- calculate and store the square of the radius

- loop over all nodes

- for each node, calculate the square of the distance between the node and the center of the sphere

- compare the result to the square radius - if it's greater, then the point is outside the sphere, else inside

More complex solution:

- organize your 3D points in a geomatrical data structure, e. g. an Octree[^]

- determine which of the segments of this data structures contain part or all of the sphere

- for all those specific segments, do the simple solution search described above.

P.S.:

If performance is not an issue, you can also do the

*very*simple solution (as suggested above):

- loop over all nodes

- for each node, calculate the distance between the node and the center of the sphere

- compare the result to the radius - if it's greater, then the point is outside the sphere, else inside

I consider that 'very' simple, but at the same time possibly better than either of the above, because it explicitely does the obvious thing. Anyone with a minimum of knowledge about geometry looking at the code will immediately understand it. This may make it more maintainable than the other solutions.