# Right Hand and Left Hand normals in 2D. What is going on?

## Recommended Posts

Spa8nky    230
Looking at an article on metanetsoftware.com here, it states (at the bottom of the page) that left hand and right hand normals are defined as follows:
Quote:
 Every 2D vector has two such normals: the right hand and left hand normal. As you might expect, the right hand normal points to the right of the vector, and the left hand normal points to the left. Given a vector a, the right hand normal of a is simply: rn.x = -a.y; rn.y = a.x; and the left hand normal is: ln.x = a.y; ln.y = -a.x; Note that ln = -rn.
If I create a vector:
            Vector2 R = new Vector2();
R.X = 10;
R.Y = 0;

and find the right hand normal as they suggested:
            Vector2 normal_RH = new Vector2();
normal_RH.X = -CCW.Y;
normal_RH.Y = CCW.X;

The normalised normal = (0,1). If vector R is pointing +ve x -------> then surely the vector (0,1) is the left hand normal and not the right? What is going on? Thank you.

##### Share on other sites
fastcall22    10846
Place the four fingers of your right hand along the direction of the vector, what direction is your thumb pointing?

##### Share on other sites
Spa8nky    230
So it is not its location to the right of the line that makes is right handed, that would make sense.

I guess in both cases the palms of my hand should be facing away from me?

##### Share on other sites
apatriarca    2365
It's the first time I see those vectors named in that way. I think the terms clockwise and counterclockwise would be easier to understand (at least for me). Anyway your right palm should point downward and the four fingers of your right hand should point in the direction of the vector. If you have done it correctly, your right thumb should then point toward the "right hand" normal. If you do the same with the left hand, the thumb should point toward the "left hand" normal.

##### Share on other sites
Spa8nky    230
Thank you for clearing that up in my mind. I was getting confused between right handed and right hand side.

##### Share on other sites
raigan    1110
"Right hand normal" simply meant the normal that points to the right of the line, nothing to do with hands and thumbs.

The problem here is one of "left-handed" vs "right-handed" coordinate systems: you're assuming that the vector (0,1) points upward (the way it's taught in math class) while the tutorial assumes that it points downward (the way it exists in some graphics APIs). So the vector (0,1) does in fact point to the right of the vector (1,0), *IF* you consider +y to be in the down direction rather than up.

##### Share on other sites
apatriarca    2365
Quote:
 Original post by raigan"Right hand normal" simply meant the normal that points to the right of the line, nothing to do with hands and thumbs.

No, the "right hand normal" points to the left of the line, not right. Consider the vector (1,0), the right hand normal in this case it's the vector (0,1) which is at the left of the x-axis.

Quote:
 Original post by raiganThe problem here is one of "left-handed" vs "right-handed" coordinate systems: you're assuming that the vector (0,1) points upward (the way it's taught in math class) while the tutorial assumes that it points downward (the way it exists in some graphics APIs). So the vector (0,1) does in fact point to the right of the vector (1,0), *IF* you consider +y to be in the down direction rather than up.

This is called orientation. Bases of vector spaces can be classified as positively oriented or negatively oriented based on the sign of their determinant. "left-handed" and "right-handed" coordinate systems only exists in 3D and they are defined using the "right hand rule". This definition can be extended in 2D assuming the existence of a third vector which is normal to the plane.

##### Share on other sites
raigan    1110
Well, since I'm one of the authors of the tutorial in question, I can say definitively that by "right hand normal" we meant "normal pointing to the right side of the vector".

The OPs problem was the assumption that (0,1) points up, when in our world that vector points down :)

This may be confusing since we don't explicitly *state* this anywhere, but if you consider e.g Figure 12 at the very bottom of the page -- the right-hand (red) normal of (3,-1) is given as (1,3) -- this can be inferred.

We're used to polygon vertices being listed in counter-clockwise order, and the right-hand side of polygon edges being the "outside" of the polygon. Hence the right-hand normal is the normal pointing to the right side of a vector. I guess this is just a convention.

##### Share on other sites
apatriarca    2365
Quote:
 Original post by raiganWell, since I'm one of the authors of the tutorial in question, I can say definitively that by "right hand normal" we meant "normal pointing to the right side of the vector". The OPs problem was the assumption that (0,1) points up, when in our world that vector points down :)This may be confusing since we don't explicitly *state* this anywhere, but if you consider e.g Figure 12 at the very bottom of the page -- the right-hand (red) normal of (3,-1) is given as (1,3) -- this can be inferred.We're used to polygon vertices being listed in counter-clockwise order, and the right-hand side of polygon edges being the "outside" of the polygon. Hence the right-hand normal is the normal pointing to the right side of a vector. I guess this is just a convention.

I did not read your tutorial, so I wasn't aware of your conventions. I think you should have written it somewhere in your tutorial.

##### Share on other sites
raigan    1110
I think it's pretty common in computer graphics for the origin to be in the top-left corner and for the basis vectors to point right and down.. that's how SDL and GDI work anyway. I've actually never used or seen an API that was setup in the "school math class" way.

##### Share on other sites
apatriarca    2365
In OpenGL, for example, you can set the orthographic projection used as wished. But even if every graphics library use this convention, I think it still make sense to state your convention somewhere. Indeed, you have written about collision detection and not rendering in your tutorial and I don't use the screen coordinates for game logic. Since you generally have to transform your objects in some way, it is not a great work to use either conventions and then transform the objects to use the other.
This discussion proves peoples generally assume a positively oriented bases when thinking about geometric problems because it is what they used in maths and physics classes. You can't assume your readers know about your convention and understand it immediately, even if it's quite common in the graphics field.

raigan    1110
You're right :)