Initial commit.
This commit is contained in:
commit
44b5f2392f
98 changed files with 11750 additions and 0 deletions
39
physics/particle.h
Normal file
39
physics/particle.h
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
// -*- C++ -*-
|
||||
|
||||
#ifndef MBOSTOCK_PARTICLE_H
|
||||
#define MBOSTOCK_PARTICLE_H
|
||||
|
||||
#include "vector.h"
|
||||
|
||||
namespace mbostock {
|
||||
|
||||
class Particle {
|
||||
public:
|
||||
Particle();
|
||||
|
||||
float inverseMass;
|
||||
Vector position;
|
||||
Vector previousPosition;
|
||||
Vector force;
|
||||
|
||||
Vector velocity() const;
|
||||
};
|
||||
|
||||
class ParticleSimulator {
|
||||
public:
|
||||
ParticleSimulator();
|
||||
ParticleSimulator(float drag);
|
||||
|
||||
void step(Particle& p) const;
|
||||
|
||||
static float timeStep();
|
||||
|
||||
private:
|
||||
static float timeStep_;
|
||||
static float timeStepSquared_;
|
||||
float drag_;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue