OctreeNode.GetNodes C# (CSharp) Method

GetNodes() public method

public GetNodes ( float x, float y, float z, double minRadius, double maxRadius ) : ArrayList
x float
y float
z float
minRadius double
maxRadius double
return ArrayList
    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;
    }

Same methods

OctreeNode::GetNodes ( Vector3 vector, double radius ) : ArrayList
OctreeNode::GetNodes ( Vector3 vector, double minRadius, double maxRadius ) : ArrayList
OctreeNode::GetNodes ( float x, float y, float z, double radius ) : ArrayList

Usage Example

Beispiel #1
0
 public ArrayList GetNodes(float x, float y, float z, double radius)
 {
     return(Top.GetNodes(x, y, z, radius));
 }