gis-tools-ts - v0.6.0
    Preparing search index...

    Class Delaunator

    Delaunator

    An incredibly fast and robust Typescript library for Delaunay triangulation of 2D points.

    import { Delaunator } from 'gis-tools-ts';
    import type { Point, VectorPoint } from 'gis-tools-ts';

    // 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;
    Index

    Constructors

    • 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).

      Parameters

      • coords: number[]

        flattened array of x,y points. e.g. [x1, y1, x2, y2, ...]

      Returns Delaunator

    Methods

    • Updates the triangulation if you modified delaunay.coords values in place, avoiding expensive memory allocations. Useful for iterative relaxation algorithms such as Lloyd's.

      Returns void

    • Parameters

      • points: Point[]

        flattened array of x,y points. e.g. [[x1, y1], [x2, y2], ...]

      Returns Delaunator

      • a Delaunator class to do Delaunay triangulation
    • Parameters

      • points: VectorPoint<Properties>[]

        flattened array of x,y vector points. e.g. [{ x1, y1 }, { x2, y2 }, ...]

      Returns Delaunator

      • a Delaunator class to do Delaunay triangulation