30using System.Runtime.InteropServices;
32using System.Xml.Serialization;
55 [StructLayout(LayoutKind.Sequential, Size = Matrix2x3.Size)]
56 [AdvBrowsableOrder(
"Rx,Ry")]
57#if !CompactFramework && !WindowsCE && !PocketPC && !XBOX360 && !SILVERLIGHT && !WINDOWS_PHONE && !NETFX_CORE
92 #region static methods
96 Copy(ref matrix, destArray, 0);
102 destArray[index] = matrix.m00;
103 destArray[++index] = matrix.m01;
104 destArray[++index] = matrix.m02;
106 destArray[++index] = matrix.m10;
107 destArray[++index] = matrix.m11;
108 destArray[++index] = matrix.m12;
113 Copy(sourceArray, 0, out result);
119 result.m00 = sourceArray[index];
120 result.m01 = sourceArray[++index];
121 result.m02 = sourceArray[++index];
123 result.m10 = sourceArray[++index];
124 result.m11 = sourceArray[++index];
125 result.m12 = sourceArray[++index];
132 dest.m00 = source.m00;
133 dest.m01 = source.m01;
134 dest.m02 = source.m02;
136 dest.m10 = source.m10;
137 dest.m11 = source.m11;
138 dest.m12 = source.m12;
143 dest.m00 = source.m00;
144 dest.m01 = source.m01;
146 dest.m10 = source.m10;
147 dest.m11 = source.m11;
154 destArray[0] = source.m00;
155 destArray[1] = source.m10;
158 destArray[4] = source.m01;
159 destArray[5] = source.m11;
162 destArray[12] = source.m02;
163 destArray[13] = source.m12;
170 result.m00 = destArray[0];
171 result.m10 = destArray[1];
173 result.m01 = destArray[4];
174 result.m11 = destArray[5];
176 result.m02 = destArray[12];
177 result.m12 = destArray[13];
183 Lerp(ref left, ref right, ref amount, out result);
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;
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;
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;
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;
249 result.
m00 = left.
m00 * scalar;
250 result.
m01 = left.
m01 * scalar;
251 result.
m02 = left.
m02 * scalar;
253 result.
m10 = left.
m10 * scalar;
254 result.
m11 = left.
m11 * scalar;
255 result.
m12 = left.
m12 * scalar;
263 result.m00 = left.m00 * scalar;
264 result.m01 = left.m01 * scalar;
265 result.m02 = left.m02 * scalar;
267 result.m10 = left.m10 * scalar;
268 result.m11 = left.m11 * scalar;
269 result.m12 = left.m12 * scalar;
295 Scalar m00 = left.m00 * right.m00 + left.m01 * right.m10;
296 Scalar m01 = left.m00 * right.m01 + left.m01 * right.m11;
298 Scalar m10 = left.m10 * right.m00 + left.m11 * right.m10;
299 Scalar m11 = left.m10 * right.m01 + left.m11 * right.m11;
304 result.m02 = left.m02;
308 result.m12 = left.m12;
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;
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;
379 result.m00 = left.m00 + right.m00;
380 result.m01 = left.m01 + right.m01;
381 result.m02 = left.m02 + right.m02;
383 result.m10 = left.m10 + right.m10;
384 result.m11 = left.m11 + right.m11;
385 result.m12 = left.m12 + right.m12;
393 Add(ref left, ref right, out result);
398 result.m00 = left.m00 + right.m00;
399 result.m01 = left.m01 + right.m01;
400 result.m02 = right.m02;
402 result.m10 = left.m10 + right.m10;
403 result.m11 = left.m11 + right.m11;
404 result.m12 = right.m12;
410 Add(ref left, ref right, out result);
415 result.m00 = left.m00 + right.m00;
416 result.m01 = left.m01 + right.m01;
417 result.m02 = left.m02;
419 result.m10 = left.m10 + right.m10;
420 result.m11 = left.m11 + right.m11;
421 result.m12 = left.m12;
437 result.m00 = source.m00;
438 result.m01 = source.m10;
442 result.m11 = source.m11;
473 result.m00 = left.m00 - right.m00;
474 result.m01 = left.m01 - right.m01;
475 result.m02 = left.m02 - right.m02;
477 result.m10 = left.m10 - right.m10;
478 result.m11 = left.m11 - right.m11;
479 result.m12 = left.m12 - right.m12;
487 Subtract(ref left, ref right, out result);
492 result.m00 = left.m00 - right.m00;
493 result.m01 = left.m01 - right.m01;
494 result.m02 = -right.m02;
496 result.m10 = left.m10 - right.m10;
497 result.m11 = left.m11 - right.m11;
498 result.m12 = -right.m12;
504 Subtract(ref left, ref right, out result);
509 result.m00 = left.m00 - right.m00;
510 result.m01 = left.m01 - right.m01;
511 result.m02 = left.m02;
513 result.m10 = left.m10 - right.m10;
514 result.m11 = left.m11 - right.m11;
515 result.m12 = left.m12;
541 Negate(ref source, out source);
545 result.m00 = -source.m00;
546 result.m01 = -source.m01;
547 result.m02 = -source.m02;
549 result.m10 = -source.m10;
550 result.m11 = -source.m11;
551 result.m12 = -source.m12;
558 Invert(ref source, out result);
578 Scalar detInv = 1 / (source.m00 *
m11 -
m01 * source.m10);
581 result.m01 = detInv * (-
m01);
584 result.m11 = detInv * (source.m00);
585 result.m12 = detInv * (-(source.m00 *
m12 -
m02 * source.m10));
587 result.m00 = detInv * (
m11);
588 result.m10 = detInv * (-source.m10);
600 source.m00 * (source.m11) -
601 source.m01 * (source.m10);
646 result.m01 = (-(
m01 * 1 -
m02 * 0));
649 result.m11 = (source.m00);
650 result.m12 = (-(source.m00 *
m12 -
m02 * source.m10));
653 result.m10 = (-(source.m10));
672 result.m11 = -source.m00;
673 result.m12 = source.m00 *
m12 -
m02 * source.m10;
676 result.m10 = source.m10;
691 result.m01 = -result.m10;
692 result.m11 = result.m00;
693 result.m02 = translation.X;
694 result.m12 = translation.Y;
701 Copy(array, 0, out result);
733 result.m01 = -result.m10;
736 result.m11 = result.m00;
748 result.
m00 = scale.
X;
753 result.
m11 = scale.
Y;
760 result.m00 = scale.X;
765 result.m11 = scale.Y;
776 result.
m02 = value.
X;
780 result.
m12 = value.
Y;
789 result.m02 = value.X;
793 result.m12 = value.Y;
829#if !CompactFramework && !WindowsCE && !PocketPC && !XBOX360 && !SILVERLIGHT
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;
870 this.m00 =
m00; this.m01 =
m01; this.m02 =
m02;
871 this.m10 =
m10; this.m11 =
m11; this.m12 =
m12;
879 [InstanceConstructor(
"Rx,Ry")]
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;
888 Copy(values, index, out
this);
894 [
System.ComponentModel.Description(
"The First row of the Matrix2x3")]
915 [
System.ComponentModel.Description(
"The Second row of the Matrix2x3")]
991 throw new NotSupportedException();
1020 Invert(ref
this, out result);
1028 #endregion Properties
1033 switch (columnIndex)
1046 switch (columnIndex)
1095 throw new NotSupportedException();
1116 Copy(ref
this, array, index);
1120 throw new NotSupportedException();
1125 Copy(array, index, out
this);
1129 throw new NotSupportedException();
1153 m00.GetHashCode() ^
m01.GetHashCode() ^
m02.GetHashCode() ^
1154 m10.GetHashCode() ^
m11.GetHashCode() ^
m12.GetHashCode();
1165 return Equals(ref
this, ref other);
1178 public Scalar this[
int rowIndex,
int columnIndex]
1188 return pM[(
ColumnCount * rowIndex) + columnIndex];
1194 ThrowHelper.CheckIndex(
"rowIndex", rowIndex,
RowCount);
1195 ThrowHelper.CheckIndex(
"columnIndex", columnIndex,
ColumnCount);
1200 pM[(
ColumnCount * rowIndex) + columnIndex] = value;
1212 public Scalar this[
int index]
1216 ThrowHelper.CheckIndex(
"index", index,
Count);
1219 fixed (
Scalar* pMatrix = &this.m00)
1221 return pMatrix[index];
1227 ThrowHelper.CheckIndex(
"index", index,
Count);
1230 fixed (
Scalar* pMatrix = &this.m00)
1232 pMatrix[index] = value;
1239 #region Operator overloads
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;
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;
1366 Add(ref left, ref right, out result);
1372 Add(ref left, ref right, out result);
1399 Subtract(ref left, ref right, out result);
1405 Subtract(ref left, ref right, out result);
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;
1440 return !(left == right);
static Scalar Cos(Scalar d)
static Scalar Sin(Scalar a)
static string CreateMatrixFormatableString(int RowCount, int ColumnCount)
static string CreateMatrixFormatString(int RowCount, int ColumnCount)
static Exception GetThrowIndex(string name, int count)
static void CheckCopy(Scalar[] array, int index, int count)
int Count
Gets a 32-bit integer that represents the total number of elements in all the dimensions of IAdvanceV...
int RowCount
Gets a 32-bit integer that represents the total number of Rows in the IMatrix.
int ColumnCount
Gets a 32-bit integer that represents the total number of Columns in the IMatrix.
A 2x2 matrix which can represent rotations for 2D vectors.
A 2x3 matrix which can represent rotations around axes.
static Scalar GetDeterminant(Matrix2x3 source)
static Matrix2x3 operator*(Matrix2x3 left, Matrix2x3 right)
Multiply (concatenate) two Matrix3 instances together.
static readonly Matrix2x3 Identity
const int Count
The number of Scalar values in the class.
Matrix2x3(Scalar[] values)
static void Multiply(ref Matrix2x3 left, ref Matrix2x2 right, out Matrix2x3 result)
static Matrix2x3 GetCofactor(Matrix2x3 source)
void CopyTransposedFrom(Scalar[] array, int index)
override bool Equals(object obj)
static Matrix2x3 FromScale(Vector2D scale)
static void GetAdjoint(ref Matrix2x3 source, out Matrix2x3 result)
static Matrix2x3 Add(Matrix2x3 left, Matrix2x2 right)
static void FromRotationZ(ref Scalar radianAngle, out Matrix2x3 result)
Matrix2x3(Scalar m00, Scalar m01, Scalar m02, Scalar m10, Scalar m11, Scalar m12)
Creates a new Matrix3 with all the specified parameters.
static Matrix2x3 FromRotationZ(Scalar radianAngle)
static void Multiply(ref Matrix2x3 left, ref Matrix2x3 right, out Matrix2x3 result)
static Matrix2x3 Invert(Matrix2x3 source)
void SetColumn(int columnIndex, Vector2D value)
static void Invert(ref Matrix2x3 source, out Matrix2x3 result)
static void FromTranslate2D(ref Vector2D value, out Matrix2x3 result)
static void Multiply(ref Matrix2x2 left, ref Matrix2x3 right, out Matrix2x3 result)
Scalar[] ToTransposedArray()
override string ToString()
static void Copy(ref Matrix2x3 matrix, Scalar[] destArray, int index)
static bool TryParse(string s, out Matrix2x3 result)
static Matrix2x3 Transpose(Matrix2x3 source)
static void Subtract(ref Matrix2x3 left, ref Matrix2x2 right, out Matrix2x3 result)
static void Add(ref Matrix2x3 left, ref Matrix2x3 right, out Matrix2x3 result)
static void Copy2DToOpenGlMatrix(ref Matrix2x3 source, Scalar[] destArray)
static readonly string FormatableString
override int GetHashCode()
static Matrix2x3 Multiply(Matrix2x2 left, Matrix2x3 right)
Used to multiply (concatenate) a Matrix2x3 and a Matrix2x2.
static Matrix2x3 GetAdjoint(Matrix2x3 source)
void CopyTo(Scalar[] array, int index)
Copies all the elements of the IAdvanceValueType to the specified one-dimensional Array of Scalar.
void SetRow(int rowIndex, Vector3D value)
static bool operator==(Matrix2x3 left, Matrix2x3 right)
Test two matrices for (value) equality
static void FromScale(ref Vector2D scale, out Matrix2x3 result)
static void Add(ref Matrix2x2 left, ref Matrix2x3 right, out Matrix2x3 result)
static Matrix2x3 Parse(string s)
static void Copy2DFromOpenGlMatrix(Scalar[] destArray, out Matrix2x3 result)
static void GetCofactor(ref Matrix2x3 source, out Matrix2x3 result)
static bool Equals(Matrix2x3 left, Matrix2x3 right)
Matrix2x3(Vector3D xAxis, Vector3D yAxis)
Create a new Matrix from 2 Vertex3 objects.
static Matrix2x3 Multiply(Matrix2x3 left, Matrix2x2 right)
Used to multiply (concatenate) a Matrix2x3 and a Matrix2x2.
bool Equals(Matrix2x3 other)
static void Copy(ref Matrix2x2 source, ref Matrix2x3 dest)
static void Negate(ref Matrix2x3 source)
static Matrix2x3 FromTranslate2D(Vector2D value)
Vector2D GetColumn(int columnIndex)
static void Add(ref Matrix2x3 left, ref Matrix2x2 right, out Matrix2x3 result)
static Matrix2x3 Subtract(Matrix2x3 left, Matrix2x3 right)
Used to subtract two matrices.
const int ColumnCount
The number of columns.
string ToString(string format)
turns the object into a string representation of itself with a special format for each Scaler in it.
static readonly Matrix2x3 Zero
static Scalar GetDeterminant(Vector3D Rx, Vector3D Ry, Vector3D Rz)
void CopyTransposedTo(Scalar[] array, int index)
static void Copy(ref Matrix4x4 source, out Matrix2x3 dest)
static Matrix2x3 FromTransformation(Scalar rotation, Vector2D translation)
static Matrix2x3 FromArray(Scalar[] array)
static void GetDeterminant(ref Matrix2x3 source, out Scalar result)
static void Negate(ref Matrix2x3 source, out Matrix2x3 result)
Matrix4x4 ToMatrix4x4From2D()
static bool operator!=(Matrix2x3 left, Matrix2x3 right)
static void Subtract(ref Matrix2x2 left, ref Matrix2x3 right, out Matrix2x3 result)
static void Subtract(ref Matrix2x3 left, ref Matrix2x3 right, out Matrix2x3 result)
static bool Equals(ref Matrix2x3 left, ref Matrix2x3 right)
static readonly string FormatString
static Matrix2x3 Multiply(Matrix2x3 left, Scalar scalar)
Used to multiply a Matrix2x3 object by a scalar value..
static void Copy(Scalar[] sourceArray, int index, out Matrix2x3 result)
Vector3D GetRow(int rowIndex)
static void FromTransformation(ref Scalar rotation, ref Vector2D translation, out Matrix2x3 result)
static Matrix2x3 operator-(Matrix2x3 left, Matrix2x3 right)
Used to subtract two matrices.
static void Transpose(ref Matrix2x3 source, out Matrix2x3 result)
Matrix2x3 Transposed
Swap the rows of the matrix with the columns.
static void Copy(Scalar[] sourceArray, out Matrix2x3 result)
static Scalar GetDeterminant(Scalar m00, Scalar m01, Scalar m02, Scalar m10, Scalar m11, Scalar m12, Scalar m20, Scalar m21, Scalar m22)
static Matrix2x3 Subtract(Matrix2x3 left, Matrix2x2 right)
Matrix2x3(Scalar[] values, int index)
const int RowCount
The number of rows.
Scalar[,] ToMatrixArray()
static Matrix2x3 Negate(Matrix2x3 source)
Negates a Matrix2x3.
static void Copy(ref Matrix2x3 matrix, Scalar[] destArray)
void CopyFrom(Scalar[] array, int index)
Copies all the elements of the IAdvanceValueType, of the specified one-dimensional Array to the IAdva...
string ToStringInternal(string FormatString)
static Matrix2x3 Subtract(Matrix2x2 left, Matrix2x3 right)
int IAdvanceValueType. Count
static Matrix2x3 operator+(Matrix2x3 left, Matrix2x3 right)
Used to add two matrices together.
static Matrix2x3 Lerp(Matrix2x3 left, Matrix2x3 right, Scalar amount)
static Matrix2x3 Add(Matrix2x2 left, Matrix2x3 right)
Scalar[] ToArray()
Copies the elements of the IAdvanceValueType to a new array of Scalar .
static Matrix2x3 Add(Matrix2x3 left, Matrix2x3 right)
Used to add two matrices together.
const int Size
The Size of the class in bytes;
static void Multiply(ref Matrix2x3 left, ref Scalar scalar, out Matrix2x3 result)
static Matrix2x3 Multiply(Matrix2x3 left, Matrix2x3 right)
Used to multiply (concatenate) two Matrix4x4s.
static void Lerp(ref Matrix2x3 left, ref Matrix2x3 right, ref Scalar amount, out Matrix2x3 result)
static readonly Matrix4x4 Identity
This is the Vector Class.
Scalar X
This is the X value. (Usually represents a horizontal position or direction.)
Scalar Y
This is the Y value. (Usually represents a vertical position or direction.)
A Vector with 3 dimensions.
Scalar X
This is the X value.
Scalar Y
This is the Y value.
Scalar Z
This is the Z value.