Lagrangian Liquid Simulation
Master Thesis project on simulation of liquids using Lagrangian approach and SPH
src/Particle.cpp
Go to the documentation of this file.
00001 
00002 
00003 
00004 #include "Particle.h"
00005 
00006 Particle::Particle()
00007 {
00008     Particle::Particle(0, 0, 0, 0, 0);
00009 }
00010 
00011 Particle::Particle(const Particle& _particle)
00012 {
00013     m_id = _particle.getId();
00014 
00015     m_mass = _particle.getMass();
00016 
00017     m_position = _particle.getPosition();
00018     m_lastPosition = m_position;
00019 
00020     m_velocity = _particle.getVelocity();
00021     m_lastVelocity = m_velocity;
00022 
00023     m_acceleration = _particle.getAcceleration();
00024     m_lastAcceleration = m_acceleration;
00025 
00026     m_netForce = _particle.getNetForce();
00027 
00028     m_moveable = _particle.getMoveable();
00029 
00030     m_radius = _particle.getRadius();
00031 
00032     m_colour = _particle.getColour();
00033 }
00034 
00035 Particle::Particle
00036             (
00037                 const int _id,
00038                 const ngl::Real _mass,
00039                 const ngl::Vector _position,
00040                 const ngl::Colour _colour,
00041                 const ngl::Real _radius,
00042                 const bool _moveable,
00043                 const ngl::Vector _velocity,
00044                 const ngl::Vector _acceleration,
00045                 const ngl::Vector _netForce
00046             )
00047 {
00048     //init params
00049     m_id = _id;
00050 
00051     m_mass = _mass;
00052 
00053     m_position = _position;
00054     m_lastPosition = m_position;
00055 
00056     m_velocity = _velocity;
00057     m_lastVelocity = m_velocity;
00058 
00059     m_acceleration = _acceleration;
00060     m_lastAcceleration = m_acceleration;
00061 
00062     m_netForce = _netForce;
00063 
00064     m_moveable = _moveable;
00065 
00066     m_radius = _radius;
00067 
00068     m_colour = _colour;
00069 }
00070 
00071 Particle::~Particle()
00072 {
00073 }
00074 
00075 void Particle::setPosition(const ngl::Vector _p)
00076 {
00077     //set positions to new value
00078     m_lastPosition = _p;
00079     m_position = _p;
00080 }
00081 
00082 void Particle::updatePosition(const ngl::Vector _p)
00083 {
00084     //save current value
00085     m_lastPosition = m_position;
00086 
00087     //update to new value
00088     m_position = _p;
00089 }
00090 
00091 void Particle::setVelocity(const ngl::Vector _v)
00092 {
00093     //set velocities to new value
00094     m_lastVelocity = _v;
00095     m_velocity = _v;
00096 }
00097 
00098 void Particle::updateVelocity(const ngl::Vector _v)
00099 {
00100     //save current value
00101     m_lastVelocity = m_velocity;
00102 
00103     //update to new value
00104     m_velocity = _v;
00105 }
00106 
00107 void Particle::setAcceleration(const ngl::Vector _a)
00108 {
00109     //set velocities to new value
00110     m_lastAcceleration = _a;
00111     m_acceleration = _a;
00112 }
00113 
00114 void Particle::updateAcceleration(const ngl::Vector _a)
00115 {
00116     //save current value
00117     m_lastAcceleration = m_acceleration;
00118 
00119     //update to new value
00120     m_acceleration = _a;
00121 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator