layersByDistancefunction
The things out to a limit, each in the band of its distance. With no limit (or Infinity) every thing that has a distance is kept. A thing with no distance is counted and never placed. A thing whose distance is rough is kept apart as uncertain when
the nearest its error allows is inside the limit, and is counted in uncertain, not in a band.
Import it
import { layersByDistance } from "@johnmorrisdotca/hoshi-stars/distance";
Definition
function layersByDistance(inputs: readonly DistanceInput[], options?: { limit?: number; }): DistanceLayers
Parameters
| Name | Type | Description |
|---|---|---|
inputs | readonly DistanceInput[] | The things: from |
options (optional) | { limit?: number; } |
|
Returns
DistanceLayers
The things within the limit, nearest first, with the counts.
Examples
import { stars } from "@johnmorrisdotca/hoshi-stars";
import { layersByDistance, starInput } from "@johnmorrisdotca/hoshi-stars/distance";
const layers = layersByDistance(stars().map(starInput), { limit: 50 });
console.log(layers.things.length, layers.counts.slice(0, 2), layers.unknown);157 [ 3, 123 ] 2517What it prints (run when this page was built)