# Left-handed vs. right-handed

## Recommended Posts

GuyWithBeard    1891
Hi! As Managed DirectX got new life through SlimDX I decided to rewrite my old game engine, and along the way I decided to move from left-handed coordinate systems to right-handed. Many modern APIs (XNA for example) as well as many modeling tools seem to use right-handed coordinate systems. Now, I have been thinking about this for a while, but I am not quite certain yet; What do I have to change to move from LH to RH? Is it enough that I use the RH-functions that DirectX offers instead of the LH-ones, or do I have to invert the Z axis in ALL the calculations throughout the whole engine? Also what other things do I need to keep in mind? I seem to remember that the faces on a model face the other way when changing the handedness. Is this correct? Anything else? Thanks in advance! //chinc

##### Share on other sites
Aressera    2919
Left vs. right handedness has to do with what hand you use to define a cross product.

for v1 x v2 = v3:

right handed: v1 is index finger, v2 is the middle finger perpendicular to the palm, v3 is the thumb pointed out like your bumming a ride.

left handed: use your left hand instead. (the cross product gives the opposite result)

This is essentially the right hand rule used in physics classes. This is related to coordinate systems in that for a given coordinate system with basis vectors i, j, k, they will be related by the following: i x j = k

This is why I really dislike directX, because in order to get a proper directX rotation matrix, you have to reverse the cross product: k x j = i

Most of the world uses a right handed system (OpenGl, etc.), so directX is alone.

Normally one would build a rotation matrix like so:

    [ i.x, j.x, k.x ]R = [ i.y, j.y, k.y ]    [ i.z, j.z, k.z ]

but in a left handed coordinate system, it is as follows:

    [ i.x, i.y, i.z ]R = [ j.x, j.y, j.z ]    [ k.x, k.y, k.z ]

Basically, a left handed rotation matrix is the transpose of a right handed system.

Other than that, I'm not sure how this relates exactly to DirectX because I have a mac and use OpenGL.

##### Share on other sites
jyk    2094
Quote:
 Original post by AresseraNormally one would build a rotation matrix like so: [ i.x, j.x, k.x ]R = [ i.y, j.y, k.y ] [ i.z, j.z, k.z ]but in a left handed coordinate system, it is as follows: [ i.x, i.y, i.z ]R = [ j.x, j.y, j.z ] [ k.x, k.y, k.z ]Basically, a left handed rotation matrix is the transpose of a right handed system.
This could probably use some clarification...

It's not a given, I don't think, that a rotation matrix needs to be transposed when switching to a coordinate system of a different handedness. You may want to transpose it (to, say, preserve the apparent direction of a rotation). However, I would still consider the above example to be a little misleading, as it suggests a change in basis orientation (column vector to row vector) rather than a simple negation of the angle of rotation.

Just to be clear, coordinate system handedness has nothing to do with basis orientation (by which I mean the choice of row- or column-vector notation, and, by extension, whether the basis vectors of a transform are stored in the rows or columns of a matrix). Now, it just so happens that D3D uses row-vector notation and a left-handed coordinate system, whereas OpenGL uses column-vector notation and a right-handed coordinate system, and as a result it's common for people to make the (incorrect) assumption that these two issues are somehow related (similar confusion surrounds the issue of how matrices are laid out in memory). However, the relationship is purely incidental.

##### Share on other sites
chessnut    100
It's as simple as switching the sign on the z axis. As to the model thing it all depends on the orientation of your camera.

## 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