Skip to content

Instantly share code, notes, and snippets.

@nafeesb
Created June 8, 2018 00:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nafeesb/3d5f8db4ff529c684a765c4c3f087025 to your computer and use it in GitHub Desktop.
Save nafeesb/3d5f8db4ff529c684a765c4c3f087025 to your computer and use it in GitHub Desktop.
Average distance to neighbor points
///
/// Average max distance
///
float maxdistance = 15;
int maxpoints = 5;
int closept[] = pcfind_radius(0, "P", "pscale", 1.0, @P, maxdistance, maxpoints);
f@dist = 0;
foreach (int opt; closept) {
vector npos = point(0, "P", opt);
@dist += distance( @P, npos );
}
@dist /= len(closept);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment