TrueSync
TSMatrix.cs
1 /* Copyright (C) <2009-2011> <Thorben Linneweber, Jitter Physics>
2 *
3 * This software is provided 'as-is', without any express or implied
4 * warranty. In no event will the authors be held liable for any damages
5 * arising from the use of this software.
6 *
7 * Permission is granted to anyone to use this software for any purpose,
8 * including commercial applications, and to alter it and redistribute it
9 * freely, subject to the following restrictions:
10 *
11 * 1. The origin of this software must not be misrepresented; you must not
12 * claim that you wrote the original software. If you use this software
13 * in a product, an acknowledgment in the product documentation would be
14 * appreciated but is not required.
15 * 2. Altered source versions must be plainly marked as such, and must not be
16 * misrepresented as being the original software.
17 * 3. This notice may not be removed or altered from any source distribution.
18 */
19 
20 namespace TrueSync
21 {
22 
26  public struct TSMatrix
27  {
31  public FP M11; // 1st row vector
35  public FP M12;
39  public FP M13;
43  public FP M21; // 2nd row vector
47  public FP M22;
51  public FP M23;
55  public FP M31; // 3rd row vector
59  public FP M32;
63  public FP M33;
64 
65  internal static TSMatrix InternalIdentity;
66 
70  public static readonly TSMatrix Identity;
71  public static readonly TSMatrix Zero;
72 
73  static TSMatrix()
74  {
75  Zero = new TSMatrix();
76 
77  Identity = new TSMatrix();
78  Identity.M11 = FP.One;
79  Identity.M22 = FP.One;
80  Identity.M33 = FP.One;
81 
82  InternalIdentity = Identity;
83  }
84 
85  public TSVector eulerAngles {
86  get {
87  TSVector result = new TSVector();
88 
89  result.x = TSMath.Atan2(M32, M33) * FP.Rad2Deg;
90  result.y = TSMath.Atan2(-M31, TSMath.Sqrt(M32 * M32 + M33 * M33)) * FP.Rad2Deg;
91  result.z = TSMath.Atan2(M21, M11) * FP.Rad2Deg;
92 
93  return result * -1;
94  }
95  }
96 
97  public static TSMatrix CreateFromYawPitchRoll(FP yaw, FP pitch, FP roll)
98  {
99  TSMatrix matrix;
100  TSQuaternion quaternion;
101  TSQuaternion.CreateFromYawPitchRoll(yaw, pitch, roll, out quaternion);
102  CreateFromQuaternion(ref quaternion, out matrix);
103  return matrix;
104  }
105 
106  public static TSMatrix CreateRotationX(FP radians)
107  {
108  TSMatrix matrix;
109  FP num2 = FP.Cos(radians);
110  FP num = FP.Sin(radians);
111  matrix.M11 = FP.One;
112  matrix.M12 = FP.Zero;
113  matrix.M13 = FP.Zero;
114  matrix.M21 = FP.Zero;
115  matrix.M22 = num2;
116  matrix.M23 = num;
117  matrix.M31 = FP.Zero;
118  matrix.M32 = -num;
119  matrix.M33 = num2;
120  return matrix;
121  }
122 
123  public static void CreateRotationX(FP radians, out TSMatrix result)
124  {
125  FP num2 = FP.Cos(radians);
126  FP num = FP.Sin(radians);
127  result.M11 = FP.One;
128  result.M12 = FP.Zero;
129  result.M13 = FP.Zero;
130  result.M21 = FP.Zero;
131  result.M22 = num2;
132  result.M23 = num;
133  result.M31 = FP.Zero;
134  result.M32 = -num;
135  result.M33 = num2;
136  }
137 
138  public static TSMatrix CreateRotationY(FP radians)
139  {
140  TSMatrix matrix;
141  FP num2 = FP.Cos(radians);
142  FP num = FP.Sin(radians);
143  matrix.M11 = num2;
144  matrix.M12 = FP.Zero;
145  matrix.M13 = -num;
146  matrix.M21 = FP.Zero;
147  matrix.M22 = FP.One;
148  matrix.M23 = FP.Zero;
149  matrix.M31 = num;
150  matrix.M32 = FP.Zero;
151  matrix.M33 = num2;
152  return matrix;
153  }
154 
155  public static void CreateRotationY(FP radians, out TSMatrix result)
156  {
157  FP num2 = FP.Cos(radians);
158  FP num = FP.Sin(radians);
159  result.M11 = num2;
160  result.M12 = FP.Zero;
161  result.M13 = -num;
162  result.M21 = FP.Zero;
163  result.M22 = FP.One;
164  result.M23 = FP.Zero;
165  result.M31 = num;
166  result.M32 = FP.Zero;
167  result.M33 = num2;
168  }
169 
170  public static TSMatrix CreateRotationZ(FP radians)
171  {
172  TSMatrix matrix;
173  FP num2 = FP.Cos(radians);
174  FP num = FP.Sin(radians);
175  matrix.M11 = num2;
176  matrix.M12 = num;
177  matrix.M13 = FP.Zero;
178  matrix.M21 = -num;
179  matrix.M22 = num2;
180  matrix.M23 = FP.Zero;
181  matrix.M31 = FP.Zero;
182  matrix.M32 = FP.Zero;
183  matrix.M33 = FP.One;
184  return matrix;
185  }
186 
187 
188  public static void CreateRotationZ(FP radians, out TSMatrix result)
189  {
190  FP num2 = FP.Cos(radians);
191  FP num = FP.Sin(radians);
192  result.M11 = num2;
193  result.M12 = num;
194  result.M13 = FP.Zero;
195  result.M21 = -num;
196  result.M22 = num2;
197  result.M23 = FP.Zero;
198  result.M31 = FP.Zero;
199  result.M32 = FP.Zero;
200  result.M33 = FP.One;
201  }
202 
215  #region public JMatrix(FP m11, FP m12, FP m13, FP m21, FP m22, FP m23,FP m31, FP m32, FP m33)
216  public TSMatrix(FP m11, FP m12, FP m13, FP m21, FP m22, FP m23,FP m31, FP m32, FP m33)
217  {
218  this.M11 = m11;
219  this.M12 = m12;
220  this.M13 = m13;
221  this.M21 = m21;
222  this.M22 = m22;
223  this.M23 = m23;
224  this.M31 = m31;
225  this.M32 = m32;
226  this.M33 = m33;
227  }
228  #endregion
229 
234  #region public FP Determinant()
235  //public FP Determinant()
236  //{
237  // return M11 * M22 * M33 -M11 * M23 * M32 -M12 * M21 * M33 +M12 * M23 * M31 + M13 * M21 * M32 - M13 * M22 * M31;
238  //}
239  #endregion
240 
247  #region public static JMatrix Multiply(JMatrix matrix1, JMatrix matrix2)
248  public static TSMatrix Multiply(TSMatrix matrix1, TSMatrix matrix2)
249  {
250  TSMatrix result;
251  TSMatrix.Multiply(ref matrix1, ref matrix2, out result);
252  return result;
253  }
254 
261  public static void Multiply(ref TSMatrix matrix1, ref TSMatrix matrix2, out TSMatrix result)
262  {
263  FP num0 = ((matrix1.M11 * matrix2.M11) + (matrix1.M12 * matrix2.M21)) + (matrix1.M13 * matrix2.M31);
264  FP num1 = ((matrix1.M11 * matrix2.M12) + (matrix1.M12 * matrix2.M22)) + (matrix1.M13 * matrix2.M32);
265  FP num2 = ((matrix1.M11 * matrix2.M13) + (matrix1.M12 * matrix2.M23)) + (matrix1.M13 * matrix2.M33);
266  FP num3 = ((matrix1.M21 * matrix2.M11) + (matrix1.M22 * matrix2.M21)) + (matrix1.M23 * matrix2.M31);
267  FP num4 = ((matrix1.M21 * matrix2.M12) + (matrix1.M22 * matrix2.M22)) + (matrix1.M23 * matrix2.M32);
268  FP num5 = ((matrix1.M21 * matrix2.M13) + (matrix1.M22 * matrix2.M23)) + (matrix1.M23 * matrix2.M33);
269  FP num6 = ((matrix1.M31 * matrix2.M11) + (matrix1.M32 * matrix2.M21)) + (matrix1.M33 * matrix2.M31);
270  FP num7 = ((matrix1.M31 * matrix2.M12) + (matrix1.M32 * matrix2.M22)) + (matrix1.M33 * matrix2.M32);
271  FP num8 = ((matrix1.M31 * matrix2.M13) + (matrix1.M32 * matrix2.M23)) + (matrix1.M33 * matrix2.M33);
272 
273  result.M11 = num0;
274  result.M12 = num1;
275  result.M13 = num2;
276  result.M21 = num3;
277  result.M22 = num4;
278  result.M23 = num5;
279  result.M31 = num6;
280  result.M32 = num7;
281  result.M33 = num8;
282  }
283  #endregion
284 
291  #region public static JMatrix Add(JMatrix matrix1, JMatrix matrix2)
292  public static TSMatrix Add(TSMatrix matrix1, TSMatrix matrix2)
293  {
294  TSMatrix result;
295  TSMatrix.Add(ref matrix1, ref matrix2, out result);
296  return result;
297  }
298 
305  public static void Add(ref TSMatrix matrix1, ref TSMatrix matrix2, out TSMatrix result)
306  {
307  result.M11 = matrix1.M11 + matrix2.M11;
308  result.M12 = matrix1.M12 + matrix2.M12;
309  result.M13 = matrix1.M13 + matrix2.M13;
310  result.M21 = matrix1.M21 + matrix2.M21;
311  result.M22 = matrix1.M22 + matrix2.M22;
312  result.M23 = matrix1.M23 + matrix2.M23;
313  result.M31 = matrix1.M31 + matrix2.M31;
314  result.M32 = matrix1.M32 + matrix2.M32;
315  result.M33 = matrix1.M33 + matrix2.M33;
316  }
317  #endregion
318 
324  #region public static JMatrix Inverse(JMatrix matrix)
325  public static TSMatrix Inverse(TSMatrix matrix)
326  {
327  TSMatrix result;
328  TSMatrix.Inverse(ref matrix, out result);
329  return result;
330  }
331 
332  public FP Determinant()
333  {
334  return M11 * M22 * M33 + M12 * M23 * M31 + M13 * M21 * M32 -
335  M31 * M22 * M13 - M32 * M23 * M11 - M33 * M21 * M12;
336  }
337 
338  public static void Invert(ref TSMatrix matrix, out TSMatrix result)
339  {
340  FP determinantInverse = 1 / matrix.Determinant();
341  FP m11 = (matrix.M22 * matrix.M33 - matrix.M23 * matrix.M32) * determinantInverse;
342  FP m12 = (matrix.M13 * matrix.M32 - matrix.M33 * matrix.M12) * determinantInverse;
343  FP m13 = (matrix.M12 * matrix.M23 - matrix.M22 * matrix.M13) * determinantInverse;
344 
345  FP m21 = (matrix.M23 * matrix.M31 - matrix.M21 * matrix.M33) * determinantInverse;
346  FP m22 = (matrix.M11 * matrix.M33 - matrix.M13 * matrix.M31) * determinantInverse;
347  FP m23 = (matrix.M13 * matrix.M21 - matrix.M11 * matrix.M23) * determinantInverse;
348 
349  FP m31 = (matrix.M21 * matrix.M32 - matrix.M22 * matrix.M31) * determinantInverse;
350  FP m32 = (matrix.M12 * matrix.M31 - matrix.M11 * matrix.M32) * determinantInverse;
351  FP m33 = (matrix.M11 * matrix.M22 - matrix.M12 * matrix.M21) * determinantInverse;
352 
353  result.M11 = m11;
354  result.M12 = m12;
355  result.M13 = m13;
356 
357  result.M21 = m21;
358  result.M22 = m22;
359  result.M23 = m23;
360 
361  result.M31 = m31;
362  result.M32 = m32;
363  result.M33 = m33;
364  }
365 
371  public static void Inverse(ref TSMatrix matrix, out TSMatrix result)
372  {
373  FP det = 1024 * matrix.M11 * matrix.M22 * matrix.M33 -
374  1024 * matrix.M11 * matrix.M23 * matrix.M32 -
375  1024 * matrix.M12 * matrix.M21 * matrix.M33 +
376  1024 * matrix.M12 * matrix.M23 * matrix.M31 +
377  1024 * matrix.M13 * matrix.M21 * matrix.M32 -
378  1024 * matrix.M13 * matrix.M22 * matrix.M31;
379 
380  FP num11 =1024* matrix.M22 * matrix.M33 - 1024*matrix.M23 * matrix.M32;
381  FP num12 =1024* matrix.M13 * matrix.M32 -1024* matrix.M12 * matrix.M33;
382  FP num13 =1024* matrix.M12 * matrix.M23 -1024* matrix.M22 * matrix.M13;
383 
384  FP num21 =1024* matrix.M23 * matrix.M31 -1024* matrix.M33 * matrix.M21;
385  FP num22 =1024* matrix.M11 * matrix.M33 -1024* matrix.M31 * matrix.M13;
386  FP num23 =1024* matrix.M13 * matrix.M21 -1024* matrix.M23 * matrix.M11;
387 
388  FP num31 =1024* matrix.M21 * matrix.M32 - 1024* matrix.M31 * matrix.M22;
389  FP num32 =1024* matrix.M12 * matrix.M31 - 1024* matrix.M32 * matrix.M11;
390  FP num33 =1024* matrix.M11 * matrix.M22 - 1024*matrix.M21 * matrix.M12;
391 
392  if(det == 0){
393  result.M11 = FP.PositiveInfinity;
394  result.M12 = FP.PositiveInfinity;
395  result.M13 = FP.PositiveInfinity;
396  result.M21 = FP.PositiveInfinity;
397  result.M22 = FP.PositiveInfinity;
398  result.M23 = FP.PositiveInfinity;
399  result.M31 = FP.PositiveInfinity;
400  result.M32 = FP.PositiveInfinity;
401  result.M33 = FP.PositiveInfinity;
402  } else{
403  result.M11 = num11 / det;
404  result.M12 = num12 / det;
405  result.M13 = num13 / det;
406  result.M21 = num21 / det;
407  result.M22 = num22 / det;
408  result.M23 = num23 / det;
409  result.M31 = num31 / det;
410  result.M32 = num32 / det;
411  result.M33 = num33 / det;
412  }
413 
414  }
415  #endregion
416 
423  #region public static JMatrix Multiply(JMatrix matrix1, FP scaleFactor)
424  public static TSMatrix Multiply(TSMatrix matrix1, FP scaleFactor)
425  {
426  TSMatrix result;
427  TSMatrix.Multiply(ref matrix1, scaleFactor, out result);
428  return result;
429  }
430 
437  public static void Multiply(ref TSMatrix matrix1, FP scaleFactor, out TSMatrix result)
438  {
439  FP num = scaleFactor;
440  result.M11 = matrix1.M11 * num;
441  result.M12 = matrix1.M12 * num;
442  result.M13 = matrix1.M13 * num;
443  result.M21 = matrix1.M21 * num;
444  result.M22 = matrix1.M22 * num;
445  result.M23 = matrix1.M23 * num;
446  result.M31 = matrix1.M31 * num;
447  result.M32 = matrix1.M32 * num;
448  result.M33 = matrix1.M33 * num;
449  }
450  #endregion
451 
457  #region public static JMatrix CreateFromQuaternion(JQuaternion quaternion)
458 
459  public static TSMatrix CreateFromLookAt(TSVector position, TSVector target){
460  TSMatrix result;
461  LookAt (out result, position, target);
462  return result;
463  }
464 
465  public static void LookAt(out TSMatrix result, TSVector position, TSVector target){
466  TSVector zaxis = target - position; zaxis.Normalize ();
467  TSVector xaxis = TSVector.Cross (TSVector.up, zaxis); xaxis.Normalize();
468  TSVector yaxis = TSVector.Cross (zaxis, xaxis);
469  result.M11 = xaxis.x;
470  result.M21 = yaxis.x;
471  result.M31 = zaxis.x;
472  result.M12 = xaxis.y;
473  result.M22 = yaxis.y;
474  result.M32 = zaxis.y;
475  result.M13 = xaxis.z;
476  result.M23 = yaxis.z;
477  result.M33 = zaxis.z;
478  }
479 
480 
481  public static TSMatrix CreateFromQuaternion(TSQuaternion quaternion)
482  {
483  TSMatrix result;
484  TSMatrix.CreateFromQuaternion(ref quaternion,out result);
485  return result;
486  }
487 
493  public static void CreateFromQuaternion(ref TSQuaternion quaternion, out TSMatrix result)
494  {
495  FP num9 = quaternion.x * quaternion.x;
496  FP num8 = quaternion.y * quaternion.y;
497  FP num7 = quaternion.z * quaternion.z;
498  FP num6 = quaternion.x * quaternion.y;
499  FP num5 = quaternion.z * quaternion.w;
500  FP num4 = quaternion.z * quaternion.x;
501  FP num3 = quaternion.y * quaternion.w;
502  FP num2 = quaternion.y * quaternion.z;
503  FP num = quaternion.x * quaternion.w;
504  result.M11 = FP.One - (2 * (num8 + num7));
505  result.M12 = 2 * (num6 + num5);
506  result.M13 = 2 * (num4 - num3);
507  result.M21 = 2 * (num6 - num5);
508  result.M22 = FP.One - (2 * (num7 + num9));
509  result.M23 = 2 * (num2 + num);
510  result.M31 = 2 * (num4 + num3);
511  result.M32 = 2 * (num2 - num);
512  result.M33 = FP.One - (2 * (num8 + num9));
513  }
514  #endregion
515 
521  #region public static JMatrix Transpose(JMatrix matrix)
522  public static TSMatrix Transpose(TSMatrix matrix)
523  {
524  TSMatrix result;
525  TSMatrix.Transpose(ref matrix, out result);
526  return result;
527  }
528 
534  public static void Transpose(ref TSMatrix matrix, out TSMatrix result)
535  {
536  result.M11 = matrix.M11;
537  result.M12 = matrix.M21;
538  result.M13 = matrix.M31;
539  result.M21 = matrix.M12;
540  result.M22 = matrix.M22;
541  result.M23 = matrix.M32;
542  result.M31 = matrix.M13;
543  result.M32 = matrix.M23;
544  result.M33 = matrix.M33;
545  }
546  #endregion
547 
554  #region public static JMatrix operator *(JMatrix value1,JMatrix value2)
555  public static TSMatrix operator *(TSMatrix value1,TSMatrix value2)
556  {
557  TSMatrix result; TSMatrix.Multiply(ref value1, ref value2, out result);
558  return result;
559  }
560  #endregion
561 
562 
563  public FP Trace()
564  {
565  return this.M11 + this.M22 + this.M33;
566  }
567 
574  #region public static JMatrix operator +(JMatrix value1, JMatrix value2)
575  public static TSMatrix operator +(TSMatrix value1, TSMatrix value2)
576  {
577  TSMatrix result; TSMatrix.Add(ref value1, ref value2, out result);
578  return result;
579  }
580  #endregion
581 
588  #region public static JMatrix operator -(JMatrix value1, JMatrix value2)
589  public static TSMatrix operator -(TSMatrix value1, TSMatrix value2)
590  {
591  TSMatrix result; TSMatrix.Multiply(ref value2, -FP.One, out value2);
592  TSMatrix.Add(ref value1, ref value2, out result);
593  return result;
594  }
595  #endregion
596 
597 
604  #region public static void CreateFromAxisAngle(ref JVector axis, FP angle, out JMatrix result)
605  public static void CreateFromAxisAngle(ref TSVector axis, FP angle, out TSMatrix result)
606  {
607  FP x = axis.x;
608  FP y = axis.y;
609  FP z = axis.z;
610  FP num2 = FP.Sin(angle);
611  FP num = FP.Cos(angle);
612  FP num11 = x * x;
613  FP num10 = y * y;
614  FP num9 = z * z;
615  FP num8 = x * y;
616  FP num7 = x * z;
617  FP num6 = y * z;
618  result.M11 = num11 + (num * (FP.One - num11));
619  result.M12 = (num8 - (num * num8)) + (num2 * z);
620  result.M13 = (num7 - (num * num7)) - (num2 * y);
621  result.M21 = (num8 - (num * num8)) - (num2 * z);
622  result.M22 = num10 + (num * (FP.One - num10));
623  result.M23 = (num6 - (num * num6)) + (num2 * x);
624  result.M31 = (num7 - (num * num7)) + (num2 * y);
625  result.M32 = (num6 - (num * num6)) - (num2 * x);
626  result.M33 = num9 + (num * (FP.One - num9));
627  }
628 
635  public static TSMatrix AngleAxis(FP angle, TSVector axis)
636  {
637  TSMatrix result; CreateFromAxisAngle(ref axis, angle, out result);
638  return result;
639  }
640 
641  #endregion
642 
643  public override string ToString() {
644  return string.Format("{0}|{1}|{2}|{3}|{4}|{5}|{6}|{7}|{8}", M11.RawValue, M12.RawValue, M13.RawValue, M21.RawValue, M22.RawValue, M23.RawValue, M31.RawValue, M32.RawValue, M33.RawValue);
645  }
646 
647  // TODO not working with rigidbody, even with update
648  private void LookAt(TSVector position, TSVector target) {
649  TSMatrix.LookAt (out this, position, target);
650  }
651 
652  }
653 
654 }
FP y
The Y component of the vector.
Definition: TSVector.cs:39
static TSMatrix AngleAxis(FP angle, TSVector axis)
Creates a matrix which rotates around the given axis by the given angle.
Definition: TSMatrix.cs:635
static void CreateFromQuaternion(ref TSQuaternion quaternion, out TSMatrix result)
Creates a JMatrix representing an orientation from a quaternion.
Definition: TSMatrix.cs:493
static TSMatrix Multiply(TSMatrix matrix1, FP scaleFactor)
Multiply a matrix by a scalefactor.
Definition: TSMatrix.cs:424
static void Add(ref TSMatrix matrix1, ref TSMatrix matrix2, out TSMatrix result)
Matrices are added.
Definition: TSMatrix.cs:305
static TSMatrix operator-(TSMatrix value1, TSMatrix value2)
Subtracts two matrices.
Definition: TSMatrix.cs:589
static TSMatrix operator*(TSMatrix value1, TSMatrix value2)
Multiplies two matrices.
Definition: TSMatrix.cs:555
static readonly TSVector up
A vector with components (0,1,0);
Definition: TSVector.cs:59
static FP Atan2(FP y, FP x)
Returns the arc tan of coordinates x-y.
Definition: TSMath.cs:181
static TSMatrix CreateFromLookAt(TSVector position, TSVector target)
Creates a JMatrix representing an orientation from a quaternion.
Definition: TSMatrix.cs:459
A vector structure.
Definition: TSVector.cs:29
static TSMatrix Add(TSMatrix matrix1, TSMatrix matrix2)
Matrices are added.
Definition: TSMatrix.cs:292
static void Transpose(ref TSMatrix matrix, out TSMatrix result)
Creates the transposed matrix.
Definition: TSMatrix.cs:534
static TSMatrix Inverse(TSMatrix matrix)
Calculates the inverse of a give matrix.
Definition: TSMatrix.cs:325
static void CreateFromAxisAngle(ref TSVector axis, FP angle, out TSMatrix result)
Creates a matrix which rotates around the given axis by the given angle.
Definition: TSMatrix.cs:605
Contains common math operations.
Definition: TSMath.cs:25
FP z
The Z component of the vector.
Definition: TSVector.cs:41
static void Multiply(ref TSMatrix matrix1, FP scaleFactor, out TSMatrix result)
Multiply a matrix by a scalefactor.
Definition: TSMatrix.cs:437
TSMatrix(FP m11, FP m12, FP m13, FP m21, FP m22, FP m23, FP m31, FP m32, FP m33)
Initializes a new instance of the matrix structure.
Definition: TSMatrix.cs:216
static void Multiply(ref TSMatrix matrix1, ref TSMatrix matrix2, out TSMatrix result)
Multiply two matrices. Notice: matrix multiplication is not commutative.
Definition: TSMatrix.cs:261
static readonly TSMatrix Identity
Identity matrix.
Definition: TSMatrix.cs:70
static TSVector Cross(TSVector vector1, TSVector vector2)
The cross product of two vectors.
Definition: TSVector.cs:531
static FP Sqrt(FP number)
Gets the square root.
Definition: TSMath.cs:59
static TSVector Normalize(TSVector value)
Normalizes the given vector.
Definition: TSVector.cs:612
static void Inverse(ref TSMatrix matrix, out TSMatrix result)
Calculates the inverse of a give matrix.
Definition: TSMatrix.cs:371
3x3 Matrix.
Definition: TSMatrix.cs:26
FP x
The X component of the vector.
Definition: TSVector.cs:37
static TSMatrix Multiply(TSMatrix matrix1, TSMatrix matrix2)
Gets the determinant of the matrix.
Definition: TSMatrix.cs:248
A Quaternion representing an orientation.
Definition: TSQuaternion.cs:29
static TSMatrix Transpose(TSMatrix matrix)
Creates the transposed matrix.
Definition: TSMatrix.cs:522
static TSMatrix operator+(TSMatrix value1, TSMatrix value2)
Adds two matrices.
Definition: TSMatrix.cs:575