magneto Posted November 30, 2013 Share Posted November 30, 2013 Hi, I am trying to revert the rotation of a volume so it aligns with the world. I tried setting the primitive intrinsic, but if you set it to identity, then you lose the scale. Since it's absolute, I am not able to apply the inverse of this transform either. Should I use the explodematrix expression? I am actually trying to create a bounding box that has the same size and orientation. Setting the orientation of the box is easy but I am not sure how else I can find out the size of the volume since it can be scaled. But Volume Slice SOP is able to do this accurately it so there must be a way. Any ideas? Thanks Quote Link to comment Share on other sites More sharing options...
sanostol Posted November 30, 2013 Share Posted November 30, 2013 do You have a example file, demonstrating what You try to achieve? Quote Link to comment Share on other sites More sharing options...
magneto Posted November 30, 2013 Author Share Posted November 30, 2013 Thanks sanostol. I attached the file. Basically trying to create the same bounding box of the volume you see. But I don't want to use OBB algorithms because the transform of the volume is known. I actually came up with a solution yesterday by sampling the positions of the corner voxels, which when you account for the voxel size, seems to work. Just didn't think it would be this complicated vol.hip Quote Link to comment Share on other sites More sharing options...
petz Posted November 30, 2013 Share Posted November 30, 2013 is this what you are after? petz vol_1.hip 1 Quote Link to comment Share on other sites More sharing options...
magneto Posted November 30, 2013 Author Share Posted November 30, 2013 (edited) Thanks petz, very clever trick. Your solutions are always the most elegant EDIT: Do you know if I can use the same idea to extract rotation? Because if I extract it using the same function, then I am not sure how to apply it to an identity matrix. There is only a rotate function that rotates a matrix around an axis. How can I use this extracted rotation to orient another geometry? EDIT 2: In other words, I want to reset the translate and scale of the matrix so I am only left with a rotation matrix. I tried extracting and rotating by x, y and z separately, and also converting the matrix (after from matrix4 to matrix3) into a quaternion, and then applying but it seems inaccurate. Do I have to use something like the QR decomposition? Any math experts? Thanks Edited November 30, 2013 by magneto Quote Link to comment Share on other sites More sharing options...
anim Posted December 2, 2013 Share Posted December 2, 2013 one way to create rotation matrix rotm from transform matrix mat vector euler = cracktransform(0, 0, 1, {0, 0, 0}, mat);matrix3 rotm = qconvert(quaternion(euler,0));[/CODE] 1 Quote Link to comment Share on other sites More sharing options...
magneto Posted December 3, 2013 Author Share Posted December 3, 2013 Thanks anim, do you think that's accurate enough? I tried it for some stuff but it seems off when compared to the full matrix itself, which of course also have a scale I am trying to get rid of. 1 Quote Link to comment Share on other sites More sharing options...
Guest mantragora Posted December 3, 2013 Share Posted December 3, 2013 Why do I feel like I'm watching Maya thread ? 1 Quote Link to comment Share on other sites More sharing options...
magneto Posted December 3, 2013 Author Share Posted December 3, 2013 Why do you say that? Were matrix operations common in Maya? It has been a long time since I wrote tools for Maya, and for a good reason Quote Link to comment Share on other sites More sharing options...
Guest mantragora Posted December 3, 2013 Share Posted December 3, 2013 Yeah, I hate Maya. I tried get into it couple times last 5 years. Once I have to script every little shit in it or use this f*cking linking editor I'm out. It's the end of 2013 and in Maya it's still 90's. 1 Quote Link to comment Share on other sites More sharing options...
anim Posted December 3, 2013 Share Posted December 3, 2013 Thanks anim, do you think that's accurate enough? I tried it for some stuff but it seems off when compared to the full matrix itself, which of course also have a scale I am trying to get rid of. do you have example of that? Quote Link to comment Share on other sites More sharing options...
magneto Posted December 3, 2013 Author Share Posted December 3, 2013 Thanks anim, I will make a scene file today 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.