-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPhysics.hpp
36 lines (31 loc) · 902 Bytes
/
Physics.hpp
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
#ifndef MY_PHYSICS
#define MY_PHYSICS
#define GLM_FORCE_RADIANS
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtx/rotate_vector.hpp>
#include <glm/gtc/quaternion.hpp>
#include <glm/gtx/quaternion.hpp>
#include "Util.hpp"
#include "Force.hpp"
#include "P_State.hpp"
struct Derivative;
class Physics {
public:
// true if changed, false if not
bool integrate(P_State&, float t, float dt);
Physics();
private:
void newOrient(P_State& state, const float& dt);
v3 simple_force_resolve(const P_State& state, float dt);
v3 simple_torque_resolve(const P_State& state, float dt);
Derivative evaluate(P_State, float t, float dt, const Derivative&);
};
struct Derivative {
v3 dx; // dx/dt = velocity
v3 dp; // dp/dt = force (change in momentum)
v3 dL; // dL/dt = change in angular momentum
Derivative () {
}
};
#endif