# @types/d3-polygon

• Version 3.0.0
• Published
• 7.45 kB
• No dependencies

## Install

``npm i @types/d3-polygon``
``yarn add @types/d3-polygon``
``pnpm add @types/d3-polygon``

## Overview

TypeScript definitions for D3JS d3-polygon module

## Functions

### functionpolygonArea

``polygonArea: (polygon: Array<[number, number]>) => number;``
• 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.

#### Parameter polygon

Array of coordinates <x0, y0>, <x1, y1> and so on.

### functionpolygonCentroid

``polygonCentroid: (polygon: Array<[number, number]>) => [number, number];``
• Returns the centroid of the specified polygon.

#### Parameter polygon

Array of coordinates <x0, y0>, <x1, y1> and so on.

### functionpolygonContains

``polygonContains: (    polygon: Array<[number, number]>,    point: [number, number]) => boolean;``
• Returns true if and only if the specified point is inside the specified polygon.

#### Parameter polygon

Array of coordinates <x0, y0>, <x1, y1> and so on.

#### Parameter point

Coordinates of point <x, y>.

### functionpolygonHull

``polygonHull: (points: Array<[number, number]>) => Array<[number, number]> | null;``
• 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.

#### Parameter points

Array of coordinates <x0, y0>, <x1, y1> and so on.

### functionpolygonLength

``polygonLength: (polygon: Array<[number, number]>) => number;``
• Returns the length of the perimeter of the specified polygon.

#### Parameter polygon

Array of coordinates <x0, y0>, <x1, y1> and so on.

No dependencies.

## Dev Dependencies (0)

No dev dependencies.

## Peer Dependencies (0)

No peer dependencies.

To add a badge like this one to your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to `https://www.jsdocs.io/package/@types/d3-polygon`.
``[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/d3-polygon)``
``<a href="https://www.jsdocs.io/package/@types/d3-polygon"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>``