34 lines
983 B
C++
34 lines
983 B
C++
#pragma once
|
|
|
|
#include <J3ML/LinearAlgebra.h>
|
|
|
|
|
|
|
|
namespace LinearAlgebra {
|
|
/// A 4-by-4 matrix for affine transformations and perspective projections of 3D geometry.
|
|
/* This matrix can represent the most generic form of transformations for 3D objects,
|
|
* including perspective projections, which a 4-by-3 cannot store,
|
|
* and translations, which a 3-by-3 cannot represent.
|
|
* The elements of this matrix are
|
|
* m_00, m_01, m_02, m_03
|
|
* m_10, m_11, m_12, m_13
|
|
* m_20, m_21, m_22, m_23,
|
|
* m_30, m_31, m_32, m_33
|
|
*
|
|
* The element m_yx is the value on the row y and column x.
|
|
* You can access m_yx using the double-bracket notation m[y][x]
|
|
*/
|
|
class Matrix4x4 {
|
|
public:
|
|
static const Matrix4x4 Zero;
|
|
static const Matrix4x4 Identity;
|
|
|
|
Vector3 GetTranslationComponent() const;
|
|
Matrix3x3 GetRotationComponent() const;
|
|
|
|
Vector4 GetRow() const;
|
|
Vector4 GetColumn() const;
|
|
protected:
|
|
float elems[4][4];
|
|
};
|
|
} |