-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathObject.h
69 lines (53 loc) · 900 Bytes
/
Object.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#ifndef OBJECT_HEADER
#define OBJECT_HEADER
#include <cmath>
#include "typeAndStruct.h"
class Object {
protected:
State state;
dd timeStep;
public:
//Constructor
Object () {
state.x = 0;
state.y = 0;
state.v = 0;
state.theta = 0;
}
Object (State astate) {
state = astate;
}
Object (dd ax, dd ay, dd av, dd atheta) {
state.x = ax;
state.y = ay;
state.v = av;
state.theta = atheta;
}
//functions
dd getX(){
return state.x;
}
dd getY(){
return state.y;
}
dd getV(){
return state.v;
}
dd getXDot(){
return state.v*cos(state.theta);
}
dd getYDot(){
return state.v*sin(state.theta);
}
dd getTheta(){
return state.theta;
}
State getState(){
return state;
}
void update_state(double time_step);
void setTimeStep(dd dt){
timeStep = dt;
}
};
#endif