point-is-in-polygon
TypeScript icon, indicating that this package has built-in type declarations

0.6.0 • Public • Published

Point is in Polygon

The point-is-in-polygon package is a lightweight package that was developed to check if the coordinates of a point are in the coordinates of a polygon.

Usage

const polygon = new Polygon([
  [
    { x: 200, y: 200 },
    { x: 500, y: 100 },
    { x: 800, y: 200 },
    { x: 800, y: 400 },
    { x: 500, y: 500 },
    { x: 200, y: 400 },
    { x: 200, y: 200 },
  ],
]);

const point = new Point({
  x: 300,
  y: 400,
});

point.isInPolygon(polygon); // true

Package Sidebar

Install

npm i point-is-in-polygon

Weekly Downloads

1

Version

0.6.0

License

MIT

Unpacked Size

12.9 kB

Total Files

24

Last publish

Collaborators

  • ermesonsampaio