JSPM

bound-points

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1723
  • Score
    100M100P100Q111831F
  • License MIT

Find a bounding box for a set of points

Package Exports

  • bound-points

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (bound-points) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

bound-points

Computes a bounding box from a set of points in any dimension.

Example

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 upper and lower bounds for the point set.

License

(c) 2015 Mikola Lysenko. MIT License