C# Class CryEngine.Matrix34

Afficher le fichier Open project: PoppermostProductions/CryMono Class Usage Examples

Private Properties

Свойство Type Description
IsOrthonormal int
Scale void
ScaleColumn void

Méthodes publiques

Méthode 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

Méthode 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 méthode

public AddTranslation ( Vec3 t ) : Matrix34
t Vec3
Résultat Matrix34

Create() public static méthode

public static Create ( Vec3 s, Quat q, Vec3 t = default(Vec3) ) : Matrix34
s Vec3
q Quat
t Vec3
Résultat Matrix34

CreateFromVectors() public static méthode

public static CreateFromVectors ( Vec3 vx, Vec3 vy, Vec3 vz, Vec3 pos ) : Matrix34
vx Vec3
vy Vec3
vz Vec3
pos Vec3
Résultat Matrix34

CreateIdentity() public static méthode

public static CreateIdentity ( ) : Matrix34
Résultat Matrix34

CreateRotationAA() public static méthode

public static CreateRotationAA ( Vec3 rot, Vec3 t = default(Vec3) ) : Matrix34
rot Vec3
t Vec3
Résultat Matrix34

CreateRotationAA() public static méthode

public static CreateRotationAA ( float rad, Vec3 axis, Vec3 t = default(Vec3) ) : Matrix34
rad float
axis Vec3
t Vec3
Résultat Matrix34

CreateRotationAA() public static méthode

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

CreateRotationX() public static méthode

public static CreateRotationX ( float rad, Vec3 t = default(Vec3) ) : Matrix34
rad float
t Vec3
Résultat Matrix34

CreateRotationXYZ() public static méthode

public static CreateRotationXYZ ( Vec3 rad, Vec3 t = default(Vec3) ) : Matrix34
rad Vec3
t Vec3
Résultat Matrix34

CreateRotationY() public static méthode

public static CreateRotationY ( float rad, Vec3 t = default(Vec3) ) : Matrix34
rad float
t Vec3
Résultat Matrix34

CreateRotationZ() public static méthode

public static CreateRotationZ ( float rad, Vec3 t = default(Vec3) ) : Matrix34
rad float
t Vec3
Résultat Matrix34

CreateScale() public static méthode

public static CreateScale ( Vec3 s, Vec3 t = default(Vec3) ) : Matrix34
s Vec3
t Vec3
Résultat Matrix34

CreateSlerp() public static méthode

public static CreateSlerp ( Matrix34 m, Matrix34 n, float t ) : Matrix34
m Matrix34
n Matrix34
t float
Résultat Matrix34

CreateTranslationMat() public static méthode

public static CreateTranslationMat ( Vec3 v ) : Matrix34
v Vec3
Résultat Matrix34

Determinant() public méthode

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

GetHashCode() public méthode

public GetHashCode ( ) : int
Résultat int

Invert() public méthode

public Invert ( ) : void
Résultat void

InvertFast() public méthode

public InvertFast ( ) : void
Résultat void

IsEquivalent() public méthode

public IsEquivalent ( Matrix34 m, float e = 0.05f ) : bool
m Matrix34
e float
Résultat bool

IsOrthonormalRH() public méthode

public IsOrthonormalRH ( float threshold = 0.001f ) : int
threshold float
Résultat int

Matrix34() public méthode

public Matrix34 ( Matrix33 m33 ) : System
m33 Matrix33
Résultat System

Matrix34() public méthode

public Matrix34 ( Vec3 s, Quat q, Vec3 t = default(Vec3) ) : System
s Vec3
q Quat
t Vec3
Résultat System

Matrix34() public méthode

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
Résultat System

OrthonormalizeFast() public méthode

Remove scale from matrix.
public OrthonormalizeFast ( ) : void
Résultat void

ScaleTranslation() public méthode

public ScaleTranslation ( float s ) : void
s float
Résultat void

Set() public méthode

public Set ( Vec3 s, Quat q, Vec3 t = default(Vec3) ) : void
s Vec3
q Quat
t Vec3
Résultat void

SetFromVectors() public méthode

public SetFromVectors ( Vec3 vx, Vec3 vy, Vec3 vz, Vec3 pos ) : void
vx Vec3
vy Vec3
vz Vec3
pos Vec3
Résultat void

SetIdentity() public méthode

public SetIdentity ( ) : void
Résultat void

SetRotation33() public méthode

public SetRotation33 ( Matrix33 m33 ) : void
m33 Matrix33
Résultat void

SetRotationAA() public méthode

public SetRotationAA ( Vec3 rot, Vec3 t = default(Vec3) ) : void
rot Vec3
t Vec3
Résultat void

SetRotationAA() public méthode

public SetRotationAA ( float rad, Vec3 axis, Vec3 t = default(Vec3) ) : void
rad float
axis Vec3
t Vec3
Résultat void

SetRotationAA() public méthode

public SetRotationAA ( float c, float s, Vec3 axis, Vec3 t = default(Vec3) ) : void
c float
s float
axis Vec3
t Vec3
Résultat void

SetRotationX() public méthode

public SetRotationX ( float rad, Vec3 t = default(Vec3) ) : void
rad float
t Vec3
Résultat void

SetRotationXYZ() public méthode

public SetRotationXYZ ( Vec3 rad, Vec3 t = default(Vec3) ) : void
rad Vec3
t Vec3
Résultat void

SetRotationY() public méthode

public SetRotationY ( float rad, Vec3 t = default(Vec3) ) : void
rad float
t Vec3
Résultat void

SetRotationZ() public méthode

public SetRotationZ ( float rad, Vec3 t = default(Vec3) ) : void
rad float
t Vec3
Résultat void

SetScale() public méthode

public SetScale ( Vec3 s, Vec3 t = default(Vec3) ) : void
s Vec3
t Vec3
Résultat void

SetSlerp() public méthode

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
Résultat void

SetTranslation() public méthode

public SetTranslation ( Vec3 t ) : void
t Vec3
Résultat void

SetTranslationMat() public méthode

public SetTranslationMat ( Vec3 v ) : void
v Vec3
Résultat void

TransformPoint() public méthode

transforms a point and add translation vector
public TransformPoint ( Vec3 p ) : Vec3
p Vec3
Résultat Vec3

TransformVector() public méthode

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

operator() public static méthode

public static operator ( ) : Matrix34
Résultat Matrix34