Пример #1
0
        /// <summary>
        /// This is essentially the same as Lerp but instead the function will ensure that the speed never exceeds maxDistanceDelta.
        /// Negative values of maxDistanceDelta pushes the vector away from target.
        /// </summary>
        public static PointF MoveTowards(this PointF current, PointF target, float maxDistanceDelta)
        {
            var dir       = target.Sub(current);
            var magnitude = dir.Length();

            if (magnitude <= maxDistanceDelta || magnitude <= float.Epsilon)
            {
                return(target);
            }
            return(current.Add(dir.Mul(maxDistanceDelta / magnitude)));
        }
		/// <summary>
		/// Size BetWeen Two PointF
		/// </summary>
		/// <param name="p"></param>
		/// <param name="p2"></param>
		/// <returns></returns>
		public static SizeF Diff(PointF p, PointF p2)
		{
			return new SizeF(p2.Sub(p));
		}