I have a 2 list of dictionaries. The first list contains sphere definitions in terms of x, y, z, radius. The second list contains various points in space as x, y, z. These lists are both very long, so iterating over each list and compare against all values is inefficient.
I've been trying the map and reduce terms, but both of them take only 1 term in the filtering function. What I'm using is the following.
for curNode in nodeList:
for i in sphereList:
tmpRad = findRadius(i, curNode)
if float(tmpRad) <= float(i['radius']):
print "Remove node", curNode['num']
nodeRemovalList.append(curNode['num'])
break
where i is the current sphere (x, y, z, rad) and curNode is the node (num, x, y, z). For large lists, this becomes very inefficient. I'd like to filter out nodes which fall within the radius of any spheres.