JSPM

polygon-selfintersect

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 613
  • Score
    100M100P100Q104003F
  • License MIT

Detect if a polygon has self intersecting lines

Package Exports

  • polygon-selfintersect

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (polygon-selfintersect) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

polygon-selfintersect

This script find all the self-intersections in a polygon.

Install

npm install polygon-selfintersect

Usage

var polygonSelfIntersect = require('polygon-selfintersect');
var myPolygon = [[1, 1], [1, 3], [3, 3], [3, 1], [0, 4], [1, 1]];

if (polygonSelfIntersect.findSelfIntersections(myPolygon)) {
  console.log("Found the following self intersection lines:");
  console.log(polygonSelfIntersect.getSelfIntersectionLines());
} else {
  console.log("No self intersection found.");
}

Licence

MIT