locateAsync method
Returns the location of a point within a Delaunay triangulation.
rval
an integer which specify one of the following five cases for point location:
- The point falls into some facet. The function returns PTLOC_INSIDE and edge will contain one of edges of the facet.
- The point falls onto the edge. The function returns PTLOC_ON_EDGE and edge will contain this edge.
- The point coincides with one of the subdivision vertices. The function returns PTLOC_VERTEX and vertex will contain a pointer to the vertex.
- The point is outside the subdivision reference rectangle. The function returns PTLOC_OUTSIDE_RECT and no pointers are filled.
- One of input arguments is invalid. A runtime error is raised or, if silent or "parent" error processing mode is selected, PTLOC_ERROR is returned.
https://docs.opencv.org/4.x/df/dbf/classcv_1_1Subdiv2D.html#aec8f1fd5a802f62faa97520b465897d7
Implementation
// ignore: comment_references
/// [rval] an integer which specify one of the following five cases for point location:
///
/// - The point falls into some facet. The function returns [PTLOC_INSIDE] and edge will contain one of edges of the facet.
/// - The point falls onto the edge. The function returns [PTLOC_ON_EDGE] and edge will contain this edge.
/// - The point coincides with one of the subdivision vertices. The function returns [PTLOC_VERTEX] and vertex will contain a pointer to the vertex.
/// - The point is outside the subdivision reference rectangle. The function returns [PTLOC_OUTSIDE_RECT] and no pointers are filled.
/// - One of input arguments is invalid. A runtime error is raised or, if silent or "parent" error processing mode is selected, [PTLOC_ERROR] is returned.
///
/// https://docs.opencv.org/4.x/df/dbf/classcv_1_1Subdiv2D.html#aec8f1fd5a802f62faa97520b465897d7
Future<(int rval, int edge, int vertex)> locateAsync(Point2f pt) async =>
cvRunAsync3((callback) => cffi.Subdiv2D_Locate_Async(ref, pt.ref, callback),
(completer, p, p1, p2) {
final rval = p.cast<ffi.Int>().value;
calloc.free(p);
final edge = p1.cast<ffi.Int>().value;
calloc.free(p1);
final vertex = p2.cast<ffi.Int>().value;
calloc.free(p2);
completer.complete((rval, edge, vertex));
});