diff options
Diffstat (limited to '')
-rw-r--r-- | libraries/ModifiedBulletX/MonoXnaCompactMaths/Matrix.cs | 1366 |
1 files changed, 683 insertions, 683 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 | } |