Sign in to follow this  
shinobi-warrior

matrix & mirrored vertices

Recommended Posts

hi, i have a problem with mirrored vertices. I'm exporting vertex information from a CAD system and it is possible, that some vertices (meshes) are designed/placed by mirroring, and the mirroring is stored in the rotation matrix. Is there a way to determine the mirroring for x,y,z ? thanx in advance

Share this post


Link to post
Share on other sites
if you want to get the mirrored object from the vertices, and the mirror matrix, simply multiply them (Matrix*Vertex)
if not this is what you want, then what? maybe i can help :)

Share this post


Link to post
Share on other sites
I thought i made myself clear, ... but it seems not.

I have a 3x3 rotation matrix which also stores the information of the mirroring.

For me it is not wanted to get a matrix storing mirroring, because i have an none-mirrored object and i don't want it to be mirrored. So i have to get rid of the mirroring in the matrix or at least to know which axis/es is/are mirrored.

Does anyone know a solution how to extract from the matrix which axis/es is or are mirrored?

thx

Share this post


Link to post
Share on other sites
i understand now. i think it is not so easy. unfortunately i dont remember how does mirroring work, but i think you wont be able to extract it, since you have other transformations stored in the matrix. finally the solution will lead to a linear equation sytem with infinite solutions (dont know it for sure, ive just finished the first term of linear algebra at the university, and have few practice in matrices/equation systems, or whatever they are called in english)

Share this post


Link to post
Share on other sites
I've come across this problem when writing exporters for 3ds max. What you need to do is test the parity of the transform matrix for your object. I'm not sure if you can extract which axis is mirrored, but I've never needed to because I always export my verts transformed by the mirror matrix.

Something like this should do the trick (where GetRow(?) returns a vector):

bool GetMatrixParity( matrix& M )
{
return Dot( Cross( M.GetRow(0) , M.GetRow(1) ), GetRow(2) ) < 0.0f );
}

if this returns true, then the matrix contains a mirror - you need to reverse the vertex winding order when rendering trianges/computing normals etc.

Hope that helps

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this