public ArrayList GetNodes(float x, float y, float z, double minRadius, double maxRadius)
{
var nodes = new ArrayList();
if (Branch == null)
{
foreach (var leaf in from OctreeLeaf leaf in Items let distance = Math.Sqrt(
Math.Pow(x - leaf.X, 2.0) +
Math.Pow(y - leaf.Y, 2.0) +
Math.Pow(z - leaf.Z, 2.0)) where distance >= minRadius && distance < maxRadius select leaf)
{
nodes.Add(leaf.LeafObject);
}
return nodes;
}
// Check the distance of the bounds of the branch,
// versus the bestDistance. If there is a boundary that
// is closer, then it is possible that another node has an
// object that is closer.
foreach (object test in from t in Branch let childDistance = t.Bounds.BorderDistance(x, y, z) where childDistance > minRadius && childDistance <= maxRadius select t.GetNode(x, y, z, minRadius) into test where test != null select test)
{
nodes.Add(test);
}
return nodes;
}