cloth

view src/particle.h @ 0:92983e143a03

initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 11 Feb 2013 19:40:36 +0200
parents
children
line source
1 #ifndef PARTICLE_H_
2 #define PARTICLE_H_
4 #include <set>
5 #include "vmath/vmath.h"
7 class SimWorld;
8 struct Collision;
10 class Particle {
11 private:
12 Vector3 forces;
13 Vector3 pos, velocity;
14 float rad;
15 float elast;
16 float mass;
17 float friction;
19 std::set<const Particle*> ignorelist;
21 public:
22 Particle();
24 void add_ignore(const Particle *p);
26 void set_radius(float rad);
27 float get_radius() const;
29 void set_mass(float m);
30 float get_mass() const;
32 void set_elasticity(float e);
33 float get_elasticity() const;
35 void set_position(const Vector3 &pos);
36 void set_velocity(const Vector3 &vel);
38 Vector3 &get_position();
39 const Vector3 &get_position() const;
40 Vector3 &get_velocity();
41 const Vector3 &get_velocity() const;
43 void set_friction(float frict);
44 float get_friction() const;
46 void add_force(const Vector3 &fvec);
48 void step(SimWorld *world, float dt);
50 bool collision(const Particle *p2, Collision *col) const;
52 void draw() const;
54 friend class SimWorld;
55 };
57 #endif // PARTICLE_H_