#include <quat.hpp>
Public Member Functions | |
quat () | |
quat (const quat &) | |
quat (const double &, const double &, const double &, const double &) | |
~quat () | |
double & | operator() (const int &) |
double | operator() (const int &) const |
void | normalize () |
quat | operator+ (void) |
quat | operator- (void) |
quat & | operator= (const quat &) |
quat & | operator+= (const quat &) |
quat & | operator-= (const quat &) |
quat & | operator *= (const quat &) |
quat & | operator/= (const quat &) |
quat & | operator *= (const double &) |
quat & | operator/= (const double &) |
Public Attributes | |
double | x |
component | |
double | y |
component | |
double | z |
component | |
double | r |
component | |
Friends | |
std::ostream & | operator<< (std::ostream &, const quat &) |
double | abs (const quat &) |
double | norm (const quat &) |
quat | normal (const quat &) |
quat | inv (const quat &) |
vec | im (const quat &) |
vec | q2vt (const quat &) |
quat | conj (const quat &) |
void | swap (quat &, quat &) |
quat | operator+ (const quat &, const quat &) |
quat | operator- (const quat &, const quat &) |
quat | operator * (const quat &, const quat &) |
quat | operator/ (const quat &, const quat &) |
quat | operator * (const quat &, const double &) |
quat | operator/ (const quat &, const double &) |
quat | operator * (const double &, const quat &) |
Definition at line 3 of file quat.hpp.
|
quat constructor without arguments Definition at line 3 of file quat-constructor.hpp. Referenced by operator-(). 00004 { 00005 ; 00006 }
|
|
quat copy constructor Definition at line 14 of file quat-constructor.hpp.
|
|
quat constructor to build from four components Definition at line 23 of file quat-constructor.hpp.
|
|
quat destructor Definition at line 36 of file quat-constructor.hpp. 00037 { 00038 ; 00039 }
|
|
operator() for non-const object Definition at line 3 of file quat-io.hpp. 00004 { 00005 switch( i ){ 00006 case 0: return x; 00007 case 1: return y; 00008 case 2: return z; 00009 case 3: return r; 00010 default: 00011 std::cerr << "[ERROR] quat::operator()(const int&)" << std::endl 00012 << "The required component was not 0, 1, 2, or 3." << std::endl 00013 << "Your input was (" << i << ")." << std::endl; 00014 std::exit(1); 00015 } 00016 }
|
|
operator() for const object Definition at line 20 of file quat-io.hpp. 00021 { 00022 switch( i ){ 00023 case 0: return x; 00024 case 1: return y; 00025 case 2: return z; 00026 case 3: return r; 00027 default: 00028 std::cerr << "[ERROR] quat::operator()(const int&) const" << std::endl 00029 << "The required component was not 0, 1, 2, or 3." << std::endl 00030 << "Your input was (" << i << ")." << std::endl; 00031 std::exit(1); 00032 } 00033 }
|
|
normalize itself Definition at line 3 of file quat-calc.hpp. References abs, r, x, y, and z. 00004 { 00005 double myabs(abs(*this)); 00006 x /=myabs; 00007 y /=myabs; 00008 z /=myabs; 00009 r /=myabs; 00010 }
|
|
Definition at line 2 of file quat-unary.hpp. 00003 {
00004 return( *this );
00005 }
|
|
Definition at line 8 of file quat-unary.hpp. References quat(), r, x, y, and z. 00009 { 00010 return quat(-x, -y, -z, -r); 00011 }
|
|
quat=quat operator Definition at line 3 of file quat-quat.hpp.
|
|
quat+=quat operator Definition at line 18 of file quat-quat.hpp.
|
|
quat-=quat operator Definition at line 29 of file quat-quat.hpp.
|
|
quat*=quat operator Definition at line 40 of file quat-quat.hpp. 00041 { 00042 (*this) =(*this)*q; 00043 return *this; 00044 }
|
|
quat/=quat operator Definition at line 48 of file quat-quat.hpp. 00049 { 00050 (*this) =(*this)/q; 00051 return *this; 00052 }
|
|
quat*=double operator Definition at line 3 of file quat-double.hpp.
|
|
quat/=double operator Definition at line 14 of file quat-double.hpp.
|
|
Definition at line 40 of file quat-io.hpp. 00041 { 00042 s << "( " << q.x << ", " << q.y << ", " << q.z 00043 << "; " << q.r << " )"; 00044 return s; 00045 }
|
|
return abs Definition at line 18 of file quat-calc.hpp. Referenced by normalize().
|
|
return norm Definition at line 25 of file quat-calc.hpp.
|
|
return the normalized quat Definition at line 32 of file quat-calc.hpp. 00033 { 00034 double abs_q(abs(q)); 00035 return quat( q.x/abs_q, q.y/abs_q, q.z/abs_q, q.r/abs_q ); 00036 }
|
|
return the inverse quat Definition at line 44 of file quat-calc.hpp.
|
|
return the imaginary part Definition at line 3 of file quat-misc.hpp.
|
|
return vec from quat (|vec|=theta) Definition at line 10 of file quat-misc.hpp. 00011 { 00012 double sin_theta_half; 00013 double theta( 2.*std::acos(q.r) ); 00014 00015 if(theta<M_PI){ 00016 sin_theta_half =std::sin(0.5*theta); 00017 } 00018 else{ 00019 theta -=2.*M_PI; 00020 sin_theta_half =-std::sin(0.5*theta); 00021 } 00022 00023 return vec( theta*q.x/sin_theta_half, 00024 theta*q.y/sin_theta_half, 00025 theta*q.z/sin_theta_half ); 00026 }
|
|
return the conjugate quat Definition at line 34 of file quat-misc.hpp.
|
|
swap two quats Definition at line 45 of file quat-misc.hpp. 00046 { 00047 quat _q1(q1); 00048 q1 = q2; 00049 q2 =_q1; 00050 }
|
|
quat+quat operator Definition at line 61 of file quat-quat.hpp.
|
|
quat-quat operator Definition at line 68 of file quat-quat.hpp.
|
|
quat*quat operator Definition at line 75 of file quat-quat.hpp. 00076 { 00077 return quat(q1.r*q2.x +q1.x*q2.r +q1.y*q2.z -q1.z*q2.y, 00078 q1.r*q2.y -q1.x*q2.z +q1.y*q2.r +q1.z*q2.x, 00079 q1.r*q2.z +q1.x*q2.y -q2.x*q1.y +q1.z*q2.r, 00080 q1.r*q2.r -q1.x*q2.x -q1.y*q2.y -q1.z*q2.z ); 00081 }
|
|
quat/quat operator Definition at line 85 of file quat-quat.hpp. 00086 { 00087 return q1*inv(q2); 00088 }
|
|
quat*double operator Definition at line 29 of file quat-double.hpp.
|
|
quat/double operator Definition at line 36 of file quat-double.hpp.
|
|
double*quat operator Definition at line 3 of file double-quat.hpp.
|
|
component
Definition at line 7 of file quat.hpp. Referenced by normalize(), operator *=(), operator()(), operator+=(), operator-(), operator-=(), operator/=(), and operator=(). |
|
component
Definition at line 8 of file quat.hpp. Referenced by normalize(), operator *=(), operator()(), operator+=(), operator-(), operator-=(), operator/=(), and operator=(). |
|
component
Definition at line 9 of file quat.hpp. Referenced by normalize(), operator *=(), operator()(), operator+=(), operator-(), operator-=(), operator/=(), and operator=(). |
|
component
Definition at line 10 of file quat.hpp. Referenced by normalize(), operator *=(), operator()(), operator+=(), operator-(), operator-=(), operator/=(), and operator=(). |