vispy.util.quaternion module

class vispy.util.quaternion.Quaternion(w=1, x=0, y=0, z=0, normalize=True)[source]

Bases: object

A quaternion is a mathematically convenient way to describe rotations.

conjugate()[source]

Obtain the conjugate of the quaternion.

This is simply the same quaternion but with the sign of the imaginary (vector) parts reversed.

copy()[source]

Create an exact copy of this quaternion.

classmethod create_from_axis_angle(angle, ax, ay, az, degrees=False)[source]

Classmethod to create a quaternion from an axis-angle representation. (angle should be in radians).

classmethod create_from_euler_angles(rx, ry, rz, degrees=False)[source]

Classmethod to create a quaternion given the euler angles.

exp()[source]

Returns the exponent of the quaternion. (not tested)

get_axis_angle()[source]

Get the axis-angle representation of the quaternion. (The angle is in radians)

get_matrix()[source]

Create a 4x4 homography matrix that represents the rotation of the quaternion.

inverse()[source]

Returns q.conjugate()/q.norm()**2

So if the quaternion is unit length, it is the same as the conjugate.

log()[source]

Returns the natural logarithm of the quaternion. (not tested)

norm()[source]

Returns the norm of the quaternion

norm = w**2 + x**2 + y**2 + z**2

normalize()[source]

Returns a normalized (unit length) version of the quaternion.

rotate_point(p)[source]

Rotate a Point instance using this quaternion.