POV-Ray : Newsgroups : povray.general : Strange parsing error : Re: Strange parsing error Server Time
2 May 2024 00:17:56 EDT (-0400)
  Re: Strange parsing error  
From: Alain
Date: 30 Sep 2017 17:10:41
Message: <59d00851@news.povray.org>
Le 17-09-30 à 11:44, kurtz le pirate a écrit :
> Hello,
> 
> 
> I have an old MegaPov 1.21 code :
> 
>   93 : #macro lineEquation (rIndex, lIndex, pA, pB)
>   94 :   #local det = pA.x-pB.x;
>   95 :   #if(det=0)
>   96 :     // #error
>   97 :     #local sidesLines[rIndex][lIndex] = <0,0,1>;
>   98 :  #else
>   99 :    #local det_a = pA.z-pB.z;
> 100 :    #local det_b = (pA.x*pB.z)-(pA.z*pB.x);
> 101 :    #declare sidesLines[rIndex][lIndex] = <det_a/det,det_b/det, 0>;
> 102 :   #end
> 103 : #end
> 
> 
> Parse with PovRay 3.7 i get this error :
>      Line 99 : Bad operands for period operator.
> 
> For me, line #94 and #99 are similar, and no error for line 94.
> 
> I would also like to specify that the parameters of the macro are : 
> scalar, scalar, point, point.
> 
> 
> Going Crazy!
> 

If pA or pB are 2D vectors or scalars, I think that it could cause such 
an error.
You can force those to become 3D vectors as folow :
Add
#local pA=<0,0,0>+pA;
#local pB=<0,0,0>+pB;
// Promote to 3D vector if input is a scalar or a 2D vector
// effectively a no operation otherwise (3D, 4D and 5D)
or
#local pA=<1,1,1>*pA;
#local pB=<1,1,1>*pB;
just after line 93.


Alain


Post a reply to this message

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