I am writing a fluid simulation in which I need, for each particle, a list of neighboring particles within a radius, R.
If have a list of potential neighbors, how would I remove all the potential neighbors based on a distance criteria?
I am currently doing this with a for loop but this seems slow and inefficient.
My current method in psuedo code is:
temp = getPotentialNeighbors(point);
foreach(Particle n in temp)
{
if(Distance(n.Pos,point.Pos)<radius)
neighbors.Add(n);
}