Simstim

VEX Dictionary / pcopen

pcopen

Opens a point cloud query around a position and returns a handle for the other pc functions.

group: ptcloudptcloudfile

Available in every context

Usage

int pcopen(string filename, string channel, int shaded, ...)
int pcopen(string filename, string Pchannel, vector P, float radius, int maxpoints, ...)
int pcopen(string filename, string Pchannel, vector P, string Nchannel, vector N, float radius, int maxpoints, ...)
int pcopen(int opinput, string Pchannel, vector P, float radius, int maxpoints)

Examples

Smooth points toward their neighbours sop
// Point Wrangle, run over Points
int handle = pcopen(0, "P", @P, chf("radius"), chi("maxpts"));
vector avg = pcfilter(handle, "P");
@P = lerp(@P, avg, chf("amount"));
pcclose(handle);

pcopen queues up to maxpts of the nearest points within radius of the current point. pcfilter returns their distance-weighted average position, and lerp blends toward it. Run the wrangle several times, or inside a loop, for stronger smoothing.

Colour by local density sop
int handle = pcopen(0, "P", @P, chf("radius"), 50);
float d = fit(pcnumfound(handle), 0, 50, 0, 1);
@Cd = set(d, 0.2, 1 - d);
pcclose(handle);

pcnumfound tells you how many points the query found, which is a cheap way to measure density. Crowded areas turn red and sparse areas blue.

Use cases

Signatures (from vcc -X)

Related

Full SideFX documentation ↗