Class Subdiv2D
Planar Subdivision, can be use to compute Delaunnay's triangulation or Voroni diagram.
public class Subdiv2D : UnmanagedObject, IDisposable
- Inheritance
-
Subdiv2D
- Implements
- Inherited Members
Constructors
Subdiv2D(PointF[], bool)
Create a planar subdivision from the given points. The ROI is computed as the minimum bounding Rectangle for the input points
public Subdiv2D(PointF[] points, bool silent = false)
Parameters
points
PointF[]The points to be inserted to this planar subdivision
silent
boolIf true, any exception during insert will be ignored
Subdiv2D(Rectangle)
Start the Delaunay's triangulation in the specific region of interest.
public Subdiv2D(Rectangle roi)
Parameters
roi
RectangleThe region of interest of the triangulation
Methods
DisposeObject()
Release unmanaged resources
protected override void DisposeObject()
FindNearest(PointF, out PointF)
Finds 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 cvSubdiv2DLocate) is used as a starting point.
public Subdiv2DPointLocationType FindNearest(PointF point, out PointF nearestPoint)
Parameters
Returns
- Subdiv2DPointLocationType
The location type of the point
GetDelaunayTriangles(bool)
Returns the triangles subdivision of the current planar subdivision.
public Triangle2DF[] GetDelaunayTriangles(bool includeVirtualPoints = false)
Parameters
includeVirtualPoints
boolIf true, will include the virtual points in the resulting triangles
Returns
- Triangle2DF[]
The triangles subdivision in the current planar subdivision
Remarks
The triangles might contains virtual points that do not belongs to the inserted points, if you do not want those points, set includeVirtualPoints
GetVoronoiFacets(int[])
Obtains the list of Voronoi Facets
public VoronoiFacet[] GetVoronoiFacets(int[] idx = null)
Parameters
idx
int[]Vector of vertices IDs to consider. For all vertices you can pass empty vector.
Returns
- VoronoiFacet[]
The list of Voronoi Facets
Insert(PointF)
Insert a point to the triangulation.
public void Insert(PointF point)
Parameters
point
PointFThe point to be inserted
Insert(PointF[], bool)
Insert a collection of points to this planar subdivision
public void Insert(PointF[] points, bool silent)
Parameters
points
PointF[]The points to be inserted to this planar subdivision
silent
boolIf true, any exception during insert will be ignored
Locate(PointF, out int, out int)
Locates input point within subdivision
public Subdiv2DPointLocationType Locate(PointF pt, out int subdiv2DEdge, out int subdiv2DPoint)
Parameters
pt
PointFThe point to locate
subdiv2DEdge
intThe output edge the point falls onto or right to
subdiv2DPoint
intOptional output vertex double pointer the input point coincides with
Returns
- Subdiv2DPointLocationType
The type of location for the point