Class TransformStack

java.lang.Object
eu.svjatoslav.sixth.e3d.math.TransformStack

public class TransformStack extends Object
Stack of transforms applied to points during rendering.

Transforms are applied in reverse order (last added is applied first). This supports hierarchical scene graphs where child objects are positioned relative to their parent objects.

Example:

 There is a ship in the sea. The ship moves along the sea and every object
 on the ship moves with it. Inside the ship there is a car. The car moves
 along the ship and every object on the car moves with it.

 To calculate the world position of an object inside the car:
 1. Apply object's position relative to the car
 2. Apply car's position relative to the ship
 3. Apply ship's position relative to the world
 
See Also:
  • Constructor Details

    • TransformStack

      public TransformStack()
  • Method Details

    • addTransform

      public void addTransform(Transform transform)
      Pushes a transform onto the stack.
      Parameters:
      transform - the transform to push
    • clear

      public void clear()
      Clears all transforms from the stack.
    • dropTransform

      public void dropTransform()
      Pops the most recently added transform from the stack.
    • transform

      public void transform(Point3D coordinate, Point3D result)
      Transforms a point through all transforms in the stack.
      Parameters:
      coordinate - the input coordinate (not modified)
      result - the output coordinate (receives transformed result)