1 /* involute, Copyright (c) 2004-2014 Jamie Zawinski <jwz@jwz.org>
3 * Permission to use, copy, modify, distribute, and sell this software and its
4 * documentation for any purpose is hereby granted without fee, provided that
5 * the above copyright notice appear in all copies and that both that
6 * copyright notice and this permission notice appear in supporting
7 * documentation. No representations are made about the suitability of this
8 * software for any purpose. It is provided "as is" without express or
11 * Utilities for rendering OpenGL gears with involute teeth.
14 #ifndef __GEAR_INVOLUTE_H__
15 #define __GEAR_INVOLUTE_H__
18 unsigned long id; /* unique name */
19 double x, y, z; /* position */
20 double r; /* radius of the gear, at middle of teeth */
21 double th; /* rotation (degrees) */
23 GLint nteeth; /* how many teeth */
24 double tooth_w, tooth_h; /* size of teeth */
26 double tooth_slope; /* 0 for normal right-angle gear; 1 = 45 deg. */
27 double inner_r; /* radius of the (larger) inside hole */
28 double inner_r2; /* radius of the (smaller) inside hole, if any */
29 double inner_r3; /* yet another */
31 double thickness; /* height of the edge */
32 double thickness2; /* height of the (smaller) inside disc if any */
33 double thickness3; /* yet another */
34 int spokes; /* how many spokes inside, if any */
35 int nubs; /* how many little nubbly bits, if any */
36 double spoke_thickness; /* spoke versus hole */
37 double wobble; /* factory defect! */
38 int motion_blur_p; /* whether it's spinning too fast to draw */
39 int polygons; /* how many polys in this gear */
41 double ratio; /* gearing ratio with previous gears */
42 double rpm; /* approximate revolutions per minute */
44 Bool inverted_p; /* whether this gear has teeth on the inside */
45 Bool base_p; /* whether this gear begins a new train */
46 int coax_p; /* whether this is one of a pair of bound gears.
47 1 for first, 2 for second. */
48 double coax_displacement; /* distance between gear planes */
50 double coax_thickness; /* thickness of the other gear in the pair */
52 enum { INVOLUTE_SMALL,
55 INVOLUTE_HUGE } size; /* Controls complexity of mesh. */
62 /* Render one gear, unrotated at 0,0.
63 Returns the number of polygons.
65 extern int draw_involute_gear (gear *g, Bool wire_p);
67 /* Draws a much simpler representation of a gear.
68 Returns the number of polygons.
70 extern int draw_involute_schematic (gear *g, Bool wire_p);
72 /* Which of the gear's inside rings is the biggest?
74 extern int involute_biggest_ring (gear *g,
75 double *posP, double *sizeP,
78 #endif /* __GEAR_INVOLUTE_H__ */