translation
Constructor of a translation transformation of type atrafo.
Signatures
- translation( vector offset )
Details
The translation transformation allows for moving an object or vector by a specified offset in space. The offset is given as a vector, where each component of the vector represents the distance to move along the corresponding axis (X, Y, Z).
This transformation is particularly useful for repositioning objects without altering their orientation or scale. It can be combined with other transformations to achieve more complex effects, such as moving an object to a new location before rotating or scaling it.
Example
make translation( <[ 0.0, -2.0, 5.0 ]> ) >> sphere()
Moves a sphere 2 units down along the Y-axis and 5 units up along the Z-axis.
Note
The translation is applied relative to the object's current position. To move an object to an absolute position, you may need to calculate the relative offset based on the object's initial location.
Parameters
- offset
-
A vector representing the distance and direction to move the object. Each component of the vector corresponds to the movement along one of the axes of the coordinate system.