Socket
Socket
Sign inDemoInstall

bentley-ottmann-intersections

Package Overview
Dependencies
3
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    bentley-ottmann-intersections

A module to check if a polygon self-intersects using the bentley-ottmann algorithm


Version published
Weekly downloads
18
increased by500%
Maintainers
1
Install size
560 kB
Created
Weekly downloads
 

Readme

Source

bentley-ottmann-intersections

A small module using the Bentley-Ottmann algorithm to detection self-intersections

Install

npm install bentley-ottmann-intersections

Documentation

Valid inputs: Geojson Polygon, MultiPolygon

    const findIntersections = require('bentley-ottmann-intersections')

    const box = {type: 'Polygon', coordinates: [[[0, 0], [1, 0], [1, 1], [0, 1], [0, 0]]]}
    findIntersections(box)
    // returns array os intersection points

Benchmarks

Tested against

  • gpsi - https://www.npmjs.com/package/geojson-polygon-self-intersections
  • isects - https://www.npmjs.com/package/2d-polygon-self-intersections
// Switzerland with kinks
// bentleyOttmannIntersections x 2,333 ops/sec ±1.79% (89 runs sampled)
// gpsi x 36.78 ops/sec ±2.03% (49 runs sampled)
// isects x 12.70 ops/sec ±1.37% (36 runs sampled
// - Fastest is bentleyOttmannIntersections

// Simple Case
// gpsi x 246,005 ops/sec ±1.54% (90 runs sampled)
// bentleyOttmannIntersections x 464,363 ops/sec ±1.73% (95 runs sampled)
// - Fastest is bentleyOttmannIntersections

Further Reading

Geom algorithms website

FAQs

Last updated on 09 Sep 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc