Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

nvmath::Quatf Class Reference

Quaternion class. More...

#include <Quatf.h>

List of all members.

Public Member Functions

NVSG_API Quatf (void)
 Default constructor.
NVSG_API Quatf (const Vec4f &v)
 Constructor using a Vec4f.
NVSG_API Quatf (float f0, float f1, float f2, float f3)
 Constructor using four floats.
NVSG_API Quatf (const Vec3f &axis, float angle)
 Constructor using an axis and an angle.
NVSG_API Quatf (const Vec3f &vec0, const Vec3f &vec1)
 Constructor by two vectors.
NVSG_API float & operator[] (size_t i)
 Non-constant subscript operator.
NVSG_API const float & operator[] (size_t i) const
 Constant subscript operator.
NVSG_API Quatfoperator= (const Quatf &q)
 Assignment operator.
NVSG_API bool operator== (const Quatf &q) const
 Equality operator.
NVSG_API bool operator!= (const Quatf &q) const
 Inequality operator.
NVSG_API Quatfoperator+= (const Quatf &q)
 Quaternion addition and assignment operator.
NVSG_API Quatfoperator-= (const Quatf &q)
 Quaternion subtraction and assignment operator.
NVSG_API Quatf operator- (const Quatf &q) const
 Quaternion subtraction operator.
NVSG_API Quatf operator- (void) const
 Negation operator.
NVSG_API Quatfoperator *= (float f)
 Quaternion multiplication with a scalar and assignment operator.
NVSG_API Quatf operator * (float f) const
 Quaternion multiplication with a scalar operator.
NVSG_API Quatfoperator *= (const Quatf &q)
 Quaternion multiplication with a quaternion (i.e. concatenation) and assignment operator.
NVSG_API Quatf operator * (const Quatf &q) const
 Quaternion multiplication with a quaternion (i.e. concatenation) operator.
NVSG_API Quatfoperator/= (float f)
 Quaternion division by a scalar and assignment operator.
NVSG_API Quatf operator/ (float f) const
 Quaternion division by a scalar operator.
NVSG_API Quatfoperator/= (const Quatf &q)
 Quaternion division by a quaternion and assignment operator.
NVSG_API Quatf operator/ (const Quatf &q) const
 Quaternion division by a quaternion operator.
NVSG_API Quatf operator~ (void) const
 Quaternion conjugation operator.
NVSG_API void invert (void)
 Invert the quaternion.
NVSG_API Quatfnormalize (void)
 Normalize the quaternion.

Related Functions

(Note that these are not member functions.)

void decompose (const Quatf &q, Vec3f &axis, float &angle)
float distance (const Quatf &q0, const Quatf &q1)
float magnitude (const Quatf &q)
bool isNormalized (const Quatf &q)
bool isNull (const Quatf &q)
Quatf operator * (float f, const Quatf &q)
Vec3f operator * (const Quatf &q, const Vec3f &v)
template<>
NVSG_API Quatf lerp (float alpha, const Quatf &q0, const Quatf &q1)


Detailed Description

Quaternion class.

Quaternions add a fourth element to the [x,y,z] values that define a three-component vector. Quaternions are an alternative to the matrix methods that are typically used for 3-D rotations. A quaternion represents an axis in 3-D space and a rotation around that axis. For example, a quaternion might represent a (1,1,2) axis and a rotation of 1 radian.

Note:
Only unit quaternions represent a rotation. We always expect unit quaternions.


Constructor & Destructor Documentation

nvmath::Quatf::Quatf void   )  [inline]
 

Default constructor.

For performance reasons no initialization is performed.

nvmath::Quatf::Quatf const Vec4f v  )  [inline]
 

Constructor using a Vec4f.

A quaternion with the same values as v is constructed.

Parameters:
v  vector to construct from

nvmath::Quatf::Quatf float  f0,
float  f1,
float  f2,
float  f3
[inline]
 

Constructor using four floats.

A quaternion with the given values is constructed.

Note:
f0, f1, and f2 are not the x,y,z-component of the rotation axis, and f3 is not the rotation angle. If you have such values handy, use the constructor that takes the axis as a Vec3f and an angle.
Parameters:
f0  x component of the new quaternion
f1  y component of the new quaternion
f2  z component of the new quaternion
f3  w component of the new quaternion

nvmath::Quatf::Quatf const Vec3f axis,
float  angle
[inline]
 

Constructor using an axis and an angle.

A quaternion is constructed through a normalized axis and an angle.

Parameters:
axis  axis to use for quaternion
angle  rotation angle in radians

nvmath::Quatf::Quatf const Vec3f vec0,
const Vec3f vec1
[inline]
 

Constructor by two vectors.

A quaternion is constructed that is the rotation that maps vec0 to vec1.

Parameters:
vec0  start vector
vec1  end vector


Member Function Documentation

float & nvmath::Quatf::operator[] size_t  i  )  [inline]
 

Non-constant subscript operator.

Returns:
reference to i th element of the quaternion
Parameters:
i  index to quaternion to use (i=0,1,2,3)

const float & nvmath::Quatf::operator[] size_t  i  )  const [inline]
 

Constant subscript operator.

Returns:
constant reference to i th element of the quaternion
Parameters:
i  index to quaternion to use (i=0,1,2,3)

Quatf & nvmath::Quatf::operator= const Quatf q  )  [inline]
 

Assignment operator.

Returns:
reference to the assigned quaternion
Parameters:
q  copy q to the quaternion

