Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does coordinate system handedness relate to rotation direction and vertices ordering?

While trying to understand different coordinate systems I came across this website, which states: RenderMan uses left-handed coordinate system and the positive rotation is clockwise, while OpenGL uses right-handed coordinate system and the positive rotation is counter-clockwise.

My question is whether the rotation direction and the coordinate system handedness are just two distinct conventions or this results from maths itself ?

Similarly, I know that the front facing vertices of triangles have to be ordered in counter-clokwise direction in OpenGL. Does this too relate to coordinate system handedness or it's just another unrelated convention ?

And thirdly, when a picture of random coordinate system with axes labeled as x, y, z is thrown before me, how do I tell which one is left handed and which one is right handed ? I know there is a rule with right hand and the middle and the index fingers and the thumb, but everyone seems to use it differently. How should I align my fingers with these axes ?

Sorry for probably mixing a lot of unrelated stuff together, but after reading all kinds of internet sources, things start to blend together in my head.

like image 448
jcxz Avatar asked Nov 02 '13 21:11

jcxz


People also ask

What does it mean for a coordinate system to be right-handed?

Coordinates are usually right-handed. For right-handed coordinates the right thumb points along the z axis in the positive direction and the curl of the fingers represents a motion from the first or x axis to the second or y axis. When viewed from the top or z axis the system is counter-clockwise.

What is the difference between a left-handed coordinate system and a right-handed coordinate system?

In this case, right-handedness is defined as any positive axis (x, y, or z) pointing toward the viewer. Left-handedness is defined as any positive axis (x, y, or z) pointing away from the viewer.

How are rotations in the coordinate system done?

Example: Rotate the point (5, 8) about the origin 270° clockwise. The rule for rotating an object 270° clockwise about the origin is to take the opposite value of the coordinate and then switch it with the coordinate. The opposite of 5 is -5 and, switching the coordinates, we obtain our answer: (8, -5).


2 Answers

A fairly common method for either left or right hand:

  1. With your hand flat, point your fingers in the direction of X.
  2. Curl all fingers but your index finger to point towards Y.
  3. Raise your thumb. That's Z.

Again that's:

  • +x = Index finger
  • +y = middle finger (and/or ring and pinky fingers) bent 90 degrees inward
  • +z = thumb sticking out

Given an XYZ coordinate frame, determine positive rotations:

  1. Point your thumb in the direction of +X, or +Y, or +Z.
  2. The direction in which your fingers curl and point is the direction of positive rotation.

In most cases with which I'm familiar (YMMV), the right-hand rule is the norm. Graphics can be a little screwy in using the left-hand rule sometimes. In the cases with which I'm familiar, which are by no means exhaustive, the left-hand rule is chosen because the programmer/designer wants Z to point in some "natural" direction. Some people don't like the notion of Z pointing into or out of the screen, perhaps.

Once a certain handedness has been chosen, then there are consequences for vector directions. Although I'm not sure this is the right example since I deal with image processing rather than graphics, if a polygon is defined using oriented segments, then the cross product of successive segments will point out of or into the screen. It's important to know which side of the 2D polygon is facing "out" to the viewer, because the polygon may represent some 2D object that has different colors on opposite sides.

More generally speaking, the choice of handedness will determine how cross products are handled. "X cross Y equals Z" is what you're doing when you point your fingers and thumb using your hand.

Try holding out both hands and do this:

  1. Point left and right hand fingers straight ahead, away from your body. That's X.
  2. Curl your fingers to your left--flip one hand over to do so. That's Y.
  3. Now stick out your thumbs. They point in opposite directions.
like image 175
Rethunk Avatar answered Jan 04 '23 08:01

Rethunk


Sometimes, a picture paints a thousand words...

enter image description here

Actually, there are several valid right-hand configurations, so pick one and stick with it:

alternatives

like image 21
Drew Noakes Avatar answered Jan 04 '23 09:01

Drew Noakes