jetzt funktionierts
This commit is contained in:
1 parent
bb785bb25c
commit
71c9eb485b
2 files changed
+30
-2
No files matched your search
@@ -23,8 +23,6 @@ __all__ = ["matmul", "transpose"]
|
|||||||
|
|
||||||
def matmul(a: list[list[float]] , b:list[list[float]]) -> list[list[float]]:
|
def matmul(a: list[list[float]] , b:list[list[float]]) -> list[list[float]]:
|
||||||
"""Return the product of two matrices ``a`` and ``b``.
|
"""Return the product of two matrices ``a`` and ``b``.
|
||||||
|
|
||||||
|
|
||||||
Returns
|
Returns
|
||||||
-------
|
-------
|
||||||
List[List[float]]
|
List[List[float]]
|
||||||
@@ -169,6 +167,13 @@ def transpose(a: list[list[float]]) -> list[list[float]]:
|
|||||||
[row[i] for row in a]
|
[row[i] for row in a]
|
||||||
for i in range(len(a[0]))
|
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:
|
def main() -> None:
|
||||||
"""Demonstrate :func:`matmul` with a simple example.
|
"""Demonstrate :func:`matmul` with a simple example.
|
||||||
This function is only executed when the module is run as a script.
|
This function is only executed when the module is run as a script.
|
||||||
|
|||||||
@@ -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
|
||||||
Reference in new issue
Block a user