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

OSCAR::Quaternion Class Reference
[Math]

Used to reperesent a quaternion rotation. More...

#include <Quaternion.h>

Inheritance diagram for OSCAR::Quaternion:

Inheritance graph
[legend]
List of all members.

Public Methods

 Quaternion ()
 Quaternion (double x, double y, double z, double w)
 Quaternion (const double *array)
 Quaternion (const Vector &rhs)
 Quaternion (const Quaternion &rhs)
bool GetConjugate (Quaternion &quat) const
void Conjugate ()
bool Inverse (Quaternion &quat) const
Quaternion Inverse () const
void Invert ()
double & X ()
const double & X () const
double & Y ()
const double & Y () const
double & Z ()
const double & Z () const
double & W ()
const double & W () const
bool Get (Orientation &O) const
bool Get (Rot3by3 &R) const
bool Get (SpatialXform &S) const
bool Get (Vector3 &axis, double &angle, AngleUnits angUnits=Radians) const
bool Set (const Orientation &orient)
bool Set (const Rot3by3 &R)
bool Set (const SpatialXform &spatial)
bool Set (const Vector3 &axis, double angle, AngleUnits angUnits=Radians)
bool Normalize ()
Quaternion & operator *= (const Quaternion &rhs)
Quaternion operator * (const Quaternion &rhs) const
Quaternion & operator/= (const Quaternion &rhs)
Quaternion operator/ (const Quaternion &rhs) const
Quaternion & operator *= (const double rhs)
Quaternion operator * (const double rhs) const
Quaternion & operator/= (const double rhs)
Quaternion operator/ (const double rhs) const

Private Methods

void init (const double *array=0)

Detailed Description

Author:
Peter March
A quaternion is a 4d vector repesentation of an orientation. It consists of an axis in space and the cosine of the half-angle of rotation (w) about that axis. The format for this class is [x,y,z,w], although some people use (w,x,y,z). The main use of this class will be in motion planning of rotations. For details on quaternions, see http://mathworld.wolfram.com/Quaternion.html


Constructor & Destructor Documentation

OSCAR::Quaternion::Quaternion  
 

Constructor.

Construct an identity (0,0,0,1) Quaternion object.

OSCAR::Quaternion::Quaternion double    x,
double    y,
double    z,
double    w
 

Constructor.

Constructs an Quaternion object with values for x, y, z, w.

Parameters:
x x-axis in space.
y y-axis in space.
z z-axis in space.
w w is the cosine of the half-angle of rotation around that axis.

OSCAR::Quaternion::Quaternion const double *    array [explicit]
 

Constructor.

Constructs an Quaternion object with values initialized from first four elements of an array. If the array is smaller than four, behavior is undefined.

Parameters:
array Pointer to an array.

OSCAR::Quaternion::Quaternion const Vector   rhs
 

Copy Constructor.

This is the Copy Constructor for an object of type Quaternion. Use this to construct an Quaternion object from an existing Vector object.

Parameters:
rhs An Vector object that will be used to initialize this new object.

OSCAR::Quaternion::Quaternion const Quaternion &    rhs
 

Copy Constructor.

This is the Copy Constructor for an object of type Quaternion. Use this to construct an Quaternion object from an existing Quaternion object.

Parameters:
rhs An Quaternion object that will be used to initialize this new object.


Member Function Documentation

void OSCAR::Quaternion::Conjugate  
 

Conjugate of an Quaternion object.

Conjugates an Quaternion object, where ~Q = [-X,-Y,-Z,W]

Returns:
Returns reference to this object.

bool OSCAR::Quaternion::Get Vector3   axis,
double &    angle,
AngleUnits    angUnits = Radians
const
 

Get an Equivalent Axis representation from an Quaternion object.

This method is used to get an equivalent axis representation from an Quaternion object.

Parameters:
axis On return, axis contains the axis.
angle On return, angle contains the angle.
angUnits Use this to pass in information whether the specified angle is in degrees or radians. The default is Radians. AngleUnits is an enum whose possible values are Degrees and Radians.
Returns:
True if the method succeeds, and false otherwise.

bool OSCAR::Quaternion::Get SpatialXform   S const
 

Get an SpatialXform representation from an Quaternion object.

This method is used to get an equivalent SpatialXform object from an Quaternion object.

Parameters:
S On return, S contains a reference to the equivalent SpatialXform..
Returns:
True if the method succeeds, and false otherwise.

bool OSCAR::Quaternion::Get Rot3by3   R const
 

Get the 3 by 3 rotation matrix part from an Quaternion object.

This method is used to get the 3 by 3 rotation matrix from an Quaternion object.

Parameters:
R On return, R contains a reference to the extracted rotation matrix.
Returns:
True always.

bool OSCAR::Quaternion::Get Orientation   O const
 

Get the elements representing the orientation of the source frame w.r.t the destination frame.

This method is used to get the last three elements of a HandPose and the type of orientation.

Parameters:
O On return, O holds the values of the last three elements of the HandPose, and the orientation type of orientation is set to be the same as that of HandPose .
Returns:
True if the method succeeds. False otherwise.

bool OSCAR::Quaternion::GetConjugate Quaternion &    quat const
 

Get the conjugate of an Quaternion object.

This method is used to get the conjugate of an Quaternion object.

Parameters:
quat On return, quat contains the conjugate.
Returns:
True.

void OSCAR::Quaternion::init const double *    array = 0 [private]
 

Quaternion OSCAR::Quaternion::Inverse   const
 

Get the inverse of an Quaternion object.

