LQuaternionf¶
from panda3d.core import LQuaternionf
-
class
LQuaternionf
¶ Bases:
LVecBase4f
This is the base quaternion class
Inheritance diagram
-
__add__
(other: LQuaternionf) → LQuaternionf¶
-
__div__
(scalar: float) → LQuaternionf¶
-
__imul__
(param0: LQuaternionf) → LQuaternionf¶
-
__init__
()¶
-
__init__
(param0: LQuaternionf)
-
__init__
(copy: LVecBase4f)
-
__init__
(r: float, copy: LVecBase3f)
-
__mul__
(param0: LQuaternionf) → LQuaternionf
-
__mul__
(scalar: float) → LQuaternionf
-
__pow__
(param0: float) → LQuaternionf¶ Returns a new quaternion that represents this quaternion raised to the given power.
-
__sub__
(other: LQuaternionf) → LQuaternionf¶
-
__sub__
(other: LQuaternionf) → LQuaternionf¶
-
almostEqual
(other: LQuaternionf) → bool¶ Returns true if two quaternions are memberwise equal within a default tolerance based on the numeric type.
-
almostEqual
(other: LQuaternionf, threshold: float) → bool Returns true if two quaternions are memberwise equal within a specified tolerance.
-
almostSameDirection
(other: LQuaternionf, threshold: float) → bool¶ Returns true if two quaternions represent the same rotation within a specified tolerance.
-
angleDeg
(other: LQuaternionf) → float¶ Returns the angle between the orientation represented by this quaternion and the other one, expressed in degrees.
-
angleRad
(other: LQuaternionf) → float¶ Returns the angle between the orientation represented by this quaternion and the other one, expressed in radians.
-
conjugate
() → LQuaternionf¶ Returns the complex conjugate of this quat.
-
conjugateFrom
(other: LQuaternionf) → 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
conjugateInPlace()
.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.
-
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.
-
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.
-
getAxis
() → LVector3f¶ 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.
-
getAxisNormalized
() → LVector3f¶ This, along with
getAngle()
, returns the rotation represented by the quaternion as an angle about an arbitrary axis. This returns the normalized axis.
-
static
getClassType
() → TypeHandle¶
-
getForward
(cs: CoordinateSystem) → LVector3f¶ Returns the orientation represented by this quaternion, expressed as a forward vector.
-
getHpr
(cs: CoordinateSystem) → LVecBase3f¶ Extracts the equivalent Euler angles from the unit quaternion.
-
getRight
(cs: CoordinateSystem) → LVector3f¶ Returns the orientation represented by this quaternion, expressed as a right vector.
-
getUp
(cs: CoordinateSystem) → LVector3f¶ Returns the orientation represented by this quaternion, expressed as an up vector.
-
static
identQuat
() → LQuaternionf¶ Returns an identity quaternion.
-
invertFrom
(other: LQuaternionf) → 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
invertInPlace()
.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.
-
isAlmostIdentity
(tolerance: float) → bool¶ Returns true if this quaternion represents the identity transformation within a given tolerance.
-
isIdentity
() → bool¶ Returns true if this quaternion represents the identity transformation: no rotation.
-
isSameDirection
(other: LQuaternionf) → bool¶ Returns true if two quaternions represent the same rotation within a default tolerance based on the numeric type.
-
multiply
(rhs: LQuaternionf) → LQuaternionf¶ actual multiply call (non virtual)
-
static
pureImaginary
(v: LVector3f) → LQuaternionf¶
-
setFromAxisAngle
(angle_deg: float, axis: LVector3f) → None¶ angleDeg()
is the angle about the axis in degrees. axis must be normalized.
-
setFromAxisAngleRad
(angle_rad: float, axis: LVector3f) → None¶ angleRad()
is the angle about the axis in radians. axis must be normalized.
-
setFromMatrix
(m: LMatrix3f) → 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.
-
setHpr
(hpr: LVecBase3f, cs: CoordinateSystem) → None¶ Sets the quaternion as the unit quaternion that is equivalent to these Euler angles. (from Real-time Rendering, p.49)
-
xform
(v: LVecBase3f) → LVecBase3f¶ Transforms a 3-d vector by the indicated rotation
-
xform
(v: LVecBase4f) → LVecBase4f Transforms a 4-d vector by the indicated rotation
-