Skip to content

Commit

Permalink
Remove unittest again (not relevant for this approach)
Browse files Browse the repository at this point in the history
  • Loading branch information
grorp committed Dec 18, 2024
1 parent 765e5ef commit 27c0115
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 44 deletions.
1 change: 0 additions & 1 deletion src/script/lua_api/l_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include "common/c_content.h"
#include "log.h"
#include "player.h"
#include "quaternion.h"
#include "server/serveractiveobject.h"
#include "tool.h"
#include "remoteplayer.h"
Expand Down
43 changes: 0 additions & 43 deletions src/unittest/test_irr_matrix4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,9 @@
#include "irrMath.h"
#include "matrix4.h"
#include "irr_v3d.h"
#include "quaternion.h"

using matrix4 = core::matrix4;

static bool vec_equals(const v3f &a, const v3f &b) {
// more tolerance than usual
return core::equals(a.X, b.X, 0.0001f) && core::equals(a.Y, b.Y, 0.0001f) &&
core::equals(a.Z, b.Z, 0.0001f);
}

static bool matrix_equals(const matrix4 &a, const matrix4 &b) {
return a.equals(b, 0.00001f);
}
Expand Down Expand Up @@ -71,42 +64,6 @@ SECTION("setRotationRadians") {
CHECK(Z.transformVect(y).equals(-x));
}
}

}

SECTION("setInverseRotationRadians") {
const std::vector<f32> floats = GENERATE(take(100,
chunk(6, random(-100.0f, 100.0f))));
const v3f vec{floats[0], floats[1], floats[2]};
const v3f rot{floats[3], floats[4], floats[5]};

// rotation matrix constructed from Euler angles directly is equal to
// rotation matrix constructed from quaternion

core::matrix4 rot_mat;
rot_mat.setRotationRadians(rot);

core::quaternion rot_quat(rot);
core::matrix4 rot_quat_mat;
rot_quat.getMatrixFast(rot_quat_mat);

CHECK(matrix_equals(rot_mat, rot_quat_mat));

// inverse rotation matrix constructed from Euler angles directly is equal
// to rotation matrix constructed from inverse quaternion

core::matrix4 inv_rot_mat;
inv_rot_mat.setInverseRotationRadians(rot);

core::quaternion inv_rot_quat(rot);
inv_rot_quat.makeInverse();
core::matrix4 inv_rot_quat_mat;
inv_rot_quat.getMatrixFast(inv_rot_quat_mat);

CHECK(matrix_equals(inv_rot_mat, inv_rot_quat_mat));

// inverse rotation works correctly (cancels out rotation)
CHECK(vec_equals(vec, inv_rot_mat.transformVect(rot_mat.transformVect(vec))));
}

}

0 comments on commit 27c0115

Please sign in to comment.