/*************************************** Auteur : Pierre Aubert Mail : aubertp7@gmail.com Licence : CeCILL-C ****************************************/ #include "Particle.h" ///Default constructeur of Particle Particle::Particle(){ initialisationParticle(); } ///Copy constructor of Particle /** @param other : class to copy */ Particle::Particle(const Particle & other){ copyParticle(other); } ///Destructeur of Particle Particle::~Particle(){ } ///Definition of equal operator of Particle /** @param other : class to copy * @return copied class */ Particle & Particle::operator = (const Particle & other){ copyParticle(other); return *this; } ///Initialise randomly the Particle void Particle::randomInit(){ float boxHalfSize(1.0f), velocity(0.005f); p_position.setComposante(randfloat(-boxHalfSize, boxHalfSize), randfloat(-boxHalfSize, boxHalfSize), randfloat(-boxHalfSize, boxHalfSize)); p_velocity.setComposante(randfloat(-velocity, velocity), randfloat(-velocity, velocity), randfloat(-velocity, velocity)); p_acceleration.setComposante(0.0f, 0.0f, -9.81f); } ///Move the current Particle /** @param dt : ellapsed time */ void Particle::move(float dt){ p_velocity += p_acceleration*dt; p_position += p_velocity*dt; } ///Set the position of the Particle /** @param position : position of the Particle */ void Particle::setPosition(const Vec3f & position){ p_position = position; } ///Set the position of the Particle /** @param velocity : velocity of the Particle */ void Particle::setVelocity(const Vec3f & velocity){ p_velocity = velocity; } ///Set the position of the Particle /** @param acceleration : acceleration of the Particle */ void Particle::setAcceleration(const Vec3f & acceleration){ p_acceleration = acceleration; } ///Get the position of the Particle /** @return position of the Particle */ const Vec3f & Particle::getPosition() const{return p_position;} ///Get the position of the Particle /** @return position of the Particle */ Vec3f & Particle::getPosition(){return p_position;} ///Get the velocity of the Particle /** @return velocity of the Particle */ const Vec3f & Particle::getVelocity() const{return p_velocity;} ///Get the velocity of the Particle /** @return velocity of the Particle */ Vec3f & Particle::getVelocity(){return p_velocity;} ///Get the acceleration of the Particle /** @return acceleration of the Particle */ const Vec3f & Particle::getAcceleration() const{return p_acceleration;} ///Get the acceleration of the Particle /** @return acceleration of the Particle */ Vec3f & Particle::getAcceleration(){return p_acceleration;} ///Copy function of Particle /** @param other : class to copy */ void Particle::copyParticle(const Particle & other){ p_position = other.p_position; p_velocity = other.p_velocity; p_acceleration = other.p_acceleration; } ///Initialisation function of the class Particle void Particle::initialisationParticle(){ }