|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object | +--Lsystem
This class provides a front-end interface for creating a BranchGroup by interpreting a 2-D FRACTINT-type L-system stored in a file. (Currently, it's only been tested on the file "weed.lsys", but hey, that's a start.) For more information on L-systems, see: http://spanky.triumf.ca/www/fractint/lsys/plants.html
Example usage:
Lsystem lsystem = new Lsystem(); // construct an L-system object
lsystem.initLsys (initPoint, lineLength, initAngle);
// init. starting Lsystem parameters
lsystem.initDraw (thk, mult, cylEdges, debug);
// initialize drawing settings
lsystem.readLsystem(filename); // read rules from an L-system file
lsystem.setAppearance(branchApp, leafApp); // set branch/leaf appearance
BranchGroup lsysBg = lsystem.execute(depth);
// interpret L-system to depth "depth,"
// returning a BranchGroup
| Constructor Summary | |
Lsystem()
Constructs an L-system object with default parameters. |
|
| Method Summary | |
javax.media.j3d.BranchGroup |
execute(int depth)
Interprets the L-system. |
void |
initDraw(double thk,
double mult,
int cylEdges,
boolean debug)
Initialization parameters affecting the L-system's geometry. |
void |
initLsys(javax.vecmath.Point3d initPoint,
double lineLength,
double initAngle)
Initialization parameters of the L-system. |
boolean |
readLsystem(java.lang.String filename)
Reads an L-system contained in a file. |
void |
setAppearance(javax.media.j3d.Appearance branchApp,
javax.media.j3d.Appearance leafApp)
Sets the Appearance of the branches and leaves of the L-system. |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Constructor Detail |
public Lsystem()
| Method Detail |
public javax.media.j3d.BranchGroup execute(int depth)
depth - Number of recursive iterations of the L-system rules.
public void setAppearance(javax.media.j3d.Appearance branchApp,
javax.media.j3d.Appearance leafApp)
branchApp - Appearance of the branchesleafApp - Appearance of the leaves
public void initLsys(javax.vecmath.Point3d initPoint,
double lineLength,
double initAngle)
initPoint - starting point of L-system interpreter in 3-D spacelineLength - initial line lengthinitAngle - initial orientation in 2-D space
public void initDraw(double thk,
double mult,
int cylEdges,
boolean debug)
thk - minimum radius of the cylinders (line segments)mult - multiplier for making longer line segments thicker
(cylinder radius = thickness + mult * lineLength)cylEdges - number of edges (resolution) of the cylindersdebug - flag to turn on debugging messagespublic boolean readLsystem(java.lang.String filename)
filename - the name of the file.
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||