Files
DefinitelyTyped/types/d3-polygon/index.d.ts
Tom Wanzek 8ae97451d5 D3 Modules Linting (#16536)
* [d3-collection] Linted
* Added and completed linting
* Replaced `Object` with `any` adding TODO to change to proper `object` type when publishing the definitions to use TS 2.2+

* [d3-color] Linted

* [d3-dispatch] Linted

* [d3-hsv]  Linted

* [d3-interpolate] Linted. `Object` to `any`
* Replace use of `Object` as extension basis with `any` for now. Added TODO to change it to use the `object` type, when updating the definitions to formally use TS2.2+

* [d3-path] Linted.

* [d3-polygon] Linted.

* [d3-quadtree] Linted.

* [d3-queue] Linted.

* [d3-request] Linted.

* [d3-scale-chromatic] Linted.

* [d3-time-format] Linted.

* [d3-time] Linted.

* [d3-timer] Linted.

* [d3-voronoi] Linted.

* [d3-scale] Move callable-type lint deactivation to tslint.json
* line level deactivation was ignored.
2017-05-19 07:13:46 -07:00

47 lines
1.9 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Type definitions for D3JS d3-polygon module 1.0
// Project: https://github.com/d3/d3-polygon/
// Definitions by: Tom Wanzek <https://github.com/tomwanzek>, Alex Ford <https://github.com/gustavderdrache>, Boris Yankov <https://github.com/borisyankov>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Last module patch version validated against: 1.0.1
/**
* 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 Andrews 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;