Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
18
Task/Fractal-tree/Processing/fractal-tree-2.processing
Normal file
18
Task/Fractal-tree/Processing/fractal-tree-2.processing
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
void setup() {
|
||||
size(600, 600);
|
||||
background(0);
|
||||
stroke(255);
|
||||
drawTree(300, 550, -90, 9);
|
||||
}
|
||||
|
||||
void drawTree(float x1, float y1, float angle, int depth) {
|
||||
float forkAngle = 20;
|
||||
float baseLen = 10.0;
|
||||
if (depth > 0) {
|
||||
float x2 = x1 + cos(radians(angle)) * depth * baseLen;
|
||||
float y2 = y1 + sin(radians(angle)) * depth * baseLen;
|
||||
line(x1, y1, x2, y2);
|
||||
drawTree(x2, y2, angle - forkAngle, depth - 1);
|
||||
drawTree(x2, y2, angle + forkAngle, depth - 1);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue