PDA

View Full Version : Coordinate systems

jyk
03-19-2000, 04:25 PM
I'm working on an engine that will work both in software and with OpenGL. I'm used to a left-handed coordinate system (with z going into the screen), but OpenGL uses a right-handed system, so I need to switch to that. Is there any advantage to having -z go into the screen? Since you eventually want to divide by z for perspective, doesn't this mean that you'll have to flip the sign anyway (since dividing by a negative z value would flip your x and y values)? So, I guess the question is, what are the advantages of a right-handed system?

Thanks.

Humus
03-20-2000, 06:45 AM
What is better i think i mostly of matter of taste. However, if you want z to be positive into the screen you can use glScale(1,1,-1);

dmy
03-20-2000, 11:37 PM
matematicians prefer the right handed system, computer graphics hobbists usually prefer a left handed system because it's more straightforward, even thought it's mainly an historical reason.

personally i suggest a right handed system, because in computer graphics mathematics is very important, and if one want a quick reference into math texts, the step from abstraction to code is shorter.

moreover, it's more easy to figure out rotation directions if one thinks with his hands:
take the left hand (not the right!) and make your thumb points toward you, the index finger point up and the other finger to the right.
just made up the right handed system coordinate frame.
to figure out rotations, use the right hand closed with the thumb point outward.
then, apply the right hand on top of the left hand axis: the direction of fingers of the right hand is the direction of positive rotations around that axis.
this is also the way mathematics describe such things, like momentum.

Dolo/\/\ightY

[This message has been edited by dmy (edited 03-21-2000).]

Eric
03-21-2000, 06:37 AM
Hi !

Just a question : am I crazy coz' I have got my X axis going to the right of the screen, my Y axis going into the screen itself and my Z axis going to the top of the screen ???

Huh ? http://www.opengl.org/discussion_boards/ubb/smile.gif http://www.opengl.org/discussion_boards/ubb/smile.gif http://www.opengl.org/discussion_boards/ubb/wink.gif

Eric

P.S. : I have always thought that having your Z coordinate as the altitude was more logical....

dmy
03-21-2000, 07:26 AM
if it works, it's good. http://www.opengl.org/discussion_boards/ubb/smile.gif
when designing/rendering height fields, i too prefer that.

Dolo/\/\ightY

jyk
03-22-2000, 09:46 PM
Yeah, I've read that flight and sub sims often have z going up and down, 'cuz it makes more sense to have x and y correspond to longitude and lattitude.