Skip to content

Fix containing face not being found - #103

Merged
amock merged 1 commit into
naturerobots:mainfrom
ayden175:search_face
Jul 28, 2026
Merged

amock merged 1 commit into
naturerobots:mainfrom
ayden175:search_face

Conversation

@ayden175

Copy link
Copy Markdown

MeshMap::searchContainingFace() only checked the faces directly adjacent to the single nearest vertex found via getNearestVertexHandle(). For the (irregular) mesh that I was using, this sometimes caused the problem that the function would fail to find the containing face, as it was not connected to the nearest vertex. Here is a visualization of the specific issue I had:

image

To solve this, I replaced the single-ring face check with a best-first search:

  1. Start from the nearest vertex v as before
  2. Instead of only checking faces of v, expand outward via getNeighboursOfVertex(), visiting the next-closest unvisited vertex to the query point first
  3. Check all faces touching each visited vertex, tracking the best (lowest-distance) containing face found so far
  4. Stop expanding once the frontier's minimum distance exceeds max_dist

Also potentially related to #31

@ayden175
ayden175 requested a review from amock as a code owner July 27, 2026 13:24
@amock

amock commented Jul 28, 2026

Copy link
Copy Markdown
Member

At first glance, doing a small limited search is definitely an optimization over just returning an error. I'll have a look at it soon.

@amock
amock merged commit 5963aea into naturerobots:main Jul 28, 2026
2 checks passed
@amock

amock commented Jul 28, 2026

Copy link
Copy Markdown
Member

Nice addition! I tested it with the tutorials and from my point of view it only improve things. Note that the optimal solution to this problem is sketched in #104 and will probably replace this one as soon as it is implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants