Skip to content

Latest commit

 

History

History
53 lines (42 loc) · 2.18 KB

superellipse.md

File metadata and controls

53 lines (42 loc) · 2.18 KB

Superellipse

To learn mroe about the superellipse, I recommend watching Daniel Shiffman's Coding Challenge.

superellipse

sgn(val) {
    if (val == 0) {
      return 0;
    }
    return val / abs(val);
}

superellipse() {
    for (let theta = 0; theta < TWO_PI; theta += 0.05) {
      let na = 2 / this.n;
      let x = this.r * pow(abs(cos(theta)), na) * this.a * this.sgn(cos(theta));
      let y = this.r * pow(abs(sin(theta)), na) * this.b * this.sgn(sin(theta));
      this.points.push(createVector(x, y));
    }
}

🌄 Gallery

Hilbert curve background with box

Hilbert curve background with box rule-set
Rounded Star with superellipse

Rounded Star with superellipse
Snake-kolam ruleset with superellipse

Snake-kolam ruleset with superellipse
Recurvsive circles2 rule-set, a=3.6,b=1.15,n=1.5

Recurvsive circles2 rule-set, a=3.6,b=1.15,n=1.5