converting from a Right Handed Coordinate System

Started by
2 comments, last by Dave Eberly 16 years, 11 months ago
Hi, I'm having real trouble trying to convert from a physics simulator that uses a right handed coordinate system (the z axis is the vertical)to a left handed coordinate system (a la OpenGL). A plane is created using the R.H. system starting at the origin, in terms of an equation of a plane: (a b c d) = ( 0, 0, 1, 0) but I just can't wrap my head around how to draw this in the L.H. system. I may have been looking at it for far too long already today and messed my head up. Any tips or help would be greatly appreciated!
Advertisement
Hmm, perhaps I'm missing, been studying non-stop for 12 hours so forgive me if I've misunderstood!

Plane equation: a * x + b * y + c * z + d = 0
You have the equation z = 0, which means a plane stretching across the entire x-y plane with z = 0. If this is in a coordinate system with z as "up" and you want it in a coordinate system where y is "up", it would just be the infinite plane stretching across the entire x-z plane with y = 0.

EDIT: If you just want to take it from a right-handed coordinate system to a left-handed one, then the z-axis could still be the same if you threat it as "up", in which case your plane will remain the same. The difference between a left and right handed system is the order of the coordinates. In a right handed system, looking down y with z up you have x to your right, in a left handed, you have x on your left. But an infinite x-y plane will remain the same regardless.
Best regards, Omid
Actually, OpenGL is right handed. DirectX is the left handed one.

If you want to convert between right and left hand, then it's just a matter of flipping the sign on the z coordinate - i.e, z = -z;

If you're converting from a right hand system where Z is up to a OpenGL right handed system where Z is pointing out of the screen, then I'm pretty sure it's something like

new.x = x;
new.y = z;
new.z = -y;
The handedness of OpenGL or Direct3D is merely a consequence of using their "helper" functions. You can impose the handedness you prefer by setting various matrices yourself. For example, in Wild Magic, I do not use gluLookAt or D3DXMatrixLookAt* functions. I set the model matrix, view matrix and projection matrix directly, imposing a right-handed coordinate system. I also impose the convention for matrix-vector multiplication that vectors are row vectors that are on the left of the matrix that multiplies them. This allows me to use the same vertex shader programs for OpenGL and Direct3D (and a software renderer).

Perhaps you can just use the physics simulator "as is" and arrange for your graphics system to do the right thing (or is that the left thing :)

This topic is closed to new replies.

Advertisement