files added, compute modified

This commit is contained in:
englingvi103466 committed 2026-10-22 13:34:49 +02:00
1 parent 806434d813
commit ebd75fe26e
9 files changed
+527

No files matched your search

+6
View File
@@ -128,6 +128,12 @@ def project_ortho(point: tuple[float, float, float], scale: float = 1.0) -> tupl
x, y, z = point
return (x * scale, y * scale)
def project_perspective(point: tuple[float, float, float], distance: float = 200.0, scale: float = 1.0) -> tuple[float, float]:
"""Projiziert einen 3D-Punkt perspektivisch auf eine 2D-Fläche."""
x, y, z = point
# Verhindert Division durch 0, falls z genau bei -distance liegt
factor = distance / (distance + z) if (distance + z) != 0 else 1.0
return (x * factor * scale, y * factor * scale)
if __name__ == "__main__":
a = [[1, 2, 3], [4, 5, 6]]