https://github.com/ayamflow/polygon-aabb
Get the Axis Aligned Bounding Box for a set of points (convex polygon).
https://github.com/ayamflow/polygon-aabb
Last synced: about 1 year ago
JSON representation
Get the Axis Aligned Bounding Box for a set of points (convex polygon).
- Host: GitHub
- URL: https://github.com/ayamflow/polygon-aabb
- Owner: ayamflow
- Created: 2015-03-21T22:40:36.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2015-03-21T22:41:18.000Z (about 11 years ago)
- Last Synced: 2025-01-31T14:41:56.922Z (over 1 year ago)
- Language: JavaScript
- Size: 102 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
polygon-aabb
===
Get the Axis Aligned Bounding Box for a set of points (convex polygon).
## Installation
`npm i polygon-aabb --save`
## Usage
`bbox(points)`
Return a frame object containing the properties `x`, `y`, `width` and `height` of the bounding box.
## Example
```js
var bbox = require('polygon-aabb');
function debug(polygon) {
var aabb = bbox(polygon);
context.beginPath();
context.fillRect(aabb.x, aabb.y);
context.fill();
}
```