   Converting between Two Object Coordinate Systems
  This feels like it will be one of those "Duh" answers but I just can't un-duh it.  I have two objects in a chain, parent and child, and a transformation to get from parent to child.  I can retrieve the world space coordinates of each object via the MODELVIEW_MATRIX while traversing my chain.  What I don't know how to get is the parent's coordinates in the the child's object coordinates.  Is there a trick to this?I've seen mention of building a coordinate system mapping by multiplying the inverse of one modelview matrix by the other matrix.  Is there a good reference explaining this, if it's true?Thanks for any clues and direction!   
Quote:Original post by OrbusiiI have two objects in a chain, parent and child, and a transformation to get from parent to child.Didn't you mean "from child to parent"? If you already have the parent to child transformation, wouldn't that be the transformation you are asking for?In general, a chain of 2 co-ordinate systemsM1 * M2that transforms from the child to its parent (M2) and from te parent to global (M1). Notice that I use OpenGL like column vectors, so that the "more local" transformation is on the right.Now, to transform from global to child local means( M1 * M2 )-1 = M2-1 * M1-1So, if something is given in a system but should be transformed into another system, you could go the way to transform to global first and then back to local. In your case that yields inM2-1 * M1-1 * M1 == M2-1Btw: You know that the MODELVIEW matrix also contains the VIEW matrix? I suggest you to compute the transformations _not_ from the MODELVIEW matrix.EDIT: Of course, OpenGL uses column vectors. Corrected above, thx to jyk.[Edited by - haegarr on May 15, 2006 1:31:17 AM];Quote:Original post by haegarrNotice that I use OpenGL like row vectors.Did you mean column vectors?@The OP: Can you clarify what it is you're trying to compute? It sounds like you want, say, the coordinates of a vertex associated with a child's parent expressed in the child's local coordinate system, but I'm not certain.   ;  "It sounds like you want, say, the coordinates of a vertex associated with a child's parent expressed in the child's local coordinate system, but I'm not certain."Yes, that's exactly what I'm looking for: the parent's local 0,0,0 point but in the child's local coordinate system.   ;Quote:Original post by Orbusiithe parent's local 0,0,0 point but in the child's local coordinate system.Then you can choose one of the both ways shown above:(1) Use the child to parent transformation directly (M2 above), compute its inverse, and multiply the vertex co-ordinates with itv2 := M2-1 * v1(2) Use the both global transformations (M1 and M1*M2), invert the one, concatenate them, and multiply the vertex co-ordinates with it.v2 := ( M1 * M2 )-1 * M1 * v1Please notice that if you really only wants the parent's (0,0,0) vector being transformed, then most of the resulting matrix becomes irrelevant but only its translational part would be still of interest. That may be used to optimize computations.   ;Quote:Original post by OrbusiiYes, that's exactly what I'm looking for: the parent's local 0,0,0 point but in the child's local coordinate system.Ok, I think you just want:p' = M-1*pWhere p is the point in parent space, M is the child's transform matrix, and p' is the point in the local space of the child (what you're trying to compute).   ;  Thanks, all, for the quick responses!   