This method is used to get inverse of an Quaternion object. (q*Inv(q))=(Inv(q)*q)=(0,0,0,1)

Returns:
Inverse of this Quaternion object

bool OSCAR::Quaternion::Inverse Quaternion &    quat const
 

Get the inverse of an Quaternion object.

This method is used to get inverse of an Quaternion object. (q*Inv(q))=(Inv(q)*q)=(0,0,0,1)

Parameters:
quat On return, quat will contain the inverse.
Returns:
True.

void OSCAR::Quaternion::Invert   [inline]
 

Invert an Quaternion object.

Inversts an Quaternion object. (q*Inv(q))=(Inv(q)*q)=(0,0,0,1)

bool OSCAR::Quaternion::Normalize  
 

Normalizes the quaternion.

Divides the current quaternion by the sqrt of the sum of squares of each element

Returns:
true if successful. false, if divide by zero

Quaternion OSCAR::Quaternion::operator * const double    rhs const [inline]
 

Quaternion OSCAR::Quaternion::operator * const Quaternion &    rhs const
 

Overloaded binary operator* for quaternions.

Performs quaternion multiplication, as defined at http://mathworld.wolfram.com/Quaternion.html Multiplication is not communative, i.e. q1*q2 != q2*q1

Parameters:
rhs const Quaternion
Returns:
None

Quaternion& OSCAR::Quaternion::operator *= const double    rhs [inline]
 

Quaternion& OSCAR::Quaternion::operator *= const Quaternion &    rhs
 

Overloaded operator for quaternions.

Performs multiplication operation and assigns the result back to current object. No performance advantage over q1 = q1 * q2;

Parameters:
rhs const Quaternion
Returns:

Quaternion OSCAR::Quaternion::operator/ const double    rhs const [inline]
 

Quaternion OSCAR::Quaternion::operator/ const Quaternion &    rhs const
 

Overloaded binary operator/ for quaternions.

Performs quaternion division, result = LHS * inverse(RHS)

Parameters:
rhs const Quaternion argument
Returns:
Quaternion result

Quaternion& OSCAR::Quaternion::operator/= const double    rhs [inline]
 

Quaternion& OSCAR::Quaternion::operator/= const Quaternion &    rhs
 

Overloaded operator/= for quaternions.

Divides the current quaternion by the argument and reassigns the result to current object. No performance advantage over q1 = q1 / q2

Parameters:
rhs const Quaternion
Returns:

bool OSCAR::Quaternion::Set const Vector3   axis,
double    angle,
AngleUnits    angUnits = Radians
 

Set an Quaternion object based on an equivalent axis representation.

This method is used to set an Quaternion object based on an equivalent axis representation.

Parameters:
axis The axis specifies the unit vector in space that represents an equivalent axis
angle This contains the angle of rotation for axis.
angUnits Use this to pass in information whether the specified angle is in degrees or radians. The default is Radians. AngleUnits is an enum whose possible values are Degrees and Radians.
Returns:
True if the method succeeds, and false otherwise.

bool OSCAR::Quaternion::Set const SpatialXform   spatial
 

Set an Quaternion object based on an SpatialXform object.

This method is used to set an Quaternion object based on the rotational elements of an SpatialXform.

Parameters:
spatial This argument is used to set the values of the Quaternion.
Returns:
True if the method succeeds, and false otherwise.

bool OSCAR::Quaternion::Set const Rot3by3   R
 

Set the rotation matrix of an Quaternion object.

This method is used to set the orientation part of the Quaternion object based on the rotation matrix passed as argument .

Parameters:
R 
Returns:
True if the method succeeds. False otherwise.

bool OSCAR::Quaternion::Set const Orientation   orient
 

Set an Orientation representation to an Quaternion object.

This method is used to set an equivalent 3x1 Orientation object to the Quaternion object.

Parameters:
orient This argument is used to set the values of the Quaternion.
Returns:
True if the method succeeds, and false otherwise.

const double& OSCAR::Quaternion::W   const [inline]
 

Read W.

Gives read access to W of a const Quaternion. Equivalent to at(3).

Returns:
Const reference to W.

double& OSCAR::Quaternion::W   [inline]
 

Read/write W.

Gives read/write access to Z of a non-const Quaternion. Equivalent to at(3).

Returns:
Reference to W.

const double& OSCAR::Quaternion::X   const [inline]
 

Read X.

Gives read access to X of a const Quaternion. Equivalent to at(0).

Returns:
Const reference to X.

double& OSCAR::Quaternion::X   [inline]
 

Read/write X.

Gives read/write access to X of a non-const Quaternion. Equivalent to at(0).

Returns:
Reference to X.

const double& OSCAR::Quaternion::Y   const [inline]
 

Read Y.

Gives read access to Y of a const Quaternion. Equivalent to at(1).

Returns:
Const reference to Y.

double& OSCAR::Quaternion::Y   [inline]
 

Read/write Y.

Gives read/write access to Y of a non-const Quaternion. Equivalent to at(1).

Returns:
Reference to Y.

const double& OSCAR::Quaternion::Z   const [inline]
 

Read Z.

Gives read access to Z of a const Quaternion. Equivalent to at(2).

Returns:
Const reference to Z.

double& OSCAR::Quaternion::Z   [inline]
 

Read/write Z.

Gives read/write access to Z of a non-const Quaternion. Equivalent to at(2).

Returns:
Reference to Z.


The documentation for this class was generated from the following file:
RRG Homepage OSCAR Overview OSCAR Tutorials Simulations