public ArrayList GetNodes(float x, float y, float z, double radius)
{
var nodes = new ArrayList();
if (Branch == null)
{
foreach (OctreeLeaf leaf in Items)
{
double distance = Math.Sqrt(
Math.Pow(x - leaf.X, 2.0) +
Math.Pow(y - leaf.Y, 2.0) +
Math.Pow(z - leaf.Z, 2.0));
if (distance < radius)
nodes.Add(leaf.LeafObject);
}
return nodes;
}
foreach (object test in from t in Branch let childDistance = t.Bounds.BorderDistance(x, y, z) where childDistance < radius select t.GetNode(x, y, z, radius) into test where test != null select test)
{
nodes.Add(test);
}
return nodes;
}