Skip to content

Commit a4aef5c

Browse files
committed
fermat spiral
1 parent f4cc57d commit a4aef5c

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

fermat_spiral/fermat_spiral.pde

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import processing.svg.*;
2+
3+
int _numPoints = 450;
4+
float _angle = 137.5;
5+
float _scale = 10;
6+
float _seedSize = 10;
7+
8+
9+
void setup() {
10+
size(750, 500);
11+
strokeWeight(1);
12+
stroke(0);
13+
noFill();
14+
background(255);
15+
}
16+
17+
void draw() {
18+
for(int n=0; n<_numPoints; n++) {
19+
float theta = n * radians(_angle);
20+
float radius = sqrt(n) * _scale;
21+
float x = radius * cos(theta) + width/2;
22+
float y = radius * sin(theta) + height/2;
23+
24+
float size = (n / 60) + _seedSize * 1.5;
25+
//float size = _seedSize;
26+
27+
ellipse(x, y, size, size);
28+
}
29+
}

0 commit comments

Comments
 (0)