X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=antikythera;a=blobdiff_plain;f=src%2Fgear.h;fp=src%2Fgear.h;h=12d9ba2fe1e4c71b34a4b9da3fb2b94284fb5048;hp=5fde21fefaa2efc0dad8ddc8ec683f65b3f987ab;hb=a88a9ac53952e1bb3768b147a043c19392e3d5d1;hpb=ae60a8cb1a30e204e7f60969fe6245e510cca0ff diff --git a/src/gear.h b/src/gear.h index 5fde21f..12d9ba2 100644 --- a/src/gear.h +++ b/src/gear.h @@ -2,6 +2,7 @@ #define GEAR_H_ #include +#include #include #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();