New to Telerik UI for WinForms? Start a free 30-day trial

RadMatrix

Struct

Represents a layout transform that stores a translation offset.

The linear coefficients are fixed to the identity values, so scale and rotation are not retained. Operations around a nonzero origin can still change the stored translation offset and translate points. Empty and Identity have the same value in this implementation.

Definition

Namespace:Telerik.WinForms.Documents.Layout

Assembly:Telerik.WinControls.RichTextEditor.dll

Syntax:

C#
public struct RadMatrix

Constructors

Initializes the matrix with the specified offsets; the coefficient parameters are not stored.

C#
public RadMatrix(float m11, float m12, float m21, float m22, float dx, float dy)
Parameters:m11float

Ignored; the matrix uses a fixed identity coefficient.

m12float

Ignored; the matrix uses a fixed identity coefficient.

m21float

Ignored; the matrix uses a fixed identity coefficient.

m22float

Ignored; the matrix uses a fixed identity coefficient.

dxfloat

The horizontal translation offset.

dyfloat

The vertical translation offset.

Computes a translation offset for the specified scale values around an origin. The scale itself is not retained, so transformed points are not scaled.

C#
public RadMatrix(float scaleX, float scaleY, PointF origin)
Parameters:scaleXfloat

The horizontal scale used to compute the offset.

scaleYfloat

The vertical scale used to compute the offset.

originPointF

The point around which the offset is computed.

Initializes a zero-offset matrix from the specified scale values at the origin.

C#
public RadMatrix(float scaleX, float scaleY)
Parameters:scaleXfloat

The requested horizontal scale; scale is not applied to transformed points.

scaleYfloat

The requested vertical scale; scale is not applied to transformed points.

Computes a translation offset for rotating around an origin. The rotation itself is not retained, so transformed points are translated rather than rotated.

C#
public RadMatrix(float angle, PointF origin)
Parameters:anglefloat

The requested rotation angle in degrees.

originPointF

The point around which the offset is computed.

Initializes a zero-offset matrix for the specified angle at the origin. The rotation itself is not applied to transformed points.

C#
public RadMatrix(float angle)
Parameters:anglefloat

The requested rotation angle in degrees.

Initializes a new RadMatrix, applying the specified X and Y values as DX and DY members of the matrix.

C#
public RadMatrix(PointF offset)
Parameters:offsetPointF

The translation offset copied into DX and DY.

Copies the translation offsets from another matrix.

C#
public RadMatrix(RadMatrix source)
Parameters:sourceRadMatrix

The matrix whose offsets are copied.

Fields

The factor for converting degrees to radians.

C#
public const float DegreeToRadian = 0.017453294

Gets or sets the horizontal translation offset applied to points.

C#
public float DX

Gets or sets the vertical translation offset applied to points.

C#
public float DY

Represents a zero-offset transform; it compares equal to Identity.

C#
public static readonly RadMatrix Empty

Represents the zero-offset transform with fixed identity coefficients.

C#
public static readonly RadMatrix Identity

The fixed first diagonal coefficient; it is 1 for every RadMatrix.

C#
public static readonly float M11

The fixed first off-diagonal coefficient; it is 0 for every RadMatrix.

C#
public static readonly float M12

The fixed second off-diagonal coefficient; it is 0 for every RadMatrix.

C#
public static readonly float M21

The fixed second diagonal coefficient; it is 1 for every RadMatrix.

C#
public static readonly float M22

The value of pi used for angle conversions.

C#
public const float PI = 3.141593

The factor for converting radians to degrees.

C#
public const float RadianToDegree = 57.295773

Two times PI.

C#
public const float TwoPI = 6.283186

Properties

Gets the determinant of the fixed identity coefficients, which is always 1.

C#
public float Determinant { get; }

Gets the six values in matrix order: the four fixed coefficients, followed by DX and DY.

C#
public float[] Elements { get; }

Determines whether both translation offsets are zero. In this implementation, this also makes the matrix equal to Identity.

C#
public bool IsEmpty { get; }

Determines whether both translation offsets are zero. In this implementation, this also makes the matrix equal to Empty.

C#
public bool IsIdentity { get; }

Determines whether this matrix may be inverted; the fixed coefficients make this value always true.

C#
public bool IsInvertible { get; }

Gets the rotation in degrees derived from the fixed coefficients; this implementation always reports 0.

C#
public float Rotation { get; }

Gets the X-axis scale measured from transformed unit points; the fixed coefficients normally yield 1, though large offsets can affect the result through floating-point precision.

C#
public float ScaleX { get; }

Gets the Y-axis scale measured from transformed unit points; the fixed coefficients normally yield 1, though large offsets can affect the result through floating-point precision.

C#
public float ScaleY { get; }

Methods

Compares the six matrix elements with the specified array using exact float equality.

C#
public bool Equals(float[] elements)
Parameters:elementsfloat[]

The six-element array to compare with this matrix.

Returns:

bool

true if all six values match; otherwise, false.

Exceptions: ArgumentException

elements does not contain exactly six values.

