LQuaterniond¶
-
class
LQuaterniond
¶ Bases:
LVecBase4d
This is the base quaternion class
Inheritance diagram
-
LQuaterniond
(void)¶
-
LQuaterniond
(LVecBase4d const ©)¶
-
LQuaterniond
(double r, LVecBase3d const ©)¶
-
LQuaterniond
(double r, double i, double j, double k)¶
-
LQuaterniond
(LQuaterniond const&) = default¶
-
bool
almost_equal
(LQuaterniond const &other) const¶
-
bool
almost_equal
(LQuaterniond const &other, double threshold) const¶ Returns true if two quaternions are memberwise equal within a default tolerance based on the numeric type.
Returns true if two quaternions are memberwise equal within a specified tolerance.
-
bool
almost_same_direction
(LQuaterniond const &other, double threshold) const¶ Returns true if two quaternions represent the same rotation within a specified tolerance.
-
double
angle_deg
(LQuaterniond const &other) const¶ Returns the angle between the orientation represented by this quaternion and the other one, expressed in degrees.
-
double
angle_rad
(LQuaterniond const &other) const¶ Returns the angle between the orientation represented by this quaternion and the other one, expressed in radians.
-
LQuaterniond
conjugate
(void) const¶ Returns the complex conjugate of this quat.
-
bool
conjugate_from
(LQuaterniond 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
conjugate_in_place
(void)¶ Sets this to be the conjugate of the current quat. Returns true if the successful, false if the quat was singular.
-
double
get_angle
(void) const¶ 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
get_angle_rad
(void) const¶ 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.
-
LVector3d
get_axis
(void) const¶ 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.
-
LVector3d
get_axis_normalized
(void) const¶ 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
get_class_type
(void)¶
-
LVector3d
get_forward
(CoordinateSystem cs = ::CS_default) const¶ Returns the orientation represented by this quaternion, expressed as a forward vector.
-
LVecBase3d
get_hpr
(CoordinateSystem cs = ::CS_default) const¶ Extracts the equivalent Euler angles from the unit quaternion.
-
double
get_i
(void) const¶
-
double
get_j
(void) const¶
-
double
get_k
(void) const¶
-
double
get_r
(void) const¶
-
LVector3d
get_right
(CoordinateSystem cs = ::CS_default) const¶ Returns the orientation represented by this quaternion, expressed as a right vector.
-
LVector3d
get_up
(CoordinateSystem cs = ::CS_default) const¶ Returns the orientation represented by this quaternion, expressed as an up vector.
-
LQuaterniond const &
ident_quat
(void)¶ Returns an identity quaternion.
-
bool
invert_from
(LQuaterniond 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
invert_in_place
(void)¶ Inverts the current quat. Returns true if the inverse is successful, false if the quat was singular.
-
bool
is_almost_identity
(double tolerance) const¶ Returns true if this quaternion represents the identity transformation within a given tolerance.
-
bool
is_identity
(void) const¶ Returns true if this quaternion represents the identity transformation: no rotation.
-
bool
is_same_direction
(LQuaterniond const &other) const¶ Returns true if two quaternions represent the same rotation within a default tolerance based on the numeric type.
-
LQuaterniond
multiply
(LQuaterniond const &rhs) const¶ actual multiply call (non virtual)
-
bool
normalize
(void)¶
-
void
output
(std::ostream&) const¶
-
static LQuaterniond
pure_imaginary
(LVector3d const &v)¶
-
void
set_from_axis_angle
(double angle_deg, LVector3d const &axis)¶ angle_deg
is the angle about the axis in degrees. axis must be normalized.
-
void
set_from_axis_angle_rad
(double angle_rad, LVector3d const &axis)¶ angle_rad
is the angle about the axis in radians. axis must be normalized.
-
void
set_from_matrix
(LMatrix4d 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.
-
void
set_hpr
(LVecBase3d const &hpr, CoordinateSystem cs = ::CS_default)¶ Sets the quaternion as the unit quaternion that is equivalent to these Euler angles. (from Real-time Rendering, p.49)
-
void
set_i
(double i)¶
-
void
set_j
(double j)¶
-
void
set_k
(double k)¶
-
void
set_r
(double r)¶
-
LVecBase3d
xform
(LVecBase3d const &v) const¶
-
LVecBase4d
xform
(LVecBase4d const &v) const¶ Transforms a 3-d vector by the indicated rotation
Transforms a 4-d vector by the indicated rotation
-