Jypeli 10
The simple game programming library
Matrix2x3.cs
Siirry tämän tiedoston dokumentaatioon.
1#region MIT License
2/*
3 * Copyright (c) 2005-2008 Jonathan Mark Porter. http://physics2d.googlepages.com/
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights to
7 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
8 * the Software, and to permit persons to whom the Software is furnished to do so,
9 * subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be
12 * included in all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
16 * PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
17 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
18 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
19 * OTHER DEALINGS IN THE SOFTWARE.
20 */
21#endregion
22
23
24#if UseDouble
25using Scalar = System.Double;
26#else
27using Scalar = System.Single;
28#endif
29using System;
30using System.Runtime.InteropServices;
32using System.Xml.Serialization;
33
34
35// NOTE. The (x,y,z) coordinate system is assumed to be right-handed.
36// Coordinate axis rotation matrices are of the form
37// RX = 1 0 0
38// 0 cos(t) -sin(t)
39// 0 sin(t) cos(t)
40// where t > 0 indicates a counterclockwise rotation in the yz-plane
41// RY = cos(t) 0 sin(t)
42// 0 1 0
43// -sin(t) 0 cos(t)
44// where t > 0 indicates a counterclockwise rotation in the zx-plane
45// RZ = cos(t) -sin(t) 0
46// sin(t) cos(t) 0
47// 0 0 1
48// where t > 0 indicates a counterclockwise rotation in the xy-plane.
49
50namespace AdvanceMath
51{
55 [StructLayout(LayoutKind.Sequential, Size = Matrix2x3.Size)]
56 [AdvBrowsableOrder("Rx,Ry")]
57#if !CompactFramework && !WindowsCE && !PocketPC && !XBOX360 && !SILVERLIGHT && !WINDOWS_PHONE && !NETFX_CORE
58 [Serializable]
59 [System.ComponentModel.TypeConverter(typeof(AdvTypeConverter<Matrix2x3>))]
60#endif
61 public struct Matrix2x3 : IMatrix<Matrix2x3,Vector2D, Vector3D>
62 {
63 #region const fields
67 public const int RowCount = 2;
71 public const int ColumnCount = 3;
75 public const int Count = RowCount * ColumnCount;
79 public const int Size = sizeof(Scalar) * Count;
80 #endregion
81 #region static fields
84
85 public static readonly Matrix2x3 Identity = new Matrix2x3(
86 1, 0, 0,
87 0, 1, 0);
88 public static readonly Matrix2x3 Zero = new Matrix2x3(
89 0, 0, 0,
90 0, 0, 0);
91 #endregion
92 #region static methods
93
94 public static void Copy(ref Matrix2x3 matrix, Scalar[] destArray)
95 {
96 Copy(ref matrix, destArray, 0);
97 }
98 public static void Copy(ref Matrix2x3 matrix, Scalar[] destArray, int index)
99 {
100 ThrowHelper.CheckCopy(destArray, index, Count);
101
102 destArray[index] = matrix.m00;
103 destArray[++index] = matrix.m01;
104 destArray[++index] = matrix.m02;
105
106 destArray[++index] = matrix.m10;
107 destArray[++index] = matrix.m11;
108 destArray[++index] = matrix.m12;
109
110 }
111 public static void Copy(Scalar[] sourceArray, out Matrix2x3 result)
112 {
113 Copy(sourceArray, 0, out result);
114 }
115 public static void Copy(Scalar[] sourceArray, int index, out Matrix2x3 result)
116 {
117 ThrowHelper.CheckCopy(sourceArray, index, Count);
118
119 result.m00 = sourceArray[index];
120 result.m01 = sourceArray[++index];
121 result.m02 = sourceArray[++index];
122
123 result.m10 = sourceArray[++index];
124 result.m11 = sourceArray[++index];
125 result.m12 = sourceArray[++index];
126
127 }
128
129
130 public static void Copy(ref Matrix4x4 source, out Matrix2x3 dest)
131 {
132 dest.m00 = source.m00;
133 dest.m01 = source.m01;
134 dest.m02 = source.m02;
135
136 dest.m10 = source.m10;
137 dest.m11 = source.m11;
138 dest.m12 = source.m12;
139
140 }
141 public static void Copy(ref Matrix2x2 source, ref Matrix2x3 dest)
142 {
143 dest.m00 = source.m00;
144 dest.m01 = source.m01;
145
146 dest.m10 = source.m10;
147 dest.m11 = source.m11;
148 }
149
150
151
152 public static void Copy2DToOpenGlMatrix(ref Matrix2x3 source, Scalar[] destArray)
153 {
154 destArray[0] = source.m00;
155 destArray[1] = source.m10;
156
157
158 destArray[4] = source.m01;
159 destArray[5] = source.m11;
160
161
162 destArray[12] = source.m02;
163 destArray[13] = source.m12;
164
165 destArray[10] = 1;
166 destArray[15] = 1;
167 }
168 public static void Copy2DFromOpenGlMatrix(Scalar[] destArray, out Matrix2x3 result)
169 {
170 result.m00 = destArray[0];
171 result.m10 = destArray[1];
172
173 result.m01 = destArray[4];
174 result.m11 = destArray[5];
175
176 result.m02 = destArray[12];
177 result.m12 = destArray[13];
178 }
179
180 public static Matrix2x3 Lerp(Matrix2x3 left, Matrix2x3 right, Scalar amount)
181 {
182 Matrix2x3 result;
183 Lerp(ref left, ref right, ref amount, out result);
184 return result;
185 }
186 public static void Lerp(ref Matrix2x3 left, ref Matrix2x3 right, ref Scalar amount, out Matrix2x3 result)
187 {
188 result.m00 = (right.m00 - left.m00) * amount + left.m00;
189 result.m01 = (right.m01 - left.m01) * amount + left.m01;
190 result.m02 = (right.m02 - left.m02) * amount + left.m02;
191
192 result.m10 = (right.m10 - left.m10) * amount + left.m10;
193 result.m11 = (right.m11 - left.m11) * amount + left.m11;
194 result.m12 = (right.m12 - left.m12) * amount + left.m12;
195
196 }
197
198
205 public static Matrix2x3 Multiply(Matrix2x3 left, Matrix2x3 right)
206 {
207 Matrix2x3 result;
208
209 result.m00 = left.m00 * right.m00 + left.m01 * right.m10;
210 result.m01 = left.m00 * right.m01 + left.m01 * right.m11;
211 result.m02 = left.m00 * right.m02 + left.m01 * right.m12 + left.m02 ;
212
213 result.m10 = left.m10 * right.m00 + left.m11 * right.m10;
214 result.m11 = left.m10 * right.m01 + left.m11 * right.m11;
215 result.m12 = left.m10 * right.m02 + left.m11 * right.m12 + left.m12;
216
217
218 return result;
219 }
220 public static void Multiply(ref Matrix2x3 left, ref Matrix2x3 right, out Matrix2x3 result)
221 {
222 Scalar m00 = left.m00 * right.m00 + left.m01 * right.m10;
223 Scalar m01 = left.m00 * right.m01 + left.m01 * right.m11;
224 Scalar m02 = left.m00 * right.m02 + left.m01 * right.m12 + left.m02;
225
226 Scalar m10 = left.m10 * right.m00 + left.m11 * right.m10;
227 Scalar m11 = left.m10 * right.m01 + left.m11 * right.m11;
228 Scalar m12 = left.m10 * right.m02 + left.m11 * right.m12 + left.m12;
229
230 result.m00 = m00;
231 result.m01 = m01;
232 result.m02 = m02;
233
234 result.m10 = m10;
235 result.m11 = m11;
236 result.m12 = m12;
237 }
238
245 public static Matrix2x3 Multiply(Matrix2x3 left, Scalar scalar)
246 {
247 Matrix2x3 result;
248
249 result.m00 = left.m00 * scalar;
250 result.m01 = left.m01 * scalar;
251 result.m02 = left.m02 * scalar;
252
253 result.m10 = left.m10 * scalar;
254 result.m11 = left.m11 * scalar;
255 result.m12 = left.m12 * scalar;
256
257
258 return result;
259 }
260 public static void Multiply(ref Matrix2x3 left, ref Scalar scalar, out Matrix2x3 result)
261 {
262
263 result.m00 = left.m00 * scalar;
264 result.m01 = left.m01 * scalar;
265 result.m02 = left.m02 * scalar;
266
267 result.m10 = left.m10 * scalar;
268 result.m11 = left.m11 * scalar;
269 result.m12 = left.m12 * scalar;
270
271 }
272
279 public static Matrix2x3 Multiply(Matrix2x3 left, Matrix2x2 right)
280 {
281 Matrix2x3 result;
282
283 result.m00 = left.m00 * right.m00 + left.m01 * right.m10;
284 result.m01 = left.m00 * right.m01 + left.m01 * right.m11;
285 result.m02 = left.m02;
286
287 result.m10 = left.m10 * right.m00 + left.m11 * right.m10;
288 result.m11 = left.m10 * right.m01 + left.m11 * right.m11;
289 result.m12 = left.m12;
290
291 return result;
292 }
293 public static void Multiply(ref Matrix2x3 left, ref Matrix2x2 right, out Matrix2x3 result)
294 {
295 Scalar m00 = left.m00 * right.m00 + left.m01 * right.m10;
296 Scalar m01 = left.m00 * right.m01 + left.m01 * right.m11;
297
298 Scalar m10 = left.m10 * right.m00 + left.m11 * right.m10;
299 Scalar m11 = left.m10 * right.m01 + left.m11 * right.m11;
300
301
302 result.m00 = m00;
303 result.m01 = m01;
304 result.m02 = left.m02;
305
306 result.m10 = m10;
307 result.m11 = m11;
308 result.m12 = left.m12;
309
310 }
311
318 public static Matrix2x3 Multiply(Matrix2x2 left, Matrix2x3 right)
319 {
320 Matrix2x3 result;
321
322 result.m00 = left.m00 * right.m00 + left.m01 * right.m10;
323 result.m01 = left.m00 * right.m01 + left.m01 * right.m11;
324 result.m02 = left.m00 * right.m02 + left.m01 * right.m12;
325
326 result.m10 = left.m10 * right.m00 + left.m11 * right.m10;
327 result.m11 = left.m10 * right.m01 + left.m11 * right.m11;
328 result.m12 = left.m10 * right.m02 + left.m11 * right.m12;
329
330
331 return result;
332 }
333 public static void Multiply(ref Matrix2x2 left, ref Matrix2x3 right, out Matrix2x3 result)
334 {
335 Scalar m00 = left.m00 * right.m00 + left.m01 * right.m10;
336 Scalar m01 = left.m00 * right.m01 + left.m01 * right.m11;
337 Scalar m02 = left.m00 * right.m02 + left.m01 * right.m12;
338
339 Scalar m10 = left.m10 * right.m00 + left.m11 * right.m10;
340 Scalar m11 = left.m10 * right.m01 + left.m11 * right.m11;
341 Scalar m12 = left.m10 * right.m02 + left.m11 * right.m12;
342
343 result.m00 = m00;
344 result.m01 = m01;
345 result.m02 = m02;
346
347 result.m10 = m10;
348 result.m11 = m11;
349 result.m12 = m12;
350
351
352
353 }
354
355
362 public static Matrix2x3 Add(Matrix2x3 left, Matrix2x3 right)
363 {
364 Matrix2x3 result;
365
366 result.m00 = left.m00 + right.m00;
367 result.m01 = left.m01 + right.m01;
368 result.m02 = left.m02 + right.m02;
369
370 result.m10 = left.m10 + right.m10;
371 result.m11 = left.m11 + right.m11;
372 result.m12 = left.m12 + right.m12;
373
374
375 return result;
376 }
377 public static void Add(ref Matrix2x3 left, ref Matrix2x3 right, out Matrix2x3 result)
378 {
379 result.m00 = left.m00 + right.m00;
380 result.m01 = left.m01 + right.m01;
381 result.m02 = left.m02 + right.m02;
382
383 result.m10 = left.m10 + right.m10;
384 result.m11 = left.m11 + right.m11;
385 result.m12 = left.m12 + right.m12;
386
387
388 }
389
390 public static Matrix2x3 Add(Matrix2x2 left, Matrix2x3 right)
391 {
392 Matrix2x3 result;
393 Add(ref left, ref right, out result);
394 return result;
395 }
396 public static void Add(ref Matrix2x2 left, ref Matrix2x3 right, out Matrix2x3 result)
397 {
398 result.m00 = left.m00 + right.m00;
399 result.m01 = left.m01 + right.m01;
400 result.m02 = right.m02;
401
402 result.m10 = left.m10 + right.m10;
403 result.m11 = left.m11 + right.m11;
404 result.m12 = right.m12;
405
406 }
407 public static Matrix2x3 Add(Matrix2x3 left, Matrix2x2 right)
408 {
409 Matrix2x3 result;
410 Add(ref left, ref right, out result);
411 return result;
412 }
413 public static void Add(ref Matrix2x3 left, ref Matrix2x2 right, out Matrix2x3 result)
414 {
415 result.m00 = left.m00 + right.m00;
416 result.m01 = left.m01 + right.m01;
417 result.m02 = left.m02;
418
419 result.m10 = left.m10 + right.m10;
420 result.m11 = left.m11 + right.m11;
421 result.m12 = left.m12;
422
423 }
424
425 public static Matrix2x3 Transpose(Matrix2x3 source)
426 {
427 Matrix2x3 result;
428 Transpose(ref source, out result);
429 return result;
430 }
431 public static void Transpose(ref Matrix2x3 source, out Matrix2x3 result)
432 {
433 Scalar m01 = source.m01;
434 Scalar m02 = source.m02;
435 Scalar m12 = source.m12;
436
437 result.m00 = source.m00;
438 result.m01 = source.m10;
439 result.m02 = 0;
440
441 result.m10 = m01;
442 result.m11 = source.m11;
443 result.m12 = 0;
444
445
446
447
448 }
449
456 public static Matrix2x3 Subtract(Matrix2x3 left, Matrix2x3 right)
457 {
458 Matrix2x3 result;
459
460 result.m00 = left.m00 - right.m00;
461 result.m01 = left.m01 - right.m01;
462 result.m02 = left.m02 - right.m02;
463
464 result.m10 = left.m10 - right.m10;
465 result.m11 = left.m11 - right.m11;
466 result.m12 = left.m12 - right.m12;
467
468
469 return result;
470 }
471 public static void Subtract(ref Matrix2x3 left, ref Matrix2x3 right, out Matrix2x3 result)
472 {
473 result.m00 = left.m00 - right.m00;
474 result.m01 = left.m01 - right.m01;
475 result.m02 = left.m02 - right.m02;
476
477 result.m10 = left.m10 - right.m10;
478 result.m11 = left.m11 - right.m11;
479 result.m12 = left.m12 - right.m12;
480
481
482 }
483
484 public static Matrix2x3 Subtract(Matrix2x2 left, Matrix2x3 right)
485 {
486 Matrix2x3 result;
487 Subtract(ref left, ref right, out result);
488 return result;
489 }
490 public static void Subtract(ref Matrix2x2 left, ref Matrix2x3 right, out Matrix2x3 result)
491 {
492 result.m00 = left.m00 - right.m00;
493 result.m01 = left.m01 - right.m01;
494 result.m02 = -right.m02;
495
496 result.m10 = left.m10 - right.m10;
497 result.m11 = left.m11 - right.m11;
498 result.m12 = -right.m12;
499
500 }
501 public static Matrix2x3 Subtract(Matrix2x3 left, Matrix2x2 right)
502 {
503 Matrix2x3 result;
504 Subtract(ref left, ref right, out result);
505 return result;
506 }
507 public static void Subtract(ref Matrix2x3 left, ref Matrix2x2 right, out Matrix2x3 result)
508 {
509 result.m00 = left.m00 - right.m00;
510 result.m01 = left.m01 - right.m01;
511 result.m02 = left.m02;
512
513 result.m10 = left.m10 - right.m10;
514 result.m11 = left.m11 - right.m11;
515 result.m12 = left.m12;
516
517 }
518
523 public static Matrix2x3 Negate(Matrix2x3 source)
524 {
525 Matrix2x3 result;
526
527 result.m00 = -source.m00;
528 result.m01 = -source.m01;
529 result.m02 = -source.m02;
530
531 result.m10 = -source.m10;
532 result.m11 = -source.m11;
533 result.m12 = -source.m12;
534
535
536
537 return result;
538 }
539 public static void Negate(ref Matrix2x3 source)
540 {
541 Negate(ref source, out source);
542 }
543 public static void Negate(ref Matrix2x3 source, out Matrix2x3 result)
544 {
545 result.m00 = -source.m00;
546 result.m01 = -source.m01;
547 result.m02 = -source.m02;
548
549 result.m10 = -source.m10;
550 result.m11 = -source.m11;
551 result.m12 = -source.m12;
552
553 }
554
555 public static Matrix2x3 Invert(Matrix2x3 source)
556 {
557 Matrix2x3 result;
558 Invert(ref source, out result);
559 return result;
560 }
561 public static void Invert(ref Matrix2x3 source, out Matrix2x3 result)
562 {
563 Scalar m01 = source.m01;
564 Scalar m02 = source.m02;
565
566 Scalar m11 = source.m11;
567 Scalar m12 = source.m12;
568
569
570
571
572 // Scalar m11m22m12m21 = (m11);
573 // Scalar m10m22m12m20 = (source.m10 );
574 // Scalar m10m21m11m20 = 0;
575
576
577
578 Scalar detInv = 1 / (source.m00 * m11 - m01 * source.m10);
579
580
581 result.m01 = detInv * (-m01);
582 result.m02 = detInv * (m01 * m12 - m02 * m11);
583
584 result.m11 = detInv * (source.m00);
585 result.m12 = detInv * (-(source.m00 * m12 - m02 * source.m10));
586
587 result.m00 = detInv * (m11);
588 result.m10 = detInv * (-source.m10);
589 }
590
591 public static Scalar GetDeterminant(Matrix2x3 source)
592 {
593 Scalar result;
594 GetDeterminant(ref source, out result);
595 return result;
596 }
597 public static void GetDeterminant(ref Matrix2x3 source, out Scalar result)
598 {
599 result =
600 source.m00 * (source.m11) -
601 source.m01 * (source.m10);
602 }
603
604 /* public static Matrix2x3 Transpose(Matrix2x3 source)
605 {
606 Matrix2x3 result;
607 Transpose(ref source, out result);
608 return result;
609 }
610 public static void Transpose(ref Matrix2x3 source, out Matrix2x3 result)
611 {
612 Scalar m01 = source.m01;
613 Scalar m02 = source.m02;
614 Scalar m12 = source.m12;
615
616 result.m00 = source.m00;
617 result.m01 = source.m10;
618 result.m02 = source.m20;
619
620 result.m10 = m01;
621 result.m11 = source.m11;
622 result.m12 = source.m21;
623
624 result.m20 = m02;
625 result.m21 = m12;
626 result.m22 = source.m22;
627
628
629
630 }*/
631
632 public static Matrix2x3 GetAdjoint(Matrix2x3 source)
633 {
634 Matrix2x3 result;
635 GetAdjoint(ref source, out result);
636 return result;
637 }
638 public static void GetAdjoint(ref Matrix2x3 source, out Matrix2x3 result)
639 {
640 Scalar m01 = source.m01;
641 Scalar m02 = source.m02;
642 Scalar m11 = source.m11;
643 Scalar m12 = source.m12;
644
645
646 result.m01 = (-(m01 * 1 - m02 * 0));
647 result.m02 = (m01 * m12 - m02 * m11);
648
649 result.m11 = (source.m00);
650 result.m12 = (-(source.m00 * m12 - m02 * source.m10));
651
652 result.m00 = (m11);
653 result.m10 = (-(source.m10));
654 }
655
656 public static Matrix2x3 GetCofactor(Matrix2x3 source)
657 {
658 Matrix2x3 result;
659 GetCofactor(ref source, out result);
660 return result;
661 }
662 public static void GetCofactor(ref Matrix2x3 source, out Matrix2x3 result)
663 {
664 Scalar m01 = source.m01;
665 Scalar m02 = source.m02;
666 Scalar m11 = source.m11;
667 Scalar m12 = source.m12;
668
669 result.m01 = m01;
670 result.m02 = -(m01 * m12 - m02 * m11);
671
672 result.m11 = -source.m00;
673 result.m12 = source.m00 * m12 - m02 * source.m10;
674
675 result.m00 = -m11;
676 result.m10 = source.m10;
677
678 }
679
680
681 public static Matrix2x3 FromTransformation(Scalar rotation, Vector2D translation)
682 {
683 Matrix2x3 result;
684 FromTransformation(ref rotation, ref translation, out result);
685 return result;
686 }
687 public static void FromTransformation(ref Scalar rotation, ref Vector2D translation, out Matrix2x3 result)
688 {
689 result.m00 = MathHelper.Cos(rotation);
690 result.m10 = MathHelper.Sin(rotation);
691 result.m01 = -result.m10;
692 result.m11 = result.m00;
693 result.m02 = translation.X;
694 result.m12 = translation.Y;
695 }
696
697
698 public static Matrix2x3 FromArray(Scalar[] array)
699 {
700 Matrix2x3 result;
701 Copy(array, 0, out result);
702 return result;
703 }
704 /* public static Matrix2x3 FromTransposedArray(Scalar[] array)
705 {
706 Matrix2x3 result;
707 CopyTranspose(array, 0, out result);
708 return result;
709 }*/
710
711 public static Matrix2x3 FromRotationZ(Scalar radianAngle)
712 {
713 Matrix2x3 result;
714
715 result.m10 = MathHelper.Sin(radianAngle);
716
717
718 result.m00 = MathHelper.Cos(radianAngle);
719 result.m01 = -result.m10;
720 result.m02 = 0;
721
722 result.m11 = result.m00;
723 result.m12 = 0;
724
725 return result;
726 }
727 public static void FromRotationZ(ref Scalar radianAngle, out Matrix2x3 result)
728 {
729
730 result.m10 = MathHelper.Sin(radianAngle);
731
732 result.m00 = MathHelper.Cos(radianAngle);
733 result.m01 = -result.m10;
734 result.m02 = 0;
735
736 result.m11 = result.m00;
737 result.m12 = 0;
738
739
740 }
741
742
743
744 public static Matrix2x3 FromScale(Vector2D scale)
745 {
746 Matrix2x3 result;
747
748 result.m00 = scale.X;
749 result.m01 = 0;
750 result.m02 = 0;
751
752 result.m10 = 0;
753 result.m11 = scale.Y;
754 result.m12 = 0;
755
756 return result;
757 }
758 public static void FromScale(ref Vector2D scale, out Matrix2x3 result)
759 {
760 result.m00 = scale.X;
761 result.m01 = 0;
762 result.m02 = 0;
763
764 result.m10 = 0;
765 result.m11 = scale.Y;
766 result.m12 = 0;
767
768 }
769
770 public static Matrix2x3 FromTranslate2D(Vector2D value)
771 {
772 Matrix2x3 result;
773
774 result.m00 = 1;
775 result.m01 = 0;
776 result.m02 = value.X;
777
778 result.m10 = 0;
779 result.m11 = 1;
780 result.m12 = value.Y;
781
782
783 return result;
784 }
785 public static void FromTranslate2D(ref Vector2D value, out Matrix2x3 result)
786 {
787 result.m00 = 1;
788 result.m01 = 0;
789 result.m02 = value.X;
790
791 result.m10 = 0;
792 result.m11 = 1;
793 result.m12 = value.Y;
794 }
795
798 Scalar m20, Scalar m21, Scalar m22)
799 {
800 Scalar cofactor00 = m11 * m22 - m12 * m21;
801 Scalar cofactor10 = m12 * m20 - m10 * m22;
802 Scalar cofactor20 = m10 * m21 - m11 * m20;
803 Scalar result =
804 m00 * cofactor00 +
805 m01 * cofactor10 +
806 m02 * cofactor20;
807 return result;
808 }
810 {
811 Scalar cofactor00 = Ry.Y * Rz.Z - Ry.Z * Rz.Y;
812 Scalar cofactor10 = Ry.Z * Rz.X - Ry.X * Rz.Z;
813 Scalar cofactor20 = Ry.X * Rz.Y - Ry.Y * Rz.X;
814 Scalar result =
815 Rx.X * cofactor00 +
816 Rx.Y * cofactor10 +
817 Rx.Z * cofactor20;
818 return result;
819 }
820
821
822 [ParseMethod]
823 public static Matrix2x3 Parse(string s)
824 {
825 Matrix2x3 rv = Zero;
826 ParseHelper.ParseMatrix<Matrix2x3>(s, ref rv);
827 return rv;
828 }
829#if !CompactFramework && !WindowsCE && !PocketPC && !XBOX360 && !SILVERLIGHT
830 public static bool TryParse(string s, out Matrix2x3 result)
831 {
832 result = Zero;
833 return ParseHelper.TryParseMatrix<Matrix2x3>(s, ref result);
834 }
835#endif
836
837
838 public static bool Equals(Matrix2x3 left, Matrix2x3 right)
839 {
840 return
841 left.m00 == right.m00 && left.m01 == right.m01 && left.m02 == right.m02 &&
842 left.m10 == right.m10 && left.m11 == right.m11 && left.m12 == right.m12;
843 }
844 public static bool Equals(ref Matrix2x3 left, ref Matrix2x3 right)
845 {
846 return
847 left.m00 == right.m00 && left.m01 == right.m01 && left.m02 == right.m02 &&
848 left.m10 == right.m10 && left.m11 == right.m11 && left.m12 == right.m12;
849 }
850
851 #endregion
852 #region fields
853
854 // | m00 m01 m02 |
855 // | m10 m11 m12 |
856 [XmlIgnore]
857 public Scalar m00, m01, m02;
858 [XmlIgnore]
859 public Scalar m10, m11, m12;
860
861 #endregion
862 #region Constructors
863
869 {
870 this.m00 = m00; this.m01 = m01; this.m02 = m02;
871 this.m10 = m10; this.m11 = m11; this.m12 = m12;
872 }
873
879 [InstanceConstructor("Rx,Ry")]
880 public Matrix2x3(Vector3D xAxis, Vector3D yAxis)
881 {
882 this.m00 = xAxis.X; this.m01 = xAxis.Y; this.m02 = xAxis.Z;
883 this.m10 = yAxis.X; this.m11 = yAxis.Y; this.m12 = yAxis.Z;
884 }
885 public Matrix2x3(Scalar[] values) : this(values, 0) { }
886 public Matrix2x3(Scalar[] values, int index)
887 {
888 Copy(values, index, out this);
889 }
890 #endregion
891 #region Properties
892 [AdvBrowsable]
893#if !WINDOWS_STOREAPP
894 [System.ComponentModel.Description("The First row of the Matrix2x3")]
895#endif
897 {
898 get
899 {
900 Vector3D value;
901 value.X = m00;
902 value.Y = m01;
903 value.Z = m02;
904 return value;
905 }
906 set
907 {
908 m00 = value.X;
909 m01 = value.Y;
910 m02 = value.Z;
911 }
912 }
913 [AdvBrowsable]
914#if !WINDOWS_STOREAPP
915 [System.ComponentModel.Description("The Second row of the Matrix2x3")]
916#endif
918 {
919 get
920 {
921 Vector3D value;
922 value.X = m10;
923 value.Y = m11;
924 value.Z = m12;
925 return value;
926 }
927 set
928 {
929 m10 = value.X;
930 m11 = value.Y;
931 m12 = value.Z;
932 }
933 }
934 [XmlIgnore]
936 {
937 get
938 {
939 return new Vector2D(m00, m10);
940 }
941 set
942 {
943 this.m00 = value.X;
944 this.m10 = value.Y;
945 }
946 }
947 [XmlIgnore]
949 {
950 get
951 {
952 return new Vector2D(m01, m11);
953 }
954 set
955 {
956 this.m01 = value.X;
957 this.m11 = value.Y;
958 }
959 }
960 [XmlIgnore]
962 {
963 get
964 {
965 return new Vector2D(m02, m12);
966 }
967 set
968 {
969 this.m02 = value.X;
970 this.m12 = value.Y;
971 }
972 }
973
975 {
976 get
977 {
978 Scalar result;
979 GetDeterminant(ref this, out result);
980 return result;
981 }
982 }
988 {
989 get
990 {
991 throw new NotSupportedException();
992 /* Matrix2x3 result;
993 Transpose(ref this, out result);
994 return result;*/
995 }
996 }
998 {
999 get
1000 {
1001 Matrix2x3 result;
1002 GetAdjoint(ref this, out result);
1003 return result;
1004 }
1005 }
1007 {
1008 get
1009 {
1010 Matrix2x3 result;
1011 GetCofactor(ref this, out result);
1012 return result;
1013 }
1014 }
1016 {
1017 get
1018 {
1019 Matrix2x3 result;
1020 Invert(ref this, out result);
1021 return result;
1022 }
1023 }
1024
1025 int IAdvanceValueType.Count { get { return Count; } }
1026 int IMatrix.RowCount { get { return RowCount; } }
1027 int IMatrix.ColumnCount { get { return ColumnCount; } }
1028 #endregion Properties
1029 #region Methods
1030
1031 public Vector2D GetColumn(int columnIndex)
1032 {
1033 switch (columnIndex)
1034 {
1035 case 0:
1036 return Cx;
1037 case 1:
1038 return Cy;
1039 case 2:
1040 return Cz;
1041 }
1042 throw ThrowHelper.GetThrowIndex("columnIndex", ColumnCount);
1043 }
1044 public void SetColumn(int columnIndex, Vector2D value)
1045 {
1046 switch (columnIndex)
1047 {
1048 case 0:
1049 Cx = value;
1050 return;
1051 case 1:
1052 Cy = value;
1053 return;
1054 case 2:
1055 Cz = value;
1056 return;
1057 }
1058 throw ThrowHelper.GetThrowIndex("columnIndex", ColumnCount);
1059 }
1060 public Vector3D GetRow(int rowIndex)
1061 {
1062 switch (rowIndex)
1063 {
1064 case 0:
1065 return Rx;
1066 case 1:
1067 return Ry;
1068 }
1069 throw ThrowHelper.GetThrowIndex("rowIndex", RowCount);
1070 }
1071 public void SetRow(int rowIndex, Vector3D value)
1072 {
1073 switch (rowIndex)
1074 {
1075 case 0:
1076 Rx = value;
1077 return;
1078 case 1:
1079 Ry = value;
1080 return;
1081 }
1082 throw ThrowHelper.GetThrowIndex("rowIndex", RowCount);
1083 }
1084
1086 {
1087 return new Scalar[RowCount, ColumnCount]{ { m00, m01, m02 }, { m10, m11, m12 } };
1088 }
1089 public Scalar[] ToArray()
1090 {
1091 return new Scalar[Count] { m00, m01, m02, m10, m11, m12 };
1092 }
1094 {
1095 throw new NotSupportedException();
1096 // return new Scalar[Count] { m00, m10, m20, m01, m11, m21, m02, m12, m22 };
1097 }
1098
1100 {
1101 Matrix4x4 result = Matrix4x4.Identity;
1102 result.m00 = this.m00; result.m01 = this.m01; result.m03 = this.m02;
1103 result.m10 = this.m10; result.m11 = this.m11; result.m13 = this.m12;
1104 return result;
1105 }
1107 {
1108 Matrix4x4 result = Matrix4x4.Identity;
1109 result.m00 = this.m00; result.m01 = this.m01; result.m02 = this.m02;
1110 result.m10 = this.m10; result.m11 = this.m11; result.m12 = this.m12;
1111 return result;
1112 }
1113
1114 public void CopyTo(Scalar[] array, int index)
1115 {
1116 Copy(ref this, array, index);
1117 }
1118 public void CopyTransposedTo(Scalar[] array, int index)
1119 {
1120 throw new NotSupportedException();
1121 // CopyTranspose(ref this, array, index);
1122 }
1123 public void CopyFrom(Scalar[] array, int index)
1124 {
1125 Copy(array, index, out this);
1126 }
1127 public void CopyTransposedFrom(Scalar[] array, int index)
1128 {
1129 throw new NotSupportedException();
1130 // CopyTranspose(array, index, out this);
1131 }
1132
1133
1134
1135 private string ToStringInternal(string FormatString)
1136 {
1137 return string.Format(FormatString,
1138 m00, m01, m02,
1139 m10, m11, m12);
1140 }
1141 public string ToString(string format)
1142 {
1143 return ToStringInternal(string.Format(FormatableString, format));
1144 }
1145 public override string ToString()
1146 {
1148 }
1149
1150 public override int GetHashCode()
1151 {
1152 return
1153 m00.GetHashCode() ^ m01.GetHashCode() ^ m02.GetHashCode() ^
1154 m10.GetHashCode() ^ m11.GetHashCode() ^ m12.GetHashCode();
1155 }
1156
1157 public override bool Equals(object obj)
1158 {
1159 return
1160 (obj is Matrix2x3) &&
1161 Equals((Matrix2x3)obj);
1162 }
1163 public bool Equals(Matrix2x3 other)
1164 {
1165 return Equals(ref this, ref other);
1166 }
1167
1168 #endregion
1169 #region Indexors
1170#if UNSAFE
1178 public Scalar this[int rowIndex, int columnIndex]
1179 {
1180 get
1181 {
1182 ThrowHelper.CheckIndex("rowIndex", rowIndex, RowCount);
1183 ThrowHelper.CheckIndex("columnIndex", columnIndex, ColumnCount);
1184 unsafe
1185 {
1186 fixed (Scalar* pM = &m00)
1187 {
1188 return pM[(ColumnCount * rowIndex) + columnIndex];
1189 }
1190 }
1191 }
1192 set
1193 {
1194 ThrowHelper.CheckIndex("rowIndex", rowIndex, RowCount);
1195 ThrowHelper.CheckIndex("columnIndex", columnIndex, ColumnCount);
1196 unsafe
1197 {
1198 fixed (Scalar* pM = &m00)
1199 {
1200 pM[(ColumnCount * rowIndex) + columnIndex] = value;
1201 }
1202 }
1203 }
1204 }
1212 public Scalar this[int index]
1213 {
1214 get
1215 {
1216 ThrowHelper.CheckIndex("index", index, Count);
1217 unsafe
1218 {
1219 fixed (Scalar* pMatrix = &this.m00)
1220 {
1221 return pMatrix[index];
1222 }
1223 }
1224 }
1225 set
1226 {
1227 ThrowHelper.CheckIndex("index", index, Count);
1228 unsafe
1229 {
1230 fixed (Scalar* pMatrix = &this.m00)
1231 {
1232 pMatrix[index] = value;
1233 }
1234 }
1235 }
1236 }
1237#endif
1238 #endregion
1239 #region Operator overloads
1246 public static Matrix2x3 operator *(Matrix2x3 left, Matrix2x3 right)
1247 {
1248
1249 Matrix2x3 result;
1250
1251 result.m00 = left.m00 * right.m00 + left.m01 * right.m10;
1252 result.m01 = left.m00 * right.m01 + left.m01 * right.m11;
1253 result.m02 = left.m00 * right.m02 + left.m01 * right.m12 + left.m02 ;
1254
1255 result.m10 = left.m10 * right.m00 + left.m11 * right.m10;
1256 result.m11 = left.m10 * right.m01 + left.m11 * right.m11;
1257 result.m12 = left.m10 * right.m02 + left.m11 * right.m12 + left.m12 ;
1258
1259 return result;
1260 }
1267 public static Matrix2x3 operator *(Matrix2x2 left, Matrix2x3 right)
1268 {
1269
1270 Matrix2x3 result;
1271
1272 result.m00 = left.m00 * right.m00 + left.m01 * right.m10;
1273 result.m01 = left.m00 * right.m01 + left.m01 * right.m11;
1274 result.m02 = left.m00 * right.m02 + left.m01 * right.m12;
1275
1276 result.m10 = left.m10 * right.m00 + left.m11 * right.m10;
1277 result.m11 = left.m10 * right.m01 + left.m11 * right.m11;
1278 result.m12 = left.m10 * right.m02 + left.m11 * right.m12;
1279
1280 return result;
1281 }
1288 public static Matrix2x3 operator *(Matrix2x3 left, Matrix2x2 right)
1289 {
1290
1291 Matrix2x3 result;
1292
1293 result.m00 = left.m00 * right.m00 + left.m01 * right.m10;
1294 result.m01 = left.m00 * right.m01 + left.m01 * right.m11;
1295 result.m02 = left.m02;
1296
1297 result.m10 = left.m10 * right.m00 + left.m11 * right.m10;
1298 result.m11 = left.m10 * right.m01 + left.m11 * right.m11;
1299 result.m12 = left.m12;
1300
1301 return result;
1302 }
1303
1310 public static Matrix2x3 operator *(Matrix2x3 matrix, Scalar scalar)
1311 {
1312 Matrix2x3 result;
1313
1314 result.m00 = matrix.m00 * scalar;
1315 result.m01 = matrix.m01 * scalar;
1316 result.m02 = matrix.m02 * scalar;
1317 result.m10 = matrix.m10 * scalar;
1318 result.m11 = matrix.m11 * scalar;
1319 result.m12 = matrix.m12 * scalar;
1320
1321 return result;
1322 }
1329 public static Matrix2x3 operator *(Scalar scalar, Matrix2x3 matrix)
1330 {
1331 Matrix2x3 result;
1332
1333 result.m00 = matrix.m00 * scalar;
1334 result.m01 = matrix.m01 * scalar;
1335 result.m02 = matrix.m02 * scalar;
1336 result.m10 = matrix.m10 * scalar;
1337 result.m11 = matrix.m11 * scalar;
1338 result.m12 = matrix.m12 * scalar;
1339
1340 return result;
1341 }
1348 public static Matrix2x3 operator +(Matrix2x3 left, Matrix2x3 right)
1349 {
1350 Matrix2x3 result;
1351
1352 result.m00 = left.m00 + right.m00;
1353 result.m01 = left.m01 + right.m01;
1354 result.m02 = left.m02 + right.m02;
1355
1356 result.m10 = left.m10 + right.m10;
1357 result.m11 = left.m11 + right.m11;
1358 result.m12 = left.m12 + right.m12;
1359
1360
1361 return result;
1362 }
1363 public static Matrix2x3 operator +(Matrix2x2 left, Matrix2x3 right)
1364 {
1365 Matrix2x3 result;
1366 Add(ref left, ref right, out result);
1367 return result;
1368 }
1369 public static Matrix2x3 operator +(Matrix2x3 left, Matrix2x2 right)
1370 {
1371 Matrix2x3 result;
1372 Add(ref left, ref right, out result);
1373 return result;
1374 }
1381 public static Matrix2x3 operator -(Matrix2x3 left, Matrix2x3 right)
1382 {
1383 Matrix2x3 result;
1384
1385 result.m00 = left.m00 - right.m00;
1386 result.m01 = left.m01 - right.m01;
1387 result.m02 = left.m02 - right.m02;
1388
1389 result.m10 = left.m10 - right.m10;
1390 result.m11 = left.m11 - right.m11;
1391 result.m12 = left.m12 - right.m12;
1392
1393
1394 return result;
1395 }
1396 public static Matrix2x3 operator -(Matrix2x2 left, Matrix2x3 right)
1397 {
1398 Matrix2x3 result;
1399 Subtract(ref left, ref right, out result);
1400 return result;
1401 }
1402 public static Matrix2x3 operator -(Matrix2x3 left, Matrix2x2 right)
1403 {
1404 Matrix2x3 result;
1405 Subtract(ref left, ref right, out result);
1406 return result;
1407 }
1413 public static Matrix2x3 operator -(Matrix2x3 matrix)
1414 {
1415 Matrix2x3 result;
1416
1417 result.m00 = -matrix.m00;
1418 result.m01 = -matrix.m01;
1419 result.m02 = -matrix.m02;
1420 result.m10 = -matrix.m10;
1421 result.m11 = -matrix.m11;
1422 result.m12 = -matrix.m12;
1423
1424 return result;
1425 }
1432 public static bool operator ==(Matrix2x3 left, Matrix2x3 right)
1433 {
1434 return
1435 left.m00 == right.m00 && left.m01 == right.m01 && left.m02 == right.m02 &&
1436 left.m10 == right.m10 && left.m11 == right.m11 && left.m12 == right.m12;
1437 }
1438 public static bool operator !=(Matrix2x3 left, Matrix2x3 right)
1439 {
1440 return !(left == right);
1441 }
1442
1443
1444 public static explicit operator Matrix2x3(Matrix4x4 source)
1445 {
1446 Matrix2x3 result;
1447
1448 result.m00 = source.m00;
1449 result.m01 = source.m01;
1450 result.m02 = source.m02;
1451
1452 result.m10 = source.m10;
1453 result.m11 = source.m11;
1454 result.m12 = source.m12;
1455
1456
1457 return result;
1458 }
1459 public static explicit operator Matrix2x3(Matrix2x2 source)
1460 {
1461 Matrix2x3 result;
1462
1463 result.m00 = source.m00;
1464 result.m01 = source.m01;
1465 result.m02 = 0;
1466
1467 result.m10 = source.m10;
1468 result.m11 = source.m11;
1469 result.m12 = 0;
1470
1471
1472
1473
1474
1475
1476 return result;
1477 }
1478
1479 #endregion
1480
1481
1482 }
1483}
System.Single Scalar
Definition: Clamped.cs:29
System.Single Scalar
Definition: Matrix2x3.cs:27
static Scalar Cos(Scalar d)
Definition: MathHelper.cs:302
static Scalar Sin(Scalar a)
Definition: MathHelper.cs:312
static string CreateMatrixFormatableString(int RowCount, int ColumnCount)
Definition: MatrixHelper.cs:43
static string CreateMatrixFormatString(int RowCount, int ColumnCount)
Definition: MatrixHelper.cs:39
static Exception GetThrowIndex(string name, int count)
Definition: ThrowHelper.cs:50
static void CheckCopy(Scalar[] array, int index, int count)
Definition: ThrowHelper.cs:35
int Count
Gets a 32-bit integer that represents the total number of elements in all the dimensions of IAdvanceV...
Definition: Interfaces.cs:41
int RowCount
Gets a 32-bit integer that represents the total number of Rows in the IMatrix.
Definition: Interfaces.cs:98
int ColumnCount
Gets a 32-bit integer that represents the total number of Columns in the IMatrix.
Definition: Interfaces.cs:102
A 2x2 matrix which can represent rotations for 2D vectors.
Definition: Matrix2x2.cs:58
A 2x3 matrix which can represent rotations around axes.
Definition: Matrix2x3.cs:62
static Scalar GetDeterminant(Matrix2x3 source)
Definition: Matrix2x3.cs:591
static Matrix2x3 operator*(Matrix2x3 left, Matrix2x3 right)
Multiply (concatenate) two Matrix3 instances together.
Definition: Matrix2x3.cs:1246
static readonly Matrix2x3 Identity
Definition: Matrix2x3.cs:85
const int Count
The number of Scalar values in the class.
Definition: Matrix2x3.cs:75
Matrix2x3(Scalar[] values)
Definition: Matrix2x3.cs:885
static void Multiply(ref Matrix2x3 left, ref Matrix2x2 right, out Matrix2x3 result)
Definition: Matrix2x3.cs:293
static Matrix2x3 GetCofactor(Matrix2x3 source)
Definition: Matrix2x3.cs:656
void CopyTransposedFrom(Scalar[] array, int index)
Definition: Matrix2x3.cs:1127
override bool Equals(object obj)
Definition: Matrix2x3.cs:1157
static Matrix2x3 FromScale(Vector2D scale)
Definition: Matrix2x3.cs:744
static void GetAdjoint(ref Matrix2x3 source, out Matrix2x3 result)
Definition: Matrix2x3.cs:638
static Matrix2x3 Add(Matrix2x3 left, Matrix2x2 right)
Definition: Matrix2x3.cs:407
static void FromRotationZ(ref Scalar radianAngle, out Matrix2x3 result)
Definition: Matrix2x3.cs:727
Matrix2x3(Scalar m00, Scalar m01, Scalar m02, Scalar m10, Scalar m11, Scalar m12)
Creates a new Matrix3 with all the specified parameters.
Definition: Matrix2x3.cs:867
static Matrix2x3 FromRotationZ(Scalar radianAngle)
Definition: Matrix2x3.cs:711
static void Multiply(ref Matrix2x3 left, ref Matrix2x3 right, out Matrix2x3 result)
Definition: Matrix2x3.cs:220
static Matrix2x3 Invert(Matrix2x3 source)
Definition: Matrix2x3.cs:555
void SetColumn(int columnIndex, Vector2D value)
Definition: Matrix2x3.cs:1044
static void Invert(ref Matrix2x3 source, out Matrix2x3 result)
Definition: Matrix2x3.cs:561
static void FromTranslate2D(ref Vector2D value, out Matrix2x3 result)
Definition: Matrix2x3.cs:785
static void Multiply(ref Matrix2x2 left, ref Matrix2x3 right, out Matrix2x3 result)
Definition: Matrix2x3.cs:333
Scalar[] ToTransposedArray()
Definition: Matrix2x3.cs:1093
override string ToString()
Definition: Matrix2x3.cs:1145
static void Copy(ref Matrix2x3 matrix, Scalar[] destArray, int index)
Definition: Matrix2x3.cs:98
Matrix4x4 ToMatrix4x4()
Definition: Matrix2x3.cs:1106
static bool TryParse(string s, out Matrix2x3 result)
Definition: Matrix2x3.cs:830
static Matrix2x3 Transpose(Matrix2x3 source)
Definition: Matrix2x3.cs:425
static void Subtract(ref Matrix2x3 left, ref Matrix2x2 right, out Matrix2x3 result)
Definition: Matrix2x3.cs:507
static void Add(ref Matrix2x3 left, ref Matrix2x3 right, out Matrix2x3 result)
Definition: Matrix2x3.cs:377
static void Copy2DToOpenGlMatrix(ref Matrix2x3 source, Scalar[] destArray)
Definition: Matrix2x3.cs:152
static readonly string FormatableString
Definition: Matrix2x3.cs:83
override int GetHashCode()
Definition: Matrix2x3.cs:1150
static Matrix2x3 Multiply(Matrix2x2 left, Matrix2x3 right)
Used to multiply (concatenate) a Matrix2x3 and a Matrix2x2.
Definition: Matrix2x3.cs:318
static Matrix2x3 GetAdjoint(Matrix2x3 source)
Definition: Matrix2x3.cs:632
void CopyTo(Scalar[] array, int index)
Copies all the elements of the IAdvanceValueType to the specified one-dimensional Array of Scalar.
Definition: Matrix2x3.cs:1114
void SetRow(int rowIndex, Vector3D value)
Definition: Matrix2x3.cs:1071
static bool operator==(Matrix2x3 left, Matrix2x3 right)
Test two matrices for (value) equality
Definition: Matrix2x3.cs:1432
static void FromScale(ref Vector2D scale, out Matrix2x3 result)
Definition: Matrix2x3.cs:758
static void Add(ref Matrix2x2 left, ref Matrix2x3 right, out Matrix2x3 result)
Definition: Matrix2x3.cs:396
static Matrix2x3 Parse(string s)
Definition: Matrix2x3.cs:823
static void Copy2DFromOpenGlMatrix(Scalar[] destArray, out Matrix2x3 result)
Definition: Matrix2x3.cs:168
static void GetCofactor(ref Matrix2x3 source, out Matrix2x3 result)
Definition: Matrix2x3.cs:662
static bool Equals(Matrix2x3 left, Matrix2x3 right)
Definition: Matrix2x3.cs:838
Matrix2x3(Vector3D xAxis, Vector3D yAxis)
Create a new Matrix from 2 Vertex3 objects.
Definition: Matrix2x3.cs:880
static Matrix2x3 Multiply(Matrix2x3 left, Matrix2x2 right)
Used to multiply (concatenate) a Matrix2x3 and a Matrix2x2.
Definition: Matrix2x3.cs:279
bool Equals(Matrix2x3 other)
Definition: Matrix2x3.cs:1163
static void Copy(ref Matrix2x2 source, ref Matrix2x3 dest)
Definition: Matrix2x3.cs:141
int IMatrix. ColumnCount
Definition: Matrix2x3.cs:1027
static void Negate(ref Matrix2x3 source)
Definition: Matrix2x3.cs:539
static Matrix2x3 FromTranslate2D(Vector2D value)
Definition: Matrix2x3.cs:770
Vector2D GetColumn(int columnIndex)
Definition: Matrix2x3.cs:1031
static void Add(ref Matrix2x3 left, ref Matrix2x2 right, out Matrix2x3 result)
Definition: Matrix2x3.cs:413
int IMatrix. RowCount
Definition: Matrix2x3.cs:1026
static Matrix2x3 Subtract(Matrix2x3 left, Matrix2x3 right)
Used to subtract two matrices.
Definition: Matrix2x3.cs:456
const int ColumnCount
The number of columns.
Definition: Matrix2x3.cs:71
string ToString(string format)
turns the object into a string representation of itself with a special format for each Scaler in it.
Definition: Matrix2x3.cs:1141
static readonly Matrix2x3 Zero
Definition: Matrix2x3.cs:88
static Scalar GetDeterminant(Vector3D Rx, Vector3D Ry, Vector3D Rz)
Definition: Matrix2x3.cs:809
void CopyTransposedTo(Scalar[] array, int index)
Definition: Matrix2x3.cs:1118
static void Copy(ref Matrix4x4 source, out Matrix2x3 dest)
Definition: Matrix2x3.cs:130
static Matrix2x3 FromTransformation(Scalar rotation, Vector2D translation)
Definition: Matrix2x3.cs:681
static Matrix2x3 FromArray(Scalar[] array)
Definition: Matrix2x3.cs:698
static void GetDeterminant(ref Matrix2x3 source, out Scalar result)
Definition: Matrix2x3.cs:597
static void Negate(ref Matrix2x3 source, out Matrix2x3 result)
Definition: Matrix2x3.cs:543
Matrix4x4 ToMatrix4x4From2D()
Definition: Matrix2x3.cs:1099
static bool operator!=(Matrix2x3 left, Matrix2x3 right)
Definition: Matrix2x3.cs:1438
static void Subtract(ref Matrix2x2 left, ref Matrix2x3 right, out Matrix2x3 result)
Definition: Matrix2x3.cs:490
static void Subtract(ref Matrix2x3 left, ref Matrix2x3 right, out Matrix2x3 result)
Definition: Matrix2x3.cs:471
static bool Equals(ref Matrix2x3 left, ref Matrix2x3 right)
Definition: Matrix2x3.cs:844
static readonly string FormatString
Definition: Matrix2x3.cs:82
static Matrix2x3 Multiply(Matrix2x3 left, Scalar scalar)
Used to multiply a Matrix2x3 object by a scalar value..
Definition: Matrix2x3.cs:245
static void Copy(Scalar[] sourceArray, int index, out Matrix2x3 result)
Definition: Matrix2x3.cs:115
Vector3D GetRow(int rowIndex)
Definition: Matrix2x3.cs:1060
static void FromTransformation(ref Scalar rotation, ref Vector2D translation, out Matrix2x3 result)
Definition: Matrix2x3.cs:687
static Matrix2x3 operator-(Matrix2x3 left, Matrix2x3 right)
Used to subtract two matrices.
Definition: Matrix2x3.cs:1381
static void Transpose(ref Matrix2x3 source, out Matrix2x3 result)
Definition: Matrix2x3.cs:431
Matrix2x3 Transposed
Swap the rows of the matrix with the columns.
Definition: Matrix2x3.cs:988
static void Copy(Scalar[] sourceArray, out Matrix2x3 result)
Definition: Matrix2x3.cs:111
static Scalar GetDeterminant(Scalar m00, Scalar m01, Scalar m02, Scalar m10, Scalar m11, Scalar m12, Scalar m20, Scalar m21, Scalar m22)
Definition: Matrix2x3.cs:796
static Matrix2x3 Subtract(Matrix2x3 left, Matrix2x2 right)
Definition: Matrix2x3.cs:501
Matrix2x3(Scalar[] values, int index)
Definition: Matrix2x3.cs:886
const int RowCount
The number of rows.
Definition: Matrix2x3.cs:67
Scalar[,] ToMatrixArray()
Definition: Matrix2x3.cs:1085
static Matrix2x3 Negate(Matrix2x3 source)
Negates a Matrix2x3.
Definition: Matrix2x3.cs:523
static void Copy(ref Matrix2x3 matrix, Scalar[] destArray)
Definition: Matrix2x3.cs:94
void CopyFrom(Scalar[] array, int index)
Copies all the elements of the IAdvanceValueType, of the specified one-dimensional Array to the IAdva...
Definition: Matrix2x3.cs:1123
string ToStringInternal(string FormatString)
Definition: Matrix2x3.cs:1135
static Matrix2x3 Subtract(Matrix2x2 left, Matrix2x3 right)
Definition: Matrix2x3.cs:484
int IAdvanceValueType. Count
Definition: Matrix2x3.cs:1025
static Matrix2x3 operator+(Matrix2x3 left, Matrix2x3 right)
Used to add two matrices together.
Definition: Matrix2x3.cs:1348
static Matrix2x3 Lerp(Matrix2x3 left, Matrix2x3 right, Scalar amount)
Definition: Matrix2x3.cs:180
static Matrix2x3 Add(Matrix2x2 left, Matrix2x3 right)
Definition: Matrix2x3.cs:390
Scalar[] ToArray()
Copies the elements of the IAdvanceValueType to a new array of Scalar .
Definition: Matrix2x3.cs:1089
static Matrix2x3 Add(Matrix2x3 left, Matrix2x3 right)
Used to add two matrices together.
Definition: Matrix2x3.cs:362
const int Size
The Size of the class in bytes;
Definition: Matrix2x3.cs:79
static void Multiply(ref Matrix2x3 left, ref Scalar scalar, out Matrix2x3 result)
Definition: Matrix2x3.cs:260
static Matrix2x3 Multiply(Matrix2x3 left, Matrix2x3 right)
Used to multiply (concatenate) two Matrix4x4s.
Definition: Matrix2x3.cs:205
static void Lerp(ref Matrix2x3 left, ref Matrix2x3 right, ref Scalar amount, out Matrix2x3 result)
Definition: Matrix2x3.cs:186
static readonly Matrix4x4 Identity
Definition: Matrix4x4.cs:72
This is the Vector Class.
Definition: Vector2D.cs:50
Scalar X
This is the X value. (Usually represents a horizontal position or direction.)
Definition: Vector2D.cs:796
Scalar Y
This is the Y value. (Usually represents a vertical position or direction.)
Definition: Vector2D.cs:805
A Vector with 3 dimensions.
Definition: Vector3D.cs:47
Scalar X
This is the X value.
Definition: Vector3D.cs:692
Scalar Y
This is the Y value.
Definition: Vector3D.cs:701
Scalar Z
This is the Z value.
Definition: Vector3D.cs:710