barsuift.simLife.tree
Class TreeStateFactory
java.lang.Object
barsuift.simLife.tree.TreeStateFactory
public class TreeStateFactory
- extends java.lang.Object
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
HEIGHT_RADIUS_RATIO
public static final int HEIGHT_RADIUS_RATIO
- See Also:
- Constant Field Values
HEIGHT_BRANCH_RADIAL_LENGTH_RATIO
public static final float HEIGHT_BRANCH_RADIAL_LENGTH_RATIO
- Ratio between the length of branches compared to the tree height
- See Also:
- Constant Field Values
TreeStateFactory
public TreeStateFactory()
createRandomTreeState
public TreeState createRandomTreeState(javax.vecmath.Point3d translationVector,
int nbBranches,
float height)
computeRandomBranchState
protected TreeBranchState computeRandomBranchState(float treeRadius,
float treeHeight)
computeBranchTranslationVector
protected javax.vecmath.Vector3d computeBranchTranslationVector(float treeRadius,
float treeHeight)
- Compute the branch translation vector.
- x=[-1;1] * treeRadius
- y=treeHeight
- z=[-1;1] * treeRadius * sin(acos(x))
- Parameters:
treeRadius - the tree radiustreeHeight - the tree height
- Returns:
- the computed translation vector
computeBranchEndPoint
protected javax.vecmath.Point3d computeBranchEndPoint(double treeHeight,
boolean goingToPositiveX,
boolean goingToPositiveZ)
- Compute the branch end point.
The end pĂ´int is computed as follows :
- x=[0-1] * HEIGHT_BRANCH_RADIAL_LENGTH_RATIO * treeHeight
- y=[0-1] * treeHeight
- z=[0-1] * HEIGHT_BRANCH_RADIAL_LENGTH_RATIO * treeHeight
- Parameters:
treeHeight - the tree heightgoingToPositiveX - true of the x should be positive, false otherwisegoingToPositiveZ - true of the z should be positive, false otherwise
- Returns:
- the computed branch end point
Copyright © 2010. All Rights Reserved.