POV-Ray : Newsgroups : povray.general : One Object in Union : Re: One Object in Union Server Time
4 Nov 2024 19:23:24 EST (-0500)
  Re: One Object in Union  
From: ABX
Date: 1 Oct 2003 07:13:45
Message: <abdlnvoojc7pvkjvpp213ulc3ij39quv96@4ax.com>
On Wed,  1 Oct 2003 07:02:36 EDT, "mmm" <mik### [at] comcastnet> wrote:
> I'm writing a macro that takes the union of from 1 to n objects.  If there
> is one object, POV rightfully issues a warning message.  How can I get
> around the problem?

Is below sufficient ?


#macro Get_Nth_Object(Nth) // Nth is 0-based
  sphere{ ... }
#end

#macro Get_Objects_In_One_Body(N)
  #if(N=1)
    #local Object = Get_Nth_Object(0)
  #else
    #local Object = union{
      #local Counter = 0;
      #while (Counter < N )
        Get_Nth_Object(Counter)
        #local Counter = Counter + 1;
      #end
    }
  #end
  Object
#end

difference{
  object{ Get_Objects_In_One_Body(3) }
  object{ Get_Objects_In_One_Body(1) }
}

ABX


Post a reply to this message

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