Delaunay class
A class for quickly calculating the Delaunay triangulation in 2D of a set of points in the cartesian plane.
Example usage:
Float32List points = Float32List.fromList(<double>[
143.0, 178.5,
50.2, -100.7,
...
]);
Delaunay delaunay = Delaunay(points);
delaunay.update();
for (int i = 0; i < delaunay.triangles.length; i += 3) {
int a = delaunay.triangles[i];
int b = delaunay.triangles[i + 1];
int c = delaunay.triangles[i + 3];
double ax = delaunay.coords[2*a];
double ay = delaunay.coords[2*a + 1];
...
}
...
points[0] = 140.0;
delaunay.update();
...
This implementation is adapted from the Delaunator JavaScript library. See https://github.com/mapbox/delaunator
Constructors
- Delaunay(Float32List coords)
-
Allocates memory for a Delaunay triangulation, keeping a reference to
coords
. -
Delaunay.from(List<
Point< points)double> > -
Allocates memory for a Delaunay triangulation.
factory
Properties
- colinear → bool
-
Whether after a call to initialize, it has been detected that this is
the degenerate case of all points being colinear.
no setter
- coords → Float32List
-
The coordinates being triangulated.
no setter
- halfEdges → Int32List
-
The list of edges in the triangulation.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hull → Uint32List
-
The indices in coords of the points on the convex hull of the input
data, counter-clockwise.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- triangles → Uint32List
-
The list of triangles in the triagulation.
no setter
Methods
-
getPoint(
int i) → Point< double> -
coords[i]
in the form of aPoint<double>
. -
initialize(
) → void - Initializes the Delaunay triangulation by finding the seed triangle and sorting the points in increasing distance from the seed triangle's circumcenter.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
processAllPoints(
) → void - Iterates over all the points in order of increasing distance from the seed triangle's circumcenter, adding them to the triangulation.
-
swap(
Uint32List arr, int i, int j) → void -
toString(
) → String -
A string representation of this object.
inherited
-
update(
) → void - Calculates or recalculates the Delaunay triangulation.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited