some changes

This commit is contained in:
marcelbls 2025-11-06 16:56:00 +01:00
parent 7973718285
commit 3a027799d1
5 changed files with 23 additions and 7 deletions

View File

@ -14,3 +14,8 @@ Gibt die Transponierte einer gegebenen Matrix zurück (Zeilen und Spalten werden
Erzeugt eine 2D-Rotationsmatrix für einen gegebenen Winkel (in Grad).
Diese Matrix kann verwendet werden, um Punkte in der Ebene um den Ursprung zu rotieren.
**rot_3D(angle, axis):**
Erzeugt eine 3D-Rotationsmatrix für gegebenen Winkel und der gegebenen Achse.
Achse x, y oder z und Wikel zwischen 0 und 360

View File

@ -81,10 +81,6 @@ def rot_3D(angle: float, axis: str) -> List[List[float]]:
:param axis: x,y,z axis of rotation matrix
:return: 3D rotation matrix
"""
if angle > 360:
raise ValueError("angle must be less than 360")
elif angle < 0:
raise ValueError("angle must be greater than 0")
cos = math.cos(math.radians(angle))
sin = math.sin(math.radians(angle))
@ -102,4 +98,8 @@ def rot_3D(angle: float, axis: str) -> List[List[float]]:
if __name__ == "__main__":
print(rot_3D(90, "x"))
print(rot_3D(-90, "x"))
print(transpose([
[1, 2, 3],
[4, 5, 6]
]))

View File

@ -1,6 +1,6 @@
[project]
name = "matrixmania_marcel"
version = "0.1.1"
version = "0.2.0"
description = "MatrixMania: Simple linear algebra functions for teaching (matmul, transpose, rot_2D)."
authors = [

View File

@ -5,5 +5,7 @@ def test_rot_3D():
result = rot_3D(angle,"x")
print(f"Angle:{angle} Rot-Matrix:{result}")
assert result == [[1, 0, 0], [0, 6.123233995736766e-17, -1.0], [0, 1.0, 6.123233995736766e-17]] == [[6.123233995736766e-17, -1.0], [1.0, 6.123233995736766e-17]]
assert result == [[1, 0, 0], [0, 6.123233995736766e-17, -1.0], [0, 1.0, 6.123233995736766e-17]]

View File

@ -1 +1,10 @@
from matrixmania import transpose
def test_transpose():
matrix = [
[1, 2, 3],
[4, 5, 6]
]
matrix = transpose(matrix)
assert matrix == [[1, 4],[2, 5],[3, 6]]