funktion project_ortho implementiert und Testfunktionen hinzugefügt

This commit is contained in:
heinleinju104093 committed 2026-10-22 17:13:38 +02:00
1 parent b5c3ce3308
commit 77a2faa345
3 files changed
+88 -14

No files matched your search

+54 -14
View File
@@ -4,18 +4,10 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="32afd46d-add2-46b7-adb8-c1257e181060" name="Changes" comment="tabulate and ruff added">
<change afterPath="$PROJECT_DIR$/src/matrixmania/__init__.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/matrixmania/compute.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/test/test_matrixmania/__init__.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/test/test_matrixmania/test_rot.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/matrixmania.iml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/modules.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/modules.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/vcs.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
<list default="true" id="32afd46d-add2-46b7-adb8-c1257e181060" name="Changes" comment="structure redefined and tests implemented">
<change afterPath="$PROJECT_DIR$/test/test_matrixmania/test_projection.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/AGENTS.md" beforeDir="false" afterPath="$PROJECT_DIR$/AGENTS.md" afterDir="false" />
<change beforePath="$PROJECT_DIR$/compute.py" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/pyproject.toml" beforeDir="false" afterPath="$PROJECT_DIR$/pyproject.toml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/matrixmania/compute.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/matrixmania/compute.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -44,6 +36,9 @@
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
"ModuleVcsDetector.initialDetectionPerformed": "true",
"Python tests.Python tests for test.test_matrixmania.test_projection.test_project_ortho_no_scale.executor": "Run",
"Python tests.Python tests for test.test_matrixmania.test_projection.test_project_ortho_scale.executor": "Run",
"Python tests.Python tests for test.test_matrixmania.test_rot.test_rot_2d.executor": "Run",
"Python tests.Python tests in test_rot.py.executor": "Run",
"Python.compute.executor": "Run",
"Python.install_dependencies.executor": "Run",
@@ -67,7 +62,7 @@
<recent name="C:\Users\julia\PycharmProjects\matrixmania\src\matrixmania" />
</key>
</component>
<component name="RunManager" selected="Python tests.Python tests for test.test_matrixmania.test_rot.test_rot_2d">
<component name="RunManager" selected="Python tests.Python tests for test.test_matrixmania.test_projection.test_project_ortho_scale">
<configuration name="install_dependencies" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
<module name="matrixmania@1" />
<option name="ENV_FILES" value="" />
@@ -92,6 +87,40 @@
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration name="Python tests for test.test_matrixmania.test_projection.test_project_ortho_no_scale" type="tests" factoryName="Autodetect" temporary="true" nameIsGenerated="true">
<module name="matrixmania@1" />
<option name="ENV_FILES" value="" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="DEBUG_JUST_MY_CODE" value="false" />
<option name="RUN_TOOL" value="" />
<option name="_new_additionalArguments" value="&quot;&quot;" />
<option name="_new_target" value="&quot;test.test_matrixmania.test_projection.test_project_ortho_no_scale&quot;" />
<option name="_new_targetType" value="&quot;PYTHON&quot;" />
<method v="2" />
</configuration>
<configuration name="Python tests for test.test_matrixmania.test_projection.test_project_ortho_scale" type="tests" factoryName="Autodetect" temporary="true" nameIsGenerated="true">
<module name="matrixmania@1" />
<option name="ENV_FILES" value="" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="DEBUG_JUST_MY_CODE" value="false" />
<option name="RUN_TOOL" value="" />
<option name="_new_additionalArguments" value="&quot;&quot;" />
<option name="_new_target" value="&quot;test.test_matrixmania.test_projection.test_project_ortho_scale&quot;" />
<option name="_new_targetType" value="&quot;PYTHON&quot;" />
<method v="2" />
</configuration>
<configuration name="Python tests for test.test_matrixmania.test_rot.test_rot_2d" type="tests" factoryName="Autodetect" temporary="true" nameIsGenerated="true">
<module name="matrixmania@1" />
<option name="ENV_FILES" value="" />
@@ -111,6 +140,8 @@
</configuration>
<recent_temporary>
<list>
<item itemvalue="Python tests.Python tests for test.test_matrixmania.test_projection.test_project_ortho_scale" />
<item itemvalue="Python tests.Python tests for test.test_matrixmania.test_projection.test_project_ortho_no_scale" />
<item itemvalue="Python tests.Python tests for test.test_matrixmania.test_rot.test_rot_2d" />
<item itemvalue="Python.install_dependencies" />
</list>
@@ -155,7 +186,15 @@
<option name="project" value="LOCAL" />
<updated>1792077022970</updated>
</task>
<option name="localTasksCounter" value="4" />
<task id="LOCAL-00004" summary="structure redefined and tests implemented">
<option name="closed" value="true" />
<created>1792679838169</created>
<option name="number" value="00004" />
<option name="presentableId" value="LOCAL-00004" />
<option name="project" value="LOCAL" />
<updated>1792679838169</updated>
</task>
<option name="localTasksCounter" value="5" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
@@ -176,6 +215,7 @@
<MESSAGE value="first commit" />
<MESSAGE value="second" />
<MESSAGE value="tabulate and ruff added" />
<option name="LAST_COMMIT_MESSAGE" value="tabulate and ruff added" />
<MESSAGE value="structure redefined and tests implemented" />
<option name="LAST_COMMIT_MESSAGE" value="structure redefined and tests implemented" />
</component>
</project>
+8
View File
@@ -189,3 +189,11 @@ def rot_3d(angle: float, axis: str) -> list[list[float]]:
return [[cosine, 0.0, sine], [0.0, 1.0, 0.0], [-sine, 0.0, cosine]]
return [[cosine, -sine, 0.0], [sine, cosine, 0.0], [0.0, 0.0, 1.0]]
def project_ortho(point: tuple[float, float, float], scale: float = 1) -> tuple[float, float] :
"""Ignoriert Z-Koordinate und skaliert mit scale multiplier"""
new_point : tuple[float, float] = (
point[0] * scale,
point[1] * scale
)
return new_point
+26
View File
@@ -0,0 +1,26 @@
from matrixmania.compute import project_ortho
def test_project_ortho_no_scale() -> None:
"""Prüft die Funktion project_ortho, ob richtige Form zurückgegeben wird. Ohne scale Parameter"""
#Arrange: Es wird mit dem Tupel (1,2,3) geprüft, erwartet wird das Tupel (1,2)
test_tupel = (1,2,3)
expected_tupel = (1,2)
#Act und Assert: Funktion mit Parameter test_tuple wird mit expected_tupel verglichen
assert project_ortho(test_tupel) == expected_tupel
def test_project_ortho_scale() -> None:
"""Prüft die Funktion project_ortho, ob richtige Form zurückgegeben wird. Mit scale Parameter"""
# Arrange: Es wird mit dem Tupel (1,2,3) geprüft, der scale parameter wird auf 10 gesetzt. Erwartet wird das Tupel (10,20)
test_tupel = (1,2,3)
scale = 10
expected_tupel = (10,20)
# Act und Assert: Funktion mit Parameter test_tuple wird mit expected_tupel verglichen
assert project_ortho(test_tupel,scale) == expected_tupel