findNearest method
Finds the subdivision vertex closest to the given point.
The function is another function that locates the input point within the subdivision. It finds the subdivision vertex that is the closest to the input point. It is not necessarily one of vertices of the facet containing the input point, though the facet (located using locate() ) is used as a starting point.
https://docs.opencv.org/4.x/df/dbf/classcv_1_1Subdiv2D.html#a3ec256af000e129e08eb5f269ccdeb0f
Implementation
(int rval, Point2f nearestPt) findNearest(Point2f pt) {
return using<(int, Point2f)>((arena) {
final pp = calloc<cvg.Point2f>();
final p = arena<ffi.Int>();
cvRun(() => cffi.Subdiv2D_FindNearest(ref, pt.ref, pp, p));
return (p.value, Point2f.fromPointer(pp));
});
}