POV-Ray : Newsgroups : povray.general : syntax error with macro : Re: syntax error with macro Server Time
29 Jul 2024 14:25:07 EDT (-0400)
  Re: syntax error with macro  
From: clipka
Date: 9 May 2011 06:32:11
Message: <4dc7c2ab$1@news.povray.org>
Am 02.05.2011 16:05, schrieb kurtz le pirate:

> i have this simple macro :
>
> #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);
>      <det_a/det, det_b/det, 0>
>    #end
> #end

For some obscure reasons, POV-Ray has some problems with assigning 
macro-generated expressions to variables. Try using:

  #macro lineEquation (x1,z1,x2,z2)
    #local det = x1-x2;
    #if(det=0)
      ...
    #else
      #local det_a = z1-z2;
      #local det_b = (x1*z2)-(z1*x2);
      #local result = <det_a/det, det_b/det, 0>;
      result
    #end
  #end


Post a reply to this message

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