Lagrangian Liquid Simulation
Master Thesis project on simulation of liquids using Lagrangian approach and SPH
|
00001 #ifndef PARTICLE_H 00002 #define PARTICLE_H 00003 00004 #include "vector" 00005 00006 #include "ngl/Obj.h" 00007 #include "ngl/Colour.h" 00008 00009 00019 00020 class Particle 00021 { 00022 public: 00024 Particle(); 00025 00028 Particle(const Particle& _particle); 00029 00040 Particle 00041 ( 00042 const int _id, 00043 const ngl::Real _mass, 00044 const ngl::Vector _position, 00045 const ngl::Colour _colour, 00046 const ngl::Real _radius, 00047 const bool _moveable = true, 00048 const ngl::Vector _velocity = 0, 00049 const ngl::Vector _acceleration = 0, 00050 const ngl::Vector _netForce = 0 00051 ); 00052 00054 ~Particle(); 00055 00057 inline int getId() const { return m_id; } 00058 00061 inline void setId(const int _id) { m_id = _id; } 00062 00064 inline ngl::Real getMass() const { return m_mass; } 00065 00067 inline ngl::Vector getLastPosition() const { return m_lastPosition; } 00068 00070 inline ngl::Vector getPosition() const { return m_position; } 00071 00074 void setPosition(const ngl::Vector _p); 00075 00078 void updatePosition(const ngl::Vector _p); 00079 00081 inline ngl::Vector getLastVelocity() const { return m_lastVelocity; } 00082 00084 inline ngl::Vector getVelocity() const { return m_velocity; } 00085 00088 void setVelocity(const ngl::Vector _v); 00089 00092 void updateVelocity(const ngl::Vector _v); 00093 00095 inline void resetForce() { m_netForce = 0; } 00096 00098 inline ngl::Vector getNetForce() const { return m_netForce; } 00099 00102 inline void accumulateNetForce(const ngl::Vector _f) { m_netForce += _f; } 00103 00105 inline ngl::Vector getLastAcceleration() const { return m_lastAcceleration; } 00106 00108 inline ngl::Vector getAcceleration() const { return m_acceleration; } 00109 00112 void setAcceleration(const ngl::Vector _a); 00113 00116 void updateAcceleration(const ngl::Vector _a); 00117 00119 inline bool getMoveable() const { return m_moveable; } 00120 00123 inline void setMoveable(const bool _f) { m_moveable = _f; } 00124 00126 inline ngl::Real getRadius() const { return m_radius; } 00127 00130 inline void setRadius(const ngl::Real _c) { m_radius = _c; } 00131 00133 inline ngl::Colour getColour() const { return m_colour; } 00134 00137 inline void setColour(const ngl::Colour _c) { m_colour = _c; } 00138 00139 protected: 00141 int m_id; 00142 00144 ngl::Real m_mass; 00145 00147 ngl::Vector m_lastPosition; 00148 00150 ngl::Vector m_position; 00151 00153 ngl::Vector m_lastVelocity; 00154 00156 ngl::Vector m_velocity; 00157 00159 ngl::Vector m_lastAcceleration; 00160 00162 ngl::Vector m_acceleration; 00163 00165 ngl::Vector m_netForce; 00166 00168 ngl::Real m_moveable; 00169 00171 ngl::Real m_radius; 00172 00174 ngl::Colour m_colour; 00175 }; 00176 00177 #endif // PARTICLE_H