POV-Ray : Newsgroups : povray.general : POVWin beta 6 problems and questions : Re: POVWin beta 6 problems and questions Server Time
13 Aug 2024 13:18:51 EDT (-0400)
  Re: POVWin beta 6 problems and questions  
From: PoD
Date: 27 Aug 1998 14:30:14
Message: <35E5979F.7B64@merlin.net.au>
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

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