Page 1 of 1

Xmas Tree...

Posted: Wed May 11, 2005 11:17 pm
by mtnviewmark
In another post, yevgen said "Imagine you write a program to draw Xmas-tree with candles. ...",

There are so many reasons not to do this:
  • 'Tisn't the season
  • CFDG is just plainly the wrong tool for the job
  • It doesn't really counter the desire for absolute values in rules
  • I just celebrated Passover!
But, I couldn't help myself...

Code: Select all

startshape Tree

rule Tree {
	Pine { }
	Star { y 16 b 0.5 s 0.5 }
	CandlesL { y 3 s 0.8 }
	CandlesR { y 3.5 s 0.8 }
}

rule Pine {
	Trunk { }
	BranchesL { y 3 s 0.8 }
	BranchesR { y 3.5 s 0.8 }
}
rule Trunk {
	SQUARE { }
	Trunk { y 0.4 s 0.975 }
}
rule BranchesL {
	Pine { r 80 s 0.5 }
	BranchesL { y 3 s 0.815 }
}
rule BranchesR {
	Pine { r -80 s 0.5 }
	BranchesR { y 3 s 0.81 }
}

rule CandlesL {
	Candle { x -6.5 y 1.2 s 0.4 }
	CandlesL { y 3 s 0.815 }
}
rule CandlesR {
	Candle { x 6.5 y 1.2 s 0.4 }
	CandlesR { y 3 s 0.81 }
}
rule Candle {
	SQUARE { y 0 }
	SQUARE { y 0.7 }
	SQUARE { y 1.4 }
	SQUARE { y 2 }
	Flame { y 3.1 b 0.3 }
	Ray { y 3.6 s 0.5 b 0.5 }
}
rule Flame {
	CIRCLE { }
	Flame { y 0.15 s 0.9 b 0.1 r 2 }
}

rule Star {
	Arm { r 0 }
	Arm { r 72 }
	Arm { r 144 }
	Arm { r -72 }
	Arm { r -144 }
	Ray { b 0.7 r 180 }
}
rule Arm {
	CIRCLE { }
	Arm { y 0.1 s 0.9 }
}
rule Ray {
	Line { y 8 s 0.2 }
	Ray { r -36 s 0.97 }
}
rule Line {
	SQUARE { }
	Line { y 0.8 s 0.9 }
}
Warning: Very shape intensive!

Posted: Thu May 12, 2005 7:27 am
by chris
I love it. Especially the candle flames.

If we ever put opacity in this language, I think a cool looking camp fire would be totally feasible.

Posted: Fri May 13, 2005 3:44 am
by bigelectricat
wow, amazing! now how about making a christmas wreath? with flowers in the bottom and three candles in the center? just kidding!

:P