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

SH::ShQuaternion< B, T > Class Template Reference

A Quaternion. More...

#include <ShQuaternion.hpp>

Collaboration diagram for SH::ShQuaternion< B, T >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ShQuaternion ()
 Constructor for ShQuaternion.

template<ShBindingType B2>  ShQuaternion (const ShQuaternion< B2, T > &other)
 Constructor for ShQuaternion with a quaternion as parameter.

template<ShBindingType B2>  ShQuaternion (const ShVector< 4, B2, T > &values)
 Constructor for ShQuaternion with a 4-vector as parameter.

template<ShBindingType B2, ShBindingType B3>  ShQuaternion (const ShAttrib< 1, B2, T > &angle, const ShVector< 3, B3, T > &axis)
 Constructor for ShQuaternion with an angle and axis of rotation.

template<ShBindingType B2>  ShQuaternion (const ShMatrix< 4, 4, B2, T > &mat)
 Constructor for ShQuaternion with a rotation matrix.

template<ShBindingType B2> ShQuaternionoperator= (const ShQuaternion< B2, T > &other)
 Definition of assignment to another quaternion.

template<ShBindingType B2> ShQuaternionoperator+= (const ShQuaternion< B2, T > &right)
 Definition of the add-assign operation with another quaternion.

template<ShBindingType B2> ShQuaternionoperator-= (const ShQuaternion< B2, T > &right)
 Definition of the minus-assign operation with another quaternion.

template<ShBindingType B2> ShQuaternionoperator *= (const ShQuaternion< B2, T > &right)
 Definition of the times-assign operation with another quaternion.

template<ShBindingType B2> ShQuaternionoperator *= (const ShAttrib< 1, B2, T > &right)
 Definition of the times-assign operation with a scalar.

template<ShBindingType B2> ShQuaternionoperator *= (const ShVector< 3, B2, T > &right)
 Definition of the times-assign operation with a 3-vector.

template<ShBindingType B2> ShQuaternionoperator *= (const ShNormal< 3, B2, T > &right)
 Definition of the times-assign operation with a 3-normal.

template<ShBindingType B2> ShQuaternion< SH_TEMP, T > operator+ (const ShQuaternion< B2, T > &q2)
 Definition of the add operation with another quaternion.

template<ShBindingType B2> ShQuaternion< SH_TEMP, T > operator- (const ShQuaternion< B2, T > &q2)
 Definition of the subtract operation with another quaternion.

template<ShBindingType B2> ShQuaternion< SH_TEMP, T > operator * (const ShQuaternion< B2, T > &q2)
 Definition of the multiply operation with another quaternion.

template<ShBindingType B2> ShQuaternion< SH_TEMP, T > operator * (const ShAttrib< 1, B2, T > &c)
 Definition of the multiply operation with a scalar.

template<ShBindingType B2> ShQuaternion< SH_TEMP, T > operator * (const ShVector< 3, B2, T > &q2)
 Definition of the times operation with a 3-vector.

template<ShBindingType B2> ShQuaternion< SH_TEMP, T > operator * (const ShNormal< 3, B2, T > &q2)
 Definition of the times operation with a 3-normal.

void normalize ()
 Definition of the normalize function.

void getValues (T values[]) const
 Definition of the getValues function.

void setUnit (bool flag)
 Definition of the setUnit function.

void name (const std::string &name)
 Definition of the name function.

std::string name () const
 Definition of the name function.

template<ShBindingType B2> ShAttrib< 1, SH_TEMP, T > dot (const ShQuaternion< B2, T > &q) const
 Definition of the dot function.

ShQuaternion< SH_TEMP, T > conjugate () const
 Definition of the conjugate function.

ShQuaternion< SH_TEMP, T > inverse () const
 Definition of the inverse function.

ShMatrix< 4, 4, SH_TEMP, T > getMatrix () const
 Definition of the getMatrix function.

ShVector< 4, SH_TEMP, T > getVector () const
 Definition of the getVector function.


Friends

template<ShBindingType B2, typename T2> std::ostream & operator<< (std::ostream &out, const ShQuaternion< B2, T2 > &q)

