panda3d.core.LQuaterniond

from panda3d.core import LQuaterniond
class LQuaterniond

Bases: LVecBase4d

This is the base quaternion class

Inheritance diagram

Inheritance diagram of LQuaterniond

__init__() → None
__init__(param0: LQuaterniond) → None
__init__(copy: LVecBase4d) → None
__init__(r: float, copy: LVecBase3d) → None
__init__(r: float, i: float, j: float, k: float) → None
static pureImaginary(v: LVector3d) → LQuaterniond
Return type

LQuaterniond

conjugate() → LQuaterniond

Returns the complex conjugate of this quat.

Return type

LQuaterniond

xform(v: LVecBase3d) → LVecBase3d

Transforms a 3-d vector by the indicated rotation

Return type

LVecBase3d

xform(v: LVecBase4d) → LVecBase4d

Transforms a 4-d vector by the indicated rotation

Return type

LVecBase4d

multiply(rhs: LQuaterniond) → LQuaterniond

actual multiply call (non virtual)

Return type

LQuaterniond

angleRad(other: LQuaterniond) → float

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

angleDeg(other: LQuaterniond) → float

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

almostEqual(other: LQuaterniond) → bool

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

almostEqual(other: LQuaterniond, threshold: float) → bool

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

isSameDirection(other: LQuaterniond) → bool

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

almostSameDirection(other: LQuaterniond, threshold: float) → bool

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

output(param0: ostream) → None
extractToMatrix(m: LMatrix3d) → None

Based on the quat lib from VRPN.

extractToMatrix(m: LMatrix4d) → None

Based on the quat lib from VRPN.

setFromMatrix(m: LMatrix3d) → None

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.

setFromMatrix(m: LMatrix4d) → None
setHpr(hpr: LVecBase3d, cs: CoordinateSystem) → None

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

getHpr(cs: CoordinateSystem) → LVecBase3d

Extracts the equivalent Euler angles from the unit quaternion.

Return type

LVecBase3d

getAxis() → LVector3d

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

Return type

LVector3d

getAxisNormalized() → LVector3d

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

Return type

LVector3d

getAngleRad() → float

This, along with getAxis(), 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.

getAngle() → float

This, along with getAxis(), 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.

setFromAxisAngleRad(angle_rad: float, axis: LVector3d) → None

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

setFromAxisAngle(angle_deg: float, axis: LVector3d) → None

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

getUp(cs: CoordinateSystem) → LVector3d

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

Return type

LVector3d

getRight(cs: CoordinateSystem) → LVector3d

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

Return type

LVector3d

getForward(cs: CoordinateSystem) → LVector3d

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

Return type

LVector3d

getR() → float
getI() → float
getJ() → float
getK() → float
setR(r: float) → None
setI(i: float) → None
setJ(j: float) → None
setK(k: float) → None
normalize() → bool
conjugateFrom(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.

conjugateInPlace() → bool

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

invertFrom(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.

invertInPlace() → bool

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

isIdentity() → bool

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

isAlmostIdentity(tolerance: float) → bool

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

static identQuat() → LQuaterniond

Returns an identity quaternion.

Return type

LQuaterniond

static getClassType() → TypeHandle
Return type

TypeHandle