C# Class CryEngine.Matrix34

Mostrar archivo Open project: PoppermostProductions/CryMono Class Usage Examples

Private Properties

Property Type Description
IsOrthonormal int
Scale void
ScaleColumn void

Public Methods

Method Description
AddTranslation ( Vec3 t ) : Matrix34
Create ( Vec3 s, Quat q, Vec3 t = default(Vec3) ) : Matrix34
CreateFromVectors ( Vec3 vx, Vec3 vy, Vec3 vz, Vec3 pos ) : Matrix34
CreateIdentity ( ) : Matrix34
CreateRotationAA ( Vec3 rot, Vec3 t = default(Vec3) ) : Matrix34
CreateRotationAA ( float rad, Vec3 axis, Vec3 t = default(Vec3) ) : Matrix34
CreateRotationAA ( float c, float s, Vec3 axis, Vec3 t = default(Vec3) ) : Matrix34
CreateRotationX ( float rad, Vec3 t = default(Vec3) ) : Matrix34
CreateRotationXYZ ( Vec3 rad, Vec3 t = default(Vec3) ) : Matrix34
CreateRotationY ( float rad, Vec3 t = default(Vec3) ) : Matrix34
CreateRotationZ ( float rad, Vec3 t = default(Vec3) ) : Matrix34
CreateScale ( Vec3 s, Vec3 t = default(Vec3) ) : Matrix34
CreateSlerp ( Matrix34 m, Matrix34 n, float t ) : Matrix34
CreateTranslationMat ( Vec3 v ) : Matrix34
Determinant ( ) : float

determinant is ambiguous: only the upper-left-submatrix's determinant is calculated

GetHashCode ( ) : int
Invert ( ) : void
InvertFast ( ) : void
IsEquivalent ( Matrix34 m, float e = 0.05f ) : bool
IsOrthonormalRH ( float threshold = 0.001f ) : int
Matrix34 ( Matrix33 m33 ) : System
Matrix34 ( Vec3 s, Quat q, Vec3 t = default(Vec3) ) : System
Matrix34 ( float v00, float v01, float v02, float v03, float v10, float v11, float v12, float v13, float v20, float v21, float v22, float v23 ) : System
OrthonormalizeFast ( ) : void

Remove scale from matrix.

ScaleTranslation ( float s ) : void
Set ( Vec3 s, Quat q, Vec3 t = default(Vec3) ) : void
SetFromVectors ( Vec3 vx, Vec3 vy, Vec3 vz, Vec3 pos ) : void
SetIdentity ( ) : void
SetRotation33 ( Matrix33 m33 ) : void
SetRotationAA ( Vec3 rot, Vec3 t = default(Vec3) ) : void
SetRotationAA ( float rad, Vec3 axis, Vec3 t = default(Vec3) ) : void
SetRotationAA ( float c, float s, Vec3 axis, Vec3 t = default(Vec3) ) : void
SetRotationX ( float rad, Vec3 t = default(Vec3) ) : void
SetRotationXYZ ( Vec3 rad, Vec3 t = default(Vec3) ) : void
SetRotationY ( float rad, Vec3 t = default(Vec3) ) : void
SetRotationZ ( float rad, Vec3 t = default(Vec3) ) : void
SetScale ( Vec3 s, Vec3 t = default(Vec3) ) : void
SetSlerp ( Matrix34 m, Matrix34 n, float t ) : void

Direct-Matrix-Slerp: for the sake of completeness, I have included the following expression for Spherical-Linear-Interpolation without using quaternions. This is much faster then converting both matrices into quaternions in order to do a quaternion slerp and then converting the slerped quaternion back into a matrix. This is a high-precision calculation. Given two orthonormal 3x3 matrices this function calculates the shortest possible interpolation-path between the two rotations. The interpolation curve forms a great arc on the rotation sphere (geodesic). Not only does Slerp follow a great arc it follows the shortest great arc. Furthermore Slerp has constant angular velocity. All in all Slerp is the optimal interpolation curve between two rotations. STABILITY PROBLEM: There are two singularities at angle=0 and angle=PI. At 0 the interpolation-axis is arbitrary, which means any axis will produce the same result because we have no rotation. Thats why I'm using (1,0,0). At PI the rotations point away from each other and the interpolation-axis is unpredictable. In this case I'm also using the axis (1,0,0). If the angle is ~0 or ~PI, then we have to normalize a very small vector and this can cause numerical instability. The quaternion-slerp has exactly the same problems. Ivo

