27#include <jau/test/catch2_ext.hpp>
35static const float mI_0[] = { 1, 0, 0, 0,
41static const float m1_0[] = { 1, 3, 4, 0,
47static const float m1T_0[] = { 1, 6, 98, 54,
53static const float m2_0[] = { 1, 6, 98, 54,
59static const float m2xm1_0[] = { 26, 59, 143, 71,
62 71, 386, 5370, 2954 };
65static const float m1xm2_0[] = {12557, 893, 748, 1182,
68 1182, 113, 104, 131 };
71TEST_CASE(
"Test 00 Load Get",
"[mat4f][linear_algebra][math]" ) {
87TEST_CASE(
"Test 01 Mul",
"[mat4f][linear_algebra][math]" ) {
100TEST_CASE(
"Test 02 Transpose",
"[mat4f][linear_algebra][math]" ) {
105TEST_CASE(
"Test 10 LookAtNegZ",
"[mat4f][linear_algebra][math]" ) {
116 Mat4f exp( { 1, 0, 0, 0,
124TEST_CASE(
"Test 11 LookAtPosY",
"[mat4f][linear_algebra][math]" ) {
135 Mat4f exp( { 1, 0, 0, 0,
144TEST_CASE(
"Test 20 Float16Stack",
"[stack][mat4f][math]" ) {
146 Mat4f m10( { 1.0f, 2.0f, 3.0f, 4.0f,
147 5.0f, 6.0f, 7.0f, 8.0f,
148 9.0f, 10.0f, 11.0f, 12.0f,
149 13.0f, 14.0f, 15.0f, 16.0f
151 Mat4f m20 = m10 * 2.0f;
152 std::cout <<
"mat4 m10 " << m10 << std::endl;
153 std::cout <<
"mat4 m20 " << m20 << std::endl;
154 s1.
push(m10.cbegin());
155 s1.
push(m20.cbegin());
159 REQUIRE( m22 == m20 );
160 REQUIRE( m12 == m10 );
163TEST_CASE(
"Test 21 Mat4fStack",
"[stack][mat4f][math]" ) {
165 Mat4f m10( { 1.0f, 2.0f, 3.0f, 4.0f,
166 5.0f, 6.0f, 7.0f, 8.0f,
167 9.0f, 10.0f, 11.0f, 12.0f,
168 13.0f, 14.0f, 15.0f, 16.0f
170 Mat4f m20 = m10 * 2.0f;
171 std::cout <<
"mat4 m10 " << m10 << std::endl;
172 std::cout <<
"mat4 m20 " << m20 << std::endl;
178 REQUIRE( m22 == m20 );
179 REQUIRE( m12 == m10 );
constexpr Matrix4 & mul(const Matrix4 &b) noexcept
Multiply matrix: [this] = [this] x [b].
constexpr iterator begin() noexcept
constexpr Matrix4 & load(const_iterator src) noexcept
Load the values of the given matrix src to this matrix w/o boundary check.
constexpr Matrix4 & setToLookAt(const Vec3 &eye, const Vec3 ¢er, const Vec3 &up) noexcept
Set this matrix to the look-at matrix based on given parameters.
constexpr_cxx20 void push(const matrix_t &src) noexcept
constexpr_cxx20 void pop(matrix_t &dest) noexcept
constexpr_cxx20 void pop(value_type *dest) noexcept
constexpr_cxx20 void push(const value_type *src) noexcept
constexpr T EPSILON
Alias for epsilon constant, i.e. std::numeric_limits<T>::epsilon()
SimpleStack< float, 16 > Stack16f
4x4 float matrix stack based on single float elements
MatrixStack< float > Mat4fStack
4x4 float matrix stack
__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 m1xm2_0[]
static const Mat4f m1xm2(m1xm2_0)
static const float m1T_0[]
static const Mat4f m2xm1(m2xm1_0)