Builtin Library
README.md
core.pairs (procNode)
Every pair of points within a radius: for each query point, the source points that stand within the radius of it, as a list of owners and items.
Built from core.spatial over the sources, the hash_count and hash_gather kernels, scan of the counts and expand of each query's list into one row per pair. Outputs: owner (the query point of each pair), items (the source point of each pair), counts and offsets (each query's list in items) and total. A point is not its own neighbour when the queries are the sources.
Inputs
points(Geometry). The query points.sources(Geometry, optional). The points looked at. Left empty, the query points look at each other.radius(Number). Default1.0. Above 0. How far a query point reaches.
Outputs
owner: the query point of each pair.items: the source point of each pair.counts: the length of each query's list.offsets: where each query's list starts initems.total: the number of pairs.spatial: thecore.spatialrecord the sources were indexed by.
Example
local points = g.points.grid({ countX = 4, countZ = 1, spacing = 1 })
local pairs = g.core.pairs({ points = points, radius = 1.5 })
Six pairs: each point with the points 1 apart on either side of it.