### The triangle

Let's define a triangle ABC in 2 or 3D, defined by its three vertices

normal(

and therefore

area(

where |v| means the length of v. Now, let's expand the cross products, by distribution:

(

Since the cross product is anticommutative,

normal(

which is the sum of one cross product per side of the triangle. We can evaluate it by traversing all the vertices in order and cyclically, and doing the cross product with the following vertex. Not only this is interesting as an alternative way to compute triangle normals without edge vectors, but it also hits at some sort of generalization to polygons with more sides.

**A**,**B**and**C**. We now want to compute its area or normal vector - remember that the area is half the length of its normal. The classic approach to computing it is to first compute the edge vectors**B**-**A**and**C**-**A**and then cross them:normal(

**A**,**B**,**C**) = (**B**-**A**) x (**C**-**A**)and therefore

area(

**A**,**B**,**C**) = |normal(**A**,**B**,**C**)|/2where |v| means the length of v. Now, let's expand the cross products, by distribution:

(

**B**-**A**) x (**C**-**A**) =**B**x**C**-**B**x**A**-**A**x**C**+**A**x**A**Since the cross product is anticommutative,

**B**x**A**= -**A**x**B**, and since**A**x**A**= 0 (for it defines a zero area triangle), we get thatnormal(

**A**,**B**,**C**) =**A**x**B**+**B**x**C**+**C**x**A**which is the sum of one cross product per side of the triangle. We can evaluate it by traversing all the vertices in order and cyclically, and doing the cross product with the following vertex. Not only this is interesting as an alternative way to compute triangle normals without edge vectors, but it also hits at some sort of generalization to polygons with more sides.

### The quad

Let's define a quad ABCD by its four vertices

normal(

Again, due to the anticommutativity of the cross product (

normal(

which is again a cyclic alphabetically sorted sum of one cross product per side of the polygon. Nice!

Of course, again, area(

Interestingly, the normal/area of the quad can be also expressed as the cross of the diagonals: (

**A**,**B**,**C**and**D**. We will compute both its surface area and normal as the sum of the aras and normals of two of the triangles it is composed of. This will work just fine for the surface areas, and for the normals too as long as the two triangles are coplanar and do define a real quad. In case they don't, the addition of the two normals will be nothing but the average normal of the quad. In any case, we have that:normal(

**A**,**B**,**C**,**D**) = normal(**A**,**B**,**D**) + normal(**B**,**C**,**D**) =**A**x**B**+**B**x**D**+**D**x**A**+**B**x**C**+**C**x**D**+**D**x**B**.Again, due to the anticommutativity of the cross product (

**B**x**D**= -**D**x**B**) we get thatnormal(

**A**,**B**,**C**,**D**) =**A**x**B**+**B**x**C**+**C**x**D**+**D**x**A**which is again a cyclic alphabetically sorted sum of one cross product per side of the polygon. Nice!

Of course, again, area(

**A**,**B**,**C**,**D**) = |normal(**A**,**B**,**C**,**D**)|/2Interestingly, the normal/area of the quad can be also expressed as the cross of the diagonals: (

**A**-**C**)x(**B**-**D**). Indeed, if you apply distribution and anticommutativity to this cross product, you will see it reduces to the same cyclic summatory of cross products.### And beyond

In fact, this is true for n-sided polygons. You can easily demonstrate this yourself by drawing a pentagon, then an hexagon, and generalizing the idea. The result is that for n vertices v

_{i}with i={0, 1, 2, ...n-1} forming a polygon,

normal(v

_{0}, v

_{1}, ..., v

_{n-1}) = ∑v

_{i}ₓ v

_{i+1}

where of course the i+1 wraps to 0 when it otherwise becomes n.

### Conclusions

This is extremely useful trick for 4 kilobyte demo coding, when you want to avoid doing some vertex subtractions in order to compute your face normals (and vertex normals too, as explained in the article about clever 3D mesh normalization. The problem this technique might have arises in the cases where the polygons or mesh are big and some of its vertices are far from the origin. In that case the cross products might be dealing with very parallel vectors and the precision of the result might be compromised. THe regular method of computing normals doesn't suffer from this as vertices get subtracted form each other. However, for most use cases, the method presented here works just fine. Promise.