Author SHA1 Message Date
linkse100241 84b469b454 Merge branch 'Project_Developer' 2025-12-01 12:06:01 +01:00
1nn0c3ntt 0821395b92 Merge branch 'Project_Developer' 2025-12-01 10:57:32 +01:00
1nn0c3ntt 5b99ad8812 Fix merge conflict by removing build files 2025-12-01 10:49:01 +01:00
1nn0c3ntt ae9c8305f5 Merge branch 'Project_Developer' 2025-12-01 10:43:05 +01:00
rotormelja98119 c61b682fd4 Merge branch 'main' of https://git.efi.th-nuernberg.de/gitea/linkse100241/prog3b_652 2025-11-17 12:20:47 +01:00
linkse100241 3a4f335465 Merge branch 'project_tester' 2025-11-17 12:09:49 +01:00
linkse100241 544c4503cd gamematrix.cpp remove from include in branch tester 2025-11-17 12:09:33 +01:00
rotormelja98119 402962e32b WIP: requirements angepasst 2025-11-17 12:05:38 +01:00
1nn0c3ntt 5f5f4568e6 Merge remote-tracking branch 'origin/Project_Developer' 2025-11-17 12:04:03 +01:00
laemmerzahlkr91200 22cf057f82 Developer files
gamematrix etc.
2025-11-17 12:03:29 +01:00
linkse100241 29d3ea45d5 Merge remote-tracking branch 'origin/main' into project_tester 2025-11-17 11:48:11 +01:00
linkse100241 e179abd8d9 tests.cpp update 2025-11-16 16:48:17 +01:00
linkse100241 72168eaa79 test.cpp aktualisiert 2025-11-16 16:46:56 +01:00
rotormelja98119 1e2548ddd0 Replace requirements.txt with updated version 2025-11-03 13:19:47 +01:00
rotormelja98119 6ffded95fe Merge branch 'main' of https://git.efi.th-nuernberg.de/gitea/linkse100241/prog3b_652 2025-11-03 13:11:21 +01:00
rotormelja98119 3be1087eb9 changes2 2025-11-03 13:08:40 +01:00
linkse100241 5dfa867449 Create tests.txt 2025-11-03 12:40:11 +01:00
linkse100241 18f4a5b492 Delete tests.txt 2025-11-03 12:37:43 +01:00
linkse100241 368576471a Create tests.cpp 2025-11-03 12:36:07 +01:00
rotormelja98119 2d2bf6e2c4 Merge branch 'project_leader' 2025-11-03 12:32:13 +01:00
rotormelja98119 aeb4065e1c requirements edit 2025-11-03 12:30:38 +01:00
laemmerzahlkr91200 9a91e99728 Merge branch 'main' of https://git.efi.th-nuernberg.de/gitea/linkse100241/prog3b_652 2025-11-03 12:16:10 +01:00
1nn0c3ntt 84627ca069 Merge branch 'main' of https://git.efi.th-nuernberg.de/gitea/linkse100241/prog3b_652 2025-11-03 12:15:13 +01:00
1nn0c3ntt 50ed40ee3b Architekt: Design Doc ist fertig 2025-11-03 12:15:06 +01:00
linkse100241 4b16388754 Create tests.txt 2025-11-03 12:14:47 +01:00
laemmerzahlkr91200 eb85ce2112 Create Kris_3_11.txt 2025-11-03 12:12:49 +01:00
6 changed files with 363 additions and 0 deletions
View File
+74
View File
@@ -0,0 +1,74 @@
========================================================
Projekt: gamematrix (C++ Library)
Rolle: Architekt
Datei: design.txt
Datum: 03.11.2025
Team: prog3b_652
========================================================
# ----------------------------
# 1. Projektstruktur / Namespace
# ----------------------------
Namespace: Matrix3D
Ziel: Saubere Trennung der Bibliothek, Vermeidung von Namenskonflikten.
Beispiel:
namespace Matrix3D {
// Funktionen, ggf Klasse(n)
}
# ----------------------------
# 2. Datenstrukturen / Klassen
# ----------------------------
Listen Sie die Klassen oder Structs auf, die verwendet werden:
| Name | Typ | Beschreibung |
|--------|------------------------------------------|--------------|
| Vec3 | struct Vec3 | 3D-Vektor (x, y, z) |
| Mat4 | std::array<std::array<double,4>,4> | 4x4-Matrix (homogen) |
| ______ | ________ | ___________________ |
| ______ | ________ | ___________________ |
# ----------------------------
# 3. Operatoren / Templates
# ----------------------------
Welche Operatoren oder Templates sollen definiert werden?
- Templates für unterschiedliche Datentypen? ☐ Ja ☐ Nein
- Operatoren:
- Mat4 * Mat4
- Mat4 * Vec3
# ----------------------------
# 4. Funktionen / Schnittstellen
# ----------------------------
Liste der Funktionen mit Eingabe/Ausgabe und kurzer Beschreibung:
| Funktion | Eingabe | Ausgabe | Kurzbeschreibung |
|---------------|------------------------------------|-----------------------|----------------------------------------|
| matmul | Mat4 A, Mat4 B | Mat4 | Matrixmultiplikation 4x4 |
| translate | Vec3 pos | Mat4 | Verschiebungstransformation |
| rot3D | double angle_deg, char axis | Mat4 | Rotation um Achse x/y/z |
| identity (optional)| --- | Mat4 | Identitätsmatrix |
| _____________ | __________________________________ | ____________________ | ______________________________ |
# ----------------------------
# 5. Designentscheidungen / Hinweise
# ----------------------------
- Rückgabe der Matrizen per Wert oder Referenz? ___________
- Verwendung von std::array oder std::vector? ___________
- Homogene Koordinaten für Translation / Rotation (4x4)? ☐ Ja ☐ Nein
- Weitere Designüberlegungen: ___________________________
# ----------------------------
# 6. Deliverables / Milestones
# ----------------------------
- design.txt fertig und im Branch architect committed
- Übergabe an Entwickler für Implementierung
========================================================
Hinweis:
- Dieses Dokument dient als Grundlage für die Implementierung.
- Alle Designentscheidungen sollen klar nachvollziehbar sein.
========================================================
+76
View File
@@ -0,0 +1,76 @@
========================================================
Projekt: gamematrix (C++ Library)
Rolle: Projektleiter
Datei: requirements.txt
Datum: 03.11.2025
Team: prob3b_652
========================================================
# ----------------------------
# 1. Projektziel
# ----------------------------
Beschreiben Sie hier kurz das Ziel des Projekts:
Ziel:
- C++-Bibliothek gamematrix.cpp erweitern. Matrizenoperationen für 3D-Transformationen bereitstellen.
- Integration in das bestehende Spielprojekt.
- Git-Workflow: Neuer Branch für diese Woche (KW25), Änderungen committen und später in den Hauptbranch mergen.
- Vorgehensmodell: Wasserfall, alle Phasen strikt nacheinander.
# ----------------------------
# 2. Funktionale Anforderungen
# ----------------------------
Listen Sie alle Funktionen auf, die die Bibliothek bereitstellen soll..
Tragen Sie ein: Funktion, Eingabe, Ausgabe, kurze Beschreibung
| Funktion | Eingabe | Ausgabe | Kurzbeschreibung |
|---------------|------------------------------------|-----------------------|----------------------------------------|
| matmul | 4x4 Matrix A, 4x4 Matrix B | 4x4 Matrix |Multipliziert zwei Matrizen und gibt |
| | | |das Ergebnis als neue Matrix zurück. |
| | | |Prüft dabei, ob die Dimensionen |
| | | |kompatibel sind |
|---------------------------------------------------------------------------------------------------------------------|
| translate | 3D Vektor | 4x4 Matrix | Verschiebt Punkte oder Objekte im Raum |
| | | | um einen gegebenen Vektor. |
|---------------------------------------------------------------------------------------------------------------------|
| rot3D | Winkel in °, Rotationsachse (x/y/z)| 4x4 Matrix | Rotiert eine Matrix um eine Achse um |
| | | |einen vorgegebenen Winkel |
|---------------------------------------------------------------------------------------------------------------------|
| identity (optional)| --- | 4x4 Matrix | _____________________________________ |
| _____________ | __________________________________ | ____________________ | ______________________________ |
| _____________ | __________________________________ | ____________________ | ______________________________ |
# ----------------------------
# 3. Nicht-funktionale Anforderungen
# ----------------------------
(z. B. Performance, Lesbarkeit, Wartbarkeit, Python-Kompatibilität via pybind11)
- Jede Methode soll mit einem aussagekräftigen Kommentar versehen werden.
- User soll aufgefordert werden zwei 4x4 Matritzen einzugeben bzw. einen Winkel in Grad.
(Architect Aufgabe -> Die Eingabe- Methode soll Prüfen ob die Form vom Winkel bzw. Matritzen den
Anforderungen entsprechen)
- ____________________________________________________________
# ----------------------------
# 4. Annahmen / Einschränkungen
# ----------------------------
- Wir arbeiten ausschließlich mit 4x4 Matritzen. Winkel soll in Grand eingegeben werden. ____________________________________________________________
- Variablendeklaration ausschließlich mit double# ----------------------------
# 5. Abnahmekriterien
# ----------------------------
Wie soll geprüft werden, dass die Anforderungen erfüllt sind?
(z. B. Unit-Tests, Beispielrotationen, Matrizenmultiplikation)
- Beispielrotationen
- Matritzen-Multiplikation
-
========================================================
Hinweis:
- Diese Datei wird vom Projektleiter erstellt und gepflegt.
- Jede Phase des Projekts soll hier dokumentiert werden.
========================================================
+44
View File
@@ -0,0 +1,44 @@
@@ -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.
========================================================
+150
View File
@@ -0,0 +1,150 @@
//
// Created by kris- on 03.11.2025.
//
#include <iostream>
#include "gamematrix.h"
// Matrixmultiplikation
// 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);
//Matrixmultiplikation-Funktion
std::array<std::array<double,4>,4> gameMatrix::matmul(
const std::array<std::array<double,4>,4>& A,
const std::array<std::array<double,4>,4>& B)
{ //Matrix-Mathematik (Matrix C = A*B)
std::array<std::array<double,4>,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;
}
//Rotation 3D
std::array<std::array<double,4>,4> gameMatrix::rot3D(double angle_deg, char axis) {
double rad = angle_deg * M_PI / 180.0;
//Mathematik-Rotation
std::array<std::array<double,4>,4> R{};
for (int i = 0; i < 4; ++i)
R[i][i] = 1.0;
if (axis == 'x' || axis == 'X') {
R[1][1] = cos(rad);
R[1][2] = -sin(rad);
R[2][1] = sin(rad);
R[2][2] = cos(rad);
} else if (axis == 'y' || axis == 'Y') {
R[0][0] = cos(rad);
R[0][2] = sin(rad);
R[2][0] = -sin(rad);
R[2][2] = cos(rad);
} else if (axis == 'z' || axis == 'Z') {
R[0][0] = cos(rad);
R[0][1] = -sin(rad);
R[1][0] = sin(rad);
R[1][1] = cos(rad);
}
return R;
}
//Translation
std::array<std::array<double,4>,4> gameMatrix::translate(const std::array<double,3>& pos) {
std::array<std::array<double,4>,4> T{};
for (int i = 0; i < 4; ++i)
T[i][i] = 1.0; // Identitätsmatrix
T[0][3] = pos[0]; // x-Verschiebung
T[1][3] = pos[1]; // y-Verschiebung
T[2][3] = pos[2]; // z-Verschiebung
return T;
}
//unnötig die main hier, aber wenn die schon mal da ist, warum auch nicht zum testen dieser .cpp-Datei
int main()
{
// Part Matrix
std::array<std::array<double,4>,4> A{};
std::array<std::array<double,4>,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];
}
std::array<std::array<double,4>,4> 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";
}
//Ende Matrix
// Rotation
double angle;
char axis;
std::cout << "\nGib einen Rotationswinkel in Grad ein: ";
std::cin >> angle;
std::cout << "Gib die Rotationsachse (x/y/z) ein: ";
std::cin >> axis;
std::array<std::array<double,4>,4> R = gameMatrix::rot3D(angle, axis);
std::cout << "\nRotationsmatrix R:\n";
for (int i = 0; i < 4; ++i) {
for (int j = 0; j < 4; ++j)
std::cout << R[i][j] << "\t";
std::cout << "\n";
}
// Translation
std::array<double,3> pos;
std::cout << "\nGib die Translation (x y z) ein: ";
std::cin >> pos[0] >> pos[1] >> pos[2];
std::array<std::array<double,4>,4> T = gameMatrix::translate(pos);
std::cout << "\nTranslationsmatrix T:\n";
for (int i = 0; i < 4; ++i) {
for (int j = 0; j < 4; ++j)
std::cout << T[i][j] << "\t";
std::cout << "\n";
}
return 0;
}
+19
View File
@@ -0,0 +1,19 @@
#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);
};