# Polarity of the Surface Normal of a 3D triangle

I have a triangle (defined in 3D space) that has 3 points (p1, p2 and p3).

Is it possible to work out what the polarity of the surface normal would be for the face knowing it lists each point in an anti-clockwise direction going around the face on the same side that the surface normal should point?

Edit: "Polarity" might be a bad choice of word. By polarity I mean choice between $\vec{n}$ and $-\vec{n}$ where $\vec{n}$ is the surface normal.

Edit: Surely, the surface normal orientation can be calculated if you know the order of the coordinates?

Edit: OK, I have been thinking about what exactly I am asking... cause its not clear, I know.

So.... 1) I have a surface normal $\vec{n}.$ 2) I use the right hand rule to determine orientation... points (p1, p2, p3) go anti-clockwise around the triangle.

Q: Given 3 points of a triangle...and after calculating its normal. How can I tell which orientation I should use, please? It's giving me a real headache!

-
how do i get my reputation up? – Beakie Aug 19 '12 at 22:36
You generally get reputation if other users upvote your questions, or upvote your answers. – user2468 Aug 19 '12 at 22:39
What do you mean by the "polarity" of the normal? The cross product $(p_2-p_1)\times(p_3-p_1)$ gives a vector pointing in the direction you want. – Rahul Aug 19 '12 at 22:41
Imagine a cube. Say, I need the surface normal of each side to point outwards. If I calculate the surface normal each side would have the same surface normal as the side opposite. In order to give this line a direction I need to consider its "polarity". In order to calculate the "polarity", I am wondering if defining the order of the points around the shape (in this case triangle) would help me know which way round the surface normal should be "pointing". Sorry if I'm not making sense... – Beakie Aug 19 '12 at 22:53
The word you are looking for is orientation. – rschwieb Aug 20 '12 at 0:05

You seem to be a little confused. If you know the direction of the normal, then you can determine what the order of the vertices should be. If you know the ordering of the vertices, then you can determine the direction of the normal. But if you know neither, you cannot determine either. And if you know both, what's the question?

The easy way to keep track of everything is this. When at first you are defining the triangles for your (triangulated) cube, you know which direction each face's normal should point in, so you should order the vertices of your triangles accordingly. Later, when you just have a bunch of triangles and have forgotten that they came from a cube, you can recover the direction of the normal because you know the vertices are in a consistent orientation. That's all there is to it. Leave a comment if anything's unclear.

If you have a set of vertices $\{p, q, r\}$ and you want the normal to be in the direction of some known vector $n$, then you can start by assuming the order is $(p,q,r)$, computing the corresponding normal $\tilde n = (q-p)\times(r-p)$, and checking whether the dot product $\tilde n\cdot n$ is positive; if not, take the opposite order $(r,q,p)$ instead.

-
I am sorry for creating a world of confusing around my question. I am in COMPLETE agreement with you. My question (as confused as it seems) is HOW. I have ordered verticies. I have a normal. How (using maths, or more specifically, code) can I take this information and tell my program when to negate the orientation of the surface normal? What geometry can I use to determine a direction from my ordered vertices. Does this make any more sense? I have a question in my head... I am just really struggling to ask it without knowing the answer! :) – Beakie Aug 20 '12 at 22:15
Are you asking how to tell whether the normal you want is consistent with the vertex ordering you have, and what to do when it isn't? – Rahul Aug 20 '12 at 22:19
booooooooooOOOMMM "Are you asking how to tell whether the normal you want is consistent with the vertex ordering you have"...........exactly. this is my question... thanks! is the answer the edit given by rschwieb? – Beakie Aug 20 '12 at 22:39
Please see my edit. – Rahul Aug 20 '12 at 22:55
this sounds like the answer. thanks!!!!!! – Beakie Aug 20 '12 at 23:34

No, orientation is an arbitrary choice.

The standard convention is that if you are indicating motion in a counterclockwise direction around the edge of the shape, then the orientation is "towards you", else "away from you". This is the right hand system.

Added Using the three points (and the right hand convention), you can describe the oriented triangle by writing its edges as vectors. From the point coordinates you have the vector $v_1=p_2-p_1$, $v_2=p_3-p_2$ and $v_3=p_1-p_3$. When placed end to end these represent the oriented triangle in your picture. The cross products $v_1\times v_2$, $v_2\times v_3$ and $v_2\times v_3$ will all point in the direction of the normal you drew (if I haven't turned myself around!)

-
I am really sure it isn't. Surely the surface normal will always point in one direction, and there must be some way, using the coordinates of establishing if this direction needs flipping? – Beakie Aug 20 '12 at 0:12
@Beakie Once you have established what orientation convention you intend to use, yes. If you use the right hand system and identify the shape as having motion going counterclockwise around the edge, then you would say the side facing you is "up". If you had adopted the other orientation convention, then you would say the side facing you is "down". Both are valid, but the right hand convention I think is more common. – rschwieb Aug 20 '12 at 0:25
OK, the convention I haven't chosen, but that IS surely arbitrary. How can I use these coordinates to work out any sort of orientation? For now, lets say right hand convention... – Beakie Aug 20 '12 at 0:30
@Beakie If you choose the right hand orientation (=choosing the normal definition of the cross product) and if you use the points consistently in order to produce the vectors I meneiond, then you can work out the normal from the vectors in my post. I think this answers your question. (?) – rschwieb Aug 20 '12 at 20:37
@Beakie Notice that the vectors I produced in your counterclockwise list are stacked end-to-end in a cycle through the points in that order. – rschwieb Aug 20 '12 at 20:41