Transformations
Translate
translate{ //number of units to move in each of the x, y and z directions }
For example:
sphere { <0, 0, 0>, 1 pigment { Salmon } translate <2, 0, 0> //move 2 units along x-axis }
Scale
scale{ //amount of scaling in each of the x, y and z directions. }
For example:
sphere { <0, 0, 0>, 1 pigment { Salmon } scale <2, 2, 2> //scale height, width & depth 200% }
Rotation
rotate{ //degrees of rotation along each of the x, y and z axis. }
Rotations occur about the x-axis first, then the y-axis, then the z-axis. Rotation is always performed relative to the axis, so if an object is not sitting on the actual axis of rotation, it will orbit about the axis when rotated (the same distance away from where it started):
box { <0, 0, 0>, // Near lower left corner <1, 1, 1> // Far upper right corner pigment { Yellow } rotate <-20, 0, 0> // -20 degrees around X axis rotate <0, 30, 0> // 30 degrees around Y axis rotate <0, 0, 10> // 10 degrees around Z axis }
Challenges
- translate a donut shape
- squish a sphere into a pancake using scale on only one axis
- draw a cube using box object then rotate it so it looks like a diamond