Exemplo n.º 1
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);
        }
        /// <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);
        }
Exemplo n.º 3
0
 /// <summary>
 ///     Computes the closest <see cref="PointF" /> on this <see cref="RectangleF" /> to a specified
 ///     <see cref="PointF" />.
 /// </summary>
 /// <param name="rect">The rectangle.</param>
 /// <param name="point">The point.</param>
 /// <returns>The closest <see cref="PointF" /> on this <see cref="RectangleF" /> to the <paramref name="point" />.</returns>
 public static PointF ClosestPointTo(this RectangleF rect, PointF point)
 {
     PrimitivesHelper.ClosestPointToPointFromRectangle(rect.TopLeft, rect.BottomRight, point, out PointF result);
     return(result);
 }