Circle Morphing
Computational interpolations from a circle-to-a-square, and circle-to-a-triangle, using p5.js
THIS SOFTWARE IS NOT FREE. NO COMMERCIAL USE. ATTRIBUTION REQUIRED. BY-NC.
References / See Also:
- Dan Shiffman's "10 Minute Coding Challenges - Shape Morphing" (12:35-43:20).
- Dan Shiffman's "Coding Challenge #19: Superellipse" (4:22-12:00).
- A Book of drawCircle() & Github by Yuki Yoshida
- Squaring the Circle and Dark Matter by Troika
- OTTO β Footnotes from the History of Two Cultures: Mitsuo Katsui by JΓΌrg Lehni
--
Some Ways of Transforming a Circle into a Square
- (code) by progressively deleting all points except for the square's corners
- (code) by approximating a circle with four Bezier cubic splines and modulating the spline control points
- (code) by approximating a circle with four circular arcs whose radii lengthen to infinity
- (code) by linearly interpolating points on the circle towards points on the square, along radii of the circle
- (code) by progressively moving points evenly sampled along the circle, towards points on the square, resampled at equal intervals, by small random amounts
- (code) by treating it as a rounded rect, whose (rounded) corners have a dynamic radius
- (code) by treating it as a multisided polygon whose number of sides gradually decreases to four
- (code) by gradually flattening the circle on four sides
- (code) by gradually shrinking the circle's radius, revealing square corners within
- (code) by treating points along the perimeter as a series of springy particles
- (code) by considering it as a set of alternating straight lines and arcs in which the arcs shrink while the lines grow
- (code) by using a 'superellipse' formula
- (code) by progressively subdividing it into a 4-gon, 8-gon, 16-gon, 32-gon, etc., with smooth interpolations.
- (code) by abruptly moving points evenly sampled along the circle, towards corresponding points on the square
--
Some Ways of Transforming a Circle into a Triangle
- (code) // by sampling a circle into many vertices, and then locally averaging each point with its neighbors, except for the three special corner vertices.
- (code) by progressively deleting all points except for the triangle's corners
- (code) by approximating a circle with three Bezier cubic splines and modulating the spline control points
- (code) by approximating a circle with three circular arcs whose radii lengthen to infinity
- (code) by linearly interpolating points on the circle towards points on the triangle, along radii of the circle
- (code) by progressively moving points evenly sampled along the circle, towards points on the triangle, resampled at equal intervals, by small random amounts
- (code) by treating it as a rounded triangle, whose (rounded) corners have a dynamic radius
- (code) by treating it as a multisided polygon whose number of sides gradually decreases to three
- (code) by gradually flattening the circle on three sides
- (code) by gradually shrinking the circle's radius, revealing triangular corners within
- (code) by treating points along the perimeter as a series of springy particles
- (code) by considering it as a set of alternating straight lines and arcs in which the arcs shrink while the lines grow
- (code) by treating the form as a series of 6 circular arcs, alternatingly with small and large radii
- (code) by progressively subdividing it into a 3-gon, 6-gon, 12-gon, 24-gon, etc., with smooth interpolations.