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 05:14:28 EDT (-0400)
  Re: vector.x is a float, isn't it?  
From: Chris B
Date: 14 Jul 2008 09:05:44
Message: <487b4f28$1@news.povray.org>
"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

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