コード例 #1
0
 public void SolveProximity(Node2Proximity prox)
 {
     if (this.m_root == null)
     {
         return;
     }
     this.m_root.SolveProximity(this.m_list, prox);
 }
コード例 #2
0
        /// <summary>Recursive method that solves a proximity search.</summary>
        /// <param name="nodes">Node set to search</param>
        /// <param name="prox">Proximity object to search with</param>
        public void SolveProximity(Node2List nodes, Node2Proximity prox)
        {
            double d0 = default(double);
            double d1 = default(double);

            prox.DistanceRange(ref d0, ref d1);
            double num1 = this.MinimumDistanceSquared(prox.Start.x, prox.Start.y);

            if (num1 >= d1 || num1 > prox.MaxSearchRadiusSquared || this.MaximumDistanceSquared(prox.Start.x, prox.Start.y) <= prox.MinSearchRadiusSquared)
            {
                return;
            }
            if (this.m_nodes == null)
            {
                Node2Leaf[] node2LeafArray;
                if (prox.Start.x < this.x_mid)
                {
                    if (prox.Start.y < this.y_mid)
                    {
                        node2LeafArray = new Node2Leaf[4]
                        {
                            this.m_A,
                            this.m_B,
                            this.m_D,
                            this.m_C
                        }
                    }
                    ;
                    else
                    {
                        node2LeafArray = new Node2Leaf[4]
                        {
                            this.m_D,
                            this.m_A,
                            this.m_C,
                            this.m_B
                        }
                    };
                }
                else if (prox.Start.y < this.y_mid)
                {
                    node2LeafArray = new Node2Leaf[4]
                    {
                        this.m_B,
                        this.m_A,
                        this.m_C,
                        this.m_D
                    }
                }
                ;
                else
                {
                    node2LeafArray = new Node2Leaf[4]
                    {
                        this.m_C,
                        this.m_D,
                        this.m_B,
                        this.m_A
                    }
                };
                int num2 = node2LeafArray.Length - 1;
                for (int index = 0; index <= num2; ++index)
                {
                    if (node2LeafArray[index] != null)
                    {
                        node2LeafArray[index].SolveProximity(nodes, prox);
                    }
                }
            }
            else
            {
                if (this.m_nodes == null)
                {
                    return;
                }
                int num2 = this.m_nodes.Count - 1;
                for (int index = 0; index <= num2; ++index)
                {
                    prox.RegisterNode(nodes[this.m_nodes[index]], this.m_nodes[index]);
                }
            }
        }