Skip to content

Commit b86ee07

Browse files
committed
Add test for normal_polygon
1 parent c14fe46 commit b86ee07

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/compas/geometry/test_core.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from compas.geometry import area_polygon_xy
2020
from compas.geometry import area_triangle
2121
from compas.geometry import area_triangle_xy
22+
from compas.geometry import normal_polygon
2223

2324

2425
@pytest.fixture
@@ -202,3 +203,14 @@ def test_area_triangle(triangle, R):
202203
assert close(area_triangle(triangle.points), 0.5)
203204
assert close(area_triangle_xy(triangle.points), 0.0)
204205
assert close(triangle.area, 0.5)
206+
207+
208+
# ==============================================================================
209+
# normals
210+
# ==============================================================================\
211+
212+
def test_normal_polygon():
213+
polygon = [(0, 0, 0), (10, 0, 0), (10, 10, 0), (0, 10, 0)]
214+
normal = normal_polygon(polygon, unitized=False)
215+
area = area_polygon(polygon)
216+
assert length_vector(normal) == area

0 commit comments

Comments
 (0)