View Full Version : Turn euler angle to normal vector
06-20-2012, 03:30 AM
I need to turn rotation axis angle (in degrees) into Normal Vector. Does anyone know how can i do this?
06-20-2012, 04:56 AM
Not sure what you mean...Do you mean take X,Y,Z rotation and turn it into a wV (a quaternion)?
06-20-2012, 06:51 AM
multiply a vector (eg 1,0,0) by the object's matrix to get a world space vector, then you might need to normalize it. check out the pointMatrixMult node.
06-21-2012, 01:28 AM
Sorry, gtbull80 (http://forums.cgsociety.org/member.php?u=184365),
Let's say I create a polyCube (rx ry rz = 0 0 0 ). How can I get the direction vector (0,1,0)
and I rotate the object 90,0,0. how can I get the direction vector (1,0,0)
doctorbob: I'm confused, but I'll try to digest it.
06-21-2012, 02:25 AM
def rotToVector(inObject, namePrefix):
matrixMult = cmds.createNode('pointMatrixMult', name=namePrefix + '_matrixMult')
cmds.setAttr(matrixMult + '.vectorMultiply', 1)
# adjust the axis you're interested in here
# by default, it's Y
cmds.setAttr(matrixMult + '.inPoint', 0, 1, 0, type="double3")
cmds.connectAttr(inObject + '.matrix', matrixMult + '.inMatrix', force=True)
select an object, run this. hook the output of "blah_matrixMult" into something and look at the purdy numbers.
06-21-2012, 04:51 AM
@f3rry (http://forums.cgsociety.org/member.php?u=28639), Chris gave you one option to determine the new vector after rotation.
But you confuse terminology, and what you ask doesn't make sense:
What do you by turn rotation axis into normal? Normal is a vector which is perpendicular (~) to a vertex or a face of a mesh, and there's no relation to rotation axis.
What do you mean take a direction from a cube? A cube is a mesh which consists of points and faces. It has no direction.
It's like you are asking how do I convert a banana to a number.
What Chris understood from your question is let suppose I have a vector, and it is transformed with the same transformation of a mesh; what would be it's new direction.
06-21-2012, 05:51 AM
@zoharl - i took it to mean normalized vector from rotation (ie, within a range of 0-1).
i don't think the code i provided will be normalized, but that's not hard.
06-21-2012, 10:14 AM
Yes, I agree, not the cleanest solution. I should have queried the rotation only, and apply it to the input (constant in your case) vector (without fancy nodes). @f3rry (http://forums.cgsociety.org/member.php?u=28639), you can search for a previous related posts that I participated in on this subject.
06-22-2012, 01:05 AM
Yes that's what I mean. Sorry for any confusion. I am not familiar with the terminology. I will try to dig up your previous posts. Thanks again to everyone
06-22-2012, 01:05 AM
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 ©2000-2013, Jelsoft Enterprises Ltd.