Macha Posted March 17, 2010 Share Posted March 17, 2010 (edited) I have a geometry sitting nicely in the default world coordinate system. I have another 3 vectors defining another coordinate system. How would I transform the geometry from one coordinate system to the other, so that it transforms and aligns appropriately? I know I can do something with transformPrims() and hou.hmath.buildRotateAboutAxis or getTransformFromPointToPoint() but I'm not sure what, I get all confused. Does anyone know how to do it, or where I can find good info about it? If it helps. These are my new coordinate vectors: v0 = [-0.508 -0.496 -0.703] v1 = [-0.797 -0.036 0.602] v2 = [ 0.324 -0.867 0.376] Edited March 17, 2010 by Macha Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted March 17, 2010 Share Posted March 17, 2010 I have a geometry sitting nicely in the default world coordinate system. I have another 3 vectors defining another coordinate system. How would I transform the geometry from one coordinate system to the other, so that it transforms and aligns appropriately? If the vectors vn are unit length and independent (like the orthogonal sets in your image), then I think the only missing ingredient would be the translation vector -- the position at the origin of the system you're transforming to (say, o1) relative to the origin of the system you're transforming from; say o, both expressed in the same space of course). Then I believe the transform matrix (in a Houdini-friendly order), would be: // translation vector vector v3 = o1-o0; // xfrom for points matrix Mp = set( v0.x, v0.y, v0.z, 0, v1.x, v1.y, v1.z, 0, v2.x, v2.y, v2.z, 0, v3.x, v3.y, v3.z, 1 ); // xfrom for vectors (strip translation) matrix3 Mv = Mp; // and for normals (strip translation and scaling) matrix3 Mn = invert(Mv); transpose(Mn); Then, to each element (point, vector, normal) that you want to transform, right-multiply it by the appropriate matrix -- eg p' = p*Mp, or v' = v*Mv, or n' = n*Mn (untested) HTH, Cheers. Quote Link to comment Share on other sites More sharing options...
Macha Posted March 18, 2010 Author Share Posted March 18, 2010 Thanks Mario, I think I got it working! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.