Skip to content

Instantly share code, notes, and snippets.

@makakken
Created December 18, 2020 20:08
Show Gist options
  • Save makakken/36cba2b1216b6fbc52f95cce3ecdc5ee to your computer and use it in GitHub Desktop.
Save makakken/36cba2b1216b6fbc52f95cce3ecdc5ee to your computer and use it in GitHub Desktop.
// Knots has a length of 5
void calcCurve() {
for (int i=0; i<Knots.length; i++) {
float a = norm(i, 0, Knots.length);
float theta = TWO_PI * (a + ((1./(2*Knots.length))*random(-1,1)));
float r = width * random(.35, .45);
Knots[i][0] = (width/2.)+(r*cos(theta));
Knots[i][1] = (height/2.)+(r*sin(theta));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment