POV-Ray : Newsgroups : povray.general : Problem making macro work right : Problem making macro work right Server Time
8 Aug 2024 06:18:07 EDT (-0400)
  Problem making macro work right  
From: Dan Johnson
Date: 19 Feb 2001 07:31:09
Message: <3A911395.A8F95AA0@hotmail.com>
By changing things around I can make this actually render something, but
my primary misunderstanding is why it gives its current error message
that I have seen in other macros I have made.

"error: No matching } in object, union found instead."

Well isn't a union treated like an object?



// begin pov code
#include "colors.inc"

light_source {<20,100,-150> rgb 2}
camera {location <0,0,-6> look_at 0}

#macro Arrange_3d (Dimentions_vector,N)
        #local A = Dimentions_vector.x;
        #local B = Dimentions_vector.y;
        #local C = Dimentions_vector.z;
        #local Error_loop = 1;
        #while (Error_loop <= 3)
        #switch (Error_loop)
        #case (1)
        #local Vect = A;
        #case (2)
        #local Vect = B;
        #case (3)
        #local Vect = C;
        #end
        #if (abs(Vect)<1)
        #local Input_error = yes;
        #end
        #if (Vect-int(Vect.x)>0)
        #local Input_error = yes;
        #end
        #if ((Vect/abs(Vect))<0)
        #local Input_error = yes;
        #end
        #local Error_loop = Error_loop + 1;
        #end
        #ifdef (Input_error)
        #if (Input_error = yes)
        #error "Dimentions_vector has a number that is not a natural
number"
        #end
        #end

       ( (mod(N+A-1,A))*x + (B-mod(div(N+A-1,A)+B-1,B))*y +
(mod(div(N+B*A-1,B*A)+C-1,C))*z -<A-1,B+1,C-1>/2)
#end  // use only natural numbers aka 1,2,3,4,5,6... no fractions 0 or
negative numbers


#macro Grid (Dimentions_vector,Marker_interval,Marker_scale)

        #local N = 1;
        #while (N <= (((Dimentions_vector.x * 2) +
1)*((Dimentions_vector.y * 2) +1)*((Dimentions_vector.z * 2) + 1)))
                #local Grid_vector = Arrange_3d(<(Dimentions_vector.x *
2) + 1,(Dimentions_vector.y * 2) +1,(Dimentions_vector.z * 2) + 1>,N) *
Marker_interval;
                union {
                sphere {0,.5}
                text { ttf "timrom.ttf"
concat("<",str(Grid_vector.x,1,0),",",str(Grid_vector.y,1,0),",",str(Grid_vector.z,1,0),">")
.5 0  translate 1}
                scale Marker_scale
                translate Grid_vector}
                #local N = N+1;
        #end
#end

object {Grid(<2,2,2>,1,.1) pigment{Green}}
//end pov code


--
Dan Johnson

http://www.geocities.com/zapob


Post a reply to this message

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