Polygon Geom

Polygon Geom

API ReferenceGeometryPolygon Geom

d3.geom.polygon(vertices)

Returns the input array of vertices with additional methods attached, as described below.

polygon.area()

Returns the signed area of this polygon. If the vertices are in counterclockwise order, the area is positive, otherwise it is negative.

polygon.centroid()

Returns a two-element array representing the centroid of this polygon.

polygon.clip(subject)

Clips the subject polygon against this polygon. In other words, returns a polygon representing the intersection of this polygon and the subject polygon. Assumes the clip polygon is counterclockwise and convex.

© 2010–2016 Michael Bostock
Licensed under the BSD License.
https://github.com/d3/d3-3.x-api-reference/blob/master/Polygon-Geom.md

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部