SetTranslation ( Vec3 t ) : void
SetTranslationMat ( Vec3 v ) : void
TransformPoint ( Vec3 p ) : Vec3

transforms a point and add translation vector

TransformVector ( Vec3 p ) : Vec3

transforms a vector. the translation is not beeing considered

operator ( ) : Matrix34

Private Methods

Method Description
IsOrthonormal ( float threshold = 0.001f ) : int

check if we have an orthonormal-base (general case, works even with reflection matrices)

Scale ( Vec3 s ) : void

apply scaling to matrix.

ScaleColumn ( Vec3 s ) : void

apply scaling to the columns of the matrix.

Method Details

AddTranslation() public method

public AddTranslation ( Vec3 t ) : Matrix34
t Vec3
return Matrix34

Create() public static method

public static Create ( Vec3 s, Quat q, Vec3 t = default(Vec3) ) : Matrix34
s Vec3
q Quat
t Vec3
return Matrix34

CreateFromVectors() public static method

public static CreateFromVectors ( Vec3 vx, Vec3 vy, Vec3 vz, Vec3 pos ) : Matrix34
vx Vec3
vy Vec3
vz Vec3
pos Vec3
return Matrix34

CreateIdentity() public static method

public static CreateIdentity ( ) : Matrix34
return Matrix34

CreateRotationAA() public static method

public static CreateRotationAA ( Vec3 rot, Vec3 t = default(Vec3) ) : Matrix34
rot Vec3
t Vec3
return Matrix34

CreateRotationAA() public static method

public static CreateRotationAA ( float rad, Vec3 axis, Vec3 t = default(Vec3) ) : Matrix34
rad float
axis Vec3
t Vec3
return Matrix34

CreateRotationAA() public static method

public static CreateRotationAA ( float c, float s, Vec3 axis, Vec3 t = default(Vec3) ) : Matrix34
c float
s float
axis Vec3
t Vec3
return Matrix34

CreateRotationX() public static method

public static CreateRotationX ( float rad, Vec3 t = default(Vec3) ) : Matrix34
rad float
t Vec3
return Matrix34

CreateRotationXYZ() public static method

public static CreateRotationXYZ ( Vec3 rad, Vec3 t = default(Vec3) ) : Matrix34
rad Vec3
t Vec3
return Matrix34

CreateRotationY() public static method

public static CreateRotationY ( float rad, Vec3 t = default(Vec3) ) : Matrix34
rad float
t Vec3
return Matrix34

CreateRotationZ() public static method

public static CreateRotationZ ( float rad, Vec3 t = default(Vec3) ) : Matrix34
rad float
t Vec3
return Matrix34

CreateScale() public static method

public static CreateScale ( Vec3 s, Vec3 t = default(Vec3) ) : Matrix34
s Vec3
t Vec3
return Matrix34

CreateSlerp() public static method

public static CreateSlerp ( Matrix34 m, Matrix34 n, float t ) : Matrix34
m Matrix34
n Matrix34
t float
return Matrix34

CreateTranslationMat() public static method

public static CreateTranslationMat ( Vec3 v ) : Matrix34
v Vec3
return Matrix34

Determinant() public method

determinant is ambiguous: only the upper-left-submatrix's determinant is calculated
public Determinant ( ) : float
return float

GetHashCode() public method

public GetHashCode ( ) : int
return int

Invert() public method

public Invert ( ) : void
return void

InvertFast() public method

public InvertFast ( ) : void
return void

IsEquivalent() public method

public IsEquivalent ( Matrix34 m, float e = 0.05f ) : bool
m Matrix34
e float
return bool

IsOrthonormalRH() public method

public IsOrthonormalRH ( float threshold = 0.001f ) : int
threshold float
return int

Matrix34() public method

public Matrix34 ( Matrix33 m33 ) : System
m33 Matrix33
return System

Matrix34() public method

public Matrix34 ( Vec3 s, Quat q, Vec3 t = default(Vec3) ) : System
s Vec3
q Quat
t Vec3
return System

