13 #ifndef __ROTPARTICLE_H
14 #define __ROTPARTICLE_H
20 #include "Foundation/vec3.h"
21 #include "Foundation/Matrix3.h"
22 #include "Model/Particle.h"
23 #include "Foundation/Quaternion.h"
45 class SimpleParticleData;
75 const Vec3 &currAngVel,
100 typedef double (
CRotParticle::* ScalarFieldFunction)()
const;
110 double m_div_inertRot;
163 static int getPackSize();
168 Vec3 getDisplacement()
const {
return CParticle::getDisplacement();};
169 void resetDisplacement() {CParticle::resetDisplacement();}
171 inline const Vec3 &getAngVel ()
const {
return m_angVel;}
172 inline Vec3 getAngVelNR ()
const {
return m_angVel;}
173 inline void setAngVel(
const Vec3 &V) { m_angVel = V;}
174 inline Quaternion getInitQuat()
const {
return m_initquat;}
175 inline Quaternion getQuat()
const {
return m_quat;}
176 inline void setQuat(
const Quaternion &quat) { m_quat = quat;}
177 inline double getInertRot ()
const {
return m_inertRot; }
178 inline void setInertRot (
double inertRot)
180 m_inertRot = inertRot;
181 m_div_inertRot = 1.0/m_inertRot;
183 inline double getInvInertRot ()
const {
return m_div_inertRot; }
187 void integrateTherm(
double dt){}
188 virtual void thermExpansion() {}
190 virtual void zeroHeat(){}
193 double getAngularKineticEnergy()
const {
return (0.2*m_mass*
m_rad*
m_rad)*(m_angVel*m_angVel);}
194 double getLinearKineticEnergy()
const {
return (0.5*m_mass)*(m_vel*m_vel);}
195 double getKineticEnergy()
const {
return getLinearKineticEnergy() + getAngularKineticEnergy();}
199 virtual void setNonDynamic() {m_is_dynamic=
false;m_is_rot=
false;};
200 virtual void setNonDynamicLinear() {m_is_dynamic=
false;};
201 virtual void setNonDynamicRot() {m_is_rot=
false;};
205 const double angle = vec.norm();
206 const double halfAngle = angle/2.0;
207 if (halfAngle > 0.0) {
208 return Quaternion(cos(halfAngle), (vec)*(sin(halfAngle)/angle));
212 void rotateBy(
const Vec3 &vec) {m_quat = getQuatFromRotVec(vec)*m_quat;}
213 void rotateTo(
const Vec3 &vec) {m_quat = getQuatFromRotVec(vec);}
216 void print(){cout << *
this << endl << flush;};
226 template <
typename TmplVisitor>
227 void visit(TmplVisitor &visitor)
229 visitor.visitRotParticle(*
this);
237 static void get_type() {cout <<
" CRotParticle" ;};
241 #endif //__ROTPARTICLE_H