M&B: Bannerlord 1.2.9
The horns sound, the ravens gather.
Loading...
Searching...
No Matches
TaleWorlds.Library.Mat3 Struct Reference

3x3 Matrix class for 3d graphics.

Public Member Functions

 Mat3 (Vec3 s, Vec3 f, Vec3 u)
 Initializes a new instance of matrix.
 
 Mat3 (float sx, float sy, float sz, float fx, float fy, float fz, float ux, float uy, float uz)
 Initializes a new instance of matrix.
 
void RotateAboutSide (float a)
 Rotates about side/x-axis. Applies pitch rotation.
 
void RotateAboutForward (float a)
 Rotates about forward/y-axis. Applies roll rotation.
 
void RotateAboutUp (float a)
 Rotates about up/z-axis. Applies yaw rotation.
 
void RotateAboutAnArbitraryVector (Vec3 v, float a)
 Rotates about the param vector.
 
bool IsOrthonormal ()
 Determines whether the matrix is orthonormal.
 
bool IsLeftHanded ()
 
bool NearlyEquals (Mat3 rhs, float epsilon=MBMath.Epsilon)
 
Vec3 TransformToParent (Vec3 v)
 Transforms vector to parent frame.
 
Vec3 TransformToParent (ref Vec3 v)
 
Vec3 TransformToLocal (Vec3 v)
 Transforms vector to local frame.
 
Mat3 TransformToParent (Mat3 m)
 Transforms matrix to parent frame.
 
Mat3 TransformToLocal (Mat3 m)
 Transforms matrix to local frame.
 
void Orthonormalize ()
 Orthonormalizes the matrix.
 
void OrthonormalizeAccordingToForwardAndKeepUpAsZAxis ()
 
Mat3 GetUnitRotation (float removedScale)
 
Vec3 MakeUnit ()
 
bool IsUnit ()
 
void ApplyScaleLocal (float scaleAmount)
 Scales the matrix by scaleAmount.
 
void ApplyScaleLocal (Vec3 scaleAmountXYZ)
 Scales the matrix by scaleAmountXYZ vector.
 
bool HasScale ()
 
Vec3 GetScaleVector ()
 Get scale amounts of each component.
 
Vec3 GetScaleVectorSquared ()
 Get scale squared amounts of each component.
 
void ToQuaternion (out Quaternion quat)
 
Quaternion ToQuaternion ()
 
Vec3 GetEulerAngles ()
 Calculates the angular orientation of the matrix with respect to XYZ axes.
 
Mat3 Transpose ()
 Create a transposed matrix.
 
override string ToString ()
 Creates readable string representation.
 
override bool Equals (object obj)
 Determines whether the specified generic object is equal to this instance.
 
override int GetHashCode ()
 Returns a hash code for this instance.
 
bool IsIdentity ()
 
bool IsZero ()
 
bool IsUniformScaled ()
 
void ApplyEulerAngles (Vec3 eulerAngles)
 

Static Public Member Functions

static Mat3 Lerp (Mat3 m1, Mat3 m2, float alpha)
 
static Mat3 CreateMat3WithForward (in Vec3 direction)
 Creates a new rotation matrix which has its forward axis aligned with the given direction. Uses global up vector (0,0,1) if global up is not aligned with the given direction to determine perpendicular frame directions If global up and direction are aligned, uses the global forward vector (0,1,0) for the same purpose.
 
static Mat3 operator* (Mat3 v, float a)
 Implements matrix scalar product.
 
static bool operator== (Mat3 m1, Mat3 m2)
 Implements the operator ==.
 
static bool operator!= (Mat3 m1, Mat3 m2)
 Implements the operator !=.
 

Public Attributes

Vec3 s
 Side vector, also x axis.
 
Vec3 f
 Forward vector, also y axis.
 
Vec3 u
 Up vector, also z axis.
 

Properties

Vec3 this[int i] [get, set]
 Implements indexer operation.
 
static Mat3 Identity [get]
 Returns a identity matrix.
 

Constructor & Destructor Documentation

◆ Mat3() [1/2]

TaleWorlds.Library.Mat3.Mat3 ( Vec3 s,
Vec3 f,
Vec3 u )
Parameters
sThe side axis.
fThe forward axis.
uThe up axis.

◆ Mat3() [2/2]

TaleWorlds.Library.Mat3.Mat3 ( float sx,
float sy,
float sz,
float fx,
float fy,
float fz,
float ux,
float uy,
float uz )
Parameters
sxThe side.x.
syThe side.y.
szThe side.z.
fxThe forward.x.
fyThe forward.y.
fzThe forward.z.
uxThe up.x.
uyThe up.y.
uzThe up.z.

Member Function Documentation

◆ RotateAboutSide()

void TaleWorlds.Library.Mat3.RotateAboutSide ( float a)
Parameters
aThe amount, in radians, in which to rotate around the x-axis.

◆ RotateAboutForward()

void TaleWorlds.Library.Mat3.RotateAboutForward ( float a)
Parameters
aThe amount, in radians, in which to rotate around the y-axis.

◆ RotateAboutUp()

void TaleWorlds.Library.Mat3.RotateAboutUp ( float a)
Parameters
aThe amount, in radians, in which to rotate around the z-axis.

◆ RotateAboutAnArbitraryVector()

void TaleWorlds.Library.Mat3.RotateAboutAnArbitraryVector ( Vec3 v,
float a )
Parameters
vThe vector to be rotated about.
aThe amount, in radians, in which to rotate around the param vector.

◆ IsOrthonormal()

bool TaleWorlds.Library.Mat3.IsOrthonormal ( )
Returns
true if the matrix is orthonormal; otherwise, false.

