-
Notifications
You must be signed in to change notification settings - Fork 0
/
Physics.h
46 lines (44 loc) · 879 Bytes
/
Physics.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
#pragma once
class Physics
{
private:
float velOld[3], velNew[3];
float accelOld[3], accelNew[3];
float posOld[3], posNew[3];
float force[3];
public:
void computeNew(float, float);
//float getPos(int a) { return posNew[a]; }
float *getPos() { return posNew; }
float *getVel() { return velNew; }
float *getAccel() { return accelNew; }
void setPos(float set[3]) {
for (int i = 0; i < 3; i++)
{
posOld[i] = posNew[i];
posNew[i] = set[i];
}
}
void setVel(float set[3]) {
for (int i = 0; i < 3; i++)
{
velOld[i] = velNew[i];
velNew[i] = set[i];
}
}
void setAccel(float set[3]) {
for (int i = 0; i < 3; i++)
{
accelOld[i] = accelNew[i];
accelNew[i] = set[i];
}
}
void setForce(float set[3]) {
for (int i = 0; i < 3; i++)
{
force[i] = set[i];
}
}
Physics();
~Physics();
};