-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDoublePendulum.h
46 lines (40 loc) · 1.08 KB
/
DoublePendulum.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
#ifndef DOUBLEPENDULUM_CLASS_H
#define DOUBLEPENDULUM_CLASS_H
#include <glm/glm.hpp>
#include "Globals.h"
#include "Line.h"
#include "Circle.h"
#include "Helpers/Mathematics.h"
#include "Helpers/Utils.h"
/*
* Reference: https://www.myphysicslab.com/pendulum/double-pendulum-en.html
*/
class DoublePendulum {
private:
float _angle1;
float _angle2;
float _angularVel1 = 0.0f;
float _angularVel2 = 0.0f;
float _length1;
float _length2;
glm::vec3 _origin;
glm::vec3 _m1Pos;
glm::vec3 _m2Pos;
std::vector<Line*> _lines;
std::vector<Circle*> _circles;
void _calculateBobPositions();
public:
DoublePendulum(
const Primitives& primitives,
glm::vec3 o );
void SetAngle1Deg( float value );
void SetAngle2Deg( float value );
void Draw( Shader& shader, Camera& camera );
void Draw(
Shader& shader1,
Shader& shader2,
Camera& camera );
void Update();
glm::vec3 GetBobPosition();
};
#endif