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

#include <physik.hpp>

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

Öffentliche Typen

typedef physik_base< T > physik_value
 
typedef T value_type
 
typedef T * pointer
 
typedef physik< T > self_type
 

Öffentliche Methoden

 physik (physik_value *o)
 
 physik (physik_value *o, const vector3< T > &Position, const vector3< T > &Velocity, const vector3< T > &Accelerator, T mass=1.0)
 
virtual void update (value_type fTime, value_type fRunTime)
 
void reset ()
 
void accelerate (const vector3< T > &accel)
 
void angaccel (vector3< T > accel)
 
void set_accelerate (vector3< T > Acc)
 
void set_angaccel (vector3< T > Ang)
 
vector3< T > position ()
 
vector3< T > velocity ()
 
value_type mass ()
 
value_type getBoundingsphereRadius ()
 
void set_velocity (vector3< T > velo)
 
virtual std::string to_string ()
 

Ausführliche Beschreibung

template<typename T = double>
class std::math::physik< T >

Dokumentation der benutzerdefinierten Datentypen

◆ physik_value

template<typename T = double>
typedef physik_base<T> std::math::physik< T >::physik_value

◆ pointer

template<typename T = double>
typedef T* std::math::physik< T >::pointer

◆ self_type

template<typename T = double>
typedef physik<T> std::math::physik< T >::self_type

◆ value_type

template<typename T = double>
typedef T std::math::physik< T >::value_type

Beschreibung der Konstruktoren und Destruktoren

◆ physik() [1/2]

template<typename T = double>
std::math::physik< T >::physik ( physik_value o)
inline
77  :
78  m_Velocity(0,0,0), m_Accelerate(0,0,0), m_AngularAccelerate(0,0,0), m_AngularVelocity(0,0,0)
79  {
80  m_pRender = o;
81  m_Translation = matrix4x4_identity();
82  m_Rotation = matrix4x4_identity();
83  m_Scaling = scaling(vector3<T>(m_pRender->getWorldMatrix()->m11, m_pRender->getWorldMatrix()->m22,
84  m_pRender->getWorldMatrix()->m33));
85  m_Mass = 1;
86  }
matrix4x4< T > scaling(const vector3< T > &v)
Definition: matrix4x4.hpp:518
virtual matrix4x4< T > getWorldMatrix()=0
matrix4x4< T > matrix4x4_identity()
Definition: matrix4x4.hpp:262

◆ physik() [2/2]

template<typename T = double>
std::math::physik< T >::physik ( physik_value o,
const vector3< T > &  Position,
const vector3< T > &  Velocity,
const vector3< T > &  Accelerator,
mass = 1.0 
)
inline
90  :
91  m_Velocity(Velocity), m_Accelerate(Accelerator), m_AngularVelocity(0,0,0), m_AngularAccelerate(0,0,0)
92  {
93  m_pRender = o;
94  m_Translation = translate(matrix4x4_identity(), Position);
95  m_Rotation = matrix4x4_identity();
96  m_Scaling = scaling(vector3<T>(m_pRender->getWorldMatrix()->m11,
97  m_pRender->getWorldMatrix()->m22,
98  m_pRender->getWorldMatrix()->m33));
99  m_Mass = mass;
100  }
value_type mass()
Definition: physik.hpp:123
matrix4x4< T > scaling(const vector3< T > &v)
Definition: matrix4x4.hpp:518
virtual matrix4x4< T > getWorldMatrix()=0
matrix4x4< T > translate(const matrix4x4< T > &mat, const vector3< T > &v)
Definition: matrix4x4.hpp:264
matrix4x4< T > matrix4x4_identity()
Definition: matrix4x4.hpp:262

Dokumentation der Elementfunktionen

◆ accelerate()

template<typename T = double>
void std::math::physik< T >::accelerate ( const vector3< T > &  accel)
inline
106  {
107  m_Accelerate = transformnormal(accel, m_pRender->getWorldMatrix());
108  }
virtual matrix4x4< T > getWorldMatrix()=0
vector3< T > transformnormal(const vector3< T > &v, const matrix4x4< T > &m)
Definition: ext.hpp:98

◆ angaccel()

