gears meshing, machines of gears, machines of MADNESS
[laserbrain_demo] / src / machine.h
1 #ifndef MACHINE_H_
2 #define MACHINE_H_
3
4 #include <vector>
5 #include "gear.h"
6
7 struct Motor {
8         float speed;    /* signed to denote direction, in Hz */
9         int drive;              /* which gear it drives */
10 };
11
12 class Machine {
13 private:
14         std::vector<Gear*> gears;
15         bool **meshing;
16         bool *visited;  /* used for update_gear */
17
18         std::vector<Motor> motors;
19
20         void update_gear(int idx, float angle);
21
22 public:
23         Machine();
24         ~Machine();
25
26         void add_gear(Gear *g); /* takes ownership */
27         void add_motor(int gearidx, float speed_hz);
28
29         void calc_meshing();
30
31         void update(float dt);
32         void draw() const;
33 };
34
35 #endif  // MACHINE_H_