5using Microsoft.Xna.Framework.Design;
13 [SuppressMessage(
"Microsoft.Design",
"CA1051:DoNotDeclareVisibleInstanceFields")]
16 [SuppressMessage(
"Microsoft.Design",
"CA1051:DoNotDeclareVisibleInstanceFields")]
19 [SuppressMessage(
"Microsoft.Design",
"CA1051:DoNotDeclareVisibleInstanceFields")]
88 return string.Format(currentCulture,
"{{X:{0} Y:{1} Z:{2}}}",
new object[3]
90 X.ToString(currentCulture),
91 Y.ToString(currentCulture),
92 Z.ToString(currentCulture)
117 return X.GetHashCode() +
Y.GetHashCode() +
Z.GetHashCode();
122 float num =
X *
X +
Y *
Y +
Z *
Z;
128 return X *
X +
Y *
Y +
Z *
Z;
133 float num = value1.X - value2.
X;
134 float num2 = value1.Y - value2.
Y;
135 float num3 = value1.Z - value2.
Z;
136 float num4 = num * num + num2 * num2 + num3 * num3;
142 float num = value1.X - value2.X;
143 float num2 = value1.Y - value2.Y;
144 float num3 = value1.Z - value2.Z;
145 float num4 = num * num + num2 * num2 + num3 * num3;
151 float num = value1.X - value2.
X;
152 float num2 = value1.Y - value2.
Y;
153 float num3 = value1.Z - value2.
Z;
154 return num * num + num2 * num2 + num3 * num3;
159 float num = value1.X - value2.X;
160 float num2 = value1.Y - value2.Y;
161 float num3 = value1.Z - value2.Z;
162 result = num * num + num2 * num2 + num3 * num3;
167 return vector1.X * vector2.X + vector1.Y * vector2.Y + vector1.Z * vector2.
Z;
172 result = vector1.X * vector2.X + vector1.Y * vector2.Y + vector1.Z * vector2.Z;
177 float num =
X *
X +
Y *
Y +
Z *
Z;
178 float num2 = 1f / (float)
Math.
Sqrt(num);
186 float num = value.X * value.X + value.Y * value.Y + value.Z *
value.Z;
187 float num2 = 1f / (float)
Math.
Sqrt(num);
189 result.X = value.X * num2;
190 result.Y = value.Y * num2;
191 result.Z = value.Z * num2;
197 float num = value.X * value.X + value.Y * value.Y + value.Z *
value.Z;
198 float num2 = 1f / (float)
Math.
Sqrt(num);
199 result.X = value.X * num2;
200 result.Y = value.Y * num2;
201 result.Z = value.Z * num2;
207 result.X = vector1.Y * vector2.Z - vector1.Z * vector2.
Y;
208 result.Y = vector1.Z * vector2.X - vector1.X * vector2.
Z;
209 result.Z = vector1.X * vector2.Y - vector1.Y * vector2.
X;
215 float x = vector1.Y * vector2.Z - vector1.Z * vector2.Y;
216 float y = vector1.Z * vector2.X - vector1.X * vector2.Z;
217 float z = vector1.X * vector2.Y - vector1.Y * vector2.X;
225 float num = vector.X * normal.X + vector.Y * normal.Y + vector.Z * normal.
Z;
227 result.X = vector.X - 2f * num * normal.
X;
228 result.Y = vector.Y - 2f * num * normal.
Y;
229 result.Z = vector.Z - 2f * num * normal.
Z;
235 float num = vector.X * normal.X + vector.Y * normal.Y + vector.Z * normal.Z;
236 result.X = vector.X - 2f * num * normal.X;
237 result.Y = vector.Y - 2f * num * normal.Y;
238 result.Z = vector.Z - 2f * num * normal.Z;
244 result.X = ((value1.X < value2.
X) ? value1.
X : value2.
X);
245 result.Y = ((value1.Y < value2.
Y) ? value1.
Y : value2.
Y);
246 result.Z = ((value1.Z < value2.
Z) ? value1.
Z : value2.
Z);
252 result.X = ((value1.X < value2.X) ? value1.X : value2.X);
253 result.Y = ((value1.Y < value2.Y) ? value1.Y : value2.Y);
254 result.Z = ((value1.Z < value2.Z) ? value1.Z : value2.Z);
260 result.X = ((value1.X > value2.
X) ? value1.
X : value2.
X);
261 result.Y = ((value1.Y > value2.
Y) ? value1.
Y : value2.
Y);
262 result.Z = ((value1.Z > value2.
Z) ? value1.
Z : value2.
Z);
268 result.X = ((value1.X > value2.X) ? value1.X : value2.X);
269 result.Y = ((value1.Y > value2.Y) ? value1.Y : value2.Y);
270 result.Z = ((value1.Z > value2.Z) ? value1.Z : value2.Z);
276 x = ((x > max.
X) ? max.
X : x);
277 x = ((x < min.
X) ? min.
X : x);
279 y = ((y > max.
Y) ? max.
Y : y);
280 y = ((y < min.
Y) ? min.
Y : y);
282 z = ((z > max.
Z) ? max.
Z : z);
283 z = ((z < min.
Z) ? min.
Z : z);
294 x = ((x > max.X) ? max.X : x);
295 x = ((x < min.X) ? min.X : x);
297 y = ((y > max.Y) ? max.Y : y);
298 y = ((y < min.Y) ? min.Y : y);
300 z = ((z > max.Z) ? max.Z : z);
301 z = ((z < min.Z) ? min.Z : z);
310 result.X = value1.X + (value2.X - value1.
X) * amount;
311 result.Y = value1.Y + (value2.Y - value1.
Y) * amount;
312 result.Z = value1.Z + (value2.Z - value1.
Z) * amount;
318 result.X = value1.X + (value2.X - value1.X) * amount;
319 result.Y = value1.Y + (value2.Y - value1.Y) * amount;
320 result.Z = value1.Z + (value2.Z - value1.Z) * amount;
326 result.X = value1.X + amount1 * (value2.X - value1.
X) + amount2 * (value3.
X - value1.
X);
327 result.Y = value1.Y + amount1 * (value2.Y - value1.
Y) + amount2 * (value3.
Y - value1.
Y);
328 result.Z = value1.Z + amount1 * (value2.Z - value1.
Z) + amount2 * (value3.
Z - value1.
Z);
334 result.X = value1.X + amount1 * (value2.X - value1.X) + amount2 * (value3.X - value1.X);
335 result.Y = value1.Y + amount1 * (value2.Y - value1.Y) + amount2 * (value3.Y - value1.Y);
336 result.Z = value1.Z + amount1 * (value2.Z - value1.Z) + amount2 * (value3.Z - value1.Z);
341 amount = ((amount > 1f) ? 1f : ((amount < 0f) ? 0f : amount));
342 amount = amount * amount * (3f - 2f * amount);
344 result.X = value1.X + (value2.X - value1.
X) * amount;
345 result.Y = value1.Y + (value2.Y - value1.
Y) * amount;
346 result.Z = value1.Z + (value2.Z - value1.
Z) * amount;
352 amount = ((amount > 1f) ? 1f : ((amount < 0f) ? 0f : amount));
353 amount = amount * amount * (3f - 2f * amount);
354 result.X = value1.X + (value2.X - value1.X) * amount;
355 result.Y = value1.Y + (value2.Y - value1.Y) * amount;
356 result.Z = value1.Z + (value2.Z - value1.Z) * amount;
361 float num = amount * amount;
362 float num2 = amount * num;
364 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);
365 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);
366 result.Z = 0.5f * (2f * value2.Z + (0f - value1.Z + value3.
Z) * amount + (2f * value1.
Z - 5f * value2.
Z + 4f * value3.
Z - value4.
Z) * num + (0f - value1.Z + 3f * value2.Z - 3f * value3.Z + value4.
Z) * num2);
372 float num = amount * amount;
373 float num2 = amount * num;
374 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);
375 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);
376 result.Z = 0.5f * (2f * value2.Z + (0f - value1.Z + value3.Z) * amount + (2f * value1.Z - 5f * value2.Z + 4f * value3.Z - value4.Z) * num + (0f - value1.Z + 3f * value2.Z - 3f * value3.Z + value4.Z) * num2);
381 float num = amount * amount;
382 float num2 = amount * num;
383 float num3 = 2f * num2 - 3f * num + 1f;
384 float num4 = -2f * num2 + 3f * num;
385 float num5 = num2 - 2f * num + amount;
386 float num6 = num2 - num;
388 result.X = value1.X * num3 + value2.X * num4 + tangent1.X * num5 + tangent2.X * num6;
389 result.Y = value1.Y * num3 + value2.Y * num4 + tangent1.Y * num5 + tangent2.Y * num6;
390 result.Z = value1.Z * num3 + value2.Z * num4 + tangent1.Z * num5 + tangent2.Z * num6;
396 float num = amount * amount;
397 float num2 = amount * num;
398 float num3 = 2f * num2 - 3f * num + 1f;
399 float num4 = -2f * num2 + 3f * num;
400 float num5 = num2 - 2f * num + amount;
401 float num6 = num2 - num;
402 result.X = value1.X * num3 + value2.X * num4 + tangent1.X * num5 + tangent2.X * num6;
403 result.Y = value1.Y * num3 + value2.Y * num4 + tangent1.Y * num5 + tangent2.Y * num6;
404 result.Z = value1.Z * num3 + value2.Z * num4 + tangent1.Z * num5 + tangent2.Z * num6;
409 float x = position.X * matrix.M11 + position.Y * matrix.M21 + position.Z * matrix.M31 + matrix.
M41;
410 float y = position.X * matrix.M12 + position.Y * matrix.M22 + position.Z * matrix.M32 + matrix.
M42;
411 float z = position.X * matrix.M13 + position.Y * matrix.M23 + position.Z * matrix.M33 + matrix.
M43;
421 float x = position.X * matrix.M11 + position.Y * matrix.M21 + position.Z * matrix.M31 + matrix.M41;
422 float y = position.X * matrix.M12 + position.Y * matrix.M22 + position.Z * matrix.M32 + matrix.M42;
423 float z = position.X * matrix.M13 + position.Y * matrix.M23 + position.Z * matrix.M33 + matrix.M43;
431 float x = normal.X * matrix.M11 + normal.Y * matrix.M21 + normal.Z * matrix.
M31;
432 float y = normal.X * matrix.M12 + normal.Y * matrix.M22 + normal.Z * matrix.
M32;
433 float z = normal.X * matrix.M13 + normal.Y * matrix.M23 + normal.Z * matrix.
M33;
443 float x = normal.X * matrix.M11 + normal.Y * matrix.M21 + normal.Z * matrix.M31;
444 float y = normal.X * matrix.M12 + normal.Y * matrix.M22 + normal.Z * matrix.M32;
445 float z = normal.X * matrix.M13 + normal.Y * matrix.M23 + normal.Z * matrix.M33;
453 float num = rotation.X + rotation.
X;
454 float num2 = rotation.Y + rotation.
Y;
455 float num3 = rotation.Z + rotation.
Z;
456 float num4 = rotation.W * num;
457 float num5 = rotation.W * num2;
458 float num6 = rotation.W * num3;
459 float num7 = rotation.X * num;
460 float num8 = rotation.X * num2;
461 float num9 = rotation.X * num3;
462 float num10 = rotation.Y * num2;
463 float num11 = rotation.Y * num3;
464 float num12 = rotation.Z * num3;
465 float x = value.X * (1f - num10 - num12) +
value.Y * (num8 - num6) + value.Z * (num9 + num5);
466 float y = value.X * (num8 + num6) +
value.Y * (1f - num7 - num12) + value.Z * (num11 - num4);
467 float z = value.X * (num9 - num5) +
value.Y * (num11 + num4) + value.Z * (1f - num7 - num10);
477 float num = rotation.X + rotation.X;
478 float num2 = rotation.Y + rotation.Y;
479 float num3 = rotation.Z + rotation.Z;
480 float num4 = rotation.W * num;
481 float num5 = rotation.W * num2;
482 float num6 = rotation.W * num3;
483 float num7 = rotation.X * num;
484 float num8 = rotation.X * num2;
485 float num9 = rotation.X * num3;
486 float num10 = rotation.Y * num2;
487 float num11 = rotation.Y * num3;
488 float num12 = rotation.Z * num3;
489 float x = value.X * (1f - num10 - num12) +
value.Y * (num8 - num6) + value.Z * (num9 + num5);
490 float y = value.X * (num8 + num6) +
value.Y * (1f - num7 - num12) + value.Z * (num11 - num4);
491 float z = value.X * (num9 - num5) +
value.Y * (num11 + num4) + value.Z * (1f - num7 - num10);
516 destinationArray[i].X = x * matrix.M11 + y * matrix.M21 + z * matrix.M31 + matrix.M41;
517 destinationArray[i].Y = x * matrix.M12 + y * matrix.M22 + z * matrix.M32 + matrix.M42;
518 destinationArray[i].Z = x * matrix.M13 + y * matrix.M23 + z * matrix.M33 + matrix.M43;
522 [SuppressMessage(
"Microsoft.Usage",
"CA2233")]
580 [SuppressMessage(
"Microsoft.Usage",
"CA2233")]
627 float num = rotation.X + rotation.X;
628 float num2 = rotation.Y + rotation.Y;
629 float num3 = rotation.Z + rotation.Z;
630 float num4 = rotation.W * num;
631 float num5 = rotation.W * num2;
632 float num6 = rotation.W * num3;
633 float num7 = rotation.X * num;
634 float num8 = rotation.X * num2;
635 float num9 = rotation.X * num3;
636 float num10 = rotation.Y * num2;
637 float num11 = rotation.Y * num3;
638 float num12 = rotation.Z * num3;
639 float num13 = 1f - num10 - num12;
640 float num14 = num8 - num6;
641 float num15 = num9 + num5;
642 float num16 = num8 + num6;
643 float num17 = 1f - num7 - num12;
644 float num18 = num11 - num4;
645 float num19 = num9 - num5;
646 float num20 = num11 + num4;
647 float num21 = 1f - num7 - num10;
659 [SuppressMessage(
"Microsoft.Usage",
"CA2233")]
678 float num = rotation.X + rotation.X;
679 float num2 = rotation.Y + rotation.Y;
680 float num3 = rotation.Z + rotation.Z;
681 float num4 = rotation.W * num;
682 float num5 = rotation.W * num2;
683 float num6 = rotation.W * num3;
684 float num7 = rotation.X * num;
685 float num8 = rotation.X * num2;
686 float num9 = rotation.X * num3;
687 float num10 = rotation.Y * num2;
688 float num11 = rotation.Y * num3;
689 float num12 = rotation.Z * num3;
690 float num13 = 1f - num10 - num12;
691 float num14 = num8 - num6;
692 float num15 = num9 + num5;
693 float num16 = num8 + num6;
694 float num17 = 1f - num7 - num12;
695 float num18 = num11 - num4;
696 float num19 = num9 - num5;
697 float num20 = num11 + num4;
698 float num21 = 1f - num7 - num10;
717 result.Y = 0f -
value.Y;
718 result.Z = 0f -
value.Z;
724 result.X = 0f -
value.X;
725 result.Y = 0f -
value.Y;
726 result.Z = 0f -
value.Z;
732 result.X = value1.X + value2.
X;
733 result.Y = value1.Y + value2.
Y;
734 result.Z = value1.Z + value2.
Z;
740 result.X = value1.X + value2.X;
741 result.Y = value1.Y + value2.Y;
742 result.Z = value1.Z + value2.Z;
748 result.X = value1.X - value2.
X;
749 result.Y = value1.Y - value2.
Y;
750 result.Z = value1.Z - value2.
Z;
756 result.X = value1.X - value2.X;
757 result.Y = value1.Y - value2.Y;
758 result.Z = value1.Z - value2.Z;
764 result.X = value1.X * value2.
X;
765 result.Y = value1.Y * value2.
Y;
766 result.Z = value1.Z * value2.
Z;
772 result.X = value1.X * value2.X;
773 result.Y = value1.Y * value2.Y;
774 result.Z = value1.Z * value2.Z;
780 result.X = value1.X * scaleFactor;
781 result.Y = value1.Y * scaleFactor;
782 result.Z = value1.Z * scaleFactor;
788 result.X = value1.X * scaleFactor;
789 result.Y = value1.Y * scaleFactor;
790 result.Z = value1.Z * scaleFactor;
796 result.X = value1.X / value2.
X;
797 result.Y = value1.Y / value2.
Y;
798 result.Z = value1.Z / value2.
Z;
804 result.X = value1.X / value2.X;
805 result.Y = value1.Y / value2.Y;
806 result.Z = value1.Z / value2.Z;
811 float num = 1f / value2;
813 result.X = value1.X * num;
814 result.Y = value1.Y * num;
815 result.Z = value1.Z * num;
821 float num = 1f / value2;
822 result.X = value1.X * num;
823 result.Y = value1.Y * num;
824 result.Z = value1.Z * num;
831 result.Y = 0f -
value.Y;
832 result.Z = 0f -
value.Z;
838 if (value1.
X == value2.
X && value1.
Y == value2.
Y)
840 return value1.Z == value2.
Z;
847 if (value1.
X == value2.
X && value1.
Y == value2.
Y)
849 return value1.Z != value2.
Z;
857 result.X = value1.X + value2.
X;
858 result.Y = value1.Y + value2.
Y;
859 result.Z = value1.Z + value2.
Z;
866 result.X = value1.X - value2.
X;
867 result.Y = value1.Y - value2.
Y;
868 result.Z = value1.Z - value2.
Z;
875 result.X = value1.X * value2.
X;
876 result.Y = value1.Y * value2.
Y;
877 result.Z = value1.Z * value2.
Z;
884 result.X = value.X * scaleFactor;
885 result.Y = value.Y * scaleFactor;
886 result.Z = value.Z * scaleFactor;
893 result.X = value.X * scaleFactor;
894 result.Y = value.Y * scaleFactor;
895 result.Z = value.Z * scaleFactor;
902 result.X = value1.X / value2.
X;
903 result.Y = value1.Y / value2.
Y;
904 result.Z = value1.Z / value2.
Z;
910 float num = 1f / divider;
912 result.X = value.X * num;
913 result.Y = value.Y * num;
914 result.Z = value.Z * num;
static string NotEnoughSourceSize
static string NotEnoughTargetSize
static CultureInfo CurrentCulture
static double Sqrt(double d)
static void Divide(ref Vector3 value1, ref Vector3 value2, out Vector3 result)
static bool operator!=(Vector3 value1, Vector3 value2)
static void Lerp(ref Vector3 value1, ref Vector3 value2, float amount, out Vector3 result)
static void Barycentric(ref Vector3 value1, ref Vector3 value2, ref Vector3 value3, float amount1, float amount2, out Vector3 result)
static bool operator==(Vector3 value1, Vector3 value2)
static Vector3 TransformNormal(Vector3 normal, Matrix matrix)
static void Transform(Vector3[] sourceArray, ref Quaternion rotation, Vector3[] destinationArray)
static void Cross(ref Vector3 vector1, ref Vector3 vector2, out Vector3 result)
static Vector3 Clamp(Vector3 value1, Vector3 min, Vector3 max)
static void Reflect(ref Vector3 vector, ref Vector3 normal, out Vector3 result)
static Vector3 Multiply(Vector3 value1, Vector3 value2)
static void Max(ref Vector3 value1, ref Vector3 value2, out Vector3 result)
static void Distance(ref Vector3 value1, ref Vector3 value2, out float result)
static Vector3 Min(Vector3 value1, Vector3 value2)
static Vector3 Add(Vector3 value1, Vector3 value2)
static float Dot(Vector3 vector1, Vector3 vector2)
static void Transform(Vector3[] sourceArray, int sourceIndex, ref Matrix matrix, Vector3[] destinationArray, int destinationIndex, int length)
static Vector3 Transform(Vector3 position, Matrix matrix)
static Vector3 Subtract(Vector3 value1, Vector3 value2)
static void Add(ref Vector3 value1, ref Vector3 value2, out Vector3 result)
Vector3(Vector2 value, float z)
static Vector3 operator/(Vector3 value1, Vector3 value2)
static Vector3 operator*(Vector3 value1, Vector3 value2)
static Vector3 SmoothStep(Vector3 value1, Vector3 value2, float amount)
static void Transform(Vector3[] sourceArray, int sourceIndex, ref Quaternion rotation, Vector3[] destinationArray, int destinationIndex, int length)
static void Subtract(ref Vector3 value1, ref Vector3 value2, out Vector3 result)
static Vector3 Barycentric(Vector3 value1, Vector3 value2, Vector3 value3, float amount1, float amount2)
static void Min(ref Vector3 value1, ref Vector3 value2, out Vector3 result)
static void Multiply(ref Vector3 value1, float scaleFactor, out Vector3 result)
static void Normalize(ref Vector3 value, out Vector3 result)
static Vector3 Hermite(Vector3 value1, Vector3 tangent1, Vector3 value2, Vector3 tangent2, float amount)
bool Equals(Vector3 other)
static void TransformNormal(ref Vector3 normal, ref Matrix matrix, out Vector3 result)
static void Dot(ref Vector3 vector1, ref Vector3 vector2, out float result)
static void Divide(ref Vector3 value1, float value2, out Vector3 result)
static void CatmullRom(ref Vector3 value1, ref Vector3 value2, ref Vector3 value3, ref Vector3 value4, float amount, out Vector3 result)
static void TransformNormal(Vector3[] sourceArray, ref Matrix matrix, Vector3[] destinationArray)
static Vector3 Negate(Vector3 value)
static void Hermite(ref Vector3 value1, ref Vector3 tangent1, ref Vector3 value2, ref Vector3 tangent2, float amount, out Vector3 result)
static Vector3 Divide(Vector3 value1, float value2)
static void SmoothStep(ref Vector3 value1, ref Vector3 value2, float amount, out Vector3 result)
static Vector3 operator+(Vector3 value1, Vector3 value2)
override string ToString()
static void Transform(Vector3[] sourceArray, ref Matrix matrix, Vector3[] destinationArray)
static Vector3 Max(Vector3 value1, Vector3 value2)
override bool Equals(object obj)
static void Clamp(ref Vector3 value1, ref Vector3 min, ref Vector3 max, out Vector3 result)
static Vector3 Lerp(Vector3 value1, Vector3 value2, float amount)
static void Transform(ref Vector3 value, ref Quaternion rotation, out Vector3 result)
static void Negate(ref Vector3 value, out Vector3 result)
static Vector3 Normalize(Vector3 value)
static Vector3 CatmullRom(Vector3 value1, Vector3 value2, Vector3 value3, Vector3 value4, float amount)
static void TransformNormal(Vector3[] sourceArray, int sourceIndex, ref Matrix matrix, Vector3[] destinationArray, int destinationIndex, int length)
static float Distance(Vector3 value1, Vector3 value2)
static Vector3 Divide(Vector3 value1, Vector3 value2)
static Vector3 Multiply(Vector3 value1, float scaleFactor)
Vector3(float x, float y, float z)
static void Transform(ref Vector3 position, ref Matrix matrix, out Vector3 result)
override int GetHashCode()
static void DistanceSquared(ref Vector3 value1, ref Vector3 value2, out float result)
static void Multiply(ref Vector3 value1, ref Vector3 value2, out Vector3 result)
static Vector3 Reflect(Vector3 vector, Vector3 normal)
static Vector3 Cross(Vector3 vector1, Vector3 vector2)
static float DistanceSquared(Vector3 value1, Vector3 value2)
static Vector3 operator-(Vector3 value)
static Vector3 Transform(Vector3 value, Quaternion rotation)