示例#1
0
 public float Length(Vector vector)
 {
     return (float)Math.Sqrt((double)(vector.X * vector.X + vector.Y * vector.Y));
 }
示例#2
0
 public static Vector Subtract(Vector value1, Vector value2)
 {
     return new Vector(value1.X - value2.X, value1.Y - value1.Y);
 }
示例#3
0
 public bool Equals(Vector other)
 {
     return X == other.X && Y == other.Y;
 }
示例#4
0
 public static Vector Negate(Vector value)
 {
     return new Vector(-value.X, -value.Y);
 }
示例#5
0
 public static Vector Normalize(Vector value)
 {
     return new Vector(value.X / value.Length(), value.Y / value.Length());
 }
示例#6
0
 public static Vector Multiply(Vector value1, float scaleFactor)
 {
     return new Vector(value1.X * scaleFactor, value1.Y * scaleFactor);
 }
示例#7
0
 public static Vector Multiply(Vector value1, Vector value2)
 {
     return new Vector(value1.X * value2.X, value1.Y * value2.Y);
 }
示例#8
0
 public static Vector Min(Vector value1, Vector value2)
 {
     return new Vector(value1.X <= value2.X ? value1.X : value2.X, value1.Y <= value2.Y ? value1.Y : value2.Y);
 }
示例#9
0
 public static void Min(ref Vector value1, ref Vector value2, out Vector result)
 {
     result = Vector.Min(value1, value2);
 }
示例#10
0
 public static float Dot(Vector vector1, Vector vector2)
 {
     return vector1.X * vector2.X + vector1.Y * vector2.Y;
 }
示例#11
0
 public static void Dot(ref Vector value1, ref Vector value2, out float result)
 {
     result = Vector.Dot(value1, value2);
 }
示例#12
0
 public static Vector Divide(Vector value1, Vector value2)
 {
     return new Vector(value1.X / value2.X, value1.Y / value2.Y);
 }
示例#13
0
 public static Vector Divide(Vector value1, float divider)
 {
     return new Vector(value1.X / divider, value1.Y / divider);
 }
示例#14
0
 public static void Distance(ref Vector value1, ref Vector value2, out float result)
 {
     result = Vector.Distance(value1, value2);
 }
示例#15
0
 public static float Distance(Vector v1, Vector v2)
 {
     return (float)Math.Sqrt((double)((v1.X - v2.X) * (v1.X - v2.X) + (v1.Y - v2.Y) * (v1.Y - v2.Y)));
 }
示例#16
0
 public static Vector Add(Vector v1, Vector v2)
 {
     return new Vector(v1.X + v2.X, v1.Y + v2.Y);
 }