From 773c171c29c899401247a2b98efae70634405965 Mon Sep 17 00:00:00 2001 From: kieran-mackle Date: Mon, 26 Aug 2024 08:42:22 +1000 Subject: [PATCH] test(surface): started test module for surfaces --- tests/test_surface.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tests/test_surface.py diff --git a/tests/test_surface.py b/tests/test_surface.py new file mode 100644 index 0000000..2782395 --- /dev/null +++ b/tests/test_surface.py @@ -0,0 +1,24 @@ +import pytest +from hypervehicle.geometry.vector import Vector3 +from hypervehicle.geometry.surface import CoonsPatch + + +def test_coons_patch(): + # Test instantiation by corners + p00 = Vector3(0, 0, 0) + p10 = Vector3(1, 0, 0) + p01 = Vector3(0, 1, 0) + p11 = Vector3(1, 1, 0) + patch = CoonsPatch(p00=p00, p10=p10, p11=p11, p01=p01) + + assert patch.defined_by_corners == True + + # TODO - Test instantiation by edges + + # Test instantiation by mix of corners and edges + with pytest.raises(Exception) as e_info: + CoonsPatch() + + # Test interpolation + assert patch(0, 0) == p00 + assert patch(1, 1) == p11