#include <Quat.h>
Inheritance diagram for Physsim::Quat:

Public Member Functions | |
| Quat () | |
| Default constructor. | |
| Quat (Real x, Real y, Real z, Real w) | |
| Constructs a quaternion from four Real values. | |
| Quat (boost::shared_array< const Real > q) | |
| Constructs a quaternion from a Real array of length 4. | |
| Quat (const Quat &q) | |
| Copy constructor. | |
| Quat (const VectorN &v) | |
| Constructs a quaternion from a vector. | |
| Quat (const Matrix3 *m) | |
| Constructs a quaternion from a rotation matrix. | |
| Quat (const Matrix4 *m) | |
| Constructs a quaternion from a transformation matrix. | |
| Quat (const AAngle *a) | |
| Constructs a quaternion from an axis-angle object. | |
| void | conjugate () |
| Negates the value of each of the x, y, and z coordinates in place. | |
| bool | epsilon_equals (const Quat &q, Real epsilon) |
| Determines whether this quaternion is equal to another within the given tolerance. | |
| void | slerp (const Quat &q, Real alpha) |
| Performs spherical linear interpolation between this and q. | |
| void | inverse () |
| Computes the inverse orientation represented by this quaternion in place. | |
| void | normalize () |
| Normalizes this quaternion in place. | |
| void | set (const VectorN &v) |
| void | set (const AAngle *a) |
| Sets this to that represented by an axis-angle representation. | |
| void | set (const Matrix3 *m) |
| Sets this quaternion to that represented by a rotation matrix. | |
| void | set (const Matrix4 *m) |
| Sets this quaternion to that represented by the rotation component of a transformation matrix. | |
| Quat | operator- (const Quat &q) const |
| Subtracts a quaternion from this. | |
| void | operator-= (const Quat &q) |
| Subtracts one quaternion from another. | |
| Quat | operator+ (const Quat &q) const |
| Adds this quaternion to another and returns the result in a new quaternion. | |
| void | operator+= (const Quat &q) |
| Adds this quaon to another and stores the result in this. | |
| void | operator= (const Quat &q) |
| Copy operator. | |
| Quat | operator * (const Quat &q) const |
| Multiplies this by q and returns the result. | |
| Quat | operator * (Real scalar) const |
| Multiplies a quaternion by a scalar. | |
| void | operator *= (const Quat &q) |
| Multiplies this by q and stores the result in this. | |
| void | operator *= (Real scalar) |
| Multiplies a quaternion by a scalar and stores the result in this. | |
| Real | magnitude () const |
| Calculates the magnitude of a quaternion. | |
Static Public Member Functions | |
| static Quat | zero () |
| Constructs a zero quaternion. | |
| static Quat | conjugate (const Quat &q) |
| Negates the value of each of the x, y, and z coordinates of the given quaternion. | |
| static bool | epsilon_equals (const Quat &q1, const Quat &q2, Real epsilon) |
| Determines whether to quaternions are equal to within the given tolerance. | |
| static Quat | slerp (const Quat &q1, const Quat &q2, Real alpha) |
| Performs spherical linear interpolation between this and q. | |
| static Quat | inverse (const Quat &q) |
| Computes the inverse orientation of a quaternion. | |
| static Quat | normalize (const Quat &q) |
| Computes the normalized quaternion of q. | |
| static Quat | deriv (const Quat &q, const Vector3 &w) |
| Computes the derivative of a quaternion given current orientation and angular velocity. | |
| static Vector3 | to_omega (const Quat &q, const Quat &qd) |
| Computes the angular velocity of a body given the current quaternion orientation and the quaternion velocity. | |
Public Attributes | |
| Real | _x |
| First quaternion component. | |
| Real | _y |
| Second quaternion component. | |
| Real | _z |
| Third quaterion component. | |
| Real | _w |
| Fourth quaternion component. | |
This class is used to represent orientation via unit quaternions. Note, however, that the user is responsible for normalizing the quaternions; normalization is not automatic.
| Quat::Quat | ( | ) |
Default constructor.
Quaternion constructed as [0,0,0] 1
| Quat::Quat | ( | Real | x, | |
| Real | y, | |||
| Real | z, | |||
| Real | w | |||
| ) |
Constructs a quaternion from four Real values.
| x | the first component of the vector | |
| y | the second component of the vector | |
| z | the third component of the vector | |
| w | the scalar component of the quaternion |
| Quat::Quat | ( | const VectorN & | v | ) |
Constructs a quaternion from a vector.
| v | a four-dimensional vector (components 0..2 are the vector component, component 3 is the angular component) |
Negates the value of each of the x, y, and z coordinates of the given quaternion.
| q | the quaternion from which the conjugate is to be computed |
| void Quat::slerp | ( | const Quat & | q, | |
| Real | alpha | |||
| ) |
Performs spherical linear interpolation between this and q.
Sets the orientation represented by this quaternion to a linear interpolated orientation between this and q. If alpha is 0, then *this is unaltered. If alpha is 1, then *this is set to q.
| q | the "final" orientation | |
| alpha | interpolation value (0 <= alpha <= 1) |
Performs spherical linear interpolation between this and q.
Calculates the orientation of determined by linear interpolation between q1 and q2. If alpha is 0, then q1 is returned. If alpha is 1, then q2 is returned.
| q1 | the "initial" orientation | |
| q2 | the "final" orientation | |
| alpha | interpolation value (0 <= alpha <= 1) |
| void Quat::set | ( | const VectorN & | v | ) |
| v | a four-dimensional vector (components 0..2 are the vector component, component 3 is the angular component) |
Computes the derivative of a quaternion given current orientation and angular velocity.
Note that the derivative is not generally a unit quaternion.
| q | the current orientation | |
| w | the angular velocity |
1.5.1