Don't you have Mr LaForge and Mr. LeClaire at your disposal? I would think they could answer in a heartbeat.
Anyway, an alternate way of dealing with this problem is to export the axis vectors instead of computing the rotations. This ensures you get a match and you don't have to deal with math. Matt -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Eric Thivierge Sent: Monday, August 26, 2013 2:46 PM To: [email protected] Subject: SI Matrix3 and Maths Hey all, Plunging ever further into the depths of matrices and the fun math issues one may need to solve while building some tools for the studio. I'm trying to figure out how the SI Matrix3's are derived / set and am hitting some walls. I have some Euler angles that I need to convert to Matrix3's then set a Transform from the result. Basically a Euler angle to Matrix3 operation. I need to solve this without the built in methods as I need to convert data from external sources to align with Softimage without the SDK available. I've referenced many of web sites (wikipedia, educational institutions, etc.) and all of the equations for multiplying the 3 matrices (x,y,z) end up with results that are not consistent with Softimage's methods. The only source that has proven to give me valid results is the 3D Math Primer for Graphics and Game Dev book (Chapter 8.7). However it only shows the solution for XYZ rotation order and even that I'm unsure how they got the order in which they multiply the rows / columns. If any of you smart people out there (Raf, Matt?) have a few free minutes to review my below code and show me the error of my ways I'd appreciate it. Maybe others could benefit too. Create 2 nulls. Set one rotation to x = -45, y=45 Select 2nd null and run script. Swap the commented "result" line and run again. # Python import math si = Application log = si.LogMessage sel = si.Selection def degToRad(value): return value * (math.pi / 180) x = -45 y = 45 z = 0 cx = math.cos(degToRad(x)) sx = math.sin(degToRad(x)) cy = math.cos(degToRad(y)) sy = math.sin(degToRad(y)) cz = math.cos(degToRad(z)) sz = math.sin(degToRad(z)) matX = XSIMath.CreateMatrix3() matX.Set(0,1,0,0,cx,sx,0,-sx,cx) matY = XSIMath.CreateMatrix3() matY.Set(cy,0,-sy,0,1,0,sy,0,cy) matZ = XSIMath.CreateMatrix3() matZ.Set(cz,sz,0,-sz,cz,0,0,0,1) result = XSIMath.CreateMatrix3() # From most sites I referenced-ish #result.Set(cz*cy, sz*cx + cz*sy*sx, sz*sx - cz*sy*cx, -sz*cy, cz*cx - sz*sy*sx, cz*sx + sz*sy*cx, sy, -cy*sx, cy*cx) result.Set(cy*cz + sy*sx*sz, sz*cx, -sy*cz + cy*sx*sz, -cy*sz + sy*sx*cz, cz*cx, sz*sy + cy*sx*cz, sy*cx, -sx, cy*cx) # From Book log(result.Get2()) xfo = XSIMath.CreateTransform() xfo.SetRotationFromMatrix3(result) sel(0).Kinematics.Global.PutTransform2(None, xfo) # End Python -- Eric Thivierge =============== Character TD / RnD Hybride Technologies

