// // Created by jholder on 21.10.21. // #include #include #include "Data/Rod2dMulti.hpp" #include "tools/vec_trafos.h" TEST_CASE("Multi Rods") { Rod2dMulti sphere(1, 100); Rod2dMulti rod(2, 100); SECTION("Checking translation") { rod.setPos({0, 0}, 0); rod.setPos(rod.getPos(0) + Eigen::Vector2d(1, -1), 0); auto newPos = rod.getPos(0); REQUIRE(newPos[0] == 1); REQUIRE(newPos[1] == -1); REQUIRE(sphere.getDiff_Sqrt()(0, 0) == 1.0); REQUIRE(sphere.getDiff_Sqrt()(0, 1) == 0.0); REQUIRE(sphere.getDiff_Sqrt()(1, 0) == 0.0); REQUIRE(sphere.getDiff_Sqrt()(1, 1) == 1.0); } SECTION("Checking rotation") { double f1 = GENERATE(take(10, random(-100, 100))); double f2 = GENERATE(take(10, random(-100, 100))); rod.setE(Eigen::Vector2d({f1, f2}).normalized(), 0); auto test = Eigen::Vector2d({1, 0}); auto e = rod.getE(0); auto erg = (rotation_Matrix(e) * test).normalized(); REQUIRE(erg.isApprox(e)); } }