Need advice to sketch squircle

Hi
I find way to sketch Squircle.
image

Refer link:

Thank
Travis

Did you tried rectangle>rounded>conic?

1 Like

I misunderstand, could you make it

it’s an option inside rectangle command:

https://docs.mcneel.com/rhino/7/help/en-us/index.htm#commands/rectangle.htm%3FTocPath%3DCommands|Alphabetical|R|_____15

1 Like

Hi Travis - here’s a way to get that type of shape - use a degree 4 curve or higher.

This pays no attention to the area as related to circles or the equations mentioned in the article but will get you that type of shape - the location of the second and fourth points - how close they are to the corner, will determine the sharpness of the corner.

-Pascal

6 Likes

Another method: Start with a NURBS circle and increase the weights of the corner control points using Weight

SquircleDC01.3dm (1.5 MB)

6 Likes

I don’t know if part of this shape idea is that the sides become linear for a moment at the mid-points, or not…

-Pascal

The rounded rectangle with conic corners is close to a squircle in terms of deviation. Pascal’s degree 5 curve is even better, with the intermediate point at 56% of the distance from the mid point to the corner.

Visually, the subtle belly in the rounded rectangle makes it distinguishable from the squircle and, to my taste, a less satisfying shape. I challenge anyone to distinguish Pascal’s curve from the squircle by eye:

p.s. The squircle here is an interpolated plot in Grasshopper of Lamé’s special quartic from the OP’s wikipedia link. This approach obviously results in a control point heavy curve, so Pascal’s close approximation is preferable.
squircle.gh (19.5 KB) [Edit: this gh file is deprecated - a newer version is posted below]

5 Likes

I think would be interesting to see the Curvature Graph as well.
As a version of an ellipse the Curvature graph must be really smooth.
Probably the Pascl’s Deg5 curves gives the best smoothness but what about the one in Wikipedia?

(Degree 4, btw… ) :upside_down_face:

-Pascal

Degree 5 in your video!

1 Like

The “squircle” is a special case of a superellipse with exponent 4 and equal coefficients. Representing a superellipse as a NURBS curve is discussed in section 30.3.5 of Handbook of Grid Generation, Thompson, Soni and Weatherill, 1999.

http://ebrary.free.fr/Mesh%20Generation/Handbook_of_Grid_%20Generation,1999/chap30.pdf

Similar to the algorithm for the circular arc, these three points can be used as the NURBS control polygon while setting the order to be 3 with knot vector (0., 0., 0., 1., 1., 1.). [Order 3 = Degree 2] The weights at the starting and ending control polygon can be set to 1.0. The only problem remaining is determining the weight at the middle point D of the control polygon. This is done similarly to the algorithm of the conic arc. The straight line OD is constructed to intersect with the line SE and the superelliptic arc at the points of m and h. The weight at point D is then set as the ratio of (hm/hD).
…
Table 30.1 shows the selected values of the
exponent η of the superellipse and the corresponding values of weights

TABLE 30.1 The Relationship
between Exponent η and Weights
η Weight
2.000000 0.7071067807
2.076143 0.7615055209
2.184741 0.8391550277
2.310944 0.9294727665
2.446475 1.0265482055
2.736506 1.2345144266
2.894152 1.3476587943
3.064489 1.4699782629
3.250206 1.6034070829
3.676614 1.9099667660
3.924127 2.0880154404
4.201364 2.2875017047
4.515468 2.5136151423
4.875638 2.7729511992
5.293192 3.0736854139
5.786112 3.4287875496
6.375087 3.8531827169
7.047038 4.3374610450
7.759080 4.8507150955
8.451551 5.3499221183
9.061041 5.7893464878
9.533431 6.1299460466
9.999865 6.4662654998
10.00000 6.4663630857

Using linear interpolation the weight for an exponent of 4 will be close to 2.146.

The curvature of the formulas in Wikipedia is very smooth with all derivatives continuous.

3 Likes

Hi Jeremy - the Curve command-line degree setting is a maximum - if you do not place degree +1 points it takes on a lower degree, in this case, with 5 points, degree 4. I wonder if the prompt should be for MaximumDegree…

That curve goes flat/linear, right at the mid points of the square - that seems to be incorrect, David mentions that the curvature on the more correct curve is never zero, if I understood.

-Pascal

File with a NURBS squircle using weight of 2.146. The match to the squircle formula could be improved by refining the weight using the method in the reference in my previous post.
NURBS Squircle DC01.3dm (1.5 MB)

Three control points in a line results in zero curvature.

1 Like

@jeremy5 Could you post a file with the “exact” squircle from Grasshopper?

Sorry @davidcockey, I won’t be at my computer for a few hours. If you want to see it sooner, I posted the GH file, so you can bake one.

Here you go. Except that when I generated the curvature graph for my original interpolated curve it was dreadful, because I had too few points for a smooth interpolation. This one uses a lot more…

Here’s the updated overlay:

Here are the three curves. I haven’t tried adding yours in yet but look forward to seeing it (I was hoping you would bring your mathematical expertise to the party :partying_face:).
squircle.3dm (60.1 KB)

And here is an update to the GH file with a couple of fixes.
squircle.gh (19.7 KB)

Regards
Jeremy

3 Likes

As I said earlier, I don’t believe the eye can distinguish between the squircle and your curve. Given the OP wanted to sketch the squircle I think your curve is good enough for the solution.

I did wonder if the flatness would be more apparent if the curve was extruded but that doesn’t seem to be the case.

Regards
Jeremy

1 Like

Yeah- with that lighting, the middle one appears to go flattest in the middle, to my eye.

-Pascal