4.0.0 • Published 7 years ago
snap-points-2d v4.0.0
snap-points-2d
Runs iterative snap rounding on a set of 2D coordinates to produce a hierarchical level of detail for optimizing online rendering of huge 2D plots.
Install
npm i snap-points-2dAPI
{levels, ids, weights, points} = require('snap-points-2d')(points, bounds?)
Reorders the points hierarchically such that those which are drawn at the same pixel coordinate are grouped together.
Inputs
pointsis an input array of 2*n coordinate values. It is kept untouched.boundsis an optional array of 4 bounding box values of the points.
Outputs
pointsis an output float64 array with reordered an normalized toboundspoint values.idsis an output uint32 array which gets the reordered index of the points.weightsis an output uint32 array of point weights (number of points at the same pixel), which can be used for transparent rendering.levelsis an array of LOD scales. Each record is an object with the following properties:pixelSizethe pixel size of this level of detail in data unitsoffsetthe offset of this lod within the output array *countthe number of items in the lod
License
(c) 2015 Mikola Lysenko. MIT License