getboundingbox
This is a utility function to calculate the bounding box of series of 2D points
var getBounds = var path = -100 12 -52 25 6 13 var box =
The result will be:
{
maxX: 6,
maxY: 25,
minX: -100,
minY: 12
}
Usage
bounds(path[, out])
Computes the min and max [x, y] points for the given path. If path
is an empty array, the bounds will be empty (all zero).
You can specify out
to re-use an object rather than creating a new one.
This is safe to with Array.map/filter/etc, e.g.
if paths ...
License
MIT, see LICENSE.md for details.