POV-Ray : Newsgroups : povray.beta-test : bug with assigment with .operator Server Time
2 Nov 2024 15:23:57 EDT (-0400)
  bug with assigment with .operator (Message 1 to 3 of 3)  
From:
Subject: bug with assigment with .operator
Date: 23 Oct 2001 03:42:16
Message: <r87attcjuq76avf6ms2j7hbp3h5dm35omd@4ax.com>
platform: POV35b6 on PII233 128 MB with NT4 SP6

I found below script returns "Float expected but vector or color
expression found." for fourth line.

#local A=array[1]{<0,1,2,3,4>}
#local L=A[0].x;
#warning str(A[0].x,0,-1)
#warning str(L,0,-1)

It's present in beta 2 and not work for any operator at lines 2 and 3:
y, red, green, u, v, transmit, etc.

ABX


Post a reply to this message

From: Warp
Subject: Re: bug with assigment with .operator
Date: 23 Oct 2001 05:15:46
Message: <3bd53541@news.povray.org>
This makes it work, so it probably gives a hint about what's going on:

#local A=array[1]{<0,1,2,3,4>}
#local L=(A[0].x);
#warning str(A[0].x,0,-1)
#warning str(L,0,-1)


  (My guess is that the parser stops at the ] and then somehow the .x is
lost... The parentheses force the parser to parse everything inside them
before it can assign any value to L, thus making it work.)

-- 
#macro N(D,I)#if(I<6)cylinder{M()#local D[I]=div(D[I],104);M().5,2pigment{
rgb M()}}N(D,(D[I]>99?I:I+1))#end#end#macro M()<mod(D[I],13)-6,mod(div(D[I
],13),8)-3,10>#end blob{N(array[6]{11117333955,
7382340,3358,3900569407,970,4254934330},0)}//                     - Warp -


Post a reply to this message

From: Philippe Debar
Subject: Re: bug with assigment with .operator
Date: 23 Oct 2001 16:41:16
Message: <3bd5d5ec@news.povray.org>

news:r87attcjuq76avf6ms2j7hbp3h5dm35omd@4ax.com...
> platform: POV35b6 on PII233 128 MB with NT4 SP6
>
> I found below script returns "Float expected but vector or color
> expression found." for fourth line.
>
> #local A=array[1]{<0,1,2,3,4>}
> #local L=A[0].x;
> #warning str(A[0].x,0,-1)
> #warning str(L,0,-1)
>
> It's present in beta 2 and not work for any operator at lines 2 and 3:
> y, red, green, u, v, transmit, etc.
>
> ABX


IIRC this is an old one.  I found this in the doc :

in "6.1.5.5  Common Color Pitfalls"


--- quote---
Finally there is another problem which arises when using color dot operators
in #declare or #local directives. Consider the directive:
 #declare MyColor = rgb <0.75, 0.5, 0.75>;
 #declare RedAmt = MyColor.red;

Now RedAmt should be a float but unfortunately it is a color. POV-Ray looks
at the first keyword after the equals to try to guess what type of
identifier you want. It sees the color identifier MyColor and assumes you
want to declare a color. It then computes the float value as 0.75 then
promotes that into rgbft<0.75,0.75,0.75,0.75,0.75>. It would take a major
rewrite to fix this problem so we're just warning you about it. Any of the
following work-arounds will work properly.
 #declare RedAmt = 0.0+MyColor.red;
 #declare RedAmt = 1.0*MyColor.red;
 #declare RedAmt = (MyColor.red);
---end of quote---


I did not find anything more enlightening, but I admit I searched rather
hastily. I remember the problem (or something rather similar) discussed
somewhere in the pov newsgroups (at least a year ago...)



Povingly


Philippe


Post a reply to this message

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