-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathForceOneObject.h
69 lines (60 loc) · 1.65 KB
/
ForceOneObject.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
/**
* @file ForceOneObject.h
* @author Dan R. Lipsa
* @date 7 June 2011
* @brief Forces and torque acting on one object
* @ingroup data model
*/
#ifndef __FORCE_ONE_OBJECT_H__
#define __FORCE_ONE_OBJECT_H__
#include "Enums.h"
class Body;
/**
* @brief Names of parameters in a DMP file where the network and the
* pressure forces are stored.
*/
struct ForceNamesOneObject
{
ForceNamesOneObject ();
size_t m_bodyId;
boost::array<string, 3> m_networkForceName;
boost::array<string, 3> m_pressureForceName;
string m_networkTorqueName;
string m_pressureTorqueName;
};
/**
* @brief Forces and torque acting on one object
*/
class ForceOneObject
{
public:
ForceOneObject ();
ForceOneObject (boost::shared_ptr<Body> body);
ForceOneObject& operator+= (const ForceOneObject& other);
ForceOneObject& operator-= (const ForceOneObject& other);
ForceOneObject operator/ (float value) const;
G3D::Vector3 GetForce (ForceType::Enum type) const;
void SetForce (ForceType::Enum type, float x, float y, float z);
float GetTorque (ForceType::Enum type) const;
void SetTorque (ForceType::Enum type, float t);
void SetBody (boost::shared_ptr<Body> body)
{
m_body = body;
}
boost::shared_ptr<Body> GetBody () const
{
return m_body;
}
string ToString () const;
friend ostream& operator<< (ostream& ostr, const ForceOneObject& foo);
private:
boost::shared_ptr<Body> m_body;
G3D::Vector3 m_networkForce;
G3D::Vector3 m_pressureForce;
float m_networkTorque;
float m_pressureTorque;
};
#endif //__FORCE_ONE_OBJECT_H__
// Local Variables:
// mode: c++
// End: