[]
Represents a 3x2 coordinate system transformation matrix with double precision.
public class Matrix : IEquatable<Matrix>
Initializes a new instance of the Matrix class.
public Matrix(double m11, double m12, double m21, double m22, double m31, double m32)
m11
doubleThe value to assign at row 1 column 1 of the matrix.
m12
doubleThe value to assign at row 1 column 2 of the matrix.
m21
doubleThe value to assign at row 2 column 1 of the matrix.
m22
doubleThe value to assign at row 2 column 2 of the matrix.
m31
doubleThe value to assign at row 3 column 1 of the matrix.
m32
doubleThe value to assign at row 3 column 2 of the matrix.
Initializes a new instance of the Matrix class from System.Numerics.Matrix3x2.
public Matrix(Matrix3x2 m)
m
System.Numerics.Matrix3x2The source System.Numerics.Matrix3x2.
Gets the identity matrix.
public static readonly Matrix Identity
Gets a value indicating whether this instance is an identity matrix.
public bool IsIdentity { get; }
Gets element (1, 1).
public double M11 { get; }
Gets element (1, 2).
public double M12 { get; }
Gets element (2, 1).
public double M21 { get; }
Gets element (2, 2).
public double M22 { get; }
Gets element (3, 1).
public double M31 { get; }
Gets element (3, 2).
public double M32 { get; }
Creates a rotation matrix.
public static Matrix CreateRotation(double radians, double cx, double cy)
radians
doubleAngle of rotation, in radians. Angles are measured clockwise when looking along the rotation axis.
cx
doubleX-coordinate of the center offset.
cy
doubleY-coordinate of the center offset.
The rotation matrix.
Creates a rotation matrix.
public static Matrix CreateRotation(double radians, PointF centerPoint)
radians
doubleAngle of rotation, in radians. Angles are measured clockwise when looking along the rotation axis.
centerPoint
System.Drawing.PointFThe center offset.
The rotation matrix.
Creates a rotation matrix.
public static Matrix CreateRotation(double radians)
radians
doubleAngle of rotation, in radians. Angles are measured clockwise when looking along the rotation axis.
The rotation matrix.
Creates a scaling matrix that is offset by a given center point.
public static Matrix CreateScale(double xScale, double yScale, double cx, double cy)
xScale
doubleThe value to scale by on the X axis.
yScale
doubleThe value to scale by on the Y axis.
cx
doubleX-coordinate of the center offset.
cy
doubleY-coordinate of the center offset.
The scaling matrix.
Creates a scaling matrix that scales uniformly with the specified scale with an offset from the specified center.
public static Matrix CreateScale(double scale, double cx, double cy)
scale
doubleThe uniform scale to use.
cx
doubleX-coordinate of the center offset.
cy
doubleY-coordinate of the center offset.
The scaling matrix.
Creates a scaling matrix that is offset by a given center point.
public static Matrix CreateScale(double xScale, double yScale, PointF centerPoint)
xScale
doubleThe value to scale by on the X axis.
yScale
doubleThe value to scale by on the Y axis.
centerPoint
System.Drawing.PointFThe center offset.
The scaling matrix.
Creates a scaling matrix from the specified X and Y components.
public static Matrix CreateScale(double xScale, double yScale)
xScale
doubleThe value to scale by on the X axis.
yScale
doubleThe value to scale by on the Y axis.
The scaling matrix.
Creates a scaling matrix that scales uniformly with the specified scale with an offset from the specified center.
public static Matrix CreateScale(double scale, PointF centerPoint)
scale
doubleThe uniform scale to use.
centerPoint
System.Drawing.PointFThe center offset.
The scaling matrix.
Creates a scaling matrix that scales uniformly with the given scale.
public static Matrix CreateScale(double scale)
scale
doubleThe uniform scale to use.
The scaling matrix.
Creates a skew matrix from the specified angles in radians and a center point.
public static Matrix CreateSkew(double radiansX, double radiansY, double cx, double cy)
radiansX
doubleThe X angle, in radians.
radiansY
doubleThe Y angle, in radians.
cx
doubleX-coordinate of the center offset.
cy
doubleY-coordinate of the center offset.
The skew matrix.
Creates a skew matrix from the specified angles in radians and a center point.
public static Matrix CreateSkew(double radiansX, double radiansY, PointF centerPoint)
radiansX
doubleThe X angle, in radians.
radiansY
doubleThe Y angle, in radians.
centerPoint
System.Drawing.PointFThe center point.
The skew matrix.
Creates a skew matrix from the specified angles in radians.
public static Matrix CreateSkew(double radiansX, double radiansY)
radiansX
doubleThe X angle, in radians.
radiansY
doubleThe Y angle, in radians.
The skew matrix.
Creates a translation matrix.
public static Matrix CreateTranslation(double xPosition, double yPosition)
xPosition
doubleThe X position.
yPosition
doubleThe Y position.
The translation matrix.
Creates a translation matrix.
public static Matrix CreateTranslation(PointF point)
point
System.Drawing.PointFThe translation position.
The translation matrix.
Determines whether the specified Matrix is equal to this instance.
public bool Equals(Matrix other)
other
MatrixDetermines whether the specified object is equal to this instance.
public override bool Equals(object value)
value
objectReturns a hash code for this instance.
public override int GetHashCode()
Inverts the matrix if possible. Returns the inverted matrix if the operation succeeded.
public Matrix Invert()
The inverted matrix or null.
Inverts the matrix if possible. The return value indicates whether the operation succeeded.
public bool Invert(out Matrix result)
result
MatrixWhen this method returns, contains the inverted matrix if the operation succeeded.
true if the matrix was inverted successfully; otherwise, false.
Determines the product of two matrices.
public Matrix Multiply(Matrix rightMatrix)
rightMatrix
MatrixThe second matrix to multiply.
The product of the two matrices.
Determines the product of the current Matrix to System.Numerics.Matrix3x2.
public Matrix3x2 Multiply(Matrix3x2 rightMatrix)
rightMatrix
System.Numerics.Matrix3x2The second matrix to multiply.
The product of the two matrices in a shape of System.Numerics.Matrix3x2.
Applies the rotation transformation.
public Matrix Rotate(double radians, double cx, double cy)
radians
doubleAngle of rotation, in radians. Angles are measured clockwise when looking along the rotation axis.
cx
doubleX-coordinate of the center offset.
cy
doubleY-coordinate of the center offset.
The rotated matrix.
Applies the rotation transformation.
public Matrix Rotate(double radians, PointF centerPoint)
radians
doubleAngle of rotation, in radians. Angles are measured clockwise when looking along the rotation axis.
centerPoint
System.Drawing.PointFThe center offset.
The rotated matrix.
Applies the rotation transformation.
public Matrix Rotate(double radians)
radians
doubleAngle of rotation, in radians. Angles are measured clockwise when looking along the rotation axis.
The rotated matrix.
Applies the scaling transformation that is offset by a given center point.
public Matrix Scale(double sx, double sy, double cx, double cy)
sx
doubleThe value to scale by on the X axis.
sy
doubleThe value to scale by on the Y axis.
cx
doubleX-coordinate of the center offset.
cy
doubleY-coordinate of the center offset.
The scaled matrix.
Applies the scaling transformation that is offset by a given center point.
public Matrix Scale(double sx, double sy, PointF centerPoint)
sx
doubleThe value to scale by on the X axis.
sy
doubleThe value to scale by on the Y axis.
centerPoint
System.Drawing.PointFThe center offset.
The scaled matrix.
Applies the scaling transformation.
public Matrix Scale(double sx, double sy)
sx
doubleThe value to scale by on the X axis.
sy
doubleThe value to scale by on the Y axis.
The scaled matrix.
Applies the scaling transformation.
public Matrix Scale(double scaleFactor)
scaleFactor
doubleThe value to scale by on the X and Y axes.
The scaled matrix.
Applies the skew transformation that is offset by a given center point.
public Matrix Skew(double radiansX, double radiansY, double cx, double cy)
radiansX
doubleThe X angle, in radians.
radiansY
doubleThe Y angle, in radians.
cx
doubleX-coordinate of the center offset.
cy
doubleY-coordinate of the center offset.
The skew matrix.
Applies the skew transformation that is offset by a given center point.
public Matrix Skew(double radiansX, double radiansY, PointF centerPoint)
radiansX
doubleThe X angle, in radians.
radiansY
doubleThe Y angle, in radians.
centerPoint
System.Drawing.PointFThe center point.
The skew matrix.
Applies the skew transformation.
public Matrix Skew(double radiansX, double radiansY)
radiansX
doubleThe X angle, in radians.
radiansY
doubleThe Y angle, in radians.
The skew matrix.
Applies the skew transformation along the X axis.
public Matrix SkewX(double radians)
radians
doubleThe X angle, in radians.
The skew matrix.
Applies the skew transformation along the Y axis.
public Matrix SkewY(double radians)
radians
doubleThe Y angle, in radians.
The skew matrix.
Creates a System.Numerics.Matrix3x2 from this Matrix.
public Matrix3x2 ToMatrix3x2()
Returns a string that represents the current Matrix.
public override string ToString()
Returns a string that represents this instance.
public string ToString(IFormatProvider formatProvider)
formatProvider
System.IFormatProviderTransforms a point by this matrix.
public (double, double) Transform(double x, double y)
x
doubleX-coordinate of the original point.
y
doubleY-coordinate of the original point.
A pair of transformed X and Y coordinates.
Transforms a point by this matrix.
public PointF Transform(PointF point)
point
System.Drawing.PointFThe original point to apply the transformation.
The transformed point.
Transforms an array of points by this matrix.
public void Transform(PointF[] points, int startIndex, int count)
points
System.Drawing.PointF[]startIndex
intcount
intTransforms a point by this matrix.
public PointF Transform(float x, float y)
x
floatX-coordinate of the original point.
y
floatY-coordinate of the original point.
The transformed point.
Applies the translation transformation.
public Matrix Translate(double xPosition, double yPosition)
xPosition
doubleThe X position.
yPosition
doubleThe Y position.
The translated matrix.
Applies the translation transformation.
public Matrix Translate(PointF point)
point
System.Drawing.PointFThe translation position.
The translated matrix.
Returns a value that indicates whether the specified matrices are equal.
public static bool operator ==(Matrix matrix1, Matrix matrix2)
Returns a value that indicates whether the specified matrices are not equal.
public static bool operator !=(Matrix matrix1, Matrix matrix2)
Determines the product of two matrices.
public static Matrix operator *(Matrix leftMatrix, Matrix rightMatrix)
The product of the two matrices.
Determines the product of the Matrix to System.Numerics.Matrix3x2.
public static Matrix3x2 operator *(Matrix leftMatrix, Matrix3x2 rightMatrix)
leftMatrix
MatrixThe first matrix to multiply.
rightMatrix
System.Numerics.Matrix3x2The second matrix to multiply.
The product of the two matrices in a shape of System.Numerics.Matrix3x2.