axom icon indicating copy to clipboard operation
axom copied to clipboard

Add test cases for finding the closest point on a triangle

Open adayton1 opened this issue 10 months ago • 2 comments

My application is getting fairly different answers in some cases when using the closest_point query. I noticed there are no test cases for the triangle case. Having a few test cases would definitely increase my confidence that closest_point is actually doing the right thing.

Also, maybe label the vertices in the documentation for the function with A, B, and C (in addition to 0, 1, 2) to match comments in the source code like "Check if P in vertex region outside A"

adayton1 avatar Apr 02 '24 17:04 adayton1

Thanks for reporting this, @adayton1.

We have several indirect test cases for this functionality via primal::squared_distance(Point, Triangle), which is defined in terms of closest_point -- but we should add explicit unit test for closest_point(Point, Triangle), especially if you're seeing inconsistencies.

Do you have any specific example/regression cases that you'd like us to add?

See:

  • https://github.com/LLNL/axom/blob/f0a346dfa380bdd6412f1e4cbecd1a4d6e0d6f03/src/axom/primal/operators/squared_distance.hpp#L182-L188
  • https://github.com/LLNL/axom/blob/f0a346dfa380bdd6412f1e4cbecd1a4d6e0d6f03/src/axom/primal/tests/primal_squared_distance.cpp#L75-L135

kennyweiss avatar Apr 03 '24 15:04 kennyweiss

I don't have any specific examples yet, but I will be attempting to discover the cases where I am seeing inconsistencies over the next couple weeks.

adayton1 avatar Apr 08 '24 15:04 adayton1

Looks like a lot of the differences disappear with a really small tolerance (EPS = 1e-50).

adayton1 avatar Apr 23 '24 02:04 adayton1