PDA

View Full Version : Alternate Matrix

 Sagroth07-07-2007, 02:07 PMWe can set matrix attribute via setAttr alternate syntax: -type "matrix" "xform" Is there a way to get matrix in this way? Everything seems to return it as double16. Well, actually we can just compose it quering stuff like scale/shear/rotatePivotTranslate and so on... But when it comes to jointOrient and rotateOrient - they need to be in quaternion and I don't know how to query or calculate these values. Any ideas?
tbaypaul
07-10-2007, 06:16 PM
mel doesn't support quats directly. Quats are just a vector plus a rotation. So....in unit vector notation........
q = xi + yj + zk + w. So a quat can be represented by two coordinates. q =(w, v).
A vector Victor converted to quats is....q = (0, Victor)....just the vector orientation with zero rotation about it's axis.

Given an angle theta and an axis A you can convert to quats via...w = cos(theta / 2), v = sin(theta/2)*A A is normalized.

You can use angleBetween to get the rotation of a vector on to another and to rotate a point given an axis and angle:

vector \$p = <<1, 0, 0>>;
vector \$rotAxis = <<0, 0, 1>>;