Re: [Maya-Python] Re: Adding up child rotations

2011-03-21 Thread j...@janberger.de
 
You can match transformations with different rotation orders,
because internally the rotation order is irrelevant, it is only used
when calculating the input and the output ( given it is rotation ).
Internally the 4x4 matrix is just a bunch of vectors, that dont
know anything about rotation orders and how many times they spun around.
So I am not sure if the classic way will get you what you are looking for.

 
 

t nojun...@gmail.com hat am 21. März 2011 um 03:04 geschrieben:

 OK! Due to further research, it seems that matching rotations of
 different rotation orders is a mathmatical imposibility;
 http://en.wikipedia.org/wiki/Rotation_(mathematics)
 So, the question now is;

 What would be the scripted plugin code to do 'relative' additive
 rotations on one transform from the rotation values of nodes in a
 hierarchy?

 I'd like to use this class that supports rotations past 360 degrees
 using MTransformationMatrix::rotateBy
 http://download.autodesk.com/us/maya/2010help/api/class_m_transformation_matrix.html

 Thanks!

 --
 http://groups.google.com/group/python_inside_maya

-- 
http://groups.google.com/group/python_inside_maya


[Maya-Python] Re: Adding up child rotations

2011-03-21 Thread t
My current mel script that I'd like to turn into a scripted plugin:
for ($obj in $hir){
 string $type = `nodeType $obj`;
 if (`gmatch joint $type`){
  float $jo[] ={};
  $jo[0] = `getAttr ($obj + .jointOrientX)`;
  $jo[1] = `getAttr ($obj + .jointOrientY)`;
  $jo[2] = `getAttr ($obj + .jointOrientZ)`;
  rotate -r -os  $jo[0] $jo[1]  $jo[2] c;
 }
 float $rot[] = `xform -q -os -ro $obj`;
 rotate -r -os $rot[0] $rot[1] $rot[2] $target;
}
By classic way do you mean using the MMatrix class?
Because 'AK Eric' says in the above mentioned description that the
MTransformationMatrix [class] will keep track of rotations past 360
degrees  rotation order of the node, while MMatrix objects will not.
It makes sense: A matrix itself stores orientations as vectors, which
have no concept how how far they’ve been ‘rotated’, so the MMatrix
object doesn’t track this data. But behind the scenes, the
MTransformationMatrix does track this info... 
http://www.akeric.com/blog/?p=1067
The whole point of the plugin I want to create is to add up how many
times the source nodes have spun and incrementaly add the rotations
together and output it on to one node. It sounds like
MTransformationMatrix::rotateBy would allow me to do this?
http://download.autodesk.com/us/maya/2010help/api/class_m_transformation_matrix.html#554b247da58575f45b45446e04bb1afa
Thanks!

On Mar 21, 6:25 pm, j...@janberger.de j...@janberger.de wrote:
  
 You can match transformations with different rotation orders,
 because internally the rotation order is irrelevant, it is only used
 when calculating the input and the output ( given it is rotation ).
 Internally the 4x4 matrix is just a bunch of vectors, that dont
 know anything about rotation orders and how many times they spun around.
 So I am not sure if the classic way will get you what you are looking for.

  
  

 t nojun...@gmail.com hat am 21. März 2011 um 03:04 geschrieben:



  OK! Due to further research, it seems that matching rotations of
  different rotation orders is a mathmatical imposibility;
 http://en.wikipedia.org/wiki/Rotation_(mathematics)
  So, the question now is;

  What would be the scripted plugin code to do 'relative' additive
  rotations on one transform from the rotation values of nodes in a
  hierarchy?

  I'd like to use this class that supports rotations past 360 degrees
  using MTransformationMatrix::rotateBy
 http://download.autodesk.com/us/maya/2010help/api/class_m_transformat...

  Thanks!

  --
 http://groups.google.com/group/python_inside_maya- Hide quoted text -

 - Show quoted text -

-- 
http://groups.google.com/group/python_inside_maya


Re: [Maya-Python] Re: Adding up child rotations

2011-03-21 Thread Jan Berger


The example in the blog just spits out what has 
been put into the TransformationMatrix.
The question is whether when you add a rotation 
this will be kept track of as well, right?
If I were you I would take the code from the blog 
and add some rotation either with rotateBy
or addRotation and then see what it spits out. 
Sorry I can not give you direct answers and/or write code ...



At 10:34 AM 3/21/2011, you wrote:

My current mel script that I'd like to turn into a scripted plugin:
for ($obj in $hir){
 string $type = `nodeType $obj`;
 if (`gmatch joint $type`){
  float $jo[] ={};
  $jo[0] = `getAttr ($obj + .jointOrientX)`;
  $jo[1] = `getAttr ($obj + .jointOrientY)`;
  $jo[2] = `getAttr ($obj + .jointOrientZ)`;
  rotate -r -os  $jo[0] $jo[1]  $jo[2] c;
 }
 float $rot[] = `xform -q -os -ro $obj`;
 rotate -r -os $rot[0] $rot[1] $rot[2] $target;
}
By classic way do you mean using the MMatrix class?
Because 'AK Eric' says in the above mentioned description that the
MTransformationMatrix [class] will keep track of rotations past 360
degrees  rotation order of the node, while MMatrix objects will not.
It makes sense: A matrix itself stores orientations as vectors, which
have no concept how how far they’ve been ‘rotated’, so the MMatrix
object doesn’t track this data. But behind the scenes, the
MTransformationMatrix does track this info... 
http://www.akeric.com/blog/?p=1067

The whole point of the plugin I want to create is to add up how many
times the source nodes have spun and incrementaly add the rotations
together and output it on to one node. It sounds like
MTransformationMatrix::rotateBy would allow me to do this?
http://download.autodesk.com/us/maya/2010help/api/class_m_transformation_matrix.html#554b247da58575f45b45446e04bb1afa
Thanks!

On Mar 21, 6:25 pm, j...@janberger.de j...@janberger.de wrote:

 You can match transformations with different rotation orders,
 because internally the rotation order is irrelevant, it is only used
 when calculating the input and the output ( given it is rotation ).
 Internally the 4x4 matrix is just a bunch of vectors, that dont
 know anything about rotation orders and how many times they spun around.
 So I am not sure if the classic way will get you what you are looking for.




 t nojun...@gmail.com hat am 21. März 2011 um 03:04 geschrieben:



  OK! Due to further research, it seems that matching rotations of
  different rotation orders is a mathmatical imposibility;
 http://en.wikipedia.org/wiki/Rotation_(mathematics)
  So, the question now is;

  What would be the scripted plugin code to do 'relative' additive
  rotations on one transform from the rotation values of nodes in a
  hierarchy?

  I'd like to use this class that supports rotations past 360 degrees
  using MTransformationMatrix::rotateBy
 http://download.autodesk.com/us/maya/2010help/api/class_m_transformat...

  Thanks!

  --
 http://groups.google.com/group/python_inside_maya- Hide quoted text -

 - Show quoted text -

--
http://groups.google.com/group/python_inside_maya


Jan Berger
j...@janberger.de :: www.janberger.de  


--
http://groups.google.com/group/python_inside_maya