POV-Ray : Newsgroups : povray.general : condition parsed as vector : Re: condition parsed as vector Server Time
8 Aug 2024 06:15:03 EDT (-0400)
  Re: condition parsed as vector  
From: Thorsten Froehlich
Date: 15 Feb 2001 15:26:47
Message: <3a8c3b87$1@news.povray.org>
In article <3a8c3198$1@news.povray.org> , "KalleK" <kal### [at] gmxde> 
wrote:

> Do I have to compare every component seperated?

Yes, you do.  There is no general way to compare a vector to a scalar.
Imagine <10,100,-20> == y , what would the result be?  Clearly the
second component is dominating, or should it only evaluate to true for
<0,1,0> == y ?  And what about <4,8,2> == <2,4,1> ?  The direction is
the same, yet the first one is twice as long as the second one.

> Or what's the error?

The documentation makes is clear that there are no comparisons of
vectors supported (section "Vector Operators"), not even those for
equality.

>   #local T0 = x;
>   #local T1 = 1;
>   #local T1 = (T0=y);
> This driggers the error : "Attempted to redefine float identifier as vector
> identifier." but a
> conditions should be represented as a boolean/float.

Keep in mind that x, y and z have a special meaning.  y is the vector
<0,1,0>, not a scalar.  And as you know from the documentation, there
are no comparison operators for vectors.  Since the parser assumes this
it will stop at the first vector (T0) it finds and not even see the
comparison operator that is following it.  However, I have to admit that
the error message is a bit confusing :-(


     Thorsten


Post a reply to this message

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