From a43276cce107b5dc4697a072d0000d12e29c3dcd Mon Sep 17 00:00:00 2001 From: wmayer Date: Sun, 13 Feb 2022 17:44:43 +0100 Subject: [PATCH] Mesh: [skip ci] add Mesh unit test for nearestFacetOnRay --- src/Mod/Mesh/App/MeshTestsApp.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Mod/Mesh/App/MeshTestsApp.py b/src/Mod/Mesh/App/MeshTestsApp.py index 4c32fc6570..1bff750057 100644 --- a/src/Mod/Mesh/App/MeshTestsApp.py +++ b/src/Mod/Mesh/App/MeshTestsApp.py @@ -192,6 +192,15 @@ class MeshSplitTestCases(unittest.TestCase): self.assertFalse(self.mesh.hasCorruptedFacets()) self.assertTrue(self.mesh.isSolid()) + def testFindNearest(self): + self.assertEqual(len(self.mesh.nearestFacetOnRay((-2,2,-6),(0,0,1))), 0) + self.assertEqual(len(self.mesh.nearestFacetOnRay((0.5,0.5,0.5),(0,0,1))), 1) + self.assertEqual(len(self.mesh.nearestFacetOnRay((0.5,0.5,0.5),(0,0,1),-math.pi/2)), 0) + self.assertEqual(len(self.mesh.nearestFacetOnRay((0.2,0.1,0.2),(0,0, 1))), + len(self.mesh.nearestFacetOnRay((0.2,0.1,0.2),(0,0,-1)))) + self.assertEqual(len(self.mesh.nearestFacetOnRay((0.2,0.1,0.2),(0,0, 1), math.pi/2)), + len(self.mesh.nearestFacetOnRay((0.2,0.1,0.2),(0,0,-1), math.pi/2))) + class MeshGeoTestCases(unittest.TestCase): def setUp(self): # set up a planar face with 2 triangles