diff --git a/docs/images/lib-torus_knot-1.JPG b/docs/images/lib-torus_knot-1.JPG new file mode 100644 index 00000000..3e098137 Binary files /dev/null and b/docs/images/lib-torus_knot-1.JPG differ diff --git a/docs/images/lib-torus_knot-2.JPG b/docs/images/lib-torus_knot-2.JPG new file mode 100644 index 00000000..137a8347 Binary files /dev/null and b/docs/images/lib-torus_knot-2.JPG differ diff --git a/docs/lib-torus_knot.md b/docs/lib-torus_knot.md new file mode 100644 index 00000000..d59c13b4 --- /dev/null +++ b/docs/lib-torus_knot.md @@ -0,0 +1,37 @@ +# torus_knot + +Generate a path of [The (p,q)-torus knot](https://en.wikipedia.org/wiki/Torus_knot). + +![torus_knot](images/lib-torus_knot-1.JPG) + +## Parameters + +- `p` : The p parameter of The (p,q)-torus knot. +- `q` : The q parameter of The (p,q)-torus knot. +- `phi_step` : The amount when increasing phi. + +## Examples + + include ; + include ; + include ; + include ; + include ; + + p = 2; + q = 3; + phi_step = 0.05; + star_radius = 0.5; + + pts = torus_knot(p, q, phi_step); + + shape_pentagram_pts = shape_pentagram(star_radius); + + path_extrude( + shape_pentagram_pts, + concat(pts, [pts[0]]), + closed = true + ); + +![torus_knot](images/lib-torus_knot-2.JPG) +