Detailed Description

template<ShBindingType B, typename T = float>
class SH::ShQuaternion< B, T >

A Quaternion.

Definition at line 38 of file ShQuaternion.hpp.


Constructor & Destructor Documentation

template<ShBindingType B, typename T>
SH::ShQuaternion< B, T >::ShQuaternion  ) 
 

Constructor for ShQuaternion.

Creates a identity ShQuaternion

Definition at line 31 of file ShQuaternionImpl.hpp.

template<ShBindingType B, typename T>
template<ShBindingType B2>
SH::ShQuaternion< B, T >::ShQuaternion const ShQuaternion< B2, T > &  other  ) 
 

Constructor for ShQuaternion with a quaternion as parameter.

Creates a ShQuaternion where each element is equal to the one in the parameters

Parameters:
other the quaternion from which we will get the values from

Definition at line 42 of file ShQuaternionImpl.hpp.

template<ShBindingType B, typename T>
template<ShBindingType B2>
SH::ShQuaternion< B, T >::ShQuaternion const ShVector< 4, B2, T > &  values  ) 
 

Constructor for ShQuaternion with a 4-vector as parameter.

Creates a ShQuaternion where each element is equal to the one in the parameters

Parameters:
values 4-vector from which we will get the values from

Definition at line 49 of file ShQuaternionImpl.hpp.

template<ShBindingType B, typename T>
template<ShBindingType B2, ShBindingType B3>
SH::ShQuaternion< B, T >::ShQuaternion const ShAttrib< 1, B2, T > &  angle,
const ShVector< 3, B3, T > &  axis
 

Constructor for ShQuaternion with an angle and axis of rotation.

Creates a unit ShQuaternion defined by a rotation

Parameters:
angle angle in radians of the rotation
axis axis of rotation

Definition at line 56 of file ShQuaternionImpl.hpp.

References SH::cos(), SH::normalize(), and SH::sin().

template<ShBindingType B, typename T>
template<ShBindingType B2>
SH::ShQuaternion< B, T >::ShQuaternion const ShMatrix< 4, 4, B2, T > &  mat  ) 
 

Constructor for ShQuaternion with a rotation matrix.

Creates a unit ShQuaternion defined by a rotation

Parameters:
mat matrix defining the rotation
Precondition:
det(mat) = 1

Definition at line 67 of file ShQuaternionImpl.hpp.


Member Function Documentation

template<ShBindingType B, typename T>
ShQuaternion< SH_TEMP, T > SH::ShQuaternion< B, T >::conjugate  )  const
 

Definition of the conjugate function.

Returns the conjugate of this quaternion

Definition at line 217 of file ShQuaternionImpl.hpp.

Referenced by SH::ShQuaternion< B, T >::inverse().

template<ShBindingType B, typename T>
template<ShBindingType B2>
ShAttrib< 1, SH_TEMP, T > SH::ShQuaternion< B, T >::dot const ShQuaternion< B2, T > &  q  )  const
 

Definition of the dot function.

Returns the dot product between this quaternion and q

Parameters:
q quaternion we're taking the dot product with

Definition at line 211 of file ShQuaternionImpl.hpp.

References SH::dot(), and SH::ShQuaternion< B, T >::getVector().

template<ShBindingType B, typename T>
ShMatrix< 4, 4, SH_TEMP, T > SH::ShQuaternion< B, T >::getMatrix  )  const
 

Definition of the getMatrix function.

Returns the rotation matrix defined by this quaternion

Precondition:
this quaternion is unit

Definition at line 239 of file ShQuaternionImpl.hpp.

template<ShBindingType B, typename T>
void SH::ShQuaternion< B, T >::getValues values[]  )  const
 

Definition of the getValues function.

Outputs the current content of the quaternion as a T array

Parameters:
values output T array

Definition at line 334 of file ShQuaternionImpl.hpp.

References SH::ShVariable::getValues().

template<ShBindingType B, typename T>
ShVector< 4, SH_TEMP, T > SH::ShQuaternion< B, T >::getVector  )  const
 

Definition of the getVector function.

Returns the values of this quaternion as a vector