◆ IsLeftHanded()

bool TaleWorlds.Library.Mat3.IsLeftHanded ( )

◆ NearlyEquals()

bool TaleWorlds.Library.Mat3.NearlyEquals ( Mat3 rhs,
float epsilon = MBMath::Epsilon )

◆ TransformToParent() [1/3]

Vec3 TaleWorlds.Library.Mat3.TransformToParent ( Vec3 v)
Parameters
vVector in local frame.
Returns
Vector in parent frame.

◆ TransformToParent() [2/3]

Vec3 TaleWorlds.Library.Mat3.TransformToParent ( ref Vec3 v)

◆ TransformToLocal() [1/2]

Vec3 TaleWorlds.Library.Mat3.TransformToLocal ( Vec3 v)
Parameters
vVector in parent frame.
Returns
Vector in local frame.

◆ TransformToParent() [3/3]

Mat3 TaleWorlds.Library.Mat3.TransformToParent ( Mat3 m)
Parameters
mMatrix in local frame.
Returns
Matrix in parent frame.

◆ TransformToLocal() [2/2]

Mat3 TaleWorlds.Library.Mat3.TransformToLocal ( Mat3 m)
Parameters
mMatrix in parent frame.
Returns
Matrix in local frame.

◆ Orthonormalize()

void TaleWorlds.Library.Mat3.Orthonormalize ( )

◆ OrthonormalizeAccordingToForwardAndKeepUpAsZAxis()

void TaleWorlds.Library.Mat3.OrthonormalizeAccordingToForwardAndKeepUpAsZAxis ( )

◆ GetUnitRotation()

Mat3 TaleWorlds.Library.Mat3.GetUnitRotation ( float removedScale)

◆ MakeUnit()

Vec3 TaleWorlds.Library.Mat3.MakeUnit ( )

◆ IsUnit()

bool TaleWorlds.Library.Mat3.IsUnit ( )

◆ ApplyScaleLocal() [1/2]

void TaleWorlds.Library.Mat3.ApplyScaleLocal ( float scaleAmount)
Parameters
scaleAmountThe scale amount.

◆ ApplyScaleLocal() [2/2]

void TaleWorlds.Library.Mat3.ApplyScaleLocal ( Vec3 scaleAmountXYZ)
Parameters
scaleAmountXYZThe scale amount.

◆ HasScale()

bool TaleWorlds.Library.Mat3.HasScale ( )

◆ GetScaleVector()

Vec3 TaleWorlds.Library.Mat3.GetScaleVector ( )

◆ GetScaleVectorSquared()

Vec3 TaleWorlds.Library.Mat3.GetScaleVectorSquared ( )

◆ ToQuaternion() [1/2]

void TaleWorlds.Library.Mat3.ToQuaternion ( out Quaternion quat)

◆ ToQuaternion() [2/2]

Quaternion TaleWorlds.Library.Mat3.ToQuaternion ( )

◆ Lerp()

static Mat3 TaleWorlds.Library.Mat3.Lerp ( Mat3 m1,
Mat3 m2,
float alpha )
static

◆ CreateMat3WithForward()

static Mat3 TaleWorlds.Library.Mat3.CreateMat3WithForward ( in Vec3 direction)
static
Parameters
directionIs the forward direction.

◆ GetEulerAngles()

Vec3 TaleWorlds.Library.Mat3.GetEulerAngles ( )
Returns
Each axis's rotation angle is wrapped in the vector's corresponding component.

◆ Transpose()

Mat3 TaleWorlds.Library.Mat3.Transpose ( )
Returns

◆ operator*()

static Mat3 TaleWorlds.Library.Mat3.operator* ( Mat3 v,
float a )
static
Parameters
vThe matrix.
aScalar.
Returns
The result of the operator.

◆ operator==()

static bool TaleWorlds.Library.Mat3.operator== ( Mat3 m1,
Mat3 m2 )
static
Parameters
m1The m1.
m2The m2.
Returns
The result of the operator.

◆ operator!=()

static bool TaleWorlds.Library.Mat3.operator!= ( Mat3 m1,
Mat3 m2 )
static
Parameters
m1The m1.
m2The m2.
Returns
The result of the operator.

◆ ToString()

override string TaleWorlds.Library.Mat3.ToString ( )
Returns
Output string

◆ Equals()

override bool TaleWorlds.Library.Mat3.Equals ( object obj)
Parameters
objThe generic object to compare with this instance.
Returns
true if the specified generic object is equal to this instance; otherwise, false.

◆ GetHashCode()

override int TaleWorlds.Library.Mat3.GetHashCode ( )
Returns
A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.

◆ IsIdentity()

bool TaleWorlds.Library.Mat3.IsIdentity ( )

◆ IsZero()

bool TaleWorlds.Library.Mat3.IsZero ( )

◆ IsUniformScaled()

bool TaleWorlds.Library.Mat3.IsUniformScaled ( )

◆ ApplyEulerAngles()

void TaleWorlds.Library.Mat3.ApplyEulerAngles ( Vec3 eulerAngles)

Member Data Documentation

◆ s

Vec3 TaleWorlds.Library.Mat3.s

◆ f

Vec3 TaleWorlds.Library.Mat3.f

◆ u

Vec3 TaleWorlds.Library.Mat3.u

Property Documentation

◆ this[int i]

Vec3 TaleWorlds.Library.Mat3.this[int i]
getset

return s if i = 0 return f if i = 1 return u if i = 2

◆ Identity

Mat3 TaleWorlds.Library.Mat3.Identity
staticget
Returns