s2-tools
Version:
A collection of geospatial tools primarily designed for WGS84, Web Mercator, and S2.
55 lines • 2.01 kB
TypeScript
import type { Point, VectorPoint } from '../geometry';
/**
* # Delaunator
*
* ## Description
* An incredibly fast and robust Typescript library for Delaunay triangulation of 2D points.
*
* ## Usage
* ```ts
* import { Delaunator } from 's2-tools'
* import type { Point, VectorPoint } from 's2-tools'
*
* // its recommended to stereotypically use `fromPoints` to construct a Delaunator
* const points: Point[] = [...]
* const delaunator = Delaunator.fromPoints(points)
*
* // or you can construct from vector points with `fromVectorPoints`
* const points: VectorPoint[] = [...]
* const delaunator = Delaunator.fromVectorPoints(points)
*
* // you can now use the triangulation
* const { triangles } = delaunator
* ```
*/
export declare class Delaunator {
#private;
edgeStack: any[];
coords: number[];
triangles: number[];
halfedges: number[];
hull: number[];
trianglesLen: number;
/**
* Constructs a delaunay triangulation object given an array of point coordinates of the form:
* [x0, y0, x1, y1, ...] (use a typed array for best performance).
* @param coords - flattened array of x,y points. e.g. [x1, y1, x2, y2, ...]
*/
constructor(coords: number[]);
/**
* @param points - flattened array of x,y points. e.g. [[x1, y1], [x2, y2], ...]
* @returns - a Delaunator class to do Delaunay triangulation
*/
static fromPoints(points: Point[]): Delaunator;
/**
* @param points - flattened array of x,y vector points. e.g. [{ x1, y1 }, { x2, y2 }, ...]
* @returns - a Delaunator class to do Delaunay triangulation
*/
static fromVectorPoints(points: VectorPoint[]): Delaunator;
/**
* Updates the triangulation if you modified delaunay.coords values in place, avoiding expensive
* memory allocations. Useful for iterative relaxation algorithms such as [Lloyd's](https://en.wikipedia.org/wiki/Lloyd%27s_algorithm).
*/
update(): void;
}
//# sourceMappingURL=delaunator.d.ts.map