alternative Standard Libary  0.29.8
std::math::quaternion< T > Template-Klassenreferenz

#include <quaternion.hpp>

+ Klassendiagramm für std::math::quaternion< T >:
+ Zusammengehörigkeiten von std::math::quaternion< T >:

Öffentliche Typen

typedef T value_type
 
typedef quaternion< T > self_type
 

Öffentliche Methoden

virtual std::string to_string ()
 
 quaternion ()
 
 quaternion (float _s, vector3< value_type > axis)
 
 quaternion (const vector3< value_type > &axis)
 
 quaternion (float fs, float x, float y, float z)
 
 quaternion (float *pfs)
 
 operator T* ()
 
 operator const T * () const
 
self_typeoperator= (const self_type &q)
 
self_typeoperator+= (const self_type &q)
 
self_typeoperator-= (const self_type &q)
 
self_typeoperator*= (const self_type &b)
 
self_typeoperator*= (const value_type f)
 
self_typeoperator/= (const self_type &q)
 
self_typeoperator/= (const value_type f)
 

Öffentliche Attribute

union {
   struct {
      vector3< value_type >   v
 
      float   s
 
   } 
 
   vector4< value_type >   vec
 
   float   qu [4]
 
}; 
 

Ausführliche Beschreibung

template<typename T>
class std::math::quaternion< T >

Dokumentation der benutzerdefinierten Datentypen

◆ self_type

template<typename T >
typedef quaternion<T> std::math::quaternion< T >::self_type

◆ value_type

template<typename T >
typedef T std::math::quaternion< T >::value_type

Beschreibung der Konstruktoren und Destruktoren

◆ quaternion() [1/5]

template<typename T >
std::math::quaternion< T >::quaternion ( )
inline
69 : s(1.0f), v(vector3<value_type>(0.0f)) {}
vector3< value_type > v
Definition: quaternion.hpp:59
float s
Definition: quaternion.hpp:60

◆ quaternion() [2/5]

template<typename T >
std::math::quaternion< T >::quaternion ( float  _s,
vector3< value_type axis 
)
inline
70 : s(_s), v(axis) {}
vector3< value_type > v
Definition: quaternion.hpp:59
float s
Definition: quaternion.hpp:60

◆ quaternion() [3/5]

template<typename T >
std::math::quaternion< T >::quaternion ( const vector3< value_type > &  axis)
312  {
313  value_type cos_z_2 = (value_type)cos(0.5*axis.z);
314  value_type cos_y_2 = (value_type)cos(0.5*axis.y);
315  value_type cos_x_2 = (value_type)cos(0.5*axis.x);
316 
317  value_type sin_z_2 = (value_type)sin(0.5*axis.z);
318  value_type sin_y_2 = (value_type)sin(0.5*axis.y);
319  value_type sin_x_2 = (value_type)sin(0.5*axis.x);
320 
321  // and now compute quaternion
322  s = cos_z_2*cos_y_2*cos_x_2 + sin_z_2*sin_y_2*sin_x_2;
323  v.x = cos_z_2*cos_y_2*sin_x_2 - sin_z_2*sin_y_2*cos_x_2;
324  v.y = cos_z_2*sin_y_2*cos_x_2 + sin_z_2*cos_y_2*sin_x_2;
325  v.z = sin_z_2*cos_y_2*cos_x_2 - cos_z_2*sin_y_2*sin_x_2;
326  }
value_type z
Definition: vector3.hpp:61
vector3< value_type > v
Definition: quaternion.hpp:59
value_type y
Definition: vector3.hpp:60
float s
Definition: quaternion.hpp:60
value_type x
Definition: vector3.hpp:59
T value_type
Definition: quaternion.hpp:52

◆ quaternion() [4/5]

template<typename T >
std::math::quaternion< T >::quaternion ( float  fs,
float  x,
float  y,
float  z 
)
inline
72 : s(fs), v(vector3<value_type>(x,y,z)) {}
vector3< value_type > v
Definition: quaternion.hpp:59
float s
Definition: quaternion.hpp:60

◆ quaternion() [5/5]

template<typename T >
std::math::quaternion< T >::quaternion ( float *  pfs)
inline
73 : s(pfs[0]), v(vector3<value_type>(pfs[1],pfs[2],pfs[3])) {}
vector3< value_type > v
Definition: quaternion.hpp:59
float s
Definition: quaternion.hpp:60

Dokumentation der Elementfunktionen

