-
Notifications
You must be signed in to change notification settings - Fork 0
/
solver.h
48 lines (41 loc) · 977 Bytes
/
solver.h
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
42
43
44
45
46
47
48
#ifndef SOLVER_H
#define SOLVER_H
#include "profile.h"
#include "joint.h"
#include "collision.h"
#include "broadphase.h"
#include <vector>
#include <list>
#include <deque>
class Solver{
public:
Solver() : BPT(100), NPT(100), SLT(100), MVT(100) {applyg = NULL;}
~Solver();
void Solve(double dt);
void addBody(Body* b);
void addJoint(Joint* j);
void addRay(mRay* r);
void drawBodies(bool debug);
double GetProfile(std::string s);
void SetGravityFunc(void(* g)(std::deque<Body*>&)) {applyg = g;}
void DeleteBody(Body* b);
void Flush();
private:
void (* applyg)(std::deque<Body*>&);
void applyG();
void applyForces(double dt);
void clearForces();
void solvePositions(double dt);
void checkCol();
void solveVelocities(double dt);
Profile BPT;
Profile NPT;
Profile SLT;
Profile MVT;
std::deque<Body*> body;
std::vector<Joint*> joint;
std::vector<mRay*> ray;
std::list<Manifold> contacts;
BroadPhase bp;
};
#endif