protected internal OctreeNode <T> GetChild(float x, float y, float z) { return(Bounds.PointWithinBounds(x, y, z) ? (Branch != null ? (from t in Branch where t.Bounds.PointWithinBounds(x, y, z) select t.GetChild(x, y, z)). FirstOrDefault() : this) : null); }
public ArrayList GetNode(OctreeBox rect, ArrayList nodes) { if (Branch == null) { var things = Items.GetEnumerator(); while (things.MoveNext()) { var qtl = (OctreeLeaf <T>)things.Current; if (qtl != null && rect.PointWithinBounds(qtl.X, qtl.Y, qtl.Z)) { nodes.Add(qtl.LeafObject); } } } else { foreach (var t in Branch.Where(t => t.Bounds.Within(rect))) { t.GetNode(rect, nodes); } } return(nodes); }