PythagorasTree (fractal)

Help Contents Examples PythagorasTree (fractal)
Pythagoras (advanced) Projection (3d advanced)

PythagorasTree (fractal)

Example:    PythagorasTree.eli
Modified:   June 1, 2000
Version:    2.0
Author:     Pavel Boychev
E-mail:     pavel@elica.net

Copyright © 2000 Elica Group

This sample program draws a nice fractal called Pythagoras Tree.

run "geomland
run "turtle

to treecolor :len

	if :len<5
	[
		color rgb_ 0 1 0
	]
	[
		color 0
	] 
end

to triangle :len

	if :len<2
	[
		treecolor :len t.forward :len
	]
	[
		make local "alpha 30+(random 30)

		right :alpha
		square :len*(cos :alpha)
		left 90
		square :len*(sin :alpha)
		right 90-:alpha
	]
end

to square :len

	treecolor :len
	right 90
	forward 1*:len
	left 90

	if :len<2
	[
		forward :len
	]
	[
		triangle :len
	]
	treecolor :len
	left 90
	forward 1*:len
	right 90
end
     
make "cscy 1.5

hide
left 90
square 50

Pythagoras (advanced) Projection (3d advanced)