RosettaCodeData/Task/Fractal-tree/POV-Ray/fractal-tree.pov-ray
Ingy döt Net d066446780 langs a-z
2013-04-10 22:43:41 -07:00

43 lines
763 B
Text

#include "colors.inc"
#include "transforms.inc"
#declare CamLoc = <0, 5, 0>;
#declare CamLook = <0,0,0>;
camera
{
location CamLoc
look_at CamLook
rotate y*90
}
light_source
{
CamLoc
color White
}
#declare Init_Height = 10;
#declare Spread_Ang = 35;
#declare Branches = 14;
#declare Scaling_Factor = 0.75;
#macro Stick(P0, P1)
cylinder {
P0, P1, 0.02
texture { pigment { Green } }
}
#end
#macro FractalTree(O, D, S, R, B)
#if (B > 0)
Stick(O, O+D*S)
FractalTree(O+D*S, vtransform(D, transform{rotate y*R}),
S*Scaling_Factor, R, B-1)
FractalTree(O+D*S, vtransform(D, transform{rotate -y*R}),
S*Scaling_Factor, R, B-1)
#end
#end
union {
FractalTree(<-2,0,0>, <1,0,0>, 1, Spread_Ang, Branches)
}