polygon-points
Advanced tools
Comparing version 0.5.0 to 0.5.1
16
index.js
@@ -1,2 +0,1 @@ | ||
// jshint esversion: 6, globalstrict: true, strict: true | ||
'use strict'; | ||
@@ -84,4 +83,19 @@ | ||
} | ||
getBitset(width, height) { | ||
const length = width * height; | ||
const buffer = Buffer.alloc(length, 0); | ||
let count = 0; | ||
for (let y = 0, i = 0; y < width; y++) { | ||
for (let x = 0; x < width; x++, i++) { | ||
if (this.containsPoint(x, y) === true) { | ||
buffer[i] = true; | ||
count++; | ||
} | ||
} | ||
} | ||
return {buffer: buffer, count: count, length: length}; | ||
} | ||
} | ||
module.exports = PolygonPoints; |
{ | ||
"name": "polygon-points", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"description": "Determine if an x y coordinate exists in a polygon.", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "node tests/test.js" | ||
"test": "node tests/test.js", | ||
"preversion": "npm test" | ||
}, | ||
@@ -9,0 +10,0 @@ "repository": { |
# polygon-points | ||
###### [![Build Status](https://travis-ci.org/kevinGodell/polygon-points.svg?branch=master)](https://travis-ci.org/kevinGodell/polygon-points) [![GitHub issues](https://img.shields.io/github/issues/kevinGodell/polygon-points.svg)](https://github.com/kevinGodell/polygon-points/issues) [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/kevinGodell/polygon-points/master/LICENSE) | ||
###### [![Build Status](https://travis-ci.org/kevinGodell/polygon-points.svg?branch=master)](https://travis-ci.org/kevinGodell/polygon-points) [![Build status](https://ci.appveyor.com/api/projects/status/al11is88xms9kqq9/branch/master?svg=true)](https://ci.appveyor.com/project/kevinGodell/polygon-points/branch/master) [![GitHub issues](https://img.shields.io/github/issues/kevinGodell/polygon-points.svg)](https://github.com/kevinGodell/polygon-points/issues) [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/kevinGodell/polygon-points/master/LICENSE) | ||
Determine if an x y coordinate exists in a polygon. This is being used in a motion detection project where specific regions of an image are being filtered and measured. It works fast when iterating pixels because it caches the bounding box value and uses it to quickly eliminate non-targeted pixels from unnecessary difference calculations. It is designed to be used with positive integer values starting with an x y value of 0 0 at the top left. | ||
@@ -4,0 +4,0 @@ ### installation: |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6780
88