2.0.0 • Published 4 years ago

centroid2d v2.0.0

Weekly downloads
6
License
ISC
Repository
-
Last release
4 years ago

Centroid 2D

A package to find the area weighted center of a convex polygon whose mass is evenly distributed across the surface.

Usage

$ npm i centroid2d
const findCentroid = require('centroid2d)

let polygon = [
    [0, 0],
    [5, 0],
    [5, 5],
    [0, 5],
]
let centroid = findCentroid(polygon) // [2.5, 2.5]

Input must be an array of arrays of x and y coordinates.

There is no typechecking for simplicity and speed.

TODO:

Feedback ✉️

It is greatly appreciated! 🎉

Website 🌐

js@jacobsmith.tech

https://github.com/limeandcoconut

@limeandcoconut 🐦

Cheers!

License

ISC, see license for details.

2.0.0

4 years ago

1.0.0

6 years ago