1 /* GNU AGPLv3 (or later at your option)
2 see bottom for more license info */
4 /* spin thing that erin likes */
12 penny_radius
= 19.05 / 2;
13 penny_thickness
= 1.52;
14 weight_radius
= (weight
== "penny") ? penny_radius
: _608zz_radius
;
15 bearing_radius
= (bearing
== "608zz") ? _608zz_radius
: 1/0;
18 module
spin(weight_radius
,
22 bearing_holder_radius
= bearing_radius
+ wall_thickness
;
23 weight_holder_radius
= weight_radius
+ wall_thickness
;
25 circle(bearing_holder_radius
);
28 * imagine a right triangle with one point at the origin, at the
29 * center of the spinning bearing holder, one point in the middle of
30 * the weight holder, and one point at the center of a circle tangent
31 * to the first two, called the joiner circle.
32 * the radius of the joiner circle is the arithmetic average of the
33 * weight holder and bearing holder.
35 joiner_radius
= (bearing_holder_radius
+ weight_holder_radius
) / 2;
36 /* a: goes between the center of the weight holder and the center of
38 a
= joiner_radius
+ weight_holder_radius
;
39 /* b: length of the base, which goes along the x-axis between
40 the origin and the center of the weight holder. */
41 b
= weight_holder_radius
+ bearing_holder_radius
;
42 /* c: goes between origin and joiner circle. */
43 c
= bearing_holder_radius
+ joiner_radius
;
45 /* A: angle at the origin, between the base and hypotenuse.
46 it is calculated using law of cosines, given the lengths of
47 all 3 sides of the triangle. */
48 A
= acos((pow(b
, 2) + pow(c
, 2) - pow(a
, 2)) / (2 * b
* c
));
49 /* find the center of the joiner circle */
50 joiner_x
= cos(A
) * c
;
51 joiner_y
= sin(A
) * c
;
53 /* find the points where the circles meet */
54 bearing_joiner_point
= [cos(A
) * bearing_holder_radius
,
55 sin(A
) * bearing_holder_radius
];
56 bearing_weight_point
= [bearing_holder_radius
, 0];
57 /* C: angle between x-axis and line-segment between center of weight
58 holder and center of joiner.
59 it is calculated using law of cosines, given the lengths of
60 all 3 sides of the triangle. */
61 C
= acos((pow(a
, 2) + pow(b
, 2) - pow(c
, 2)) / (2 * a
* b
));
62 weight_joiner_point
= [b
- cos(C
) * weight_holder_radius
,
63 sin(C
) * weight_holder_radius
];
64 for(arm
= [0 : arms
- 1]) {
65 rotate(arm
* 360.0 / arms
) {
67 polygon([bearing_weight_point
,
69 weight_joiner_point
]);
70 translate([joiner_x
, joiner_y
]) {
71 circle(joiner_radius
); } }
72 mirror(v
= [0, 1, 0]) {
74 polygon([bearing_weight_point
,
76 weight_joiner_point
]);
77 translate([joiner_x
, joiner_y
]) {
78 circle(joiner_radius
); } } }
79 translate([weight_holder_radius
+ bearing_holder_radius
, 0]) {
80 circle(weight_holder_radius
); } } } }
83 This file is part of 3d-printables.
85 3d-printables is free software: you can redistribute it and/or modify
86 it under the terms of the GNU Affero General Public License as published by
87 the Free Software Foundation, either version 3 of the License, or
88 (at your option) any later version.
90 3d-printables is distributed in the hope that it will be useful,
91 but WITHOUT ANY WARRANTY; without even the implied warranty of
92 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
93 GNU Affero General Public License for more details.
95 You should have received a copy of the GNU Affero General Public License
96 along with challenge-bot. If not, see <http://www.gnu.org/licenses/>.