How can I calculate the surface area of a set of coplanar points, representing the vertices of a polygon, in three dimensions?
Should I convert it into 2D, or is there a way to compute this quantity in 3D?
How can I calculate the surface area of a set of coplanar points, representing the vertices of a polygon, in three dimensions?
Should I convert it into 2D, or is there a way to compute this quantity in 3D?
Copyright © 2021 JogjaFile Inc.
You don't have to come back to a 2D framework.
Let $O=\dfrac1n \sum A_k$ be the center of gravity of your cloud of points. It belongs naturally to their common plane.
The area of triangle $OA_kA_{k+1}$ is
$$\dfrac12\|\vec{OA_k} \times \vec{OA_{k+1}}\|$$
(half the norm of the cross product : https://en.wikipedia.org/wiki/Cross_product).
But, after discussion with @achille hui (that I thank very much for this remark), sum all these vectors and take their norm at the end.
$$area =\left\| \sum_{k=1}^{k=n}\dfrac12\vec{OA_k} \times \vec{OA_{k+1}} \right\| \tag{1}$$
(we assume cyclicity, i.e., $A_{n+1}=A_1$)
The benefit of taking norm at the end instead of taking it each time is that you can cope in this way with non-convex polygons.
Remark : A simpler formula : instead of taking the center of gravity $O$, one can take for example $A_1$ as the reference point. In this case, the two terms containing $\vec{OA_1}$ vanish, transforming the sum with $n+1$ terms into the following sum containing $n-1$ terms only:
$$area =\left\| \sum_{k=2}^{k=n-1} \dfrac12\vec{A_1A_k} \times \vec{A_1A_{k+1}} \right\| \tag{2}$$
Explanation : Let $\vec{N}$ be a normal unit vector to the plane of the $A_k$. Let us assume first that the set of vertices $A_k$ is convex. When "traversing" it, we will have
$$\dfrac12\vec{OA_k} \times \vec{OA_{k+1}}=a_k\vec{N}$$
with $a_k$ the signed area of triangle $OA_kA_{k+1}$
If we assumed that $\vec{N}$ is oriented such that all $a_k \geq 0$, this explains the result. But the "miracle" is that, if the polygon generated by the $A_k$ isn't convex, some of the $a_k$s will become negative, but it will not entail the result because there willl be areas concellations.
Edit: Formula (2) can be extended not only to non-convex polygons but as well to certain self-crossing polygons. For example in the following case, formula (2) gives the following sum $2-3+2=1$ which is equal to the sum $+2-1=-1$ of oriented areas of the upper square (area $+2$) and area of right triangle at the bottom which is $-1$.
In fact all this is well descibed under the "shoelace formula" terminology here.