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 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[][] samples
    The samples.
  • Constructor Summary

    Constructors
    Constructor Description
    DelaunayClarkson()
    Create a new instance of this algorithm.
  • Method Summary

    Modifier and Type Method Description
    void compute​(double[][] samples, float scale)
    Compute the convex hull of the set of points given in parameter as samples.
    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.
    void improve​(int pass)
    Improve uses edge-flipping to bring the current triangulation closer to the true Delaunay triangulation.
    void setSamples​(double[][] samples)
    Set the the samples to process with Delaunay computation.
    String toString()  
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • samples

      protected double[][] samples
      The 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 double d[n][m] where n is the number of samples (io the number of points) and m is 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 double d[n][m] where n is the number of samples (io the number of points) and m is 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 underlying samples lies within a 2D space or a tetrahedron if the underlying samples lies within a 3D space.

      Simplexes are described by a list of samples that compose its vertices. The vertex n of the simplex k can be accessed by getSamples(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 the samples it 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

      public void compute​(double[][] samples, float scale) throws DelaunayException
      Compute the convex hull of the set of points given in parameter as samples. As the algorithm relies on the use of integer coordinates, the scale parameter is multiplied to each coordinate in order to obtain an integer value by truncating the result. The scale parameter 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:
      true if all the test are passing and false otherwise.
    • improve

      public void improve​(int pass) throws DelaunayException
      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

      public String toString()
      Overrides:
      toString in class Object