# LQuaterniond

```from panda3d.core import LQuaterniond
```
class LQuaterniond

Bases:

Bases: `LVecBase4d`

This is the base quaternion class

Inheritance diagram

__add__(other: LQuaterniond)
__div__(scalar: float)
__imul__(param0: LQuaterniond)
__init__()
__init__(param0: LQuaterniond)
__init__(copy: LVecBase4d)
__init__(r: float, copy: LVecBase3d)
__init__(r: float, i: float, j: float, k: float)
__mul__(param0: LMatrix3d)
__mul__(param0: LMatrix4d)
__mul__(param0: LQuaterniond)
__mul__(scalar: float)
__pow__(param0: float)

Returns a new quaternion that represents this quaternion raised to the given power.

__sub__(other: LQuaterniond)
__sub__(other: LQuaterniond)
almost_equal(other: LQuaterniond) bool

Returns true if two quaternions are memberwise equal within a default tolerance based on the numeric type.

almost_equal(other: LQuaterniond, threshold: float) bool

Returns true if two quaternions are memberwise equal within a specified tolerance.

almost_same_direction(other: LQuaterniond, threshold: float) bool

Returns true if two quaternions represent the same rotation within a specified tolerance.

angle_deg(other: LQuaterniond)

Returns the angle between the orientation represented by this quaternion and the other one, expressed in degrees.

angle_rad(other: LQuaterniond)

Returns the angle between the orientation represented by this quaternion and the other one, expressed in radians.

conjugate()

Returns the complex conjugate of this quat.

conjugate_from(other: LQuaterniond) bool

Computes the conjugate of the other quat, and stores the result in this quat. This is a fully general operation and makes no assumptions about the type of transform represented by the quat.

The other quat must be a different object than this quat. However, if you need to get a conjugate of a quat in place, see `conjugate_in_place()`.

The return value is true if the quat was successfully inverted, false if there was a singularity.

conjugate_in_place() bool

Sets this to be the conjugate of the current quat. Returns true if the successful, false if the quat was singular.

extract_to_matrix(m: LMatrix3d)

Based on the quat lib from VRPN.

extract_to_matrix(m: LMatrix4d)

Based on the quat lib from VRPN.

get_angle()

This, along with `get_axis()`, returns the rotation represented by the quaternion as an angle about an arbitrary axis. This returns the angle, in degrees counterclockwise about the axis.

It is necessary to ensure the quaternion has been normalized (for instance, with a call to `normalize()`) before calling this method.

get_angle_rad()

This, along with `get_axis()`, returns the rotation represented by the quaternion as an angle about an arbitrary axis. This returns the angle, in radians counterclockwise about the axis.

It is necessary to ensure the quaternion has been normalized (for instance, with a call to `normalize()`) before calling this method.

get_axis()

This, along with `get_angle()`, returns the rotation represented by the quaternion as an angle about an arbitrary axis. This returns the axis; it is not normalized.

get_axis_normalized()

This, along with `get_angle()`, returns the rotation represented by the quaternion as an angle about an arbitrary axis. This returns the normalized axis.

static get_class_type()
get_forward(cs: CoordinateSystem)

Returns the orientation represented by this quaternion, expressed as a forward vector.

get_hpr(cs: CoordinateSystem)

Extracts the equivalent Euler angles from the unit quaternion.

get_i()
get_j()
get_k()
get_r()
get_right(cs: CoordinateSystem)

Returns the orientation represented by this quaternion, expressed as a right vector.

get_up(cs: CoordinateSystem)

Returns the orientation represented by this quaternion, expressed as an up vector.

static ident_quat()

Returns an identity quaternion.

invert_from(other: LQuaterniond) bool

Computes the inverse of the other quat, and stores the result in this quat. This is a fully general operation and makes no assumptions about the type of transform represented by the quat.

The other quat must be a different object than this quat. However, if you need to invert a quat in place, see `invert_in_place()`.

The return value is true if the quat was successfully inverted, false if there was a singularity.

invert_in_place() bool

Inverts the current quat. Returns true if the inverse is successful, false if the quat was singular.

is_almost_identity(tolerance: float) bool

Returns true if this quaternion represents the identity transformation within a given tolerance.

is_identity() bool

Returns true if this quaternion represents the identity transformation: no rotation.

is_same_direction(other: LQuaterniond) bool

Returns true if two quaternions represent the same rotation within a default tolerance based on the numeric type.

multiply(rhs: LQuaterniond)

actual multiply call (non virtual)

normalize() bool
output(param0: ostream)
static pure_imaginary(v: LVector3d)
set_from_axis_angle(angle_deg: float, axis: LVector3d)

`angle_deg()` is the angle about the axis in degrees. axis must be normalized.

set_from_axis_angle_rad(angle_rad: float, axis: LVector3d)

`angle_rad()` is the angle about the axis in radians. axis must be normalized.

set_from_matrix(m: LMatrix3d)

Sets the quaternion according to the rotation represented by the matrix. Originally we tried an algorithm presented by Do-While Jones, but that turned out to be broken. This is based on the quat lib from UNC.

set_from_matrix(m: LMatrix4d)
set_hpr(hpr: LVecBase3d, cs: CoordinateSystem)

Sets the quaternion as the unit quaternion that is equivalent to these Euler angles. (from Real-time Rendering, p.49)

set_i(i: float)
set_j(j: float)
set_k(k: float)
set_r(r: float)
xform(v: LVecBase3d)

Transforms a 3-d vector by the indicated rotation

xform(v: LVecBase4d)

Transforms a 4-d vector by the indicated rotation