This repository has been archived by the owner on Jan 18, 2024. It is now read-only.
forked from rpbpolis/spic-prj-api
-
Notifications
You must be signed in to change notification settings - Fork 1
/
RigidBody.hpp
104 lines (87 loc) · 2.63 KB
/
RigidBody.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
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
#ifndef RIGIDBODY_H_
#define RIGIDBODY_H_
#include "Component.hpp"
#include "Point.hpp"
#if __has_include("RigidBody_includes.hpp")
#include "RigidBody_includes.hpp"
#endif
namespace spic {
/**
* @brief Enumeration for different rigid body types
* @spicapi
*/
enum class BodyType {
staticBody,
kinematicBody,
dynamicBody
};
/**
* @brief A component representing a rigid body.
* @spicapi
*/
class RigidBody : public Component {
public:
/**
* @brief Constructor
* @param mass The mass of the rigid body
* @param gravityScale The scale of the gravity of the rigid body
* @param bodyType The type of the rigid body
* @sharedapi
*/
RigidBody(double mass, double gravityScale, const BodyType& bodyType);
/**
* @brief Apply force to this rigid body.
* @param forceDirection A point, used as a vector to indicate direction
* and magnitude of the force to be applied.
* @spicapi
*/
void AddForce(const Point& forceDirection);
/**
* @brief The type of this body.
* @return The current value.
* @sharedapi
*/
BodyType Type() const;
/**
* @brief The type of this body.
* @param newBodyType The desired value.
* @sharedapi
*/
void Type(BodyType newBodyType);
/**
* @brief The mass of this body.
* @return The current value.
* @sharedapi
*/
double Mass() const;
/**
* @brief The mass of this body.
* @param newMass The desired value.
* @sharedapi
*/
void Mass(double newMass);
/**
* @brief The gravity scale of this body.
* @return The current value.
* @sharedapi
*/
double GravityScale() const;
/**
* @brief The gravity scale of this body.
* @param newMass The desired value.
* @sharedapi
*/
void GravityScale(double newGravityScale);
#if __has_include("RigidBody_public.hpp")
#include "RigidBody_public.hpp"
#endif
private:
double mass;
double gravityScale;
BodyType bodyType;
#if __has_include("RigidBody_private.hpp")
#include "RigidBody_private.hpp"
#endif
};
}
#endif // RIGIDBODY_H_