point-in-polygon

determine if a point is inside a polygon

  • Owner: substack/point-in-polygon
  • Platform:
  • License:: MIT License
  • Category::
  • Topic:
  • Like:
    0
      Compare:

Github stars Tracking Chart

point-in-polygon

Determine if a point is inside of a polygon.

This module casts a ray from the inquiry point and counts intersections,
based on
this algorithm.

example

var inside = require('point-in-polygon');
var polygon = [ [ 1, 1 ], [ 1, 2 ], [ 2, 2 ], [ 2, 1 ] ];

console.dir([
    inside([ 1.5, 1.5 ], polygon),
    inside([ 4.9, 1.2 ], polygon),
    inside([ 1.8, 1.1 ], polygon)
]);

output:

[ true, false, true ]

methods

var inside = require('point-in-polygon')

inside(point, polygon)

Return whether point is contained in polygon.

point should be a 2-item array of coordinates.

polygon should be an array of 2-item arrays of coordinates.

install

npm install point-in-polygon

license

MIT

Main metrics

Overview
Name With Ownersubstack/point-in-polygon
Primary LanguageJavaScript
Program languageJavaScript (Language Count: 1)
Platform
License:MIT License
所有者活动
Created At2012-01-01 20:23:49
Pushed At2021-03-16 00:05:36
Last Commit At2021-03-15 14:05:24
Release Count4
Last Release Name1.1.0 (Posted on 2021-03-15 14:05:24)
First Release Name1.0.0 (Posted on 2015-06-13 10:57:10)
用户参与
Stargazers Count895
Watchers Count25
Fork Count100
Commits Count18
Has Issues Enabled
Issues Count16
Issue Open Count1
Pull Requests Count3
Pull Requests Open Count0
Pull Requests Close Count2
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private