|
|
Rainer Mager wrote:
>
> Hi all,
>
[Snip]
>
> 5. Am I correct in saying that macros can not be recursive? Is there any way
> to do recursion?
>
[Snip]
>
> I love the new syntax high-lighting and other new features in 3.1. Great job
> POV Team!
>
> --Rainer
Macros can be recursed, I'm currently working on a tree macro which uses
this. Here's a simplified version.
#macro Tree( Length, Level )
union{
cylinder{ 0, y*Length,.2 pigment{White}}
sphere{ y*Length,.2 pigment{White}}
#if( Level > 0 ) // stops infinite recursion
// a branch
object {
Tree( Length, Level-1)
rotate<30, 30, 0>
scale .8
translate y*1/3
}
// another branch
object {
Tree( Length, Level-1)
rotate<30, 100, 0>
scale .7
translate y*2/3
}
// some more trunk
object {
Tree( Length, Level-1)
rotate<5, 200, 0>
scale .6
translate y
}
#end
}
#end
Post a reply to this message
|
|