View Source Evision.Subdiv2D (Evision v0.1.9)

Link to this section Summary

cv

Returns the edge destination.

Returns the edge origin.

Finds the subdivision vertex closest to the given point.

Returns one of the edges related to the given edge.

Returns a list of all edges.

Returns a list of the leading edge ID connected to each triangle.

Returns a list of all triangles.

Returns vertex location from vertex ID.

Returns a list of all Voronoi facets.

Creates a new empty Delaunay subdivision

Insert multiple points into a Delaunay triangulation.

Returns the location of a point within a Delaunay triangulation.

Returns next edge around the edge origin.

Returns another edge of the same quad-edge.

creates an empty Subdiv2D object. To create a new empty Delaunay subdivision you need to use the #initDelaunay function.

Positional Arguments
  • rect: Rect.

Positional Arguments
  • edge: int

Python prototype (for reference):

Link to this section cv

Returns the edge destination.

Positional Arguments
  • edge: int.

    Subdivision edge ID.

Return
  • dstpt: Point2f*.

    Output vertex location.

@returns vertex ID.

Python prototype (for reference):

edgeDst(edge) -> retval, dstpt

Returns the edge origin.

Positional Arguments
  • edge: int.

    Subdivision edge ID.

Return
  • orgpt: Point2f*.

    Output vertex location.

@returns vertex ID.

Python prototype (for reference):

edgeOrg(edge) -> retval, orgpt

Finds the subdivision vertex closest to the given point.

Positional Arguments
  • pt: Point2f.

    Input point.

Return
  • nearestPt: Point2f*.

    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.

Python prototype (for reference):

findNearest(pt) -> retval, nearestPt
Link to this function

getEdge(self, edge, nextEdgeType)

View Source

Returns one of the edges related to the given edge.

Positional Arguments
  • edge: int.

    Subdivision edge ID.

  • nextEdgeType: int.

    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 @returns edge ID related to the input edge.

Python prototype (for reference):

getEdge(edge, nextEdgeType) -> retval

Returns a list of all edges.

Return
  • edgeList: [Vec4f].

    Output vector.

The function gives each edge as a 4 numbers vector, where each two are one of the edge vertices. i.e. org_x = v[0], org_y = v[1], dst_x = v[2], dst_y = v[3].

Python prototype (for reference):

getEdgeList() -> edgeList
Link to this function

getLeadingEdgeList(self)

View Source

Returns a list of the leading edge ID connected to each triangle.

Return
  • leadingEdgeList: [int].

    Output vector.

The function gives one edge ID for each triangle.

Python prototype (for reference):

getLeadingEdgeList() -> leadingEdgeList

Returns a list of all triangles.

Return
  • triangleList: [Vec6f].

    Output vector.

The function gives each triangle as a 6 numbers vector, where each two are one of the triangle vertices. i.e. p1_x = v[0], p1_y = v[1], p2_x = v[2], p2_y = v[3], p3_x = v[4], p3_y = v[5].

Python prototype (for reference):

getTriangleList() -> triangleList

Returns vertex location from vertex ID.

Positional Arguments
  • vertex: int.

    vertex ID.

Return
  • firstEdge: int*.

    Optional. The first edge ID which is connected to the vertex.

@returns vertex (x,y)

Python prototype (for reference):

getVertex(vertex) -> retval, firstEdge
Link to this function

getVoronoiFacetList(self, idx)

View Source

Returns a list of all Voronoi facets.

Positional Arguments
  • idx: [int].

    Vector of vertices IDs to consider. For all vertices you can pass empty vector.

Return
  • facetList: [vector_Point2f].

    Output vector of the Voronoi facets.

  • facetCenters: [Point2f].

    Output vector of the Voronoi facets center points.

Python prototype (for reference):

getVoronoiFacetList(idx) -> facetList, facetCenters
Link to this function

initDelaunay(self, rect)

View Source

Creates a new empty Delaunay subdivision

Positional Arguments
  • rect: Rect.

    Rectangle that includes all of the 2D points that are to be added to the subdivision.

Python prototype (for reference):

initDelaunay(rect) -> None

Insert multiple points into a Delaunay triangulation.

Positional Arguments
  • ptvec: [Point2f].

    Points to insert.

The function inserts a vector of points into a subdivision and modifies the subdivision topology appropriately.

Python prototype (for reference):

insert(ptvec) -> None

Returns the location of a point within a Delaunay triangulation.

Positional Arguments
  • pt: Point2f.

    Point to locate.

Return
  • edge: int.

    Output edge that the point belongs to or is located to the right of it.

  • vertex: int.

    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.

Python prototype (for reference):

locate(pt) -> retval, edge, vertex

Returns next edge around the edge origin.

Positional Arguments
  • edge: int.

    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).

Python prototype (for reference):

nextEdge(edge) -> retval
Link to this function

rotateEdge(self, edge, rotate)

View Source

Returns another edge of the same quad-edge.

Positional Arguments
  • edge: int.

    Subdivision edge ID.

  • rotate: int.

    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.

Python prototype (for reference):

rotateEdge(edge, rotate) -> retval

creates an empty Subdiv2D object. To create a new empty Delaunay subdivision you need to use the #initDelaunay function.

Python prototype (for reference):

Subdiv2D() -> <Subdiv2D object>
Positional Arguments
  • rect: Rect.

    Rectangle that includes all of the 2D points that are to be added to the subdivision.

Has overloading in C++

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.

Python prototype (for reference):

Subdiv2D(rect) -> <Subdiv2D object>
Positional Arguments
  • edge: int

Python prototype (for reference):

symEdge(edge) -> retval

Link to this section Functions

Raising version of edgeDst/2.

Raising version of edgeOrg/2.

Raising version of findNearest/2.

Link to this function

getEdge!(self, edge, nextEdgeType)

View Source

Raising version of getEdge/3.

Raising version of getEdgeList/1.

Link to this function

getLeadingEdgeList!(self)

View Source

Raising version of getLeadingEdgeList/1.

Raising version of getTriangleList/1.

Link to this function

getVertex!(self, vertex)

View Source

Raising version of getVertex/2.

Link to this function

getVoronoiFacetList!(self, idx)

View Source

Raising version of getVoronoiFacetList/2.

Link to this function

initDelaunay!(self, rect)

View Source

Raising version of initDelaunay/2.

Raising version of insert/2.

Raising version of locate/2.

Raising version of nextEdge/2.

Link to this function

rotateEdge!(self, edge, rotate)

View Source

Raising version of rotateEdge/3.

Raising version of subdiv2D/0.

Raising version of subdiv2D/1.

Raising version of symEdge/2.