diff --git a/src/matrixmania/compute.py b/src/matrixmania/compute.py index 2a11f7a..a9b233c 100644 --- a/src/matrixmania/compute.py +++ b/src/matrixmania/compute.py @@ -23,8 +23,6 @@ __all__ = ["matmul", "transpose"] def matmul(a: list[list[float]] , b:list[list[float]]) -> list[list[float]]: """Return the product of two matrices ``a`` and ``b``. - - Returns ------- List[List[float]] @@ -169,6 +167,13 @@ def transpose(a: list[list[float]]) -> list[list[float]]: [row[i] for row in a] for i in range(len(a[0])) ] + +def project_ortho(point: tuple[float, float], scale: float= 1) -> tuple[float, float]: + #das dreidimensionale wird zweidimensional gezeichnet z muss hinten immer weg + x, y, z = point + return (x * scale, y * scale) + + def main() -> None: """Demonstrate :func:`matmul` with a simple example. This function is only executed when the module is run as a script. diff --git a/test/test_matrixmania/test_projection.py b/test/test_matrixmania/test_projection.py new file mode 100644 index 0000000..72ece99 --- /dev/null +++ b/test/test_matrixmania/test_projection.py @@ -0,0 +1,23 @@ +from matrixmania.compute import project_ortho + +def test_project_ortho_ohneSkalierung(): + # Arrange + point =(1, 2, 3) + expected = (1, 2) + + #Act + result = project_ortho(point) + + #Assert + assert result == expected +def test_project_ortho_mitskalierung(): + #Arrange + point = (1, 2, 3) + scale = 100 + expected =(100, 200) + + #Act + result = project_ortho(point, scale) + + #Assert + assert result == expected \ No newline at end of file