Ejemplo n.º 1
0
        public void Add(Node node)
        {
            if (RootNode == null)
            {
                RootNode = node;
            }
            else
            {

                int currentDimension = Level % cSpace.DimensionCount;
                if (node.p[currentDimension] < RootNode.p[currentDimension])
                {
                    if (LeftTree != null)
                    {
                        LeftTree.Add(node);
                    }
                    else
                    {
                        LeftTree = new KdTree(cSpace, node, Level + 1);
                    }
                }
                else
                {
                    if (RightTree != null)
                    {
                        RightTree.Add(node);
                    }
                    else
                    {
                        RightTree = new KdTree(cSpace, node, Level + 1);
                    }
                }
            }
        }
Ejemplo n.º 2
0
 public NodeList(CSpace cSpace, GrowConnectionType connectionType, bool useKdTree)
 {
     this.cSpace = cSpace;
     this.useKdTree = useKdTree;
     this.connectionType = connectionType;
     if (useKdTree)
     {
         kdTree = new KdTree(cSpace);
     }
     this.nodeList = new List<Node>();
     if (connectionType == GrowConnectionType.Edge)
     {
         this.edgeList = new List<Edge>();
     }
 }