C# Класс Accord.Math.Matrix3x3

Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
V00 float
V01 float
V02 float
V10 float
V11 float
V12 float
V20 float
V21 float
V22 float

Открытые методы

Метод Описание
Add ( Matrix3x3 matrix1, Matrix3x3 matrix2 ) : Matrix3x3

Adds corresponding components of two matrices.

Add ( Matrix3x3 matrix, float value ) : Matrix3x3

Adds specified value to all components of the specified matrix.

Adjugate ( ) : Matrix3x3

Calculate adjugate of the matrix, adj(A).

CreateDiagonal ( Vector3 vector ) : Matrix3x3

Creates a diagonal matrix using the specified vector as diagonal elements.

CreateFromColumns ( Vector3 column0, Vector3 column1, Vector3 column2 ) : Matrix3x3

Creates a matrix from 3 columns specified as vectors.

CreateFromRows ( Vector3 row0, Vector3 row1, Vector3 row2 ) : Matrix3x3

Creates a matrix from 3 rows specified as vectors.

CreateFromYawPitchRoll ( float yaw, float pitch, float roll ) : Matrix3x3

Creates rotation matrix to rotate an object around X, Y and Z axes.

The routine assumes roll-pitch-yaw rotation order, when creating rotation matrix, i.e. an object is first rotated around Z axis, then around X axis and finally around Y axis.

CreateRotationX ( float radians ) : Matrix3x3

Creates rotation matrix around X axis.

CreateRotationY ( float radians ) : Matrix3x3

Creates rotation matrix around Y axis.

CreateRotationZ ( float radians ) : Matrix3x3

Creates rotation matrix around Z axis.

Equals ( Matrix3x3 matrix ) : bool

Tests whether the matrix equals to the specified one.

Equals ( Object obj ) : bool

Tests whether the matrix equals to the specified object.

ExtractYawPitchRoll ( float &yaw, float &pitch, float &roll ) : void

Extract rotation angles from the rotation matrix.

The routine assumes roll-pitch-yaw rotation order when extracting rotation angle. Using extracted angles with the CreateFromYawPitchRoll should provide same rotation matrix.

The method assumes the provided matrix represent valid rotation matrix.

Sample usage:

// assume we have a rotation matrix created like this float yaw = 10.0f / 180 * Math.PI; float pitch = 30.0f / 180 * Math.PI; float roll = 45.0f / 180 * Math.PI; Matrix3x3 rotationMatrix = Matrix3x3.CreateFromYawPitchRoll( yaw, pitch, roll ); // ... // now somewhere in the code you may want to get rotation // angles back from a matrix assuming same rotation order float extractedYaw; float extractedPitch; float extractedRoll; rotation.ExtractYawPitchRoll( out extractedYaw, out extractedPitch, out extractedRoll );
GetColumn ( int index ) : Vector3

Get column of the matrix.

GetHashCode ( ) : int

Returns the hashcode for this instance.

GetRow ( int index ) : Vector3

Get row of the matrix.

Inverse ( ) : Matrix3x3

Calculate inverse of the matrix, A-1.

Multiply ( Matrix3x3 matrix1, Matrix3x3 matrix2 ) : Matrix3x3

Multiplies two specified matrices.

Multiply ( Matrix3x3 matrix, float factor ) : Matrix3x3

Multiplies matrix by the specified factor.

Multiply ( Matrix3x3 matrix, Vector3 vector ) : Vector3

Multiplies specified matrix by the specified vector.

MultiplySelfByTranspose ( ) : Matrix3x3

Multiply the matrix by its transposition, A*AT.

MultiplyTransposeBySelf ( ) : Matrix3x3

Multiply transposition of this matrix by itself, AT*A.

PseudoInverse ( ) : Matrix3x3

Calculate pseudo inverse of the matrix, A+.

The pseudo inverse of the matrix is calculate through its SVD as V*E+*UT.

SVD ( Matrix3x3 &u, Vector3 &e, Matrix3x3 &v ) : void

Calculate Singular Value Decomposition (SVD) of the matrix, such as A=U*E*VT.

Having components U, E and V the source matrix can be reproduced using below code: Matrix3x3 source = u * Matrix3x3.Diagonal( e ) * v.Transpose( );

Subtract ( Matrix3x3 matrix1, Matrix3x3 matrix2 ) : Matrix3x3

Subtracts corresponding components of two matrices.

ToArray ( ) : float[]

Returns array representation of the matrix.

Transpose ( ) : Matrix3x3

Transpose the matrix, AT.

operator ( ) : Matrix3x3

Multiplies two specified matrices.

operator ( ) : Vector3

Multiplies specified matrix by the specified vector.

