new ways to project
This commit is contained in:
1 parent
4a838bfdc8
commit
9b09fc2aac
3 files changed
+60
-2
No files matched your search
@@ -31,3 +31,4 @@ def test_get_3D_rotation_matrix():
|
||||
#Assert
|
||||
assert rot == expected_matrix
|
||||
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
from src.compute import project_ortho, project_perspective
|
||||
|
||||
def test_ortho_proj_unscaled():
|
||||
#Arrange
|
||||
point = (1.0, 2.0, 3.0)
|
||||
expected = (1.0, 2.0)
|
||||
|
||||
#Act
|
||||
result = project_ortho(point)
|
||||
|
||||
#Assert
|
||||
assert result == expected
|
||||
|
||||
|
||||
def test_ortho_proj_scaled():
|
||||
# Arrange
|
||||
point = (1.0, 2.0, 3.0)
|
||||
scale = 100.0
|
||||
expected = (100.0, 200.0)
|
||||
|
||||
# Act
|
||||
result = project_ortho(point, scale)
|
||||
|
||||
# Assert
|
||||
assert result == expected
|
||||
|
||||
def test_perspective_proj_unscaled():
|
||||
# Arrange
|
||||
point = (1.0, 2.0, 3.0)
|
||||
expected = (1/7, 2/7)
|
||||
|
||||
# Act
|
||||
result = project_perspective(point)
|
||||
|
||||
# Assert
|
||||
assert result == expected
|
||||
|
||||
def test_perspective_proj_scaled():
|
||||
# Arrange
|
||||
point = (1.0, 2.0, 3.0)
|
||||
scale = 100.0
|
||||
focal_length = 2
|
||||
expected = (200/7, 400/7)
|
||||
|
||||
# Act
|
||||
result = project_perspective(point, scale, focal_length)
|
||||
|
||||
# Assert
|
||||
assert result == expected
|
||||
Reference in new issue
Block a user