POV-Ray : Newsgroups : povray.binaries.images : tree creation : Re: tree creation Server Time
5 Nov 2024 14:21:56 EST (-0500)
  Re: tree creation  
From: MSAB
Date: 17 Aug 2006 14:00:00
Message: <web.44e4ad92665c4df4a68196d10@news.povray.org>
Yeah, recursion is what you need. A few month ago, i also write a tree-macro
only for fun, which essential structure is like this:

#macro Tree(a,b,r,n)
 #if (n=0)
 cone { a,r, b,0.8*r }
 #else
 #local d=b-a;
 #local c=a+0.5*d;

 union{ cone {a,r, b,0.8*r }
 Tree(c,c+0.4*vrotate(d,-45*z),0.9*r,n-1)
 Tree(b,b+0.3*vrotate(d,45*z),0.8*r,n-1)
 Tree(b,b+0.9*vrotate(d,3*z),0.8*r,n-1)}
 #end
#end

At the end my macro is a bit complexer (see pic at the attachment)

Sorry for my bad englisch ;)


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.