-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgeometry.cpp
More file actions
143 lines (111 loc) · 4.13 KB
/
Copy pathgeometry.cpp
File metadata and controls
143 lines (111 loc) · 4.13 KB
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#include "geometry.h"
CCollisionManager* CGeometry::m_pcCollisionManager = NULL;
/******************************************************************************/
/******************************************************************************/
CGeometry::CGeometry(const char* pch_name) :
CSimObject(pch_name),
m_fMass(0),
m_fRotation(0)
{
m_vPosition.x = 0;
m_vPosition.y = 0;
// m_fPosX = 0;
// m_fPosY = 0;
}
/******************************************************************************/
/******************************************************************************/
CGeometry::CGeometry(const char* pch_name, double f_pos_x, double f_pos_y,
double f_rotation, double f_mass) :
CSimObject(pch_name),
m_fMass(f_mass),
m_fRotation(f_rotation)
{
m_vPosition.x = f_pos_x;
m_vPosition.y = f_pos_y;
}
/******************************************************************************/
/******************************************************************************/
CGeometry::~CGeometry()
{
// Do nothing
}
/******************************************************************************/
/******************************************************************************/
void CGeometry::GetPosition(double* x, double* y)
{
(*x) = m_vPosition.x;
(*y) = m_vPosition.y;
//(*x) = m_fPosX;
//(*y) = m_fPosY;
}
/******************************************************************************/
/******************************************************************************/
double CGeometry::GetRotation()
{
return m_fRotation;
}
/******************************************************************************/
/******************************************************************************/
void CGeometry::SetMass(double f_mass)
{
m_fMass = f_mass;
}
/******************************************************************************/
/******************************************************************************/
double CGeometry::GetMass()
{
return m_fMass;
}
/******************************************************************************/
/******************************************************************************/
double CGeometry::SetRotation(double f_rotation)
{
m_fRotation = f_rotation;
}
/******************************************************************************/
/******************************************************************************/
void CGeometry::SetPosition(double x, double y)
{
m_vPosition.x = x;
m_vPosition.y = y;
// m_fPosX = x;
// m_fPosY = y;
}
/******************************************************************************/
/******************************************************************************/
void CGeometry::SetPosition(dVector2 v)
{
m_vPosition = v;
}
/******************************************************************************/
/******************************************************************************/
dVector2 CGeometry::GetPosition()
{
return m_vPosition;
}
/******************************************************************************/
/******************************************************************************/
bool CGeometry::AreCollisionsOn()
{
return m_pcCollisionManager != NULL;
//return false;
}
/******************************************************************************/
/******************************************************************************/
CCollisionManager* CGeometry::GetCollisionManager()
{
return m_pcCollisionManager;
}
/******************************************************************************/
/******************************************************************************/
void CGeometry::SetCollisionManager(CCollisionManager* pc_collision_manager)
{
if (m_pcCollisionManager != NULL && pc_collision_manager != NULL)
{
printf("You are creating more than one collision managers!");
fflush(stdout);
}
m_pcCollisionManager = pc_collision_manager;
}
/******************************************************************************/
/******************************************************************************/