im having problems working out the tangent from the face normal
im using a simple pCube with 6 faces
and running this code
i = 0
t = 0
rot=[]
while t < 6:
normal = [normVal[i], normVal[i+1], normVal[i+2]]
tangent = [0,0,0]
ro=0
kRotateOrders = [mApi.MEulerRotation.kXYZ,
mApi.MEulerRotation.kYZX,
mApi.MEulerRotation.kZXY,
mApi.MEulerRotation.kXZY,
mApi.MEulerRotation.kYXZ,
mApi.MEulerRotation.kZYX,]
cross = [normal[1]*tangent[2] - normal[2]*tangent[1],
normal[2]*tangent[0] - normal[0]*tangent[2],
normal[0]*tangent[1] - normal[1]*tangent[0]]
tMatrix = normal+[0]+tangent+[0]+cross+[0,0,0,0,1]
mMatrix = mApi.MMatrix()
mApi.MScriptUtil.createMatrixFromList(tMatrix, mMatrix)
tmMatrix = mApi.MTransformationMatrix(mMatrix)
rotate = tmMatrix.eulerRotation().reorder(kRotateOrders[ro])
RAD_to_DEG = (180/math.pi)
rotation = [rotate[0]*RAD_to_DEG, rotate[1]*RAD_to_DEG,
rotate[2]*RAD_to_DEG]
i = i+1
t = t+1
rot.append(rotation[0])
rot.append(rotation[1])
rot.append(rotation[2])
this puts the rotation of the normal in degrees, but the lines
attached to these rotations are coming out wrong
is this due to the tangent ive given as 0 0 0 or something else?
if anyone can help me it will be greatly appreciated
--
http://groups.google.com/group/python_inside_maya