|
Panda3D
|
This is the base quaternion class. More...
Public Member Functions | |
| QuatD () | |
| QuatD (VBase4D const copy) | |
| QuatD (double, double, double, double) | |
| QuatD (double, VBase3D const copy) | |
| bool | almostEqual (QuatD const other) |
| Returns true if two quaternions are memberwise equal within a default tolerance based on the numeric type. | |
| bool | almostEqual (QuatD const other, double threshold) |
| Returns true if two quaternions are memberwise equal within a specified tolerance. | |
| bool | almostSameDirection (QuatD const other, double threshold) |
| Returns true if two quaternions represent the same rotation within a specified tolerance. | |
| double | angleDeg (QuatD const other) |
| Returns the angle between the orientation represented by this quaternion and the other one, expressed in degrees. | |
| double | angleRad (QuatD const other) |
| Returns the angle between the orientation represented by this quaternion and the other one, expressed in radians. | |
| QuatD | conjugate () |
| Returns the complex conjugate of this quat. | |
| bool | conjugateFrom (QuatD const other) |
| Computes the conjugate of the other quat, and stores the result in this quat. | |
| bool | conjugateInPlace () |
| Sets this to be the conjugate of the current quat. | |
| extractToMatrix (Mat3D m) | |
| Based on the quat lib from VRPN. | |
| extractToMatrix (Mat4D m) | |
| Based on the quat lib from VRPN. | |
| double | getAngle () |
| This, along with get_axis(), returns the rotation represented by the quaternion as an angle about an arbitrary axis. | |
| double | getAngleRad () |
| This, along with get_axis(), returns the rotation represented by the quaternion as an angle about an arbitrary axis. | |
| Vec3D | getAxis () |
| This, along with get_angle(), returns the rotation represented by the quaternion as an angle about an arbitrary axis. | |
| Vec3D | getAxisNormalized () |
| This, along with get_angle(), returns the rotation represented by the quaternion as an angle about an arbitrary axis. | |
| Vec3D | getForward (CoordinateSystem cs) |
| Returns the orientation represented by this quaternion, expressed as a forward vector. | |
| Vec3D | getForward () |
| Returns the orientation represented by this quaternion, expressed as a forward vector. | |
| VBase3D | getHpr () |
| Extracts the equivalent Euler angles from the unit quaternion. | |
| VBase3D | getHpr (CoordinateSystem cs) |
| Extracts the equivalent Euler angles from the unit quaternion. | |
| double | getI () |
| double | getJ () |
| double | getK () |
| double | getR () |
| Vec3D | getRight (CoordinateSystem cs) |
| Returns the orientation represented by this quaternion, expressed as a right vector. | |
| Vec3D | getRight () |
| Returns the orientation represented by this quaternion, expressed as a right vector. | |
| Vec3D | getUp (CoordinateSystem cs) |
| Returns the orientation represented by this quaternion, expressed as an up vector. | |
| Vec3D | getUp () |
| Returns the orientation represented by this quaternion, expressed as an up vector. | |
| bool | invertFrom (QuatD const other) |
| Computes the inverse of the other quat, and stores the result in this quat. | |
| bool | invertInPlace () |
| Inverts the current quat. | |
| bool | isAlmostIdentity (double tolerance) |
| Returns true if this quaternion represents the identity transformation within a given tolerance. | |
| bool | isIdentity () |
| Returns true if this quaternion represents the identity transformation: no rotation. | |
| bool | isSameDirection (QuatD const other) |
| Returns true if two quaternions represent the same rotation within a default tolerance based on the numeric type. | |
| QuatD | multiply (QuatD const rhs) |
| actual multiply call (non virtual) | |
| bool | normalize () |
| Normalizes the vector in place. | |
| Mat4D | operator* (Mat4D const ) |
| Quat * Matrix = matrix. | |
| QuatD | operator* (double scalar) |
| QuatD | operator* (QuatD const ) |
| Mat3D | operator* (Mat3D const ) |
| Quat * Matrix = matrix. | |
| QuatD | operator*= (QuatD const ) |
| QuatD | operator+ (QuatD const other) |
| QuatD | operator- () |
| QuatD | operator- (QuatD const other) |
| QuatD | operator/ (double scalar) |
| output (ostream) | |
| setFromAxisAngle (double angle_deg, Vec3D const axis) | |
| angle_deg is the angle about the axis in degrees. | |
| setFromAxisAngleRad (double angle_rad, Vec3D const axis) | |
| angle_rad is the angle about the axis in radians. | |
| setFromMatrix (Mat4D const m) | |
| setFromMatrix (Mat3D const m) | |
| Sets the quaternion according to the rotation represented by the matrix. | |
| setHpr (VBase3D const hpr, CoordinateSystem cs) | |
| Sets the quaternion as the unit quaternion that is equivalent to these Euler angles. | |
| setHpr (VBase3D const hpr) | |
| Sets the quaternion as the unit quaternion that is equivalent to these Euler angles. | |
| setI (double i) | |
| setJ (double j) | |
| setK (double k) | |
| setR (double r) | |
| VBase3D | xform (VBase3D const v) |
| Transforms a 3-d vector by the indicated rotation. | |
| VBase4D | xform (VBase4D const v) |
| Transforms a 4-d vector by the indicated rotation. | |
Static Public Member Functions | |
| static TypeHandle | getClassType () |
| static QuatD const | identQuat () |
| Returns an identity quaternion. | |
| static QuatD | pureImaginary (Vec3D const ) |
This is the base quaternion class.
| QuatD | ( | ) |
| QuatD | ( | double | , |
| double | , | ||
| double | , | ||
| double | |||
| ) |
| bool almostEqual | ( | QuatD const | other | ) |
Returns true if two quaternions are memberwise equal within a default tolerance based on the numeric type.
| bool almostEqual | ( | QuatD const | other, |
| double | threshold | ||
| ) |
Returns true if two quaternions are memberwise equal within a specified tolerance.
| bool almostSameDirection | ( | QuatD const | other, |
| double | threshold | ||
| ) |
Returns true if two quaternions represent the same rotation within a specified tolerance.
| double angleDeg | ( | QuatD const | other | ) |
Returns the angle between the orientation represented by this quaternion and the other one, expressed in degrees.
| double angleRad | ( | QuatD const | other | ) |
Returns the angle between the orientation represented by this quaternion and the other one, expressed in radians.
| QuatD conjugate | ( | ) |
Returns the complex conjugate of this quat.
| bool conjugateFrom | ( | QuatD const | other | ) |
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.
| bool conjugateInPlace | ( | ) |
Sets this to be the conjugate of the current quat.
Returns true if the successful, false if the quat was singular.
| extractToMatrix | ( | Mat3D | m | ) |
Based on the quat lib from VRPN.
| extractToMatrix | ( | Mat4D | m | ) |
Based on the quat lib from VRPN.
| double getAngle | ( | ) |
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.
| double getAngleRad | ( | ) |
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.
| Vec3D getAxis | ( | ) |
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.
| Vec3D getAxisNormalized | ( | ) |
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 TypeHandle getClassType | ( | ) | [static] |
Reimplemented from VBase4D.
Reimplemented in LRotationd, and LOrientationd.
| Vec3D getForward | ( | CoordinateSystem | cs | ) |
Returns the orientation represented by this quaternion, expressed as a forward vector.
| Vec3D getForward | ( | ) |
Returns the orientation represented by this quaternion, expressed as a forward vector.
| VBase3D getHpr | ( | CoordinateSystem | cs | ) |
Extracts the equivalent Euler angles from the unit quaternion.
| VBase3D getHpr | ( | ) |
Extracts the equivalent Euler angles from the unit quaternion.
| double getI | ( | ) |
| double getJ | ( | ) |
| double getK | ( | ) |
| double getR | ( | ) |
| Vec3D getRight | ( | CoordinateSystem | cs | ) |
Returns the orientation represented by this quaternion, expressed as a right vector.
| Vec3D getRight | ( | ) |
Returns the orientation represented by this quaternion, expressed as a right vector.
| Vec3D getUp | ( | ) |
Returns the orientation represented by this quaternion, expressed as an up vector.
| Vec3D getUp | ( | CoordinateSystem | cs | ) |
Returns the orientation represented by this quaternion, expressed as an up vector.
| static QuatD const identQuat | ( | ) | [static] |
Returns an identity quaternion.
| bool invertFrom | ( | QuatD const | other | ) |
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.
| bool invertInPlace | ( | ) |
Inverts the current quat.
Returns true if the inverse is successful, false if the quat was singular.
| bool isAlmostIdentity | ( | double | tolerance | ) |
Returns true if this quaternion represents the identity transformation within a given tolerance.
| bool isIdentity | ( | ) |
Returns true if this quaternion represents the identity transformation: no rotation.
| bool isSameDirection | ( | QuatD const | other | ) |
Returns true if two quaternions represent the same rotation within a default tolerance based on the numeric type.
| bool normalize | ( | ) |
Normalizes the vector in place.
Returns true if the vector was normalized, false if it was a zero-length vector.
Reimplemented from VBase4D.
| QuatD operator* | ( | double | scalar | ) |
Reimplemented from VBase4D.
Reimplemented in LRotationd.
Reimplemented in LRotationd, and LOrientationd.
| QuatD operator/ | ( | double | scalar | ) |
Reimplemented from VBase4D.
Reimplemented in LRotationd.
| setFromAxisAngle | ( | double | angle_deg, |
| Vec3D const | axis | ||
| ) |
angle_deg is the angle about the axis in degrees.
axis must be normalized.
| setFromAxisAngleRad | ( | double | angle_rad, |
| Vec3D const | axis | ||
| ) |
angle_rad is the angle about the axis in radians.
axis must be normalized.
| setFromMatrix | ( | Mat3D const | m | ) |
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 | ( | Mat4D const | m | ) |
| setHpr | ( | VBase3D const | hpr | ) |
Sets the quaternion as the unit quaternion that is equivalent to these Euler angles.
(from Real-time Rendering, p.49)
| setHpr | ( | VBase3D const | hpr, |
| CoordinateSystem | cs | ||
| ) |
Sets the quaternion as the unit quaternion that is equivalent to these Euler angles.
(from Real-time Rendering, p.49)
| setI | ( | double | i | ) |
| setJ | ( | double | j | ) |
| setK | ( | double | k | ) |
| setR | ( | double | r | ) |
1.7.3