Example #1
0
        /// <summary>
        /// Returns the object nearest to the given coordinates.
        /// </summary>
        /// <param name="x">The x-value of the coordinates.</param>
        /// <param name="y">The y-value of the coordinates.</param>
        /// <param name="distance">The distance to the nearest object.</param>
        /// <returns>The object nearest to the given coordinates.</returns>
        public T GetNearestObject(double x, double y, out double distance)
        {
            double obtainedDistance = double.PositiveInfinity;
            T      obtainedObject   = null;

            _rootNode.GetNearestObject(x, y, ref obtainedObject, ref obtainedDistance);
            distance = obtainedDistance;
            return(obtainedObject);
        }