@Reference(authors="David Sinclair", title="S-hull: a fast sweep-hull routine for Delaunay triangulation", booktitle="Online: http://s-hull.org/") public class SweepHullDelaunay2D extends Object
Modifier and Type | Class and Description |
---|---|
(package 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 LinkedList<IntIntPair> |
hull
Internal representation of the hull
|
private static Logging |
LOG
Class logger
|
private List<Vector> |
points
The current set of points.
|
private ArrayList<SweepHullDelaunay2D.Triangle> |
tris
Triangles
|
Constructor and Description |
---|
SweepHullDelaunay2D()
Constructor.
|
SweepHullDelaunay2D(List<Vector> points)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
add(Vector point)
Add a single point to the list (this does not compute or update the
triangulation!)
|
(package private) void |
debugHull()
Debug helper
|
(package private) int |
flipTriangle(int i,
BitSet flipped)
Flip a single triangle, if necessary.
|
(package private) int |
flipTriangles(BitSet flippedA,
BitSet flippedB)
Flip triangles as necessary
|
ArrayList<SweepHullDelaunay2D.Triangle> |
getDelaunay()
Get the Delaunay triangulation.
|
Polygon |
getHull()
Get the convex hull only.
|
(package private) boolean |
leftOf(Vector a,
Vector b,
Vector d)
Test if the vector AD is right of AB.
|
static void |
main(String[] args) |
static double |
quadraticEuclidean(Vector v1,
Vector v2)
Squared euclidean distance. 2d.
|
(package private) void |
run(boolean hullonly)
Run the actual algorithm
|
private static final Logging LOG
private List<Vector> points
private ArrayList<SweepHullDelaunay2D.Triangle> tris
private LinkedList<IntIntPair> hull
public void add(Vector point)
point
- Point to addvoid run(boolean hullonly)
hullonly
- void debugHull()
int flipTriangles(BitSet flippedA, BitSet flippedB)
flippedA
- Bit set for triangles to testflippedB
- Bit set to mark triangles as doneint flipTriangle(int i, BitSet flipped)
i
- Triangle numberflipped
- Bitset to modifypublic Polygon getHull()
public ArrayList<SweepHullDelaunay2D.Triangle> getDelaunay()
public static double quadraticEuclidean(Vector v1, Vector v2)
v1
- First vectorv2
- Second vectorboolean leftOf(Vector a, Vector b, Vector d)
a
- Starting pointb
- Reference pointd
- Test pointpublic static void main(String[] args)