POV-Ray : Newsgroups : povray.general : syntax error with macro : Re: syntax error with macro Server Time
29 Jul 2024 14:17:23 EDT (-0400)
  Re: syntax error with macro  
From: Trevor G Quayle
Date: 3 May 2011 15:20:00
Message: <web.4dc0547bc5c3a7fb81c811d20@news.povray.org>
kurtz le pirate <kur### [at] yahoofr> wrote:
> In article <4dbef64e@news.povray.org>, Alain <aze### [at] qwertyorg> wrote:
>
> > Try this:
> > <det_a/det, det_b/det, 0>;
>
>
> already tried...
>
> error is now :
>
> File Context (5 lines):
> // --- z = ax + b
> // --- line d0 : p0 to p1
> #declare sidesLines[0][0] =
> lineEquation(rectangles[0][0].x,rectangles[0][0].z,rectangles[0][1].x,rec
> tangles[0][1].z);
> Parse Error: Expected 'object or directive', ; found instead
>
>
>
>
> --
> klp

Remove the ';' from this declaration now:

#declare sidesLines[0][0] =
lineEquation(rectangles[0][0].x,rectangles[0][0].z,rectangles[0][1].x,rec
tangles[0][1].z)


It does have something to do with the result being posted inside the #if loop.
The other alternative and what I would see as the cleaner, more correct
alternative, is to move the value outside the #if loop:


#macro lineEquation (x1,z1,x2,z2)
  #local det = x1-x2;
  #if(det=0)
    #error "\n\n---\nWarning, the system has no unique solution.\nProgram stop
here\n\n"
  #else
    #local det_a = z1-z2;
    #local det_b = (x1*z2)-(z1*x2);
  #end
  <det_a/det, det_b/det, 0>
#end

#declare sidesLines[0][0] = lineEquation(,,,);


-tgq


Post a reply to this message

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