Struct TransformationMatrix
Represents a 3x2 matrix which is used to apply transformations on a render target and geometry.
Inherited Members
Namespace: GameOverlay.Drawing
Assembly: GameOverlay.dll
Syntax
public struct TransformationMatrix
Constructors
| Improve this Doc View SourceTransformationMatrix(RawMatrix3x2)
Initializes a new TransformationMatrix using the given RawMatrix3x2.
Declaration
public TransformationMatrix(RawMatrix3x2 matrix)
Parameters
Type | Name | Description |
---|---|---|
SharpDX.Mathematics.Interop.RawMatrix3x2 | matrix |
TransformationMatrix(Single)
Initializes a new instance of the TransformationMatrix struct.
Declaration
public TransformationMatrix(float value)
Parameters
Type | Name | Description |
---|---|---|
Single | value | The value that will be assigned to all components. |
TransformationMatrix(Single, Single, Single, Single, Single, Single)
Initializes a new instance of the TransformationMatrix struct.
Declaration
public TransformationMatrix(float m11, float m12, float m21, float m22, float m31, float m32)
Parameters
Type | Name | Description |
---|---|---|
Single | m11 | The value to assign at row 1 column 1 of the matrix. |
Single | m12 | The value to assign at row 1 column 2 of the matrix. |
Single | m21 | The value to assign at row 2 column 1 of the matrix. |
Single | m22 | The value to assign at row 2 column 2 of the matrix. |
Single | m31 | The value to assign at row 3 column 1 of the matrix. |
Single | m32 | The value to assign at row 3 column 2 of the matrix. |
TransformationMatrix(Single[])
Initializes a new instance of the TransformationMatrix struct.
Declaration
public TransformationMatrix(float[] values)
Parameters
Type | Name | Description |
---|---|---|
Single[] | values | The values to assign to the components of the matrix. This must be an array with six elements. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when |
ArgumentOutOfRangeException | Thrown when |
Fields
| Improve this Doc View SourceEmpty
Gets an empty matrix.
Declaration
public static readonly TransformationMatrix Empty
Field Value
Type | Description |
---|---|
TransformationMatrix |
Identity
Gets the identity matrix.
Declaration
public static readonly TransformationMatrix Identity
Field Value
Type | Description |
---|---|
TransformationMatrix | The identity matrix. |
Properties
| Improve this Doc View SourceIsIdentity
Gets a value indicating whether this instance is an identity matrix.
Declaration
public bool IsIdentity { get; }
Property Value
Type | Description |
---|---|
Boolean |
|
Item[Int32]
Gets or sets the component at the specified index.
Declaration
public float this[int index] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The zero-based index of the component to access. |
Property Value
Type | Description |
---|---|
Single | The value of the matrix component, depending on the index. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | Thrown when the |
Item[Int32, Int32]
Gets or sets the component at the specified index.
Declaration
public float this[int row, int column] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
Int32 | row | The row of the matrix to access. |
Int32 | column | The column of the matrix to access. |
Property Value
Type | Description |
---|---|
Single | The value of the matrix component, depending on the index. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | Thrown when the |
M11
Element (1,1)
Declaration
public float M11 { get; set; }
Property Value
Type | Description |
---|---|
Single |
M12
Element (1,2)
Declaration
public float M12 { get; set; }
Property Value
Type | Description |
---|---|
Single |
M21
Element (2,1)
Declaration
public float M21 { get; set; }
Property Value
Type | Description |
---|---|
Single |
M22
Element (2,2)
Declaration
public float M22 { get; set; }
Property Value
Type | Description |
---|---|
Single |
M31
Element (3,1)
Declaration
public float M31 { get; set; }
Property Value
Type | Description |
---|---|
Single |
M32
Element (3,2)
Declaration
public float M32 { get; set; }
Property Value
Type | Description |
---|---|
Single |
ScaleVector
Gets or sets the scale of the matrix; that is M11 and M22.
Declaration
public Point ScaleVector { get; set; }
Property Value
Type | Description |
---|---|
Point |
TranslationVector
Gets or sets the translation of the matrix; that is M31 and M32.
Declaration
public Point TranslationVector { get; set; }
Property Value
Type | Description |
---|---|
Point |
Methods
| Improve this Doc View SourceAdd(ref TransformationMatrix, ref TransformationMatrix)
Determines the sum of two matrices.
Declaration
public static TransformationMatrix Add(ref TransformationMatrix left, ref TransformationMatrix right)
Parameters
Type | Name | Description |
---|---|---|
TransformationMatrix | left | The first matrix to add. |
TransformationMatrix | right | The second matrix to add. |
Returns
Type | Description |
---|---|
TransformationMatrix |
Determinant()
Calculates the determinant of this matrix.
Declaration
public float Determinant()
Returns
Type | Description |
---|---|
Single | Result of the determinant. |
Divide(ref TransformationMatrix, ref TransformationMatrix)
Scales a matrix by the given value.
Declaration
public static TransformationMatrix Divide(ref TransformationMatrix left, ref TransformationMatrix right)
Parameters
Type | Name | Description |
---|---|---|
TransformationMatrix | left | The matrix to scale. |
TransformationMatrix | right | The amount by which to scale. |
Returns
Type | Description |
---|---|
TransformationMatrix |
Divide(ref TransformationMatrix, Single)
Scales a matrix by the given value.
Declaration
public static TransformationMatrix Divide(ref TransformationMatrix left, float right)
Parameters
Type | Name | Description |
---|---|---|
TransformationMatrix | left | The matrix to scale. |
Single | right | The amount by which to scale. |
Returns
Type | Description |
---|---|
TransformationMatrix |
Equals(TransformationMatrix)
Determines whether the specified TransformationMatrix is equal to this instance.
Declaration
public bool Equals(TransformationMatrix other)
Parameters
Type | Name | Description |
---|---|---|
TransformationMatrix | other | The TransformationMatrix to compare with this instance. |
Returns
Type | Description |
---|---|
Boolean |
|
Equals(ref TransformationMatrix)
Determines whether the specified TransformationMatrix is equal to this instance.
Declaration
public bool Equals(ref TransformationMatrix other)
Parameters
Type | Name | Description |
---|---|---|
TransformationMatrix | other | The TransformationMatrix to compare with this instance. |
Returns
Type | Description |
---|---|
Boolean |
|
Equals(Object)
Determines whether the specified Object is equal to this instance.
Declaration
public override bool Equals(object value)
Parameters
Type | Name | Description |
---|---|---|
Object | value | The Object to compare with this instance. |
Returns
Type | Description |
---|---|
Boolean |
|
Overrides
| Improve this Doc View SourceGetHashCode()
Returns a hash code for this instance.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 | A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. |
Overrides
| Improve this Doc View SourceInvert()
Calculates the inverse of this matrix instance.
Declaration
public void Invert()
Invert(TransformationMatrix)
Calculates the inverse of the specified matrix.
Declaration
public static TransformationMatrix Invert(TransformationMatrix value)
Parameters
Type | Name | Description |
---|---|---|
TransformationMatrix | value | The matrix whose inverse is to be calculated. |
Returns
Type | Description |
---|---|
TransformationMatrix | the inverse of the specified matrix. |
Invert(ref TransformationMatrix)
Calculates the inverse of the specified matrix.
Declaration
public static TransformationMatrix Invert(ref TransformationMatrix value)
Parameters
Type | Name | Description |
---|---|---|
TransformationMatrix | value | The matrix whose inverse is to be calculated. |
Returns
Type | Description |
---|---|
TransformationMatrix |
Lerp(ref TransformationMatrix, ref TransformationMatrix, Single)
Performs a linear interpolation between two matrices.
Declaration
public static TransformationMatrix Lerp(ref TransformationMatrix start, ref TransformationMatrix end, float amount)
Parameters
Type | Name | Description |
---|---|---|
TransformationMatrix | start | Start matrix. |
TransformationMatrix | end | End matrix. |
Single | amount | Value between 0 and 1 indicating the weight of |
Returns
Type | Description |
---|---|
TransformationMatrix |
Remarks
Passing amount
a value of 0 will cause start
to be returned; a value of 1 will cause end
to be returned.
Multiply(ref TransformationMatrix, ref TransformationMatrix)
Scales a matrix by the given value.
Declaration
public static TransformationMatrix Multiply(ref TransformationMatrix left, ref TransformationMatrix right)
Parameters
Type | Name | Description |
---|---|---|
TransformationMatrix | left | The matrix to scale. |
TransformationMatrix | right | The amount by which to scale. |
Returns
Type | Description |
---|---|
TransformationMatrix |
Multiply(ref TransformationMatrix, Single)
Scales a matrix by the given value.
Declaration
public static TransformationMatrix Multiply(ref TransformationMatrix left, float right)
Parameters
Type | Name | Description |
---|---|---|
TransformationMatrix | left | The matrix to scale. |
Single | right | The amount by which to scale. |
Returns
Type | Description |
---|---|
TransformationMatrix |
Negate(ref TransformationMatrix)
Negates a matrix.
Declaration
public static TransformationMatrix Negate(ref TransformationMatrix value)
Parameters
Type | Name | Description |
---|---|---|
TransformationMatrix | value | The matrix to be negated. |
Returns
Type | Description |
---|---|
TransformationMatrix |
Rotation(Single)
Creates a matrix that rotates.
Declaration
public static TransformationMatrix Rotation(float angle)
Parameters
Type | Name | Description |
---|---|---|
Single | angle | Angle of rotation in radians. Angles are measured clockwise when looking along the rotation axis. |
Returns
Type | Description |
---|---|
TransformationMatrix |
Rotation(Single, Point)
Creates a matrix that rotates about a specified center.
Declaration
public static TransformationMatrix Rotation(float angle, Point center)
Parameters
Type | Name | Description |
---|---|---|
Single | angle | Angle of rotation in radians. Angles are measured clockwise when looking along the rotation axis. |
Point | center | The center of the rotation. |
Returns
Type | Description |
---|---|
TransformationMatrix |
Scaling(Point)
Creates a matrix that scales along the x-axis and y-axis.
Declaration
public static TransformationMatrix Scaling(Point scale)
Parameters
Type | Name | Description |
---|---|---|
Point | scale | Scaling factor for both axes. |
Returns
Type | Description |
---|---|
TransformationMatrix | The created scaling matrix. |
Scaling(ref Point)
Creates a matrix that scales along the x-axis and y-axis.
Declaration
public static TransformationMatrix Scaling(ref Point scale)
Parameters
Type | Name | Description |
---|---|---|
Point | scale | Scaling factor for both axes. |
Returns
Type | Description |
---|---|
TransformationMatrix |
Scaling(Single)
Creates a matrix that uniformly scales along both axes.
Declaration
public static TransformationMatrix Scaling(float scale)
Parameters
Type | Name | Description |
---|---|---|
Single | scale | The uniform scale that is applied along both axes. |
Returns
Type | Description |
---|---|
TransformationMatrix |
Scaling(Single, Single)
Creates a matrix that scales along the x-axis and y-axis.
Declaration
public static TransformationMatrix Scaling(float x, float y)
Parameters
Type | Name | Description |
---|---|---|
Single | x | Scaling factor that is applied along the x-axis. |
Single | y | Scaling factor that is applied along the y-axis. |
Returns
Type | Description |
---|---|
TransformationMatrix |
Scaling(Single, Single, Point)
Creates a matrix that is scaling from a specified center.
Declaration
public static TransformationMatrix Scaling(float x, float y, Point center)
Parameters
Type | Name | Description |
---|---|---|
Single | x | Scaling factor that is applied along the x-axis. |
Single | y | Scaling factor that is applied along the y-axis. |
Point | center | The center of the scaling. |
Returns
Type | Description |
---|---|
TransformationMatrix | The created scaling matrix. |
Skew(Single, Single)
Creates a skew matrix.
Declaration
public static TransformationMatrix Skew(float angleX, float angleY)
Parameters
Type | Name | Description |
---|---|---|
Single | angleX | Angle of skew along the X-axis in radians. |
Single | angleY | Angle of skew along the Y-axis in radians. |
Returns
Type | Description |
---|---|
TransformationMatrix |
SmoothStep(ref TransformationMatrix, ref TransformationMatrix, Single)
Performs a cubic interpolation between two matrices.
Declaration
public static TransformationMatrix SmoothStep(ref TransformationMatrix start, ref TransformationMatrix end, float amount)
Parameters
Type | Name | Description |
---|---|---|
TransformationMatrix | start | Start matrix. |
TransformationMatrix | end | End matrix. |
Single | amount | Value between 0 and 1 indicating the weight of |
Returns
Type | Description |
---|---|
TransformationMatrix |
Subtract(ref TransformationMatrix, ref TransformationMatrix)
Determines the difference between two matrices.
Declaration
public static TransformationMatrix Subtract(ref TransformationMatrix left, ref TransformationMatrix right)
Parameters
Type | Name | Description |
---|---|---|
TransformationMatrix | left | The first matrix to subtract. |
TransformationMatrix | right | The second matrix to subtract. |
Returns
Type | Description |
---|---|
TransformationMatrix |
ToArray()
Creates an array containing the elements of the matrix.
Declaration
public float[] ToArray()
Returns
Type | Description |
---|---|
Single[] | A six-element array containing the components of the matrix. |
ToString()
Returns a String that represents this instance.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String | A String that represents this instance. |
Overrides
| Improve this Doc View SourceToString(IFormatProvider)
Returns a String that represents this instance.
Declaration
public string ToString(IFormatProvider formatProvider)
Parameters
Type | Name | Description |
---|---|---|
IFormatProvider | formatProvider | The format provider. |
Returns
Type | Description |
---|---|
String | A String that represents this instance. |
ToString(String)
Returns a String that represents this instance.
Declaration
public string ToString(string format)
Parameters
Type | Name | Description |
---|---|---|
String | format | The format. |
Returns
Type | Description |
---|---|
String | A String that represents this instance. |
ToString(String, IFormatProvider)
Returns a String that represents this instance.
Declaration
public string ToString(string format, IFormatProvider formatProvider)
Parameters
Type | Name | Description |
---|---|---|
String | format | The format. |
IFormatProvider | formatProvider | The format provider. |
Returns
Type | Description |
---|---|
String | A String that represents this instance. |
Transformation(Single, Single, Single, Single, Single)
Creates a transformation matrix.
Declaration
public static TransformationMatrix Transformation(float xScale, float yScale, float angle, float xOffset, float yOffset)
Parameters
Type | Name | Description |
---|---|---|
Single | xScale | Scaling factor that is applied along the x-axis. |
Single | yScale | Scaling factor that is applied along the y-axis. |
Single | angle | Angle of rotation in radians. Angles are measured clockwise when looking along the rotation axis. |
Single | xOffset | X-coordinate offset. |
Single | yOffset | Y-coordinate offset. |
Returns
Type | Description |
---|---|
TransformationMatrix |
TransformPoint(TransformationMatrix, Point)
Transforms a vector by this matrix.
Declaration
public static Point TransformPoint(TransformationMatrix matrix, Point point)
Parameters
Type | Name | Description |
---|---|---|
TransformationMatrix | matrix | The matrix to use as a transformation matrix. |
Point | point | The original vector to apply the transformation. |
Returns
Type | Description |
---|---|
Point | The result of the transformation for the input vector. |
TransformPoint(ref TransformationMatrix, ref Point)
Transforms a vector by this matrix.
Declaration
public static Point TransformPoint(ref TransformationMatrix matrix, ref Point point)
Parameters
Type | Name | Description |
---|---|---|
TransformationMatrix | matrix | The matrix to use as a transformation matrix. |
Point | point | The original vector to apply the transformation. |
Returns
Type | Description |
---|---|
Point |
Translation(Point)
Creates a translation matrix using the specified offsets.
Declaration
public static TransformationMatrix Translation(Point value)
Parameters
Type | Name | Description |
---|---|---|
Point | value | The offset for both coordinate planes. |
Returns
Type | Description |
---|---|
TransformationMatrix | The created translation matrix. |
Translation(ref Point)
Creates a translation matrix using the specified offsets.
Declaration
public static TransformationMatrix Translation(ref Point value)
Parameters
Type | Name | Description |
---|---|---|
Point | value | The offset for both coordinate planes. |
Returns
Type | Description |
---|---|
TransformationMatrix |
Translation(Single, Single)
Creates a translation matrix using the specified offsets.
Declaration
public static TransformationMatrix Translation(float x, float y)
Parameters
Type | Name | Description |
---|---|---|
Single | x | X-coordinate offset. |
Single | y | Y-coordinate offset. |
Returns
Type | Description |
---|---|
TransformationMatrix |
Operators
| Improve this Doc View SourceAddition(TransformationMatrix, TransformationMatrix)
Adds two matrices.
Declaration
public static TransformationMatrix operator +(TransformationMatrix left, TransformationMatrix right)
Parameters
Type | Name | Description |
---|---|---|
TransformationMatrix | left | The first matrix to add. |
TransformationMatrix | right | The second matrix to add. |
Returns
Type | Description |
---|---|
TransformationMatrix | The sum of the two matrices. |
Division(TransformationMatrix, TransformationMatrix)
Divides two matrices.
Declaration
public static TransformationMatrix operator /(TransformationMatrix left, TransformationMatrix right)
Parameters
Type | Name | Description |
---|---|---|
TransformationMatrix | left | The first matrix to divide. |
TransformationMatrix | right | The second matrix to divide. |
Returns
Type | Description |
---|---|
TransformationMatrix | The quotient of the two matrices. |
Division(TransformationMatrix, Single)
Scales a matrix by a given value.
Declaration
public static TransformationMatrix operator /(TransformationMatrix left, float right)
Parameters
Type | Name | Description |
---|---|---|
TransformationMatrix | left | The matrix to scale. |
Single | right | The amount by which to scale. |
Returns
Type | Description |
---|---|
TransformationMatrix | The scaled matrix. |
Equality(TransformationMatrix, TransformationMatrix)
Tests for equality between two objects.
Declaration
public static bool operator ==(TransformationMatrix left, TransformationMatrix right)
Parameters
Type | Name | Description |
---|---|---|
TransformationMatrix | left | The first value to compare. |
TransformationMatrix | right | The second value to compare. |
Returns
Type | Description |
---|---|
Boolean |
|
Explicit(RawMatrix3x2 to TransformationMatrix)
Converts the given RawMatrix3x2 to a TransformationMatrix.
Declaration
public static explicit operator TransformationMatrix(RawMatrix3x2 value)
Parameters
Type | Name | Description |
---|---|---|
SharpDX.Mathematics.Interop.RawMatrix3x2 | value | The RawMatrix3x2 to convert. |
Returns
Type | Description |
---|---|
TransformationMatrix |
Implicit(TransformationMatrix to RawMatrix3x2)
Converts the given TransformationMatrix to a RawMatrix3x2.
Declaration
public static implicit operator RawMatrix3x2(TransformationMatrix value)
Parameters
Type | Name | Description |
---|---|---|
TransformationMatrix | value | The TransformationMatrix to convert. |
Returns
Type | Description |
---|---|
SharpDX.Mathematics.Interop.RawMatrix3x2 |
Inequality(TransformationMatrix, TransformationMatrix)
Tests for inequality between two objects.
Declaration
public static bool operator !=(TransformationMatrix left, TransformationMatrix right)
Parameters
Type | Name | Description |
---|---|---|
TransformationMatrix | left | The first value to compare. |
TransformationMatrix | right | The second value to compare. |
Returns
Type | Description |
---|---|
Boolean |
|
Multiply(TransformationMatrix, TransformationMatrix)
Scales a matrix by a given value.
Declaration
public static TransformationMatrix operator *(TransformationMatrix left, TransformationMatrix right)
Parameters
Type | Name | Description |
---|---|---|
TransformationMatrix | left | The matrix to scale. |
TransformationMatrix | right | The amount by which to scale. |
Returns
Type | Description |
---|---|
TransformationMatrix | The scaled matrix. |
Multiply(TransformationMatrix, Single)
Scales a matrix by a given value.
Declaration
public static TransformationMatrix operator *(TransformationMatrix left, float right)
Parameters
Type | Name | Description |
---|---|---|
TransformationMatrix | left | The amount by which to scale. |
Single | right | The matrix to scale. |
Returns
Type | Description |
---|---|
TransformationMatrix | The scaled matrix. |
Subtraction(TransformationMatrix, TransformationMatrix)
Subtracts two matrices.
Declaration
public static TransformationMatrix operator -(TransformationMatrix left, TransformationMatrix right)
Parameters
Type | Name | Description |
---|---|---|
TransformationMatrix | left | The first matrix to subtract. |
TransformationMatrix | right | The second matrix to subtract. |
Returns
Type | Description |
---|---|
TransformationMatrix | The difference between the two matrices. |
UnaryNegation(TransformationMatrix)
Negates a matrix.
Declaration
public static TransformationMatrix operator -(TransformationMatrix value)
Parameters
Type | Name | Description |
---|---|---|
TransformationMatrix | value | The matrix to negate. |
Returns
Type | Description |
---|---|
TransformationMatrix | The negated matrix. |