There are three ways of specifying the rotate function:
You can specify one axis to rotate the object about. The direction is anti clockwise if you are looking towards the origin from the positive end of the axis. The angle is in degrees.
object rotate(axis around, double angle, object x);
Or you can specify an axis to rotate from and an axis to rotate towards. This rotates the object about the third axis by some angle in degrees.
object rotate(axis from, axis to, double angle, object x);
The third rotate command rotates the object to a required orientation. Two vectors are specified. It rotates the object so the original X axis moves to the direction specified by the vector fwd. It then rotates until the original Z axis of the object moves to the direction specified by the vector up.
object rotate(vector fwd, vector up, object x);
The first example is shown in figure 5 and the second example is shown in figure 6
Example 1
purple_cylinder = rotate(Z,X,90,purple_cylinder);
Or
purple_cylinder = rotate(Y,90,purple_cylinder);
Figure 5: Rotating a cylinder 90 degrees about Y or 90 degrees from Z to X.
Example 2
vector forward = {4, -3, 1), up = {-3,-1,3}; stripe_cyl = rotate(forward,up,strip_cyl);
Figure 6: Rotating a cylinder to forward = (4,-3,1) and up = (-3,-1,3).