Matrix34() public method

public Matrix34 ( float v00, float v01, float v02, float v03, float v10, float v11, float v12, float v13, float v20, float v21, float v22, float v23 ) : System
v00 float
v01 float
v02 float
v03 float
v10 float
v11 float
v12 float
v13 float
v20 float
v21 float
v22 float
v23 float
return System

OrthonormalizeFast() public method

Remove scale from matrix.
public OrthonormalizeFast ( ) : void
return void

ScaleTranslation() public method

public ScaleTranslation ( float s ) : void
s float
return void

Set() public method

public Set ( Vec3 s, Quat q, Vec3 t = default(Vec3) ) : void
s Vec3
q Quat
t Vec3
return void

SetFromVectors() public method

public SetFromVectors ( Vec3 vx, Vec3 vy, Vec3 vz, Vec3 pos ) : void
vx Vec3
vy Vec3
vz Vec3
pos Vec3
return void

SetIdentity() public method

public SetIdentity ( ) : void
return void

SetRotation33() public method

public SetRotation33 ( Matrix33 m33 ) : void
m33 Matrix33
return void

SetRotationAA() public method

public SetRotationAA ( Vec3 rot, Vec3 t = default(Vec3) ) : void
rot Vec3
t Vec3
return void

SetRotationAA() public method

public SetRotationAA ( float rad, Vec3 axis, Vec3 t = default(Vec3) ) : void
rad float
axis Vec3
t Vec3
return void

SetRotationAA() public method

public SetRotationAA ( float c, float s, Vec3 axis, Vec3 t = default(Vec3) ) : void
c float
s float
axis Vec3
t Vec3
return void

SetRotationX() public method

public SetRotationX ( float rad, Vec3 t = default(Vec3) ) : void
rad float
t Vec3
return void

SetRotationXYZ() public method

public SetRotationXYZ ( Vec3 rad, Vec3 t = default(Vec3) ) : void
rad Vec3
t Vec3
return void

SetRotationY() public method

public SetRotationY ( float rad, Vec3 t = default(Vec3) ) : void
rad float
t Vec3
return void

SetRotationZ() public method

public SetRotationZ ( float rad, Vec3 t = default(Vec3) ) : void
rad float
t Vec3
return void

SetScale() public method

public SetScale ( Vec3 s, Vec3 t = default(Vec3) ) : void
s Vec3
t Vec3
return void

SetSlerp() public method

Direct-Matrix-Slerp: for the sake of completeness, I have included the following expression for Spherical-Linear-Interpolation without using quaternions. This is much faster then converting both matrices into quaternions in order to do a quaternion slerp and then converting the slerped quaternion back into a matrix. This is a high-precision calculation. Given two orthonormal 3x3 matrices this function calculates the shortest possible interpolation-path between the two rotations. The interpolation curve forms a great arc on the rotation sphere (geodesic). Not only does Slerp follow a great arc it follows the shortest great arc. Furthermore Slerp has constant angular velocity. All in all Slerp is the optimal interpolation curve between two rotations. STABILITY PROBLEM: There are two singularities at angle=0 and angle=PI. At 0 the interpolation-axis is arbitrary, which means any axis will produce the same result because we have no rotation. Thats why I'm using (1,0,0). At PI the rotations point away from each other and the interpolation-axis is unpredictable. In this case I'm also using the axis (1,0,0). If the angle is ~0 or ~PI, then we have to normalize a very small vector and this can cause numerical instability. The quaternion-slerp has exactly the same problems. Ivo
public SetSlerp ( Matrix34 m, Matrix34 n, float t ) : void
m Matrix34
n Matrix34
t float
return void

SetTranslation() public method

public SetTranslation ( Vec3 t ) : void
t Vec3
return void

SetTranslationMat() public method

public SetTranslationMat ( Vec3 v ) : void
v Vec3
return void

TransformPoint() public method

transforms a point and add translation vector
public TransformPoint ( Vec3 p ) : Vec3
p Vec3
return Vec3

TransformVector() public method

transforms a vector. the translation is not beeing considered
public TransformVector ( Vec3 p ) : Vec3
p Vec3
return Vec3

operator() public static method

public static operator ( ) : Matrix34
return Matrix34