[][src]Struct opencv::imgproc::Subdiv2D

pub struct Subdiv2D { /* fields omitted */ }

Methods

impl Subdiv2D[src]

pub fn as_raw_Subdiv2D(&self) -> *mut c_void[src]

pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self[src]

impl Subdiv2D[src]

pub fn default() -> Result<Subdiv2D>[src]

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

pub fn new(rect: Rect) -> Result<Subdiv2D>[src]

Parameters

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

pub fn init_delaunay(&mut self, rect: Rect) -> Result<()>[src]

Creates a new empty Delaunay subdivision

Parameters

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

pub fn insert(&mut self, pt: Point2f) -> Result<i32>[src]

Insert a single point into a Delaunay triangulation.

Parameters

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

pub fn insert_multiple(&mut self, ptvec: &VectorOfPoint2f) -> Result<()>[src]

Insert multiple points into a Delaunay triangulation.

Parameters

  • ptvec: Points to insert.

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

pub fn locate(
    &mut self,
    pt: Point2f,
    edge: &mut i32,
    vertex: &mut i32
) -> Result<i32>
[src]

Returns the location of a point within a Delaunay triangulation.

Parameters

  • pt: Point to locate.
  • edge: Output edge that the point belongs to or is located to the right of it.
  • 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.

pub fn find_nearest(
    &mut self,
    pt: Point2f,
    nearest_pt: &mut Point2f
) -> Result<i32>
[src]

Finds the subdivision vertex closest to the given point.

Parameters

  • pt: Input point.
  • nearestPt: 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.

C++ default parameters

  • nearest_pt: 0

pub fn get_edge_list(&self, edge_list: &mut VectorOfVec4f) -> Result<()>[src]

Returns a list of all edges.

Parameters

  • edgeList: 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].

pub fn get_leading_edge_list(
    &self,
    leading_edge_list: &mut VectorOfint
) -> Result<()>
[src]

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

Parameters

  • leadingEdgeList: Output vector.

The function gives one edge ID for each triangle.

pub fn get_triangle_list(&self, triangle_list: &mut VectorOfVec6f) -> Result<()>[src]

Returns a list of all triangles.

Parameters

  • triangleList: 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].

pub fn get_voronoi_facet_list(
    &mut self,
    idx: &VectorOfint,
    facet_list: &mut VectorOfVectorOfPoint2f,
    facet_centers: &mut VectorOfPoint2f
) -> Result<()>
[src]

Returns a list of all Voroni facets.

Parameters

  • idx: Vector of vertices IDs to consider. For all vertices you can pass empty vector.
  • facetList: Output vector of the Voroni facets.
  • facetCenters: Output vector of the Voroni facets center points.

pub fn get_vertex(&self, vertex: i32, first_edge: &mut i32) -> Result<Point2f>[src]

Returns vertex location from vertex ID.

Parameters

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

Returns

vertex (x,y)

C++ default parameters

  • first_edge: 0

pub fn get_edge(&self, edge: i32, next_edge_type: i32) -> Result<i32>[src]

Returns one of the edges related to the given edge.

Parameters

  • edge: Subdivision edge ID.
  • nextEdgeType: 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.

pub fn next_edge(&self, edge: i32) -> Result<i32>[src]

Returns next edge around the edge origin.

Parameters

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

pub fn rotate_edge(&self, edge: i32, rotate: i32) -> Result<i32>[src]

Returns another edge of the same quad-edge.

Parameters

  • edge: Subdivision edge ID.
  • 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.

pub fn sym_edge(&self, edge: i32) -> Result<i32>[src]

pub fn edge_org(&self, edge: i32, orgpt: &mut Point2f) -> Result<i32>[src]

Returns the edge origin.

Parameters

  • edge: Subdivision edge ID.
  • orgpt: Output vertex location.

Returns

vertex ID.

C++ default parameters

  • orgpt: 0

pub fn edge_dst(&self, edge: i32, dstpt: &mut Point2f) -> Result<i32>[src]

Returns the edge destination.

Parameters

  • edge: Subdivision edge ID.
  • dstpt: Output vertex location.

Returns

vertex ID.

C++ default parameters

  • dstpt: 0

Trait Implementations

impl Send for Subdiv2D[src]

impl Drop for Subdiv2D[src]

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]