diff --git a/README.md b/README.md index 961eee49..d21a7294 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ If you use NPM, `npm install d3@4.0.0-alpha.4`. Otherwise, download the [latest * [Interpolators](#interpolators) * [Number Formats](#number-formats) * [Paths](#paths) +* [Polygons](#polygons) * [Random Numbers](#random-numbers) * [Requests](#requests) * [Scales](#scales) ([Continuous](#continuous), [Sequential](#sequential), [Quantize](#quantize), [Ordinal](#ordinal), [Categorical](#categorical)) @@ -315,6 +316,16 @@ Serialize Canvas path commands to SVG. * [*path*.rect](https://github.com/d3/d3-path#path_rect) - draw a rectangle. * [*path*.toString](https://github.com/d3/d3-path#path_toString) - serialize to an SVG path data string. +## [Polygons](https://github.com/d3/d3-polygon) + +Geometric operations for two-dimensional polygons. + +* [d3.polygonArea](https://github.com/d3/d3-polygon#polygonArea) - compute the area of the given polygon. +* [d3.polygonCentroid](https://github.com/d3/d3-polygon#polygonCentroid) - compute the centroid of the given polygon. +* [d3.polygonHull](https://github.com/d3/d3-polygon#polygonHull) - compute the convex hull of the given points. +* [d3.polygonContains](https://github.com/d3/d3-polygon#polygonContains) - test whether a point is inside a polygon. +* [d3.polygonLength](https://github.com/d3/d3-polygon#polygonLength) - compute the length of the given polygon’s perimeter. + ## [Random Numbers](https://github.com/d3/d3-random) Generate random numbers from various distributions. diff --git a/index.js b/index.js index a498e030..099a623d 100644 --- a/index.js +++ b/index.js @@ -83,6 +83,14 @@ export { easeElasticInOut } from "d3-ease"; +export { + polygonArea, + polygonCentroid, + polygonHull, + polygonContains, + polygonLength +} from "d3-polygon"; + export { path } from "d3-path"; diff --git a/package.json b/package.json index 281040d8..01f01011 100644 --- a/package.json +++ b/package.json @@ -45,6 +45,7 @@ "d3-format": "0.5.0", "d3-interpolate": "0.4.0", "d3-path": "0.1.3", + "d3-polygon": "0.2.0", "d3-random": "0.2.0", "d3-request": "0.3.0", "d3-scale": "0.5.0",