2d-bounds 中文文档教程
2d-bounds
基于准系统数组的二维边界计算
install
npm install 2d-bounds
use
bounds2(points
[, out
])
points
- array of 2+ item arrays (i.e.[[0, 0], [1, 1]]
) representing an array of 2d vectorsout
- avoid creating garbage by reusing an array
返回 out
这是一个 4 分量数组:[lowX, lowY, hiX, hiY]
example
var bounds2 = require('2d-bounds');
var polyline = [
[-100, 100],
[0, 0],
[10, 200]
];
var b = bounds2(polyline);
console.log(b);
// outputs: [ -100, 0, 10, 200 ]
license
2d-bounds
barebones array based 2d bounds compute
install
npm install 2d-bounds
use
bounds2(points
[, out
])
points
- array of 2+ item arrays (i.e.[[0, 0], [1, 1]]
) representing an array of 2d vectorsout
- avoid creating garbage by reusing an array
returns out
which is a 4 component array: [lowX, lowY, hiX, hiY]
example
var bounds2 = require('2d-bounds');
var polyline = [
[-100, 100],
[0, 0],
[10, 200]
];
var b = bounds2(polyline);
console.log(b);
// outputs: [ -100, 0, 10, 200 ]