POV-Ray : Newsgroups : povray.advanced-users : vector.x is a float, isn't it? : Re: vector.x is a float, isn't it? Server Time
3 Jul 2024 04:39:37 EDT (-0400)
  Re: vector.x is a float, isn't it?  
From: Reactor
Date: 13 Jul 2008 18:00:01
Message: <web.487a7a07d340be7bc2684d3b0@news.povray.org>
"slehar" <sle### [at] gmailcom> wrote:
> Can someone please explain to me why I ***can't*** do this?
>
> CODE >>>>
>   #declare myVector = <1,2>
>
>   atan2(myVector.y,myVector.x)
> <<<< CODE
>
> Parse Error: Expected 'operand', uv vector identifier found instead
>
> But why I ***CAN*** do this?
>
> CODE >>>>
>   #declare myVector = <1,2>;
>   #declare xValue = myVector.x;
>   #declare yValue = myVector.y;
>
>   atan2(yValue,xValue)
> <<<< CODE
>
> Works just fine!
>
> Isn't myVector.x a plain float value that can be used wherever
> a float is required?
>
>   slehar



You are correct that it "should" behave that way.  I know there is talk of
overhauling SDL and parsing for version 4.0.  Out of curiosity, have you tried
placing parenthesis? Such as:

atan2( (myVector.y) , (myVector.x) )
or even
atan2( (myVector.y + 0) , (myVector.x + 0) )

just off hand ideas, haven't tried it myself.


-Reactor.


Post a reply to this message

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