Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,18 @@
|
|||
def setup():
|
||||
size(600, 600)
|
||||
background(0)
|
||||
stroke(255)
|
||||
drawTree(300, 550, 9)
|
||||
|
||||
def drawTree(x, y, depth):
|
||||
fork_ang = radians(20)
|
||||
base_len = 10
|
||||
if depth > 0:
|
||||
pushMatrix()
|
||||
translate(x, y - baseLen * depth)
|
||||
line(0, baseLen * depth, 0, 0)
|
||||
rotate(fork_ang)
|
||||
drawTree(0, 0, depth - 1)
|
||||
rotate(2 * -fork_ang)
|
||||
drawTree(0, 0, depth - 1)
|
||||
popMatrix()
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
def setup():
|
||||
size(600, 600)
|
||||
background(0)
|
||||
stroke(255)
|
||||
drawTree(300, 550, -90, 9)
|
||||
|
||||
def drawTree(x1, y1, angle, depth):
|
||||
fork_angle = 20
|
||||
base_len = 10.0
|
||||
if depth > 0:
|
||||
x2 = x1 + cos(radians(angle)) * depth * base_len
|
||||
y2 = y1 + sin(radians(angle)) * depth * base_len
|
||||
line(x1, y1, x2, y2)
|
||||
drawTree(x2, y2, angle - fork_angle, depth - 1)
|
||||
drawTree(x2, y2, angle + fork_angle, depth - 1)
|
||||
Loading…
Add table
Add a link
Reference in a new issue