0

I have two non-convex meshes and I want to find the closest distance between them. An approximate value is enough for my needs (as long as it does not deviate too much from the true value).

I break the non-convex meshes in many convex parts, and for speed reasons I also find the convex hulls of each convex part.

Then, I test the distances for all combinations between the hulls of the first and the second mesh. The shortest one defines the closest distance between the two meshes.

I already have a working solution with CGAL's Optimal Distances package (see image below). The result is nice, but the runtime is not ideal, actually it is the main bottleneck in my pipeline.

It makes sense that this problem is resource intensive, but it would be really nice to have a faster alternative with CGAL or another library or approach that gives a similar result. Unfortunately I have not found any alternative up to now.

enter image description here

Update:

The link provided above pinpoints to the CGAL-example that I'm following, namely the "polytope_distance_d_fast_exact.cpp" example. Regarding the used kernel, I use:

// use an inexact kernel...
typedef CGAL::Homogeneous<double>                         K;
typedef K::Point_3                                        Point;
// ... and the EXACT traits class based on the inexcat kernel
typedef CGAL::Polytope_distance_d_traits_3<K, ET, double> Traits;
typedef CGAL::Polytope_distance_d<Traits>                 Polytope_distance;
dim_tz
  • 1,451
  • 5
  • 20
  • 37

1 Answers1

0

It’s a bit of an older library - and it’s been a few years since I used it - but I seem to remember trying to do something similar with the GNU Triangulated Surface library...

In particular, using the function gts_surface_distance to find the distance between two GtsSurfaces (which I think your non-convex meshes can still be represented as).

See here for more info.

I'm afraid I have no idea if it might be faster for you - but perhaps worth a shot!

timlukins
  • 2,694
  • 21
  • 35