13 #ifndef __ROTPARTICLEVI_H
14 #define __ROTPARTICLEVI_H
17 #include "Foundation/vec3.h"
18 #include "Foundation/Matrix3.h"
19 #include "Model/Particle.h"
20 #include "Foundation/Quaternion.h"
45 class SimpleParticleData;
74 const Vec3 &currAngVel,
81 m_angVel_t(currAngVel),
106 double m_div_inertRot;
155 static int getPackSize();
160 Vec3 getDisplacement()
const {
return CParticle::getDisplacement();};
161 void resetDisplacement() {CParticle::resetDisplacement();}
163 inline const Vec3 &getAngVel ()
const {
return m_angVel;}
164 inline const Vec3 getAngVel_t ()
const {
return m_angVel_t ;} ;
165 inline void setAngVel_t (
const Vec3 &v) { m_angVel_t = v;} ;
166 inline Vec3 getAngVelNR ()
const {
return m_angVel_t;}
167 inline void setAngVel(
const Vec3 &V) { m_angVel = V;}
168 inline Quaternion getInitQuat()
const {
return m_initquat;}
169 inline Quaternion getQuat()
const {
return m_quat;}
170 inline void setQuat(
const Quaternion &q) {m_quat = q;}
171 inline double getInertRot ()
const {
return m_inertRot; }
172 inline void setInertRot (
double inertRot)
174 m_inertRot = inertRot;
175 m_div_inertRot = 1.0/m_inertRot;
177 inline double getInvInertRot ()
const {
return m_div_inertRot; }
179 inline void setMoment(
const Vec3 &moment) {
m_moment = moment;}
180 Vec3 getAngVector()
const ;
186 virtual void zeroHeat(){} ;
187 virtual void integrateTherm(
double){} ;
188 virtual void setTemperature(
double){} ;
189 virtual void setCp(
double){} ;
190 virtual void setThermExpansion0(
double){} ;
191 virtual void setThermExpansion1(
double){} ;
192 virtual void setThermExpansion2(
double){} ;
193 virtual void thermExpansion(){} ;
194 virtual double get_y() {
return m_pos.Y(); } ;
199 double getAngularKineticEnergy()
const {
return (0.2*m_mass*
m_rad*
m_rad)*(m_angVel_t*m_angVel_t);}
200 double getLinearKineticEnergy()
const {
return (0.5*m_mass)*(m_vel*m_vel);}
201 double getKineticEnergy()
const {
return getLinearKineticEnergy() + getAngularKineticEnergy();}
203 virtual void setNonRot() {m_inertRot=0.0;m_div_inertRot=0.0;};
207 const double angle = vec.norm();
208 const double halfAngle = angle/2.0;
209 if (halfAngle > 0.0) {
210 return Quaternion(cos(halfAngle), (vec)*(sin(halfAngle)/angle));
214 void rotateBy(
const Vec3 &vec) {m_quat = getQuatFromRotVec(vec)*m_quat;}
215 void rotateTo(
const Vec3 &vec) {m_quat = getQuatFromRotVec(vec);}
220 void print(){cout << *
this << endl << flush;};
235 static void get_type() {cout <<
" CRotParticleVi" ;};
238 template <
typename TmplVisitor>
239 void visit(TmplVisitor &visitor)
241 visitor.visitRotParticleVi(*
this);
246 #endif //__ROTPARTICLEVI_H