From fafa551959ef84006083c91cd03a12fb51be7d0d Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Fri, 17 May 2019 17:59:08 +0800 Subject: [PATCH] added torus_knot --- src/torus_knot.scad | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 src/torus_knot.scad diff --git a/src/torus_knot.scad b/src/torus_knot.scad new file mode 100644 index 00000000..6bf26975 --- /dev/null +++ b/src/torus_knot.scad @@ -0,0 +1,11 @@ +function torus_knot(p, q, phi_step) = [ + for(phi = [0:phi_step:6.28318]) + let( + degree = phi * 180 / 3.14159, + r = cos(q * degree) + 2, + x = r * cos(p * degree), + y = r * sin(p * degree), + z = -sin(q * degree) + ) + [x, y, z] +]; \ No newline at end of file