5.1.1.2.1 : Implementation Particle.h
Implementation of Particle.h file : First, we have to avoid multiple include :

1
2
3
4
5
#ifndef __PARTICLE_H__
#define __PARTICLE_H__

#include "asterics_random.h"
#include "PAbstractVect3.h"


Then we create the vector type we need :

1
2
///Vector of float
typedef PAbstractVect3<float> Vec3f;


Let's define the Particle class :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
///@brief Description of the Particle
class Particle{
	public:
		Particle();
		Particle(const Particle & other);
		virtual ~Particle();
		Particle & operator = (const Particle & other);
		
		void randomInit();
		
		void move(float dt);
		
		void setPosition(const Vec3f & position);
		void setVelocity(const Vec3f & velocity);
		void setAcceleration(const Vec3f & acceleration);
		
		const Vec3f & getPosition() const;
		Vec3f & getPosition();
		
		const Vec3f & getVelocity() const;
		Vec3f & getVelocity();
		
		const Vec3f & getAcceleration() const;
		Vec3f & getAcceleration();
		
	protected:
		void copyParticle(const Particle & other);
		
	private:
		void initialisationParticle();
		///Position of the particle
		Vec3f p_position;
		///Velocity of the particle
		Vec3f p_velocity;
		///Acceleration of the particle
		Vec3f p_acceleration;
};



#endif