diff --git a/README.md b/README.md index 24b0ff2..11fdf59 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ This Package contains a few fundamental function which can be used for **matrice - matmul function - transpose function - rot_2D function +- rot_3D function ## matmul function: @@ -89,4 +90,25 @@ rotation matrix for 90°: 6.12323e-17 -1 1 6.12323e-17 ----------- ------------ +``` + +## rot_3D function: +This function calculates the rotation matrix for one 3D axis (x, y, z) for a certain angle. + +**Example:** +``` +theta = math.pi / 2 +R = rot_3D(theta, "y") + +print("rotation matrix for 90° on the y axis:") +print(tabulate(R)) +``` +**Result:** +``` +rotation matrix for 90° on the y axis: +------------ - ----------- + 6.12323e-17 0 1 + 0 1 0 +-1 0 6.12323e-17 +------------ - ----------- ``` \ No newline at end of file diff --git a/matrixmania/__init__.py b/matrixmania/__init__.py index 2dbdec6..e3601ab 100644 --- a/matrixmania/__init__.py +++ b/matrixmania/__init__.py @@ -1 +1 @@ -from .compute import matmul, transpose, rot_2D +from .compute import matmul, transpose, rot_2D, rot_3D diff --git a/matrixmania/compute.py b/matrixmania/compute.py index eb0d0c7..5f285d4 100644 --- a/matrixmania/compute.py +++ b/matrixmania/compute.py @@ -127,3 +127,9 @@ if __name__ == "__main__": print("Matrix A:") print(tabulate(matrix_a)) + theta = math.pi / 2 + R = rot_3D(theta, "y") + + print("rotation matrix for 90° on the y axis:") + print(tabulate(R)) + diff --git a/pyproject.toml b/pyproject.toml index 52c7d87..43e03b6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "matrixmania_benkertmo99686" -version = "0.1.0" +version = "0.2.0" description = "MatrixMania: Simple linear algebra functions for teaching (matmul, transpose, rot_2D)." authors = [ { name="Mona Benkert", email="benkertmo99686@th-nuernberg.de" }