# @types/d3-polygon

> TypeScript definitions for d3-polygon

Latest version **3.0.2** (published 2023-11-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/d3-polygon
pnpm add @types/d3-polygon
yarn add @types/d3-polygon
bun add @types/d3-polygon
```

## Health

**Score 45/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 3.0.2 |
| Published | 2023-11-07 |
| First published | 2016-08-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51438 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/d3-polygon
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/d3-polygon
- npm.io page: https://npm.io/package/@types/d3-polygon

## Recent versions

- 3.0.2 (latest) — 2023-11-07
- 3.0.0 (ts3.6) — 2021-06-25
- 2.0.0 (ts3.2) — 2020-09-29
- 1.0.7 (ts2.0) — 2019-02-13
- 1.0.10 — 2023-11-07
- 2.0.3 — 2023-11-07
- 1.0.9 — 2023-10-18
- 2.0.2 — 2023-10-18
- 3.0.1 — 2023-10-18
- 2.0.1 — 2021-06-25
- 1.0.8 — 2020-09-29
- 1.0.6 — 2018-05-08
- 1.0.5 — 2017-05-19
- 1.0.4 — 2016-09-12
- 0.0.3 — 2016-08-25
- … 2 more at https://npm.io/package/@types/d3-polygon/versions

## README

# Installation
> `npm install --save @types/d3-polygon`

# Summary
This package contains type definitions for d3-polygon (https://github.com/d3/d3-polygon/).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/d3-polygon.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/d3-polygon/index.d.ts)
````ts
// Last module patch version validated against: 3.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 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: Tue, 07 Nov 2023 15:11:37 GMT
 * Dependencies: none

# Credits
These definitions were written by [Tom Wanzek](https://github.com/tomwanzek), [Alex Ford](https://github.com/gustavderdrache), [Boris Yankov](https://github.com/borisyankov), and [Nathan Bierema](https://github.com/Methuselah96).

---
_Source: https://npm.io/package/@types/d3-polygon · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