Determines whether the specified object is a RadMatrix with equal translation offsets.

C#
public override bool Equals(object obj)
Parameters:objobject

The object to compare with this matrix.

Returns:

bool

true when obj is a matrix with matching offsets; otherwise, false.

Overrides: ValueType.Equals(object)

Returns a hash code based on the fixed coefficients and translation offsets.

C#
public override int GetHashCode()
Returns:

int

A hash code for this matrix.

Overrides: ValueType.GetHashCode()

Combines this matrix with another by adding their translation offsets; order does not affect the result.

C#
public void Multiply(RadMatrix matrix, MatrixOrder order)
Parameters:matrixRadMatrix

The matrix whose offsets are added.

orderMatrixOrder

The multiplication order requested for the operation.

Combines this matrix with another by adding their translation offsets.

C#
public void Multiply(RadMatrix matrix)
Parameters:matrixRadMatrix

The matrix whose offsets are added.

Calculates the Euclidean distance between two points.

C#
public static float PointsDistance(PointF point1, PointF point2)
Parameters:point1PointF

The first point.

point2PointF

The second point.

Returns:

float

The distance between the points.

Resets both translation offsets to zero.

C#
public void Reset()

Attempts to rotate the matrix around the origin; the fixed linear coefficients mean this operation does not rotate transformed points.

C#
public void Rotate(float angle, MatrixOrder order)
Parameters:anglefloat

The requested rotation angle in degrees.

orderMatrixOrder

The multiplication order used to combine the transform.

Attempts to rotate the matrix around the origin; rotation is not retained by this implementation.

C#
public void Rotate(float angle)
Parameters:anglefloat

The requested rotation angle in degrees.

Computes and combines the translation offset for a rotation around the specified point. The requested rotation is not applied to transformed points.

C#
public void RotateAt(float angle, PointF origin, MatrixOrder order)
Parameters:anglefloat

The requested rotation angle in degrees.

originPointF

The point around which the offset is computed.

orderMatrixOrder

The multiplication order used to combine the offset.

Computes an offset for a rotation around the specified point; points are translated by the offset rather than rotated.

C#
public void RotateAt(float angle, PointF origin)
Parameters:anglefloat

The requested rotation angle in degrees.

originPointF

The point around which the offset is computed.

Attempts to scale the matrix; the fixed linear coefficients mean this operation does not scale transformed points.

C#
public void Scale(float scaleX, float scaleY, MatrixOrder order)
Parameters:scaleXfloat

The requested horizontal scale.

scaleYfloat

The requested vertical scale.

orderMatrixOrder

The multiplication order used to combine the transform.

Attempts to scale the matrix; scale coefficients are not retained by this implementation.

C#
public void Scale(float scaleX, float scaleY)
Parameters:scaleXfloat

The requested horizontal scale.

scaleYfloat

The requested vertical scale.

Returns a string containing this matrix's translation offsets.

C#
public override string ToString()
Returns:

string

The offsets in the form RadMatrix: Offset [DX, DY].

Overrides: ValueType.ToString()

Translates a point by this matrix's DX and DY offsets.

C#
public PointF TransformPoint(PointF point)
Parameters:pointPointF

The point to transform.

Returns:

PointF

The translated point.

Transforms each point in the array in place by applying this matrix's translation offsets.

C#
public void TransformPoints(PointF[] points)
Parameters:pointsPointF[]

The points to transform.

Translates the rectangle by applying the matrix offset to its top-left and bottom-right corners.

C#
public RectangleF TransformRectangle(RectangleF bounds)
Parameters:boundsRectangleF

The rectangle to transform.

Returns:

RectangleF

The translated rectangle.

Adds a translation to the matrix; the order does not change the result because only offsets are combined.

C#
public void Translate(float dx, float dy, MatrixOrder order)
Parameters:dxfloat

The horizontal offset to add.

dyfloat

The vertical offset to add.

orderMatrixOrder

The multiplication order requested for the operation.

Adds a translation to the matrix.

C#
public void Translate(float dx, float dy)
Parameters:dxfloat

The horizontal offset to add.

dyfloat

The vertical offset to add.

Operators

Determines whether two matrices have different translation offsets.

C#
public static bool operator !=(RadMatrix matrix1, RadMatrix matrix2)
Parameters:matrix1RadMatrix

The first matrix.

matrix2RadMatrix

The second matrix.

Returns:

bool

true when either offset differs; otherwise, false.

Combines two matrices by adding their translation offsets.

C#
public static RadMatrix operator *(RadMatrix matrix1, RadMatrix matrix2)
Parameters:matrix1RadMatrix

The first matrix.

matrix2RadMatrix

The second matrix.

Returns:

RadMatrix

A matrix with the sum of the input offsets.

Determines whether two matrices have equal translation offsets.

C#
public static bool operator ==(RadMatrix matrix1, RadMatrix matrix2)
Parameters:matrix1RadMatrix

The first matrix.

matrix2RadMatrix

The second matrix.

Returns:

bool

true when both offsets match; otherwise, false.