template<typename T = double>
void std::math::physik< T >::angaccel ( vector3< T >  accel)
inline
110  {
111  m_AngularAccelerate = transformnormal(accel, m_pRender->getWorldMatrix());
112  }
virtual matrix4x4< T > getWorldMatrix()=0
vector3< T > transformnormal(const vector3< T > &v, const matrix4x4< T > &m)
Definition: ext.hpp:98

◆ getBoundingsphereRadius()

template<typename T = double>
value_type std::math::physik< T >::getBoundingsphereRadius ( )
inline
126  { return m_pRender->getBoundingsphereRadius(); }
virtual value_type getBoundingsphereRadius()
Definition: physik.hpp:64

◆ mass()

template<typename T = double>
value_type std::math::physik< T >::mass ( )
inline
124  { return m_Mass; }

◆ position()

template<typename T = double>
vector3<T> std::math::physik< T >::position ( )
inline
120  { return transformcoord(vector3<T>(0), m_Translation); }
vector3< T > transformcoord(const vector3< T > &v, const matrix4x4< T > &m)
Definition: ext.hpp:85

◆ reset()

template<typename T = double>
void std::math::physik< T >::reset ( )
172  {
173  m_Accelerate = vector3<T>(0);
174  m_AngularAccelerate = vector3<T>(0);
175  m_AngularVelocity = vector3<T>(0);
176  m_Velocity = vector3<T>(0);
177  }

◆ set_accelerate()

template<typename T = double>
void std::math::physik< T >::set_accelerate ( vector3< T >  Acc)
inline
115  { m_Accelerate= Acc; }

◆ set_angaccel()

template<typename T = double>
void std::math::physik< T >::set_angaccel ( vector3< T >  Ang)
inline
117  { m_AngularAccelerate = Ang; }

◆ set_velocity()

template<typename T = double>
void std::math::physik< T >::set_velocity ( vector3< T >  velo)
inline
129  { m_Velocity = velo; }

◆ to_string()

template<typename T = double>
virtual std::string std::math::physik< T >::to_string ( )
inlinevirtual
130  {
131  std::frmstring("[physik] pos: %s vel: %s\nmass: %.3f bsradius: %.3f",
134  }
value_type getBoundingsphereRadius()
Definition: physik.hpp:125
virtual std::string to_string()
Definition: physik.hpp:130
value_type mass()
Definition: physik.hpp:123
size_t frmstring(basic_string< E, TAllocator, TStorage > &dest, const char *format, va_list arg)
Definition: string.hpp:99
vector3< T > position()
Definition: physik.hpp:119
vector3< T > velocity()
Definition: physik.hpp:121

◆ update()

template<typename T = double>
void std::math::physik< T >::update ( value_type  fTime,
value_type  fRunTime 
)
virtual
152  {
153  float angle = fTime * lenghtSq(m_AngularAccelerate);
154  vector3<T> axis = normalize(m_AngularVelocity);
155 
156  if(m_pRender)
157  {
158  matrix4x4<T> mWorld = matrix4x4_identity(), m = matrix4x4_identity();
159  m_Rotation = rotate(m_Rotation, axis, angle);
160  m_Translation = translate(m_Translation, scale(m_Velocity, fTime));
161 
162  m = m_Scaling * m_Rotation;
163  mWorld = m * m_Translation;
164 
165  m_pRender->setWorldMatrix(mWorld);
166  }
167  m_Velocity += fTime * m_Accelerate;
168  m_AngularVelocity += fTime * m_AngularAccelerate;
169  }
virtual void setWorldMatrix(const matrix4x4< T > &p)
vector3< T > angle(const matrix4x4< T > &m)
Definition: matrix4x4.hpp:408
T lenghtSq(const quaternion< T > &v)
Definition: quaternion.hpp:125
matrix4x4< T > rotate(const matrix4x4< T > &mat, const vector3< T > &v, const T angle)
Definition: matrix4x4.hpp:274
vector2< T > scale(const vector2< T > &v, const float s)
Definition: vector2.hpp:189
quaternion< T > normalize(const quaternion< T > &v)
Definition: quaternion.hpp:164
matrix4x4< T > translate(const matrix4x4< T > &mat, const vector3< T > &v)
Definition: matrix4x4.hpp:264
matrix4x4< T > matrix4x4_identity()
Definition: matrix4x4.hpp:262

◆ velocity()

template<typename T = double>
vector3<T> std::math::physik< T >::velocity ( )
inline
122  { return m_Velocity; }

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