aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorYann Herklotz <ymherklotz@gmail.com>2017-08-06 21:42:40 +0100
committerYann Herklotz <ymherklotz@gmail.com>2017-08-06 21:42:40 +0100
commit3ce4865390924d13c525938c5c60c73650564a50 (patch)
tree973a886ba303ef5f379fb0dbc0f49c23ff8268c1 /include
parent5401b4a6ea1055e27820fd1155c7093d63491214 (diff)
downloadYAGE-3ce4865390924d13c525938c5c60c73650564a50.tar.gz
YAGE-3ce4865390924d13c525938c5c60c73650564a50.zip
ParticleBody now passes gravity test
Diffstat (limited to 'include')
-rw-r--r--include/YAGE/Physics/body.hpp45
1 files changed, 21 insertions, 24 deletions
diff --git a/include/YAGE/Physics/body.hpp b/include/YAGE/Physics/body.hpp
index f32b767d..fab28fc1 100644
--- a/include/YAGE/Physics/body.hpp
+++ b/include/YAGE/Physics/body.hpp
@@ -12,45 +12,42 @@
#include "Math/matrix.hpp"
namespace yage {
-
class Body {
public:
- // gravity constant
- static const double GRAVITY;
+ // gravity constant
+ static const double GRAVITY;
protected:
- // center of mass of the object
- Vector2d position_ = Vector2d(0, 0);
+ // center of mass of the object
+ Vector2d position_ = Vector2d(0, 0);
- // mass of the object
- double mass_ = 1;
+ // mass of the object
+ double mass_ = 1;
- // current velocity of the object
- Vector2d velocity_ = Vector2d(0, 0);
+ // current velocity of the object
+ Vector2d velocity_ = Vector2d(0, 0);
- // boolean that defines if gravity can act on the object
- bool gravity_ = true;
+ // boolean that defines if gravity can act on the object
+ bool gravity_ = true;
- // current acceleration
- Vector2d acceleration_ = Vector2d(0, 0);
+ // current acceleration
+ Vector2d acceleration_ = Vector2d(0, 0);
- // force acting on the body
- Vector2d force_ = Vector2d(0, 0);
+ // force acting on the body
+ Vector2d force_ = Vector2d(0, 0);
public:
- // apply force to the object and update the velocity
- virtual void applyForce(const Vector2d& force) = 0;
- virtual void update() = 0;
+ // apply force to the object and update the velocity
+ virtual void applyForce(const Vector2d& force) = 0;
+ virtual void update() = 0;
- double xPosition() const;
- double yPosition() const;
+ double xPosition() const;
+ double yPosition() const;
protected:
- // protected constructor to initialize member variables
- Body(const Vector2d& position = Vector2d(0, 0), double mass = 1,
- const Vector2d& velocity = Vector2d(0, 0), bool gravity = false);
+ // protected constructor to initialize member variables
+ Body(const Vector2d& position = Vector2d(0, 0), double mass = 1, const Vector2d& velocity = Vector2d(0, 0), bool gravity = false);
};
-
} // namespace yage
#endif