New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

polygon-intersect-test

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

polygon-intersect-test

determine whether two polygons intersect in 2d

latest
npmnpm
Version
1.0.1
Version published
Weekly downloads
155
-30.8%
Maintainers
1
Weekly downloads
 
Created
Source

polygon-intersect-test

determine whether two polygons intersect in 2d

This package works on both nested and flat arrays (good for typed arrays) and you can provide array offsets to avoid instantiation overhead for subarray slices.

example

var polygonIntersect = require('polygon-intersect-test')

var A = [
  -1.00,-1.00, -1.00,+1.00, +1.00,+1.00, +1.00,-1.00, -1.00,-1.00,
  -1.00,-1.01, +1.01,-1.01, +1.01,+1.01, -1.01,+1.01, -1.01,-1.00
]
var B = [ -0.50,+0.10, -0.80,-0.20, -0.40,+0.00, ]
var C = [ -0.90,+0.80, -1.05,-0.60, -0.75,+0.70 ]

console.log(polygonIntersect(A,B)) // false
console.log(polygonIntersect(A,C)) // true

api

var polygonIntersectTest = require('polygon-intersect-test')
var polygonIntersectTestFlat = require('polygon-intersect-test/flat')
var polygonIntersectTestNested = require('polygon-intersect-test/nested')

polygonIntersectTest(A, B, arange, brange)

Return a boolean of whether the polygons A and B intersect.

A and B may both be flat arrays or they may both be nested arrays of 2-item [x,y] arrays.

Optionally provide arange or brange as 2-item arrays of [start,end] array index offsets into the respective A or B polygon.

You may also use the dedicated flat (polygonIntersectTestFlat) or nested (polygonIntersectTestNested) routines to skip a check to find the appropriate implementation.

install

npm install polygon-intersection-test

license

bsd

FAQs

Package last updated on 12 May 2022

Did you know?

Socket

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