getClosestFacetAtCoordinates returning null most of the time

I think it is working as expected (albeit not how you would like it to work):

When using facets, the mesh bounding volume is subdivided into tiny cubes, depending on a number of parameters (partitioningBBoxRatio, partitioningSubdivisions, …).

When checking a point P for a closest facet, the function looks for the cube containing P and compute the distances between P and each facet of this cube and returns back the facet with the minimum distance to P.

So, there are two important things to note:

  1. P must be inside the bounding volume of the mesh (taking partitioningBBoxRatio into account - so you can inflate a bit the bounding volume used by the function by setting partitioningBBoxRatio greater than 1) for the function to (potentially) returns something other than null (see 2.)
  2. if the cube that holds P does not contain any facts, the function returns null

So, given that the center of the label plane you move stays inside the bounding volume, it’s 2. that explains that most of the time no facet is found.

You can circumvent 2. by lowering partitioningSubdivisions (even setting it to 1), but that defeats the purpose of the subdivision process, which is to quickly find a match by checking only a subset of the facets…

2 Likes