コード例 #1
0
 public static float GetAngle(this Vector2f v)
 {
     return(MathExtensions.Atan2(v.Y, v.X));
 }
コード例 #2
0
 //returns the length of the vector
 public static float Magnitude(this Vector2f v, Vector2f v2)
 {
     return(MathExtensions.Sqrt(v.X * v2.X + v.Y * v2.Y));
 }
コード例 #3
0
 // returns the distance between this vector and the one passed as a parameter
 public static float Distance(this Vector2f v, Vector2f v2)
 {
     return(MathExtensions.Sqrt(Math.Pow(v.X - v2.X, 2) + Math.Pow(v.Y - v2.Y, 2)));
 }