Demonstrandum / Acetone

Haskell 2D Graphics
GNU General Public License v3.0
0 stars 0 forks source link

Implement squircle. #3

Open Demonstrandum opened 2 years ago

Demonstrandum commented 2 years ago

More shapes in shapes package. Squircle continuous rounded rectangle with opengl triangle strip. https://www.desmos.com/calculator/sy6c5tuake

As well as regular polygons, with their polygoid (?) rounded variants.

https://www.desmos.com/calculator/qyf9pvxosz https://www.desmos.com/calculator/uwrivivhmo

https://www.johndcook.com/blog/2020/07/05/squircle-corner-radius/ https://www.figma.com/blog/desperately-seeking-squircles/

Demonstrandum commented 2 years ago

Classes of rounded rectangles:

It should be noted that the corners should still essentially be spliced onto a rectangle, since applying the methods to non-square rectangles leaves you with corners distorted on the dimension of the longest side of the rectangle. This saves computation (only compute one corner, copy it four times), leverages us greater control of the look on the vertex level (without trying to derive some painful formula) and lets us turn on and off each corner as we choose (like CSS: border-top-left-radius: 5pt).