2

I tried trim_with_solid method to drill a hole into a 3D model:

igl::copyleft::cgal::trim_with_solid(m_VA, m_FA, m_VB, m_FB, m_V, m_F, m_D, m_J);

But for hollowed 3D models with inner and outer walls, the hole is not closed:

Inner and outer walls

Possible solution

As posted here, a possible solution might be to use CSG operations of:

igl::copyleft::cgal::mesh_boolean

// or

igl::copyleft::cgal::CSGTree

However, the CSG operations need the input meshes to be manifold.

Question

I couldn't figure out if libigl has any tool to make a mesh manifold. Is there such a tool? Is there any other library which might help?

Megidd
  • 7,089
  • 6
  • 65
  • 142
  • There are `igl::is_vertex_manifold` and `igl::is_edge_manifold` methods which might be helpful ... – Megidd Nov 16 '20 at 13:38
  • Do you consider other mesh libraries or igl only? Is it possible to download your input meshes? – Fedor Jan 28 '23 at 14:51
  • @Fedor As far as I remember, a sample input mesh was this: https://upload.wikimedia.org/wikipedia/commons/9/93/Utah_teapot_%28solid%29.stl – Megidd Jan 28 '23 at 14:57
  • @Fedor Eventually, I implemented the hole drilling feature by this Go package: https://github.com/reactivego/csg along with some tricks to make it fast. – Megidd Jan 28 '23 at 15:00
  • 2
    Thanks, I see. Another option would be to use [MeshLib](https://meshinspector.github.io/MeshLib/html/group__BooleanGroup.html) – Fedor Jan 28 '23 at 16:57

1 Answers1

1

Eventually, I implemented the hole drilling feature by this Go package: https://github.com/reactivego/csg

Along with some tricks to make it fast:

Workaround & tricks

It's assumed that the user usually creates holes for the flat/simple regions on the 3D model surface. So, these flat/simple regions are less likely to have faulty triangles. Accordingly, the following workaround might be proposed:

  1. Consider the requested hole as a cylinder shape.
    1. This would be the original cylinder.
  2. Scale up the hole cylinder by a percent. Like 20%.
    1. This would be the scaled cylinder.
  3. Extract any triangle of the 3D model which:
    1. ...is inside or intersecting with the scaled cylinder.
    2. 3D model would no longer contain those extracted triangles.
  4. Convert the extracted triangles to CSG polygons.
  5. Perform CGS operation between CSG polygons and the original cylinder.
  6. Get the resulting polygons of CSG operation.
  7. Convert the resulting polygons to new triangles.
  8. Add new triangles to the 3D model.

Conclusion

The above workaround was great. The hole drilling is fast and reliable.

Screenshot

Megidd
  • 7,089
  • 6
  • 65
  • 142