operator ( ) : bool

Tests whether two specified matrices are equal.

Описание методов

Add() публичный статический метод

Adds corresponding components of two matrices.
public static Add ( Matrix3x3 matrix1, Matrix3x3 matrix2 ) : Matrix3x3
matrix1 Matrix3x3 The matrix to add to.
matrix2 Matrix3x3 The matrix to add to the first matrix.
Результат Matrix3x3

Add() публичный статический метод

Adds specified value to all components of the specified matrix.
public static Add ( Matrix3x3 matrix, float value ) : Matrix3x3
matrix Matrix3x3 Matrix to add value to.
value float Value to add to all components of the specified matrix.
Результат Matrix3x3

Adjugate() публичный метод

Calculate adjugate of the matrix, adj(A).
public Adjugate ( ) : Matrix3x3
Результат Matrix3x3

CreateDiagonal() публичный статический метод

Creates a diagonal matrix using the specified vector as diagonal elements.
public static CreateDiagonal ( Vector3 vector ) : Matrix3x3
vector Vector3 Vector to use for diagonal elements of the matrix.
Результат Matrix3x3

CreateFromColumns() публичный статический метод

Creates a matrix from 3 columns specified as vectors.
public static CreateFromColumns ( Vector3 column0, Vector3 column1, Vector3 column2 ) : Matrix3x3
column0 Vector3 First column of the matrix to create.
column1 Vector3 Second column of the matrix to create.
column2 Vector3 Third column of the matrix to create.
Результат Matrix3x3

CreateFromRows() публичный статический метод

Creates a matrix from 3 rows specified as vectors.
public static CreateFromRows ( Vector3 row0, Vector3 row1, Vector3 row2 ) : Matrix3x3
row0 Vector3 First row of the matrix to create.
row1 Vector3 Second row of the matrix to create.
row2 Vector3 Third row of the matrix to create.
Результат Matrix3x3

CreateFromYawPitchRoll() публичный статический метод

Creates rotation matrix to rotate an object around X, Y and Z axes.

The routine assumes roll-pitch-yaw rotation order, when creating rotation matrix, i.e. an object is first rotated around Z axis, then around X axis and finally around Y axis.

public static CreateFromYawPitchRoll ( float yaw, float pitch, float roll ) : Matrix3x3
yaw float Rotation angle around Y axis in radians.
pitch float Rotation angle around X axis in radians.
roll float Rotation angle around Z axis in radians.
Результат Matrix3x3

CreateRotationX() публичный статический метод

Creates rotation matrix around X axis.
public static CreateRotationX ( float radians ) : Matrix3x3
radians float Rotation angle around X axis in radians.
Результат Matrix3x3

CreateRotationY() публичный статический метод

Creates rotation matrix around Y axis.
public static CreateRotationY ( float radians ) : Matrix3x3
radians float Rotation angle around Y axis in radians.
Результат Matrix3x3

CreateRotationZ() публичный статический метод

Creates rotation matrix around Z axis.
public static CreateRotationZ ( float radians ) : Matrix3x3
radians float Rotation angle around Z axis in radians.
Результат Matrix3x3

Equals() публичный метод

Tests whether the matrix equals to the specified one.
public Equals ( Matrix3x3 matrix ) : bool
matrix Matrix3x3 The matrix to test equality with.
Результат bool

Equals() публичный метод

Tests whether the matrix equals to the specified object.
public Equals ( Object obj ) : bool
obj Object The object to test equality with.
Результат bool

ExtractYawPitchRoll() публичный метод

Extract rotation angles from the rotation matrix.

The routine assumes roll-pitch-yaw rotation order when extracting rotation angle. Using extracted angles with the CreateFromYawPitchRoll should provide same rotation matrix.

The method assumes the provided matrix represent valid rotation matrix.

Sample usage:

// assume we have a rotation matrix created like this float yaw = 10.0f / 180 * Math.PI; float pitch = 30.0f / 180 * Math.PI; float roll = 45.0f / 180 * Math.PI; Matrix3x3 rotationMatrix = Matrix3x3.CreateFromYawPitchRoll( yaw, pitch, roll ); // ... // now somewhere in the code you may want to get rotation // angles back from a matrix assuming same rotation order float extractedYaw; float extractedPitch; float extractedRoll; rotation.ExtractYawPitchRoll( out extractedYaw, out extractedPitch, out extractedRoll );
public ExtractYawPitchRoll ( float &yaw, float &pitch, float &roll ) : void
yaw float Extracted rotation angle around Y axis in radians.
pitch float Extracted rotation angle around X axis in radians.
roll float Extracted rotation angle around Z axis in radians.
Результат void

