Compare commits

...

2 commits

Author SHA1 Message Date
Alex Matulich
835cbc0f00 Removed _squircle_anchor_radius() function no longer needed 2024-12-09 12:29:03 -08:00
Alex Matulich
039485e913 Added paragraph breaks in coments for squircle 2024-12-09 12:21:53 -08:00

View file

@ -1999,8 +1999,11 @@ function reuleaux_polygon(n=3, r, d, anchor=CENTER, spin=0) =
// path = squircle(squareness, size, [style]); // path = squircle(squareness, size, [style]);
// Description: // Description:
// 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. // 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.
// .
// There are multiple approaches to constructing a squircle. One approach is a special case of superellipse (shown in {{supershape}} example 3), and uses exponents to adjust the shape. Another, called Fernández-Guasti squircle or FG squircle, arises from work in optics and uses a "squareness" parameter between 0 and 1 to adjust the shape. // There are multiple approaches to constructing a squircle. One approach is a special case of superellipse (shown in {{supershape}} example 3), and uses exponents to adjust the shape. Another, called Fernández-Guasti squircle or FG squircle, arises from work in optics and uses a "squareness" parameter between 0 and 1 to adjust the shape.
// .
// The FG style and superellipse style squircles are visually almost indistinguishable, with the superellipse having slightly rounder "corners" than FG for a given value of squareness. Either style requires just the two parameters `squareness` and `size`. The vertex distribution is adjusted to be more dense at the corners for smoothness at low values of `$fn`. // The FG style and superellipse style squircles are visually almost indistinguishable, with the superellipse having slightly rounder "corners" than FG for a given value of squareness. Either style requires just the two parameters `squareness` and `size`. The vertex distribution is adjusted to be more dense at the corners for smoothness at low values of `$fn`.
// .
// When called as a module, creates a 2D squircle with the desired squareness. // When called as a module, creates a 2D squircle with the desired squareness.
// When called as a function, returns a 2D path for a squircle. // When called as a function, returns a 2D path for a squircle.
// Arguments: // Arguments:
@ -2072,14 +2075,6 @@ function squircle(squareness=0.5, size=[1,1], style="fg", atype="box", anchor=CE
? [reorient(anchor, spin, two_d=true, size=size, p=path, extent=false, override=override), override] ? [reorient(anchor, spin, two_d=true, size=size, p=path, extent=false, override=override), override]
: reorient(anchor, spin, two_d=true, size=size, p=path, extent=false, override=override); : reorient(anchor, spin, two_d=true, size=size, p=path, extent=false, override=override);
function _squircle_anchor_radius(squareness, angle, style) =
style == "fg"
? let(sq = _linearize_squareness(squareness))
squircle_radius_fg(sq, 1, angle)
: let(n = _squircle_se_exponent(squareness))
squircle_radius_se(n, 1, angle);
//_superformula(theta=angle, m1=4,m2=4,n1=n,n2=n,n3=n,a=1,b=1);
/* FG squircle functions */ /* FG squircle functions */