Article 75FG6 Smoothed polygons

Smoothed polygons

by
John
from John D. Cook on (#75FG6)

The previous post constructed a triangular analog of the squircle, the unit circle in thep-norm wherep is typically around 4. The casep = 2 is a Euclidean circle and the limit as p is a Euclidean square.

The previous post introduced three functions Li(x,y) such that the level set of each function

trisqr4.svg

forms a side of a triangle. Then it introduced a soft penalty for each L being away 1, and the level sets of that penalty function formed the rounded triangles we were looking for.

Another approach would be to change theLs slightly so that the sides are the levels sets Li(x,y) = 0. The advantage to this formulation is that the product of three numbers is 0 if and only if one of the numbers is zero. That means if we define

trisqr5.svg
then the set of points

trisqr6.svg

corresponds to the three lines when c = 0 and the level setsfor smallc > 0 are nearly triangles. The level sets will be smooth if the gradient is non-zero, i.e. c is not zero.

This approach is not unique to triangles. You could create smooth approximations any polygon by multiplying linear functions that define the sides. Or you could do something similar with curved arcs.

If we define ourL's by

trisqr7.svg

then our curves will be the level sets of

trisqr8.svg

A few level sets are shown below. The level set forc = 0 is the straight lines.

Note the level sets are not connected. If you're interested in approximate triangles, you want the components that are inside the triangle.

trisqr3.png

The post Smoothed polygons first appeared on John D. Cook.
External Content
Source RSS or Atom Feed
Feed Location http://feeds.feedburner.com/TheEndeavour?format=xml
Feed Title John D. Cook
Feed Link https://www.johndcook.com/blog
Reply 0 comments