Skip to main content
`Ctrl`+`K`

# vispy.util.quaternion module

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

  Bases: `object`

  A quaternion is a mathematically convenient way to describe rotations.

  conjugate()

    Obtain the conjugate of the quaternion.

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

  copy()

    Create an exact copy of this quaternion.

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

    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)

    Classmethod to create a quaternion given the euler angles.

  exp()

    Returns the exponent of the quaternion. (not tested)

  get_axis_angle()

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

  get_matrix()

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

  inverse()

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

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

  log()

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

  norm()

    Returns the norm of the quaternion

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

  normalize()

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

  rotate_point(p)

    Rotate a Point instance using this quaternion.