|
![](/i/fill.gif) |
I came across this (very) old thread but eventually had to write my own
version of the rotation matrix. It follows the conventions from
http://mathworld.wolfram.com/EulerAngles.html and rotates by the angles
phi,theta,psi,
#macro Euler(A)
#local xp = vaxis_rotate(x,z,-A.x);
#local yp = vaxis_rotate(y,z, A.x);
#local ys = vaxis_rotate(yp,xp,A.y);
#local zs = vaxis_rotate(z,xp,A.y);
#local xt = vaxis_rotate(xp,zs,A.z);
#local yt = vaxis_rotate(ys,zs,A.z);
#local cosphi = vdot(xp,x);
#local sinphi = vdot(vcross(xp,x), z);
#local costheta = vdot(zs,z);
#local sintheta= vdot(vcross(zs,z), xp);
#local cospsi = vdot(xt,xp);
#local sinpsi = vdot(vcross(xt,xp), zs);
transform {
matrix < cospsi, sinpsi, 0,
-sinpsi, cospsi, 0,
0, 0, 1, 0,0,0 >
matrix < 1, 0, 0,
0, costheta, sintheta,
0, -sintheta, costheta, 0,0,0 >
matrix < cosphi, sinphi, 0,
-sinphi, cosphi, 0,
0, 0, 1, 0,0,0 >
}
#end
The three matrices could be combined into one, but it seems clearer that way.
Post a reply to this message
|
![](/i/fill.gif) |