Rotation

_images/rotated_box.png

rotate() method

Graphical objects may be rotated by invoking the rotate() method of the object:

myobject.rotate(axis=vec(0, 1, 0), angle=pi / 3, origin=vec(0, 0, 0))
Parameters:
  • axis (vector) – The axis about which the object is to be rotated. Default is myobject.axis.

  • angle (scalar) – The angle of rotation in radians, counterclockwise using a right-hand rule (thumb in direction of rotation axis, fingers curl in direction of rotation).

  • origin (vector) – The rotation axis goes through the origin. Default is myobject.pos.

rotate() function

Alternatively, the rotate() function works the same way:

rotate(myobject, axis=vec(0, 1, 0), angle=pi / 3, origin=vec(0, 0, 0))
Parameters:
  • firstargument (object) – Object name.

  • axis (vector) – The axis about which the object is to be rotated. Default is myobject.axis.

  • angle (scalar) – The angle of rotation in radians, counterclockwise using a right-hand rule (thumb in direction of rotation axis, fingers curl in direction of rotation).

  • origin (vector) – The rotation axis goes through the origin. Default is myobject.pos.

Vectors may also be rotated, see vectors.