POV-Ray : Newsgroups : povray.general : syntax error with macro : Re: syntax error with macro Server Time
29 Jul 2024 14:20:38 EDT (-0400)
  Re: syntax error with macro  
From: Jaime Vives Piqueres
Date: 3 May 2011 13:19:19
Message: <4dc03917$1@news.povray.org>

>
> hello,
>
> 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
>

   I seem to recall something similar happening to me... I think it was
due to the return value being not declared and inside an "if". Try this:

#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);
      #local result=<det_a/det, det_b/det, 0>;
    #end
    result
#end


-- 
Jaime Vives Piqueres
		
La Persistencia de la Ignorancia
http://www.ignorancia.org


Post a reply to this message

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