Module org.jeometry.algorithm
Class DelaunayClarkson
java.lang.Object
org.jeometry.geom3D.algorithm.delaunay.clarkson.DelaunayClarkson
- Direct Known Subclasses:
DelaunayClarkson3D
public class DelaunayClarkson extends Object
This class is an implementation of the Ken Clarkson hull algorithm that enable to compute convex hull in n-dimension.
This algorithm compute a convex hull for a set of
This algorithm is based on an integer representation of input point coordinates, so if your points are closer than a coordinate unit, it is required to apply a scale on them. This scale can be given in parameter to computation method (
This algorithm compute a convex hull for a set of
n points in a O(n x log(n)) average time
with a worst case in O(n x n). This algorithm is based on an integer representation of input point coordinates, so if your points are closer than a coordinate unit, it is required to apply a scale on them. This scale can be given in parameter to computation method (
compute(double[][], float).- Since:
- 1.0.0
- Version:
- "1.0.5"
- Author:
- Julien Seinturier - COMEX S.A. - contact@jorigin.org - https://github.com/jorigin/jeometry
-
Field Summary
Fields Modifier and Type Field Description protected double[][]samplesThe samples. -
Constructor Summary
Constructors Constructor Description DelaunayClarkson()Create a new instance of this algorithm. -
Method Summary
Modifier and Type Method Description voidcompute(double[][] samples, float scale)Compute the convex hull of the set of points given in parameter assamples.int[][]getNeighbors()Get the neighborhood of the delaunay simplexes.double[][]getSamples()Get the samples to process with Delaunay computation.int[][]getSimplexes()Get the simplexes that compose the Delaunay computation result.int[][]getVertices()Get the vertices that compose the delaunay computation result.voidimprove(int pass)Improve uses edge-flipping to bring the current triangulation closer to the true Delaunay triangulation.voidsetSamples(double[][] samples)Set the the samples to process with Delaunay computation.StringtoString()booleanvalid()Checks a triangulation in various ways to make sure it is constructed correctly; test returns false if there are any problems with the triangulation.
-
Field Details
-
samples
protected double[][] samplesThe samples.
-
-
Constructor Details
-
DelaunayClarkson
public DelaunayClarkson()Create a new instance of this algorithm.
-
-
Method Details
-
getSamples
public double[][] getSamples()Get the samples to process with Delaunay computation. Samples can be 2D, 3D or higher dimension points.
The underlying data structure is an array of doubled[n][m]wherenis the number of samples (io the number of points) andmis the sample space dimension (ie 2 for 2D, 3 for 3D, ...).- Returns:
- the samples to process with Delaunay computation. Samples can be 2D, 3D or higher dimension points.
-
setSamples
public void setSamples(double[][] samples)Set the the samples to process with Delaunay computation. Samples can be 2D, 3D or higher dimension points.
The underlying data structure is an array of doubled[n][m]wherenis the number of samples (io the number of points) andmis the sample space dimension (ie 2 for 2D, 3 for 3D, ...).- Parameters:
samples- the samples to process with Delaunay computation. Samples can be 2D, 3D or higher dimension points.
-
getSimplexes
public int[][] getSimplexes()Get the simplexes that compose the Delaunay computation result. A simplex is a basic Delaunay element and can can be a triangle if the underlyingsampleslies within a 2D space or a tetrahedron if the underlying samples lies within a 3D space.
Simplexes are described by a list ofsamplesthat compose its vertices. The vertexnof the simplexkcan be accessed bygetSamples(getSimplexes(k)[n]).- Returns:
- the simplexes that compose the Delaunay computation result.
- See Also:
getSamples()
-
getVertices
public int[][] getVertices()Get the vertices that compose the delaunay computation result. Each vertex is described by a reference to thesamplesit represents and by a list of references to simplexes that relie on this vertex.- Returns:
- the vertices that compose the delaunay computation result.
- See Also:
getSamples(),getSimplexes()
-
getNeighbors
public int[][] getNeighbors()Get the neighborhood of the delaunay simplexes.- Returns:
- the neighborhood of the delaunay simplexes.
-
compute
Compute the convex hull of the set of points given in parameter assamples. As the algorithm relies on the use of integer coordinates, thescaleparameter is multiplied to each coordinate in order to obtain an integer value by truncating the result. Thescaleparameter can represent the precision of the points.- Parameters:
samples- the set of points used for convex hull computation.scale- the scale to apply to the point coordinates in order to obtain integer values after truncating them.- Throws:
DelaunayException- if an error occurs.
-
valid
public boolean valid()Checks a triangulation in various ways to make sure it is constructed correctly; test returns false if there are any problems with the triangulation. This method is expensive, provided mainly for debugging purposes.- Returns:
trueif all the test are passing andfalseotherwise.
-
improve
Improve uses edge-flipping to bring the current triangulation closer to the true Delaunay triangulation. pass is the number of passes the algorithm should take over all edges (however, the algorithm terminates if no edges are flipped for an entire pass).- Parameters:
pass- the number of passes the algorithm should take over all edges.- Throws:
DelaunayException- if an error occurs.
-
toString
-