Compare commits

..

1 Commits

Author SHA1 Message Date
37a455a492 Update requirements 2025-11-17 12:19:45 +01:00
3 changed files with 0 additions and 104 deletions

View File

@ -1,44 +0,0 @@
@@ -1,43 +0,0 @@
========================================================
Projekt: gamematrix (C++ Library)
Rolle: Tester
Datei: tests.txt
Datum: 4.10.2025
Team: prog3b_652
========================================================
# ----------------------------
# 1. Testplan Übersicht
# ----------------------------
Ziel: Überprüfung der Funktionen matmul(), translate(), rot3D().
| Funktion | Testfall | Eingabe | Erwartetes Ergebnis | Bemerkung |
|---------------|---------------------------|------------------------------|-----------------------------------|----------------------------|
| matmul | Identity * Identity | 4x4 Identity Matrizen | Identity | Basisfall |
| matmul | Beispielmatrizen | A=[[...]], B=[[...]] | C=[[...]] | Prüfen mit Handrechnung |
| translate | Verschiebung | Vec3 {1,2,3} | Matrix mit Translation 1,2,3 | Prüfen letzte Spalte |
| rot3D | Rotation Z 90° | angle_deg=90, axis='z' | (1,0,0) -> (0,1,0) | Prüfen Anwendung auf Vektor|
| rot3D | Rotation X 180° | angle_deg=180, axis='x' | (0,1,0) -> (0,-1,0) | Prüfen Anwendung auf Vektor|
| rot3D | Rotation Y 270° | angle_deg=270, axis='y' | (1,0,0) -> (0,0,-1) | Prüfen Anwendung auf Vektor|
# ----------------------------
# 2. Testdaten / Matrizen
# ----------------------------
- Matrizen für matmul: Identity, Beispiel A/B Matrizen
- Vektoren für translate: Vec3 {x, y, z}
- Vektoren für rot3D: Vec3 {1,0,0}, Vec3 {0,1,0}
# ----------------------------
# 3. Abnahmekriterien
# ----------------------------
- Alle Unit-Tests erfolgreich
- Keine Exceptions außer gewollt (z.B. ungültige Achse)
- Testbericht in tests.txt dokumentiert
========================================================
Hinweis:
- Diese Datei wird vom Tester gepflegt.
- Tester dokumentiert Input, Output, erwartetes Ergebnis und Erfolg/Fehler.
========================================================

View File

@ -1,19 +0,0 @@
#pragma once
#include <vector>
#include <array>
#include <stdexcept>
#include <cmath>
class gameMatrix
{
public:
// Matrix Multiplikation
static std::array<std::array<double,4>,4> matmul(const std::array<std::array<double,4>,4>& A,
const std::array<std::array<double,4>,4>& B);
// Rotationsmatrix um Achse x/y/z
static std::array<std::array<double,4>,4> rot3D(double angle_deg, char axis);
// Verschiebung
static std::array<std::array<double,4>,4> translate(const std::array<double, 3>& pos);
};

View File

@ -1,41 +0,0 @@
#include <iostream>
#include <array>
#include <cassert>
#include <cmath>
#include "gamematrix.h"
// Matrix-Vektor Multiplikation (4x4 Matrix auf 4D Vektor anwenden)
std::array<double, 4> matVecMul(const std::array<std::array<double, 4>, 4>& mat, const std::array<double, 4>& vec) {
std::array<double, 4> result = {0, 0, 0, 0};
for (size_t i = 0; i < 4; ++i) {
for (size_t j = 0; j < 4; ++j) {
result[i] += mat[i][j] * vec[j];
}
}
return result;
}
void test_rotateZ() {
std::array<double, 4> v = {1, 0, 0, 1}; // Der Vektor (1, 0, 0) wird zu (1, 0, 0, 1)
// Rotationsmatrix um 90° um die Z-Achse
auto R = gameMatrix::rot3D(90, 'Z');
// Vektor mit der Matrix multiplizieren
std::array<double, 4> result = matVecMul(R, v);
// Erwartetes Ergebnis
std::array<double, 4> expected_result = {0, 1, 0, 1};
// Vergleich der Ergebnisse
for (size_t i = 0; i < 4; ++i) {
assert(std::abs(result[i] - expected_result[i]) < 1e-6);
}
std::cout << "Test erfolgreich! Rotation um Z-Achse funktioniert." << std::endl;
}
int main() {
test_rotateZ();
return 0;
}