POV-Ray : Newsgroups : povray.general : Strange parsing error Server Time
24 Nov 2024 18:20:41 EST (-0500)
  Strange parsing error (Message 1 to 6 of 6)  
From: kurtz le pirate
Subject: Strange parsing error
Date: 30 Sep 2017 11:44:43
Message: <59cfbbeb@news.povray.org>
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!

-- 
Kurtz le pirate
Compagnie de la Banquise


Post a reply to this message

From: William F Pokorny
Subject: Re: Strange parsing error
Date: 30 Sep 2017 13:08:44
Message: <59cfcf9c$1@news.povray.org>
On 09/30/2017 11:44 AM, kurtz le pirate wrote:
> Hello,
> 
> 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 think there must be other things going on to get into the parse issue. 
I don't see anything amiss(1) in what you posted and several quick tests 
here after adding a little boiler plate code around you snippet run OK 
for me.

Bill P.

(1) Not a parse issue, but better to use #declare in both if conditions 
when setting the external array.


Post a reply to this message

From: Bald Eagle
Subject: Re: Strange parsing error
Date: 30 Sep 2017 13:25:05
Message: <web.59cfd2eb923e3e145cafe28e0@news.povray.org>
kurtz le pirate <kur### [at] gmailcom> wrote:

>   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;
 Bad operands for period operator.
>
> For me, line #94 and #99 are similar, and no error for line 94.



Well it looks like you should output the actual values to the debug stream or a
file to make sure there's actually a z component being passed to those vector
identifiers.

Aside from that, without the rest of code, it's anybody's guess what's
happening.


Post a reply to this message

From: Alain
Subject: Re: Strange parsing error
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

From: clipka
Subject: Re: Strange parsing error
Date: 30 Sep 2017 19:09:06
Message: <59d02412$1@news.povray.org>
Am 30.09.2017 um 17:44 schrieb kurtz le pirate:

> 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.

I'm with Alain on this one: My guess is that there's nothing wrong with
the macro per se, but rather with its invocation, and that you're
accidently passing a 2D point or scalar as the 3rd or 4th parameter. The
`.x` works fine for either of those (you can interpret a scalar as a 1D
vector if you will), but `.y` requires at least a 2D vector, and `.z`
requires at least a 3D vector.


Post a reply to this message

From: kurtz le pirate
Subject: Re: Strange parsing error
Date: 14 Oct 2017 12:23:06
Message: <59e239ea$1@news.povray.org>
Le 01/10/2017 à 01:09, clipka a écrit :

> I'm with Alain on this one: My guess is that there's nothing wrong with
> the macro per se, but rather with its invocation, and that you're
> accidently passing a 2D point or scalar as the 3rd or 4th parameter. The
> `.x` works fine for either of those (you can interpret a scalar as a 1D
> vector if you will), but `.y` requires at least a 2D vector, and `.z`
> requires at least a 3D vector.
> 

Bingo ! You're right.

Somewhere in the code, i pass a bad vector.


Sorry.


-- 
Kurtz le pirate
Compagnie de la Banquise


Post a reply to this message

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