Raven Engine v0.1
A modern 3D Game Engine
Loading...
Searching...
No Matches
MatrixOps.h File Reference
#include <Crux/Types/Matrix.h>
#include <Crux/Types/Vector.h>
#include <Crux/Math/BasicMath.h>
#include <Crux/Math/Trigonometry.h>
#include <Crux/Math/VectorOps.h>
#include <Crux/Math/QuaternionOps.h>
#include <cmath>

Namespaces

namespace  Crux
namespace  Crux::Interop

Functions

template<typename T, size_t Rows, size_t Cols>
constexpr bool Crux::operator== (const Matrix< T, Rows, Cols > &a, const Matrix< T, Rows, Cols > &b)
template<typename T, size_t Rows, size_t Cols>
constexpr bool Crux::operator!= (const Matrix< T, Rows, Cols > &a, const Matrix< T, Rows, Cols > &b) noexcept
template<typename T, size_t Rows, size_t Cols>
constexpr Matrix< T, Rows, Cols > Crux::operator+ (const Matrix< T, Rows, Cols > &a, const Matrix< T, Rows, Cols > &b)
template<typename T, size_t Rows, size_t Cols>
constexpr Matrix< T, Rows, Cols > Crux::operator- (const Matrix< T, Rows, Cols > &a, const Matrix< T, Rows, Cols > &b)
template<typename T, size_t Rows, size_t Cols>
constexpr Matrix< T, Rows, Cols > Crux::operator* (const Matrix< T, Rows, Cols > &a, const T &scalar)
template<typename T, size_t Rows, size_t Cols>
constexpr Matrix< T, Rows, Cols > Crux::operator* (const T &scalar, const Matrix< T, Rows, Cols > &a)
template<typename T>
constexpr Vector< T, 4 > Crux::operator* (const Matrix< T, 4, 4 > &m, const Vector< T, 4 > &v)
template<typename T>
constexpr Vector< T, 3 > Crux::operator* (const Matrix< T, 4, 4 > &m, const Vector< T, 3 > &v)
template<typename T>
constexpr Vector< T, 4 > Crux::operator* (const Vector< T, 4 > &v, const Matrix< T, 4, 4 > &m)
template<typename T, size_t Rows, size_t Cols>
constexpr Matrix< T, Rows, Cols > Crux::operator/ (const Matrix< T, Rows, Cols > &a, const T &scalar)
template<typename T, size_t RowsA, size_t ColsA, size_t ColsB>
constexpr Matrix< T, RowsA, ColsB > Crux::operator* (const Matrix< T, RowsA, ColsA > &a, const Matrix< T, ColsA, ColsB > &b)
template<typename T, size_t Rows, size_t Cols>
constexpr Matrix< T, Rows, Cols > Crux::Zero ()
 Generates a zero matrix of size Rows x Cols.
template<typename T, size_t Rows, size_t Cols>
constexpr Matrix< T, Cols, Rows > Crux::Transpose (const Matrix< T, Rows, Cols > &a)
 Transposes the given matrix (rows become columns).
template<typename T>
constexpr Matrix< T, 4, 4 > Crux::RotateX (T angle)
 Creates a 4x4 rotation matrix around the X axis.
template<typename T>
constexpr Matrix< T, 4, 4 > Crux::RotateY (T angle)
 Creates a 4x4 rotation matrix around the Y axis.
template<typename T>
constexpr Matrix< T, 4, 4 > Crux::RotateZ (T angle)
 Creates a 4x4 rotation matrix around the Z axis.
template<typename T>
constexpr Matrix< T, 4, 4 > Crux::Rotate (T angle, const Vector< T, 3 > &axis)
 Creates a 4x4 rotation matrix around an arbitrary axis.
template<typename T>
constexpr Matrix< T, 2, 2 > Crux::Scale (T tx, T ty)
 Constructs a 2D scaling matrix.
template<typename T>
constexpr Matrix< T, 4, 4 > Crux::Scale (T sx, T sy, T sz)
 Constructs a 4x4 3D non-uniform scaling matrix.
template<typename T>
constexpr Matrix< T, 4, 4 > Crux::Scale (const Vector< T, 3 > &s)
 Constructs a 4x4 3D non-uniform scaling matrix from a vector.
template<typename T, size_t N>
constexpr Matrix< T, N, N > Crux::Scale (T s)
 Constructs a uniform scaling matrix of size N x N.
template<typename T>
constexpr Matrix< T, 3, 3 > Crux::Translate (T tx, T ty)
 Constructs a 3x3 2D translation matrix.
