-
Notifications
You must be signed in to change notification settings - Fork 0
/
sketch_180817a.pde
53 lines (40 loc) · 1.29 KB
/
sketch_180817a.pde
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// I discovered the name for this pattern about 2 years after I created it:
// the Mystic Rose. There are plenty of examples if you search online.
// See below for parameters that can be tweaked
// (in particular, number of points around the circle)
PImage backgroundImage;
void setup() {
backgroundImage = loadImage("FullSizeRender.jpg");
size(1080, 1080);
stroke(255);
noLoop();
}
void draw() {
image(backgroundImage, 0, 0, width, height);
stroke(255, 240, 240);
strokeWeight(1.5);
fill(0);
int numPoints = 20; // number of points around the circle
int x0 = 540; // x position of the circle's centre
int y0 = 540; // y position of the circle's centre
int radius = 300; // size of the circle
float angle = TWO_PI / numPoints;
float[] x = new float[numPoints];
float[] y = new float[numPoints];
for (int i = 0; i < numPoints; i++) {
x[i] = x0 + radius * cos(angle * i);
y[i] = y0 + radius * sin(angle * i);
}
for (int i = 0; i < numPoints; i++) {
for (int j = 0; j < numPoints; j++) {
line(x[i], y[i], x[j], y[j]);
}
}
for (int i = 0; i < numPoints; i++) {
circle(x[i], y[i], 3);
}
// save("sketch_180817a-5.jpg");
}
void circle(float x, float y, float radius) {
ellipse(x, y, radius*2, radius*2);
}