Compare commits
No commits in common. "c7cc86197c4adcf45f680687208be7500c563c8f" and "2a4fac44e57502f9be2978c6d7f5acbe65955de2" have entirely different histories.
c7cc86197c
...
2a4fac44e5
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,2 +0,0 @@
|
||||
.DS_Store
|
||||
.idea/
|
||||
@ -3,9 +3,6 @@ project(Prog3B)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
|
||||
# WICHTIG: wegen raylib + neuer CMake-Version
|
||||
set(CMAKE_POLICY_VERSION_MINIMUM 3.5)
|
||||
|
||||
include(FetchContent)
|
||||
|
||||
FetchContent_Declare(
|
||||
@ -23,14 +20,4 @@ add_executable(Prog3B
|
||||
)
|
||||
|
||||
target_include_directories(Prog3B PRIVATE .)
|
||||
target_link_libraries(Prog3B raylib)
|
||||
|
||||
# macOS-Frameworks nicht vergessen:
|
||||
if(APPLE)
|
||||
target_link_libraries(Prog3B
|
||||
"-framework Cocoa"
|
||||
"-framework IOKit"
|
||||
"-framework CoreVideo"
|
||||
"-framework OpenGL"
|
||||
)
|
||||
endif()
|
||||
target_link_libraries(Prog3B raylib)
|
||||
36
tests.cpp
36
tests.cpp
@ -1,28 +1,22 @@
|
||||
#include <iostream>
|
||||
#include <cmath>
|
||||
#include "gamematrix.h"
|
||||
using namespace Matrix3D;
|
||||
|
||||
bool approx(double a, double b, double eps = 1e-6) {
|
||||
return std::fabs(a - b) < eps;
|
||||
void test_rotation_z() {
|
||||
Vec3 v{1,0,0};
|
||||
auto R = rot3D(90,'z');
|
||||
Vec3 res = apply(R,v);
|
||||
std::cout << "Rotate Z 90° -> (" << res.x << "," << res.y << "," << res.z << ")\n";
|
||||
}
|
||||
|
||||
void test_translate() {
|
||||
Vec3 v{0,0,0};
|
||||
auto T = translate({1,2,3});
|
||||
Vec3 res = apply(T,v);
|
||||
std::cout << "Translate -> (" << res.x << "," << res.y << "," << res.z << ")\n";
|
||||
}
|
||||
|
||||
int main() {
|
||||
int failed = 0;
|
||||
|
||||
// Beispiel-Test: Rotation um Z 90°
|
||||
std::array<double,3> v = {1,0,0};
|
||||
auto Rz = rot3D(90, 'z'); // ggf. Namespace anpassen
|
||||
auto result = apply(Rz, v);
|
||||
if (!approx(result[0], 0.0) || !approx(result[1], 1.0)) {
|
||||
std::cout << "Test rot3D(Z,90) failed!\n";
|
||||
failed++;
|
||||
}
|
||||
|
||||
// Ausgabe
|
||||
if (failed == 0)
|
||||
std::cout << "ALL TESTS PASSED ✅\n";
|
||||
else
|
||||
std::cout << failed << " TEST(S) FAILED ❌\n";
|
||||
|
||||
return failed;
|
||||
test_rotation_z();
|
||||
test_translate();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user