aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorYann Herklotz <ymherklotz@gmail.com>2017-05-12 12:54:20 +0100
committerYann Herklotz <ymherklotz@gmail.com>2017-05-12 12:54:20 +0100
commitf7fc06b5066018451b6b456be0dbc46bafe2fd88 (patch)
treedbb167c37d6b2a877c093e38b20b47174b38380d /include
parenta8bf22bf263762c56546751fcfcae181d574582a (diff)
downloadYAGE-f7fc06b5066018451b6b456be0dbc46bafe2fd88.tar.gz
YAGE-f7fc06b5066018451b6b456be0dbc46bafe2fd88.zip
Removed force
Diffstat (limited to 'include')
-rw-r--r--include/YAGE/Physics/README.org23
-rw-r--r--include/YAGE/Physics/body.hpp6
-rw-r--r--include/YAGE/Physics/rigidbody.hpp1
3 files changed, 28 insertions, 2 deletions
diff --git a/include/YAGE/Physics/README.org b/include/YAGE/Physics/README.org
new file mode 100644
index 00000000..0a2a5066
--- /dev/null
+++ b/include/YAGE/Physics/README.org
@@ -0,0 +1,23 @@
+#+TITLE: README
+#+DATE: <2017-04-17 Mon>
+#+AUTHOR:
+#+EMAIL: yannherklotz@yann-arch
+#+OPTIONS: ':nil *:t -:t ::t <:t H:3 \n:nil ^:t arch:headline
+#+OPTIONS: author:t c:nil creator:comment d:(not "LOGBOOK") date:t
+#+OPTIONS: e:t email:nil f:t inline:t num:t p:nil pri:nil stat:t
+#+OPTIONS: tags:t tasks:t tex:t timestamp:t toc:t todo:t |:t
+#+CREATOR: Emacs 25.1.1 (Org mode 8.2.10)
+#+DESCRIPTION:
+#+EXCLUDE_TAGS: noexport
+#+KEYWORDS:
+#+LANGUAGE: en
+#+SELECT_TAGS: export
+
+* Physics Engine
+
+** Acceleration, speed and position
+
+ I have a = dv/dt; v=dp/dt;
+
+ I am going to use the second order runga kutta method with a=0, b=1, alpha=1/2 and beta=1/2
+
diff --git a/include/YAGE/Physics/body.hpp b/include/YAGE/Physics/body.hpp
index 9806f4e3..170ef491 100644
--- a/include/YAGE/Physics/body.hpp
+++ b/include/YAGE/Physics/body.hpp
@@ -9,6 +9,8 @@ namespace yage
class Body
{
protected:
+ // current force acting on object
+ glm::vec2 force_;
// current velocity of the object
glm::vec2 velocity_;
@@ -28,8 +30,8 @@ public:
virtual void applyForce(const glm::vec2 &force)=0;
protected:
// protected constructor to initialize member variables
- Body(const glm::vec2 &center_of_mass, double mass, const glm::vec2 &velocity, bool gravity) :
- velocity_(velocity), center_of_mass_(center_of_mass),
+ Body(const glm::vec2 &center_of_mass, double mass, const glm::vec2 &force, const glm::vec2 &velocity, bool gravity) :
+ force_(force), velocity_(velocity), center_of_mass_(center_of_mass),
mass_(mass), gravity_(gravity)
{}
};
diff --git a/include/YAGE/Physics/rigidbody.hpp b/include/YAGE/Physics/rigidbody.hpp
index 47f3bc01..56f089ed 100644
--- a/include/YAGE/Physics/rigidbody.hpp
+++ b/include/YAGE/Physics/rigidbody.hpp
@@ -11,6 +11,7 @@ class RigidBody : public Body
public:
RigidBody(const glm::vec2 &center_of_mass,
double mass,
+ const glm::vec2 &force=glm::vec2(0.f, 0.f),
const glm::vec2 &velocity=glm::vec2(0.f, 0.f),
bool gravity=true);