aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/ModifiedBulletX/ModifiedBulletX/LinearMath/Vector4.cs
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/ModifiedBulletX/ModifiedBulletX/LinearMath/Vector4.cs')
-rw-r--r--libraries/ModifiedBulletX/ModifiedBulletX/LinearMath/Vector4.cs220
1 files changed, 110 insertions, 110 deletions
diff --git a/libraries/ModifiedBulletX/ModifiedBulletX/LinearMath/Vector4.cs b/libraries/ModifiedBulletX/ModifiedBulletX/LinearMath/Vector4.cs
index a64ce97..de98ccd 100644
--- a/libraries/ModifiedBulletX/ModifiedBulletX/LinearMath/Vector4.cs
+++ b/libraries/ModifiedBulletX/ModifiedBulletX/LinearMath/Vector4.cs
@@ -1,110 +1,110 @@
1/* 1/*
2 Bullet for XNA Copyright (c) 2003-2007 Vsevolod Klementjev http://www.codeplex.com/xnadevru 2 Bullet for XNA Copyright (c) 2003-2007 Vsevolod Klementjev http://www.codeplex.com/xnadevru
3 Bullet original C++ version Copyright (c) 2003-2007 Erwin Coumans http://bulletphysics.com 3 Bullet original C++ version Copyright (c) 2003-2007 Erwin Coumans http://bulletphysics.com
4 4
5 This software is provided 'as-is', without any express or implied 5 This software is provided 'as-is', without any express or implied
6 warranty. In no event will the authors be held liable for any damages 6 warranty. In no event will the authors be held liable for any damages
7 arising from the use of this software. 7 arising from the use of this software.
8 8
9 Permission is granted to anyone to use this software for any purpose, 9 Permission is granted to anyone to use this software for any purpose,
10 including commercial applications, and to alter it and redistribute it 10 including commercial applications, and to alter it and redistribute it
11 freely, subject to the following restrictions: 11 freely, subject to the following restrictions:
12 12
13 1. The origin of this software must not be misrepresented; you must not 13 1. The origin of this software must not be misrepresented; you must not
14 claim that you wrote the original software. If you use this software 14 claim that you wrote the original software. If you use this software
15 in a product, an acknowledgment in the product documentation would be 15 in a product, an acknowledgment in the product documentation would be
16 appreciated but is not required. 16 appreciated but is not required.
17 2. Altered source versions must be plainly marked as such, and must not be 17 2. Altered source versions must be plainly marked as such, and must not be
18 misrepresented as being the original software. 18 misrepresented as being the original software.
19 3. This notice may not be removed or altered from any source distribution. 19 3. This notice may not be removed or altered from any source distribution.
20*/ 20*/
21 21
22using System; 22using System;
23using System.Collections.Generic; 23using System.Collections.Generic;
24using System.Text; 24using System.Text;
25 25
26namespace XnaDevRu.BulletX.LinearMath 26namespace XnaDevRu.BulletX.LinearMath
27{ 27{
28 internal class Vector4 : Vector3 28 internal class Vector4 : Vector3
29 { 29 {
30 public Vector4() { } 30 public Vector4() { }
31 31
32 public Vector4(float x, float y, float z, float w) 32 public Vector4(float x, float y, float z, float w)
33 : base(x, y, z) { W = w; } 33 : base(x, y, z) { W = w; }
34 34
35 public static Vector4 Absolute4(Vector4 a) 35 public static Vector4 Absolute4(Vector4 a)
36 { 36 {
37 return new Vector4( 37 return new Vector4(
38 Math.Abs(a.X), 38 Math.Abs(a.X),
39 Math.Abs(a.Y), 39 Math.Abs(a.Y),
40 Math.Abs(a.Z), 40 Math.Abs(a.Z),
41 Math.Abs(a.W)); 41 Math.Abs(a.W));
42 } 42 }
43 43
44 public int MaxAxis4() 44 public int MaxAxis4()
45 { 45 {
46 int maxIndex = -1; 46 int maxIndex = -1;
47 float maxVal = -1e30f; 47 float maxVal = -1e30f;
48 if (X > maxVal) 48 if (X > maxVal)
49 { 49 {
50 maxIndex = 0; 50 maxIndex = 0;
51 maxVal = X; 51 maxVal = X;
52 } 52 }
53 if (Y > maxVal) 53 if (Y > maxVal)
54 { 54 {
55 maxIndex = 1; 55 maxIndex = 1;
56 maxVal = Y; 56 maxVal = Y;
57 } 57 }
58 if (Z > maxVal) 58 if (Z > maxVal)
59 { 59 {
60 maxIndex = 2; 60 maxIndex = 2;
61 maxVal = Z; 61 maxVal = Z;
62 } 62 }
63 if (W > maxVal) 63 if (W > maxVal)
64 { 64 {
65 maxIndex = 3; 65 maxIndex = 3;
66 maxVal = W; 66 maxVal = W;
67 } 67 }
68 68
69 return maxIndex; 69 return maxIndex;
70 } 70 }
71 71
72 public int MinAxis4() 72 public int MinAxis4()
73 { 73 {
74 int minIndex = -1; 74 int minIndex = -1;
75 float minVal = 1e30f; 75 float minVal = 1e30f;
76 if (X < minVal) 76 if (X < minVal)
77 { 77 {
78 minIndex = 0; 78 minIndex = 0;
79 minVal = X; 79 minVal = X;
80 } 80 }
81 if (Y < minVal) 81 if (Y < minVal)
82 { 82 {
83 minIndex = 1; 83 minIndex = 1;
84 minVal = Y; 84 minVal = Y;
85 } 85 }
86 if (Z < minVal) 86 if (Z < minVal)
87 { 87 {
88 minIndex = 2; 88 minIndex = 2;
89 minVal = Z; 89 minVal = Z;
90 } 90 }
91 if (W < minVal) 91 if (W < minVal)
92 { 92 {
93 minIndex = 3; 93 minIndex = 3;
94 minVal = W; 94 minVal = W;
95 } 95 }
96 96
97 return minIndex; 97 return minIndex;
98 } 98 }
99 99
100 public int ClosestAxis4() 100 public int ClosestAxis4()
101 { 101 {
102 return Absolute4(this).MaxAxis4(); 102 return Absolute4(this).MaxAxis4();
103 } 103 }
104 104
105 public static explicit operator MonoXnaCompactMaths.Vector4(Vector4 a) 105 public static explicit operator MonoXnaCompactMaths.Vector4(Vector4 a)
106 { 106 {
107 return new MonoXnaCompactMaths.Vector4(a.X, a.Y, a.Z, a.W); 107 return new MonoXnaCompactMaths.Vector4(a.X, a.Y, a.Z, a.W);
108 } 108 }
109 } 109 }
110} 110}