Implemented Matrix3x3::ForwardDir, BackwardDir, LeftDir, RightDir, UpDir, DownDir return normalized relative direction vectors.
This commit is contained in:
@@ -161,6 +161,14 @@ namespace J3ML::LinearAlgebra {
|
||||
/// Sets this matrix to perform the rotation expressed by the given quaternion.
|
||||
void SetRotatePart(const Quaternion& quat);
|
||||
|
||||
|
||||
Vector3 ForwardDir() const;
|
||||
Vector3 BackwardDir() const;
|
||||
Vector3 LeftDir() const;
|
||||
Vector3 RightDir() const;
|
||||
Vector3 UpDir() const;
|
||||
Vector3 DownDir() const;
|
||||
|
||||
/// Returns the given row.
|
||||
/** @param row The zero-based index [0, 2] of the row to get. */
|
||||
Vector3 GetRow(int index) const;
|
||||
|
@@ -1087,6 +1087,18 @@ namespace J3ML::LinearAlgebra {
|
||||
return m;
|
||||
}
|
||||
|
||||
Vector3 Matrix3x3::ForwardDir() const { return Col(2).Normalized(); }
|
||||
|
||||
Vector3 Matrix3x3::BackwardDir() const { return -Col(2).Normalized(); }
|
||||
|
||||
Vector3 Matrix3x3::LeftDir() const { return -Col(0).Normalized(); }
|
||||
|
||||
Vector3 Matrix3x3::RightDir() const { return Col(0).Normalized(); }
|
||||
|
||||
Vector3 Matrix3x3::UpDir() const { return Col(1).Normalized(); }
|
||||
|
||||
Vector3 Matrix3x3::DownDir() const { return -Col(1).Normalized(); }
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user