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

Started by
10 comments, last by raigan 14 years, 2 months ago
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.
Advertisement
Place the four fingers of your right hand along the direction of the vector, what direction is your thumb pointing?
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?
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.
Thank you for clearing that up in my mind. I was getting confused between right handed and right hand side.
"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.





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 raigan
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.

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

Quote:Original post by raigan
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.

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

This topic is closed to new replies.

Advertisement