From 97bda39e6484e33abb614bdc4c5db555331955f4 Mon Sep 17 00:00:00 2001 From: Alex Matulich Date: Tue, 4 Nov 2025 21:58:23 -0800 Subject: [PATCH] Minor updates to documentation --- isosurface.scad | 2 +- rounding.scad | 2 +- shapes2d.scad | 9 +++++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/isosurface.scad b/isosurface.scad index 78ddd81..c360deb 100644 --- a/isosurface.scad +++ b/isosurface.scad @@ -2157,7 +2157,7 @@ function debug_tetra(r) = let(size=r/norm([1,1,1])) [ // ], // bounding_box = [[-16,-13,-5],[18,13,6]], // voxel_size=0.4); -// Example(3D): Next we show how to create a function that works like the built-ins. **This is a full implementation** that allows you to specify the function directly by name in the `spec` argument without needing the function literal syntax, and without needing the `point` argument in `spec`, as in the prior examples. Here, `noisy_sphere_calcs() is the calculation function that accepts the `point` position argument and any other parameters needed (here `r` and `noise_level`), and returns a single value. Then there is a "master" function `noisy_sphere() that does some error checking and returns an array consisting of (a) a function literal expression that sets all of your parameters, and (b) another array containing the metaball sign and a simple "debug" VNF representation of the metaball for viewing when `debug=true` is passed to `metaballs()`. The call to `mb_cutoff()` at the end handles the cutoff function for the noisy ball consistent with the other internal metaball functions; it requires `dist` and `cutoff` as arguments. You are not required to use this implementation in your own custom functions; in fact it's easier simply to declare the function literal in your `spec` argument, but this example shows how to do it all. +// Example(3D): Next we show how to create a function that works like the built-ins. **This is a full implementation** that allows you to specify the function directly by name in the `spec` argument without needing the function literal syntax, and without needing the `point` argument in `spec`, as in the prior examples. Here, `noisy_sphere_calcs()` is the calculation function that accepts the `point` position argument and any other parameters needed (here `r` and `noise_level`), and returns a single value. Then there is a "master" function `noisy_sphere()` that does some error checking and returns an array consisting of (a) a function literal expression that sets all of your parameters, and (b) another array containing the metaball sign and a simple "debug" VNF representation of the metaball for viewing when `debug=true` is passed to `metaballs()`. The call to `mb_cutoff()` at the end handles the cutoff function for the noisy ball consistent with the other internal metaball functions; it requires `dist` and `cutoff` as arguments. You are not required to use this implementation in your own custom functions; in fact it's easier simply to declare the function literal in your `spec` argument, but this example shows how to do it all. // // // // noisy sphere internal calculation function // diff --git a/rounding.scad b/rounding.scad index a316b0d..5d9739b 100644 --- a/rounding.scad +++ b/rounding.scad @@ -650,7 +650,7 @@ function _rounding_offsets(edgespec,z_dir=1) = // stroke(smooth_path(square(4),size=0.4), width=0.1); // stroke(smooth_path(square(4),method="corners",size=0.4), // color="red", width=0.1); -// Example(2D): Closing the path changes the end tangents. Original path in green, "edges" path in yellow, "corners" in red. +// Example(2D): Closing the path changes the end tangents. Original path in green, "edges" path in yellow, "corners" in red. For a shape like this, you may find it simpler to use {{squircle()}} instead. // polygon(smooth_path(square(4),method="edges",size=0.4,closed=true)); // color("red") // polygon(smooth_path(square(4),method="corners",size=0.4,closed=true)); diff --git a/shapes2d.scad b/shapes2d.scad index 909ef85..d880213 100644 --- a/shapes2d.scad +++ b/shapes2d.scad @@ -2021,6 +2021,10 @@ function _gs_indent_R(r1,r2,s,h) = // Usage: As Function // path = squircle(size, [squareness], [style=]); // Description: +// When called as a module, creates a 2D squircle with the specified squareness. +// When called as a function, returns a 2D path for a squircle. + +// . // A [squircle](https://en.wikipedia.org/wiki/Squircle) is a shape intermediate between a square/rectangle and a // circle/ellipse. Squircles are sometimes used to make dinner plates (more area for the same radius as a circle), keyboard // buttons, and smartphone icons. Old CRT television screens also resembled elongated squircles. @@ -2040,8 +2044,9 @@ function _gs_indent_R(r1,r2,s,h) = // Unlike the other styles, when the `size` parameter defines a rectangle, the bezier style retains the the corner // proportions for the short side of the corner rather than stretching the entire corner. // . -// When called as a module, creates a 2D squircle with the specified squareness. -// When called as a function, returns a 2D path for a squircle. +// By design, the squircle segments generated are neither constant-length nor constant-angle spacing. The number of +// segments is $fn rounded to the nearest multiple of 4, and the length of each segment is dependent on its proximity +// to the corner, with the segments at the corner being the shortest. // Arguments: // size = Same as the `size` parameter in `square()`, can be a single number or a vector `[xsize,ysize]`. // squareness = Value between 0 and 1. Controls the shape, setting the location of a squircle "corner" at the specified interpolated position between a circle and a square. When `squareness=0` the shape is a circle, and when `squareness=1` the shape is a square. Default: 0.5