From d7364eb89f81fa770bc3658a93917412baa020df Mon Sep 17 00:00:00 2001 From: Yann Herklotz Date: Thu, 24 Aug 2017 00:24:58 +0100 Subject: Updating docs --- body_8hpp_source.html | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'body_8hpp_source.html') diff --git a/body_8hpp_source.html b/body_8hpp_source.html index 15710e0a..cca13de1 100644 --- a/body_8hpp_source.html +++ b/body_8hpp_source.html @@ -85,30 +85,30 @@ $(document).ready(function(){initNavTree('body_8hpp_source.html','');});
body.hpp
-Go to the documentation of this file.
1 /* ----------------------------------------------------------------------------
2  * body.hpp
3  *
4  * Copyright (c) 2017 Yann Herklotz Grave <ymherklotz@gmail.com> -- MIT License
5  * See file LICENSE for more details
6  * ----------------------------------------------------------------------------
7  */
8 
9 #ifndef YAGE_PHYSICS_BODY_HPP
10 #define YAGE_PHYSICS_BODY_HPP
11 
12 #include "Math/matrix.hpp"
13 
14 namespace yage {
15 class Body {
16 public:
17  // gravity constant
18  static const double GRAVITY;
19 
20 protected:
21  // center of mass of the object
23 
24  // mass of the object
25  double mass_ = 1;
26 
27  // current velocity of the object
29 
30  // boolean that defines if gravity can act on the object
31  bool gravity_ = true;
32 
33  // current acceleration
35 
36  // force acting on the body
38 
39 public:
40  // apply force to the object and update the velocity
41  virtual void applyForce(const Vector2d& force) = 0;
42  virtual void update() = 0;
43 
44  double xPosition() const;
45  double yPosition() const;
46 
47 protected:
48  // protected constructor to initialize member variables
49  Body(Vector2d position = Vector2d(0, 0), double mass = 1, Vector2d velocity = Vector2d(0, 0), bool gravity = false);
50 };
51 } // namespace yage
52 
53 #endif
bool gravity_
Definition: body.hpp:31
-
static const double GRAVITY
Definition: body.hpp:18
+Go to the documentation of this file.
1 /* ----------------------------------------------------------------------------
2  * body.hpp
3  *
4  * Copyright (c) 2017 Yann Herklotz Grave <ymherklotz@gmail.com> -- MIT License
5  * See file LICENSE for more details
6  * ----------------------------------------------------------------------------
7  */
8 
9 #ifndef YAGE_PHYSICS_BODY_HPP
10 #define YAGE_PHYSICS_BODY_HPP
11 
12 #include "Math/matrix.hpp"
13 
14 namespace yage
15 {
16 class Body
17 {
18 public:
19  // gravity constant
20  static const double GRAVITY;
21 
22 protected:
23  // center of mass of the object
25 
26  // mass of the object
27  double mass_ = 1;
28 
29  // current velocity of the object
31 
32  // boolean that defines if gravity can act on the object
33  bool gravity_ = true;
34 
35  // current acceleration
37 
38  // force acting on the body
40 
41 public:
42  // apply force to the object and update the velocity
43  virtual void applyForce(const Vector2d &force) = 0;
44  virtual void update() = 0;
45 
46  double xPosition() const;
47  double yPosition() const;
48 
49 protected:
50  // protected constructor to initialize member variables
51  Body(Vector2d position = Vector2d(0, 0), double mass = 1,
52  Vector2d velocity = Vector2d(0, 0), bool gravity = false);
53 };
54 } // namespace yage
55 
56 #endif
bool gravity_
Definition: body.hpp:33
+
static const double GRAVITY
Definition: body.hpp:20
virtual void applyForce(const Vector2d &force)=0
-
Vector2d force_
Definition: body.hpp:37
+
Vector2d force_
Definition: body.hpp:39
-
double xPosition() const
Definition: body.cpp:17
-
Definition: body.hpp:15
-
Body(Vector2d position=Vector2d(0, 0), double mass=1, Vector2d velocity=Vector2d(0, 0), bool gravity=false)
Definition: body.cpp:21
-
Vector2d velocity_
Definition: body.hpp:28
-
double yPosition() const
Definition: body.cpp:19
-
Vector2< double > Vector2d
Definition of a 2D vector.
Definition: matrix.hpp:316
-
Vector2d acceleration_
Definition: body.hpp:34
-
double mass_
Definition: body.hpp:25
+
double xPosition() const
Definition: body.cpp:18
+
Definition: body.hpp:16
+
Body(Vector2d position=Vector2d(0, 0), double mass=1, Vector2d velocity=Vector2d(0, 0), bool gravity=false)
Definition: body.cpp:22
+
Vector2d velocity_
Definition: body.hpp:30
+
double yPosition() const
Definition: body.cpp:20
+
Vector2< double > Vector2d
Definition of a 2D vector.
Definition: matrix.hpp:350
+
Vector2d acceleration_
Definition: body.hpp:36
+
double mass_
Definition: body.hpp:27
virtual void update()=0
Templated matrix class.
Definition: camera2d.hpp:17
-
Vector2d position_
Definition: body.hpp:22
+
Vector2d position_
Definition: body.hpp:24