grav

view src/sim.h @ 1:3d541da6e48c

lalalala
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 23 May 2014 18:27:42 +0300
parents 68db0e456733
children
line source
1 #ifndef SIM_H_
2 #define SIM_H_
4 #include <vector>
5 #include <vmath/vmath.h>
7 class Particle {
8 public:
9 float mass;
10 Vector3 pos, vel;
11 Vector3 prev_pos;
12 Vector3 accel;
14 Particle();
16 void add_force(const Vector3 &force);
17 void step(float dt);
18 };
20 class SimWorld {
21 private:
22 std::vector<Particle> particles;
23 float radius_sq;
25 public:
26 SimWorld();
28 void set_world_bounds(float rad);
30 void add_particle(const Particle &p);
31 void step(float dt);
32 void draw() const;
33 };
35 #endif // SIM_H_