37static const float EPSILON = std::numeric_limits<float>::epsilon();
39static const float mI_0[] = { 1, 0, 0, 0,
45static const float m1_0[] = { 1, 3, 4, 0,
51static const float m1T_0[] = { 1, 6, 98, 54,
57static const float m2_0[] = { 1, 6, 98, 54,
63static const float m2xm1_0[] = { 26, 59, 143, 71,
66 71, 386, 5370, 2954 };
69static const float m1xm2_0[] = {12557, 893, 748, 1182,
72 1182, 113, 104, 131 };
75TEST_CASE(
"Test 00 Load Get",
"[mat4f][linear_algebra][math]" ) {
91TEST_CASE(
"Test 01 Mul",
"[mat4f][linear_algebra][math]" ) {
104TEST_CASE(
"Test 02 Transpose",
"[mat4f][linear_algebra][math]" ) {
109TEST_CASE(
"Test 10 LookAtNegZ",
"[mat4f][linear_algebra][math]" ) {
122 Mat4f exp( { 1, 0, 0, 0,
130TEST_CASE(
"Test 11 LookAtPosY",
"[mat4f][linear_algebra][math]" ) {
143 Mat4f exp( { 1, 0, 0, 0,
152TEST_CASE(
"Test 20 Float16Stack",
"[stack][mat4f][math]" ) {
154 Mat4f m10( { 1.0f, 2.0f, 3.0f, 4.0f,
155 5.0f, 6.0f, 7.0f, 8.0f,
156 9.0f, 10.0f, 11.0f, 12.0f,
157 13.0f, 14.0f, 15.0f, 16.0f
159 Mat4f m20 = m10 * 2.0f;
160 std::cout <<
"mat4 m10 " << m10 << std::endl;
161 std::cout <<
"mat4 m20 " << m20 << std::endl;
162 s1.
push(m10.cbegin());
163 s1.
push(m20.cbegin());
167 REQUIRE( m22 == m20 );
168 REQUIRE( m12 == m10 );
171TEST_CASE(
"Test 21 Mat4fStack",
"[stack][mat4f][math]" ) {
173 Mat4f m10( { 1.0f, 2.0f, 3.0f, 4.0f,
174 5.0f, 6.0f, 7.0f, 8.0f,
175 9.0f, 10.0f, 11.0f, 12.0f,
176 13.0f, 14.0f, 15.0f, 16.0f
178 Mat4f m20 = m10 * 2.0f;
179 std::cout <<
"mat4 m10 " << m10 << std::endl;
180 std::cout <<
"mat4 m20 " << m20 << std::endl;
186 REQUIRE( m22 == m20 );
187 REQUIRE( m12 == m10 );
#define COMPARE_NARRAYS_EPS(lhs, rhs, len, eps)
Basic 4x4 value_type matrix implementation using fields for intensive use-cases (host operations).
constexpr value_type get(const jau::nsize_t i) const noexcept
Returns the ith component of the given column-major order matrix, 0 <= i < 16, w/o boundary check.
constexpr iterator begin() noexcept
constexpr Matrix4 & setToLookAt(const Vec3 &eye, const Vec3 ¢er, const Vec3 &up, Matrix4 &tmp) noexcept
Set this matrix to the look-at matrix based on given parameters.
constexpr Matrix4 & mul(const Matrix4 &b) noexcept
Multiply matrix: [this] = [this] x [b].
constexpr Matrix4 & load(const_iterator src) noexcept
Load the values of the given matrix src to this matrix w/o boundary check.
A Matrix stack of compounds, each consisting of 16 * T
constexpr_cxx20 void pop(matrix_t &dest) noexcept
constexpr_cxx20 void push(const matrix_t &src) noexcept
A simple stack of compounds, each consisting of element_size * T
constexpr_cxx20 void push(const value_type *src) noexcept
constexpr_cxx20 void pop(value_type *dest) noexcept
__pack(...): Produces MSVC, clang and gcc compatible lead-in and -out macros.
static const Mat4f mI(mI_0)
static const float mI_0[]
static const Mat4f m1T(m1T_0)
static const Mat4f m1(m1_0)
static const float m2xm1_0[]
static const float m2_0[]
TEST_CASE("Test 00 Load Get", "[mat4f][linear_algebra][math]")
static const float m1_0[]
static const Mat4f m2(m2_0)
static const float EPSILON
static const float m1xm2_0[]
static const Mat4f m1xm2(m1xm2_0)
static const float m1T_0[]
static const Mat4f m2xm1(m2xm1_0)