@Reference(authors="D. Sinclair", title="S-hull: a fast sweep-hull routine for Delaunay triangulation", booktitle="Online", url="http://s-hull.org/", bibkey="web/Sinclair16") public class SweepHullDelaunay2D extends java.lang.Object
Note: This implementation does not check or handle duplicate points!
TODO: Handle duplicates.
TODO: optimize data structures for memory usage
Modifier and Type | Class and Description |
---|---|
private static class |
SweepHullDelaunay2D.Orientation
The possible orientations two triangles can have to each other.
|
static class |
SweepHullDelaunay2D.Triangle
Class representing a triangle, by referencing points in a list.
|
Modifier and Type | Field and Description |
---|---|
private java.util.LinkedList<IntIntPair> |
hull
Internal representation of the hull
|
private static Logging |
LOG
Class logger
|
private java.util.List<double[]> |
points
The current set of points.
|
private java.util.ArrayList<SweepHullDelaunay2D.Triangle> |
tris
Triangles
|
Constructor and Description |
---|
SweepHullDelaunay2D()
Constructor.
|
SweepHullDelaunay2D(java.util.List<double[]> points)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
add(double... point)
Add a single point to the list (this does not compute or update the
triangulation!)
|
(package private) void |
debugHull()
Debug helper
|
SweepHullDelaunay2D.Triangle |
findSmallest(int seedid,
int seed2id,
double[] sortd,
int[] sorti,
int len) |
(package private) int |
flipTriangle(int i,
long[] flipped)
Flip a single triangle, if necessary.
|
(package private) int |
flipTriangles(long[] flippedB)
Flip triangles as necessary
|
(package private) int |
flipTriangles(long[] flippedA,
long[] flippedB)
Flip triangles as necessary
|
java.util.ArrayList<SweepHullDelaunay2D.Triangle> |
getDelaunay()
Get the Delaunay triangulation.
|
Polygon |
getHull()
Get the convex hull only.
|
(package private) boolean |
leftOf(double[] a,
double[] b,
double[] d)
Test if the double[] AD is right of AB.
|
static double |
quadraticEuclidean(double[] v1,
double[] v2)
Squared euclidean distance. 2d.
|
(package private) void |
run(boolean hullonly)
Run the actual algorithm
|
private static final Logging LOG
private java.util.List<double[]> points
Note: this list should not be changed after running the algorithm, since we use it for object indexing, and the ids should not change
private java.util.ArrayList<SweepHullDelaunay2D.Triangle> tris
private java.util.LinkedList<IntIntPair> hull
public SweepHullDelaunay2D()
public SweepHullDelaunay2D(java.util.List<double[]> points)
points
- Existing pointspublic void add(double... point)
point
- Point to addvoid run(boolean hullonly)
hullonly
- public SweepHullDelaunay2D.Triangle findSmallest(int seedid, int seed2id, double[] sortd, int[] sorti, int len)
seedid
- First seed pointseed2id
- Second seed pointsorti
- Pointslen
- Number of pointsvoid debugHull()
int flipTriangles(long[] flippedB)
flippedB
- Bit set to mark triangles as doneint flipTriangles(long[] flippedA, long[] flippedB)
flippedA
- Bit set for triangles to testflippedB
- Bit set to mark triangles as doneint flipTriangle(int i, long[] flipped)
i
- Triangle numberflipped
- Bitset to modifypublic Polygon getHull()
Note: if you also want the Delaunay Triangulation, you should get that first!
public java.util.ArrayList<SweepHullDelaunay2D.Triangle> getDelaunay()
public static double quadraticEuclidean(double[] v1, double[] v2)
v1
- First double[]v2
- Second double[]boolean leftOf(double[] a, double[] b, double[] d)
a
- Starting pointb
- Reference pointd
- Test pointCopyright © 2019 ELKI Development Team. License information.