8.4 Rotation

In the rotation operation, all the object’s points are moved in a circular motion in turn of a point (two dimensions) or an axis (three dimensions). In the general case of a three dimensional rotation, it is usual to decompose it into three successive rotations around the coordinate axes. These rotations around the \(X\), \(Y\), and \(Z\) axes are called main rotations. In Khepri, each of these rotations is performed by the rotate function that receives, as arguments, the object on which the rotation is applied, the rotation angle, and the rotation axis defined by a position and a vector. By omission, the rotation will be performed in relation to the \(Z\) axis.

This figure illustrates some combinations of translations, scales and rotations, generated by the following program:

papal_cross()

move(papal_cross(), vx(20))

move(scale(papal_cross(), 1.25), vx(40))

move(rotate(scale(papal_cross(), 1.5), pi/4), vx(60))

move(rotate(scale(papal_cross(), 1.75), pi/4, u0(), vx()), vx(80))

A papal cross of unit radius placed at the origin (on the left), transformed by the following operations (from left to right): translation, scale with translation, scale with rotation and translation and, finally, scale with rotation around the \(X\) axis and translation.

image