|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"slehar" <sle### [at] gmailcom> wrote in message
news:web.487a73ecc7f877ecf75a90cb0@news.povray.org...
>
> Can someone please explain to me why I ***can't*** do this?
>
> CODE >>>>
> #declare myVector = <1,2>
>
> atan2(myVector.y,myVector.x)
#declare myVector = <1,2>;
#debug concat("myAngle: ", str(atan2(myVector.y,myVector.x),3,3),"\n")
writes "myAngle: 1.107" into the message stream for me on 3.6 under Windows.
What version are you running?
Regards,
Chris B.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> 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.
Nope, the parentheses don't fix it.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Chris B" <nom### [at] nomailcom> wrote:
> "slehar" <sle### [at] gmailcom> wrote in message
> news:web.487a73ecc7f877ecf75a90cb0@news.povray.org...
>
> #declare myVector = <1,2>;
> #debug concat("myAngle: ", str(atan2(myVector.y,myVector.x),3,3),"\n")
>
> writes "myAngle: 1.107" into the message stream for me on 3.6 under Windows.
> What version are you running?
>
> Regards,
> Chris B.
Wow, thats bizarre! That code works for me too! But when I put the atan2( ) in
the density function where I need it, it doesn't work!
I'm running version 3.6.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"slehar" <sle### [at] gmailcom> wrote in message
news:web.487b4422d340be7bf75a90cb0@news.povray.org...
> "Chris B" <nom### [at] nomailcom> wrote:
>> "slehar" <sle### [at] gmailcom> wrote in message
>> news:web.487a73ecc7f877ecf75a90cb0@news.povray.org...
>>
>> #declare myVector = <1,2>;
>> #debug concat("myAngle: ", str(atan2(myVector.y,myVector.x),3,3),"\n")
>>
>> writes "myAngle: 1.107" into the message stream for me on 3.6 under
>> Windows.
>> What version are you running?
>>
>> Regards,
>> Chris B.
>
> Wow, thats bizarre! That code works for me too! But when I put the
> atan2( ) in
> the density function where I need it, it doesn't work!
>
> I'm running version 3.6.
Ah. I'm not sure it's your problem, but x, y and z are the default parameter
names used with a function, so I'd guess that they have a different meaning
if used in a function definition or within function parameters. You might
want to try the equivalent colour vector component in your context on the
off-chance that it'll work. It works ok in the following context:
#declare myVector = <1,2>;
#debug concat("myAngle: ", str(atan2(myVector.green,myVector.red),3,3),"\n")
Regards,
Chris B.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Wasn't it slehar who wrote:
>"Chris B" <nom### [at] nomailcom> wrote:
>> "slehar" <sle### [at] gmailcom> wrote in message
>> news:web.487a73ecc7f877ecf75a90cb0@news.povray.org...
>>
>> #declare myVector = <1,2>;
>> #debug concat("myAngle: ", str(atan2(myVector.y,myVector.x),3,3),"\n")
>>
>> writes "myAngle: 1.107" into the message stream for me on 3.6 under Windows.
>> What version are you running?
>>
>> Regards,
>> Chris B.
>
>Wow, thats bizarre! That code works for me too! But when I put the atan2( ) in
>the density function where I need it, it doesn't work!
The problem isn't the atan2(), you can't mention vectors inside a
function. You can so this:
#declare mX = myVector.x;
#declare mY = myVector.y;
...
function {
... atan2(mX,mY) ...
}
--
Mike Williams
Gentleman of Leisure
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|