This repository contains a collection of p5.js sketches that utilize polar curves. I have also created a sketch to explore how changing a curves parameters affect its shape. You can play here.
The base code is from Dan Shiffman's Heart Curve Coding Challenge.
I am using the equation for a chrysanthemum curve from Paul Bourke.
r = 5 (1 + sin(11 u / 5)) - 4 sin4(17 u / 3) sin8(2 cos(3 u) - 28 u) . . . where 0 <= u <= 21 pi
The center uses the code from Dan Shiffman's Phyllotaxis Coding challenge.
I am also using the P5.js patgrad libary to add a background gradient color to the flower.
In this sketch, I am using a Flower class to render multiple flowers and have adapted the "cannabis" curve to create the leaves. The formula for the cannabis curve is from Mathworld.
let r = this.lfsc * (1 + 7 / 10 * cos(4 * beta)) * (1 + 1 / 10 * cos(12 * beta)) * (5 / 10 + 0.06 * cos(40 * beta)) * (1 + sin(beta));
let x = r * cos(beta);
let y = -r * sin(beta);
I am using the equation from Wolfram Mathworld. I am graphing 120 curves with a random rotation with varying scale and alpha.
for (let theta = -170; theta < 170; theta += 1) {
let r = ( 0.2 * sin(theta) - 1.5 * cos(theta) ) * tan(theta);
let x = this.sc * r * cos(theta);
let y = -this.sc * r * sin(theta);}
I ran across this reference, which has the equations for the Batman logo, the Twitter logo and even a "bunny" curve!
Other Curves
Wolfram Mathworld