Working on some arcane aspect of my landscape pipeline I find I need to identify whether points in my mesh are part of the “outside edge” of the mesh. I am familiar with the calculation of a Convex Hull – but this creates the shorest line that connects encompasses the mesh, and is not limited to triangles that already exist in the mesh. This means that the Convex Hull probably does not resemble the shape of the original mesh.
The solution to the problem jumped into my head rather than searching for it on the web – it was a really simple solution when I considered what made an “exterior” point different from an “interior” point. We can visually see an interior point because it is completely surrounded by triangles – but what does that “surrounded” mean mathematically ?
It means that the sum of all the angles between the subject point and all the other points of the triangles it forms part of are exactly 360 degrees. Anything less than that; then the point is an “exterior” point.
In order to determine a convex hull for a point cloud I follow the following logic
- Triangulate the mesh.
- For each point, select all the triangles it it part of
- For each of those triangles, calculate the angle formed between the subject point and the other two points.
- Iterate all the triangles that use this point, and sum the angles found.
- If they are less than 360 then this point is not wholly surrounded by triangles and is therefore exterior.
This method works for meshes that do not have interior holes in them, as the points on the hole boundary would be treated as part of the Concave Hull.