I'm trying to write a code to calculate the tranformation matrix for a polygon.
this is so that if I import an obj into a scene and it has lost its transforms I can get them back or if a model face is extracted and want to find the rotations and transformations. my method is to take 3 points and calculate 3 vectors X and Y then cross product to get Z axis.(this all seems pretty solid, I have code to make lines in space to show the vectors). once normalized this feeds into a matrix. this is where i get fuzzy then use the APT to calculate euler rotations. I have to calculate the inverse rotation in order to zero the rotations, then apply the rotations, for this I invert the matrix. centerpoint is calculated from some pymel code I found on this forum. That seems to run fine. The code works for some faces but not all. I have some problems with faces that are rotated certain directions, and more problems with non planar faces although not exclusive. but it works maybe 50 % of the time, so i'm not sure what is wrong with the way the code is written. I would expect 100% success or 100% fail. I'm sorry I can't describe the problem better, hopefully the code is commented well enough and speaks for itself. There is probably a better way to do this but these are the code tools that I'm most familiar with. here is the code. http://pastebin.com/937xCBiy -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected].
