Previous Up Next

12.14.4  Rotation in space: rotation

See section 11.15.4 for rotations in the plane.

The rotation command takes two or three arguments. The first argument is a line which is the axis of rotation and the second argument is a real number representing the angle of rotation. The third optional argument is a geometric object.

With two arguments, rotation returns a command which rotates an object.
Input:

r := rotation(line(point(0,0,0),point(1,1,1)), 2*pi/3)

then:

r(point(0,0,1))

returns and draws the result of rotating the point (0,0,1) about the line through (0,0,0) and (1,1,1) through an angle of 2π/3 radians; namely (1,0,0).

Given a third argument of a geometric object, rotation returns and draws the rotated object.
Input:

rotation(line(point(0,0,0),point(1,1,1)), 2*pi/3, point(0,0,1))

returns and draws the point (1,0,0), as above.

Input:

rotation(line(point(0,0,0),point(1,1,1)), 2*pi/3,
line(point(1,0,0),point(0,1,0)))

returns and draws the result of rotating the line through (1,0,0) and (0,1,0) about the line through (0,0,0) and (1,1,1) through an angle of 2π/3 radians; namely the line through (0,1,0) and (0,0,1).


Previous Up Next