/// <summary>
        ///     Computes the closest <see cref="Point2" /> on this <see cref="BoundingRectangle" /> to a specified
        ///     <see cref="Point2" />.
        /// </summary>
        /// <param name="point">The point.</param>
        /// <returns>The closest <see cref="Point2" /> on this <see cref="BoundingRectangle" /> to the <paramref name="point" />.</returns>
        public Point2 ClosestPointTo(Point2 point)
        {
            Point2 result;

            PrimitivesHelper.ClosestPointToPointFromRectangle(Center - HalfExtents, Center + HalfExtents, point, out result);
            return(result);
        }
Esempio n. 2
0
        /// <summary>
        ///     Computes the closest <see cref="Point2" /> on this <see cref="RectangleF" /> to a specified
        ///     <see cref="Point2" />.
        /// </summary>
        /// <param name="point">The point.</param>
        /// <returns>The closest <see cref="Point2" /> on this <see cref="RectangleF" /> to the <paramref name="point" />.</returns>
        public Point2 ClosestPointTo(Point2 point)
        {
            Point2 result;

            PrimitivesHelper.ClosestPointToPointFromRectangle(TopLeft, BottomRight, point, out result);
            return(result);
        }