POV-Ray : Newsgroups : povray.beta-test : bug with assigment with .operator : Re: bug with assigment with .operator Server Time
2 Nov 2024 17:20:32 EDT (-0400)
  Re: bug with assigment with .operator  
From: Philippe Debar
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.