@types/delaunator
TypeScript icon, indicating that this package has built-in type declarations

5.0.2 • Public • Published

Installation

npm install --save @types/delaunator

Summary

This package contains type definitions for delaunator (https://github.com/mapbox/delaunator#readme).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/delaunator.

index.d.ts

declare class Delaunator<P> {
    /**
     * A Uint32Array array of triangle vertex indices (each group of three numbers forms a triangle).
     * All triangles are directed counterclockwise.
     */
    triangles: Uint32Array;

    /**
     * A Int32Array array of triangle half-edge indices that allows you to traverse the triangulation.
     * i-th half-edge in the array corresponds to vertex triangles[i] the half-edge is coming from.
     * halfedges[i] is the index of a twin half-edge in an adjacent triangle (or -1 for outer half-edges on the convex hull).
     *
     * The flat array-based data structures might be counterintuitive, but they're one of the key reasons this library is fast.
     */
    halfedges: Int32Array;

    /**
     * A Uint32Array array of indices that reference points on the convex hull of the input data, counter-clockwise.
     */
    hull: Uint32Array;

    /**
     * An array of input coordinates in the form [x0, y0, x1, y1, ....], of the type provided in the constructor (or Float64Array if you used Delaunator.from).
     */
    coords: ArrayLike<number> | Float64Array;

    /**
     * Constructs a delaunay triangulation object given a typed array of point coordinates of the form: [x0, y0, x1, y1, ...].
     * (use a typed array for best performance).
     */
    constructor(points: ArrayLike<number>);

    /**
     * Constructs a delaunay triangulation object given an array of points ([x, y] by default).
     */
    static from(points: ArrayLike<ArrayLike<number>>): Delaunator<ArrayLike<number>>;

    /**
     * Constructs a delaunay triangulation object given an array of custom points. Duplicate points are skipped.
     * getX and getY are optional functions for custom point formats. Duplicate points are skipped.
     */
    static from<P>(points: ArrayLike<P>, getX: (point: P) => number, getY: (point: P) => number): Delaunator<P>;

    /**
     * Updates the triangulation if you modified delaunay.coords values in place, avoiding expensive memory
     * allocations. Useful for iterative relaxation algorithms such as Lloyd's.
     */
    update(): void;
}

export = Delaunator;

Additional Details

  • Last updated: Mon, 06 Nov 2023 22:41:05 GMT
  • Dependencies: none

Credits

These definitions were written by Denis Carriere, Bradley Odell, and Tobias Kraus.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/delaunator

Weekly Downloads

9,125

Version

5.0.2

License

MIT

Unpacked Size

7.25 kB

Total Files

5

Last publish

Collaborators

  • types