◆ operator const T *()

template<typename T >
std::math::quaternion< T >::operator const T * ( ) const
inline
76 { return (float*)qu; }
float qu[4]
Definition: quaternion.hpp:63

◆ operator T*()

template<typename T >
std::math::quaternion< T >::operator T* ( )
inline
75 { return (T*)(qu); }
float qu[4]
Definition: quaternion.hpp:63

◆ operator*=() [1/2]

template<typename T >
self_type& std::math::quaternion< T >::operator*= ( const self_type b)
inline
84  {
85  s = ((s * b.s) - (v.x * b.v.x) - (v.y * b.v.z) - (v.z * b.v.z));
86  v.x = ((s * b.v.x) + (v.x * b.s) + (v.y * b.v.y) - (v.z * b.v.y));
87  v.y = ((s * b.v.y) - (v.x * b.v.z) + (v.y * b.s) + (v.z * b.v.x));
88  v.z = ((s * b.v.z) + (v.x * b.v.y) - (v.y * b.v.x) + (v.z * b.s));
89  return *this;
90  }
value_type z
Definition: vector3.hpp:61
vector3< value_type > v
Definition: quaternion.hpp:59
value_type y
Definition: vector3.hpp:60
float s
Definition: quaternion.hpp:60
value_type x
Definition: vector3.hpp:59

◆ operator*=() [2/2]

template<typename T >
self_type& std::math::quaternion< T >::operator*= ( const value_type  f)
inline
92  { s *= f; v.x *= f; v.y *= f; v.z *= f; return *this; }
value_type z
Definition: vector3.hpp:61
vector3< value_type > v
Definition: quaternion.hpp:59
value_type y
Definition: vector3.hpp:60
float s
Definition: quaternion.hpp:60
value_type x
Definition: vector3.hpp:59

◆ operator+=()

template<typename T >
self_type& std::math::quaternion< T >::operator+= ( const self_type q)
inline
81  { v += q.v; s += q.s; return *this; }
vector3< value_type > v
Definition: quaternion.hpp:59
float s
Definition: quaternion.hpp:60

◆ operator-=()

template<typename T >
self_type& std::math::quaternion< T >::operator-= ( const self_type q)
inline
83  { v -= q.v; s -= q.s; return *this; }
vector3< value_type > v
Definition: quaternion.hpp:59
float s
Definition: quaternion.hpp:60

◆ operator/=() [1/2]

template<typename T >
quaternion< T > & std::math::quaternion< T >::operator/= ( const self_type q)
328  {
329  (* this) *= invert(q); return *this;
330  }
matrix4x4< T > invert(const matrix4x4< T > &mat)
Definition: matrix4x4.hpp:490

◆ operator/=() [2/2]

template<typename T >
self_type& std::math::quaternion< T >::operator/= ( const value_type  f)
inline
95  { s /= f; v.x /= f; v.y /= f; v.z /= f; return *this; }
value_type z
Definition: vector3.hpp:61
vector3< value_type > v
Definition: quaternion.hpp:59
value_type y
Definition: vector3.hpp:60
float s
Definition: quaternion.hpp:60
value_type x
Definition: vector3.hpp:59

◆ operator=()

template<typename T >
self_type& std::math::quaternion< T >::operator= ( const self_type q)
inline
79  { v = q.v; s = q.s; return *this; }
vector3< value_type > v
Definition: quaternion.hpp:59
float s
Definition: quaternion.hpp:60

◆ to_string()

template<typename T >
virtual std::string std::math::quaternion< T >::to_string ( )
inlinevirtual
66  {
67  return std::frmstring("quad: %s", vec.to_string().c_str());
68  }
size_t frmstring(basic_string< E, TAllocator, TStorage > &dest, const char *format, va_list arg)
Definition: string.hpp:99
vector4< value_type > vec
Definition: quaternion.hpp:62
std::basic_string< E, TAllocator, TStorage > to_string()
Definition: vector4.hpp:97

Dokumentation der Datenelemente

◆ @20

union { ... }

◆ qu

template<typename T >
float std::math::quaternion< T >::qu[4]

◆ s

template<typename T >
float std::math::quaternion< T >::s

◆ v

template<typename T >
vector3<value_type> std::math::quaternion< T >::v

◆ vec

template<typename T >
vector4<value_type> std::math::quaternion< T >::vec

Die Dokumentation für diese Klasse wurde erzeugt aufgrund der Datei: