diff --git a/.idea/editor.xml b/.idea/editor.xml index ff4427b..b0d69ef 100644 --- a/.idea/editor.xml +++ b/.idea/editor.xml @@ -1,580 +1,483 @@ - \ No newline at end of file diff --git a/TestingGround_ChatGPT_Kris.exe b/TestingGround_ChatGPT_Kris.exe new file mode 100644 index 0000000..c3fb2f9 Binary files /dev/null and b/TestingGround_ChatGPT_Kris.exe differ diff --git a/cmake-build-debug/Testing/Temporary/LastTest.log b/cmake-build-debug/Testing/Temporary/LastTest.log index 1a39e10..ae26cc4 100644 --- a/cmake-build-debug/Testing/Temporary/LastTest.log +++ b/cmake-build-debug/Testing/Temporary/LastTest.log @@ -1,3 +1,3 @@ -Start testing: Nov 03 12:23 Mitteleuropäische Zeit +Start testing: Nov 09 13:54 Mitteleuropäische Zeit ---------------------------------------------------------- -End testing: Nov 03 12:23 Mitteleuropäische Zeit +End testing: Nov 09 13:54 Mitteleuropäische Zeit diff --git a/includes/TestingGround_ChatGPT_Kris.cpp b/includes/TestingGround_ChatGPT_Kris.cpp index cb95854..dff3419 100644 --- a/includes/TestingGround_ChatGPT_Kris.cpp +++ b/includes/TestingGround_ChatGPT_Kris.cpp @@ -1,65 +1,65 @@ //Ablage für ChatGPT Sachen, nicht relavant für das Projekt (Nur ein "Cloud"-Zwischenspeicher) -// Created by gamer on 09.11.2025. -// #include #include +#include +#include // Typalias für 4x4-Matrix mit double -using Matrix4x4 = std::array, 4>; +#include "gamematrix.h" +// Matrixmultiplikation +static std::array,4> matmul(const std::array,4>& A, + const std::array,4>& B); -// Matrixmultiplikation: C = A * B -Matrix4x4 matmul(const Matrix4x4& A, const Matrix4x4& B) { - Matrix4x4 C = {}; // Alle Werte automatisch 0 +// Rotationsmatrix um Achse x/y/z +static std::array,4> rot3D(double angle_deg, char axis); - for (int i = 0; i < 4; ++i) { - for (int j = 0; j < 4; ++j) { - for (int k = 0; k < 4; ++k) { +// Verschiebung +static std::array,4> translate(const std::array& pos); + + +//Mathematische Funkion, Rechnung (Matrix C = A*B) +std::array,4> gameMatrix::matmul( + const std::array,4>& A, + const std::array,4>& B) +{ + std::array,4> C{}; + + for (int i = 0; i < 4; ++i) + for (int j = 0; j < 4; ++j) + for (int k = 0; k < 4; ++k) C[i][j] += A[i][k] * B[k][j]; - } - } - } return C; } -// Matrixeinlesung vom Benutzer -Matrix4x4 inputMatrix(const std::string& name) { - Matrix4x4 M = {}; - std::cout << "Bitte Werte für Matrix " << name << " (4x4) eingeben:\n"; - for (int i = 0; i < 4; ++i) { - for (int j = 0; j < 4; ++j) { - std::cout << name << "[" << i << "][" << j << "]: "; - std::cin >> M[i][j]; - } - } - return M; -} -// Matrixausgabe -void printMatrix(const Matrix4x4& M) { - for (int i = 0; i < 4; ++i) { +int main() +{ + std::array,4> A{}; + std::array,4> B{}; + + std::cout << "Gib die Werte für Matrix A (4x4) ein:\n"; + for (int i = 0; i < 4; ++i) for (int j = 0; j < 4; ++j) { - std::cout << M[i][j] << "\t"; + std::cout << "A[" << i << "][" << j << "] = "; + std::cin >> A[i][j]; } + + std::cout << "\nGib die Werte für Matrix B (4x4) ein:\n"; + for (int i = 0; i < 4; ++i) + for (int j = 0; j < 4; ++j) { + std::cout << "B[" << i << "][" << j << "] = "; + std::cin >> B[i][j]; + } + + auto C = gameMatrix::matmul(A, B); + + std::cout << "\nErgebnis der Matrixmultiplikation (C = A * B):\n"; + for (int i = 0; i < 4; ++i) { + for (int j = 0; j < 4; ++j) + std::cout << C[i][j] << "\t"; std::cout << "\n"; } -} - -int main() { - // Benutzerinput - Matrix4x4 A = inputMatrix("A"); - Matrix4x4 B = inputMatrix("B"); - - // Multiplikation - Matrix4x4 C = matmul(A, B); - - // Ausgabe - std::cout << "\nErgebnis der Matrixmultiplikation (C = A * B):\n"; - printMatrix(C); return 0; } - - - -//das ist statisch. Matrix A und B sollen von User als input gegeben werden \ No newline at end of file diff --git a/includes/gamematrix.cpp b/includes/gamematrix.cpp index eb945c9..71cc936 100644 --- a/includes/gamematrix.cpp +++ b/includes/gamematrix.cpp @@ -1,10 +1,11 @@ // // Created by kris- on 03.11.2025. // -#include +#include +#include "gamematrix.h" + +// Matrixmultiplikation -static std::array,4> matmul(const std::array,4>& A, - const std::array,4>& B); // Rotationsmatrix um Achse x/y/z static std::array,4> rot3D(double angle_deg, char axis); @@ -12,3 +13,58 @@ static std::array,4> rot3D(double angle_deg, char axis); // Verschiebung static std::array,4> translate(const std::array& pos); + + + +//Matrixmultiplikation-Funktion +std::array,4> gameMatrix::matmul( + const std::array,4>& A, + const std::array,4>& B) + + +//Mathematische Funkion, Rechnung (Matrix C = A*B) +{ + std::array,4> C{}; + + for (int i = 0; i < 4; ++i) + for (int j = 0; j < 4; ++j) + for (int k = 0; k < 4; ++k) + C[i][j] += A[i][k] * B[k][j]; + + return C; +} + +int main() +{ + std::array,4> A{}; + std::array,4> B{}; + + std::cout << "Gib die Werte für Matrix A (4x4) ein:\n"; + for (int i = 0; i < 4; ++i) + for (int j = 0; j < 4; ++j) { + std::cout << "A[" << i << "][" << j << "] = "; + std::cin >> A[i][j]; + } + + std::cout << "\nGib die Werte für Matrix B (4x4) ein:\n"; + for (int i = 0; i < 4; ++i) + for (int j = 0; j < 4; ++j) { + std::cout << "B[" << i << "][" << j << "] = "; + std::cin >> B[i][j]; + } + + auto C = gameMatrix::matmul(A, B); + + std::cout << "\nErgebnis der Matrixmultiplikation (C = A * B):\n"; + for (int i = 0; i < 4; ++i) { + for (int j = 0; j < 4; ++j) + std::cout << C[i][j] << "\t"; + std::cout << "\n"; + } + + return 0; +} + + + + diff --git a/includes/gamematrix.h b/includes/gamematrix.h index 7a644d6..7d23453 100644 --- a/includes/gamematrix.h +++ b/includes/gamematrix.h @@ -8,8 +8,9 @@ class gameMatrix { public: // Matrix Multiplikation - static std::array,4> matmul(const std::array,4>& A, - const std::array,4>& B); + static std::array,4> matmul( + const std::array,4>& A, + const std::array,4>& B); // Rotationsmatrix um Achse x/y/z static std::array,4> rot3D(double angle_deg, char axis); @@ -17,3 +18,4 @@ public: // Verschiebung static std::array,4> translate(const std::array& pos); }; +