home documentation

butterfly polar curve

The butterfly curve is given by a polar equation, which traces out the figure-eight shape of the wings of a butterfly. It creates a continuous closed curve that is symmetric about the origin, and each loop crosses through the origin. I was able to find a program from Kantel-Chaos-Team which translated this equation into Python code. Then I ported that code into JavaScript, and altered the values until I landed on this jellyfish or coral-like creature. The hardest part was turning the Python code into JavaScript when I didn't fully understand the mathematics that was causing the curve to be drawn. But once it was rendered, I was able to make it 3-dimensional by adding WEBGL capabilities, an arbitrary z value I wrote, and rotating the shape.

sources

  • Barile, M. Weisstein, E.W. (n.d.). Butterfly Curve. [online] From MathWorld--A Wolfram Web Resource. Available at: https://mathworld.wolfram.com/ButterflyCurve.html.
  • Kantel-Chaos-Team. (n.d.). Butterfly Curve - Processing.py lernen. [online] Available at: http://py.kantel-chaos-team.de.s3-website-us-east-1.amazonaws.com/butterfly/ [Accessed 15 Jun. 2023]