java.lang.Object
eu.svjatoslav.sixth.e3d.renderer.raster.shapes.AbstractShape
eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.base.AbstractCompositeShape
eu.svjatoslav.sixth.e3d.examples.terrain_demo.FractalTree

public class FractalTree extends eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.base.AbstractCompositeShape
A fractal tree demonstrating hierarchical transforms in Sixth 3D.

The tree consists of a trunk and 3 level-0 branches. Each branch recursively contains 3 sub-branches (level-1), demonstrating how AbstractCompositeShape objects can be attached to each other.

Transform inheritance: Each branch has its own transform (position + rotation). When the tree is rendered, the engine propagates parent transforms to children via TransformStack. This means:

  • Level-0 branches are positioned relative to the trunk's tip
  • Level-1 sub-branches are positioned relative to their parent branch's tip
  • Parent wobble rotation automatically affects all descendants
  • Each level adds its own wobble, creating cascading animation

See Branch for the implementation of animated, recursive branching.

See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final eu.svjatoslav.sixth.e3d.renderer.raster.Color
    Brown color for tree trunk and branches (50% transparent).

    Fields inherited from class eu.svjatoslav.sixth.e3d.renderer.raster.shapes.AbstractShape

    cachedBoundingBox, mouseInteractionController
  • Constructor Summary

    Constructors
    Constructor
    Description
    FractalTree(eu.svjatoslav.sixth.e3d.geometry.Point3D basePosition, double trunkHeight, double trunkRadius)
    Creates a fractal tree with trunk and recursive branches.
  • Method Summary

    Methods inherited from class eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.base.AbstractCompositeShape

    addShape, addShape, beforeTransformHook, extractSolidPolygons, getBoundingBox, getGroup, getLocation, getSubShapesRegistry, getTransform, getViewSpaceTracker, hideGroup, intersect, removeGroup, setBackfaceCulling, setCacheNeedsRebuild, setColor, setGroupForUngrouped, setMouseInteractionController, setRootComposite, setShadingEnabled, setTransform, showGroup, subtract, transform, union

    Methods inherited from class eu.svjatoslav.sixth.e3d.renderer.raster.shapes.AbstractShape

    invalidateBounds

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • BROWN

      public static final eu.svjatoslav.sixth.e3d.renderer.raster.Color BROWN
      Brown color for tree trunk and branches (50% transparent).
  • Constructor Details

    • FractalTree

      public FractalTree(eu.svjatoslav.sixth.e3d.geometry.Point3D basePosition, double trunkHeight, double trunkRadius)
      Creates a fractal tree with trunk and recursive branches.

      The tree has 3 level-0 branches, each with 3 level-1 sub-branches (total of 9 sub-branches). Each branch animates independently with random wobble, and children inherit parent motion via transform hierarchy.

      Parameters:
      basePosition - the position of the trunk base (on terrain surface)
      trunkHeight - the height of the trunk cylinder
      trunkRadius - the radius of the trunk cylinder