Hausaufgabe perspektivische Projektion und Tests

This commit is contained in:
naifla103879 committed 2026-10-26 13:31:58 +01:00
1 parent 9aa475906e
commit f54fc5d4ef
2 files changed
+64 -1

No files matched your search

+27 -1
View File
@@ -1,5 +1,7 @@
from matrixmania.compute import project_ortho
import pytest
from matrixmania.compute import project_ortho, project_perspective
def test_project_ortho_default():
@@ -24,3 +26,27 @@ def test_project_ortho_scale_100():
# Assert
assert result == expected
def test_project_perspective_default():
# Arrange
point = (1.0, 2.0, 3.0)
expected = (1.0 / 7.0, 2.0 / 7.0)
# Act
result = project_perspective(point)
# Assert
assert result == pytest.approx(expected)
def test_project_perspective_focal_length_2_scale_100():
# Arrange
point = (1.0, 2.0, 3.0)
expected = ((1.0 * 2.0 / 7.0) * 100, (2.0 * 2.0 / 7.0) * 100)
# Act
result = project_perspective(point, focal_length=2.0, scale=100)
# Assert
assert result == pytest.approx(expected)