3.0.2 • Published 6 months ago

@types/d3-polygon v3.0.2

Weekly downloads
299,487
License
MIT
Repository
github
Last release
6 months ago

Installation

npm install --save @types/d3-polygon

Summary

This package contains type definitions for D3JS d3-polygon module (https://github.com/d3/d3-polygon/).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/d3-polygon/v2.

index.d.ts

// Type definitions for D3JS d3-polygon module 2.0
// Project: https://github.com/d3/d3-polygon/, https://d3js.org/d3-polygon
// Definitions by: Tom Wanzek <https://github.com/tomwanzek>
//                 Alex Ford <https://github.com/gustavderdrache>
//                 Boris Yankov <https://github.com/borisyankov>
//                 Nathan Bierema <https://github.com/Methuselah96>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

// Last module patch version validated against: 2.0.0

/**
 * Returns the signed area of the specified polygon. If the vertices of the polygon are in counterclockwise order
 * (assuming a coordinate system where the origin <0,0> is in the top-left corner), the returned area is positive;
 * otherwise it is negative, or zero.
 *
 * @param polygon Array of coordinates <x0, y0>, <x1, y1> and so on.
 */
export function polygonArea(polygon: Array<[number, number]>): number;

/**
 * Returns the centroid of the specified polygon.
 *
 * @param polygon Array of coordinates <x0, y0>, <x1, y1> and so on.
 */
export function polygonCentroid(polygon: Array<[number, number]>): [number, number];

/**
 * Returns the convex hull of the specified points using Andrew’s monotone chain algorithm.
 * The returned hull is represented as an array containing a subset of the input points arranged in
 * counterclockwise order. Returns null if points has fewer than three elements.
 *
 * @param points Array of coordinates <x0, y0>, <x1, y1> and so on.
 */
export function polygonHull(points: Array<[number, number]>): Array<[number, number]> | null;

/**
 * Returns true if and only if the specified point is inside the specified polygon.
 *
 * @param polygon Array of coordinates <x0, y0>, <x1, y1> and so on.
 * @param point Coordinates of point <x, y>.
 */
export function polygonContains(polygon: Array<[number, number]>, point: [number, number]): boolean;

/**
 * Returns the length of the perimeter of the specified polygon.
 *
 * @param polygon Array of coordinates <x0, y0>, <x1, y1> and so on.
 */
export function polygonLength(polygon: Array<[number, number]>): number;

Additional Details

  • Last updated: Fri, 25 Jun 2021 14:01:31 GMT
  • Dependencies: none
  • Global values: none

Credits

These definitions were written by Tom Wanzek, Alex Ford, Boris Yankov, and Nathan Bierema.

3.0.2

6 months ago

3.0.1

7 months ago

1.0.9

7 months ago

2.0.3

6 months ago

2.0.2

7 months ago

1.0.10

6 months ago

3.0.0

3 years ago

2.0.1

3 years ago

1.0.8

4 years ago

2.0.0

4 years ago

1.0.7

5 years ago

1.0.6

6 years ago

1.0.5

7 years ago

1.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago