Rotate Vector in XSIMaths

2013-02-21 Thread Peter Agg
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

Re: Rotate Vector in XSIMaths

2013-02-21 Thread Peter Agg
(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 peter@googlemail.com 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

Re: Rotate Vector in XSIMaths

2013-02-21 Thread Stephen Blair
vec = XSIMath.CreateVector3(0, 1, 0) #rot = XSIMath.CreateRotation(XSIMath.DegreesToRadians( -90 ), # XSIMath.DegreesToRadians( 0 ), # XSIMath.DegreesToRadians( 0 )) rot = XSIMath.CreateRotation() rot.SetFromAxisAngle(

Re: Rotate Vector in XSIMaths

2013-02-21 Thread Peter Agg
Hum, seems to be giving me the same result. vec = XSIMath.CreateVector3(0, 1, 0) rot = XSIMath.CreateRotation() rot.SetFromAxisAngle( XSIMath.CreateVector3(1.0, 0.0, 0.0), XSIMath.DegreesToRadians( -90 ) ) vec.MulByRotationInPlace( rot) print vec.X, vec.Y, vec.Z # 0.0 6.12323399574e-17 -1.0 On

Re: Rotate Vector in XSIMaths

2013-02-21 Thread Stephen Blair
Sorry, I was confused by this: (and yes, rotating [0, 1, 0] by [-90, 0, 0] should actually make make [0, 0, -1]) :) On 21/02/2013 9:46 AM, Peter Agg wrote: Hum, seems to be giving me the same result. vec = XSIMath.CreateVector3(0, 1, 0) rot = XSIMath.CreateRotation() rot.SetFromAxisAngle(

Re: Rotate Vector in XSIMaths

2013-02-21 Thread Peter Agg
Ah yeah, sorry. That was just a correction to my original example. On 21 February 2013 15:02, Stephen Blair stephenrbl...@gmail.com wrote: Sorry, I was confused by this: (and yes, rotating [0, 1, 0] by [-90, 0, 0] should actually make make [0, 0, -1]) :) On 21/02/2013 9:46 AM, Peter

Re: Rotate Vector in XSIMaths

2013-02-21 Thread Stephen Blair
I seem to be misunderstanding today, because rotating (0,1,0) by -90 around the X axis gives me (0,0,-1) http://screencast.com/t/AdsSEDqN1wpa On 21/02/2013 10:10 AM, Peter Agg wrote: Ah yeah, sorry. That was just a correction to my original example. On 21 February 2013 15:02, Stephen

Re: Rotate Vector in XSIMaths

2013-02-21 Thread Martin Chatterjee
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).

Re: Rotate Vector in XSIMaths

2013-02-21 Thread Peter Agg
/sighs The point appears to be that I completely blanked on the e-17 bit! . You see, this is the kind of crap you have to deal with when you start cutting down on caffeine! On 21 February 2013 15:20, Martin Chatterjee martin.chatterjee.li...@googlemail.com wrote: Hi Peter, as far as I

Re: Rotate Vector in XSIMaths

2013-02-21 Thread Alok
+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

Re: Rotate Vector in XSIMaths

2013-02-21 Thread Alok
Ah ! a typo: **6.12323399574 is to be multiplied by 10 ^ -17 Original Message Subject: Re: Rotate Vector in XSIMaths Date: Thu, 21 Feb

Re: Rotate Vector in XSIMaths

2013-02-21 Thread Jeremie Passerin
Who said Math were not fun !

Re: Rotate Vector in XSIMaths

2013-02-21 Thread Alan Fregtman
And on that note, for those who have half an hour to kill and love a good Disney classic: http://www.youtube.com/watch?v=YRD4gb0p5RM ^ *Donald Duck in Mathemagic Land* is both fun and educational. ;) On Thu, Feb 21, 2013 at 1:02 PM, Eric Turman i.anima...@gmail.com wrote: