From 94cae52f9db140ad2e3147b85767c276d7f3ace0 Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Mon, 28 Oct 2019 15:29:41 +0800 Subject: [PATCH] add nautilus_shell --- examples/nautilus_shell.scad | 49 ++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 examples/nautilus_shell.scad diff --git a/examples/nautilus_shell.scad b/examples/nautilus_shell.scad new file mode 100644 index 00000000..d8ed0cac --- /dev/null +++ b/examples/nautilus_shell.scad @@ -0,0 +1,49 @@ +include ; +include ; +include ; +include ; +include ; + + +$fn = 24; + +chambered_section_max_angle = 300; +steps = 25; +thickness = 1; +slices = 5; +semi_minor_axis = 10; +height = 5; + +module nautilus_shell(chambered_section_max_angle, steps, thickness) { + function r(a) = pow(2.71828, 0.0053468 * a); + + a_step = chambered_section_max_angle / steps; + spiral = [ + for(a = [a_step:a_step:chambered_section_max_angle + 450]) + rotate_p([r(a), 0], a) + ]; + + render() { + hull_polyline2d(spiral, thickness); + + for(a = [a_step:a_step * 2:chambered_section_max_angle]) { + a2 = a + 360; + a3 = a + 420; + p1 = rotate_p([r(a), 0], a); + p2 = rotate_p((p1 + rotate_p([r(a2), 0], a2)) * .6, -5); + p3 = rotate_p([r(a3), 0], a3); + + hull_polyline2d(bezier_curve(0.1, + [p1, p2, p3] + ), thickness); + } + + } +} + +ellipse_extrude(semi_minor_axis, height = height, slices = slices) + nautilus_shell(chambered_section_max_angle, steps, thickness); + +mirror([0, 0, 1]) +ellipse_extrude(semi_minor_axis, height = height, slices = slices) + nautilus_shell(chambered_section_max_angle, steps, thickness);