bool nvmath::Quatf::operator== const Quatf q  )  const [inline]
 

Equality operator.

Returns:
true if the quaternion is equal to q, otherwise false
Parameters:
q  quaternion to compare

bool nvmath::Quatf::operator!= const Quatf q  )  const [inline]
 

Inequality operator.

Returns:
true if the quaternion is not equal to q, otherwise false
Parameters:
q  quaternion to compare

NVSG_API Quatf& nvmath::Quatf::operator+= const Quatf q  ) 
 

Quaternion addition and assignment operator.

Returns:
reference to the assigned quaternion after addition
Parameters:
q  quaternion to add

NVSG_API Quatf& nvmath::Quatf::operator-= const Quatf q  ) 
 

Quaternion subtraction and assignment operator.

Returns:
reference to the assigned quaternion after subtraction
Parameters:
q  quaternion to subtract

NVSG_API Quatf nvmath::Quatf::operator- const Quatf q  )  const
 

Quaternion subtraction operator.

Returns:
difference of the two quaternions
Parameters:
q  quaternion to subtract

Quatf nvmath::Quatf::operator- void   )  const [inline]
 

Negation operator.

Returns:
negated quaternion

NVSG_API Quatf& nvmath::Quatf::operator *= float  f  ) 
 

Quaternion multiplication with a scalar and assignment operator.

Returns:
reference to the assigned quaternion after multiplication
Parameters:
f  scalar to use in the multiplication

NVSG_API Quatf nvmath::Quatf::operator * float  f  )  const
 

Quaternion multiplication with a scalar operator.

Returns:
multiplied quaternion
Parameters:
f  scalar to multiply with

Quatf & nvmath::Quatf::operator *= const Quatf q  )  [inline]
 

Quaternion multiplication with a quaternion (i.e. concatenation) and assignment operator.

Returns:
reference to the assigned quaternion after multiplication (concatenation)
Parameters:
q  quaternion to use in the multiplication

Quatf nvmath::Quatf::operator * const Quatf q  )  const [inline]
 

Quaternion multiplication with a quaternion (i.e. concatenation) operator.

Returns:
multiplied (concatenated) quaternion
Parameters:
q  quaternion to use in the multiplication

NVSG_API Quatf& nvmath::Quatf::operator/= float  f  ) 
 

Quaternion division by a scalar and assignment operator.

Returns:
reference to the assigned quaternion after division
Parameters:
f  scalar to use in the division

NVSG_API Quatf nvmath::Quatf::operator/ float  f  )  const
 

Quaternion division by a scalar operator.

Returns:
divided quaternion
Parameters:
f  scalar to use in the division

Quatf & nvmath::Quatf::operator/= const Quatf q  )  [inline]
 

Quaternion division by a quaternion and assignment operator.

Returns:
reference to the assigned quaternion after division
Parameters:
q  quaternion to use in the division

Quatf nvmath::Quatf::operator/ const Quatf q  )  const [inline]
 

Quaternion division by a quaternion operator.

Returns:
divided quaternion
Parameters:
q  quaternion to use in the division

Quatf nvmath::Quatf::operator~ void   )  const [inline]
 

Quaternion conjugation operator.

The conjugation of a quaternion is a rotation of the same size around the negated axis.

Returns:
conjugated quaternion

void nvmath::Quatf::invert void   )  [inline]
 

Invert the quaternion.

Inversion means take the conjugated quaternion and divide it by it's magnitude.

Quatf & nvmath::Quatf::normalize void   )  [inline]
 

Normalize the quaternion.

Quaternions always obey: a^2 + b^2 + c^2 + d^2 = 1.0 If they don't add up to 1.0, dividing by their magnitude will renormalize them.


Friends And Related Function Documentation

void decompose const Quatf q,
Vec3f axis,
float &  angle
[related]
 

Decompose a quaternion into axis and angle.

Parameters:
q  Quaternion to decompose
axis  Resulting axis
angle  Resulting angle (in radians)

float distance const Quatf q0,
const Quatf q1
[related]
 

Determine the distance between two quaternions.

Returns:
The distance between q0 and q1
Parameters:
q0  first quaternion
q1  second quaternion

float magnitude const Quatf q  )  [related]
 

Calculate the magnitude of a quaternion.

Returns:
magnitude of the quaternion
Parameters:
q  Quaternion to determine magnitude of

bool isNormalized const Quatf q  )  [related]
 

Test if a quaternion is normalized. A quaternion is normalized if it's magnitude is one.

Returns:
true if the quaternion is normalized, otherwise false
Parameters:
q  Quaternion to test

bool isNull const Quatf q  )  [related]
 

Test if a quaternion is null.

Returns:
true if the quaternion is null, otherwise false
Parameters:
q  Quaternion to test

Quatf operator * float  f,
const Quatf q
[related]
 

Multiply a scalar f with a quaternion q.

Returns:
product of f with q
Parameters:
f  scalar to multiply with
q  quaternion to multiply

Vec3f operator * const Quatf q,
const Vec3f v
[related]
 

Multiply a quaternion q with an vector v. Rotation of vector v by quaternion q.

Returns:
product of q with v

template<>
NVSG_API Quatf lerp< Quatf > float  alpha,
const Quatf q0,
const Quatf q1
[related]
 

Spherical linear interpolation between two quaternions q0 and q1

Parameters:
alpha  interpolation parameter
q0  starting value
q1  ending value


The documentation for this class was generated from the following file:
Generated on Tue Mar 1 13:20:39 2005 for NVSGSDK by NVIDIA