|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.generation5.bio.LSystem
The class provides basic L-System functionality.
| Constructor Summary | |
LSystem()
Default constructor. |
|
LSystem(java.lang.String initial)
Constructor with initial rule specifier (axiom) |
|
| Method Summary | |
protected void |
drawLSystem(java.lang.String strLSystem,
double angle,
int depth,
java.awt.Graphics graphics)
Draws the L-System itself. |
java.lang.String |
getAxiom()
Retrieve the axiom used. |
java.lang.String |
getRule(char replace)
Retrieve the rule for the specified letter. |
void |
initializeRules()
Initializes the rules to be self-referential, essentially resetting them. |
static void |
main(java.lang.String[] args)
Test function that writes a couple of simple L-System examples of varying types as well as depths. |
void |
render(java.awt.Graphics graphics,
int pw,
int ph)
Draw the L-System. |
void |
setAxiom(java.lang.String axiom)
Set the axiom. |
void |
setBackground(java.awt.Color back)
Set the background colour. |
void |
setDepth(int depth)
Set the maximum depth the L-System should recursively draw. |
void |
setForeground(java.awt.Color fore)
Set the foreground colour. |
void |
setParameters(double angle,
double initAngle,
int seg,
double step)
Set the parameters for the L-System. |
void |
setRule(char replace,
java.lang.String rule)
Set the rule for the given character. |
void |
setStartPoint(int sx,
int sy)
Set the initial starting point to draw the L-System at. |
void |
writeImage(java.lang.String filename,
int width,
int height)
Write the L-System to an image file. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public LSystem()
public LSystem(java.lang.String initial)
initial - Initial rule (the axiom).| Method Detail |
public void initializeRules()
public void setAxiom(java.lang.String axiom)
axiom - the axiom to use.public java.lang.String getAxiom()
public void setRule(char replace,
java.lang.String rule)
replace - the letter of the rule.rule - the rule itself.public java.lang.String getRule(char replace)
replace - the rule to retrieve.
public void setParameters(double angle,
double initAngle,
int seg,
double step)
angle - the angle at which the +/- parameters rotate the L-System by.initAngle - the initial angle the L-System starts at.seg - the segment length.step - the step size. This is the amount the L-System should multiply the step
size by for different depth.public void setDepth(int depth)
depth - the depth.
public void setStartPoint(int sx,
int sy)
sx - the starting x-point.sy - the starting y-point.
public void render(java.awt.Graphics graphics,
int pw,
int ph)
render in interface Visualizablegraphics - the graphics context.pw - the context width.ph - the context height.
protected void drawLSystem(java.lang.String strLSystem,
double angle,
int depth,
java.awt.Graphics graphics)
strLSystem - the L-System axiom.angle - the current angle.depth - the current depth.graphics - the graphics context.public void setBackground(java.awt.Color back)
back - the background colour.public void setForeground(java.awt.Color fore)
fore - the foreground colour.
public void writeImage(java.lang.String filename,
int width,
int height)
writeImage in interface Visualizablefilename - the filename to write.width - the width of the image.height - the height of the image.public static void main(java.lang.String[] args)
args - no arguments required.
|
This documentation is part of the Generation5 JDK.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||