How to get the outline points from any mesh?

Hi everyone.

I’m trying to get the outline points from any mesh.

I want to get the ordered point array ([p0, p1, p2 … p6]) from the mesh.


For reference, the mesh has many points inside.

There is no function in three.js that you can use to solve this issue. However, you can try to represent the triangulated polygon as a half-edge data structure (a common data structure in computational geometry) and then determine all half-edges with no twin/opponent edge. These edges represent the contour of the shape.