0

I am looking for a fast method to compute the approximate volume of the intersection of two polyhedrons. My program runs 20k iterations wherein each iteration I need to compute the volume of difference of two polyhedrons with ~100 vertices each (one of these polyhedrons is stationary, and the other changes its pose in each iteration). I require this program to terminate within a second.

I have tried using Nef_polyhedron_3, but it requires an exact kernel, and thus takes a large amount of time. Next, I tried to use Polygon_mesh_processing::corefine_and_compute_difference, but I could not find a method to convert my Polyhedron_3 to Surface_mesh (without the use of Nef_polyhedron).

I would be really grateful if someone could help me with this problem. Thank you in advance!

spark
  • 1
  • 2

2 Answers2

1

You can try to use this faster function from the polygon mesh processing package and then that one to get the volume of the intersection.

If still too slow then you can use Monte Carlo to get an estimation of the volume, using point sampled within the static polyhedron. This class will help knowing if a point is inside or outside the bounded volume.

sloriot
  • 6,070
  • 18
  • 27
1

For the conversion you can use the function copy_face_graph()

Andreas Fabri
  • 1,144
  • 6
  • 9
  • I was able to use Polygon_mesh_processing::corefine_and_compute_difference by converting to Surface_mesh using copy_face_graph(), but it is still too slow. Is there any other faster method? – spark Jun 27 '21 at 11:45
  • Is it possible to use [3D Fast Intersection and Distance Computation](https://doc.cgal.org/latest/AABB_tree/index.html) to approximately find the volume of intersection of polyhedra meshes? – spark Jun 27 '21 at 11:59