aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/ModifiedBulletX/MonoXnaCompactMaths/Quaternion.cs
diff options
context:
space:
mode:
authorSean Dague2007-07-16 15:40:11 +0000
committerSean Dague2007-07-16 15:40:11 +0000
commit2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6 (patch)
treee3f80ad51736cf17e856547b1bcf956010927434 /libraries/ModifiedBulletX/MonoXnaCompactMaths/Quaternion.cs
parent*Trunk compiles now (diff)
downloadopensim-SC_OLD-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.zip
opensim-SC_OLD-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.tar.gz
opensim-SC_OLD-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.tar.bz2
opensim-SC_OLD-2a3c79df83e800d5dfe75a1a3b140ed81da2b1d6.tar.xz
changed to native line ending encoding
Diffstat (limited to 'libraries/ModifiedBulletX/MonoXnaCompactMaths/Quaternion.cs')
-rw-r--r--libraries/ModifiedBulletX/MonoXnaCompactMaths/Quaternion.cs692
1 files changed, 346 insertions, 346 deletions
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/*
3MIT License 3MIT License
4Copyright © 2006 The Mono.Xna Team 4Copyright © 2006 The Mono.Xna Team
5 5
6All rights reserved. 6All rights reserved.
7 7
8Permission is hereby granted, free of charge, to any person obtaining a copy 8Permission is hereby granted, free of charge, to any person obtaining a copy
9of this software and associated documentation files (the "Software"), to deal 9of this software and associated documentation files (the "Software"), to deal
10in the Software without restriction, including without limitation the rights 10in the Software without restriction, including without limitation the rights
11to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12copies of the Software, and to permit persons to whom the Software is 12copies of the Software, and to permit persons to whom the Software is
13furnished to do so, subject to the following conditions: 13furnished to do so, subject to the following conditions:
14 14
15The above copyright notice and this permission notice shall be included in all 15The above copyright notice and this permission notice shall be included in all
16copies or substantial portions of the Software. 16copies or substantial portions of the Software.
17 17
18THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24SOFTWARE. 24SOFTWARE.
25*/ 25*/
26#endregion License 26#endregion License
27 27
28using System; 28using System;
29using System.ComponentModel; 29using System.ComponentModel;
30 30
31namespace MonoXnaCompactMaths 31namespace 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}