+1 to Martin's reply, that is the correct explanation. .Peter you don't have a thing to worry, you are doing everything right, do consider 6.12323399574e-17 as  0.0

Let me explain why:

you see the e-17 at the end of number ? That mean the number 6.12323399574 is to be multiplied by 10 ^ 17 or divided by 10 ^ 17. So effectively this is:
6.12323399574 / 1000000000000000000 ~= 0.0000000000000000612323399574

which can be approximately treated as 0.

I hope that explains.

On 21/02/2013 10:20 AM, Martin Chatterjee wrote:
Hi Peter,


as far as I see it your result is correct?  The resulting vector should be   [0.0,  0.0,  -1.0] - which is effectively the result of your print statement.

in your example vec.Y has a value of 6.12323399574e-17  which essentially is  0.0 (due to floating point math precision).

So all is fine - or did I not get your point?


Cheers, Martin
--
       Martin Chatterjee
 
[ Freelance Technical Director ]
[   http://www.chatterjee.de   ]
nbsp;] 


On Thu, Feb 21, 2013 at 3:21 PM, Peter Agg <[email protected]> wrote:
(and yes, rotating [0, 1, 0] by [-90, 0, 0] should actually make make [0, 0, -1]) :)


On 21 February 2013 14:15, Peter Agg <[email protected]> wrote:
Hey all,

I'm trying to rotate a vector in a Python Script and seem to be running into an odd block. For example: I want to rotate the vector [0, 1, 0] by [-90, 0, 0], which should make [-1, 0, 0] (and does so if I test in ICE using a Rotate Vector node) but I can't seem to work out how to do this via scripting.

What I tried:

vec = XSIMath.CreateVector3(0, 1, 0)
rot = XSIMath.CreateRotation(XSIMath.DegreesToRadians( -90 ),
                             XSIMath.DegreesToRadians( 0 ),
                             XSIMath.DegreesToRadians( 0 ))
vec.MulByRotationInPlace( rot)
print vec.X, vec.Y, vec.Z
# 0.0 6.12323399574e-17 -1.0

...which makes me think that I've misunderstood what MulByRotation does!

Any ideas?


No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2238 / Virus Database: 2639/5621 - Release Date: 02/21/13


Reply via email to