I have a data-set that has four columns [X Y Z C]. I would like to find all the C values that are in a given sphere centered at [X, Y, Z] with a radius r. What is the best approach to address this problem? Should I use the clusterdata command?
To collect the required C values I'd make a single pass through the data-set (array?) with some quick checks to eliminate most of the points outside the sphere, and then (only for the points that seem eligible) a check of actual radius.
That is, for a candidate point
Only if all three tests are true is it possible for the point to be in the desired sphere. For the final test, use precomputed r^2 and ask:
If the point passes the final test, include