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