Builtin Library
README.md
points.neighbors (procNode)
What stands around each point, within a radius and optionally a cone: neighbour count, nearest distance, centroid, and the neighbours' mean of an attribute. Use it for crowding, flocking reads and density-driven scale.
core.neighbours in measure mode, which finds each point's neighbours through a spatial hash and writes neighbors, nearest, centroid and, when mean names an attribute, neighbor_<name>. A point with no neighbour has neighbors 0, nearest equal to radius and its own position as centroid. A radius at or below 0, and a direction or mean the points do not carry, are errors.
Built from: core.neighbours.
Inputs
points(Geometry). The points to look around. Each one's neighbours are the others of the same points; the answers land on it asneighbors,nearestandcentroid, and everything it carried stays.radius(Float, default 1, at least 0.000001). How far a point looks. Only points closer than this count as its neighbours.direction(String, optional). A Vec3 point attribute each point looks along (a velocity, a tangent). Given, a neighbour counts only inside theconearound it.cone(Float, default 360). The full angle, in degrees, of the cone arounddirectiona neighbour has to stand in. 360 counts every side.mean(String, optional). A numeric point attribute (1 to 4 lanes) whose neighbours' average each point takes, asneighbor_<name>. A point with no neighbours takes its own value.
Outputs
points(Geometry). The points withneighbors(count),nearest(distance to the closest neighbour, at mostradius),centroid(Vec3) andneighbor_<mean>added.
local around = g.points.neighbors({ points = g.points.grid({ countX = 4, countZ = 4 }), radius = 1.1 })