Simstim

VEX Dictionary / nearpoints

nearpoints

Lists the point numbers nearest to a position, closest first, within a search radius.

group: geopointproximity

Available in every context

Usage

int[] nearpoints(<geometry>, vector pt, float maxdist)
int[] nearpoints(<geometry>, vector pt, float maxdist, int maxpts)
int[] nearpoints(<geometry>, string ptgroup, vector pt, float maxdist)
int[] nearpoints(<geometry>, string ptgroup, vector pt, float maxdist, int maxpts)

Examples

Connect each point to its neighbours sop
// Point Wrangle, run over Points
int pts[] = nearpoints(0, @P, chf("radius"), chi("maxpts"));
foreach (int pt; pts) {
    if (pt <= @ptnum) continue; // one line per pair
    addprim(0, "polyline", @ptnum, pt);
}

nearpoints returns point numbers sorted from nearest to farthest, and includes the point itself. Skipping pt <= @ptnum avoids building each line twice.

Use cases

Signatures (from vcc -X)

Related

Full SideFX documentation ↗