point-cluster
Advanced tools
Comparing version
{ | ||
"name": "point-cluster", | ||
"version": "3.0.1", | ||
"version": "3.0.2", | ||
"description": "Fast nd point clustering.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -25,3 +25,3 @@ # point-cluster [](https://travis-ci.org/dfcreative/point-cluster) [](http://github.com/badges/stability-badges) | ||
// get point ids within the indicated range | ||
// get point ids in the indicated range | ||
let selectedIds = ids.range([10, 10, 20, 20]) | ||
@@ -39,11 +39,9 @@ | ||
`points` is an array of `[x,y, x,y, ...]` or `[[x,y], [x,y], ...]` coordinates. | ||
* `points` is an array of `[x,y, x,y, ...]` or `[[x,y], [x,y], ...]` coordinates. | ||
* `ids` is _Uint32Array_ with point ids sorted by zoom levels, suitable for WebGL buffer, subranging or alike. | ||
* `options` | ||
`ids` is _Uint32Array_ with point ids sorted by zoom levels, suitable for WebGL buffer, subranging or alike. | ||
#### `options` | ||
Option | Default | Description | ||
---|---|--- | ||
`bounds` | `auto` | Data bounds, if different from `points` bounds, eg. in case of subdata. | ||
`bounds` | `'auto'` | Data range, if different from `points` bounds, eg. in case of subdata. | ||
`depth` | `256` | Max number of levels. Points below the indicated level are grouped into single level. | ||
@@ -54,3 +52,5 @@ <!-- `node` | `1` | Min size of node, ie. tree traversal is stopped once the node contains less than the indicated number of points. --> | ||
--- | ||
### `result = ids.range(box?, options?)` | ||
@@ -60,8 +60,11 @@ | ||
`box` can be any rectangle format, eg. `[l, t, r, b]`, see [parse-rect](https://github.com/dfcreative/parse-rect). | ||
* `box` can be any rectangle object, eg. `[l, t, r, b]`, see [parse-rect](https://github.com/dfcreative/parse-rect). | ||
* `options` | ||
`options.lod` makes result contain list of level details instead of ids, useful for obtaining subranges to render. | ||
Option | Default | Description | ||
---|---|--- | ||
`lod` | `false` | Makes result a list of level details instead of ids, useful for obtaining subranges to render. | ||
`d` | `0` | Min pixel size (number or `[width, height]` couple) to search for, to ignore lower levels. | ||
`level` | `null` | Max level to limit search. | ||
`options.d` can indicate the pixel size (number or a `w, h` couple) to search for, to ignore lower levels. Alternately, `options.level` can limit max level. | ||
```js | ||
@@ -68,0 +71,0 @@ let levels = ids.range([0,0, 100, 100], { lod: true, d: dataRange / canvas.width }) |
28393
0.18%88
3.53%