locate method

(int, int, int) locate(
  1. Point2f pt
)

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
(int rval, int edge, int vertex) locate(Point2f pt) {
  return using<(int, int, int)>((arena) {
    final edge = arena<ffi.Int>();
    final vertex = arena<ffi.Int>();
    final rval = arena<ffi.Int>();
    cvRun(() => cimgproc.Subdiv2D_Locate(ref, pt.ref, edge, vertex, rval));
    return (rval.value, edge.value, vertex.value);
  });
}