Skip to content

Instantly share code, notes, and snippets.

@starstuffharvestingstarlight
Last active August 29, 2015 14:02
Show Gist options
  • Save starstuffharvestingstarlight/4d371d8489f55f54e030 to your computer and use it in GitHub Desktop.
Save starstuffharvestingstarlight/4d371d8489f55f54e030 to your computer and use it in GitHub Desktop.
an earring in OpenSCAD
// main radius of the earring (mm)
radius = 16;
// how much it grows with each degree
grow_factor = 0.001 * radius;
// how big is the sphere in relation to the last iterated object
sphere_factor = 1.5;
// degrees from 1 to max_t
max_t = 310;
tt = [1:max_t];
// cheat the circle into a triangle
fn_ear = 3;
// generate a smooth sphere
fn_sphere = 100;
union() {
for (t = tt) {
rotate(a = [0, t, 0])
render() {
linear_extrude(height = 1, scale = 1, $fn = fn_ear)
translate([radius, 0, 0])
circle(r = t * grow_factor, $fn = fn_ear);
}
}
translate([0, 0, radius * 0.1])
rotate(a = [0, max_t, 0])
translate([radius, 0, 0])
rotate(a = [0, -max_t + 90, 0])
scale([1.0, 1.0, 0.9])
render() {
sphere(r = max_t * grow_factor * sphere_factor, $fn = fn_sphere);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment