C# 클래스 Accord.Math.Matrix4x4

파일 보기 프로젝트 열기: accord-net/framework 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
V00 float
V01 float
V02 float
V03 float
V10 float
V11 float
V12 float
V13 float
V20 float
V21 float
V22 float
V23 float
V30 float
V31 float
V32 float
V33 float

공개 메소드들

메소드 설명
Add ( Matrix4x4 matrix1, Matrix4x4 matrix2 ) : Matrix4x4

Adds corresponding components of two matrices.

CreateDiagonal ( Vector4 vector ) : Matrix4x4

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

CreateFromColumns ( Vector4 column0, Vector4 column1, Vector4 column2, Vector4 column3 ) : Matrix4x4

Creates a matrix from 4 columns specified as vectors.

CreateFromRotation ( Matrix3x3 rotationMatrix ) : Matrix4x4

Creates 4x4 tranformation matrix from 3x3 rotation matrix.

The source 3x3 rotation matrix is copied into the top left corner of the result 4x4 matrix, i.e. it represents 0th, 1st and 2nd row/column. The V33 element is set to 1 and the rest elements of 3rd row and 3rd column are set to zeros.

CreateFromRows ( Vector4 row0, Vector4 row1, Vector4 row2, Vector4 row3 ) : Matrix4x4

Creates a matrix from 4 rows specified as vectors.

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

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.

CreateLookAt ( Vector3 cameraPosition, Vector3 cameraTarget ) : Matrix4x4

Creates a view matrix for the specified camera position and target point.

Camera's "up" vector is supposed to be (0, 1, 0).

CreatePerspective ( float width, float height, float nearPlaneDistance, float farPlaneDistance ) : Matrix4x4

Creates a perspective projection matrix.

CreateRotationX ( float radians ) : Matrix4x4

Creates rotation matrix around X axis.

CreateRotationY ( float radians ) : Matrix4x4

Creates rotation matrix around Y axis.

CreateRotationZ ( float radians ) : Matrix4x4

Creates rotation matrix around Z axis.

CreateTranslation ( Vector3 position ) : Matrix4x4

Creates translation matrix for the specified movement amount.

The specified vector is copied to the 3rd column of the result matrix. All diagonal elements are set to 1. The rest of matrix is initialized with zeros.

Equals ( Matrix4x4 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; Matrix4x4 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 ) : Vector4

Get column of the matrix.

GetHashCode ( ) : int

Returns the hashcode for this instance.

GetRow ( int index ) : Vector4

Get row of the matrix.

Multiply ( Matrix4x4 matrix1, Matrix4x4 matrix2 ) : Matrix4x4

Multiplies two specified matrices.

Multiply ( Matrix4x4 matrix, Vector4 vector ) : Vector4

Multiplies specified matrix by the specified vector.

Subtract ( Matrix4x4 matrix1, Matrix4x4 matrix2 ) : Matrix4x4

Subtracts corresponding components of two matrices.

ToArray ( ) : float[]

Returns array representation of the matrix.

operator ( ) : Matrix4x4

Multiplies two specified matrices.

operator ( ) : Vector4

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 ( Matrix4x4 matrix1, Matrix4x4 matrix2 ) : Matrix4x4
matrix1 Matrix4x4 The matrix to add to.
matrix2 Matrix4x4 The matrix to add to the first matrix.
리턴 Matrix4x4

CreateDiagonal() 공개 정적인 메소드

Creates a diagonal matrix using the specified vector as diagonal elements.
public static CreateDiagonal ( Vector4 vector ) : Matrix4x4
vector Vector4 Vector to use for diagonal elements of the matrix.
리턴 Matrix4x4

CreateFromColumns() 공개 정적인 메소드

Creates a matrix from 4 columns specified as vectors.
public static CreateFromColumns ( Vector4 column0, Vector4 column1, Vector4 column2, Vector4 column3 ) : Matrix4x4
column0 Vector4 First column of the matrix to create.
column1 Vector4 Second column of the matrix to create.
column2 Vector4 Third column of the matrix to create.
column3 Vector4 Fourth column of the matrix to create.
리턴 Matrix4x4

CreateFromRotation() 공개 정적인 메소드

Creates 4x4 tranformation matrix from 3x3 rotation matrix.

The source 3x3 rotation matrix is copied into the top left corner of the result 4x4 matrix, i.e. it represents 0th, 1st and 2nd row/column. The V33 element is set to 1 and the rest elements of 3rd row and 3rd column are set to zeros.

public static CreateFromRotation ( Matrix3x3 rotationMatrix ) : Matrix4x4
rotationMatrix Matrix3x3 Source 3x3 rotation matrix.
리턴 Matrix4x4

CreateFromRows() 공개 정적인 메소드

