Class Branch
Demonstrates hierarchical transforms in Sixth 3D: each branch has its own transform (position + rotation), and sub-branches are added as child composites. The engine automatically propagates parent transforms to children via TransformStack.
Each branch wobbles around its local axes with random phase offsets. Parent wobble is automatically inherited by children, creating cascading motion.
- See Also:
-
Field Summary
Fields inherited from class eu.svjatoslav.sixth.e3d.renderer.raster.shapes.AbstractShape
cachedBoundingBox, mouseInteractionController -
Constructor Summary
ConstructorsConstructorDescriptionBranch(eu.svjatoslav.sixth.e3d.geometry.Point3D startPosition, int level, int branchIndex, double parentHeight, double parentRadius) Creates a branch with optional recursive sub-branches. -
Method Summary
Modifier and TypeMethodDescriptionvoidbeforeTransformHook(eu.svjatoslav.sixth.e3d.math.TransformStack transformPipe, eu.svjatoslav.sixth.e3d.gui.RenderingContext context) Animates this branch with wobble around its local axes.Methods inherited from class eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.base.AbstractCompositeShape
addShape, addShape, extractSolidPolygons, getBoundingBox, getGroup, getLocation, getSubShapesRegistry, getTransform, getViewSpaceTracker, hideGroup, intersect, removeGroup, setBackfaceCulling, setCacheNeedsRebuild, setColor, setGroupForUngrouped, setMouseInteractionController, setRootComposite, setShadingEnabled, setTransform, showGroup, subtract, transform, unionMethods inherited from class eu.svjatoslav.sixth.e3d.renderer.raster.shapes.AbstractShape
invalidateBounds
-
Constructor Details
-
Branch
public Branch(eu.svjatoslav.sixth.e3d.geometry.Point3D startPosition, int level, int branchIndex, double parentHeight, double parentRadius) Creates a branch with optional recursive sub-branches.The branch is positioned at the given start point relative to its parent. In local coordinates, the branch cylinder extends from origin to a calculated endpoint. The Transform positions and rotates this local geometry.
- Parameters:
startPosition- position relative to parent where this branch attacheslevel- recursion level (0 = first branch level, 1 = sub-branches)branchIndex- index among siblings (0, 1, or 2) determines angle around parentparentHeight- height of parent (for scaling this branch)parentRadius- radius of parent (for scaling this branch)
-
-
Method Details
-
beforeTransformHook
public void beforeTransformHook(eu.svjatoslav.sixth.e3d.math.TransformStack transformPipe, eu.svjatoslav.sixth.e3d.gui.RenderingContext context) Animates this branch with wobble around its local axes.Parent's wobble is automatically inherited via TransformStack - no special code needed. Each branch adds its own wobble contribution, creating cascading motion that flows down the tree structure.
The wobble is added to the base orientation, so the branch oscillates around its default outward-facing position.
- Overrides:
beforeTransformHookin classeu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.base.AbstractCompositeShape- Parameters:
transformPipe- the current transform stack (contains parent transforms)context- the rendering context with frame number for animation
-