I want to import an .obj model and calculate the coordinates of the hull curve of the projected model on the XY-plane. The model can be of any closed shape with holes etc. How can I do this?

I already tried to project each edge onto the plane get only the edges which are not duplicate because this should be an outline edge in 2d. But this is not valid for a mesh coming from 3d.

Are you using three.js docs ConvexGeometry

On your projected points?

Have you tried three-edge-projection by gkjohnson? It sounds like this demo in the provided lib would cover what you are asking for here…

I tried that, but ConvexGeometry seams not to work propably. And I think it will not work on concave shapes.

This is the result for my object when using ConvexGeometry:

Oh my bad… I got confused when you said “hull” and assumed convex hull.

edit: I’ve done something like this in the past in a few step process…

first make sure it’s an indexed mesh, (geometry.toIndexed() ) delete the uvs and normals, (deleteAttribute(‘uv’) deleteAttribute(‘normal’)) then merge all vertices (geometry.mergeVertices()) so that all vertices are shared amongst triangles, call geometry.computeVertexNormals()

then walk each triangle in the index buffer, and look for triangles whos normals, dotted with your direction vector, cross the zero threshold. Collect those triangles, then find the edge that has normals with (negative sign) the direction normal… and collect those edges as line segments.

It’s not the true outer hull, since it will capture edges on protruding overlapping stuff… but for some cases its enough.

1 Like