Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,40 @@
|
|||
float s_angle, scale, margin = 25, total = 4;
|
||||
float p_size = 700;
|
||||
float radius = p_size/2-2*margin;
|
||||
float side = radius * sin(PI/5)*2;
|
||||
|
||||
void setup() {
|
||||
float temp = width/2;
|
||||
size(590, 590);
|
||||
background(0, 0, 200);
|
||||
stroke(255);
|
||||
s_angle = 72*PI/180;
|
||||
scale = 1/(2+cos(s_angle)*2);
|
||||
for (int i = 0; i < total; i++) {
|
||||
background(0, 0, 200);
|
||||
drawPentagon(width/2, (height-p_size)/2 + 3*margin, side, total);
|
||||
}
|
||||
}
|
||||
|
||||
void drawPentagon(float x, float y, float side, float depth) {
|
||||
float angle = 3*s_angle;
|
||||
if (depth == 0) {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
float px = x;
|
||||
float py = y;
|
||||
x = x+cos(angle)*side;
|
||||
y = y-sin(angle)*side;
|
||||
line(x, y, px, py);
|
||||
angle += s_angle;
|
||||
}
|
||||
} else {
|
||||
side *= scale;
|
||||
float distance = side+side*cos(s_angle)*2;
|
||||
for (int j = 0; j < 5; j++) {
|
||||
x = x+cos(angle)*distance;
|
||||
y = y-sin(angle)*distance;
|
||||
drawPentagon(x, y, side, depth-1);
|
||||
angle += s_angle;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue