würfel läuft

This commit is contained in:
kreischeran103444 committed 2026-11-05 01:25:22 +01:00
commit 3cc07d2575
13 files changed
+526

No files matched your search

+18
View File
@@ -0,0 +1,18 @@
def project_ortho(point: tuple[float, float, float], scale: float = 1) -> tuple[float, float]:
""" projected 3D-Point orthogonal auf 2D (xy), z Koordinate wird ignoriert
point : tuple[float, float, float]
3-D point (x, y, z).
scale : float, optional
Scaling factor applied (default 1)
"""
x, y, _ = point
return (x * scale, y * scale)
def project_perspective(point: tuple[float, float, float], focal_length: float = 1.0, scale: float = 1.0, camera_distance: float = 4.0) -> tuple[float, float]:
x, y, z = point
x_2d = x * focal_length / (z + camera_distance) * scale
y_2d = y * focal_length / (z + camera_distance) * scale
return (x_2d, y_2d)