The closest point operator finds the point on a triangle that is closest to a query point. Query point o (shown in dark blue), at the origin, is closest to point o′ (light blue), which lies in the triangle's interior. Query point a (olive) is closest to point a′ (yellow), which lies on the triangle's edge at a vertex.
../../examples/primal_introduction.cpp
../../examples/primal_introduction.cpp
As the code example shows, closest_point()
can take a pointer to an int
as an optional third parameter. If supplied, the function writes a value into the int
that indicates which of the triangle's vertices or sides contains the closest point (or the interior).