Definition at line 262 of file ShQuaternionImpl.hpp.

Referenced by SH::ShQuaternion< B, T >::dot(), SH::ShQuaternion< B, T >::operator *=(), SH::ShQuaternion< B, T >::operator+=(), SH::ShQuaternion< B, T >::operator-=(), and SH::ShQuaternion< B, T >::operator=().

template<ShBindingType B, typename T>
ShQuaternion< SH_TEMP, T > SH::ShQuaternion< B, T >::inverse  )  const
 

Definition of the inverse function.

Returns the inverse of this quaternion (same as conjugate if unit)

Definition at line 228 of file ShQuaternionImpl.hpp.

References SH::ShQuaternion< B, T >::conjugate(), and SH::dot().

template<ShBindingType B, typename T>
std::string SH::ShQuaternion< B, T >::name  )  const
 

Definition of the name function.

Returns this variable's name.

Definition at line 366 of file ShQuaternionImpl.hpp.

template<ShBindingType B, typename T>
void SH::ShQuaternion< B, T >::name const std::string &  name  ) 
 

Definition of the name function.

Set this variable's name. If set to the empty string, defaults to the type and id of the variable.

Parameters:
name the name string

Definition at line 372 of file ShQuaternionImpl.hpp.

template<ShBindingType B, typename T>
void SH::ShQuaternion< B, T >::normalize  ) 
 

Definition of the normalize function.

Normalizes the current quaternion which makes it unit

Definition at line 322 of file ShQuaternionImpl.hpp.

References SH::normalize().

template<ShBindingType B, typename T>
template<ShBindingType B2>
ShQuaternion< SH_TEMP, T > SH::ShQuaternion< B, T >::operator * const ShNormal< 3, B2, T > &  q2  ) 
 

Definition of the times operation with a 3-normal.

Returns a new ShQuaternion equals to the current quaternion * ShQuaternion(0.0, right)

Parameters:
q2 3-normal converted to a quaternion multiplied to this one

Definition at line 315 of file ShQuaternionImpl.hpp.

template<ShBindingType B, typename T>
template<ShBindingType B2>
ShQuaternion< SH_TEMP, T > SH::ShQuaternion< B, T >::operator * const ShVector< 3, B2, T > &  q2  ) 
 

Definition of the times operation with a 3-vector.

Returns a new ShQuaternion equals to the current quaternion * ShQuaternion(0.0, right)

Parameters:
q2 3-vector converted to a quaternion multiplied to this one

Definition at line 306 of file ShQuaternionImpl.hpp.

template<ShBindingType B, typename T>
template<ShBindingType B2>
ShQuaternion< SH_TEMP, T > SH::ShQuaternion< B, T >::operator * const ShAttrib< 1, B2, T > &  c  ) 
 

Definition of the multiply operation with a scalar.

Returns a new ShQuaternion equals to the current quaternion * c

Parameters:
c the scalar multiplied to this one

Definition at line 297 of file ShQuaternionImpl.hpp.

template<ShBindingType B, typename T>
template<ShBindingType B2>
ShQuaternion< SH_TEMP, T > SH::ShQuaternion< B, T >::operator * const ShQuaternion< B2, T > &  q2  ) 
 

Definition of the multiply operation with another quaternion.

Returns a new ShQuaternion equals to the current quaternion * q2

Parameters:
q2 the other quaternion multiplied to this one

Definition at line 288 of file ShQuaternionImpl.hpp.

template<ShBindingType B, typename T>
template<ShBindingType B2>
ShQuaternion< B, T > & SH::ShQuaternion< B, T >::operator *= const ShNormal< 3, B2, T > &  right  ) 
 

Definition of the times-assign operation with a 3-normal.

Returns the address of a quaternion where the result is the current quaternion * ShQuaternion(0.0, right)

Parameters:
right 3-normal converted to a quaternion multiplied to this one

Definition at line 198 of file ShQuaternionImpl.hpp.

template<ShBindingType B, typename T>
template<ShBindingType B2>
ShQuaternion< B, T > & SH::ShQuaternion< B, T >::operator *= const ShVector< 3, B2, T > &  right  ) 
 

