Package eu.svjatoslav.sixth.e3d.math
Class TransformStack
java.lang.Object
eu.svjatoslav.sixth.e3d.math.TransformStack
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddTransform(Transform transform) Pushes a transform onto the stack.voidclear()Clears all transforms from the stack.voidPops the most recently added transform from the stack.voidTransforms a point through all transforms in the stack.
-
Constructor Details
-
TransformStack
public TransformStack()
-
-
Method Details
-
addTransform
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
Transforms a point through all transforms in the stack.- Parameters:
coordinate- the input coordinate (not modified)result- the output coordinate (receives transformed result)
-