Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
TMatrixNBase.h
Go to the documentation of this file.
1#pragma once
2
4#include "Utility/utility.h"
5
6namespace ph::math
7{
8
15template<typename Derived, typename T, std::size_t N>
16class TMatrixNBase : public TMatrixMxNBase<Derived, T, N, N>
17{
18private:
20 using Self = TMatrixNBase;
21
22protected:
23 using Base::m;
24
25// Hide special members as this class is not intended to be used polymorphically.
26// It is derived class's choice to expose them (by defining them in public) or not.
27protected:
29
30public:
33 Derived& setIdentity();
34
35 Derived& setScale(const TRawColVector<T, N>& scaleFactor);
36
37 Derived mul(const Derived& rhsMatrix) const;
38 Derived& mulLocal(const Derived& rhsMatrix);
39 Derived mulTransposed(const Derived& rhsMatrix) const;
40 Derived& mulTransposedLocal(const Derived& rhsMatrix);
41 void mul(const Derived& rhsMatrix, Derived* out_result) const;
42 void mulTransposed(const Derived& rhsMatrix, Derived* out_result) const;
43 Derived transpose() const;
44 Derived& transposeLocal();
45
46 using Base::Base;
47
48 using Base::NUM_ROWS;
49 using Base::NUM_COLS;
50 using Base::numRows;
51 using Base::numCols;
52
53 using Base::mul;
54 using Base::mulLocal;
59 using Base::set;
60
61 using Base::operator [];
62
63 using Base::toString;
64
65 // TODO: inverse, determinant
66};
67
68}// end namespace ph::math
69
A base for general M by N row-major matrices.
Definition TMatrixMxNBase.h:34
void multiplyMatrix(const TRawMatrix< T, N, K > &rhsMatrix, TRawMatrix< T, M, K > *out_result) const
Definition TMatrixMxNBase.ipp:75
Derived mul(T constantValue) const
Definition TMatrixMxNBase.ipp:36
TRawMatrix< T, M, N > m
Definition TMatrixMxNBase.h:77
TRawMatrix< T, N, M > transposeMatrix() const
Definition TMatrixMxNBase.ipp:114
Derived & mulLocal(T constantValue)
Definition TMatrixMxNBase.ipp:43
constexpr std::size_t numRows() const noexcept
Definition TMatrixMxNBase.ipp:24
Derived & set(T constantValue)
Definition TMatrixMxNBase.ipp:129
std::string toString() const
Definition TMatrixMxNBase.ipp:158
static constexpr auto NUM_ROWS
Definition TMatrixMxNBase.h:50
constexpr std::size_t numCols() const noexcept
Definition TMatrixMxNBase.ipp:30
void multiplyTransposedMatrix(const TRawMatrix< T, K, N > &rhsMatrix, TRawMatrix< T, M, K > *out_result) const
Definition TMatrixMxNBase.ipp:95
static constexpr auto NUM_COLS
Definition TMatrixMxNBase.h:51
TRawColVector< T, M > multiplyVector(const TRawColVector< T, M > &rhsColVector) const
Definition TMatrixMxNBase.ipp:57
A base for general N dimensional row-major square matrices.
Definition TMatrixNBase.h:17
Derived mul(const Derived &rhsMatrix) const
Definition TMatrixNBase.ipp:41
Derived & setIdentity()
Sets the matrix to be an identity matrix.
Definition TMatrixNBase.ipp:13
PH_DEFINE_INLINE_RULE_OF_5_MEMBERS(TMatrixNBase)
Derived & mulTransposedLocal(const Derived &rhsMatrix)
Definition TMatrixNBase.ipp:70
Derived & transposeLocal()
Definition TMatrixNBase.ipp:107
Derived transpose() const
Definition TMatrixNBase.ipp:98
Derived & mulLocal(const Derived &rhsMatrix)
Definition TMatrixNBase.ipp:50
Derived mulTransposed(const Derived &rhsMatrix) const
Definition TMatrixNBase.ipp:61
Derived & setScale(const TRawColVector< T, N > &scaleFactor)
Definition TMatrixNBase.ipp:27
Math functions and utilities.
Definition TransformInfo.h:10
std::array< T, M > TRawColVector
Definition TMatrixMxNBase.h:20