Creates a matrix from 4 rows specified as vectors.
public static CreateFromRows ( Vector4 row0, Vector4 row1, Vector4 row2, Vector4 row3 ) : Matrix4x4
row0 Vector4 First row of the matrix to create.
row1 Vector4 Second row of the matrix to create.
row2 Vector4 Third row of the matrix to create.
row3 Vector4 Fourth row of the matrix to create.
리턴 Matrix4x4

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 ) : Matrix4x4
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.
리턴 Matrix4x4

CreateLookAt() 공개 정적인 메소드

Creates a view matrix for the specified camera position and target point.

Camera's "up" vector is supposed to be (0, 1, 0).

public static CreateLookAt ( Vector3 cameraPosition, Vector3 cameraTarget ) : Matrix4x4
cameraPosition Vector3 Position of camera.
cameraTarget Vector3 Target point towards which camera is pointing.
리턴 Matrix4x4

CreatePerspective() 공개 정적인 메소드

Creates a perspective projection matrix.
Both near and far view planes' distances must be greater than zero. Near plane must be closer than the far plane.
public static CreatePerspective ( float width, float height, float nearPlaneDistance, float farPlaneDistance ) : Matrix4x4
width float Width of the view volume at the near view plane.
height float Height of the view volume at the near view plane.
nearPlaneDistance float Distance to the near view plane.
farPlaneDistance float Distance to the far view plane.
리턴 Matrix4x4

CreateRotationX() 공개 정적인 메소드

Creates rotation matrix around X axis.
public static CreateRotationX ( float radians ) : Matrix4x4
radians float Rotation angle around X axis in radians.
리턴 Matrix4x4

CreateRotationY() 공개 정적인 메소드

Creates rotation matrix around Y axis.
public static CreateRotationY ( float radians ) : Matrix4x4
radians float Rotation angle around Y axis in radians.
리턴 Matrix4x4

CreateRotationZ() 공개 정적인 메소드

Creates rotation matrix around Z axis.
public static CreateRotationZ ( float radians ) : Matrix4x4
radians float Rotation angle around Z axis in radians.
리턴 Matrix4x4

CreateTranslation() 공개 정적인 메소드

Creates translation matrix for the specified movement amount.

The specified vector is copied to the 3rd column of the result matrix. All diagonal elements are set to 1. The rest of matrix is initialized with zeros.

public static CreateTranslation ( Vector3 position ) : Matrix4x4
position Vector3 Vector which set direction and amount of movement.
리턴 Matrix4x4

Equals() 공개 메소드

Tests whether the matrix equals to the specified one.
public Equals ( Matrix4x4 matrix ) : bool
matrix Matrix4x4 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; Matrix4x4 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 ) : Vector4
index int Column index to get, [0, 3].
리턴 Vector4

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 ) : Vector4
index int Row index to get, [0, 3].
리턴 Vector4

Multiply() 공개 정적인 메소드

Multiplies two specified matrices.
public static Multiply ( Matrix4x4 matrix1, Matrix4x4 matrix2 ) : Matrix4x4
matrix1 Matrix4x4 Matrix to multiply.
matrix2 Matrix4x4 Matrix to multiply by.
리턴 Matrix4x4

Multiply() 공개 정적인 메소드

Multiplies specified matrix by the specified vector.
public static Multiply ( Matrix4x4 matrix, Vector4 vector ) : Vector4
matrix Matrix4x4 Matrix to multiply by vector.
vector Vector4 Vector to multiply matrix by.
리턴 Vector4

Subtract() 공개 정적인 메소드

Subtracts corresponding components of two matrices.
public static Subtract ( Matrix4x4 matrix1, Matrix4x4 matrix2 ) : Matrix4x4
matrix1 Matrix4x4 The matrix to subtract from.
matrix2 Matrix4x4 The matrix to subtract from the first matrix.
리턴 Matrix4x4

ToArray() 공개 메소드

Returns array representation of the matrix.
public ToArray ( ) : float[]
리턴 float[]

operator() 공개 정적인 메소드

Multiplies two specified matrices.
public static operator ( ) : Matrix4x4
리턴 Matrix4x4

operator() 공개 정적인 메소드

Multiplies specified matrix by the specified vector.
public static operator ( ) : Vector4
리턴 Vector4

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

V03 공개적으로 프로퍼티

Row 0 column 3 element of the matrix.
public float V03
리턴 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

V13 공개적으로 프로퍼티

Row 1 column 3 element of the matrix.
public float V13
리턴 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

V23 공개적으로 프로퍼티

Row 2 column 3 element of the matrix.
public float V23
리턴 float

V30 공개적으로 프로퍼티

Row 3 column 0 element of the matrix.
public float V30
리턴 float

V31 공개적으로 프로퍼티

Row 3 column 1 element of the matrix.
public float V31
리턴 float

V32 공개적으로 프로퍼티

Row 3 column 2 element of the matrix.
public float V32
리턴 float

V33 공개적으로 프로퍼티

Row 3 column 3 element of the matrix.
public float V33
리턴 float