constexpr Matrix< f32, 4, 4 > Crux::Translate (f32 tx, f32 ty, f32 tz)
 Constructs a 4x4 3D translation matrix.
template<typename T>
constexpr Matrix< T, 4, 4 > Crux::Translate (const Matrix< T, 4, 4 > &m, const Vector< T, 3 > &v)
 Applies a 3D translation to a 4x4 matrix using a vector.
template<typename T, size_t N>
constexpr Matrix< T, N, N > Crux::Identity ()
 Generates an identity matrix of size NxN.
template<typename T, size_t N>
constexpr T Crux::Trace (const Matrix< T, N, N > &a)
 Computes the trace (sum of diagonal elements) of a square matrix.
template<typename T, size_t Rows, size_t Cols>
constexpr T Crux::Norm (const Matrix< T, Rows, Cols > &a)
 Computes the Frobenius norm of the matrix.
template<typename T, size_t Rows, size_t Cols>
constexpr Matrix< T, Rows, Cols > Crux::Normalize (const Matrix< T, Rows, Cols > &a)
 Normalizes the matrix by dividing each element by the Frobenius norm.
template<typename T>
constexpr T Crux::Determinant (const Matrix< T, 2, 2 > &a)
 Computes the determinant of a 2x2 matrix.
template<typename T>
constexpr T Crux::Determinant (const Matrix< T, 3, 3 > &a)
 Computes the determinant of a 3x3 matrix.
template<typename T>
constexpr T Crux::Determinant (const Matrix< T, 4, 4 > &a)
 Computes the determinant of a 4x4 matrix.
template<typename T>
constexpr Matrix< T, 2, 2 > Crux::Inverse (const Matrix< T, 2, 2 > &a)
 Computes the inverse of a 2x2 matrix.
template<typename T>
constexpr Matrix< T, 3, 3 > Crux::Inverse (const Matrix< T, 3, 3 > &a)
 Computes the inverse of a 3x3 matrix.
template<typename T>
constexpr Matrix< T, 4, 4 > Crux::Inverse (const Matrix< T, 4, 4 > &a)
 Computes the inverse of a 4x4 matrix.
template<typename T>
constexpr Matrix< T, 3, 3 > Crux::ToMat3 (const Matrix< T, 4, 4 > &m)
 Converts a 4x4 Matrix into a 3x3 Matrix.
template<typename T>
constexpr Matrix< T, 4, 4 > Crux::ToMat4 (const Matrix< T, 3, 3 > &m)
 Converts a 3x3 Matrix into a 4x4 Matrix.
template<typename T>
constexpr Matrix< T, 4, 4 > Crux::LookAt (const Vector< T, 3 > &position, const Vector< T, 3 > &target, const Vector< T, 3 > &up)
 Creates a look-at view matrix using position, target, and up vectors.
template<typename T>
void Crux::DecomposeTransform (const Matrix< T, 4, 4 > &transform, Vector< T, 3 > &translation, Vector< T, 3 > &rotation, Vector< T, 3 > &scale)
 Decomposes a 4x4 transformation matrix into translation, rotation, and scale.
template<typename T>
Matrix< T, 4, 4 > Crux::ComposeTransform (const Vector< T, 3 > &translation, const Vector< T, 3 > &rotation, const Vector< T, 3 > &scale)
 Helper to compose a transformation matrix from translation, rotation, and scale.
Matrix< f32, 4, 4 > Crux::Perspective (f32 yFov, f32 aspect, f32 zNear, f32 zFar)
 Constructs a perspective projection matrix.
template<typename T>
constexpr Matrix< T, 4, 4 > Crux::Ortho (T left, T right, T bottom, T top, T zNear, T zFar)
 Constructs an orthographic projection matrix.
constexpr Matrix< f32, 4, 4 > Crux::Interop::ToGLSpace_View (const Matrix< f32, 4, 4 > &mat)
 Converts a row-major view matrix to OpenGL column-major space.
constexpr Matrix< f32, 4, 4 > Crux::Interop::ToGLSpace_Projection (const Matrix< f32, 4, 4 > &mat)
 Converts a row-major projection matrix to OpenGL column-major space.
constexpr Matrix< f32, 4, 4 > Crux::Interop::ToGLSpace_Object (const Matrix< f32, 4, 4 > &mat)
 Converts an object/world matrix to OpenGL column-major space.
constexpr Matrix< f32, 4, 4 > Crux::Interop::FromGLSpace_Object (const Matrix< f32, 4, 4 > &mat)
 Converts an OpenGL column-major object/world matrix back to Crux row-major space.