Rotation.from_axis_and_angle

classmethod Rotation.from_axis_and_angle(axis, angle, point=[0, 0, 0])

Construct a rotation transformation from a rotation axis and an angle and an optional point of rotation.

The rotation is based on the right hand rule, i.e. anti-clockwise if the axis of rotation points towards the observer.

Parameters
  • axis ([float, float, float] | compas.geometry.Vector) – Three numbers that represent the axis of rotation.

  • angle (float) – The rotation angle in radians.

  • point ([float, float, float] | compas.geometry.Point) – A point to perform a rotation around an origin other than [0, 0, 0].

Returns

compas.geometry.Rotation

Notes

The rotation is based on the right hand rule, i.e. anti-clockwise if the axis of rotation points towards the observer.

Examples

>>> axis1 = normalize_vector([-0.043, -0.254, 0.617])
>>> angle1 = 0.1
>>> R = Rotation.from_axis_and_angle(axis1, angle1)
>>> axis2, angle2 = R.axis_and_angle
>>> allclose(axis1, axis2)
True
>>> allclose([angle1], [angle2])
True