Module Opencv.Subdiv2_d
val subdiv2_d1 : unit -> t
Usage:
subdiv2_d1 ()
creates an empty Subdiv2D object. To create a new empty Delaunay subdivision you need to use the #initDelaunay function.
val subdiv2_d2 : rect2i -> t
Usage:
subdiv2_d2 rect
- Parameter:
rect
: Rectangle that includes all of the 2D points that are to be added to the subdivision.
The function creates an empty Delaunay subdivision where 2D points can be added using the function insert() . All of the points to be added must be within the specified rectangle, otherwise a runtime error is raised.
- Parameter:
val init_delaunay : t -> rect2i -> unit
Usage:
init_delaunay __self rect
Creates a new empty Delaunay subdivision
- Parameter:
rect
: Rectangle that includes all of the 2D points that are to be added to the subdivision.
- Parameter:
val insert1 : t -> point2f -> int
Usage:
insert1 __self pt
Insert a single point into a Delaunay triangulation.
- Parameter:
pt
: Point to insert.
The function inserts a single point into a subdivision and modifies the subdivision topology appropriately. If a point with the same coordinates exists already, no new point is added.
- Returns: the ID of the point.
Note: If the point is outside of the triangulation specified rect a runtime error is raised.
- Parameter:
val insert2 : t -> point2f list -> unit
Usage:
insert2 __self ptvec
Insert multiple points into a Delaunay triangulation.
- Parameter:
ptvec
: Points to insert.
The function inserts a vector of points into a subdivision and modifies the subdivision topology appropriately.
- Parameter:
val locate : t -> point2f -> int -> int -> int
Usage:
locate __self pt edge vertex
Returns the location of a point within a Delaunay triangulation.
- Parameter:
pt
: Point to locate. - Parameter:
edge
: Output edge that the point belongs to or is located to the right of it. - Parameter:
vertex
: Optional output vertex the input point coincides with.
The function locates the input point within the subdivision and gives one of the triangle edges or vertices.
- Returns: 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.
- Parameter:
val find_nearest : ?nearest_pt:point2f -> t -> point2f -> int
Usage:
find_nearest ?nearest_pt __self pt
Finds the subdivision vertex closest to the given point.
- Parameter:
pt
: Input point. - Parameter:
nearest_pt
: Output subdivision vertex 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.
- Returns: vertex ID.
- Parameter:
val get_leading_edge_list : t -> int list -> unit
Usage:
get_leading_edge_list __self leading_edge_list
Returns a list of the leading edge ID connected to each triangle.
- Parameter:
leading_edge_list
: Output vector.
The function gives one edge ID for each triangle.
- Parameter:
val get_voronoi_facet_list : t -> int list -> point2f list list -> point2f list -> unit
Usage:
get_voronoi_facet_list __self idx facet_list facet_centers
Returns a list of all Voronoi facets.
- Parameter:
idx
: Vector of vertices IDs to consider. For all vertices you can pass empty vector. - Parameter:
facet_list
: Output vector of the Voronoi facets. - Parameter:
facet_centers
: Output vector of the Voronoi facets center points.
- Parameter:
val get_vertex : ?first_edge:int -> t -> int -> point2f
Usage:
get_vertex ?first_edge __self vertex
Returns vertex location from vertex ID.
- Parameter:
vertex
: vertex ID. - Parameter:
first_edge
: Optional. The first edge ID which is connected to the vertex. - Returns: vertex (x,y)
- Parameter:
val get_edge : t -> int -> int -> int
Usage:
get_edge __self edge next_edge_type
Returns one of the edges related to the given edge.
- Parameter:
edge
: Subdivision edge ID. - Parameter:
next_edge_type
: Parameter specifying which of the related edges to return. The following values are possible: - NEXT_AROUND_ORG next around the edge origin ( eOnext on the picture below if e is the input edge)
- NEXT_AROUND_DST next around the edge vertex ( eDnext )
- PREV_AROUND_ORG previous around the edge origin (reversed eRnext )
- PREV_AROUND_DST previous around the edge destination (reversed eLnext )
- NEXT_AROUND_LEFT next around the left facet ( eLnext )
- NEXT_AROUND_RIGHT next around the right facet ( eRnext )
- PREV_AROUND_LEFT previous around the left facet (reversed eOnext )
- PREV_AROUND_RIGHT previous around the right facet (reversed eDnext )
!
sample output
(pics/quadedge.png)- Returns: edge ID related to the input edge.
- Parameter:
val next_edge : t -> int -> int
Usage:
next_edge __self edge
Returns next edge around the edge origin.
- Parameter:
edge
: Subdivision edge ID.
- Returns: an integer which is next edge ID around the edge origin: eOnext on the picture above if e is the input edge).
- Parameter:
val rotate_edge : t -> int -> int -> int
Usage:
rotate_edge __self edge rotate
Returns another edge of the same quad-edge.
- Parameter:
edge
: Subdivision edge ID. - Parameter:
rotate
: Parameter specifying which of the edges of the same quad-edge as the input one to return. The following values are possible: - 0 - the input edge ( e on the picture below if e is the input edge)
- 1 - the rotated edge ( eRot )
- 2 - the reversed edge (reversed e (in green))
- 3 - the reversed rotated edge (reversed eRot (in green))
- Returns: one of the edges ID of the same quad-edge as the input edge.
- Parameter:
val sym_edge : t -> int -> int
Usage:
sym_edge __self edge