5using Microsoft.Xna.Framework.Design;
13 [SuppressMessage(
"Microsoft.Design",
"CA1051:DoNotDeclareVisibleInstanceFields")]
16 [SuppressMessage(
"Microsoft.Design",
"CA1051:DoNotDeclareVisibleInstanceFields")]
49 return string.Format(currentCulture,
"{{X:{0} Y:{1}}}",
new object[2]
51 X.ToString(currentCulture),
52 Y.ToString(currentCulture)
77 return X.GetHashCode() +
Y.GetHashCode();
82 float num =
X *
X +
Y *
Y;
93 float num = value1.X - value2.
X;
94 float num2 = value1.Y - value2.
Y;
95 float num3 = num * num + num2 * num2;
101 float num = value1.X - value2.X;
102 float num2 = value1.Y - value2.Y;
103 float num3 = num * num + num2 * num2;
109 float num = value1.X - value2.
X;
110 float num2 = value1.Y - value2.
Y;
111 return num * num + num2 * num2;
116 float num = value1.X - value2.X;
117 float num2 = value1.Y - value2.Y;
118 result = num * num + num2 * num2;
123 return value1.X * value2.X + value1.Y * value2.
Y;
128 result = value1.X * value2.X + value1.Y * value2.Y;
133 float num =
X *
X +
Y *
Y;
134 float num2 = 1f / (float)
Math.
Sqrt(num);
141 float num = value.X * value.X + value.Y *
value.Y;
142 float num2 = 1f / (float)
Math.
Sqrt(num);
144 result.X = value.X * num2;
145 result.Y = value.Y * num2;
151 float num = value.X * value.X + value.Y *
value.Y;
152 float num2 = 1f / (float)
Math.
Sqrt(num);
153 result.X = value.X * num2;
154 result.Y = value.Y * num2;
159 float num = vector.X * normal.X + vector.Y * normal.
Y;
161 result.X = vector.X - 2f * num * normal.
X;
162 result.Y = vector.Y - 2f * num * normal.
Y;
168 float num = vector.X * normal.X + vector.Y * normal.Y;
169 result.X = vector.X - 2f * num * normal.X;
170 result.Y = vector.Y - 2f * num * normal.Y;
176 result.X = ((value1.X < value2.
X) ? value1.
X : value2.
X);
177 result.Y = ((value1.Y < value2.
Y) ? value1.
Y : value2.
Y);
183 result.X = ((value1.X < value2.X) ? value1.X : value2.X);
184 result.Y = ((value1.Y < value2.Y) ? value1.Y : value2.Y);
190 result.X = ((value1.X > value2.
X) ? value1.
X : value2.
X);
191 result.Y = ((value1.Y > value2.
Y) ? value1.
Y : value2.
Y);
197 result.X = ((value1.X > value2.X) ? value1.X : value2.X);
198 result.Y = ((value1.Y > value2.Y) ? value1.Y : value2.Y);
204 x = ((x > max.
X) ? max.
X : x);
205 x = ((x < min.
X) ? min.
X : x);
207 y = ((y > max.
Y) ? max.
Y : y);
208 y = ((y < min.
Y) ? min.
Y : y);
218 x = ((x > max.X) ? max.X : x);
219 x = ((x < min.X) ? min.X : x);
221 y = ((y > max.Y) ? max.Y : y);
222 y = ((y < min.Y) ? min.Y : y);
230 result.X = value1.X + (value2.X - value1.
X) * amount;
231 result.Y = value1.Y + (value2.Y - value1.
Y) * amount;
237 result.X = value1.X + (value2.X - value1.X) * amount;
238 result.Y = value1.Y + (value2.Y - value1.Y) * amount;
244 result.X = value1.X + amount1 * (value2.X - value1.
X) + amount2 * (value3.
X - value1.
X);
245 result.Y = value1.Y + amount1 * (value2.Y - value1.
Y) + amount2 * (value3.
Y - value1.
Y);
251 result.X = value1.X + amount1 * (value2.X - value1.X) + amount2 * (value3.X - value1.X);
252 result.Y = value1.Y + amount1 * (value2.Y - value1.Y) + amount2 * (value3.Y - value1.Y);
257 amount = ((amount > 1f) ? 1f : ((amount < 0f) ? 0f : amount));
258 amount = amount * amount * (3f - 2f * amount);
260 result.X = value1.X + (value2.X - value1.
X) * amount;
261 result.Y = value1.Y + (value2.Y - value1.
Y) * amount;
267 amount = ((amount > 1f) ? 1f : ((amount < 0f) ? 0f : amount));
268 amount = amount * amount * (3f - 2f * amount);
269 result.X = value1.X + (value2.X - value1.X) * amount;
270 result.Y = value1.Y + (value2.Y - value1.Y) * amount;
275 float num = amount * amount;
276 float num2 = amount * num;
278 result.X = 0.5f * (2f * value2.X + (0f - value1.X + value3.
X) * amount + (2f * value1.
X - 5f * value2.
X + 4f * value3.
X - value4.
X) * num + (0f - value1.X + 3f * value2.X - 3f * value3.X + value4.
X) * num2);
279 result.Y = 0.5f * (2f * value2.Y + (0f - value1.Y + value3.
Y) * amount + (2f * value1.
Y - 5f * value2.
Y + 4f * value3.
Y - value4.
Y) * num + (0f - value1.Y + 3f * value2.Y - 3f * value3.Y + value4.
Y) * num2);
285 float num = amount * amount;
286 float num2 = amount * num;
287 result.X = 0.5f * (2f * value2.X + (0f - value1.X + value3.X) * amount + (2f * value1.X - 5f * value2.X + 4f * value3.X - value4.X) * num + (0f - value1.X + 3f * value2.X - 3f * value3.X + value4.X) * num2);
288 result.Y = 0.5f * (2f * value2.Y + (0f - value1.Y + value3.Y) * amount + (2f * value1.Y - 5f * value2.Y + 4f * value3.Y - value4.Y) * num + (0f - value1.Y + 3f * value2.Y - 3f * value3.Y + value4.Y) * num2);
293 float num = amount * amount;
294 float num2 = amount * num;
295 float num3 = 2f * num2 - 3f * num + 1f;
296 float num4 = -2f * num2 + 3f * num;
297 float num5 = num2 - 2f * num + amount;
298 float num6 = num2 - num;
300 result.X = value1.X * num3 + value2.X * num4 + tangent1.X * num5 + tangent2.X * num6;
301 result.Y = value1.Y * num3 + value2.Y * num4 + tangent1.Y * num5 + tangent2.Y * num6;
307 float num = amount * amount;
308 float num2 = amount * num;
309 float num3 = 2f * num2 - 3f * num + 1f;
310 float num4 = -2f * num2 + 3f * num;
311 float num5 = num2 - 2f * num + amount;
312 float num6 = num2 - num;
313 result.X = value1.X * num3 + value2.X * num4 + tangent1.X * num5 + tangent2.X * num6;
314 result.Y = value1.Y * num3 + value2.Y * num4 + tangent1.Y * num5 + tangent2.Y * num6;
319 float x = position.X * matrix.M11 + position.Y * matrix.M21 + matrix.
M41;
320 float y = position.X * matrix.M12 + position.Y * matrix.M22 + matrix.
M42;
329 float x = position.X * matrix.M11 + position.Y * matrix.M21 + matrix.M41;
330 float y = position.X * matrix.M12 + position.Y * matrix.M22 + matrix.M42;
337 float x = normal.X * matrix.M11 + normal.Y * matrix.
M21;
338 float y = normal.X * matrix.M12 + normal.Y * matrix.
M22;
347 float x = normal.X * matrix.M11 + normal.Y * matrix.M21;
348 float y = normal.X * matrix.M12 + normal.Y * matrix.M22;
355 float num = rotation.X + rotation.
X;
356 float num2 = rotation.Y + rotation.
Y;
357 float num3 = rotation.Z + rotation.
Z;
358 float num4 = rotation.W * num3;
359 float num5 = rotation.X * num;
360 float num6 = rotation.X * num2;
361 float num7 = rotation.Y * num2;
362 float num8 = rotation.Z * num3;
363 float x = value.X * (1f - num7 - num8) +
value.Y * (num6 - num4);
364 float y = value.X * (num6 + num4) +
value.Y * (1f - num5 - num8);
373 float num = rotation.X + rotation.X;
374 float num2 = rotation.Y + rotation.Y;
375 float num3 = rotation.Z + rotation.Z;
376 float num4 = rotation.W * num3;
377 float num5 = rotation.X * num;
378 float num6 = rotation.X * num2;
379 float num7 = rotation.Y * num2;
380 float num8 = rotation.Z * num3;
381 float x = value.X * (1f - num7 - num8) +
value.Y * (num6 - num4);
382 float y = value.X * (num6 + num4) +
value.Y * (1f - num5 - num8);
410 [SuppressMessage(
"Microsoft.Usage",
"CA2233")]
464 [SuppressMessage(
"Microsoft.Usage",
"CA2233")]
509 float num = rotation.X + rotation.X;
510 float num2 = rotation.Y + rotation.Y;
511 float num3 = rotation.Z + rotation.Z;
512 float num4 = rotation.W * num3;
513 float num5 = rotation.X * num;
514 float num6 = rotation.X * num2;
515 float num7 = rotation.Y * num2;
516 float num8 = rotation.Z * num3;
517 float num9 = 1f - num7 - num8;
518 float num10 = num6 - num4;
519 float num11 = num6 + num4;
520 float num12 = 1f - num5 - num8;
530 [SuppressMessage(
"Microsoft.Usage",
"CA2233")]
549 float num = rotation.X + rotation.X;
550 float num2 = rotation.Y + rotation.Y;
551 float num3 = rotation.Z + rotation.Z;
552 float num4 = rotation.W * num3;
553 float num5 = rotation.X * num;
554 float num6 = rotation.X * num2;
555 float num7 = rotation.Y * num2;
556 float num8 = rotation.Z * num3;
557 float num9 = 1f - num7 - num8;
558 float num10 = num6 - num4;
559 float num11 = num6 + num4;
560 float num12 = 1f - num5 - num8;
577 result.Y = 0f -
value.Y;
583 result.X = 0f -
value.X;
584 result.Y = 0f -
value.Y;
590 result.X = value1.X + value2.
X;
591 result.Y = value1.Y + value2.
Y;
597 result.X = value1.X + value2.X;
598 result.Y = value1.Y + value2.Y;
604 result.X = value1.X - value2.
X;
605 result.Y = value1.Y - value2.
Y;
611 result.X = value1.X - value2.X;
612 result.Y = value1.Y - value2.Y;
618 result.X = value1.X * value2.
X;
619 result.Y = value1.Y * value2.
Y;
625 result.X = value1.X * value2.X;
626 result.Y = value1.Y * value2.Y;
632 result.X = value1.X * scaleFactor;
633 result.Y = value1.Y * scaleFactor;
639 result.X = value1.X * scaleFactor;
640 result.Y = value1.Y * scaleFactor;
646 result.X = value1.X / value2.
X;
647 result.Y = value1.Y / value2.
Y;
653 result.X = value1.X / value2.X;
654 result.Y = value1.Y / value2.Y;
659 float num = 1f / divider;
661 result.X = value1.X * num;
662 result.Y = value1.Y * num;
668 float num = 1f / divider;
669 result.X = value1.X * num;
670 result.Y = value1.Y * num;
677 result.Y = 0f -
value.Y;
683 if (value1.
X == value2.
X)
685 return value1.Y == value2.
Y;
692 if (value1.
X == value2.
X)
694 return value1.Y != value2.
Y;
702 result.X = value1.X + value2.
X;
703 result.Y = value1.Y + value2.
Y;
710 result.X = value1.X - value2.
X;
711 result.Y = value1.Y - value2.
Y;
718 result.X = value1.X * value2.
X;
719 result.Y = value1.Y * value2.
Y;
726 result.X = value.X * scaleFactor;
727 result.Y = value.Y * scaleFactor;
734 result.X = value.X * scaleFactor;
735 result.Y = value.Y * scaleFactor;
742 result.X = value1.X / value2.
X;
743 result.Y = value1.Y / value2.
Y;
749 float num = 1f / divider;
751 result.X = value1.X * num;
752 result.Y = value1.Y * num;
static string NotEnoughSourceSize
static string NotEnoughTargetSize
static CultureInfo CurrentCulture
static double Sqrt(double d)
bool Equals(Vector2 other)
static void Multiply(ref Vector2 value1, ref Vector2 value2, out Vector2 result)
static Vector2 Divide(Vector2 value1, float divider)
static void CatmullRom(ref Vector2 value1, ref Vector2 value2, ref Vector2 value3, ref Vector2 value4, float amount, out Vector2 result)
override bool Equals(object obj)
static float Dot(Vector2 value1, Vector2 value2)
static Vector2 operator*(Vector2 value1, Vector2 value2)
static void Multiply(ref Vector2 value1, float scaleFactor, out Vector2 result)
static void TransformNormal(ref Vector2 normal, ref Matrix matrix, out Vector2 result)
static Vector2 Negate(Vector2 value)
static Vector2 Clamp(Vector2 value1, Vector2 min, Vector2 max)
static Vector2 Reflect(Vector2 vector, Vector2 normal)
static Vector2 Multiply(Vector2 value1, float scaleFactor)
static void DistanceSquared(ref Vector2 value1, ref Vector2 value2, out float result)
static void Divide(ref Vector2 value1, ref Vector2 value2, out Vector2 result)
static Vector2 Min(Vector2 value1, Vector2 value2)
static Vector2 Barycentric(Vector2 value1, Vector2 value2, Vector2 value3, float amount1, float amount2)
static Vector2 Normalize(Vector2 value)
static Vector2 CatmullRom(Vector2 value1, Vector2 value2, Vector2 value3, Vector2 value4, float amount)
static bool operator==(Vector2 value1, Vector2 value2)
static Vector2 Subtract(Vector2 value1, Vector2 value2)
static Vector2 Transform(Vector2 position, Matrix matrix)
static void Add(ref Vector2 value1, ref Vector2 value2, out Vector2 result)
static void SmoothStep(ref Vector2 value1, ref Vector2 value2, float amount, out Vector2 result)
static Vector2 TransformNormal(Vector2 normal, Matrix matrix)
static void TransformNormal(Vector2[] sourceArray, int sourceIndex, ref Matrix matrix, Vector2[] destinationArray, int destinationIndex, int length)
static void Subtract(ref Vector2 value1, ref Vector2 value2, out Vector2 result)
static void Dot(ref Vector2 value1, ref Vector2 value2, out float result)
static bool operator!=(Vector2 value1, Vector2 value2)
static void Transform(Vector2[] sourceArray, int sourceIndex, ref Matrix matrix, Vector2[] destinationArray, int destinationIndex, int length)
static void Transform(Vector2[] sourceArray, int sourceIndex, ref Quaternion rotation, Vector2[] destinationArray, int destinationIndex, int length)
static Vector2 Transform(Vector2 value, Quaternion rotation)
static void Transform(ref Vector2 value, ref Quaternion rotation, out Vector2 result)
static Vector2 SmoothStep(Vector2 value1, Vector2 value2, float amount)
static Vector2 Add(Vector2 value1, Vector2 value2)
static void Clamp(ref Vector2 value1, ref Vector2 min, ref Vector2 max, out Vector2 result)
static Vector2 Divide(Vector2 value1, Vector2 value2)
static void TransformNormal(Vector2[] sourceArray, ref Matrix matrix, Vector2[] destinationArray)
static void Barycentric(ref Vector2 value1, ref Vector2 value2, ref Vector2 value3, float amount1, float amount2, out Vector2 result)
static Vector2 operator-(Vector2 value)
static void Max(ref Vector2 value1, ref Vector2 value2, out Vector2 result)
override string ToString()
static void Negate(ref Vector2 value, out Vector2 result)
static void Lerp(ref Vector2 value1, ref Vector2 value2, float amount, out Vector2 result)
static void Distance(ref Vector2 value1, ref Vector2 value2, out float result)
static void Min(ref Vector2 value1, ref Vector2 value2, out Vector2 result)
static Vector2 operator+(Vector2 value1, Vector2 value2)
static Vector2 Max(Vector2 value1, Vector2 value2)
static void Reflect(ref Vector2 vector, ref Vector2 normal, out Vector2 result)
static void Hermite(ref Vector2 value1, ref Vector2 tangent1, ref Vector2 value2, ref Vector2 tangent2, float amount, out Vector2 result)
static void Transform(Vector2[] sourceArray, ref Quaternion rotation, Vector2[] destinationArray)
static Vector2 operator/(Vector2 value1, Vector2 value2)
static float DistanceSquared(Vector2 value1, Vector2 value2)
static float Distance(Vector2 value1, Vector2 value2)
static void Divide(ref Vector2 value1, float divider, out Vector2 result)
static Vector2 Hermite(Vector2 value1, Vector2 tangent1, Vector2 value2, Vector2 tangent2, float amount)
static void Transform(ref Vector2 position, ref Matrix matrix, out Vector2 result)
Vector2(float x, float y)
static void Normalize(ref Vector2 value, out Vector2 result)
static Vector2 Lerp(Vector2 value1, Vector2 value2, float amount)
static void Transform(Vector2[] sourceArray, ref Matrix matrix, Vector2[] destinationArray)
override int GetHashCode()
static Vector2 Multiply(Vector2 value1, Vector2 value2)