GetColumn() публичный метод

Get column of the matrix.
Invalid column index was specified.
public GetColumn ( int index ) : Vector3
index int Column index to get, [0, 2].
Результат Vector3

GetHashCode() публичный метод

Returns the hashcode for this instance.
public GetHashCode ( ) : int
Результат int

GetRow() публичный метод

Get row of the matrix.
Invalid row index was specified.
public GetRow ( int index ) : Vector3
index int Row index to get, [0, 2].
Результат Vector3

Inverse() публичный метод

Calculate inverse of the matrix, A-1.
Cannot calculate inverse of the matrix since it is singular.
public Inverse ( ) : Matrix3x3
Результат Matrix3x3

Multiply() публичный статический метод

Multiplies two specified matrices.
public static Multiply ( Matrix3x3 matrix1, Matrix3x3 matrix2 ) : Matrix3x3
matrix1 Matrix3x3 Matrix to multiply.
matrix2 Matrix3x3 Matrix to multiply by.
Результат Matrix3x3

Multiply() публичный статический метод

Multiplies matrix by the specified factor.
public static Multiply ( Matrix3x3 matrix, float factor ) : Matrix3x3
matrix Matrix3x3 Matrix to multiply.
factor float Factor to multiple the specified matrix by.
Результат Matrix3x3

Multiply() публичный статический метод

Multiplies specified matrix by the specified vector.
public static Multiply ( Matrix3x3 matrix, Vector3 vector ) : Vector3
matrix Matrix3x3 Matrix to multiply by vector.
vector Vector3 Vector to multiply matrix by.
Результат Vector3

MultiplySelfByTranspose() публичный метод

Multiply the matrix by its transposition, A*AT.
public MultiplySelfByTranspose ( ) : Matrix3x3
Результат Matrix3x3

MultiplyTransposeBySelf() публичный метод

Multiply transposition of this matrix by itself, AT*A.
public MultiplyTransposeBySelf ( ) : Matrix3x3
Результат Matrix3x3

PseudoInverse() публичный метод

Calculate pseudo inverse of the matrix, A+.

The pseudo inverse of the matrix is calculate through its SVD as V*E+*UT.

public PseudoInverse ( ) : Matrix3x3
Результат Matrix3x3

SVD() публичный метод

Calculate Singular Value Decomposition (SVD) of the matrix, such as A=U*E*VT.

Having components U, E and V the source matrix can be reproduced using below code: Matrix3x3 source = u * Matrix3x3.Diagonal( e ) * v.Transpose( );

public SVD ( Matrix3x3 &u, Vector3 &e, Matrix3x3 &v ) : void
u Matrix3x3 Output parameter which gets 3x3 U matrix.
e Vector3 Output parameter which gets diagonal elements of the E matrix.
v Matrix3x3 Output parameter which gets 3x3 V matrix.
Результат void

Subtract() публичный статический метод

Subtracts corresponding components of two matrices.
public static Subtract ( Matrix3x3 matrix1, Matrix3x3 matrix2 ) : Matrix3x3
matrix1 Matrix3x3 The matrix to subtract from.
matrix2 Matrix3x3 The matrix to subtract from the first matrix.
Результат Matrix3x3

ToArray() публичный метод

Returns array representation of the matrix.
public ToArray ( ) : float[]
Результат float[]

Transpose() публичный метод

Transpose the matrix, AT.
public Transpose ( ) : Matrix3x3
Результат Matrix3x3

operator() публичный статический метод

Multiplies two specified matrices.
public static operator ( ) : Matrix3x3
Результат Matrix3x3

operator() публичный статический метод

Multiplies specified matrix by the specified vector.
public static operator ( ) : Vector3
Результат Vector3

operator() публичный статический метод

Tests whether two specified matrices are equal.
public static operator ( ) : bool
Результат bool

Описание свойств

V00 публичное свойство

Row 0 column 0 element of the matrix.
public float V00
Результат float

V01 публичное свойство

Row 0 column 1 element of the matrix.
public float V01
Результат float

V02 публичное свойство

Row 0 column 2 element of the matrix.
public float V02
Результат float

V10 публичное свойство

Row 1 column 0 element of the matrix.
public float V10
Результат float

V11 публичное свойство

Row 1 column 1 element of the matrix.
public float V11
Результат float

V12 публичное свойство

Row 1 column 2 element of the matrix.
public float V12
Результат float

V20 публичное свойство

Row 2 column 0 element of the matrix.
public float V20
Результат float

V21 публичное свойство

Row 2 column 1 element of the matrix.
public float V21
Результат float

V22 публичное свойство

Row 2 column 2 element of the matrix.
public float V22
Результат float