Definition of the times-assign operation with a 3-vector.

Returns the address of a quaternion where the result is the current quaternion * ShQuaternion(0.0, right)

Parameters:
right 3-vector converted to a quaternion multiplied to this one

Definition at line 185 of file ShQuaternionImpl.hpp.

template<ShBindingType B, typename T>
template<ShBindingType B2>
ShQuaternion< B, T > & SH::ShQuaternion< B, T >::operator *= const ShAttrib< 1, B2, T > &  right  ) 
 

Definition of the times-assign operation with a scalar.

Returns the address of a quaternion where the result is the current quaternion (each component) multiplied by right

Parameters:
right the scalar multiplied to this quaternion

Definition at line 176 of file ShQuaternionImpl.hpp.

template<ShBindingType B, typename T>
template<ShBindingType B2>
ShQuaternion< B, T > & SH::ShQuaternion< B, T >::operator *= const ShQuaternion< B2, T > &  right  ) 
 

Definition of the times-assign operation with another quaternion.

Returns the address of a quaternion where the result is the current quaternion * right

Parameters:
right the other quaternion multiplied to this one

Definition at line 158 of file ShQuaternionImpl.hpp.

References SH::cross(), SH::dot(), and SH::ShQuaternion< B, T >::getVector().

template<ShBindingType B, typename T>
template<ShBindingType B2>
ShQuaternion< SH_TEMP, T > SH::ShQuaternion< B, T >::operator+ const ShQuaternion< B2, T > &  q2  ) 
 

Definition of the add operation with another quaternion.

Returns a new ShQuaternion equals to the current quaternion + q2

Parameters:
q2 the other quaternion added to this one

Definition at line 270 of file ShQuaternionImpl.hpp.

template<ShBindingType B, typename T>
template<ShBindingType B2>
ShQuaternion< B, T > & SH::ShQuaternion< B, T >::operator+= const ShQuaternion< B2, T > &  right  ) 
 

Definition of the add-assign operation with another quaternion.

Returns the address of a quaternion where the result is the current quaternion + right

Parameters:
right the other quaternion added to this one

Definition at line 140 of file ShQuaternionImpl.hpp.

References SH::ShQuaternion< B, T >::getVector().

template<ShBindingType B, typename T>
template<ShBindingType B2>
ShQuaternion< SH_TEMP, T > SH::ShQuaternion< B, T >::operator- const ShQuaternion< B2, T > &  q2  ) 
 

Definition of the subtract operation with another quaternion.

Returns a new ShQuaternion equals to the current quaternion - q2

Parameters:
q2 the other quaternion subtracted from this one

Definition at line 279 of file ShQuaternionImpl.hpp.

template<ShBindingType B, typename T>
template<ShBindingType B2>
ShQuaternion< B, T > & SH::ShQuaternion< B, T >::operator-= const ShQuaternion< B2, T > &  right  ) 
 

Definition of the minus-assign operation with another quaternion.

Returns the address of a quaternion where the result is the current quaternion - right

Parameters:
right the other quaternion subtracted from this one

Definition at line 149 of file ShQuaternionImpl.hpp.

References SH::ShQuaternion< B, T >::getVector().

template<ShBindingType B, typename T>
template<ShBindingType B2>
ShQuaternion< B, T > & SH::ShQuaternion< B, T >::operator= const ShQuaternion< B2, T > &  other  ) 
 

Definition of assignment to another quaternion.

Returns the address of a quaternion from which the values were copied from other

Parameters:
other ShQuaternion from which we will get the values from

Definition at line 131 of file ShQuaternionImpl.hpp.

References SH::ShQuaternion< B, T >::getVector().

template<ShBindingType B, typename T>
void SH::ShQuaternion< B, T >::setUnit bool  flag  ) 
 

Definition of the setUnit function.

Manually indicate whether the quaternion is unit or non-unit

Parameters:
flag true or false

Definition at line 328 of file ShQuaternionImpl.hpp.


The documentation for this class was generated from the following files:
Generated on Mon Oct 18 14:17:57 2004 for Sh by doxygen 1.3.7