gears meshing, machines of gears, machines of MADNESS
[antikythera] / src / gear.h
index 5fde21f..12d9ba2 100644 (file)
@@ -2,6 +2,7 @@
 #define GEAR_H_
 
 #include <vector>
+#include <string>
 #include <gmath/gmath.h>
 #include "mesh.h"
 
@@ -44,9 +45,11 @@ private:
        float contour(float u);
 
 public:
+       std::string name;
        Vec3 pos, axis; /* implicitly defines a plane eqn. */
        float pdist;    /* derived: distance of plane from origin */
 
+       float init_angle;       /* initial starting angle */
        float angle;    /* current angle of the gear */
 
        int nteeth;             /* number of teeth */
@@ -63,6 +66,15 @@ public:
        Gear();
        ~Gear();
 
+       // sets the supplied number of teeth, and calculates the radius
+       // of the gear, to achieve the required tooth pitch
+       void set_teeth(int nt, float tooth_pitch);
+
+       float get_rotation() const;
+
+       // returns the angle (in radians) from one tooth to the next
+       float get_angular_pitch() const;
+
        void draw() const;
 
        bool gen_mesh();