コード例 #1
0
 public static Vector2D Truncate(this Vector2D v, double max)
 {
     if (v.Length() > max)
     {
         var normalized = v.Normalize();
         return(normalized * max);
     }
     return(v.Clone());
 }
コード例 #2
0
        /**
         * Returns the distance from current position to the given target
         */
        public double Distance(Vector2D target)
        {
            Vector2D ToTarget = target.Clone().Sub(this);

            return(ToTarget.Length());
        }