POV-Ray : Newsgroups : povray.advanced-users : macro inside a loop : macro inside a loop Server Time
29 Jul 2024 16:25:38 EDT (-0400)
  macro inside a loop  
From: Arie L  Stavchansky
Date: 19 Oct 2001 02:31:46
Message: <3bcfc8d2$1@news.povray.org>
I have the following:

//macro to make a tube of rings of spheres
#macro sphereTube(height, tubeRadius, elements, bottomSurface, topSurface,
place)

 #declare i = 10;
 #declare shift = <0, 0, 0>;

 #while (i < height)

  objectRing(

   tubeRadius, //radius of ring
   elements, //number of objects in ring
   bottomSurface, //start texture of object
   topSurface, //end texture of object
   place + shift //place away from origin

  )

  #declare shift = shift + <0, ballRadius(tubeRadius, elements)*2*i, 0>;
  #declare i = i+1;

 #end

#end

The problem is that the macro inside the loop (which functions properly) is
not being called more than once.  In fact, even the message I am given says
there are only a certain amount of frame level objects, as opposed to a
certain amount of frame level objects times the height (which is the loop
condition).

If you replace the macro inside the loop with a simple prmitive, such as a
sphere, then you will see the many spheres.  Why is the macro not being
called multiple times?

Thanks for your help,
Arie


Post a reply to this message

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