diff options
author | Sean Dague | 2007-07-16 15:40:11 +0000 |
---|---|---|
committer | Sean Dague | 2007-07-16 15:40:11 +0000 |
commit | 2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6 (patch) | |
tree | e3f80ad51736cf17e856547b1bcf956010927434 /libraries/ModifiedBulletX/MonoXnaCompactMaths | |
parent | *Trunk compiles now (diff) | |
download | opensim-SC-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.zip opensim-SC-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.tar.gz opensim-SC-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.tar.bz2 opensim-SC-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.tar.xz |
changed to native line ending encoding
Diffstat (limited to 'libraries/ModifiedBulletX/MonoXnaCompactMaths')
6 files changed, 2362 insertions, 2362 deletions
diff --git a/libraries/ModifiedBulletX/MonoXnaCompactMaths/Matrix.cs b/libraries/ModifiedBulletX/MonoXnaCompactMaths/Matrix.cs index a104d89..22842ca 100644 --- a/libraries/ModifiedBulletX/MonoXnaCompactMaths/Matrix.cs +++ b/libraries/ModifiedBulletX/MonoXnaCompactMaths/Matrix.cs | |||
@@ -1,683 +1,683 @@ | |||
1 | #region License | 1 | #region License |
2 | /* | 2 | /* |
3 | MIT License | 3 | MIT License |
4 | Copyright © 2006 The Mono.Xna Team | 4 | Copyright © 2006 The Mono.Xna Team |
5 | 5 | ||
6 | All rights reserved. | 6 | All rights reserved. |
7 | 7 | ||
8 | Permission is hereby granted, free of charge, to any person obtaining a copy | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy |
9 | of this software and associated documentation files (the "Software"), to deal | 9 | of this software and associated documentation files (the "Software"), to deal |
10 | in the Software without restriction, including without limitation the rights | 10 | in the Software without restriction, including without limitation the rights |
11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | 11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
12 | copies of the Software, and to permit persons to whom the Software is | 12 | copies of the Software, and to permit persons to whom the Software is |
13 | furnished to do so, subject to the following conditions: | 13 | furnished to do so, subject to the following conditions: |
14 | 14 | ||
15 | The above copyright notice and this permission notice shall be included in all | 15 | The above copyright notice and this permission notice shall be included in all |
16 | copies or substantial portions of the Software. | 16 | copies or substantial portions of the Software. |
17 | 17 | ||
18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
24 | SOFTWARE. | 24 | SOFTWARE. |
25 | */ | 25 | */ |
26 | #endregion License | 26 | #endregion License |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.ComponentModel; | 29 | using System.ComponentModel; |
30 | using System.Runtime.InteropServices; | 30 | using System.Runtime.InteropServices; |
31 | 31 | ||
32 | namespace MonoXnaCompactMaths | 32 | namespace MonoXnaCompactMaths |
33 | { | 33 | { |
34 | [Serializable] | 34 | [Serializable] |
35 | [StructLayout(LayoutKind.Sequential)] | 35 | [StructLayout(LayoutKind.Sequential)] |
36 | //[TypeConverter(typeof(MatrixConverter))] | 36 | //[TypeConverter(typeof(MatrixConverter))] |
37 | public struct Matrix : IEquatable<Matrix> | 37 | public struct Matrix : IEquatable<Matrix> |
38 | { | 38 | { |
39 | #region Public Constructors | 39 | #region Public Constructors |
40 | 40 | ||
41 | public Matrix(float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24, float m31, | 41 | public Matrix(float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24, float m31, |
42 | float m32, float m33, float m34, float m41, float m42, float m43, float m44) | 42 | float m32, float m33, float m34, float m41, float m42, float m43, float m44) |
43 | { | 43 | { |
44 | this.M11 = m11; | 44 | this.M11 = m11; |
45 | this.M12 = m12; | 45 | this.M12 = m12; |
46 | this.M13 = m13; | 46 | this.M13 = m13; |
47 | this.M14 = m14; | 47 | this.M14 = m14; |
48 | this.M21 = m21; | 48 | this.M21 = m21; |
49 | this.M22 = m22; | 49 | this.M22 = m22; |
50 | this.M23 = m23; | 50 | this.M23 = m23; |
51 | this.M24 = m24; | 51 | this.M24 = m24; |
52 | this.M31 = m31; | 52 | this.M31 = m31; |
53 | this.M32 = m32; | 53 | this.M32 = m32; |
54 | this.M33 = m33; | 54 | this.M33 = m33; |
55 | this.M34 = m34; | 55 | this.M34 = m34; |
56 | this.M41 = m41; | 56 | this.M41 = m41; |
57 | this.M42 = m42; | 57 | this.M42 = m42; |
58 | this.M43 = m43; | 58 | this.M43 = m43; |
59 | this.M44 = m44; | 59 | this.M44 = m44; |
60 | } | 60 | } |
61 | 61 | ||
62 | #endregion Public Constructors | 62 | #endregion Public Constructors |
63 | 63 | ||
64 | 64 | ||
65 | #region Public Fields | 65 | #region Public Fields |
66 | 66 | ||
67 | public float M11; | 67 | public float M11; |
68 | public float M12; | 68 | public float M12; |
69 | public float M13; | 69 | public float M13; |
70 | public float M14; | 70 | public float M14; |
71 | public float M21; | 71 | public float M21; |
72 | public float M22; | 72 | public float M22; |
73 | public float M23; | 73 | public float M23; |
74 | public float M24; | 74 | public float M24; |
75 | public float M31; | 75 | public float M31; |
76 | public float M32; | 76 | public float M32; |
77 | public float M33; | 77 | public float M33; |
78 | public float M34; | 78 | public float M34; |
79 | public float M41; | 79 | public float M41; |
80 | public float M42; | 80 | public float M42; |
81 | public float M43; | 81 | public float M43; |
82 | public float M44; | 82 | public float M44; |
83 | 83 | ||
84 | #endregion Public Fields | 84 | #endregion Public Fields |
85 | 85 | ||
86 | 86 | ||
87 | #region Private Members | 87 | #region Private Members |
88 | private static Matrix identity = new Matrix(1f, 0f, 0f, 0f, 0f, 1f, 0f, 0f, 0f, 0f, 1f, 0f, 0f, 0f, 0f, 1f); | 88 | private static Matrix identity = new Matrix(1f, 0f, 0f, 0f, 0f, 1f, 0f, 0f, 0f, 0f, 1f, 0f, 0f, 0f, 0f, 1f); |
89 | #endregion Private Members | 89 | #endregion Private Members |
90 | 90 | ||
91 | 91 | ||
92 | #region Public Properties | 92 | #region Public Properties |
93 | 93 | ||
94 | public Vector3 Backward | 94 | public Vector3 Backward |
95 | { | 95 | { |
96 | get | 96 | get |
97 | { | 97 | { |
98 | return new Vector3(this.M31, this.M32, this.M33); | 98 | return new Vector3(this.M31, this.M32, this.M33); |
99 | } | 99 | } |
100 | set | 100 | set |
101 | { | 101 | { |
102 | this.M31 = value.X; | 102 | this.M31 = value.X; |
103 | this.M32 = value.Y; | 103 | this.M32 = value.Y; |
104 | this.M33 = value.Z; | 104 | this.M33 = value.Z; |
105 | } | 105 | } |
106 | } | 106 | } |
107 | 107 | ||
108 | 108 | ||
109 | public Vector3 Down | 109 | public Vector3 Down |
110 | { | 110 | { |
111 | get | 111 | get |
112 | { | 112 | { |
113 | return new Vector3(-this.M21, -this.M22, -this.M23); | 113 | return new Vector3(-this.M21, -this.M22, -this.M23); |
114 | } | 114 | } |
115 | set | 115 | set |
116 | { | 116 | { |
117 | this.M21 = -value.X; | 117 | this.M21 = -value.X; |
118 | this.M22 = -value.Y; | 118 | this.M22 = -value.Y; |
119 | this.M23 = -value.Z; | 119 | this.M23 = -value.Z; |
120 | } | 120 | } |
121 | } | 121 | } |
122 | 122 | ||
123 | 123 | ||
124 | public Vector3 Forward | 124 | public Vector3 Forward |
125 | { | 125 | { |
126 | get | 126 | get |
127 | { | 127 | { |
128 | return new Vector3(-this.M31, -this.M32, -this.M33); | 128 | return new Vector3(-this.M31, -this.M32, -this.M33); |
129 | } | 129 | } |
130 | set | 130 | set |
131 | { | 131 | { |
132 | this.M31 = -value.X; | 132 | this.M31 = -value.X; |
133 | this.M32 = -value.Y; | 133 | this.M32 = -value.Y; |
134 | this.M33 = -value.Z; | 134 | this.M33 = -value.Z; |
135 | } | 135 | } |
136 | } | 136 | } |
137 | 137 | ||
138 | 138 | ||
139 | public static Matrix Identity | 139 | public static Matrix Identity |
140 | { | 140 | { |
141 | get { return identity; } | 141 | get { return identity; } |
142 | } | 142 | } |
143 | 143 | ||
144 | 144 | ||
145 | public Vector3 Left | 145 | public Vector3 Left |
146 | { | 146 | { |
147 | get | 147 | get |
148 | { | 148 | { |
149 | return new Vector3(-this.M11, -this.M12, -this.M13); | 149 | return new Vector3(-this.M11, -this.M12, -this.M13); |
150 | } | 150 | } |
151 | set | 151 | set |
152 | { | 152 | { |
153 | this.M11 = -value.X; | 153 | this.M11 = -value.X; |
154 | this.M12 = -value.Y; | 154 | this.M12 = -value.Y; |
155 | this.M13 = -value.Z; | 155 | this.M13 = -value.Z; |
156 | } | 156 | } |
157 | } | 157 | } |
158 | 158 | ||
159 | 159 | ||
160 | public Vector3 Right | 160 | public Vector3 Right |
161 | { | 161 | { |
162 | get | 162 | get |
163 | { | 163 | { |
164 | return new Vector3(this.M11, this.M12, this.M13); | 164 | return new Vector3(this.M11, this.M12, this.M13); |
165 | } | 165 | } |
166 | set | 166 | set |
167 | { | 167 | { |
168 | this.M11 = value.X; | 168 | this.M11 = value.X; |
169 | this.M12 = value.Y; | 169 | this.M12 = value.Y; |
170 | this.M13 = value.Z; | 170 | this.M13 = value.Z; |
171 | } | 171 | } |
172 | } | 172 | } |
173 | 173 | ||
174 | 174 | ||
175 | public Vector3 Translation | 175 | public Vector3 Translation |
176 | { | 176 | { |
177 | get | 177 | get |
178 | { | 178 | { |
179 | return new Vector3(this.M41, this.M42, this.M43); | 179 | return new Vector3(this.M41, this.M42, this.M43); |
180 | } | 180 | } |
181 | set | 181 | set |
182 | { | 182 | { |
183 | this.M41 = value.X; | 183 | this.M41 = value.X; |
184 | this.M42 = value.Y; | 184 | this.M42 = value.Y; |
185 | this.M43 = value.Z; | 185 | this.M43 = value.Z; |
186 | } | 186 | } |
187 | } | 187 | } |
188 | 188 | ||
189 | 189 | ||
190 | public Vector3 Up | 190 | public Vector3 Up |
191 | { | 191 | { |
192 | get | 192 | get |
193 | { | 193 | { |
194 | return new Vector3(this.M21, this.M22, this.M23); | 194 | return new Vector3(this.M21, this.M22, this.M23); |
195 | } | 195 | } |
196 | set | 196 | set |
197 | { | 197 | { |
198 | this.M21 = value.X; | 198 | this.M21 = value.X; |
199 | this.M22 = value.Y; | 199 | this.M22 = value.Y; |
200 | this.M23 = value.Z; | 200 | this.M23 = value.Z; |
201 | } | 201 | } |
202 | } | 202 | } |
203 | #endregion Public Properties | 203 | #endregion Public Properties |
204 | 204 | ||
205 | 205 | ||
206 | #region Public Methods | 206 | #region Public Methods |
207 | 207 | ||
208 | public static Matrix Add(Matrix matrix1, Matrix matrix2) | 208 | public static Matrix Add(Matrix matrix1, Matrix matrix2) |
209 | { | 209 | { |
210 | throw new NotImplementedException(); | 210 | throw new NotImplementedException(); |
211 | } | 211 | } |
212 | 212 | ||
213 | 213 | ||
214 | public static void Add(ref Matrix matrix1, ref Matrix matrix2, out Matrix result) | 214 | public static void Add(ref Matrix matrix1, ref Matrix matrix2, out Matrix result) |
215 | { | 215 | { |
216 | throw new NotImplementedException(); | 216 | throw new NotImplementedException(); |
217 | } | 217 | } |
218 | 218 | ||
219 | 219 | ||
220 | public static Matrix CreateBillboard(Vector3 objectPosition, Vector3 cameraPosition, | 220 | public static Matrix CreateBillboard(Vector3 objectPosition, Vector3 cameraPosition, |
221 | Vector3 cameraUpVector, Nullable<Vector3> cameraForwardVector) | 221 | Vector3 cameraUpVector, Nullable<Vector3> cameraForwardVector) |
222 | { | 222 | { |
223 | throw new NotImplementedException(); | 223 | throw new NotImplementedException(); |
224 | } | 224 | } |
225 | 225 | ||
226 | 226 | ||
227 | public static void CreateBillboard(ref Vector3 objectPosition, ref Vector3 cameraPosition, | 227 | public static void CreateBillboard(ref Vector3 objectPosition, ref Vector3 cameraPosition, |
228 | ref Vector3 cameraUpVector, Vector3? cameraForwardVector, out Matrix result) | 228 | ref Vector3 cameraUpVector, Vector3? cameraForwardVector, out Matrix result) |
229 | { | 229 | { |
230 | throw new NotImplementedException(); | 230 | throw new NotImplementedException(); |
231 | } | 231 | } |
232 | 232 | ||
233 | 233 | ||
234 | public static Matrix CreateConstrainedBillboard(Vector3 objectPosition, Vector3 cameraPosition, | 234 | public static Matrix CreateConstrainedBillboard(Vector3 objectPosition, Vector3 cameraPosition, |
235 | Vector3 rotateAxis, Nullable<Vector3> cameraForwardVector, Nullable<Vector3> objectForwardVector) | 235 | Vector3 rotateAxis, Nullable<Vector3> cameraForwardVector, Nullable<Vector3> objectForwardVector) |
236 | { | 236 | { |
237 | throw new NotImplementedException(); | 237 | throw new NotImplementedException(); |
238 | } | 238 | } |
239 | 239 | ||
240 | 240 | ||
241 | public static void CreateConstrainedBillboard(ref Vector3 objectPosition, ref Vector3 cameraPosition, | 241 | public static void CreateConstrainedBillboard(ref Vector3 objectPosition, ref Vector3 cameraPosition, |
242 | ref Vector3 rotateAxis, Vector3? cameraForwardVector, Vector3? objectForwardVector, out Matrix result) | 242 | ref Vector3 rotateAxis, Vector3? cameraForwardVector, Vector3? objectForwardVector, out Matrix result) |
243 | { | 243 | { |
244 | throw new NotImplementedException(); | 244 | throw new NotImplementedException(); |
245 | } | 245 | } |
246 | 246 | ||
247 | 247 | ||
248 | public static Matrix CreateFromAxisAngle(Vector3 axis, float angle) | 248 | public static Matrix CreateFromAxisAngle(Vector3 axis, float angle) |
249 | { | 249 | { |
250 | throw new NotImplementedException(); | 250 | throw new NotImplementedException(); |
251 | } | 251 | } |
252 | 252 | ||
253 | 253 | ||
254 | public static void CreateFromAxisAngle(ref Vector3 axis, float angle, out Matrix result) | 254 | public static void CreateFromAxisAngle(ref Vector3 axis, float angle, out Matrix result) |
255 | { | 255 | { |
256 | throw new NotImplementedException(); | 256 | throw new NotImplementedException(); |
257 | } | 257 | } |
258 | 258 | ||
259 | 259 | ||
260 | public static Matrix CreateFromQuaternion(Quaternion quaternion) | 260 | public static Matrix CreateFromQuaternion(Quaternion quaternion) |
261 | { | 261 | { |
262 | //--- | 262 | //--- |
263 | //http://lists.ximian.com/pipermail/mono-patches/2006-December/084667.html | 263 | //http://lists.ximian.com/pipermail/mono-patches/2006-December/084667.html |
264 | float xx = quaternion.X * quaternion.X; | 264 | float xx = quaternion.X * quaternion.X; |
265 | float xy = quaternion.X * quaternion.Y; | 265 | float xy = quaternion.X * quaternion.Y; |
266 | float xw = quaternion.X * quaternion.W; | 266 | float xw = quaternion.X * quaternion.W; |
267 | float yy = quaternion.Y * quaternion.Y; | 267 | float yy = quaternion.Y * quaternion.Y; |
268 | float yw = quaternion.Y * quaternion.W; | 268 | float yw = quaternion.Y * quaternion.W; |
269 | float yz = quaternion.Y * quaternion.Z; | 269 | float yz = quaternion.Y * quaternion.Z; |
270 | float zx = quaternion.Z * quaternion.X; | 270 | float zx = quaternion.Z * quaternion.X; |
271 | float zw = quaternion.Z * quaternion.W; | 271 | float zw = quaternion.Z * quaternion.W; |
272 | float zz = quaternion.Z * quaternion.Z; | 272 | float zz = quaternion.Z * quaternion.Z; |
273 | return new Matrix(1f - (2f * (yy + zz)), 2f * (xy + zw), 2f * (zx - yw), 0f, 2f * (xy - zw), | 273 | return new Matrix(1f - (2f * (yy + zz)), 2f * (xy + zw), 2f * (zx - yw), 0f, 2f * (xy - zw), |
274 | 1f - (2f * (zz + xx)), 2f * (yz + xw), 0f, 2f * (zx + yw), 2f * (yz - xw), | 274 | 1f - (2f * (zz + xx)), 2f * (yz + xw), 0f, 2f * (zx + yw), 2f * (yz - xw), |
275 | 1f - (2f * (yy + xx)), 0f, 0f, 0f, 0f, 1f); | 275 | 1f - (2f * (yy + xx)), 0f, 0f, 0f, 0f, 1f); |
276 | //throw new NotImplementedException(); | 276 | //throw new NotImplementedException(); |
277 | } | 277 | } |
278 | 278 | ||
279 | 279 | ||
280 | public static void CreateFromQuaternion(ref Quaternion quaternion, out Matrix result) | 280 | public static void CreateFromQuaternion(ref Quaternion quaternion, out Matrix result) |
281 | { | 281 | { |
282 | throw new NotImplementedException(); | 282 | throw new NotImplementedException(); |
283 | } | 283 | } |
284 | 284 | ||
285 | 285 | ||
286 | public static Matrix CreateLookAt(Vector3 cameraPosition, Vector3 cameraTarget, Vector3 cameraUpVector) | 286 | public static Matrix CreateLookAt(Vector3 cameraPosition, Vector3 cameraTarget, Vector3 cameraUpVector) |
287 | { | 287 | { |
288 | throw new NotImplementedException(); | 288 | throw new NotImplementedException(); |
289 | } | 289 | } |
290 | 290 | ||
291 | 291 | ||
292 | public static void CreateLookAt(ref Vector3 cameraPosition, ref Vector3 cameraTarget, ref Vector3 cameraUpVector, out Matrix result) | 292 | public static void CreateLookAt(ref Vector3 cameraPosition, ref Vector3 cameraTarget, ref Vector3 cameraUpVector, out Matrix result) |
293 | { | 293 | { |
294 | throw new NotImplementedException(); | 294 | throw new NotImplementedException(); |
295 | } | 295 | } |
296 | 296 | ||
297 | 297 | ||
298 | public static Matrix CreateOrthographic(float width, float height, float zNearPlane, float zFarPlane) | 298 | public static Matrix CreateOrthographic(float width, float height, float zNearPlane, float zFarPlane) |
299 | { | 299 | { |
300 | throw new NotImplementedException(); | 300 | throw new NotImplementedException(); |
301 | } | 301 | } |
302 | 302 | ||
303 | 303 | ||
304 | public static void CreateOrthographic(float width, float height, float zNearPlane, float zFarPlane, out Matrix result) | 304 | public static void CreateOrthographic(float width, float height, float zNearPlane, float zFarPlane, out Matrix result) |
305 | { | 305 | { |
306 | throw new NotImplementedException(); | 306 | throw new NotImplementedException(); |
307 | } | 307 | } |
308 | 308 | ||
309 | 309 | ||
310 | public static Matrix CreateOrthographicOffCenter(float left, float right, float bottom, float top, float zNearPlane, float zFarPlane) | 310 | public static Matrix CreateOrthographicOffCenter(float left, float right, float bottom, float top, float zNearPlane, float zFarPlane) |
311 | { | 311 | { |
312 | throw new NotImplementedException(); | 312 | throw new NotImplementedException(); |
313 | } | 313 | } |
314 | 314 | ||
315 | 315 | ||
316 | public static void CreateOrthographicOffCenter(float left, float right, float bottom, float top, | 316 | public static void CreateOrthographicOffCenter(float left, float right, float bottom, float top, |
317 | float zNearPlane, float zFarPlane, out Matrix result) | 317 | float zNearPlane, float zFarPlane, out Matrix result) |
318 | { | 318 | { |
319 | throw new NotImplementedException(); | 319 | throw new NotImplementedException(); |
320 | } | 320 | } |
321 | 321 | ||
322 | 322 | ||
323 | public static Matrix CreatePerspective(float width, float height, float zNearPlane, float zFarPlane) | 323 | public static Matrix CreatePerspective(float width, float height, float zNearPlane, float zFarPlane) |
324 | { | 324 | { |
325 | throw new NotImplementedException(); | 325 | throw new NotImplementedException(); |
326 | } | 326 | } |
327 | 327 | ||
328 | 328 | ||
329 | public static void CreatePerspective(float width, float height, float zNearPlane, float zFarPlane, out Matrix result) | 329 | public static void CreatePerspective(float width, float height, float zNearPlane, float zFarPlane, out Matrix result) |
330 | { | 330 | { |
331 | throw new NotImplementedException(); | 331 | throw new NotImplementedException(); |
332 | } | 332 | } |
333 | 333 | ||
334 | 334 | ||
335 | public static Matrix CreatePerspectiveFieldOfView(float fieldOfView, float aspectRatio, float zNearPlane, float zFarPlane) | 335 | public static Matrix CreatePerspectiveFieldOfView(float fieldOfView, float aspectRatio, float zNearPlane, float zFarPlane) |
336 | { | 336 | { |
337 | throw new NotImplementedException(); | 337 | throw new NotImplementedException(); |
338 | } | 338 | } |
339 | 339 | ||
340 | 340 | ||
341 | public static void CreatePerspectiveFieldOfView(float fieldOfView, float aspectRatio, float nearPlaneDistance, float farPlaneDistance, out Matrix result) | 341 | public static void CreatePerspectiveFieldOfView(float fieldOfView, float aspectRatio, float nearPlaneDistance, float farPlaneDistance, out Matrix result) |
342 | { | 342 | { |
343 | throw new NotImplementedException(); | 343 | throw new NotImplementedException(); |
344 | } | 344 | } |
345 | 345 | ||
346 | 346 | ||
347 | public static Matrix CreatePerspectiveOffCenter(float left, float right, float bottom, float top, float zNearPlane, float zFarPlane) | 347 | public static Matrix CreatePerspectiveOffCenter(float left, float right, float bottom, float top, float zNearPlane, float zFarPlane) |
348 | { | 348 | { |
349 | throw new NotImplementedException(); | 349 | throw new NotImplementedException(); |
350 | } | 350 | } |
351 | 351 | ||
352 | 352 | ||
353 | public static void CreatePerspectiveOffCenter(float left, float right, float bottom, float top, float nearPlaneDistance, float farPlaneDistance, out Matrix result) | 353 | public static void CreatePerspectiveOffCenter(float left, float right, float bottom, float top, float nearPlaneDistance, float farPlaneDistance, out Matrix result) |
354 | { | 354 | { |
355 | throw new NotImplementedException(); | 355 | throw new NotImplementedException(); |
356 | } | 356 | } |
357 | 357 | ||
358 | 358 | ||
359 | public static Matrix CreateRotationX(float radians) | 359 | public static Matrix CreateRotationX(float radians) |
360 | { | 360 | { |
361 | throw new NotImplementedException(); | 361 | throw new NotImplementedException(); |
362 | } | 362 | } |
363 | 363 | ||
364 | 364 | ||
365 | public static void CreateRotationX(float radians, out Matrix result) | 365 | public static void CreateRotationX(float radians, out Matrix result) |
366 | { | 366 | { |
367 | throw new NotImplementedException(); | 367 | throw new NotImplementedException(); |
368 | } | 368 | } |
369 | 369 | ||
370 | 370 | ||
371 | public static Matrix CreateRotationY(float radians) | 371 | public static Matrix CreateRotationY(float radians) |
372 | { | 372 | { |
373 | throw new NotImplementedException(); | 373 | throw new NotImplementedException(); |
374 | } | 374 | } |
375 | 375 | ||
376 | 376 | ||
377 | public static void CreateRotationY(float radians, out Matrix result) | 377 | public static void CreateRotationY(float radians, out Matrix result) |
378 | { | 378 | { |
379 | throw new NotImplementedException(); | 379 | throw new NotImplementedException(); |
380 | } | 380 | } |
381 | 381 | ||
382 | 382 | ||
383 | public static Matrix CreateRotationZ(float radians) | 383 | public static Matrix CreateRotationZ(float radians) |
384 | { | 384 | { |
385 | throw new NotImplementedException(); | 385 | throw new NotImplementedException(); |
386 | } | 386 | } |
387 | 387 | ||
388 | 388 | ||
389 | public static void CreateRotationZ(float radians, out Matrix result) | 389 | public static void CreateRotationZ(float radians, out Matrix result) |
390 | { | 390 | { |
391 | throw new NotImplementedException(); | 391 | throw new NotImplementedException(); |
392 | } | 392 | } |
393 | 393 | ||
394 | 394 | ||
395 | public static Matrix CreateScale(float scale) | 395 | public static Matrix CreateScale(float scale) |
396 | { | 396 | { |
397 | throw new NotImplementedException(); | 397 | throw new NotImplementedException(); |
398 | } | 398 | } |
399 | 399 | ||
400 | 400 | ||
401 | public static void CreateScale(float scale, out Matrix result) | 401 | public static void CreateScale(float scale, out Matrix result) |
402 | { | 402 | { |
403 | throw new NotImplementedException(); | 403 | throw new NotImplementedException(); |
404 | } | 404 | } |
405 | 405 | ||
406 | 406 | ||
407 | public static Matrix CreateScale(float xScale, float yScale, float zScale) | 407 | public static Matrix CreateScale(float xScale, float yScale, float zScale) |
408 | { | 408 | { |
409 | throw new NotImplementedException(); | 409 | throw new NotImplementedException(); |
410 | } | 410 | } |
411 | 411 | ||
412 | 412 | ||
413 | public static void CreateScale(float xScale, float yScale, float zScale, out Matrix result) | 413 | public static void CreateScale(float xScale, float yScale, float zScale, out Matrix result) |
414 | { | 414 | { |
415 | throw new NotImplementedException(); | 415 | throw new NotImplementedException(); |
416 | } | 416 | } |
417 | 417 | ||
418 | 418 | ||
419 | public static Matrix CreateScale(Vector3 scales) | 419 | public static Matrix CreateScale(Vector3 scales) |
420 | { | 420 | { |
421 | throw new NotImplementedException(); | 421 | throw new NotImplementedException(); |
422 | } | 422 | } |
423 | 423 | ||
424 | 424 | ||
425 | public static void CreateScale(ref Vector3 scales, out Matrix result) | 425 | public static void CreateScale(ref Vector3 scales, out Matrix result) |
426 | { | 426 | { |
427 | throw new NotImplementedException(); | 427 | throw new NotImplementedException(); |
428 | } | 428 | } |
429 | 429 | ||
430 | 430 | ||
431 | public static Matrix CreateTranslation(float xPosition, float yPosition, float zPosition) | 431 | public static Matrix CreateTranslation(float xPosition, float yPosition, float zPosition) |
432 | { | 432 | { |
433 | throw new NotImplementedException(); | 433 | throw new NotImplementedException(); |
434 | } | 434 | } |
435 | 435 | ||
436 | 436 | ||
437 | public static void CreateTranslation(ref Vector3 position, out Matrix result) | 437 | public static void CreateTranslation(ref Vector3 position, out Matrix result) |
438 | { | 438 | { |
439 | throw new NotImplementedException(); | 439 | throw new NotImplementedException(); |
440 | } | 440 | } |
441 | 441 | ||
442 | 442 | ||
443 | public static Matrix CreateTranslation(Vector3 position) | 443 | public static Matrix CreateTranslation(Vector3 position) |
444 | { | 444 | { |
445 | throw new NotImplementedException(); | 445 | throw new NotImplementedException(); |
446 | } | 446 | } |
447 | 447 | ||
448 | 448 | ||
449 | public static void CreateTranslation(float xPosition, float yPosition, float zPosition, out Matrix result) | 449 | public static void CreateTranslation(float xPosition, float yPosition, float zPosition, out Matrix result) |
450 | { | 450 | { |
451 | throw new NotImplementedException(); | 451 | throw new NotImplementedException(); |
452 | } | 452 | } |
453 | 453 | ||
454 | 454 | ||
455 | public float Determinant() | 455 | public float Determinant() |
456 | { | 456 | { |
457 | throw new NotImplementedException(); | 457 | throw new NotImplementedException(); |
458 | } | 458 | } |
459 | 459 | ||
460 | 460 | ||
461 | public static Matrix Divide(Matrix matrix1, Matrix matrix2) | 461 | public static Matrix Divide(Matrix matrix1, Matrix matrix2) |
462 | { | 462 | { |
463 | throw new NotImplementedException(); | 463 | throw new NotImplementedException(); |
464 | } | 464 | } |
465 | 465 | ||
466 | 466 | ||
467 | public static void Divide(ref Matrix matrix1, ref Matrix matrix2, out Matrix result) | 467 | public static void Divide(ref Matrix matrix1, ref Matrix matrix2, out Matrix result) |
468 | { | 468 | { |
469 | throw new NotImplementedException(); | 469 | throw new NotImplementedException(); |
470 | } | 470 | } |
471 | 471 | ||
472 | 472 | ||
473 | public static Matrix Divide(Matrix matrix1, float divider) | 473 | public static Matrix Divide(Matrix matrix1, float divider) |
474 | { | 474 | { |
475 | throw new NotImplementedException(); | 475 | throw new NotImplementedException(); |
476 | } | 476 | } |
477 | 477 | ||
478 | 478 | ||
479 | public static void Divide(ref Matrix matrix1, float divider, out Matrix result) | 479 | public static void Divide(ref Matrix matrix1, float divider, out Matrix result) |
480 | { | 480 | { |
481 | throw new NotImplementedException(); | 481 | throw new NotImplementedException(); |
482 | } | 482 | } |
483 | 483 | ||
484 | 484 | ||
485 | public bool Equals(Matrix other) | 485 | public bool Equals(Matrix other) |
486 | { | 486 | { |
487 | throw new NotImplementedException(); | 487 | throw new NotImplementedException(); |
488 | } | 488 | } |
489 | 489 | ||
490 | 490 | ||
491 | public override bool Equals(object obj) | 491 | public override bool Equals(object obj) |
492 | { | 492 | { |
493 | throw new NotImplementedException(); | 493 | throw new NotImplementedException(); |
494 | } | 494 | } |
495 | 495 | ||
496 | 496 | ||
497 | public override int GetHashCode() | 497 | public override int GetHashCode() |
498 | { | 498 | { |
499 | throw new NotImplementedException(); | 499 | throw new NotImplementedException(); |
500 | } | 500 | } |
501 | 501 | ||
502 | 502 | ||
503 | public static Matrix Invert(Matrix matrix) | 503 | public static Matrix Invert(Matrix matrix) |
504 | { | 504 | { |
505 | throw new NotImplementedException(); | 505 | throw new NotImplementedException(); |
506 | } | 506 | } |
507 | 507 | ||
508 | 508 | ||
509 | public static void Invert(ref Matrix matrix, out Matrix result) | 509 | public static void Invert(ref Matrix matrix, out Matrix result) |
510 | { | 510 | { |
511 | throw new NotImplementedException(); | 511 | throw new NotImplementedException(); |
512 | } | 512 | } |
513 | 513 | ||
514 | 514 | ||
515 | public static Matrix Lerp(Matrix matrix1, Matrix matrix2, float amount) | 515 | public static Matrix Lerp(Matrix matrix1, Matrix matrix2, float amount) |
516 | { | 516 | { |
517 | throw new NotImplementedException(); | 517 | throw new NotImplementedException(); |
518 | } | 518 | } |
519 | 519 | ||
520 | 520 | ||
521 | public static void Lerp(ref Matrix matrix1, ref Matrix matrix2, float amount, out Matrix result) | 521 | public static void Lerp(ref Matrix matrix1, ref Matrix matrix2, float amount, out Matrix result) |
522 | { | 522 | { |
523 | throw new NotImplementedException(); | 523 | throw new NotImplementedException(); |
524 | } | 524 | } |
525 | 525 | ||
526 | public static Matrix Multiply(Matrix matrix1, Matrix matrix2) | 526 | public static Matrix Multiply(Matrix matrix1, Matrix matrix2) |
527 | { | 527 | { |
528 | throw new NotImplementedException(); | 528 | throw new NotImplementedException(); |
529 | } | 529 | } |
530 | 530 | ||
531 | 531 | ||
532 | public static void Multiply(ref Matrix matrix1, ref Matrix matrix2, out Matrix result) | 532 | public static void Multiply(ref Matrix matrix1, ref Matrix matrix2, out Matrix result) |
533 | { | 533 | { |
534 | throw new NotImplementedException(); | 534 | throw new NotImplementedException(); |
535 | } | 535 | } |
536 | 536 | ||
537 | 537 | ||
538 | public static Matrix Multiply(Matrix matrix1, float factor) | 538 | public static Matrix Multiply(Matrix matrix1, float factor) |
539 | { | 539 | { |
540 | throw new NotImplementedException(); | 540 | throw new NotImplementedException(); |
541 | } | 541 | } |
542 | 542 | ||
543 | 543 | ||
544 | public static void Multiply(ref Matrix matrix1, float factor, out Matrix result) | 544 | public static void Multiply(ref Matrix matrix1, float factor, out Matrix result) |
545 | { | 545 | { |
546 | throw new NotImplementedException(); | 546 | throw new NotImplementedException(); |
547 | } | 547 | } |
548 | 548 | ||
549 | 549 | ||
550 | public static Matrix Negate(Matrix matrix) | 550 | public static Matrix Negate(Matrix matrix) |
551 | { | 551 | { |
552 | throw new NotImplementedException(); | 552 | throw new NotImplementedException(); |
553 | } | 553 | } |
554 | 554 | ||
555 | 555 | ||
556 | public static void Negate(ref Matrix matrix, out Matrix result) | 556 | public static void Negate(ref Matrix matrix, out Matrix result) |
557 | { | 557 | { |
558 | throw new NotImplementedException(); | 558 | throw new NotImplementedException(); |
559 | } | 559 | } |
560 | 560 | ||
561 | 561 | ||
562 | public static Matrix operator +(Matrix matrix1, Matrix matrix2) | 562 | public static Matrix operator +(Matrix matrix1, Matrix matrix2) |
563 | { | 563 | { |
564 | throw new NotImplementedException(); | 564 | throw new NotImplementedException(); |
565 | } | 565 | } |
566 | 566 | ||
567 | 567 | ||
568 | public static Matrix operator /(Matrix matrix1, Matrix matrix2) | 568 | public static Matrix operator /(Matrix matrix1, Matrix matrix2) |
569 | { | 569 | { |
570 | throw new NotImplementedException(); | 570 | throw new NotImplementedException(); |
571 | } | 571 | } |
572 | 572 | ||
573 | 573 | ||
574 | public static Matrix operator /(Matrix matrix1, float divider) | 574 | public static Matrix operator /(Matrix matrix1, float divider) |
575 | { | 575 | { |
576 | throw new NotImplementedException(); | 576 | throw new NotImplementedException(); |
577 | } | 577 | } |
578 | 578 | ||
579 | 579 | ||
580 | public static bool operator ==(Matrix matrix1, Matrix matrix2) | 580 | public static bool operator ==(Matrix matrix1, Matrix matrix2) |
581 | { | 581 | { |
582 | throw new NotImplementedException(); | 582 | throw new NotImplementedException(); |
583 | } | 583 | } |
584 | 584 | ||
585 | 585 | ||
586 | public static bool operator !=(Matrix matrix1, Matrix matrix2) | 586 | public static bool operator !=(Matrix matrix1, Matrix matrix2) |
587 | { | 587 | { |
588 | throw new NotImplementedException(); | 588 | throw new NotImplementedException(); |
589 | } | 589 | } |
590 | 590 | ||
591 | 591 | ||
592 | public static Matrix operator *(Matrix matrix1, Matrix matrix2) | 592 | public static Matrix operator *(Matrix matrix1, Matrix matrix2) |
593 | { | 593 | { |
594 | //--- | 594 | //--- |
595 | float[, ] arrayMatrix1 = new float[4, 4]; | 595 | float[, ] arrayMatrix1 = new float[4, 4]; |
596 | float[, ] arrayMatrix2 = new float[4, 4]; | 596 | float[, ] arrayMatrix2 = new float[4, 4]; |
597 | float[, ] arrayMatrixProduct = new float[4, 4]; | 597 | float[, ] arrayMatrixProduct = new float[4, 4]; |
598 | arrayMatrix1[0, 0] = matrix1.M11; arrayMatrix1[0, 1] = matrix1.M12; arrayMatrix1[0, 2] = matrix1.M13; arrayMatrix1[0, 3] = matrix1.M14; | 598 | arrayMatrix1[0, 0] = matrix1.M11; arrayMatrix1[0, 1] = matrix1.M12; arrayMatrix1[0, 2] = matrix1.M13; arrayMatrix1[0, 3] = matrix1.M14; |
599 | arrayMatrix1[1, 0] = matrix1.M21; arrayMatrix1[1, 1] = matrix1.M22; arrayMatrix1[1, 2] = matrix1.M23; arrayMatrix1[1, 3] = matrix1.M24; | 599 | arrayMatrix1[1, 0] = matrix1.M21; arrayMatrix1[1, 1] = matrix1.M22; arrayMatrix1[1, 2] = matrix1.M23; arrayMatrix1[1, 3] = matrix1.M24; |
600 | arrayMatrix1[2, 0] = matrix1.M31; arrayMatrix1[2, 1] = matrix1.M32; arrayMatrix1[2, 2] = matrix1.M33; arrayMatrix1[2, 3] = matrix1.M34; | 600 | arrayMatrix1[2, 0] = matrix1.M31; arrayMatrix1[2, 1] = matrix1.M32; arrayMatrix1[2, 2] = matrix1.M33; arrayMatrix1[2, 3] = matrix1.M34; |
601 | arrayMatrix1[3, 0] = matrix1.M41; arrayMatrix1[3, 1] = matrix1.M42; arrayMatrix1[3, 2] = matrix1.M43; arrayMatrix1[3, 3] = matrix1.M44; | 601 | arrayMatrix1[3, 0] = matrix1.M41; arrayMatrix1[3, 1] = matrix1.M42; arrayMatrix1[3, 2] = matrix1.M43; arrayMatrix1[3, 3] = matrix1.M44; |
602 | 602 | ||
603 | arrayMatrix2[0, 0] = matrix2.M11; arrayMatrix2[0, 1] = matrix2.M12; arrayMatrix2[0, 2] = matrix2.M13; arrayMatrix2[0, 3] = matrix2.M14; | 603 | arrayMatrix2[0, 0] = matrix2.M11; arrayMatrix2[0, 1] = matrix2.M12; arrayMatrix2[0, 2] = matrix2.M13; arrayMatrix2[0, 3] = matrix2.M14; |
604 | arrayMatrix2[1, 0] = matrix2.M21; arrayMatrix2[1, 1] = matrix2.M22; arrayMatrix2[1, 2] = matrix2.M23; arrayMatrix2[1, 3] = matrix2.M24; | 604 | arrayMatrix2[1, 0] = matrix2.M21; arrayMatrix2[1, 1] = matrix2.M22; arrayMatrix2[1, 2] = matrix2.M23; arrayMatrix2[1, 3] = matrix2.M24; |
605 | arrayMatrix2[2, 0] = matrix2.M31; arrayMatrix2[2, 1] = matrix2.M32; arrayMatrix2[2, 2] = matrix2.M33; arrayMatrix2[2, 3] = matrix2.M34; | 605 | arrayMatrix2[2, 0] = matrix2.M31; arrayMatrix2[2, 1] = matrix2.M32; arrayMatrix2[2, 2] = matrix2.M33; arrayMatrix2[2, 3] = matrix2.M34; |
606 | arrayMatrix2[3, 0] = matrix2.M41; arrayMatrix2[3, 1] = matrix2.M42; arrayMatrix2[3, 2] = matrix2.M43; arrayMatrix2[3, 3] = matrix2.M44; | 606 | arrayMatrix2[3, 0] = matrix2.M41; arrayMatrix2[3, 1] = matrix2.M42; arrayMatrix2[3, 2] = matrix2.M43; arrayMatrix2[3, 3] = matrix2.M44; |
607 | 607 | ||
608 | int n = 4; | 608 | int n = 4; |
609 | for (int i = 0; i < n; i++) | 609 | for (int i = 0; i < n; i++) |
610 | { | 610 | { |
611 | for (int j = 0; j < n; j++) | 611 | for (int j = 0; j < n; j++) |
612 | { | 612 | { |
613 | // (AB)[i,j] = Sum(k=0; k < 4; k++) { A[i,k] * B[k, j] } | 613 | // (AB)[i,j] = Sum(k=0; k < 4; k++) { A[i,k] * B[k, j] } |
614 | for (int k = 0; k < n; k++) | 614 | for (int k = 0; k < n; k++) |
615 | { | 615 | { |
616 | arrayMatrixProduct[i, j] += arrayMatrix1[i, k] * arrayMatrix2[k, j]; | 616 | arrayMatrixProduct[i, j] += arrayMatrix1[i, k] * arrayMatrix2[k, j]; |
617 | } | 617 | } |
618 | } | 618 | } |
619 | } | 619 | } |
620 | return new Matrix( arrayMatrixProduct[0, 0], arrayMatrixProduct[0, 1], arrayMatrixProduct[0, 2], arrayMatrixProduct[0, 3], | 620 | return new Matrix( arrayMatrixProduct[0, 0], arrayMatrixProduct[0, 1], arrayMatrixProduct[0, 2], arrayMatrixProduct[0, 3], |
621 | arrayMatrixProduct[1, 0], arrayMatrixProduct[1, 1], arrayMatrixProduct[1, 2], arrayMatrixProduct[1, 3], | 621 | arrayMatrixProduct[1, 0], arrayMatrixProduct[1, 1], arrayMatrixProduct[1, 2], arrayMatrixProduct[1, 3], |
622 | arrayMatrixProduct[2, 0], arrayMatrixProduct[2, 1], arrayMatrixProduct[2, 2], arrayMatrixProduct[2, 3], | 622 | arrayMatrixProduct[2, 0], arrayMatrixProduct[2, 1], arrayMatrixProduct[2, 2], arrayMatrixProduct[2, 3], |
623 | arrayMatrixProduct[3, 1], arrayMatrixProduct[3, 1], arrayMatrixProduct[3, 2], arrayMatrixProduct[3, 3]); | 623 | arrayMatrixProduct[3, 1], arrayMatrixProduct[3, 1], arrayMatrixProduct[3, 2], arrayMatrixProduct[3, 3]); |
624 | //--- | 624 | //--- |
625 | //throw new NotImplementedException(); | 625 | //throw new NotImplementedException(); |
626 | } | 626 | } |
627 | 627 | ||
628 | 628 | ||
629 | public static Matrix operator *(Matrix matrix, float scaleFactor) | 629 | public static Matrix operator *(Matrix matrix, float scaleFactor) |
630 | { | 630 | { |
631 | throw new NotImplementedException(); | 631 | throw new NotImplementedException(); |
632 | } | 632 | } |
633 | 633 | ||
634 | 634 | ||
635 | public static Matrix operator -(Matrix matrix1, Matrix matrix2) | 635 | public static Matrix operator -(Matrix matrix1, Matrix matrix2) |
636 | { | 636 | { |
637 | throw new NotImplementedException(); | 637 | throw new NotImplementedException(); |
638 | } | 638 | } |
639 | 639 | ||
640 | 640 | ||
641 | public static Matrix operator -(Matrix matrix1) | 641 | public static Matrix operator -(Matrix matrix1) |
642 | { | 642 | { |
643 | throw new NotImplementedException(); | 643 | throw new NotImplementedException(); |
644 | } | 644 | } |
645 | 645 | ||
646 | 646 | ||
647 | public static Matrix Subtract(Matrix matrix1, Matrix matrix2) | 647 | public static Matrix Subtract(Matrix matrix1, Matrix matrix2) |
648 | { | 648 | { |
649 | throw new NotImplementedException(); | 649 | throw new NotImplementedException(); |
650 | } | 650 | } |
651 | 651 | ||
652 | 652 | ||
653 | public static void Subtract(ref Matrix matrix1, ref Matrix matrix2, out Matrix result) | 653 | public static void Subtract(ref Matrix matrix1, ref Matrix matrix2, out Matrix result) |
654 | { | 654 | { |
655 | throw new NotImplementedException(); | 655 | throw new NotImplementedException(); |
656 | } | 656 | } |
657 | 657 | ||
658 | 658 | ||
659 | public override string ToString() | 659 | public override string ToString() |
660 | { | 660 | { |
661 | throw new NotImplementedException(); | 661 | throw new NotImplementedException(); |
662 | } | 662 | } |
663 | 663 | ||
664 | 664 | ||
665 | public static Matrix Transpose(Matrix matrix) | 665 | public static Matrix Transpose(Matrix matrix) |
666 | { | 666 | { |
667 | //--- | 667 | //--- |
668 | return new Matrix( matrix.M11, matrix.M21, matrix.M31, matrix.M41, | 668 | return new Matrix( matrix.M11, matrix.M21, matrix.M31, matrix.M41, |
669 | matrix.M12, matrix.M22, matrix.M32, matrix.M42, | 669 | matrix.M12, matrix.M22, matrix.M32, matrix.M42, |
670 | matrix.M13, matrix.M23, matrix.M33, matrix.M43, | 670 | matrix.M13, matrix.M23, matrix.M33, matrix.M43, |
671 | matrix.M14, matrix.M24, matrix.M34, matrix.M44); | 671 | matrix.M14, matrix.M24, matrix.M34, matrix.M44); |
672 | //--- | 672 | //--- |
673 | //throw new NotImplementedException(); | 673 | //throw new NotImplementedException(); |
674 | } | 674 | } |
675 | 675 | ||
676 | 676 | ||
677 | public static void Transpose(ref Matrix matrix, out Matrix result) | 677 | public static void Transpose(ref Matrix matrix, out Matrix result) |
678 | { | 678 | { |
679 | throw new NotImplementedException(); | 679 | throw new NotImplementedException(); |
680 | } | 680 | } |
681 | #endregion Public Methods | 681 | #endregion Public Methods |
682 | } | 682 | } |
683 | } | 683 | } |
diff --git a/libraries/ModifiedBulletX/MonoXnaCompactMaths/MonoXnaCompactMaths.csproj b/libraries/ModifiedBulletX/MonoXnaCompactMaths/MonoXnaCompactMaths.csproj index c3ec4dd..79c5263 100644 --- a/libraries/ModifiedBulletX/MonoXnaCompactMaths/MonoXnaCompactMaths.csproj +++ b/libraries/ModifiedBulletX/MonoXnaCompactMaths/MonoXnaCompactMaths.csproj | |||
@@ -1,51 +1,51 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | 2 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
3 | <PropertyGroup> | 3 | <PropertyGroup> |
4 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | 4 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
5 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | 5 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
6 | <ProductVersion>8.0.50727</ProductVersion> | 6 | <ProductVersion>8.0.50727</ProductVersion> |
7 | <SchemaVersion>2.0</SchemaVersion> | 7 | <SchemaVersion>2.0</SchemaVersion> |
8 | <ProjectGuid>{121147BC-B06B-406C-84E9-907F268CF0EB}</ProjectGuid> | 8 | <ProjectGuid>{121147BC-B06B-406C-84E9-907F268CF0EB}</ProjectGuid> |
9 | <OutputType>Library</OutputType> | 9 | <OutputType>Library</OutputType> |
10 | <AppDesignerFolder>Properties</AppDesignerFolder> | 10 | <AppDesignerFolder>Properties</AppDesignerFolder> |
11 | <RootNamespace>MonoXnaCompactMaths</RootNamespace> | 11 | <RootNamespace>MonoXnaCompactMaths</RootNamespace> |
12 | <AssemblyName>MonoXnaCompactMaths</AssemblyName> | 12 | <AssemblyName>MonoXnaCompactMaths</AssemblyName> |
13 | <StartupObject> | 13 | <StartupObject> |
14 | </StartupObject> | 14 | </StartupObject> |
15 | </PropertyGroup> | 15 | </PropertyGroup> |
16 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | 16 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
17 | <DebugSymbols>true</DebugSymbols> | 17 | <DebugSymbols>true</DebugSymbols> |
18 | <DebugType>full</DebugType> | 18 | <DebugType>full</DebugType> |
19 | <Optimize>false</Optimize> | 19 | <Optimize>false</Optimize> |
20 | <OutputPath>bin\Debug\</OutputPath> | 20 | <OutputPath>bin\Debug\</OutputPath> |
21 | <DefineConstants>DEBUG;TRACE</DefineConstants> | 21 | <DefineConstants>DEBUG;TRACE</DefineConstants> |
22 | <ErrorReport>prompt</ErrorReport> | 22 | <ErrorReport>prompt</ErrorReport> |
23 | <WarningLevel>4</WarningLevel> | 23 | <WarningLevel>4</WarningLevel> |
24 | </PropertyGroup> | 24 | </PropertyGroup> |
25 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | 25 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
26 | <DebugType>pdbonly</DebugType> | 26 | <DebugType>pdbonly</DebugType> |
27 | <Optimize>true</Optimize> | 27 | <Optimize>true</Optimize> |
28 | <OutputPath>bin\Release\</OutputPath> | 28 | <OutputPath>bin\Release\</OutputPath> |
29 | <DefineConstants>TRACE</DefineConstants> | 29 | <DefineConstants>TRACE</DefineConstants> |
30 | <ErrorReport>prompt</ErrorReport> | 30 | <ErrorReport>prompt</ErrorReport> |
31 | <WarningLevel>4</WarningLevel> | 31 | <WarningLevel>4</WarningLevel> |
32 | </PropertyGroup> | 32 | </PropertyGroup> |
33 | <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> | 33 | <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> |
34 | <!-- To modify your build process, add your task inside one of the targets below and uncomment it. | 34 | <!-- To modify your build process, add your task inside one of the targets below and uncomment it. |
35 | Other similar extension points exist, see Microsoft.Common.targets. | 35 | Other similar extension points exist, see Microsoft.Common.targets. |
36 | <Target Name="BeforeBuild"> | 36 | <Target Name="BeforeBuild"> |
37 | </Target> | 37 | </Target> |
38 | <Target Name="AfterBuild"> | 38 | <Target Name="AfterBuild"> |
39 | </Target> | 39 | </Target> |
40 | --> | 40 | --> |
41 | <ItemGroup> | 41 | <ItemGroup> |
42 | <Compile Include="Matrix.cs" /> | 42 | <Compile Include="Matrix.cs" /> |
43 | <Compile Include="Properties\AssemblyInfo.cs" /> | 43 | <Compile Include="Properties\AssemblyInfo.cs" /> |
44 | <Compile Include="Quaternion.cs" /> | 44 | <Compile Include="Quaternion.cs" /> |
45 | <Compile Include="Vector3.cs" /> | 45 | <Compile Include="Vector3.cs" /> |
46 | <Compile Include="Vector4.cs" /> | 46 | <Compile Include="Vector4.cs" /> |
47 | </ItemGroup> | 47 | </ItemGroup> |
48 | <ItemGroup> | 48 | <ItemGroup> |
49 | <Reference Include="System" /> | 49 | <Reference Include="System" /> |
50 | </ItemGroup> | 50 | </ItemGroup> |
51 | </Project> \ No newline at end of file | 51 | </Project> \ No newline at end of file |
diff --git a/libraries/ModifiedBulletX/MonoXnaCompactMaths/Properties/AssemblyInfo.cs b/libraries/ModifiedBulletX/MonoXnaCompactMaths/Properties/AssemblyInfo.cs index 748b94a..366f664 100644 --- a/libraries/ModifiedBulletX/MonoXnaCompactMaths/Properties/AssemblyInfo.cs +++ b/libraries/ModifiedBulletX/MonoXnaCompactMaths/Properties/AssemblyInfo.cs | |||
@@ -1,33 +1,33 @@ | |||
1 | using System.Reflection; | 1 | using System.Reflection; |
2 | using System.Runtime.CompilerServices; | 2 | using System.Runtime.CompilerServices; |
3 | using System.Runtime.InteropServices; | 3 | using System.Runtime.InteropServices; |
4 | 4 | ||
5 | // La información general sobre un ensamblado se controla mediante el siguiente | 5 | // La información general sobre un ensamblado se controla mediante el siguiente |
6 | // conjunto de atributos. Cambie estos atributos para modificar la información | 6 | // conjunto de atributos. Cambie estos atributos para modificar la información |
7 | // asociada con un ensamblado. | 7 | // asociada con un ensamblado. |
8 | [assembly: AssemblyTitle("MonoXnaCompactMaths")] | 8 | [assembly: AssemblyTitle("MonoXnaCompactMaths")] |
9 | [assembly: AssemblyDescription("MonoXnaCompactMaths (Vector3, Vector4, Quaternion and Matrix)")] | 9 | [assembly: AssemblyDescription("MonoXnaCompactMaths (Vector3, Vector4, Quaternion and Matrix)")] |
10 | [assembly: AssemblyConfiguration("")] | 10 | [assembly: AssemblyConfiguration("")] |
11 | [assembly: AssemblyCompany("")] | 11 | [assembly: AssemblyCompany("")] |
12 | [assembly: AssemblyProduct("")] | 12 | [assembly: AssemblyProduct("")] |
13 | [assembly: AssemblyCopyright("Copyright 2006 - 2007 The Mono.Xna Team")] | 13 | [assembly: AssemblyCopyright("Copyright 2006 - 2007 The Mono.Xna Team")] |
14 | [assembly: AssemblyTrademark("")] | 14 | [assembly: AssemblyTrademark("")] |
15 | [assembly: AssemblyCulture("")] | 15 | [assembly: AssemblyCulture("")] |
16 | 16 | ||
17 | // Si establece ComVisible como false hace que los tipos de este ensamblado no sean visibles | 17 | // Si establece ComVisible como false hace que los tipos de este ensamblado no sean visibles |
18 | // a los componentes COM. Si necesita obtener acceso a un tipo en este ensamblado desde | 18 | // a los componentes COM. Si necesita obtener acceso a un tipo en este ensamblado desde |
19 | // COM, establezca el atributo ComVisible como true en este tipo. | 19 | // COM, establezca el atributo ComVisible como true en este tipo. |
20 | [assembly: ComVisible(false)] | 20 | [assembly: ComVisible(false)] |
21 | 21 | ||
22 | // El siguiente GUID sirve como identificador de la biblioteca de tipos si este proyecto se expone a COM | 22 | // El siguiente GUID sirve como identificador de la biblioteca de tipos si este proyecto se expone a COM |
23 | [assembly: Guid("79f9dfd1-60f8-44b8-ab08-6f6e341976b7")] | 23 | [assembly: Guid("79f9dfd1-60f8-44b8-ab08-6f6e341976b7")] |
24 | 24 | ||
25 | // La información de versión de un ensamblado consta de los cuatro valores siguientes: | 25 | // La información de versión de un ensamblado consta de los cuatro valores siguientes: |
26 | // | 26 | // |
27 | // Versión principal | 27 | // Versión principal |
28 | // Versión secundaria | 28 | // Versión secundaria |
29 | // Número de versión de compilación | 29 | // Número de versión de compilación |
30 | // Revisión | 30 | // Revisión |
31 | // | 31 | // |
32 | [assembly: AssemblyVersion("1.0.0.0")] | 32 | [assembly: AssemblyVersion("1.0.0.0")] |
33 | [assembly: AssemblyFileVersion("1.0.0.0")] | 33 | [assembly: AssemblyFileVersion("1.0.0.0")] |
diff --git a/libraries/ModifiedBulletX/MonoXnaCompactMaths/Quaternion.cs b/libraries/ModifiedBulletX/MonoXnaCompactMaths/Quaternion.cs index 6ed1443..b4f1873 100644 --- a/libraries/ModifiedBulletX/MonoXnaCompactMaths/Quaternion.cs +++ b/libraries/ModifiedBulletX/MonoXnaCompactMaths/Quaternion.cs | |||
@@ -1,346 +1,346 @@ | |||
1 | #region License | 1 | #region License |
2 | /* | 2 | /* |
3 | MIT License | 3 | MIT License |
4 | Copyright © 2006 The Mono.Xna Team | 4 | Copyright © 2006 The Mono.Xna Team |
5 | 5 | ||
6 | All rights reserved. | 6 | All rights reserved. |
7 | 7 | ||
8 | Permission is hereby granted, free of charge, to any person obtaining a copy | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy |
9 | of this software and associated documentation files (the "Software"), to deal | 9 | of this software and associated documentation files (the "Software"), to deal |
10 | in the Software without restriction, including without limitation the rights | 10 | in the Software without restriction, including without limitation the rights |
11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | 11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
12 | copies of the Software, and to permit persons to whom the Software is | 12 | copies of the Software, and to permit persons to whom the Software is |
13 | furnished to do so, subject to the following conditions: | 13 | furnished to do so, subject to the following conditions: |
14 | 14 | ||
15 | The above copyright notice and this permission notice shall be included in all | 15 | The above copyright notice and this permission notice shall be included in all |
16 | copies or substantial portions of the Software. | 16 | copies or substantial portions of the Software. |
17 | 17 | ||
18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
24 | SOFTWARE. | 24 | SOFTWARE. |
25 | */ | 25 | */ |
26 | #endregion License | 26 | #endregion License |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.ComponentModel; | 29 | using System.ComponentModel; |
30 | 30 | ||
31 | namespace MonoXnaCompactMaths | 31 | namespace MonoXnaCompactMaths |
32 | { | 32 | { |
33 | [Serializable] | 33 | [Serializable] |
34 | //[TypeConverter(typeof(QuaternionConverter))] | 34 | //[TypeConverter(typeof(QuaternionConverter))] |
35 | public struct Quaternion : IEquatable<Quaternion> | 35 | public struct Quaternion : IEquatable<Quaternion> |
36 | { | 36 | { |
37 | public float X; | 37 | public float X; |
38 | public float Y; | 38 | public float Y; |
39 | public float Z; | 39 | public float Z; |
40 | public float W; | 40 | public float W; |
41 | static Quaternion identity = new Quaternion(0, 0, 0, 1); | 41 | static Quaternion identity = new Quaternion(0, 0, 0, 1); |
42 | 42 | ||
43 | 43 | ||
44 | public Quaternion(float x, float y, float z, float w) | 44 | public Quaternion(float x, float y, float z, float w) |
45 | { | 45 | { |
46 | this.X = x; | 46 | this.X = x; |
47 | this.Y = y; | 47 | this.Y = y; |
48 | this.Z = z; | 48 | this.Z = z; |
49 | this.W = w; | 49 | this.W = w; |
50 | } | 50 | } |
51 | 51 | ||
52 | 52 | ||
53 | public Quaternion(Vector3 vectorPart, float scalarPart) | 53 | public Quaternion(Vector3 vectorPart, float scalarPart) |
54 | { | 54 | { |
55 | this.X = vectorPart.X; | 55 | this.X = vectorPart.X; |
56 | this.Y = vectorPart.Y; | 56 | this.Y = vectorPart.Y; |
57 | this.Z = vectorPart.Z; | 57 | this.Z = vectorPart.Z; |
58 | this.W = scalarPart; | 58 | this.W = scalarPart; |
59 | } | 59 | } |
60 | 60 | ||
61 | public static Quaternion Identity | 61 | public static Quaternion Identity |
62 | { | 62 | { |
63 | get{ return identity; } | 63 | get{ return identity; } |
64 | } | 64 | } |
65 | 65 | ||
66 | 66 | ||
67 | public static Quaternion Add(Quaternion quaternion1, Quaternion quaternion2) | 67 | public static Quaternion Add(Quaternion quaternion1, Quaternion quaternion2) |
68 | { | 68 | { |
69 | throw new NotImplementedException(); | 69 | throw new NotImplementedException(); |
70 | } | 70 | } |
71 | 71 | ||
72 | 72 | ||
73 | public static void Add(ref Quaternion quaternion1, ref Quaternion quaternion2, out Quaternion result) | 73 | public static void Add(ref Quaternion quaternion1, ref Quaternion quaternion2, out Quaternion result) |
74 | { | 74 | { |
75 | throw new NotImplementedException(); | 75 | throw new NotImplementedException(); |
76 | } | 76 | } |
77 | 77 | ||
78 | 78 | ||
79 | public static Quaternion CreateFromAxisAngle(Vector3 axis, float angle) | 79 | public static Quaternion CreateFromAxisAngle(Vector3 axis, float angle) |
80 | { | 80 | { |
81 | throw new NotImplementedException(); | 81 | throw new NotImplementedException(); |
82 | } | 82 | } |
83 | 83 | ||
84 | 84 | ||
85 | public static void CreateFromAxisAngle(ref Vector3 axis, float angle, out Quaternion result) | 85 | public static void CreateFromAxisAngle(ref Vector3 axis, float angle, out Quaternion result) |
86 | { | 86 | { |
87 | throw new NotImplementedException(); | 87 | throw new NotImplementedException(); |
88 | } | 88 | } |
89 | 89 | ||
90 | 90 | ||
91 | public static Quaternion CreateFromRotationMatrix(Matrix matrix) | 91 | public static Quaternion CreateFromRotationMatrix(Matrix matrix) |
92 | { | 92 | { |
93 | throw new NotImplementedException(); | 93 | throw new NotImplementedException(); |
94 | } | 94 | } |
95 | 95 | ||
96 | 96 | ||
97 | public static void CreateFromRotationMatrix(ref Matrix matrix, out Quaternion result) | 97 | public static void CreateFromRotationMatrix(ref Matrix matrix, out Quaternion result) |
98 | { | 98 | { |
99 | throw new NotImplementedException(); | 99 | throw new NotImplementedException(); |
100 | } | 100 | } |
101 | 101 | ||
102 | 102 | ||
103 | public static Quaternion Divide(Quaternion quaternion1, Quaternion quaternion2) | 103 | public static Quaternion Divide(Quaternion quaternion1, Quaternion quaternion2) |
104 | { | 104 | { |
105 | throw new NotImplementedException(); | 105 | throw new NotImplementedException(); |
106 | } | 106 | } |
107 | 107 | ||
108 | 108 | ||
109 | public static void Divide(ref Quaternion quaternion1, ref Quaternion quaternion2, out Quaternion result) | 109 | public static void Divide(ref Quaternion quaternion1, ref Quaternion quaternion2, out Quaternion result) |
110 | { | 110 | { |
111 | throw new NotImplementedException(); | 111 | throw new NotImplementedException(); |
112 | } | 112 | } |
113 | 113 | ||
114 | 114 | ||
115 | public static float Dot(Quaternion quaternion1, Quaternion quaternion2) | 115 | public static float Dot(Quaternion quaternion1, Quaternion quaternion2) |
116 | { | 116 | { |
117 | throw new NotImplementedException(); | 117 | throw new NotImplementedException(); |
118 | } | 118 | } |
119 | 119 | ||
120 | 120 | ||
121 | public static void Dot(ref Quaternion quaternion1, ref Quaternion quaternion2, out float result) | 121 | public static void Dot(ref Quaternion quaternion1, ref Quaternion quaternion2, out float result) |
122 | { | 122 | { |
123 | throw new NotImplementedException(); | 123 | throw new NotImplementedException(); |
124 | } | 124 | } |
125 | 125 | ||
126 | 126 | ||
127 | public override bool Equals(object obj) | 127 | public override bool Equals(object obj) |
128 | { | 128 | { |
129 | throw new NotImplementedException(); | 129 | throw new NotImplementedException(); |
130 | } | 130 | } |
131 | 131 | ||
132 | 132 | ||
133 | public bool Equals(Quaternion other) | 133 | public bool Equals(Quaternion other) |
134 | { | 134 | { |
135 | throw new NotImplementedException(); | 135 | throw new NotImplementedException(); |
136 | } | 136 | } |
137 | 137 | ||
138 | 138 | ||
139 | public override int GetHashCode() | 139 | public override int GetHashCode() |
140 | { | 140 | { |
141 | throw new NotImplementedException(); | 141 | throw new NotImplementedException(); |
142 | } | 142 | } |
143 | 143 | ||
144 | 144 | ||
145 | public static Quaternion Inverse(Quaternion quaternion) | 145 | public static Quaternion Inverse(Quaternion quaternion) |
146 | { | 146 | { |
147 | throw new NotImplementedException(); | 147 | throw new NotImplementedException(); |
148 | } | 148 | } |
149 | 149 | ||
150 | 150 | ||
151 | public static void Inverse(ref Quaternion quaternion, out Quaternion result) | 151 | public static void Inverse(ref Quaternion quaternion, out Quaternion result) |
152 | { | 152 | { |
153 | throw new NotImplementedException(); | 153 | throw new NotImplementedException(); |
154 | } | 154 | } |
155 | 155 | ||
156 | 156 | ||
157 | public float Length() | 157 | public float Length() |
158 | { | 158 | { |
159 | //--- | 159 | //--- |
160 | return (float)Math.Sqrt(Math.Pow(this.W, 2.0) + Math.Pow(this.X, 2.0) + Math.Pow(this.Y, 2.0) + Math.Pow(this.Z, 2.0)); | 160 | return (float)Math.Sqrt(Math.Pow(this.W, 2.0) + Math.Pow(this.X, 2.0) + Math.Pow(this.Y, 2.0) + Math.Pow(this.Z, 2.0)); |
161 | //--- | 161 | //--- |
162 | //throw new NotImplementedException(); | 162 | //throw new NotImplementedException(); |
163 | } | 163 | } |
164 | 164 | ||
165 | 165 | ||
166 | public float LengthSquared() | 166 | public float LengthSquared() |
167 | { | 167 | { |
168 | //--- | 168 | //--- |
169 | return (float)(Math.Pow(this.W, 2.0) + Math.Pow(this.X, 2.0) + Math.Pow(this.Y, 2.0) + Math.Pow(this.Z, 2.0)); | 169 | return (float)(Math.Pow(this.W, 2.0) + Math.Pow(this.X, 2.0) + Math.Pow(this.Y, 2.0) + Math.Pow(this.Z, 2.0)); |
170 | //--- | 170 | //--- |
171 | //throw new NotImplementedException(); | 171 | //throw new NotImplementedException(); |
172 | } | 172 | } |
173 | 173 | ||
174 | 174 | ||
175 | public static Quaternion Lerp(Quaternion quaternion1, Quaternion quaternion2, float amount) | 175 | public static Quaternion Lerp(Quaternion quaternion1, Quaternion quaternion2, float amount) |
176 | { | 176 | { |
177 | throw new NotImplementedException(); | 177 | throw new NotImplementedException(); |
178 | } | 178 | } |
179 | 179 | ||
180 | 180 | ||
181 | public static void Lerp(ref Quaternion quaternion1, ref Quaternion quaternion2, float amount, out Quaternion result) | 181 | public static void Lerp(ref Quaternion quaternion1, ref Quaternion quaternion2, float amount, out Quaternion result) |
182 | { | 182 | { |
183 | throw new NotImplementedException(); | 183 | throw new NotImplementedException(); |
184 | } | 184 | } |
185 | 185 | ||
186 | 186 | ||
187 | public static Quaternion Slerp(Quaternion quaternion1, Quaternion quaternion2, float amount) | 187 | public static Quaternion Slerp(Quaternion quaternion1, Quaternion quaternion2, float amount) |
188 | { | 188 | { |
189 | throw new NotImplementedException(); | 189 | throw new NotImplementedException(); |
190 | } | 190 | } |
191 | 191 | ||
192 | 192 | ||
193 | public static void Slerp(ref Quaternion quaternion1, ref Quaternion quaternion2, float amount, out Quaternion result) | 193 | public static void Slerp(ref Quaternion quaternion1, ref Quaternion quaternion2, float amount, out Quaternion result) |
194 | { | 194 | { |
195 | throw new NotImplementedException(); | 195 | throw new NotImplementedException(); |
196 | } | 196 | } |
197 | 197 | ||
198 | 198 | ||
199 | public static Quaternion Subtract(Quaternion quaternion1, Quaternion quaternion2) | 199 | public static Quaternion Subtract(Quaternion quaternion1, Quaternion quaternion2) |
200 | { | 200 | { |
201 | throw new NotImplementedException(); | 201 | throw new NotImplementedException(); |
202 | } | 202 | } |
203 | 203 | ||
204 | 204 | ||
205 | public static void Subtract(ref Quaternion quaternion1, ref Quaternion quaternion2, out Quaternion result) | 205 | public static void Subtract(ref Quaternion quaternion1, ref Quaternion quaternion2, out Quaternion result) |
206 | { | 206 | { |
207 | throw new NotImplementedException(); | 207 | throw new NotImplementedException(); |
208 | } | 208 | } |
209 | 209 | ||
210 | 210 | ||
211 | public static Quaternion Multiply(Quaternion quaternion1, Quaternion quaternion2) | 211 | public static Quaternion Multiply(Quaternion quaternion1, Quaternion quaternion2) |
212 | { | 212 | { |
213 | throw new NotImplementedException(); | 213 | throw new NotImplementedException(); |
214 | } | 214 | } |
215 | 215 | ||
216 | 216 | ||
217 | public static Quaternion Multiply(Quaternion quaternion1, float scaleFactor) | 217 | public static Quaternion Multiply(Quaternion quaternion1, float scaleFactor) |
218 | { | 218 | { |
219 | throw new NotImplementedException(); | 219 | throw new NotImplementedException(); |
220 | } | 220 | } |
221 | 221 | ||
222 | 222 | ||
223 | public static void Multiply(ref Quaternion quaternion1, float scaleFactor, out Quaternion result) | 223 | public static void Multiply(ref Quaternion quaternion1, float scaleFactor, out Quaternion result) |
224 | { | 224 | { |
225 | throw new NotImplementedException(); | 225 | throw new NotImplementedException(); |
226 | } | 226 | } |
227 | 227 | ||
228 | 228 | ||
229 | public static void Multiply(ref Quaternion quaternion1, ref Quaternion quaternion2, out Quaternion result) | 229 | public static void Multiply(ref Quaternion quaternion1, ref Quaternion quaternion2, out Quaternion result) |
230 | { | 230 | { |
231 | throw new NotImplementedException(); | 231 | throw new NotImplementedException(); |
232 | } | 232 | } |
233 | 233 | ||
234 | 234 | ||
235 | public static Quaternion Negate(Quaternion quaternion) | 235 | public static Quaternion Negate(Quaternion quaternion) |
236 | { | 236 | { |
237 | throw new NotImplementedException(); | 237 | throw new NotImplementedException(); |
238 | } | 238 | } |
239 | 239 | ||
240 | 240 | ||
241 | public static void Negate(ref Quaternion quaternion, out Quaternion result) | 241 | public static void Negate(ref Quaternion quaternion, out Quaternion result) |
242 | { | 242 | { |
243 | throw new NotImplementedException(); | 243 | throw new NotImplementedException(); |
244 | } | 244 | } |
245 | 245 | ||
246 | 246 | ||
247 | public void Normalize() | 247 | public void Normalize() |
248 | { | 248 | { |
249 | //--- | 249 | //--- |
250 | this = Normalize(this); | 250 | this = Normalize(this); |
251 | //--- | 251 | //--- |
252 | //throw new NotImplementedException(); | 252 | //throw new NotImplementedException(); |
253 | } | 253 | } |
254 | 254 | ||
255 | 255 | ||
256 | public static Quaternion Normalize(Quaternion quaternion) | 256 | public static Quaternion Normalize(Quaternion quaternion) |
257 | { | 257 | { |
258 | //--- | 258 | //--- |
259 | return quaternion / quaternion.Length(); | 259 | return quaternion / quaternion.Length(); |
260 | //--- | 260 | //--- |
261 | //throw new NotImplementedException(); | 261 | //throw new NotImplementedException(); |
262 | } | 262 | } |
263 | 263 | ||
264 | 264 | ||
265 | public static void Normalize(ref Quaternion quaternion, out Quaternion result) | 265 | public static void Normalize(ref Quaternion quaternion, out Quaternion result) |
266 | { | 266 | { |
267 | throw new NotImplementedException(); | 267 | throw new NotImplementedException(); |
268 | } | 268 | } |
269 | 269 | ||
270 | 270 | ||
271 | public static Quaternion operator +(Quaternion quaternion1, Quaternion quaternion2) | 271 | public static Quaternion operator +(Quaternion quaternion1, Quaternion quaternion2) |
272 | { | 272 | { |
273 | throw new NotImplementedException(); | 273 | throw new NotImplementedException(); |
274 | } | 274 | } |
275 | 275 | ||
276 | 276 | ||
277 | public static Quaternion operator /(Quaternion quaternion1, Quaternion quaternion2) | 277 | public static Quaternion operator /(Quaternion quaternion1, Quaternion quaternion2) |
278 | { | 278 | { |
279 | throw new NotImplementedException(); | 279 | throw new NotImplementedException(); |
280 | } | 280 | } |
281 | public static Quaternion operator /(Quaternion quaternion, float factor) | 281 | public static Quaternion operator /(Quaternion quaternion, float factor) |
282 | { | 282 | { |
283 | quaternion.W /= factor; | 283 | quaternion.W /= factor; |
284 | quaternion.X /= factor; | 284 | quaternion.X /= factor; |
285 | quaternion.Y /= factor; | 285 | quaternion.Y /= factor; |
286 | quaternion.Z /= factor; | 286 | quaternion.Z /= factor; |
287 | return quaternion; | 287 | return quaternion; |
288 | } | 288 | } |
289 | 289 | ||
290 | public static bool operator ==(Quaternion quaternion1, Quaternion quaternion2) | 290 | public static bool operator ==(Quaternion quaternion1, Quaternion quaternion2) |
291 | { | 291 | { |
292 | throw new NotImplementedException(); | 292 | throw new NotImplementedException(); |
293 | } | 293 | } |
294 | 294 | ||
295 | 295 | ||
296 | public static bool operator !=(Quaternion quaternion1, Quaternion quaternion2) | 296 | public static bool operator !=(Quaternion quaternion1, Quaternion quaternion2) |
297 | { | 297 | { |
298 | throw new NotImplementedException(); | 298 | throw new NotImplementedException(); |
299 | } | 299 | } |
300 | 300 | ||
301 | 301 | ||
302 | public static Quaternion operator *(Quaternion quaternion1, Quaternion quaternion2) | 302 | public static Quaternion operator *(Quaternion quaternion1, Quaternion quaternion2) |
303 | { | 303 | { |
304 | //--- | 304 | //--- |
305 | //Grassmann product | 305 | //Grassmann product |
306 | Quaternion quaternionProduct = new Quaternion(); | 306 | Quaternion quaternionProduct = new Quaternion(); |
307 | 307 | ||
308 | quaternionProduct.W = quaternion1.W * quaternion2.W - quaternion1.X * quaternion2.X - quaternion1.Y * quaternion2.Y - quaternion1.Z * quaternion2.Z; | 308 | quaternionProduct.W = quaternion1.W * quaternion2.W - quaternion1.X * quaternion2.X - quaternion1.Y * quaternion2.Y - quaternion1.Z * quaternion2.Z; |
309 | quaternionProduct.X = quaternion1.W * quaternion2.X + quaternion1.X * quaternion2.W + quaternion1.Y * quaternion2.Z - quaternion1.Z * quaternion2.Y; | 309 | quaternionProduct.X = quaternion1.W * quaternion2.X + quaternion1.X * quaternion2.W + quaternion1.Y * quaternion2.Z - quaternion1.Z * quaternion2.Y; |
310 | quaternionProduct.Y = quaternion1.W * quaternion2.Y - quaternion1.X * quaternion2.Z + quaternion1.Y * quaternion2.W + quaternion1.Z * quaternion2.X; | 310 | quaternionProduct.Y = quaternion1.W * quaternion2.Y - quaternion1.X * quaternion2.Z + quaternion1.Y * quaternion2.W + quaternion1.Z * quaternion2.X; |
311 | quaternionProduct.Z = quaternion1.W * quaternion2.Z + quaternion1.X * quaternion2.Y - quaternion1.Y * quaternion2.X + quaternion1.Z * quaternion2.W; | 311 | quaternionProduct.Z = quaternion1.W * quaternion2.Z + quaternion1.X * quaternion2.Y - quaternion1.Y * quaternion2.X + quaternion1.Z * quaternion2.W; |
312 | return quaternionProduct; | 312 | return quaternionProduct; |
313 | //--- | 313 | //--- |
314 | //throw new NotImplementedException(); | 314 | //throw new NotImplementedException(); |
315 | } | 315 | } |
316 | 316 | ||
317 | 317 | ||
318 | public static Quaternion operator *(Quaternion quaternion1, float scaleFactor) | 318 | public static Quaternion operator *(Quaternion quaternion1, float scaleFactor) |
319 | { | 319 | { |
320 | throw new NotImplementedException(); | 320 | throw new NotImplementedException(); |
321 | } | 321 | } |
322 | 322 | ||
323 | 323 | ||
324 | public static Quaternion operator -(Quaternion quaternion1, Quaternion quaternion2) | 324 | public static Quaternion operator -(Quaternion quaternion1, Quaternion quaternion2) |
325 | { | 325 | { |
326 | throw new NotImplementedException(); | 326 | throw new NotImplementedException(); |
327 | } | 327 | } |
328 | 328 | ||
329 | 329 | ||
330 | public static Quaternion operator -(Quaternion quaternion) | 330 | public static Quaternion operator -(Quaternion quaternion) |
331 | { | 331 | { |
332 | throw new NotImplementedException(); | 332 | throw new NotImplementedException(); |
333 | } | 333 | } |
334 | 334 | ||
335 | 335 | ||
336 | public override string ToString() | 336 | public override string ToString() |
337 | { | 337 | { |
338 | throw new NotImplementedException(); | 338 | throw new NotImplementedException(); |
339 | } | 339 | } |
340 | 340 | ||
341 | private static void Conjugate(ref Quaternion quaternion, out Quaternion result) | 341 | private static void Conjugate(ref Quaternion quaternion, out Quaternion result) |
342 | { | 342 | { |
343 | throw new NotImplementedException(); | 343 | throw new NotImplementedException(); |
344 | } | 344 | } |
345 | } | 345 | } |
346 | } | 346 | } |
diff --git a/libraries/ModifiedBulletX/MonoXnaCompactMaths/Vector3.cs b/libraries/ModifiedBulletX/MonoXnaCompactMaths/Vector3.cs index fd4bcd2..f246415 100644 --- a/libraries/ModifiedBulletX/MonoXnaCompactMaths/Vector3.cs +++ b/libraries/ModifiedBulletX/MonoXnaCompactMaths/Vector3.cs | |||
@@ -1,620 +1,620 @@ | |||
1 | #region License | 1 | #region License |
2 | /* | 2 | /* |
3 | MIT License | 3 | MIT License |
4 | Copyright © 2006 The Mono.Xna Team | 4 | Copyright © 2006 The Mono.Xna Team |
5 | 5 | ||
6 | All rights reserved. | 6 | All rights reserved. |
7 | 7 | ||
8 | Authors: | 8 | Authors: |
9 | * Alan McGovern | 9 | * Alan McGovern |
10 | 10 | ||
11 | Permission is hereby granted, free of charge, to any person obtaining a copy | 11 | Permission is hereby granted, free of charge, to any person obtaining a copy |
12 | of this software and associated documentation files (the "Software"), to deal | 12 | of this software and associated documentation files (the "Software"), to deal |
13 | in the Software without restriction, including without limitation the rights | 13 | in the Software without restriction, including without limitation the rights |
14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | 14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
15 | copies of the Software, and to permit persons to whom the Software is | 15 | copies of the Software, and to permit persons to whom the Software is |
16 | furnished to do so, subject to the following conditions: | 16 | furnished to do so, subject to the following conditions: |
17 | 17 | ||
18 | The above copyright notice and this permission notice shall be included in all | 18 | The above copyright notice and this permission notice shall be included in all |
19 | copies or substantial portions of the Software. | 19 | copies or substantial portions of the Software. |
20 | 20 | ||
21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | 24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | 25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | 26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
27 | SOFTWARE. | 27 | SOFTWARE. |
28 | */ | 28 | */ |
29 | #endregion License | 29 | #endregion License |
30 | 30 | ||
31 | using System; | 31 | using System; |
32 | using System.ComponentModel; | 32 | using System.ComponentModel; |
33 | using System.Text; | 33 | using System.Text; |
34 | using System.Runtime.InteropServices; | 34 | using System.Runtime.InteropServices; |
35 | 35 | ||
36 | namespace MonoXnaCompactMaths | 36 | namespace MonoXnaCompactMaths |
37 | { | 37 | { |
38 | [Serializable] | 38 | [Serializable] |
39 | [StructLayout(LayoutKind.Sequential)] | 39 | [StructLayout(LayoutKind.Sequential)] |
40 | //[TypeConverter(typeof(Vector3Converter))] | 40 | //[TypeConverter(typeof(Vector3Converter))] |
41 | public struct Vector3 : IEquatable<Vector3> | 41 | public struct Vector3 : IEquatable<Vector3> |
42 | { | 42 | { |
43 | #region Private Fields | 43 | #region Private Fields |
44 | 44 | ||
45 | private static Vector3 zero = new Vector3(0f, 0f, 0f); | 45 | private static Vector3 zero = new Vector3(0f, 0f, 0f); |
46 | private static Vector3 one = new Vector3(1f, 1f, 1f); | 46 | private static Vector3 one = new Vector3(1f, 1f, 1f); |
47 | private static Vector3 unitX = new Vector3(1f, 0f, 0f); | 47 | private static Vector3 unitX = new Vector3(1f, 0f, 0f); |
48 | private static Vector3 unitY = new Vector3(0f, 1f, 0f); | 48 | private static Vector3 unitY = new Vector3(0f, 1f, 0f); |
49 | private static Vector3 unitZ = new Vector3(0f, 0f, 1f); | 49 | private static Vector3 unitZ = new Vector3(0f, 0f, 1f); |
50 | private static Vector3 up = new Vector3(0f, 1f, 0f); | 50 | private static Vector3 up = new Vector3(0f, 1f, 0f); |
51 | private static Vector3 down = new Vector3(0f, -1f, 0f); | 51 | private static Vector3 down = new Vector3(0f, -1f, 0f); |
52 | private static Vector3 right = new Vector3(1f, 0f, 0f); | 52 | private static Vector3 right = new Vector3(1f, 0f, 0f); |
53 | private static Vector3 left = new Vector3(-1f, 0f, 0f); | 53 | private static Vector3 left = new Vector3(-1f, 0f, 0f); |
54 | private static Vector3 forward = new Vector3(0f, 0f, -1f); | 54 | private static Vector3 forward = new Vector3(0f, 0f, -1f); |
55 | private static Vector3 backward = new Vector3(0f, 0f, 1f); | 55 | private static Vector3 backward = new Vector3(0f, 0f, 1f); |
56 | 56 | ||
57 | #endregion Private Fields | 57 | #endregion Private Fields |
58 | 58 | ||
59 | 59 | ||
60 | #region Public Fields | 60 | #region Public Fields |
61 | 61 | ||
62 | public float X; | 62 | public float X; |
63 | public float Y; | 63 | public float Y; |
64 | public float Z; | 64 | public float Z; |
65 | 65 | ||
66 | #endregion Public Fields | 66 | #endregion Public Fields |
67 | 67 | ||
68 | 68 | ||
69 | #region Properties | 69 | #region Properties |
70 | 70 | ||
71 | public static Vector3 Zero | 71 | public static Vector3 Zero |
72 | { | 72 | { |
73 | get { return zero; } | 73 | get { return zero; } |
74 | } | 74 | } |
75 | 75 | ||
76 | public static Vector3 One | 76 | public static Vector3 One |
77 | { | 77 | { |
78 | get { return one; } | 78 | get { return one; } |
79 | } | 79 | } |
80 | 80 | ||
81 | public static Vector3 UnitX | 81 | public static Vector3 UnitX |
82 | { | 82 | { |
83 | get { return unitX; } | 83 | get { return unitX; } |
84 | } | 84 | } |
85 | 85 | ||
86 | public static Vector3 UnitY | 86 | public static Vector3 UnitY |
87 | { | 87 | { |
88 | get { return unitY; } | 88 | get { return unitY; } |
89 | } | 89 | } |
90 | 90 | ||
91 | public static Vector3 UnitZ | 91 | public static Vector3 UnitZ |
92 | { | 92 | { |
93 | get { return unitZ; } | 93 | get { return unitZ; } |
94 | } | 94 | } |
95 | 95 | ||
96 | public static Vector3 Up | 96 | public static Vector3 Up |
97 | { | 97 | { |
98 | get { return up; } | 98 | get { return up; } |
99 | } | 99 | } |
100 | 100 | ||
101 | public static Vector3 Down | 101 | public static Vector3 Down |
102 | { | 102 | { |
103 | get { return down; } | 103 | get { return down; } |
104 | } | 104 | } |
105 | 105 | ||
106 | public static Vector3 Right | 106 | public static Vector3 Right |
107 | { | 107 | { |
108 | get { return right; } | 108 | get { return right; } |
109 | } | 109 | } |
110 | 110 | ||
111 | public static Vector3 Left | 111 | public static Vector3 Left |
112 | { | 112 | { |
113 | get { return left; } | 113 | get { return left; } |
114 | } | 114 | } |
115 | 115 | ||
116 | public static Vector3 Forward | 116 | public static Vector3 Forward |
117 | { | 117 | { |
118 | get { return forward; } | 118 | get { return forward; } |
119 | } | 119 | } |
120 | 120 | ||
121 | public static Vector3 Backward | 121 | public static Vector3 Backward |
122 | { | 122 | { |
123 | get { return backward; } | 123 | get { return backward; } |
124 | } | 124 | } |
125 | 125 | ||
126 | #endregion Properties | 126 | #endregion Properties |
127 | 127 | ||
128 | 128 | ||
129 | #region Constructors | 129 | #region Constructors |
130 | 130 | ||
131 | public Vector3(float x, float y, float z) | 131 | public Vector3(float x, float y, float z) |
132 | { | 132 | { |
133 | this.X = x; | 133 | this.X = x; |
134 | this.Y = y; | 134 | this.Y = y; |
135 | this.Z = z; | 135 | this.Z = z; |
136 | } | 136 | } |
137 | 137 | ||
138 | 138 | ||
139 | public Vector3(float value) | 139 | public Vector3(float value) |
140 | { | 140 | { |
141 | this.X = value; | 141 | this.X = value; |
142 | this.Y = value; | 142 | this.Y = value; |
143 | this.Z = value; | 143 | this.Z = value; |
144 | } | 144 | } |
145 | 145 | ||
146 | 146 | ||
147 | /*public Vector3(Vector2 value, float z) | 147 | /*public Vector3(Vector2 value, float z) |
148 | { | 148 | { |
149 | this.X = value.X; | 149 | this.X = value.X; |
150 | this.Y = value.Y; | 150 | this.Y = value.Y; |
151 | this.Z = z; | 151 | this.Z = z; |
152 | }*/ | 152 | }*/ |
153 | 153 | ||
154 | 154 | ||
155 | #endregion Constructors | 155 | #endregion Constructors |
156 | 156 | ||
157 | 157 | ||
158 | #region Public Methods | 158 | #region Public Methods |
159 | 159 | ||
160 | public static Vector3 Add(Vector3 value1, Vector3 value2) | 160 | public static Vector3 Add(Vector3 value1, Vector3 value2) |
161 | { | 161 | { |
162 | value1.X += value2.X; | 162 | value1.X += value2.X; |
163 | value1.Y += value2.Y; | 163 | value1.Y += value2.Y; |
164 | value1.Z += value2.Z; | 164 | value1.Z += value2.Z; |
165 | return value1; | 165 | return value1; |
166 | } | 166 | } |
167 | 167 | ||
168 | public static void Add(ref Vector3 value1, ref Vector3 value2, out Vector3 result) | 168 | public static void Add(ref Vector3 value1, ref Vector3 value2, out Vector3 result) |
169 | { | 169 | { |
170 | result.X = value1.X + value2.X; | 170 | result.X = value1.X + value2.X; |
171 | result.Y = value1.Y + value2.Y; | 171 | result.Y = value1.Y + value2.Y; |
172 | result.Z = value1.Z + value2.Z; | 172 | result.Z = value1.Z + value2.Z; |
173 | } | 173 | } |
174 | 174 | ||
175 | /*public static Vector3 Barycentric(Vector3 value1, Vector3 value2, Vector3 value3, float amount1, float amount2) | 175 | /*public static Vector3 Barycentric(Vector3 value1, Vector3 value2, Vector3 value3, float amount1, float amount2) |
176 | { | 176 | { |
177 | return new Vector3( | 177 | return new Vector3( |
178 | MathHelper.Barycentric(value1.X, value2.X, value3.X, amount1, amount2), | 178 | MathHelper.Barycentric(value1.X, value2.X, value3.X, amount1, amount2), |
179 | MathHelper.Barycentric(value1.Y, value2.Y, value3.Y, amount1, amount2), | 179 | MathHelper.Barycentric(value1.Y, value2.Y, value3.Y, amount1, amount2), |
180 | MathHelper.Barycentric(value1.Z, value2.Z, value3.Z, amount1, amount2)); | 180 | MathHelper.Barycentric(value1.Z, value2.Z, value3.Z, amount1, amount2)); |
181 | }*/ | 181 | }*/ |
182 | 182 | ||
183 | /*public static void Barycentric(ref Vector3 value1, ref Vector3 value2, ref Vector3 value3, float amount1, float amount2, out Vector3 result) | 183 | /*public static void Barycentric(ref Vector3 value1, ref Vector3 value2, ref Vector3 value3, float amount1, float amount2, out Vector3 result) |
184 | { | 184 | { |
185 | result = new Vector3( | 185 | result = new Vector3( |
186 | MathHelper.Barycentric(value1.X, value2.X, value3.X, amount1, amount2), | 186 | MathHelper.Barycentric(value1.X, value2.X, value3.X, amount1, amount2), |
187 | MathHelper.Barycentric(value1.Y, value2.Y, value3.Y, amount1, amount2), | 187 | MathHelper.Barycentric(value1.Y, value2.Y, value3.Y, amount1, amount2), |
188 | MathHelper.Barycentric(value1.Z, value2.Z, value3.Z, amount1, amount2)); | 188 | MathHelper.Barycentric(value1.Z, value2.Z, value3.Z, amount1, amount2)); |
189 | }*/ | 189 | }*/ |
190 | 190 | ||
191 | /*public static Vector3 CatmullRom(Vector3 value1, Vector3 value2, Vector3 value3, Vector3 value4, float amount) | 191 | /*public static Vector3 CatmullRom(Vector3 value1, Vector3 value2, Vector3 value3, Vector3 value4, float amount) |
192 | { | 192 | { |
193 | return new Vector3( | 193 | return new Vector3( |
194 | MathHelper.CatmullRom(value1.X, value2.X, value3.X, value4.X, amount), | 194 | MathHelper.CatmullRom(value1.X, value2.X, value3.X, value4.X, amount), |
195 | MathHelper.CatmullRom(value1.Y, value2.Y, value3.Y, value4.Y, amount), | 195 | MathHelper.CatmullRom(value1.Y, value2.Y, value3.Y, value4.Y, amount), |
196 | MathHelper.CatmullRom(value1.Z, value2.Z, value3.Z, value4.Z, amount)); | 196 | MathHelper.CatmullRom(value1.Z, value2.Z, value3.Z, value4.Z, amount)); |
197 | }*/ | 197 | }*/ |
198 | 198 | ||
199 | /*public static void CatmullRom(ref Vector3 value1, ref Vector3 value2, ref Vector3 value3, ref Vector3 value4, float amount, out Vector3 result) | 199 | /*public static void CatmullRom(ref Vector3 value1, ref Vector3 value2, ref Vector3 value3, ref Vector3 value4, float amount, out Vector3 result) |
200 | { | 200 | { |
201 | result = new Vector3( | 201 | result = new Vector3( |
202 | MathHelper.CatmullRom(value1.X, value2.X, value3.X, value4.X, amount), | 202 | MathHelper.CatmullRom(value1.X, value2.X, value3.X, value4.X, amount), |
203 | MathHelper.CatmullRom(value1.Y, value2.Y, value3.Y, value4.Y, amount), | 203 | MathHelper.CatmullRom(value1.Y, value2.Y, value3.Y, value4.Y, amount), |
204 | MathHelper.CatmullRom(value1.Z, value2.Z, value3.Z, value4.Z, amount)); | 204 | MathHelper.CatmullRom(value1.Z, value2.Z, value3.Z, value4.Z, amount)); |
205 | }*/ | 205 | }*/ |
206 | 206 | ||
207 | /*public static Vector3 Clamp(Vector3 value1, Vector3 min, Vector3 max) | 207 | /*public static Vector3 Clamp(Vector3 value1, Vector3 min, Vector3 max) |
208 | { | 208 | { |
209 | return new Vector3( | 209 | return new Vector3( |
210 | MathHelper.Clamp(value1.X, min.X, max.X), | 210 | MathHelper.Clamp(value1.X, min.X, max.X), |
211 | MathHelper.Clamp(value1.Y, min.Y, max.Y), | 211 | MathHelper.Clamp(value1.Y, min.Y, max.Y), |
212 | MathHelper.Clamp(value1.Z, min.Z, max.Z)); | 212 | MathHelper.Clamp(value1.Z, min.Z, max.Z)); |
213 | }*/ | 213 | }*/ |
214 | 214 | ||
215 | /*public static void Clamp(ref Vector3 value1, ref Vector3 min, ref Vector3 max, out Vector3 result) | 215 | /*public static void Clamp(ref Vector3 value1, ref Vector3 min, ref Vector3 max, out Vector3 result) |
216 | { | 216 | { |
217 | result = new Vector3( | 217 | result = new Vector3( |
218 | MathHelper.Clamp(value1.X, min.X, max.X), | 218 | MathHelper.Clamp(value1.X, min.X, max.X), |
219 | MathHelper.Clamp(value1.Y, min.Y, max.Y), | 219 | MathHelper.Clamp(value1.Y, min.Y, max.Y), |
220 | MathHelper.Clamp(value1.Z, min.Z, max.Z)); | 220 | MathHelper.Clamp(value1.Z, min.Z, max.Z)); |
221 | }*/ | 221 | }*/ |
222 | 222 | ||
223 | public static Vector3 Cross(Vector3 vector1, Vector3 vector2) | 223 | public static Vector3 Cross(Vector3 vector1, Vector3 vector2) |
224 | { | 224 | { |
225 | Cross(ref vector1, ref vector2, out vector1); | 225 | Cross(ref vector1, ref vector2, out vector1); |
226 | return vector1; | 226 | return vector1; |
227 | } | 227 | } |
228 | 228 | ||
229 | public static void Cross(ref Vector3 vector1, ref Vector3 vector2, out Vector3 result) | 229 | public static void Cross(ref Vector3 vector1, ref Vector3 vector2, out Vector3 result) |
230 | { | 230 | { |
231 | result = new Vector3(vector1.Y * vector2.Z - vector2.Y * vector1.Z, | 231 | result = new Vector3(vector1.Y * vector2.Z - vector2.Y * vector1.Z, |
232 | -(vector1.X * vector2.Z - vector2.X * vector1.Z), | 232 | -(vector1.X * vector2.Z - vector2.X * vector1.Z), |
233 | vector1.X * vector2.Y - vector2.X * vector1.Y); | 233 | vector1.X * vector2.Y - vector2.X * vector1.Y); |
234 | } | 234 | } |
235 | 235 | ||
236 | public static float Distance(Vector3 vector1, Vector3 vector2) | 236 | public static float Distance(Vector3 vector1, Vector3 vector2) |
237 | { | 237 | { |
238 | float result; | 238 | float result; |
239 | DistanceSquared(ref vector1, ref vector2, out result); | 239 | DistanceSquared(ref vector1, ref vector2, out result); |
240 | return (float)Math.Sqrt(result); | 240 | return (float)Math.Sqrt(result); |
241 | } | 241 | } |
242 | 242 | ||
243 | public static void Distance(ref Vector3 value1, ref Vector3 value2, out float result) | 243 | public static void Distance(ref Vector3 value1, ref Vector3 value2, out float result) |
244 | { | 244 | { |
245 | DistanceSquared(ref value1, ref value2, out result); | 245 | DistanceSquared(ref value1, ref value2, out result); |
246 | result = (float)Math.Sqrt(result); | 246 | result = (float)Math.Sqrt(result); |
247 | } | 247 | } |
248 | 248 | ||
249 | public static float DistanceSquared(Vector3 value1, Vector3 value2) | 249 | public static float DistanceSquared(Vector3 value1, Vector3 value2) |
250 | { | 250 | { |
251 | float result; | 251 | float result; |
252 | DistanceSquared(ref value1, ref value2, out result); | 252 | DistanceSquared(ref value1, ref value2, out result); |
253 | return result; | 253 | return result; |
254 | } | 254 | } |
255 | 255 | ||
256 | public static void DistanceSquared(ref Vector3 value1, ref Vector3 value2, out float result) | 256 | public static void DistanceSquared(ref Vector3 value1, ref Vector3 value2, out float result) |
257 | { | 257 | { |
258 | result = (value1.X - value2.X) * (value1.X - value2.X) + | 258 | result = (value1.X - value2.X) * (value1.X - value2.X) + |
259 | (value1.Y - value2.Y) * (value1.Y - value2.Y) + | 259 | (value1.Y - value2.Y) * (value1.Y - value2.Y) + |
260 | (value1.Z - value2.Z) * (value1.Z - value2.Z); | 260 | (value1.Z - value2.Z) * (value1.Z - value2.Z); |
261 | } | 261 | } |
262 | 262 | ||
263 | public static Vector3 Divide(Vector3 value1, Vector3 value2) | 263 | public static Vector3 Divide(Vector3 value1, Vector3 value2) |
264 | { | 264 | { |
265 | value1.X /= value2.X; | 265 | value1.X /= value2.X; |
266 | value1.Y /= value2.Y; | 266 | value1.Y /= value2.Y; |
267 | value1.Z /= value2.Z; | 267 | value1.Z /= value2.Z; |
268 | return value1; | 268 | return value1; |
269 | } | 269 | } |
270 | 270 | ||
271 | public static Vector3 Divide(Vector3 value1, float value2) | 271 | public static Vector3 Divide(Vector3 value1, float value2) |
272 | { | 272 | { |
273 | float factor = 1 / value2; | 273 | float factor = 1 / value2; |
274 | value1.X *= factor; | 274 | value1.X *= factor; |
275 | value1.Y *= factor; | 275 | value1.Y *= factor; |
276 | value1.Z *= factor; | 276 | value1.Z *= factor; |
277 | return value1; | 277 | return value1; |
278 | } | 278 | } |
279 | 279 | ||
280 | public static void Divide(ref Vector3 value1, float divisor, out Vector3 result) | 280 | public static void Divide(ref Vector3 value1, float divisor, out Vector3 result) |
281 | { | 281 | { |
282 | float factor = 1 / divisor; | 282 | float factor = 1 / divisor; |
283 | result.X = value1.X * factor; | 283 | result.X = value1.X * factor; |
284 | result.Y = value1.Y * factor; | 284 | result.Y = value1.Y * factor; |
285 | result.Z = value1.Z * factor; | 285 | result.Z = value1.Z * factor; |
286 | } | 286 | } |
287 | 287 | ||
288 | public static void Divide(ref Vector3 value1, ref Vector3 value2, out Vector3 result) | 288 | public static void Divide(ref Vector3 value1, ref Vector3 value2, out Vector3 result) |
289 | { | 289 | { |
290 | result.X = value1.X / value2.X; | 290 | result.X = value1.X / value2.X; |
291 | result.Y = value1.Y / value2.Y; | 291 | result.Y = value1.Y / value2.Y; |
292 | result.Z = value1.Z / value2.Z; | 292 | result.Z = value1.Z / value2.Z; |
293 | } | 293 | } |
294 | 294 | ||
295 | public static float Dot(Vector3 vector1, Vector3 vector2) | 295 | public static float Dot(Vector3 vector1, Vector3 vector2) |
296 | { | 296 | { |
297 | return vector1.X * vector2.X + vector1.Y * vector2.Y + vector1.Z * vector2.Z; | 297 | return vector1.X * vector2.X + vector1.Y * vector2.Y + vector1.Z * vector2.Z; |
298 | } | 298 | } |
299 | 299 | ||
300 | public static void Dot(ref Vector3 vector1, ref Vector3 vector2, out float result) | 300 | public static void Dot(ref Vector3 vector1, ref Vector3 vector2, out float result) |
301 | { | 301 | { |
302 | result = vector1.X * vector2.X + vector1.Y * vector2.Y + vector1.Z * vector2.Z; | 302 | result = vector1.X * vector2.X + vector1.Y * vector2.Y + vector1.Z * vector2.Z; |
303 | } | 303 | } |
304 | 304 | ||
305 | public override bool Equals(object obj) | 305 | public override bool Equals(object obj) |
306 | { | 306 | { |
307 | return (obj is Vector3) ? this == (Vector3)obj : false; | 307 | return (obj is Vector3) ? this == (Vector3)obj : false; |
308 | } | 308 | } |
309 | 309 | ||
310 | public bool Equals(Vector3 other) | 310 | public bool Equals(Vector3 other) |
311 | { | 311 | { |
312 | return this == other; | 312 | return this == other; |
313 | } | 313 | } |
314 | 314 | ||
315 | public override int GetHashCode() | 315 | public override int GetHashCode() |
316 | { | 316 | { |
317 | return (int)(this.X + this.Y + this.Z); | 317 | return (int)(this.X + this.Y + this.Z); |
318 | } | 318 | } |
319 | 319 | ||
320 | /*public static Vector3 Hermite(Vector3 value1, Vector3 tangent1, Vector3 value2, Vector3 tangent2, float amount) | 320 | /*public static Vector3 Hermite(Vector3 value1, Vector3 tangent1, Vector3 value2, Vector3 tangent2, float amount) |
321 | { | 321 | { |
322 | Vector3 result = new Vector3(); | 322 | Vector3 result = new Vector3(); |
323 | Hermite(ref value1, ref tangent1, ref value2, ref tangent2, amount, out result); | 323 | Hermite(ref value1, ref tangent1, ref value2, ref tangent2, amount, out result); |
324 | return result; | 324 | return result; |
325 | }*/ | 325 | }*/ |
326 | 326 | ||
327 | /*public static void Hermite(ref Vector3 value1, ref Vector3 tangent1, ref Vector3 value2, ref Vector3 tangent2, float amount, out Vector3 result) | 327 | /*public static void Hermite(ref Vector3 value1, ref Vector3 tangent1, ref Vector3 value2, ref Vector3 tangent2, float amount, out Vector3 result) |
328 | { | 328 | { |
329 | result.X = MathHelper.Hermite(value1.X, tangent1.X, value2.X, tangent2.X, amount); | 329 | result.X = MathHelper.Hermite(value1.X, tangent1.X, value2.X, tangent2.X, amount); |
330 | result.Y = MathHelper.Hermite(value1.Y, tangent1.Y, value2.Y, tangent2.Y, amount); | 330 | result.Y = MathHelper.Hermite(value1.Y, tangent1.Y, value2.Y, tangent2.Y, amount); |
331 | result.Z = MathHelper.Hermite(value1.Z, tangent1.Z, value2.Z, tangent2.Z, amount); | 331 | result.Z = MathHelper.Hermite(value1.Z, tangent1.Z, value2.Z, tangent2.Z, amount); |
332 | }*/ | 332 | }*/ |
333 | 333 | ||
334 | public float Length() | 334 | public float Length() |
335 | { | 335 | { |
336 | float result; | 336 | float result; |
337 | DistanceSquared(ref this, ref zero, out result); | 337 | DistanceSquared(ref this, ref zero, out result); |
338 | return (float)Math.Sqrt(result); | 338 | return (float)Math.Sqrt(result); |
339 | } | 339 | } |
340 | 340 | ||
341 | public float LengthSquared() | 341 | public float LengthSquared() |
342 | { | 342 | { |
343 | float result; | 343 | float result; |
344 | DistanceSquared(ref this, ref zero, out result); | 344 | DistanceSquared(ref this, ref zero, out result); |
345 | return result; | 345 | return result; |
346 | } | 346 | } |
347 | 347 | ||
348 | /*public static Vector3 Lerp(Vector3 value1, Vector3 value2, float amount) | 348 | /*public static Vector3 Lerp(Vector3 value1, Vector3 value2, float amount) |
349 | { | 349 | { |
350 | return new Vector3( | 350 | return new Vector3( |
351 | MathHelper.Lerp(value1.X, value2.X, amount), | 351 | MathHelper.Lerp(value1.X, value2.X, amount), |
352 | MathHelper.Lerp(value1.Y, value2.Y, amount), | 352 | MathHelper.Lerp(value1.Y, value2.Y, amount), |
353 | MathHelper.Lerp(value1.Z, value2.Z, amount)); | 353 | MathHelper.Lerp(value1.Z, value2.Z, amount)); |
354 | }*/ | 354 | }*/ |
355 | 355 | ||
356 | /*public static void Lerp(ref Vector3 value1, ref Vector3 value2, float amount, out Vector3 result) | 356 | /*public static void Lerp(ref Vector3 value1, ref Vector3 value2, float amount, out Vector3 result) |
357 | { | 357 | { |
358 | result = new Vector3( | 358 | result = new Vector3( |
359 | MathHelper.Lerp(value1.X, value2.X, amount), | 359 | MathHelper.Lerp(value1.X, value2.X, amount), |
360 | MathHelper.Lerp(value1.Y, value2.Y, amount), | 360 | MathHelper.Lerp(value1.Y, value2.Y, amount), |
361 | MathHelper.Lerp(value1.Z, value2.Z, amount)); | 361 | MathHelper.Lerp(value1.Z, value2.Z, amount)); |
362 | }*/ | 362 | }*/ |
363 | 363 | ||
364 | /*public static Vector3 Max(Vector3 value1, Vector3 value2) | 364 | /*public static Vector3 Max(Vector3 value1, Vector3 value2) |
365 | { | 365 | { |
366 | return new Vector3( | 366 | return new Vector3( |
367 | MathHelper.Max(value1.X, value2.X), | 367 | MathHelper.Max(value1.X, value2.X), |
368 | MathHelper.Max(value1.Y, value2.Y), | 368 | MathHelper.Max(value1.Y, value2.Y), |
369 | MathHelper.Max(value1.Z, value2.Z)); | 369 | MathHelper.Max(value1.Z, value2.Z)); |
370 | }*/ | 370 | }*/ |
371 | 371 | ||
372 | /*public static void Max(ref Vector3 value1, ref Vector3 value2, out Vector3 result) | 372 | /*public static void Max(ref Vector3 value1, ref Vector3 value2, out Vector3 result) |
373 | { | 373 | { |
374 | result = new Vector3( | 374 | result = new Vector3( |
375 | MathHelper.Max(value1.X, value2.X), | 375 | MathHelper.Max(value1.X, value2.X), |
376 | MathHelper.Max(value1.Y, value2.Y), | 376 | MathHelper.Max(value1.Y, value2.Y), |
377 | MathHelper.Max(value1.Z, value2.Z)); | 377 | MathHelper.Max(value1.Z, value2.Z)); |
378 | }*/ | 378 | }*/ |
379 | 379 | ||
380 | /*public static Vector3 Min(Vector3 value1, Vector3 value2) | 380 | /*public static Vector3 Min(Vector3 value1, Vector3 value2) |
381 | { | 381 | { |
382 | return new Vector3( | 382 | return new Vector3( |
383 | MathHelper.Min(value1.X, value2.X), | 383 | MathHelper.Min(value1.X, value2.X), |
384 | MathHelper.Min(value1.Y, value2.Y), | 384 | MathHelper.Min(value1.Y, value2.Y), |
385 | MathHelper.Min(value1.Z, value2.Z)); | 385 | MathHelper.Min(value1.Z, value2.Z)); |
386 | }*/ | 386 | }*/ |
387 | 387 | ||
388 | /*public static void Min(ref Vector3 value1, ref Vector3 value2, out Vector3 result) | 388 | /*public static void Min(ref Vector3 value1, ref Vector3 value2, out Vector3 result) |
389 | { | 389 | { |
390 | result = new Vector3( | 390 | result = new Vector3( |
391 | MathHelper.Min(value1.X, value2.X), | 391 | MathHelper.Min(value1.X, value2.X), |
392 | MathHelper.Min(value1.Y, value2.Y), | 392 | MathHelper.Min(value1.Y, value2.Y), |
393 | MathHelper.Min(value1.Z, value2.Z)); | 393 | MathHelper.Min(value1.Z, value2.Z)); |
394 | }*/ | 394 | }*/ |
395 | 395 | ||
396 | public static Vector3 Multiply(Vector3 value1, Vector3 value2) | 396 | public static Vector3 Multiply(Vector3 value1, Vector3 value2) |
397 | { | 397 | { |
398 | value1.X *= value2.X; | 398 | value1.X *= value2.X; |
399 | value1.Y *= value2.Y; | 399 | value1.Y *= value2.Y; |
400 | value1.Z *= value2.Z; | 400 | value1.Z *= value2.Z; |
401 | return value1; | 401 | return value1; |
402 | } | 402 | } |
403 | 403 | ||
404 | public static Vector3 Multiply(Vector3 value1, float scaleFactor) | 404 | public static Vector3 Multiply(Vector3 value1, float scaleFactor) |
405 | { | 405 | { |
406 | value1.X *= scaleFactor; | 406 | value1.X *= scaleFactor; |
407 | value1.Y *= scaleFactor; | 407 | value1.Y *= scaleFactor; |
408 | value1.Z *= scaleFactor; | 408 | value1.Z *= scaleFactor; |
409 | return value1; | 409 | return value1; |
410 | } | 410 | } |
411 | 411 | ||
412 | public static void Multiply(ref Vector3 value1, float scaleFactor, out Vector3 result) | 412 | public static void Multiply(ref Vector3 value1, float scaleFactor, out Vector3 result) |
413 | { | 413 | { |
414 | result.X = value1.X * scaleFactor; | 414 | result.X = value1.X * scaleFactor; |
415 | result.Y = value1.Y * scaleFactor; | 415 | result.Y = value1.Y * scaleFactor; |
416 | result.Z = value1.Z * scaleFactor; | 416 | result.Z = value1.Z * scaleFactor; |
417 | } | 417 | } |
418 | 418 | ||
419 | public static void Multiply(ref Vector3 value1, ref Vector3 value2, out Vector3 result) | 419 | public static void Multiply(ref Vector3 value1, ref Vector3 value2, out Vector3 result) |
420 | { | 420 | { |
421 | result.X = value1.X * value2.X; | 421 | result.X = value1.X * value2.X; |
422 | result.Y = value1.Y * value2.Y; | 422 | result.Y = value1.Y * value2.Y; |
423 | result.Z = value1.Z * value2.Z; | 423 | result.Z = value1.Z * value2.Z; |
424 | } | 424 | } |
425 | 425 | ||
426 | public static Vector3 Negate(Vector3 value) | 426 | public static Vector3 Negate(Vector3 value) |
427 | { | 427 | { |
428 | value = new Vector3(-value.X, -value.Y, -value.Z); | 428 | value = new Vector3(-value.X, -value.Y, -value.Z); |
429 | return value; | 429 | return value; |
430 | } | 430 | } |
431 | 431 | ||
432 | public static void Negate(ref Vector3 value, out Vector3 result) | 432 | public static void Negate(ref Vector3 value, out Vector3 result) |
433 | { | 433 | { |
434 | result = new Vector3(-value.X, -value.Y, -value.Z); | 434 | result = new Vector3(-value.X, -value.Y, -value.Z); |
435 | } | 435 | } |
436 | 436 | ||
437 | public void Normalize() | 437 | public void Normalize() |
438 | { | 438 | { |
439 | Normalize(ref this, out this); | 439 | Normalize(ref this, out this); |
440 | } | 440 | } |
441 | 441 | ||
442 | public static Vector3 Normalize(Vector3 vector) | 442 | public static Vector3 Normalize(Vector3 vector) |
443 | { | 443 | { |
444 | Normalize(ref vector, out vector); | 444 | Normalize(ref vector, out vector); |
445 | return vector; | 445 | return vector; |
446 | } | 446 | } |
447 | 447 | ||
448 | public static void Normalize(ref Vector3 value, out Vector3 result) | 448 | public static void Normalize(ref Vector3 value, out Vector3 result) |
449 | { | 449 | { |
450 | float factor; | 450 | float factor; |
451 | Distance(ref value, ref zero, out factor); | 451 | Distance(ref value, ref zero, out factor); |
452 | factor = 1f / factor; | 452 | factor = 1f / factor; |
453 | result.X = value.X * factor; | 453 | result.X = value.X * factor; |
454 | result.Y = value.Y * factor; | 454 | result.Y = value.Y * factor; |
455 | result.Z = value.Z * factor; | 455 | result.Z = value.Z * factor; |
456 | } | 456 | } |
457 | 457 | ||
458 | public static Vector3 Reflect(Vector3 vector, Vector3 normal) | 458 | public static Vector3 Reflect(Vector3 vector, Vector3 normal) |
459 | { | 459 | { |
460 | throw new NotImplementedException(); | 460 | throw new NotImplementedException(); |
461 | } | 461 | } |
462 | 462 | ||
463 | public static void Reflect(ref Vector3 vector, ref Vector3 normal, out Vector3 result) | 463 | public static void Reflect(ref Vector3 vector, ref Vector3 normal, out Vector3 result) |
464 | { | 464 | { |
465 | throw new NotImplementedException(); | 465 | throw new NotImplementedException(); |
466 | } | 466 | } |
467 | 467 | ||
468 | /*public static Vector3 SmoothStep(Vector3 value1, Vector3 value2, float amount) | 468 | /*public static Vector3 SmoothStep(Vector3 value1, Vector3 value2, float amount) |
469 | { | 469 | { |
470 | return new Vector3( | 470 | return new Vector3( |
471 | MathHelper.SmoothStep(value1.X, value2.X, amount), | 471 | MathHelper.SmoothStep(value1.X, value2.X, amount), |
472 | MathHelper.SmoothStep(value1.Y, value2.Y, amount), | 472 | MathHelper.SmoothStep(value1.Y, value2.Y, amount), |
473 | MathHelper.SmoothStep(value1.Z, value2.Z, amount)); | 473 | MathHelper.SmoothStep(value1.Z, value2.Z, amount)); |
474 | }*/ | 474 | }*/ |
475 | 475 | ||
476 | /*public static void SmoothStep(ref Vector3 value1, ref Vector3 value2, float amount, out Vector3 result) | 476 | /*public static void SmoothStep(ref Vector3 value1, ref Vector3 value2, float amount, out Vector3 result) |
477 | { | 477 | { |
478 | result = new Vector3( | 478 | result = new Vector3( |
479 | MathHelper.SmoothStep(value1.X, value2.X, amount), | 479 | MathHelper.SmoothStep(value1.X, value2.X, amount), |
480 | MathHelper.SmoothStep(value1.Y, value2.Y, amount), | 480 | MathHelper.SmoothStep(value1.Y, value2.Y, amount), |
481 | MathHelper.SmoothStep(value1.Z, value2.Z, amount)); | 481 | MathHelper.SmoothStep(value1.Z, value2.Z, amount)); |
482 | }*/ | 482 | }*/ |
483 | 483 | ||
484 | public static Vector3 Subtract(Vector3 value1, Vector3 value2) | 484 | public static Vector3 Subtract(Vector3 value1, Vector3 value2) |
485 | { | 485 | { |
486 | value1.X -= value2.X; | 486 | value1.X -= value2.X; |
487 | value1.Y -= value2.Y; | 487 | value1.Y -= value2.Y; |
488 | value1.Z -= value2.Z; | 488 | value1.Z -= value2.Z; |
489 | return value1; | 489 | return value1; |
490 | } | 490 | } |
491 | 491 | ||
492 | public static void Subtract(ref Vector3 value1, ref Vector3 value2, out Vector3 result) | 492 | public static void Subtract(ref Vector3 value1, ref Vector3 value2, out Vector3 result) |
493 | { | 493 | { |
494 | result.X = value1.X - value2.X; | 494 | result.X = value1.X - value2.X; |
495 | result.Y = value1.Y - value2.Y; | 495 | result.Y = value1.Y - value2.Y; |
496 | result.Z = value1.Z - value2.Z; | 496 | result.Z = value1.Z - value2.Z; |
497 | } | 497 | } |
498 | 498 | ||
499 | public override string ToString() | 499 | public override string ToString() |
500 | { | 500 | { |
501 | StringBuilder sb = new StringBuilder(32); | 501 | StringBuilder sb = new StringBuilder(32); |
502 | sb.Append("{X:"); | 502 | sb.Append("{X:"); |
503 | sb.Append(this.X); | 503 | sb.Append(this.X); |
504 | sb.Append(" Y:"); | 504 | sb.Append(" Y:"); |
505 | sb.Append(this.Y); | 505 | sb.Append(this.Y); |
506 | sb.Append(" Z:"); | 506 | sb.Append(" Z:"); |
507 | sb.Append(this.Z); | 507 | sb.Append(this.Z); |
508 | sb.Append("}"); | 508 | sb.Append("}"); |
509 | return sb.ToString(); | 509 | return sb.ToString(); |
510 | } | 510 | } |
511 | 511 | ||
512 | public static Vector3 Transform(Vector3 position, Matrix matrix) | 512 | public static Vector3 Transform(Vector3 position, Matrix matrix) |
513 | { | 513 | { |
514 | Transform(ref position, ref matrix, out position); | 514 | Transform(ref position, ref matrix, out position); |
515 | return position; | 515 | return position; |
516 | } | 516 | } |
517 | 517 | ||
518 | public static void Transform(ref Vector3 position, ref Matrix matrix, out Vector3 result) | 518 | public static void Transform(ref Vector3 position, ref Matrix matrix, out Vector3 result) |
519 | { | 519 | { |
520 | result = new Vector3((position.X * matrix.M11) + (position.Y * matrix.M21) + (position.Z * matrix.M31) + matrix.M41, | 520 | result = new Vector3((position.X * matrix.M11) + (position.Y * matrix.M21) + (position.Z * matrix.M31) + matrix.M41, |
521 | (position.X * matrix.M12) + (position.Y * matrix.M22) + (position.Z * matrix.M32) + matrix.M42, | 521 | (position.X * matrix.M12) + (position.Y * matrix.M22) + (position.Z * matrix.M32) + matrix.M42, |
522 | (position.X * matrix.M13) + (position.Y * matrix.M23) + (position.Z * matrix.M33) + matrix.M43); | 522 | (position.X * matrix.M13) + (position.Y * matrix.M23) + (position.Z * matrix.M33) + matrix.M43); |
523 | } | 523 | } |
524 | 524 | ||
525 | public static Vector3 TransformNormal(Vector3 normal, Matrix matrix) | 525 | public static Vector3 TransformNormal(Vector3 normal, Matrix matrix) |
526 | { | 526 | { |
527 | TransformNormal(ref normal, ref matrix, out normal); | 527 | TransformNormal(ref normal, ref matrix, out normal); |
528 | return normal; | 528 | return normal; |
529 | } | 529 | } |
530 | 530 | ||
531 | public static void TransformNormal(ref Vector3 normal, ref Matrix matrix, out Vector3 result) | 531 | public static void TransformNormal(ref Vector3 normal, ref Matrix matrix, out Vector3 result) |
532 | { | 532 | { |
533 | result = new Vector3((normal.X * matrix.M11) + (normal.Y * matrix.M21) + (normal.Z * matrix.M31), | 533 | result = new Vector3((normal.X * matrix.M11) + (normal.Y * matrix.M21) + (normal.Z * matrix.M31), |
534 | (normal.X * matrix.M12) + (normal.Y * matrix.M22) + (normal.Z * matrix.M32), | 534 | (normal.X * matrix.M12) + (normal.Y * matrix.M22) + (normal.Z * matrix.M32), |
535 | (normal.X * matrix.M13) + (normal.Y * matrix.M23) + (normal.Z * matrix.M33)); | 535 | (normal.X * matrix.M13) + (normal.Y * matrix.M23) + (normal.Z * matrix.M33)); |
536 | } | 536 | } |
537 | 537 | ||
538 | #endregion Public methods | 538 | #endregion Public methods |
539 | 539 | ||
540 | 540 | ||
541 | #region Operators | 541 | #region Operators |
542 | 542 | ||
543 | public static bool operator ==(Vector3 value1, Vector3 value2) | 543 | public static bool operator ==(Vector3 value1, Vector3 value2) |
544 | { | 544 | { |
545 | return value1.X == value2.X | 545 | return value1.X == value2.X |
546 | && value1.Y == value2.Y | 546 | && value1.Y == value2.Y |
547 | && value1.Z == value2.Z; | 547 | && value1.Z == value2.Z; |
548 | } | 548 | } |
549 | 549 | ||
550 | public static bool operator !=(Vector3 value1, Vector3 value2) | 550 | public static bool operator !=(Vector3 value1, Vector3 value2) |
551 | { | 551 | { |
552 | return !(value1 == value2); | 552 | return !(value1 == value2); |
553 | } | 553 | } |
554 | 554 | ||
555 | public static Vector3 operator +(Vector3 value1, Vector3 value2) | 555 | public static Vector3 operator +(Vector3 value1, Vector3 value2) |
556 | { | 556 | { |
557 | value1.X += value2.X; | 557 | value1.X += value2.X; |
558 | value1.Y += value2.Y; | 558 | value1.Y += value2.Y; |
559 | value1.Z += value2.Z; | 559 | value1.Z += value2.Z; |
560 | return value1; | 560 | return value1; |
561 | } | 561 | } |
562 | 562 | ||
563 | public static Vector3 operator -(Vector3 value) | 563 | public static Vector3 operator -(Vector3 value) |
564 | { | 564 | { |
565 | value = new Vector3(-value.X, -value.Y, -value.Z); | 565 | value = new Vector3(-value.X, -value.Y, -value.Z); |
566 | return value; | 566 | return value; |
567 | } | 567 | } |
568 | 568 | ||
569 | public static Vector3 operator -(Vector3 value1, Vector3 value2) | 569 | public static Vector3 operator -(Vector3 value1, Vector3 value2) |
570 | { | 570 | { |
571 | value1.X -= value2.X; | 571 | value1.X -= value2.X; |
572 | value1.Y -= value2.Y; | 572 | value1.Y -= value2.Y; |
573 | value1.Z -= value2.Z; | 573 | value1.Z -= value2.Z; |
574 | return value1; | 574 | return value1; |
575 | } | 575 | } |
576 | 576 | ||
577 | public static Vector3 operator *(Vector3 value1, Vector3 value2) | 577 | public static Vector3 operator *(Vector3 value1, Vector3 value2) |
578 | { | 578 | { |
579 | value1.X *= value2.X; | 579 | value1.X *= value2.X; |
580 | value1.Y *= value2.Y; | 580 | value1.Y *= value2.Y; |
581 | value1.Z *= value2.Z; | 581 | value1.Z *= value2.Z; |
582 | return value1; | 582 | return value1; |
583 | } | 583 | } |
584 | 584 | ||
585 | public static Vector3 operator *(Vector3 value, float scaleFactor) | 585 | public static Vector3 operator *(Vector3 value, float scaleFactor) |
586 | { | 586 | { |
587 | value.X *= scaleFactor; | 587 | value.X *= scaleFactor; |
588 | value.Y *= scaleFactor; | 588 | value.Y *= scaleFactor; |
589 | value.Z *= scaleFactor; | 589 | value.Z *= scaleFactor; |
590 | return value; | 590 | return value; |
591 | } | 591 | } |
592 | 592 | ||
593 | public static Vector3 operator *(float scaleFactor, Vector3 value) | 593 | public static Vector3 operator *(float scaleFactor, Vector3 value) |
594 | { | 594 | { |
595 | value.X *= scaleFactor; | 595 | value.X *= scaleFactor; |
596 | value.Y *= scaleFactor; | 596 | value.Y *= scaleFactor; |
597 | value.Z *= scaleFactor; | 597 | value.Z *= scaleFactor; |
598 | return value; | 598 | return value; |
599 | } | 599 | } |
600 | 600 | ||
601 | public static Vector3 operator /(Vector3 value1, Vector3 value2) | 601 | public static Vector3 operator /(Vector3 value1, Vector3 value2) |
602 | { | 602 | { |
603 | value1.X /= value2.X; | 603 | value1.X /= value2.X; |
604 | value1.Y /= value2.Y; | 604 | value1.Y /= value2.Y; |
605 | value1.Z /= value2.Z; | 605 | value1.Z /= value2.Z; |
606 | return value1; | 606 | return value1; |
607 | } | 607 | } |
608 | 608 | ||
609 | public static Vector3 operator /(Vector3 value, float divider) | 609 | public static Vector3 operator /(Vector3 value, float divider) |
610 | { | 610 | { |
611 | float factor = 1 / divider; | 611 | float factor = 1 / divider; |
612 | value.X *= factor; | 612 | value.X *= factor; |
613 | value.Y *= factor; | 613 | value.Y *= factor; |
614 | value.Z *= factor; | 614 | value.Z *= factor; |
615 | return value; | 615 | return value; |
616 | } | 616 | } |
617 | 617 | ||
618 | #endregion | 618 | #endregion |
619 | } | 619 | } |
620 | } | 620 | } |
diff --git a/libraries/ModifiedBulletX/MonoXnaCompactMaths/Vector4.cs b/libraries/ModifiedBulletX/MonoXnaCompactMaths/Vector4.cs index c75b7c8..abb30a8 100644 --- a/libraries/ModifiedBulletX/MonoXnaCompactMaths/Vector4.cs +++ b/libraries/ModifiedBulletX/MonoXnaCompactMaths/Vector4.cs | |||
@@ -1,630 +1,630 @@ | |||
1 | #region License | 1 | #region License |
2 | /* | 2 | /* |
3 | MIT License | 3 | MIT License |
4 | Copyright © 2006 The Mono.Xna Team | 4 | Copyright © 2006 The Mono.Xna Team |
5 | 5 | ||
6 | All rights reserved. | 6 | All rights reserved. |
7 | 7 | ||
8 | Permission is hereby granted, free of charge, to any person obtaining a copy | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy |
9 | of this software and associated documentation files (the "Software"), to deal | 9 | of this software and associated documentation files (the "Software"), to deal |
10 | in the Software without restriction, including without limitation the rights | 10 | in the Software without restriction, including without limitation the rights |
11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | 11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
12 | copies of the Software, and to permit persons to whom the Software is | 12 | copies of the Software, and to permit persons to whom the Software is |
13 | furnished to do so, subject to the following conditions: | 13 | furnished to do so, subject to the following conditions: |
14 | 14 | ||
15 | The above copyright notice and this permission notice shall be included in all | 15 | The above copyright notice and this permission notice shall be included in all |
16 | copies or substantial portions of the Software. | 16 | copies or substantial portions of the Software. |
17 | 17 | ||
18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
24 | SOFTWARE. | 24 | SOFTWARE. |
25 | */ | 25 | */ |
26 | #endregion License | 26 | #endregion License |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.ComponentModel; | 29 | using System.ComponentModel; |
30 | using System.Text; | 30 | using System.Text; |
31 | using System.Runtime.InteropServices; | 31 | using System.Runtime.InteropServices; |
32 | 32 | ||
33 | namespace MonoXnaCompactMaths | 33 | namespace MonoXnaCompactMaths |
34 | { | 34 | { |
35 | [Serializable] | 35 | [Serializable] |
36 | [StructLayout(LayoutKind.Sequential)] | 36 | [StructLayout(LayoutKind.Sequential)] |
37 | //[TypeConverter(typeof(Vector4Converter))] | 37 | //[TypeConverter(typeof(Vector4Converter))] |
38 | public struct Vector4 : IEquatable<Vector4> | 38 | public struct Vector4 : IEquatable<Vector4> |
39 | { | 39 | { |
40 | #region Private Fields | 40 | #region Private Fields |
41 | 41 | ||
42 | private static Vector4 zeroVector = new Vector4(); | 42 | private static Vector4 zeroVector = new Vector4(); |
43 | private static Vector4 unitVector = new Vector4(1f, 1f, 1f, 1f); | 43 | private static Vector4 unitVector = new Vector4(1f, 1f, 1f, 1f); |
44 | private static Vector4 unitXVector = new Vector4(1f, 0f, 0f, 0f); | 44 | private static Vector4 unitXVector = new Vector4(1f, 0f, 0f, 0f); |
45 | private static Vector4 unitYVector = new Vector4(0f, 1f, 0f, 0f); | 45 | private static Vector4 unitYVector = new Vector4(0f, 1f, 0f, 0f); |
46 | private static Vector4 unitZVector = new Vector4(0f, 0f, 1f, 0f); | 46 | private static Vector4 unitZVector = new Vector4(0f, 0f, 1f, 0f); |
47 | private static Vector4 unitWVector = new Vector4(0f, 0f, 0f, 1f); | 47 | private static Vector4 unitWVector = new Vector4(0f, 0f, 0f, 1f); |
48 | 48 | ||
49 | #endregion Private Fields | 49 | #endregion Private Fields |
50 | 50 | ||
51 | 51 | ||
52 | #region Public Fields | 52 | #region Public Fields |
53 | 53 | ||
54 | public float X; | 54 | public float X; |
55 | public float Y; | 55 | public float Y; |
56 | public float Z; | 56 | public float Z; |
57 | public float W; | 57 | public float W; |
58 | 58 | ||
59 | #endregion Public Fields | 59 | #endregion Public Fields |
60 | 60 | ||
61 | 61 | ||
62 | #region Properties | 62 | #region Properties |
63 | 63 | ||
64 | public static Vector4 Zero | 64 | public static Vector4 Zero |
65 | { | 65 | { |
66 | get { return zeroVector; } | 66 | get { return zeroVector; } |
67 | } | 67 | } |
68 | 68 | ||
69 | public static Vector4 One | 69 | public static Vector4 One |
70 | { | 70 | { |
71 | get { return unitVector; } | 71 | get { return unitVector; } |
72 | } | 72 | } |
73 | 73 | ||
74 | public static Vector4 UnitX | 74 | public static Vector4 UnitX |
75 | { | 75 | { |
76 | get { return unitXVector; } | 76 | get { return unitXVector; } |
77 | } | 77 | } |
78 | 78 | ||
79 | public static Vector4 UnitY | 79 | public static Vector4 UnitY |
80 | { | 80 | { |
81 | get { return unitYVector; } | 81 | get { return unitYVector; } |
82 | } | 82 | } |
83 | 83 | ||
84 | public static Vector4 UnitZ | 84 | public static Vector4 UnitZ |
85 | { | 85 | { |
86 | get { return unitZVector; } | 86 | get { return unitZVector; } |
87 | } | 87 | } |
88 | 88 | ||
89 | public static Vector4 UnitW | 89 | public static Vector4 UnitW |
90 | { | 90 | { |
91 | get { return unitWVector; } | 91 | get { return unitWVector; } |
92 | } | 92 | } |
93 | 93 | ||
94 | #endregion Properties | 94 | #endregion Properties |
95 | 95 | ||
96 | 96 | ||
97 | #region Constructors | 97 | #region Constructors |
98 | 98 | ||
99 | public Vector4(float x, float y, float z, float w) | 99 | public Vector4(float x, float y, float z, float w) |
100 | { | 100 | { |
101 | this.X = x; | 101 | this.X = x; |
102 | this.Y = y; | 102 | this.Y = y; |
103 | this.Z = z; | 103 | this.Z = z; |
104 | this.W = w; | 104 | this.W = w; |
105 | } | 105 | } |
106 | 106 | ||
107 | /*public Vector4(Vector2 value, float z, float w) | 107 | /*public Vector4(Vector2 value, float z, float w) |
108 | { | 108 | { |
109 | this.X = value.X; | 109 | this.X = value.X; |
110 | this.Y = value.Y; | 110 | this.Y = value.Y; |
111 | this.Z = z; | 111 | this.Z = z; |
112 | this.W = w; | 112 | this.W = w; |
113 | }*/ | 113 | }*/ |
114 | 114 | ||
115 | public Vector4(Vector3 value, float w) | 115 | public Vector4(Vector3 value, float w) |
116 | { | 116 | { |
117 | this.X = value.X; | 117 | this.X = value.X; |
118 | this.Y = value.Y; | 118 | this.Y = value.Y; |
119 | this.Z = value.Z; | 119 | this.Z = value.Z; |
120 | this.W = w; | 120 | this.W = w; |
121 | } | 121 | } |
122 | 122 | ||
123 | public Vector4(float value) | 123 | public Vector4(float value) |
124 | { | 124 | { |
125 | this.X = value; | 125 | this.X = value; |
126 | this.Y = value; | 126 | this.Y = value; |
127 | this.Z = value; | 127 | this.Z = value; |
128 | this.W = value; | 128 | this.W = value; |
129 | } | 129 | } |
130 | 130 | ||
131 | #endregion | 131 | #endregion |
132 | 132 | ||
133 | 133 | ||
134 | #region Public Methods | 134 | #region Public Methods |
135 | 135 | ||
136 | public static Vector4 Add(Vector4 value1, Vector4 value2) | 136 | public static Vector4 Add(Vector4 value1, Vector4 value2) |
137 | { | 137 | { |
138 | value1.W += value2.W; | 138 | value1.W += value2.W; |
139 | value1.X += value2.X; | 139 | value1.X += value2.X; |
140 | value1.Y += value2.Y; | 140 | value1.Y += value2.Y; |
141 | value1.Z += value2.Z; | 141 | value1.Z += value2.Z; |
142 | return value1; | 142 | return value1; |
143 | } | 143 | } |
144 | 144 | ||
145 | public static void Add(ref Vector4 value1, ref Vector4 value2, out Vector4 result) | 145 | public static void Add(ref Vector4 value1, ref Vector4 value2, out Vector4 result) |
146 | { | 146 | { |
147 | result.W = value1.W + value2.W; | 147 | result.W = value1.W + value2.W; |
148 | result.X = value1.X + value2.X; | 148 | result.X = value1.X + value2.X; |
149 | result.Y = value1.Y + value2.Y; | 149 | result.Y = value1.Y + value2.Y; |
150 | result.Z = value1.Z + value2.Z; | 150 | result.Z = value1.Z + value2.Z; |
151 | } | 151 | } |
152 | 152 | ||
153 | /*public static Vector4 Barycentric(Vector4 value1, Vector4 value2, Vector4 value3, float amount1, float amount2) | 153 | /*public static Vector4 Barycentric(Vector4 value1, Vector4 value2, Vector4 value3, float amount1, float amount2) |
154 | { | 154 | { |
155 | return new Vector4( | 155 | return new Vector4( |
156 | MathHelper.Barycentric(value1.X, value2.X, value3.X, amount1, amount2), | 156 | MathHelper.Barycentric(value1.X, value2.X, value3.X, amount1, amount2), |
157 | MathHelper.Barycentric(value1.Y, value2.Y, value3.Y, amount1, amount2), | 157 | MathHelper.Barycentric(value1.Y, value2.Y, value3.Y, amount1, amount2), |
158 | MathHelper.Barycentric(value1.Z, value2.Z, value3.Z, amount1, amount2), | 158 | MathHelper.Barycentric(value1.Z, value2.Z, value3.Z, amount1, amount2), |
159 | MathHelper.Barycentric(value1.W, value2.W, value3.W, amount1, amount2)); | 159 | MathHelper.Barycentric(value1.W, value2.W, value3.W, amount1, amount2)); |
160 | }*/ | 160 | }*/ |
161 | 161 | ||
162 | /*public static void Barycentric(ref Vector4 value1, ref Vector4 value2, ref Vector4 value3, float amount1, float amount2, out Vector4 result) | 162 | /*public static void Barycentric(ref Vector4 value1, ref Vector4 value2, ref Vector4 value3, float amount1, float amount2, out Vector4 result) |
163 | { | 163 | { |
164 | result = new Vector4( | 164 | result = new Vector4( |
165 | MathHelper.Barycentric(value1.X, value2.X, value3.X, amount1, amount2), | 165 | MathHelper.Barycentric(value1.X, value2.X, value3.X, amount1, amount2), |
166 | MathHelper.Barycentric(value1.Y, value2.Y, value3.Y, amount1, amount2), | 166 | MathHelper.Barycentric(value1.Y, value2.Y, value3.Y, amount1, amount2), |
167 | MathHelper.Barycentric(value1.Z, value2.Z, value3.Z, amount1, amount2), | 167 | MathHelper.Barycentric(value1.Z, value2.Z, value3.Z, amount1, amount2), |
168 | MathHelper.Barycentric(value1.W, value2.W, value3.W, amount1, amount2)); | 168 | MathHelper.Barycentric(value1.W, value2.W, value3.W, amount1, amount2)); |
169 | }*/ | 169 | }*/ |
170 | 170 | ||
171 | /*public static Vector4 CatmullRom(Vector4 value1, Vector4 value2, Vector4 value3, Vector4 value4, float amount) | 171 | /*public static Vector4 CatmullRom(Vector4 value1, Vector4 value2, Vector4 value3, Vector4 value4, float amount) |
172 | { | 172 | { |
173 | return new Vector4( | 173 | return new Vector4( |
174 | MathHelper.CatmullRom(value1.X, value2.X, value3.X, value4.X, amount), | 174 | MathHelper.CatmullRom(value1.X, value2.X, value3.X, value4.X, amount), |
175 | MathHelper.CatmullRom(value1.Y, value2.Y, value3.Y, value4.Y, amount), | 175 | MathHelper.CatmullRom(value1.Y, value2.Y, value3.Y, value4.Y, amount), |
176 | MathHelper.CatmullRom(value1.Z, value2.Z, value3.Z, value4.Z, amount), | 176 | MathHelper.CatmullRom(value1.Z, value2.Z, value3.Z, value4.Z, amount), |
177 | MathHelper.CatmullRom(value1.W, value2.W, value3.W, value4.W, amount)); | 177 | MathHelper.CatmullRom(value1.W, value2.W, value3.W, value4.W, amount)); |
178 | }*/ | 178 | }*/ |
179 | 179 | ||
180 | /*public static void CatmullRom(ref Vector4 value1, ref Vector4 value2, ref Vector4 value3, ref Vector4 value4, float amount, out Vector4 result) | 180 | /*public static void CatmullRom(ref Vector4 value1, ref Vector4 value2, ref Vector4 value3, ref Vector4 value4, float amount, out Vector4 result) |
181 | { | 181 | { |
182 | result = new Vector4( | 182 | result = new Vector4( |
183 | MathHelper.CatmullRom(value1.X, value2.X, value3.X, value4.X, amount), | 183 | MathHelper.CatmullRom(value1.X, value2.X, value3.X, value4.X, amount), |
184 | MathHelper.CatmullRom(value1.Y, value2.Y, value3.Y, value4.Y, amount), | 184 | MathHelper.CatmullRom(value1.Y, value2.Y, value3.Y, value4.Y, amount), |
185 | MathHelper.CatmullRom(value1.Z, value2.Z, value3.Z, value4.Z, amount), | 185 | MathHelper.CatmullRom(value1.Z, value2.Z, value3.Z, value4.Z, amount), |
186 | MathHelper.CatmullRom(value1.W, value2.W, value3.W, value4.W, amount)); | 186 | MathHelper.CatmullRom(value1.W, value2.W, value3.W, value4.W, amount)); |
187 | }*/ | 187 | }*/ |
188 | 188 | ||
189 | /*public static Vector4 Clamp(Vector4 value1, Vector4 min, Vector4 max) | 189 | /*public static Vector4 Clamp(Vector4 value1, Vector4 min, Vector4 max) |
190 | { | 190 | { |
191 | return new Vector4( | 191 | return new Vector4( |
192 | MathHelper.Clamp(value1.X, min.X, max.X), | 192 | MathHelper.Clamp(value1.X, min.X, max.X), |
193 | MathHelper.Clamp(value1.Y, min.Y, max.Y), | 193 | MathHelper.Clamp(value1.Y, min.Y, max.Y), |
194 | MathHelper.Clamp(value1.Z, min.Z, max.Z), | 194 | MathHelper.Clamp(value1.Z, min.Z, max.Z), |
195 | MathHelper.Clamp(value1.W, min.W, max.W)); | 195 | MathHelper.Clamp(value1.W, min.W, max.W)); |
196 | }*/ | 196 | }*/ |
197 | 197 | ||
198 | /*public static void Clamp(ref Vector4 value1, ref Vector4 min, ref Vector4 max, out Vector4 result) | 198 | /*public static void Clamp(ref Vector4 value1, ref Vector4 min, ref Vector4 max, out Vector4 result) |
199 | { | 199 | { |
200 | result = new Vector4( | 200 | result = new Vector4( |
201 | MathHelper.Clamp(value1.X, min.X, max.X), | 201 | MathHelper.Clamp(value1.X, min.X, max.X), |
202 | MathHelper.Clamp(value1.Y, min.Y, max.Y), | 202 | MathHelper.Clamp(value1.Y, min.Y, max.Y), |
203 | MathHelper.Clamp(value1.Z, min.Z, max.Z), | 203 | MathHelper.Clamp(value1.Z, min.Z, max.Z), |
204 | MathHelper.Clamp(value1.W, min.W, max.W)); | 204 | MathHelper.Clamp(value1.W, min.W, max.W)); |
205 | }*/ | 205 | }*/ |
206 | 206 | ||
207 | public static float Distance(Vector4 value1, Vector4 value2) | 207 | public static float Distance(Vector4 value1, Vector4 value2) |
208 | { | 208 | { |
209 | return (float)Math.Sqrt(DistanceSquared(value1, value2)); | 209 | return (float)Math.Sqrt(DistanceSquared(value1, value2)); |
210 | } | 210 | } |
211 | 211 | ||
212 | public static void Distance(ref Vector4 value1, ref Vector4 value2, out float result) | 212 | public static void Distance(ref Vector4 value1, ref Vector4 value2, out float result) |
213 | { | 213 | { |
214 | result = (float)Math.Sqrt(DistanceSquared(value1, value2)); | 214 | result = (float)Math.Sqrt(DistanceSquared(value1, value2)); |
215 | } | 215 | } |
216 | 216 | ||
217 | public static float DistanceSquared(Vector4 value1, Vector4 value2) | 217 | public static float DistanceSquared(Vector4 value1, Vector4 value2) |
218 | { | 218 | { |
219 | float result; | 219 | float result; |
220 | DistanceSquared(ref value1, ref value2, out result); | 220 | DistanceSquared(ref value1, ref value2, out result); |
221 | return result; | 221 | return result; |
222 | } | 222 | } |
223 | 223 | ||
224 | public static void DistanceSquared(ref Vector4 value1, ref Vector4 value2, out float result) | 224 | public static void DistanceSquared(ref Vector4 value1, ref Vector4 value2, out float result) |
225 | { | 225 | { |
226 | result = (value1.W - value2.W) * (value1.W - value2.W) + | 226 | result = (value1.W - value2.W) * (value1.W - value2.W) + |
227 | (value1.X - value2.X) * (value1.X - value2.X) + | 227 | (value1.X - value2.X) * (value1.X - value2.X) + |
228 | (value1.Y - value2.Y) * (value1.Y - value2.Y) + | 228 | (value1.Y - value2.Y) * (value1.Y - value2.Y) + |
229 | (value1.Z - value2.Z) * (value1.Z - value2.Z); | 229 | (value1.Z - value2.Z) * (value1.Z - value2.Z); |
230 | } | 230 | } |
231 | 231 | ||
232 | public static Vector4 Divide(Vector4 value1, Vector4 value2) | 232 | public static Vector4 Divide(Vector4 value1, Vector4 value2) |
233 | { | 233 | { |
234 | value1.W /= value2.W; | 234 | value1.W /= value2.W; |
235 | value1.X /= value2.X; | 235 | value1.X /= value2.X; |
236 | value1.Y /= value2.Y; | 236 | value1.Y /= value2.Y; |
237 | value1.Z /= value2.Z; | 237 | value1.Z /= value2.Z; |
238 | return value1; | 238 | return value1; |
239 | } | 239 | } |
240 | 240 | ||
241 | public static Vector4 Divide(Vector4 value1, float divider) | 241 | public static Vector4 Divide(Vector4 value1, float divider) |
242 | { | 242 | { |
243 | float factor = 1f / divider; | 243 | float factor = 1f / divider; |
244 | value1.W *= factor; | 244 | value1.W *= factor; |
245 | value1.X *= factor; | 245 | value1.X *= factor; |
246 | value1.Y *= factor; | 246 | value1.Y *= factor; |
247 | value1.Z *= factor; | 247 | value1.Z *= factor; |
248 | return value1; | 248 | return value1; |
249 | } | 249 | } |
250 | 250 | ||
251 | public static void Divide(ref Vector4 value1, float divider, out Vector4 result) | 251 | public static void Divide(ref Vector4 value1, float divider, out Vector4 result) |
252 | { | 252 | { |
253 | float factor = 1f / divider; | 253 | float factor = 1f / divider; |
254 | result.W = value1.W * factor; | 254 | result.W = value1.W * factor; |
255 | result.X = value1.X * factor; | 255 | result.X = value1.X * factor; |
256 | result.Y = value1.Y * factor; | 256 | result.Y = value1.Y * factor; |
257 | result.Z = value1.Z * factor; | 257 | result.Z = value1.Z * factor; |
258 | } | 258 | } |
259 | 259 | ||
260 | public static void Divide(ref Vector4 value1, ref Vector4 value2, out Vector4 result) | 260 | public static void Divide(ref Vector4 value1, ref Vector4 value2, out Vector4 result) |
261 | { | 261 | { |
262 | result.W = value1.W / value2.W; | 262 | result.W = value1.W / value2.W; |
263 | result.X = value1.X / value2.X; | 263 | result.X = value1.X / value2.X; |
264 | result.Y = value1.Y / value2.Y; | 264 | result.Y = value1.Y / value2.Y; |
265 | result.Z = value1.Z / value2.Z; | 265 | result.Z = value1.Z / value2.Z; |
266 | } | 266 | } |
267 | 267 | ||
268 | public static float Dot(Vector4 vector1, Vector4 vector2) | 268 | public static float Dot(Vector4 vector1, Vector4 vector2) |
269 | { | 269 | { |
270 | return vector1.X * vector2.X + vector1.Y * vector2.Y + vector1.Z * vector2.Z + vector1.W * vector2.W; | 270 | return vector1.X * vector2.X + vector1.Y * vector2.Y + vector1.Z * vector2.Z + vector1.W * vector2.W; |
271 | } | 271 | } |
272 | 272 | ||
273 | public static void Dot(ref Vector4 vector1, ref Vector4 vector2, out float result) | 273 | public static void Dot(ref Vector4 vector1, ref Vector4 vector2, out float result) |
274 | { | 274 | { |
275 | result = vector1.X * vector2.X + vector1.Y * vector2.Y + vector1.Z * vector2.Z + vector1.W * vector2.W; | 275 | result = vector1.X * vector2.X + vector1.Y * vector2.Y + vector1.Z * vector2.Z + vector1.W * vector2.W; |
276 | } | 276 | } |
277 | 277 | ||
278 | public override bool Equals(object obj) | 278 | public override bool Equals(object obj) |
279 | { | 279 | { |
280 | return (obj is Vector4) ? this == (Vector4)obj : false; | 280 | return (obj is Vector4) ? this == (Vector4)obj : false; |
281 | } | 281 | } |
282 | 282 | ||
283 | public bool Equals(Vector4 other) | 283 | public bool Equals(Vector4 other) |
284 | { | 284 | { |
285 | return this.W == other.W | 285 | return this.W == other.W |
286 | && this.X == other.X | 286 | && this.X == other.X |
287 | && this.Y == other.Y | 287 | && this.Y == other.Y |
288 | && this.Z == other.Z; | 288 | && this.Z == other.Z; |
289 | } | 289 | } |
290 | 290 | ||
291 | public override int GetHashCode() | 291 | public override int GetHashCode() |
292 | { | 292 | { |
293 | return (int)(this.W + this.X + this.Y + this.Y); | 293 | return (int)(this.W + this.X + this.Y + this.Y); |
294 | } | 294 | } |
295 | 295 | ||
296 | /*public static Vector4 Hermite(Vector4 value1, Vector4 tangent1, Vector4 value2, Vector4 tangent2, float amount) | 296 | /*public static Vector4 Hermite(Vector4 value1, Vector4 tangent1, Vector4 value2, Vector4 tangent2, float amount) |
297 | { | 297 | { |
298 | Vector4 result = new Vector4(); | 298 | Vector4 result = new Vector4(); |
299 | Hermite(ref value1, ref tangent1, ref value2, ref tangent2, amount, out result); | 299 | Hermite(ref value1, ref tangent1, ref value2, ref tangent2, amount, out result); |
300 | return result; | 300 | return result; |
301 | }*/ | 301 | }*/ |
302 | 302 | ||
303 | /*public static void Hermite(ref Vector4 value1, ref Vector4 tangent1, ref Vector4 value2, ref Vector4 tangent2, float amount, out Vector4 result) | 303 | /*public static void Hermite(ref Vector4 value1, ref Vector4 tangent1, ref Vector4 value2, ref Vector4 tangent2, float amount, out Vector4 result) |
304 | { | 304 | { |
305 | result.W = MathHelper.Hermite(value1.W, tangent1.W, value2.W, tangent2.W, amount); | 305 | result.W = MathHelper.Hermite(value1.W, tangent1.W, value2.W, tangent2.W, amount); |
306 | result.X = MathHelper.Hermite(value1.X, tangent1.X, value2.X, tangent2.X, amount); | 306 | result.X = MathHelper.Hermite(value1.X, tangent1.X, value2.X, tangent2.X, amount); |
307 | result.Y = MathHelper.Hermite(value1.Y, tangent1.Y, value2.Y, tangent2.Y, amount); | 307 | result.Y = MathHelper.Hermite(value1.Y, tangent1.Y, value2.Y, tangent2.Y, amount); |
308 | result.Z = MathHelper.Hermite(value1.Z, tangent1.Z, value2.Z, tangent2.Z, amount); | 308 | result.Z = MathHelper.Hermite(value1.Z, tangent1.Z, value2.Z, tangent2.Z, amount); |
309 | }*/ | 309 | }*/ |
310 | 310 | ||
311 | public float Length() | 311 | public float Length() |
312 | { | 312 | { |
313 | float result; | 313 | float result; |
314 | DistanceSquared(ref this, ref zeroVector, out result); | 314 | DistanceSquared(ref this, ref zeroVector, out result); |
315 | return (float)Math.Sqrt(result); | 315 | return (float)Math.Sqrt(result); |
316 | } | 316 | } |
317 | 317 | ||
318 | public float LengthSquared() | 318 | public float LengthSquared() |
319 | { | 319 | { |
320 | float result; | 320 | float result; |
321 | DistanceSquared(ref this, ref zeroVector, out result); | 321 | DistanceSquared(ref this, ref zeroVector, out result); |
322 | return result; | 322 | return result; |
323 | } | 323 | } |
324 | 324 | ||
325 | /*public static Vector4 Lerp(Vector4 value1, Vector4 value2, float amount) | 325 | /*public static Vector4 Lerp(Vector4 value1, Vector4 value2, float amount) |
326 | { | 326 | { |
327 | return new Vector4( | 327 | return new Vector4( |
328 | MathHelper.Lerp(value1.X, value2.X, amount), | 328 | MathHelper.Lerp(value1.X, value2.X, amount), |
329 | MathHelper.Lerp(value1.Y, value2.Y, amount), | 329 | MathHelper.Lerp(value1.Y, value2.Y, amount), |
330 | MathHelper.Lerp(value1.Z, value2.Z, amount), | 330 | MathHelper.Lerp(value1.Z, value2.Z, amount), |
331 | MathHelper.Lerp(value1.W, value2.W, amount)); | 331 | MathHelper.Lerp(value1.W, value2.W, amount)); |
332 | }*/ | 332 | }*/ |
333 | 333 | ||
334 | /*public static void Lerp(ref Vector4 value1, ref Vector4 value2, float amount, out Vector4 result) | 334 | /*public static void Lerp(ref Vector4 value1, ref Vector4 value2, float amount, out Vector4 result) |
335 | { | 335 | { |
336 | result = new Vector4( | 336 | result = new Vector4( |
337 | MathHelper.Lerp(value1.X, value2.X, amount), | 337 | MathHelper.Lerp(value1.X, value2.X, amount), |
338 | MathHelper.Lerp(value1.Y, value2.Y, amount), | 338 | MathHelper.Lerp(value1.Y, value2.Y, amount), |
339 | MathHelper.Lerp(value1.Z, value2.Z, amount), | 339 | MathHelper.Lerp(value1.Z, value2.Z, amount), |
340 | MathHelper.Lerp(value1.W, value2.W, amount)); | 340 | MathHelper.Lerp(value1.W, value2.W, amount)); |
341 | }*/ | 341 | }*/ |
342 | 342 | ||
343 | /*public static Vector4 Max(Vector4 value1, Vector4 value2) | 343 | /*public static Vector4 Max(Vector4 value1, Vector4 value2) |
344 | { | 344 | { |
345 | return new Vector4( | 345 | return new Vector4( |
346 | MathHelper.Max(value1.X, value2.X), | 346 | MathHelper.Max(value1.X, value2.X), |
347 | MathHelper.Max(value1.Y, value2.Y), | 347 | MathHelper.Max(value1.Y, value2.Y), |
348 | MathHelper.Max(value1.Z, value2.Z), | 348 | MathHelper.Max(value1.Z, value2.Z), |
349 | MathHelper.Max(value1.W, value2.W)); | 349 | MathHelper.Max(value1.W, value2.W)); |
350 | }*/ | 350 | }*/ |
351 | 351 | ||
352 | /*public static void Max(ref Vector4 value1, ref Vector4 value2, out Vector4 result) | 352 | /*public static void Max(ref Vector4 value1, ref Vector4 value2, out Vector4 result) |
353 | { | 353 | { |
354 | result = new Vector4( | 354 | result = new Vector4( |
355 | MathHelper.Max(value1.X, value2.X), | 355 | MathHelper.Max(value1.X, value2.X), |
356 | MathHelper.Max(value1.Y, value2.Y), | 356 | MathHelper.Max(value1.Y, value2.Y), |
357 | MathHelper.Max(value1.Z, value2.Z), | 357 | MathHelper.Max(value1.Z, value2.Z), |
358 | MathHelper.Max(value1.W, value2.W)); | 358 | MathHelper.Max(value1.W, value2.W)); |
359 | }*/ | 359 | }*/ |
360 | 360 | ||
361 | /*public static Vector4 Min(Vector4 value1, Vector4 value2) | 361 | /*public static Vector4 Min(Vector4 value1, Vector4 value2) |
362 | { | 362 | { |
363 | return new Vector4( | 363 | return new Vector4( |
364 | MathHelper.Min(value1.X, value2.X), | 364 | MathHelper.Min(value1.X, value2.X), |
365 | MathHelper.Min(value1.Y, value2.Y), | 365 | MathHelper.Min(value1.Y, value2.Y), |
366 | MathHelper.Min(value1.Z, value2.Z), | 366 | MathHelper.Min(value1.Z, value2.Z), |
367 | MathHelper.Min(value1.W, value2.W)); | 367 | MathHelper.Min(value1.W, value2.W)); |
368 | }*/ | 368 | }*/ |
369 | 369 | ||
370 | /*public static void Min(ref Vector4 value1, ref Vector4 value2, out Vector4 result) | 370 | /*public static void Min(ref Vector4 value1, ref Vector4 value2, out Vector4 result) |
371 | { | 371 | { |
372 | result = new Vector4( | 372 | result = new Vector4( |
373 | MathHelper.Min(value1.X, value2.X), | 373 | MathHelper.Min(value1.X, value2.X), |
374 | MathHelper.Min(value1.Y, value2.Y), | 374 | MathHelper.Min(value1.Y, value2.Y), |
375 | MathHelper.Min(value1.Z, value2.Z), | 375 | MathHelper.Min(value1.Z, value2.Z), |
376 | MathHelper.Min(value1.W, value2.W)); | 376 | MathHelper.Min(value1.W, value2.W)); |
377 | }*/ | 377 | }*/ |
378 | 378 | ||
379 | public static Vector4 Multiply(Vector4 value1, Vector4 value2) | 379 | public static Vector4 Multiply(Vector4 value1, Vector4 value2) |
380 | { | 380 | { |
381 | value1.W *= value2.W; | 381 | value1.W *= value2.W; |
382 | value1.X *= value2.X; | 382 | value1.X *= value2.X; |
383 | value1.Y *= value2.Y; | 383 | value1.Y *= value2.Y; |
384 | value1.Z *= value2.Z; | 384 | value1.Z *= value2.Z; |
385 | return value1; | 385 | return value1; |
386 | } | 386 | } |
387 | 387 | ||
388 | public static Vector4 Multiply(Vector4 value1, float scaleFactor) | 388 | public static Vector4 Multiply(Vector4 value1, float scaleFactor) |
389 | { | 389 | { |
390 | value1.W *= scaleFactor; | 390 | value1.W *= scaleFactor; |
391 | value1.X *= scaleFactor; | 391 | value1.X *= scaleFactor; |
392 | value1.Y *= scaleFactor; | 392 | value1.Y *= scaleFactor; |
393 | value1.Z *= scaleFactor; | 393 | value1.Z *= scaleFactor; |
394 | return value1; | 394 | return value1; |
395 | } | 395 | } |
396 | 396 | ||
397 | public static void Multiply(ref Vector4 value1, float scaleFactor, out Vector4 result) | 397 | public static void Multiply(ref Vector4 value1, float scaleFactor, out Vector4 result) |
398 | { | 398 | { |
399 | result.W = value1.W * scaleFactor; | 399 | result.W = value1.W * scaleFactor; |
400 | result.X = value1.X * scaleFactor; | 400 | result.X = value1.X * scaleFactor; |
401 | result.Y = value1.Y * scaleFactor; | 401 | result.Y = value1.Y * scaleFactor; |
402 | result.Z = value1.Z * scaleFactor; | 402 | result.Z = value1.Z * scaleFactor; |
403 | } | 403 | } |
404 | 404 | ||
405 | public static void Multiply(ref Vector4 value1, ref Vector4 value2, out Vector4 result) | 405 | public static void Multiply(ref Vector4 value1, ref Vector4 value2, out Vector4 result) |
406 | { | 406 | { |
407 | result.W = value1.W * value2.W; | 407 | result.W = value1.W * value2.W; |
408 | result.X = value1.X * value2.X; | 408 | result.X = value1.X * value2.X; |
409 | result.Y = value1.Y * value2.Y; | 409 | result.Y = value1.Y * value2.Y; |
410 | result.Z = value1.Z * value2.Z; | 410 | result.Z = value1.Z * value2.Z; |
411 | } | 411 | } |
412 | 412 | ||
413 | public static Vector4 Negate(Vector4 value) | 413 | public static Vector4 Negate(Vector4 value) |
414 | { | 414 | { |
415 | value = new Vector4(-value.X, -value.Y, -value.Z, -value.W); | 415 | value = new Vector4(-value.X, -value.Y, -value.Z, -value.W); |
416 | return value; | 416 | return value; |
417 | } | 417 | } |
418 | 418 | ||
419 | public static void Negate(ref Vector4 value, out Vector4 result) | 419 | public static void Negate(ref Vector4 value, out Vector4 result) |
420 | { | 420 | { |
421 | result = new Vector4(-value.X, -value.Y, -value.Z,-value.W); | 421 | result = new Vector4(-value.X, -value.Y, -value.Z,-value.W); |
422 | } | 422 | } |
423 | 423 | ||
424 | public void Normalize() | 424 | public void Normalize() |
425 | { | 425 | { |
426 | Normalize(ref this, out this); | 426 | Normalize(ref this, out this); |
427 | } | 427 | } |
428 | 428 | ||
429 | public static Vector4 Normalize(Vector4 vector) | 429 | public static Vector4 Normalize(Vector4 vector) |
430 | { | 430 | { |
431 | Normalize(ref vector, out vector); | 431 | Normalize(ref vector, out vector); |
432 | return vector; | 432 | return vector; |
433 | } | 433 | } |
434 | 434 | ||
435 | public static void Normalize(ref Vector4 vector, out Vector4 result) | 435 | public static void Normalize(ref Vector4 vector, out Vector4 result) |
436 | { | 436 | { |
437 | float factor; | 437 | float factor; |
438 | DistanceSquared(ref vector, ref zeroVector, out factor); | 438 | DistanceSquared(ref vector, ref zeroVector, out factor); |
439 | factor = 1f / (float)Math.Sqrt(factor); | 439 | factor = 1f / (float)Math.Sqrt(factor); |
440 | 440 | ||
441 | result.W = vector.W * factor; | 441 | result.W = vector.W * factor; |
442 | result.X = vector.X * factor; | 442 | result.X = vector.X * factor; |
443 | result.Y = vector.Y * factor; | 443 | result.Y = vector.Y * factor; |
444 | result.Z = vector.Z * factor; | 444 | result.Z = vector.Z * factor; |
445 | } | 445 | } |
446 | 446 | ||
447 | /*public static Vector4 SmoothStep(Vector4 value1, Vector4 value2, float amount) | 447 | /*public static Vector4 SmoothStep(Vector4 value1, Vector4 value2, float amount) |
448 | { | 448 | { |
449 | return new Vector4( | 449 | return new Vector4( |
450 | MathHelper.SmoothStep(value1.X, value2.X, amount), | 450 | MathHelper.SmoothStep(value1.X, value2.X, amount), |
451 | MathHelper.SmoothStep(value1.Y, value2.Y, amount), | 451 | MathHelper.SmoothStep(value1.Y, value2.Y, amount), |
452 | MathHelper.SmoothStep(value1.Z, value2.Z, amount), | 452 | MathHelper.SmoothStep(value1.Z, value2.Z, amount), |
453 | MathHelper.SmoothStep(value1.W, value2.W, amount)); | 453 | MathHelper.SmoothStep(value1.W, value2.W, amount)); |
454 | }*/ | 454 | }*/ |
455 | 455 | ||
456 | /*public static void SmoothStep(ref Vector4 value1, ref Vector4 value2, float amount, out Vector4 result) | 456 | /*public static void SmoothStep(ref Vector4 value1, ref Vector4 value2, float amount, out Vector4 result) |
457 | { | 457 | { |
458 | result = new Vector4( | 458 | result = new Vector4( |
459 | MathHelper.SmoothStep(value1.X, value2.X, amount), | 459 | MathHelper.SmoothStep(value1.X, value2.X, amount), |
460 | MathHelper.SmoothStep(value1.Y, value2.Y, amount), | 460 | MathHelper.SmoothStep(value1.Y, value2.Y, amount), |
461 | MathHelper.SmoothStep(value1.Z, value2.Z, amount), | 461 | MathHelper.SmoothStep(value1.Z, value2.Z, amount), |
462 | MathHelper.SmoothStep(value1.W, value2.W, amount)); | 462 | MathHelper.SmoothStep(value1.W, value2.W, amount)); |
463 | }*/ | 463 | }*/ |
464 | 464 | ||
465 | public static Vector4 Subtract(Vector4 value1, Vector4 value2) | 465 | public static Vector4 Subtract(Vector4 value1, Vector4 value2) |
466 | { | 466 | { |
467 | value1.W -= value2.W; | 467 | value1.W -= value2.W; |
468 | value1.X -= value2.X; | 468 | value1.X -= value2.X; |
469 | value1.Y -= value2.Y; | 469 | value1.Y -= value2.Y; |
470 | value1.Z -= value2.Z; | 470 | value1.Z -= value2.Z; |
471 | return value1; | 471 | return value1; |
472 | } | 472 | } |
473 | 473 | ||
474 | public static void Subtract(ref Vector4 value1, ref Vector4 value2, out Vector4 result) | 474 | public static void Subtract(ref Vector4 value1, ref Vector4 value2, out Vector4 result) |
475 | { | 475 | { |
476 | result.W = value1.W - value2.W; | 476 | result.W = value1.W - value2.W; |
477 | result.X = value1.X - value2.X; | 477 | result.X = value1.X - value2.X; |
478 | result.Y = value1.Y - value2.Y; | 478 | result.Y = value1.Y - value2.Y; |
479 | result.Z = value1.Z - value2.Z; | 479 | result.Z = value1.Z - value2.Z; |
480 | } | 480 | } |
481 | 481 | ||
482 | /*public static Vector4 Transform(Vector2 position, Matrix matrix) | 482 | /*public static Vector4 Transform(Vector2 position, Matrix matrix) |
483 | { | 483 | { |
484 | Vector4 result; | 484 | Vector4 result; |
485 | Transform(ref position, ref matrix, out result); | 485 | Transform(ref position, ref matrix, out result); |
486 | return result; | 486 | return result; |
487 | }*/ | 487 | }*/ |
488 | 488 | ||
489 | public static Vector4 Transform(Vector3 position, Matrix matrix) | 489 | public static Vector4 Transform(Vector3 position, Matrix matrix) |
490 | { | 490 | { |
491 | Vector4 result; | 491 | Vector4 result; |
492 | Transform(ref position, ref matrix, out result); | 492 | Transform(ref position, ref matrix, out result); |
493 | return result; | 493 | return result; |
494 | } | 494 | } |
495 | 495 | ||
496 | public static Vector4 Transform(Vector4 vector, Matrix matrix) | 496 | public static Vector4 Transform(Vector4 vector, Matrix matrix) |
497 | { | 497 | { |
498 | Transform(ref vector, ref matrix, out vector); | 498 | Transform(ref vector, ref matrix, out vector); |
499 | return vector; | 499 | return vector; |
500 | } | 500 | } |
501 | 501 | ||
502 | /*public static void Transform(ref Vector2 position, ref Matrix matrix, out Vector4 result) | 502 | /*public static void Transform(ref Vector2 position, ref Matrix matrix, out Vector4 result) |
503 | { | 503 | { |
504 | result = new Vector4((position.X * matrix.M11) + (position.Y * matrix.M21) + matrix.M41, | 504 | result = new Vector4((position.X * matrix.M11) + (position.Y * matrix.M21) + matrix.M41, |
505 | (position.X * matrix.M12) + (position.Y * matrix.M22) + matrix.M42, | 505 | (position.X * matrix.M12) + (position.Y * matrix.M22) + matrix.M42, |
506 | (position.X * matrix.M13) + (position.Y * matrix.M23) + matrix.M43, | 506 | (position.X * matrix.M13) + (position.Y * matrix.M23) + matrix.M43, |
507 | (position.X * matrix.M14) + (position.Y * matrix.M24) + matrix.M44); | 507 | (position.X * matrix.M14) + (position.Y * matrix.M24) + matrix.M44); |
508 | }*/ | 508 | }*/ |
509 | 509 | ||
510 | public static void Transform(ref Vector3 position, ref Matrix matrix, out Vector4 result) | 510 | public static void Transform(ref Vector3 position, ref Matrix matrix, out Vector4 result) |
511 | { | 511 | { |
512 | result = new Vector4((position.X * matrix.M11) + (position.Y * matrix.M21) + (position.Z * matrix.M31) + matrix.M41, | 512 | result = new Vector4((position.X * matrix.M11) + (position.Y * matrix.M21) + (position.Z * matrix.M31) + matrix.M41, |
513 | (position.X * matrix.M12) + (position.Y * matrix.M22) + (position.Z * matrix.M32) + matrix.M42, | 513 | (position.X * matrix.M12) + (position.Y * matrix.M22) + (position.Z * matrix.M32) + matrix.M42, |
514 | (position.X * matrix.M13) + (position.Y * matrix.M23) + (position.Z * matrix.M33) + matrix.M43, | 514 | (position.X * matrix.M13) + (position.Y * matrix.M23) + (position.Z * matrix.M33) + matrix.M43, |
515 | (position.X * matrix.M14) + (position.Y * matrix.M24) + (position.Z * matrix.M34) + matrix.M44); | 515 | (position.X * matrix.M14) + (position.Y * matrix.M24) + (position.Z * matrix.M34) + matrix.M44); |
516 | } | 516 | } |
517 | 517 | ||
518 | public static void Transform(ref Vector4 vector, ref Matrix matrix, out Vector4 result) | 518 | public static void Transform(ref Vector4 vector, ref Matrix matrix, out Vector4 result) |
519 | { | 519 | { |
520 | result = new Vector4((vector.X * matrix.M11) + (vector.Y * matrix.M21) + (vector.Z * matrix.M31) + (vector.W * matrix.M41), | 520 | result = new Vector4((vector.X * matrix.M11) + (vector.Y * matrix.M21) + (vector.Z * matrix.M31) + (vector.W * matrix.M41), |
521 | (vector.X * matrix.M12) + (vector.Y * matrix.M22) + (vector.Z * matrix.M32) + (vector.W * matrix.M42), | 521 | (vector.X * matrix.M12) + (vector.Y * matrix.M22) + (vector.Z * matrix.M32) + (vector.W * matrix.M42), |
522 | (vector.X * matrix.M13) + (vector.Y * matrix.M23) + (vector.Z * matrix.M33) + (vector.W * matrix.M43), | 522 | (vector.X * matrix.M13) + (vector.Y * matrix.M23) + (vector.Z * matrix.M33) + (vector.W * matrix.M43), |
523 | (vector.X * matrix.M14) + (vector.Y * matrix.M24) + (vector.Z * matrix.M34) + (vector.W * matrix.M44)); | 523 | (vector.X * matrix.M14) + (vector.Y * matrix.M24) + (vector.Z * matrix.M34) + (vector.W * matrix.M44)); |
524 | } | 524 | } |
525 | 525 | ||
526 | public override string ToString() | 526 | public override string ToString() |
527 | { | 527 | { |
528 | StringBuilder sb = new StringBuilder(32); | 528 | StringBuilder sb = new StringBuilder(32); |
529 | sb.Append("{X:"); | 529 | sb.Append("{X:"); |
530 | sb.Append(this.X); | 530 | sb.Append(this.X); |
531 | sb.Append(" Y:"); | 531 | sb.Append(" Y:"); |
532 | sb.Append(this.Y); | 532 | sb.Append(this.Y); |
533 | sb.Append(" Z:"); | 533 | sb.Append(" Z:"); |
534 | sb.Append(this.Z); | 534 | sb.Append(this.Z); |
535 | sb.Append(" W:"); | 535 | sb.Append(" W:"); |
536 | sb.Append(this.W); | 536 | sb.Append(this.W); |
537 | sb.Append("}"); | 537 | sb.Append("}"); |
538 | return sb.ToString(); | 538 | return sb.ToString(); |
539 | } | 539 | } |
540 | 540 | ||
541 | #endregion Public Methods | 541 | #endregion Public Methods |
542 | 542 | ||
543 | 543 | ||
544 | #region Operators | 544 | #region Operators |
545 | 545 | ||
546 | public static Vector4 operator -(Vector4 value) | 546 | public static Vector4 operator -(Vector4 value) |
547 | { | 547 | { |
548 | return new Vector4(-value.X, -value.Y, -value.Z, -value.W); | 548 | return new Vector4(-value.X, -value.Y, -value.Z, -value.W); |
549 | } | 549 | } |
550 | 550 | ||
551 | public static bool operator ==(Vector4 value1, Vector4 value2) | 551 | public static bool operator ==(Vector4 value1, Vector4 value2) |
552 | { | 552 | { |
553 | return value1.W == value2.W | 553 | return value1.W == value2.W |
554 | && value1.X == value2.X | 554 | && value1.X == value2.X |
555 | && value1.Y == value2.Y | 555 | && value1.Y == value2.Y |
556 | && value1.Z == value2.Z; | 556 | && value1.Z == value2.Z; |
557 | } | 557 | } |
558 | 558 | ||
559 | public static bool operator !=(Vector4 value1, Vector4 value2) | 559 | public static bool operator !=(Vector4 value1, Vector4 value2) |
560 | { | 560 | { |
561 | return !(value1 == value2); | 561 | return !(value1 == value2); |
562 | } | 562 | } |
563 | 563 | ||
564 | public static Vector4 operator +(Vector4 value1, Vector4 value2) | 564 | public static Vector4 operator +(Vector4 value1, Vector4 value2) |
565 | { | 565 | { |
566 | value1.W += value2.W; | 566 | value1.W += value2.W; |
567 | value1.X += value2.X; | 567 | value1.X += value2.X; |
568 | value1.Y += value2.Y; | 568 | value1.Y += value2.Y; |
569 | value1.Z += value2.Z; | 569 | value1.Z += value2.Z; |
570 | return value1; | 570 | return value1; |
571 | } | 571 | } |
572 | 572 | ||
573 | public static Vector4 operator -(Vector4 value1, Vector4 value2) | 573 | public static Vector4 operator -(Vector4 value1, Vector4 value2) |
574 | { | 574 | { |
575 | value1.W -= value2.W; | 575 | value1.W -= value2.W; |
576 | value1.X -= value2.X; | 576 | value1.X -= value2.X; |
577 | value1.Y -= value2.Y; | 577 | value1.Y -= value2.Y; |
578 | value1.Z -= value2.Z; | 578 | value1.Z -= value2.Z; |
579 | return value1; | 579 | return value1; |
580 | } | 580 | } |
581 | 581 | ||
582 | public static Vector4 operator *(Vector4 value1, Vector4 value2) | 582 | public static Vector4 operator *(Vector4 value1, Vector4 value2) |
583 | { | 583 | { |
584 | value1.W *= value2.W; | 584 | value1.W *= value2.W; |
585 | value1.X *= value2.X; | 585 | value1.X *= value2.X; |
586 | value1.Y *= value2.Y; | 586 | value1.Y *= value2.Y; |
587 | value1.Z *= value2.Z; | 587 | value1.Z *= value2.Z; |
588 | return value1; | 588 | return value1; |
589 | } | 589 | } |
590 | 590 | ||
591 | public static Vector4 operator *(Vector4 value1, float scaleFactor) | 591 | public static Vector4 operator *(Vector4 value1, float scaleFactor) |
592 | { | 592 | { |
593 | value1.W *= scaleFactor; | 593 | value1.W *= scaleFactor; |
594 | value1.X *= scaleFactor; | 594 | value1.X *= scaleFactor; |
595 | value1.Y *= scaleFactor; | 595 | value1.Y *= scaleFactor; |
596 | value1.Z *= scaleFactor; | 596 | value1.Z *= scaleFactor; |
597 | return value1; | 597 | return value1; |
598 | } | 598 | } |
599 | 599 | ||
600 | public static Vector4 operator *(float scaleFactor, Vector4 value1) | 600 | public static Vector4 operator *(float scaleFactor, Vector4 value1) |
601 | { | 601 | { |
602 | value1.W *= scaleFactor; | 602 | value1.W *= scaleFactor; |
603 | value1.X *= scaleFactor; | 603 | value1.X *= scaleFactor; |
604 | value1.Y *= scaleFactor; | 604 | value1.Y *= scaleFactor; |
605 | value1.Z *= scaleFactor; | 605 | value1.Z *= scaleFactor; |
606 | return value1; | 606 | return value1; |
607 | } | 607 | } |
608 | 608 | ||
609 | public static Vector4 operator /(Vector4 value1, Vector4 value2) | 609 | public static Vector4 operator /(Vector4 value1, Vector4 value2) |
610 | { | 610 | { |
611 | value1.W /= value2.W; | 611 | value1.W /= value2.W; |
612 | value1.X /= value2.X; | 612 | value1.X /= value2.X; |
613 | value1.Y /= value2.Y; | 613 | value1.Y /= value2.Y; |
614 | value1.Z /= value2.Z; | 614 | value1.Z /= value2.Z; |
615 | return value1; | 615 | return value1; |
616 | } | 616 | } |
617 | 617 | ||
618 | public static Vector4 operator /(Vector4 value1, float divider) | 618 | public static Vector4 operator /(Vector4 value1, float divider) |
619 | { | 619 | { |
620 | float factor = 1f / divider; | 620 | float factor = 1f / divider; |
621 | value1.W *= factor; | 621 | value1.W *= factor; |
622 | value1.X *= factor; | 622 | value1.X *= factor; |
623 | value1.Y *= factor; | 623 | value1.Y *= factor; |
624 | value1.Z *= factor; | 624 | value1.Z *= factor; |
625 | return value1; | 625 | return value1; |
626 | } | 626 | } |
627 | 627 | ||
628 | #endregion Operators | 628 | #endregion Operators |
629 | } | 629 | } |
630 | } | 630 | } |