POV-Ray : Newsgroups : povray.newusers : Simple macro question : Simple macro question Server Time
31 Jul 2024 00:32:54 EDT (-0400)
  Simple macro question  
From: moj34
Date: 3 Jun 2003 16:45:01
Message: <web.3edd08538a40289d44a752600@news.povray.org>
I'm new to povray, and have been getting on OK with most of the programming
aspect of it, but I've run into something I can't figure out.  Here's the
relevant bit of code:


---------snip-----------


 #declare Norm = <0, 0, 0>;


#declare n = 0;




#macro Ring(Up)


        #while (n < 360)

        #declare r=<sin(radians(n)),0,cos(radians(n))>;



        #declare Pos = trace (
                  Pot,             // object to test
                  <0,Up,0>,           // starting point
                  r,              // direction
                  Norm );          // normal

// if intersection is found, normal differs from 0
        #if (Norm.x != 0 | Norm.y != 0 | Norm.z != 0)
        sphere {Pos,0.1 pigment {colour Yellow}}
        #end
        #declare n=n+10;
        #end



     #end

  object{  Pot scale 1}




  Ring(0.5)
  Ring (0.0)
  Ring (1)


------------------snip------------

I've got a patch object called Pot, and I'm using the trace() function to
put tiny yellow spheres on its surface.  The Ring() macro takes a given
height (Up) and finds the intersections with the pot every ten degrees in a
full circle at that height. (hopefully that is clearer from the code than
from my explanation).  So far, so good, but the trouble is, when I try to
do this for a number of heights (eg 0, 0.5 and 1 in the example above) only
the ring corresponding to the first instance of the macro (y=0.5) shows up.

There's probably a simple explanation; if anyone could point it out to me I
would be very grateful :-)

If it would be helpful to post the whole scene file, let me know

Thanks
moj34


Post a reply to this message

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