Package org.tinfour.voronoi
Class BoundedVoronoiDiagram
- java.lang.Object
-
- org.tinfour.voronoi.BoundedVoronoiDiagram
-
public class BoundedVoronoiDiagram extends Object
Constructs a Voronoi Diagram structure from a set of sample points. The resulting structure is "bounded" in the sense that it covers only a finite domain on the coordinate plane (unlike a true Voronoi Diagram, which covers an infinite domain).This class is under development and is subject to minor changes in its API and behavior.
-
-
Constructor Summary
Constructors Constructor Description BoundedVoronoiDiagram(List<Vertex> vertexList, BoundedVoronoiBuildOptions options)Construct a Voronoi Diagram structure based on the input vertex set.BoundedVoronoiDiagram(IIncrementalTin delaunayTriangulation)Constructs an instance of a Voronoi Diagram that corresponds to the input Delaunay Triangulation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Rectangle2DgetBounds()Gets the bounds of the bounded Voronoi Diagram.ThiessenPolygongetContainingPolygon(double x, double y)Gets the polygon that contains the specified coordinate point (x,y).List<IQuadEdge>getEdges()Gets a list of the edges in the Voronoi Diagram.intgetMaximumEdgeAllocationIndex()Gets the maximum index of the currently allocated edges.List<ThiessenPolygon>getPolygons()Gets a list of the polygons that comprise the Voronoi DiagramRectangle2DgetSampleBounds()Gets the bounds of the sample data set.List<Vertex>getVertices()Gets a list of the vertices that define the Voronoi Diagram.List<Vertex>getVoronoiVertices()Gets the vertices that were created to produce the Voronoi Diagram.voidprintDiagnostics(PrintStream ps)Prints diagnostic statistics for the Voronoi Diagram object.
-
-
-
Constructor Detail
-
BoundedVoronoiDiagram
public BoundedVoronoiDiagram(List<Vertex> vertexList, BoundedVoronoiBuildOptions options)
Construct a Voronoi Diagram structure based on the input vertex set.- Parameters:
vertexList- a valid list of verticesoptions- optional specification for setting build parameters or a null to use defaults.
-
BoundedVoronoiDiagram
public BoundedVoronoiDiagram(IIncrementalTin delaunayTriangulation)
Constructs an instance of a Voronoi Diagram that corresponds to the input Delaunay Triangulation.- Parameters:
delaunayTriangulation- a valid instance of a Delaunay Triangulation implementation.
-
-
Method Detail
-
printDiagnostics
public void printDiagnostics(PrintStream ps)
Prints diagnostic statistics for the Voronoi Diagram object.- Parameters:
ps- a valid print stream instance.
-
getBounds
public Rectangle2D getBounds()
Gets the bounds of the bounded Voronoi Diagram. If the associated Delaunay Triangulation included "skinny" triangles along its perimeter, the Voronoi Diagram's bounds may be substantially larger than those of the original input data set- Returns:
- a valid rectangle
-
getSampleBounds
public Rectangle2D getSampleBounds()
Gets the bounds of the sample data set. These will usually be smaller than the bounds of the overall structure.- Returns:
- a valid rectangle
-
getEdges
public List<IQuadEdge> getEdges()
Gets a list of the edges in the Voronoi Diagram. Applications are strongly cautioned against modifying these edges.- Returns:
- a valid list of edges
-
getVertices
public List<Vertex> getVertices()
Gets a list of the vertices that define the Voronoi Diagram. This list is based on the input set, though in some cases coincident or nearly coincident vertices will be combined into a single vertex of type VertexMergerGroup.- Returns:
- a valid list
-
getVoronoiVertices
public List<Vertex> getVoronoiVertices()
Gets the vertices that were created to produce the Voronoi Diagram. The output includes all circumcircle vertices that were computed when the structure was created. It does not include the original vertices from the input source- Returns:
- a valid list of vertices
-
getPolygons
public List<ThiessenPolygon> getPolygons()
Gets a list of the polygons that comprise the Voronoi Diagram- Returns:
- a valid list of polygons
-
getContainingPolygon
public ThiessenPolygon getContainingPolygon(double x, double y)
Gets the polygon that contains the specified coordinate point (x,y).Note: Although a true Voronoi Diagram covers the entire plane, the Bounded Voronoi class is has a finite domain. If the specified coordinates are outside the bounds of this instance, no polygon will be found and a null result will be returned.
- Parameters:
x- a valid floating point valuey- a valid floating point value- Returns:
- the containing polygon or a null if none is found.
-
getMaximumEdgeAllocationIndex
public int getMaximumEdgeAllocationIndex()
Gets the maximum index of the currently allocated edges. This method can be used in support of applications that require the need to survey the edge set and maintain a parallel array or collection instance that tracks information about the edges. In such cases, the maximum edge index provides a way of knowing how large to size the array or collection.Internally, Tinfour uses edge index values to manage edges in memory. The while there can be small gaps in the indexing sequence, this method provides a way of obtaining the absolute maximum value of currently allocated edges.
- Returns:
- a positive value or zero if the TIN is not bootstrapped.
-
-