   World transformation when breaking out a child from hiearchy?
  Hi!I have a scene that is made as one big tree hiearchy, but to make this message easier to write I think of this tree hiearchy like several tree hiearchies connected to a root.I want to be able to break out a child from one tree A and insert it in another tŕee B without changing its accumulated transformations. So I need to calculate its accumulated transfrmations from tree A and its local transformations, so it is expressed in world coordinates and then translate these transformations into the coordinate space of B. The problem is that I want to have the transformations of the child separated into translation , scaling and rotation. Plus having rotation and scaling pivots.Does anyone have any tips of a tutorial about this?/pir   
Quote:Original post by pirHi!I have a scene that is made as one big tree hiearchy, but to make this message easier to write I think of this tree hiearchy like several tree hiearchies connected to a root.I want to be able to break out a child from one tree A and insert it in another tŕee B without changing its accumulated transformations. So I need to calculate its accumulated transfrmations from tree A and its local transformations, so it is expressed in world coordinates and then translate these transformations into the coordinate space of B. The problem is that I want to have the transformations of the child separated into translation , scaling and rotation. Plus having rotation and scaling pivots.Does anyone have any tips of a tutorial about this?/pirThis can probably all be done, but we might need a little more info. I'm not sure about the rotation and scaling pivots though, as those will most likely be baked into the transform and may not be extractable (I'd have to think about it a bit more to be sure). It might be necessary to track those separately (SRT however can be extracted from a matrix).Beyond that it'll just be a matter of performing the appropriate matrix inversions and multiplications. If you need more help with that, let us know whether you're using row or column vectors; that way any examples given can be in the appropriate form.   ;  Hi!Here is a better explanation of the my world:The world consists of a big hiearchy, described by a vector. The components in the vector can either be singel components or components containing other components. There are no limitation of levels of the hiearchy. So components contained by a component can contain other components. The purpose of this is to allow the user to group any components together during execution and have the ability to group groups toghether with other groups. Much like the outliner in Maya ( do not know what it's called in 3dsMax ).The transformation is made like this:draw_scene(){   set up camera transformation blablabla   for each component lying in world vector call draw_component()}/** draw the object and its components, the subcomponents inherit the parent space */draw_component(){   glPushMatrix()   for ( i=0; i< number of components contained in this component; i++ )   { component_number_i->draw_component()   }   glPopMatrix()}/** sets up local space in TranRotScl order */create_localspace(){  /* component translation */  glTranslatef(...);   /* component rotation around rotation pivot */  glTranslatef( rotationPivot );  glRotatef (...);  glTranslatef ( -rotatioPivot );  /* component scaling around scaling pivot */  glTranslatef ( scalingPivot );  glScalef ( ... );  glTranslatef ( -scalingPivot );}The problem comes when the user have two groups of components and wants to take members of one of the groups and give it to the other. Since the coordinate space is inherited from parent to child in a group a new member in a group must change its transformation to the new coordinate space.I dont think the pivot points of the parents is of any interest, as you said, they are baked into the transformation matrix. But I need the component pivots to be taken into concern in some way. They should not be changed to fit the new environment. But this is the only constraint, I think. So if one could take the accumulated transformation matrix and decompose it into translation rotation and scaling with the component pivots taken in concern it would be great. Then we are in world space, then we need to step into the new groups local space...maybe this made the problem a bit more clear... there are a lot on the new on hiearchy transformations. But I can't find anything about this.;  Hi!I have thought about it and will try to answer my question myself. I have not tried to check this, so please tell me if you think I'm wrong.If Mc is the accumulated transformatrix from Mb and Ma, then I do the SVD on Mc ( exept the column containing translation information ). In that way I'll get scaling and rotation. If I use this information as it is it would give me scaling and rotation around the origo.Then I compute the translation columns of the rotation and scaling step for object A, that is the object who has become a orphin. The columns I get from these two columns is then substracted from Mc's translation column. This is the new translation.So in this way I hope that I'll get the transformation as I want it. Or do I?pir   