Friday, May 1, 2020

Chaikin Curves

Sometimes I want to draw Voronoi or similar polygons in a rounded form:

Rounded polygons. Lots of them.

I use a process called Chaikin's Algorithm for this.

Start with a polygon:

Original polygon

Mark the midpoints of each side:

Polygon with midpoints

Then construct quadratic Bezier curves. Each original vertex becomes the control point of the quadratic Bezier, and the two adjacent midpoints become the two end points of the Bezier:

Quadratic bezier curves

Super simple to implement! If you don't have a quadratic Bezier drawing function, you can use the De Casteljau Algorithm to subdivide the original line into smaller lines. Repeat this until you get line segments that are fairly close to the quadratic Bezier.

I used this for this project and this project.

No comments:

Post a Comment