iRoCS Toolbox
1.1.0
|
The Quaternion class implements templated quaternions with few important operations. More...
#include <Quaternion.hh>
Public Member Functions | |
Quaternion (const Type &q0=Type(), const Type &q1=Type(), const Type &q2=Type(), const Type &q3=Type()) | |
Create a new quaternion ![]() | |
template<typename Type2 > | |
Quaternion (Quaternion< Type2 > const &q) | |
Create a new quaternion form the given quaternion. More... | |
Type & | operator() (const int index) |
Get a reference to the coefficient for the given quaternion dimension. More... | |
Type const & | operator() (const int index) const |
Get a read-only reference to the coefficient for the given quaternion dimension. More... | |
Quaternion< Type > & | operator*= (Type const &scalar) |
Scale this quaternion with the given scalar value. More... | |
template<typename Type2 > | |
Quaternion< Type > & | operator*= (Quaternion< Type2 > const &q) |
Multiply this quaternion with the given quaternion. More... | |
Quaternion< Type > & | operator+= (Type const &scalar) |
Add the given real number to this quaternion. More... | |
template<typename Type2 > | |
Quaternion< Type > & | operator+= (Quaternion< Type2 > const &q) |
Add the given quaternion to this quaternion. More... | |
Quaternion< Type > & | operator-= (Type const &scalar) |
Subtract the given real number from this quaternion. More... | |
template<typename Type2 > | |
Quaternion< Type > & | operator-= (Quaternion< Type2 > const &q) |
Subtract the given quaternion from this quaternion. More... | |
Quaternion< Type > & | operator/= (Type const &scalar) |
Divide this quaternion by the given scalar value. More... | |
template<typename Type2 > | |
Quaternion< Type > & | operator/= (Quaternion< Type2 > const &q) |
Divide this quaternion by the given quaternion. More... | |
Quaternion< Type > & | operator= (Type const &scalar) |
Set this quaternion to the given real number. More... | |
template<typename Type2 > | |
Quaternion< Type > & | operator= (Quaternion< Type2 > const &q) |
Set this quaternion to the given quaternion. More... | |
Related Functions | |
(Note that these are not member functions.) | |
template<typename Type > | |
Type | abs (const Quaternion< Type > &t) |
template<typename Type > | |
Quaternion< Type > | conj (const Quaternion< Type > &t) |
template<typename Type > | |
bool | operator!= (const Quaternion< Type > &t1, const Quaternion< Type > &t2) |
template<typename Type > | |
bool | operator!= (const Quaternion< Type > &t1, const Type &t2) |
template<typename Type > | |
bool | operator!= (const Type &t1, const Quaternion< Type > &t2) |
template<typename Type > | |
Quaternion< Type > | operator* (const Quaternion< Type > &t1, const Quaternion< Type > &t2) |
template<typename Type > | |
Quaternion< Type > | operator* (const Quaternion< Type > &t1, const Type &t2) |
template<typename Type > | |
Quaternion< Type > | operator* (const Type &t1, const Quaternion< Type > &t2) |
template<typename Type > | |
Quaternion< Type > | operator+ (const Quaternion< Type > &t1, const Quaternion< Type > &t2) |
template<typename Type > | |
Quaternion< Type > | operator+ (const Quaternion< Type > &t1, const Type &t2) |
template<typename Type > | |
Quaternion< Type > | operator+ (const Type &t1, const Quaternion< Type > &t2) |
template<typename Type > | |
Quaternion< Type > | operator+ (const Quaternion< Type > &t) |
template<typename Type > | |
Quaternion< Type > | operator- (const Quaternion< Type > &t1, const Quaternion< Type > &t2) |
template<typename Type > | |
Quaternion< Type > | operator- (const Quaternion< Type > &t1, const Type &t2) |
template<typename Type > | |
Quaternion< Type > | operator- (const Type &t1, const Quaternion< Type > &t2) |
template<typename Type > | |
Quaternion< Type > | operator- (const Quaternion< Type > &t) |
template<typename Type > | |
Quaternion< Type > | operator/ (const Quaternion< Type > &t1, const Quaternion< Type > &t2) |
template<typename Type > | |
Quaternion< Type > | operator/ (const Quaternion< Type > &t1, const Type &t2) |
template<typename Type > | |
Quaternion< Type > | operator/ (const Type &t1, const Quaternion< Type > &t2) |
template<typename Type , typename CharT , class Traits > | |
std::basic_ostream< CharT, Traits > & | operator<< (std::basic_ostream< CharT, Traits > &os, const Quaternion< Type > &t) |
template<typename Type > | |
bool | operator== (const Quaternion< Type > &t1, const Quaternion< Type > &t2) |
template<typename Type > | |
bool | operator== (const Quaternion< Type > &t1, const Type &t2) |
template<typename Type > | |
bool | operator== (const Type &t1, const Quaternion< Type > &t2) |
template<typename Type , typename CharT , class Traits > | |
std::basic_istream< CharT, Traits > & | operator>> (std::basic_istream< CharT, Traits > &is, Quaternion< Type > &t) |
The Quaternion class implements templated quaternions with few important operations.
Quaternions are an extension to complex numbers. They consist of 3 imaginary units ,
and
and a real part, and thus span a 4-D space. A typical quaternion is given by
Operations:
Addition:
Multiplication:
Conjugate:
The multiplication rule can be obtained from:
,
,
and
Type | The basic numeric type (typically float or double ) of the quaternion coefficients |
Definition at line 75 of file Quaternion.hh.
|
inline |
Create a new quaternion .
q0,q1,q2,q3 | Quaternion coefficients |
Definition at line 269 of file Quaternion.hh.
|
inline |
Create a new quaternion form the given quaternion.
q | The quaternion to copy. This function allows to promote the basic type to a different data type |
Type2 | The basic data type of the source quaternion |
Definition at line 283 of file Quaternion.hh.
|
inline |
Get a reference to the coefficient for the given quaternion dimension.
index | The dimension to get the quaternion coefficient for |
out_of_range | If the given index is not within the [0, 3] range |
Definition at line 292 of file Quaternion.hh.
|
inline |
Get a read-only reference to the coefficient for the given quaternion dimension.
index | The dimension to get the quaternion coefficient for |
out_of_range | If the given index is not within the [0, 3] range |
Definition at line 306 of file Quaternion.hh.
|
inline |
Set this quaternion to the given real number.
scalar | The scalar value to set this quaternion to. |
Definition at line 321 of file Quaternion.hh.
|
inline |
Add the given real number to this quaternion.
scalar | The scalar value to add to this quaternion. |
Definition at line 332 of file Quaternion.hh.
|
inline |
Subtract the given real number from this quaternion.
scalar | The scalar value to subtract from this quaternion. |
Definition at line 340 of file Quaternion.hh.
|
inline |
Scale this quaternion with the given scalar value.
scalar | The scaling factor to apply |
Definition at line 348 of file Quaternion.hh.
|
inline |
Divide this quaternion by the given scalar value.
scalar | The value to divide this quaternion with |
Definition at line 359 of file Quaternion.hh.
|
inline |
Set this quaternion to the given quaternion.
q | The quaternion to copy into this quaternion. |
Type2 | The source quaternion basic scalar type |
Definition at line 371 of file Quaternion.hh.
|
inline |
Add the given quaternion to this quaternion.
q | The quaternion to add to this quaternion. |
Type2 | The source quaternion basic scalar type |
Definition at line 383 of file Quaternion.hh.
|
inline |
Subtract the given quaternion from this quaternion.
q | The quaternion to subtract from this quaternion. |
Type2 | The source quaternion basic scalar type |
Definition at line 395 of file Quaternion.hh.
|
inline |
Multiply this quaternion with the given quaternion.
q | The quaternion to multiply to this quaternion. |
Type2 | The source quaternion basic scalar type |
Definition at line 407 of file Quaternion.hh.
|
inline |
Divide this quaternion by the given quaternion.
q | The quaternion to divide this quaternion by. |
Type2 | The source quaternion basic scalar type |
Definition at line 426 of file Quaternion.hh.
|
related |
Add two quaternions
t1 | The lhs quaternion |
t2 | The rhs quaternion |
Definition at line 450 of file Quaternion.hh.
|
related |
Add quaternion and scalar
t1 | The lhs quaternion |
t2 | The rhs scalar |
Definition at line 470 of file Quaternion.hh.
|
related |
Add scalar and quaternion
t1 | The lhs scalar |
t2 | The rhs quaternion |
Definition at line 490 of file Quaternion.hh.
|
related |
Compute difference between two quaternions
t1 | The lhs quaternion |
t2 | The rhs quaternion |
Definition at line 510 of file Quaternion.hh.
|
related |
Subtract scalar from quaternion.
t1 | The lhs quaternion |
t2 | The rhs scalar |
Definition at line 530 of file Quaternion.hh.
|
related |
Subtract quaternion from scalar.
t1 | The lhs scalar |
t2 | The rhs quaternion |
Definition at line 550 of file Quaternion.hh.
|
related |
Compute product of two quaternions
t1 | The lhs quaternion |
t2 | The rhs quaternion |
Definition at line 570 of file Quaternion.hh.
|
related |
Compute product of quaternion and scalar
t1 | The lhs quaternion |
t2 | The rhs scalar |
Definition at line 590 of file Quaternion.hh.
|
related |
Compute product of scalar and quaternion
t1 | The lhs scalar |
t2 | The rhs quaternion |
Definition at line 610 of file Quaternion.hh.
|
related |
Compute quotient of two quaternions
t1 | The lhs quaternion |
t2 | The rhs quaternion |
Definition at line 630 of file Quaternion.hh.
|
related |
Compute quotient of quaternion and scalar
t1 | The lhs quaternion |
t2 | The rhs scalar |
Definition at line 650 of file Quaternion.hh.
|
related |
Compute quotient of scalar and quaternion
t1 | The lhs scalar |
t2 | The rhs quaternion |
Definition at line 670 of file Quaternion.hh.
|
related |
Unary PLUS operator
t | The quaternion to apply the operator to |
Definition at line 689 of file Quaternion.hh.
|
related |
Unary MINUS operator
t | The quaternion to apply the operator to |
Definition at line 707 of file Quaternion.hh.
|
related |
Equals comparison operator.
t1 | The lhs quaternion |
t2 | The rhs quaternion |
true
if both quaternions are equal, false
otherwise Definition at line 726 of file Quaternion.hh.
|
related |
Equals comparison operator.
t1 | The lhs quaternion |
t2 | The rhs scalar |
true
if quaternion and scalar are equal, false
otherwise Definition at line 747 of file Quaternion.hh.
|
related |
Equals comparison operator.
t1 | The lhs scalar |
t2 | The rhs quaternion |
true
if quaternion and scalar are equal, false
otherwise Definition at line 768 of file Quaternion.hh.
|
related |
Unequal comparison operator.
t1 | The lhs quaternion |
t2 | The rhs quaternion |
false
if both quaternions are equal, true
otherwise Definition at line 789 of file Quaternion.hh.
|
related |
Unequal comparison operator.
t1 | The lhs quaternion |
t2 | The rhs scalar |
false
if scalar and quaternion are equal, true
otherwise Definition at line 810 of file Quaternion.hh.
|
related |
Unequal comparison operator.
t1 | The lhs scalar |
t2 | The rhs quaternion |
false
if scalar and quaternion are equal, true
otherwise Definition at line 831 of file Quaternion.hh.
|
related |
Read a quaternion from its string (stream) representation.
is | The input stream to read a quaternion from |
t | The quaternion to store the parsed string to |
Definition at line 852 of file Quaternion.hh.
|
related |
Write a quaternion to a character stream.
os | The output stream to write the quaternion to |
t | The quaternion to write |
Definition at line 901 of file Quaternion.hh.
|
related |
Compute the absolute value of the given quaternion.
t | The quaternion to compute the absolute value of |
Definition at line 924 of file Quaternion.hh.
|
related |
Compute the conjugate of the given quaternion.
t | The quaternion to compute the conjugate for |
Definition at line 945 of file Quaternion.hh.
Referenced by atb::Quaternion< Type >::operator/=().