Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mikolalysenko/bound-points
Find a bounding box for a set of points
https://github.com/mikolalysenko/bound-points
Last synced: about 2 months ago
JSON representation
Find a bounding box for a set of points
- Host: GitHub
- URL: https://github.com/mikolalysenko/bound-points
- Owner: mikolalysenko
- License: mit
- Created: 2015-02-19T03:14:04.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-09-30T04:00:57.000Z (about 9 years ago)
- Last Synced: 2024-10-20T14:28:18.441Z (2 months ago)
- Language: JavaScript
- Size: 140 KB
- Stars: 23
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
bound-points
============
Computes a bounding box from a set of points in any dimension.# Example
```javascript
var getBounds = require('bound-points')var points = [[-1, 1], [5, 10], [-8, 13]]
console.log('2d:', getBounds(points))var mesh = require('bunny')
console.log('3d:', getBounds(mesh.positions))
```Output:
```
2d: [ [ -8, 1 ], [ 5, 13 ] ]
3d: [ [ -4.958475, -0.003149, -3.729833 ],
[ 4.94885, 9.654748, 3.810639 ] ]
```# Install
```
npm i bound-points
```# API
#### `var bounds = require('bound-points')(points)`
Computes an axis aligned bounding box for a set of points.* `points` is an array of points
**Returns** A pair of lower and upper bounds for the point set.
For example:
```js
[ [ minX, minY ], [ maxX, maxY ] ]
```# License
(c) 2015 Mikola Lysenko. MIT License