I need to compare 2 sets of points and determine which one is distributed more evenly on a surface/mesh.
My attempt in the attached hip file. These are the steps I'm doing:
use Triangulate2d SOP to produce a mesh for each scattered set of points
measure the area of each prim
compute the average area of the primitives
for each prim find the difference from the average: delta = abs(primArea-averageArea)
sum all the deltas for each set and compare the 2 sums.
Critique to the above method:
Very bad efficiency since requires the slow triangulation
Doesn't work for 3D surfaces (!!), only for points scattered on planes
Doesn't produce a very meaningful result. Maybe I should divide the 2 sums to find a ratio? I don't know what is the correct statistical approach to show the difference?
Find a good radius to calculate for each point all nearpoints within this radius. If the distribution is quite even, the amount of points inside this radius should be even as well. If you take the average of all these numbers and substract it from each single number, the sum of squares of the differences should give you an approximation (or calculating the standard deviation).
Finding a good radius is another problem. Maybe something like the maximum of all distances for each point to the closest neighbour or something similar can be an option.
I'm not sure, if the results are comparable, but the method should work on points which are not only in plane.
I think that in some cases, where the distribution is more clustered, this method would return a good score from the analysis. Consider the example in the picture. This is why the triangulation is very helpful, because you have a measure of the empty space between the points.
One thing that I forgot to say: the original surface is available and the distribution of the scattered points should be measured against it (so not against empty space).
In this case you have an expected density for any given radius (npoints / globalarea ). If you put this radius on each point the density should be everywhere close the expected density, which is not the case if you have big holes.
@the radius shouldn't be to big compared to the curvature of the surface, but I think this would not be a big problem at all.