-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPendulum.h
36 lines (28 loc) · 861 Bytes
/
Pendulum.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
#include "cinder/app/AppBasic.h"
#include "cinder/gl/gl.h"
using namespace ci;
using namespace ci::app;
using namespace std;
class Pendulum
{
// physical params
int count;
int index;
float freq; // oscilations per second
// physical vars
float pos; // position of pendulum (-1...1)
float vel; // current velocity
Vec2f pt;
float size;
// musical params
int pitch; // midi note number to trigger
// display params
float hit; // 0...1, how recently we 'hit' the edge
// contructor
public:
Pendulum(int _count, int _index, float _freq, int _pitch);
// update position and trigger sound if nessecary
void update(float _t, float _c, float _width, float _height, float _size);
// draw
void draw(Pendulum** pendulums, int count);
};