Beispiel #1
0
 static Vector2D()
 {
     _zero = new Vector2D(0f, 0f);
     _unit = new Vector2D(1f, 1f);
     _unitX = new Vector2D(1f, 0f);
     _unitY = new Vector2D(0f, 1f);
 }
Beispiel #2
0
 public static Vector2D Subtract(Vector2D left, Vector2D right)
 {
     return new Vector2D(left.X - right.X, left.Y - right.Y);
 }
Beispiel #3
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="position">Position of the star.</param>
 /// <param name="magnitude">Magnitude of the star.</param>
 public Star(Vector2D position, Pen magnitude)
 {
     Position = position;
     Magnitude = magnitude;
     VDelta = 0;
 }
Beispiel #4
0
 public static Vector2D Negate(Vector2D left)
 {
     return new Vector2D(-left.X, -left.Y);
 }
Beispiel #5
0
 public static Vector2D Normalize(Vector2D vector)
 {
     Vector2D zero = Zero;
     if (vector.Length > float.Epsilon)
     {
         float inverseLength = vector.InverseLength;
         zero.X = vector.X * inverseLength;
         zero.Y = vector.Y * inverseLength;
     }
     return zero;
 }
Beispiel #6
0
 public static Vector2D Multiply(Vector2D left, Vector2D right)
 {
     return new Vector2D(left.X * right.X, left.Y * right.Y);
 }
Beispiel #7
0
 public static Vector2D Multiply(Vector2D left, float right)
 {
     return new Vector2D(left.X * right, left.Y * right);
 }
Beispiel #8
0
 public static Vector2D Divide(Vector2D dividend, float divisor)
 {
     return new Vector2D(dividend.X / divisor, dividend.Y / divisor);
 }
Beispiel #9
0
 public static float DotProduct(Vector2D left, Vector2D right)
 {
     return ((left.X * right.X) + (left.Y * right.Y));
 }
Beispiel #10
0
 public static Vector2D CrossProduct(Vector2D vector1, Vector2D vector2)
 {
     return new Vector2D((vector2.X * vector1.Y) - (vector2.Y * vector1.X), (vector2.Y * vector1.X) - (vector2.X * vector1.Y));
 }
Beispiel #11
0
 public static Vector2D Divide(Vector2D dividend, Vector2D divisor)
 {
     return new Vector2D(dividend.X / divisor.X, dividend.Y / divisor.Y);
 }
Beispiel #12
0
 public static float Angle(Vector2D vector1, Vector2D vector2)
 {
     vector1.Normalize();
     vector2.Normalize();
     return MathUtility.ACos(DotProduct(vector1, vector2));
 }
Beispiel #13
0
 public static Vector2D Add(Vector2D left, Vector2D right)
 {
     return new Vector2D(left.X + right.X, left.Y + right.Y);
 }
Beispiel #14
0
 public static Vector2D Round(Vector2D value, int decimalPlaceCount, MidpointRounding rounding)
 {
     return new Vector2D(Round(value.X, decimalPlaceCount, rounding), Round(value.Y, decimalPlaceCount, rounding));
 }
Beispiel #15
0
 public static Vector2D Round(Vector2D value, int decimalPlaceCount)
 {
     return new Vector2D(Round(value.X, decimalPlaceCount), Round(value.Y, decimalPlaceCount));
 }
Beispiel #16
0
 public static Vector2D Round(Vector2D value)
 {
     return new Vector2D(Round(value.X), Round(value.Y));
 }