Recent topics
Recent Comments 
euler angles from matrixAnyone ever tried to extract the euler angles needed by most render patches from a rotation matrix? I want to align an object to a curve. So far i managed to do it by calculating the right up and out vectors then making a rotation matrix out of that, and using the matrix with the gl tools matrix multiply patch. this works fine but id like to make some stuff simpler by just using the angle inputs on the render patches. the problem is, i cant seem to manage to extract the angles from the matrix. im to dumb to derive them (they dont teach matrix math at design schools:)) and any examples i found on the web dont seem to work (probably a different convention or something). i think QC uses a right handed system and rotations in ZYX order. maybe its not even possible?. the matrix i have is: rightX upX outX 0 rightY upY outY 0 rightZ upZ outZ 0 0 0 0 1
More like this

hi fsk there's a japanese plugin that converts a matrix into XYZ pos/rot. Plus, the source is avaiable. That's pretty much all you gonna need i guess. You'll have to hook it up to a 3Dtranformation patch  not the object pins directly.
Here's the link, hope this helps:  let me know how it goes 
http://y30.net/pg/plugins/qc/MatrixToParams.zip
Hi there, for calculation of euler angles it is important to know that  the rotation must be done in a certain sequence  there can be several solutions
I have written down one way to calculate euler angles. The convention is that the three rotations have to be done in the sequence : Z, new X, new Z.
http://winniweb.de/media/396210c21d9f59dcffff8519ac144233.pdf
Probably this can help you.
A demonstration of roation by euler angles (ZYZ convention): http://www.itp.tuberlin.de/menue/lehre/owl/mechanik/euler_winkel/
i have a vector patch that is part of my quaternion trackball example in the repository. it is "Euler Angles In Degrees From a Quaternion" which is inherently 4d from the start.
so its xyzw... it might help you figure out whats going. i can't really offer any explanation as i'm daft with algebra, trig and or calc stuff, but i can convert the math to machine code and have the computer calculate without any problems.
basically you need to use this expression, but remember sequence like mentioned above is key.
so really it starts with the inverse if a xyzw and is wzyx as the repective p0,p1,p2,p3 etc....
p0=w p1=z p2=y p3=x
2(p0p2+1p1p3)
now feed the result into this java script function.
var result = new Object(); function (__number x,__number y,__number z) main (__number test,__number p0,__number p1,__number p2,__number p3) { var mpi = 3.14159265358979323846264338327950288 ; var e =1; var x =0; var y =0; var z =0;
if (Math.abs(test) > .999) {
var theta3 = 0; var theta2 = (test) ? mpi/2. : mpi/2.; var theta1 = Math.atan2(p1, p0); }
else {
theta3 = Math.atan2(2(p0p1  ep2p3), 1  2(p1p1 + p2p2)); theta2 = Math.asin(2 * (p0p2 + ep1p3)); theta1 = Math.atan2(2(p0p3  ep1p2), 1  2(p2p2 + p3*p3)); } if (theta1 < 0) theta1 += 2 * mpi; if (theta2 < 0) theta2 += 2 * mpi; if (theta3 < 0) theta3 += 2 * mpi;
result.x=theta1 * radiansToDegrees; result.y=theta2 * radiansToDegrees result.z=theta3 * radiansToDegrees;
return result; }
this returns your xyz Euler in Degrees
see repository for all macro vector tools and quaternion trackball.
this is a qc math expression javascript implementation i think openCL should do this faster seeing the gpu is kind of made for vector calculations
Think this is the so called RollPitchYaw where  as far as I remember  the rotation sequence is global X, global Y, global Z,