View Full Version : Alternate Matrix
Sagroth 07072007, 02:07 PM We 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
07102007, 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>>;
float $rotAngle = deg_to_rad(90);
rot $p $rotAxis $rotAngle;
not a very pleasing answer. The api is much better for this stuff, transforms and matrix ops in particular. Plus with python, now you can use the api methods and wrappers in your scripts.
CGTalk Moderation
07102007, 06:16 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©20002015, Jelsoft Enterprises Ltd.