Package eu.svjatoslav.sixth.e3d.math
Class TransformsStack
java.lang.Object
eu.svjatoslav.sixth.e3d.math.TransformsStack
It is used to store and apply transforms to points. Transforms are applied in the reverse order they were added to the pipeline. Transforms are stacked and then every point is affected by every transform in this stack. This is needed to support feature where objects in the world are attached to and are relative to each other. Example: There is a ship it the sea. Ship moves along the sea and every object on the ship moves with it. Inside the ship there is a car. Car moves along the ship and every object on the car moves with it. So to calculate an absolute location in the world of particular object within a car, we must take into account object location relative to the car, car location relative to the ship, and ship location relative to the world.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addTransform
(Transform transform) Adds a transform to the pipeline.void
clear()
Clears the pipeline.void
Drops the last transform from the pipeline.void
Transforms a point.
-
Constructor Details
-
TransformsStack
public TransformsStack()
-
-
Method Details
-
addTransform
Adds a transform to the pipeline.- Parameters:
transform
- The transform to add.
-
clear
public void clear()Clears the pipeline. -
dropTransform
public void dropTransform()Drops the last transform from the pipeline. -
transform
Transforms a point.- Parameters:
coordinate
- Coordinate to be transformed into result. Original input coordinate is not modified.result
- Resulting transformed point. For efficiency reasons, result is stored into preexisting object that is passed here as an argument to avoid memory allocation.
-