Compare commits
No commits in common. "922ee7739e11fe8033e55f0ae26801dd7a63f326" and "7e0c77642dd2894d34ad72535b8933f6508dfaa2" have entirely different histories.
922ee7739e
...
7e0c77642d
Binary file not shown.
Binary file not shown.
@ -1,7 +1,6 @@
|
|||||||
from typing import List
|
from typing import List
|
||||||
import math
|
import math
|
||||||
from tabulate import tabulate
|
from tabulate import tabulate
|
||||||
from typing import Tuple
|
|
||||||
|
|
||||||
def matmul(mat1: List[List[int]], mat2: List[List[int]]) -> List[List[int]]:
|
def matmul(mat1: List[List[int]], mat2: List[List[int]]) -> List[List[int]]:
|
||||||
"""
|
"""
|
||||||
@ -120,18 +119,6 @@ def rot_3D(angle: float, axis: str) -> List[List[float]]:
|
|||||||
else:
|
else:
|
||||||
raise ValueError("Axis must be 'x', 'y', or 'z'.")
|
raise ValueError("Axis must be 'x', 'y', or 'z'.")
|
||||||
|
|
||||||
def project_ortho(point: Tuple[float, float, float], scale: float = 1) -> Tuple[float, float]:
|
|
||||||
"""
|
|
||||||
Retruns a 2d point with optional scaling
|
|
||||||
|
|
||||||
ignores the z axis and if scaling needed scales the 2d point
|
|
||||||
|
|
||||||
:param point: Coordinates of a 3d point
|
|
||||||
:param scale: scaling factor (else 1)
|
|
||||||
:return: A 2d point
|
|
||||||
"""
|
|
||||||
return scale * point[0], scale * point[1]
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
# Test matrix multiplication
|
# Test matrix multiplication
|
||||||
@ -163,6 +150,7 @@ def main():
|
|||||||
print("Matrix A:")
|
print("Matrix A:")
|
||||||
print(tabulate(matrix_a))
|
print(tabulate(matrix_a))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "matrixmania_shehibr"
|
name = "matrixmania_shehibr"
|
||||||
version = "0.3.0"
|
version = "0.2.0"
|
||||||
description = "MatrixMania: Simple linear algebra functions for teaching (matmul, transpose,rot_2D)."
|
description = "MatrixMania: Simple linear algebra functions for teaching (matmul, transpose,rot_2D)."
|
||||||
authors = [
|
authors = [
|
||||||
{ name="shehibr", email="shehibr98345@th-nuernberg.de" }
|
{ name="shehibr", email="shehibr98345@th-nuernberg.de" }
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,14 +0,0 @@
|
|||||||
from matrixmania.compute import project_ortho
|
|
||||||
|
|
||||||
def test_project_ortho_no_scale():
|
|
||||||
point = (1.0, 2.0, 3.0)
|
|
||||||
result = project_ortho(point)
|
|
||||||
expected = (1.0, 2.0)
|
|
||||||
assert result == expected
|
|
||||||
|
|
||||||
|
|
||||||
def test_project_ortho_with_scale():
|
|
||||||
point = (1.0, 2.0, 3.0)
|
|
||||||
result = project_ortho(point, scale=100)
|
|
||||||
expected = (100.0, 200.0)
|
|
||||||
assert result == expected
|
|
||||||
Loading…
x
Reference in New Issue
Block a user