View Full Version : Turn euler angle to normal vector
f3rry 06202012, 02:30 AM Hi,
I need to turn rotation axis angle (in degrees) into Normal Vector. Does anyone know how can i do this?
Thanks


gtbull80
06202012, 03:56 AM
Not sure what you mean...Do you mean take X,Y,Z rotation and turn it into a wV (a quaternion)?
doctorbob
06202012, 05: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.
cheers,
chrisg
f3rry
06212012, 12: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.
Thanks all.
doctorbob
06212012, 01: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)
return vectorMult
rotToVector(cmds.ls(sl=True)[0], 'blah')
select an object, run this. hook the output of "blah_matrixMult" into something and look at the purdy numbers.
cheers,
chrisg
zoharl
06212012, 03: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.
doctorbob
06212012, 04:51 AM
@zoharl  i took it to mean normalized vector from rotation (ie, within a range of 01).
i don't think the code i provided will be normalized, but that's not hard.
cheers,
chrisg
zoharl
06212012, 09: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.
f3rry
06222012, 12:05 AM
@zoharl
@Chris
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
CGTalk Moderation
06222012, 12: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 ©20002015, Jelsoft Enterprises Ltd.