# Check if a matrix is transposed

This topic is 2844 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

is there anyway to check if a matrix has been transposed?

In general, no.

##### Share on other sites
True, in general it is not possible. If you know a little about the matrix then there is a chance.
Affine transformation matrices have in the last row (0,0,0,1). World and view matrices are usually affine, since they are a combination of affine transformations (rotation, scale, translation ...).
Perspective projection matrices have in the last column (0,0,1,0) if left-handed and (0,0,-1,0) if right-handed.
Orthographic projection matrices have in the last column (0,0,0,1).
If those are transposed you find the entries in the last column/row.

##### Share on other sites
Just a small note about why it is not possible in general: Transposed matrix is again just a matrix. It's not different anyhow, there is nothing special on it in general.

It would be possible for a non-square matrix, IF you knew the original dimensions of the non-transposed matrix. If you are working with 3x2 matrices and you have a 2x3 matrix, you can say it probably has been transposed. But as we are in the DirectX/XNA section, you will most probably be talking about 4x4 or 3x3 matrices, so this is not good for you.

Your only hope here is what Tsus said - some special matrices have some columns or rows with "fixed" values that could be used for this.

##### Share on other sites

True, in general it is not possible. If you know a little about the matrix then there is a chance.
Affine transformation matrices have in the last row (0,0,0,1). World and view matrices are usually affine, since they are a combination of affine transformations (rotation, scale, translation ...).
...

For sure, inside a given solution the following points will be clear in general, but given as a statement detached from a concrete context I want to comment it:

The above reasoning already makes assumptions about some conventions how the matrix is build:
* are row vectors or column vectors used?
* is the homogeneous co-ordinate stored as the 4-th scalar or somewhere else?
where I already conveniently imply that the matrix is used in a 3D world with a homogeneous extension.

• ### Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• 15
• 11
• 9
• 11
• 15
×

## Important Information

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!