VelocityDb.Collection.Spatial.NodeLeaf.Nearest C# (CSharp) Method

Nearest() private method

private Nearest ( System.Point p, VelocityDb.Collection.Spatial.RTree rTree, double furthestDistanceSq, PriorityQueueRTree nearestRectangles ) : double
p System.Point
rTree VelocityDb.Collection.Spatial.RTree
furthestDistanceSq double
nearestRectangles PriorityQueueRTree
return double
    internal override double Nearest(Point p, RTree rTree, double furthestDistanceSq, PriorityQueueRTree nearestRectangles)
    {
      for (int i = 0; i < entryCount; i++)
      {
        double tempDistanceSq = entries[i].Value.distanceSq(p.x, p.y);
        if (tempDistanceSq < furthestDistanceSq)
        {
          furthestDistanceSq = tempDistanceSq;
          nearestRectangles.Clear();
        }
        if (tempDistanceSq <= furthestDistanceSq)
          nearestRectangles.Insert(entries[i].Value, tempDistanceSq);
      }
      return furthestDistanceSq;
    }