From 5bff880671606f58cf443e0875480fa1b197fc54 Mon Sep 17 00:00:00 2001 From: Michael Kennard Date: Thu, 4 Jan 2024 10:40:50 -0700 Subject: [PATCH] GmMultiPolyIntersector for python - added a test and some documentation --- .../multi_poly_intersector_pyt.py | 31 ++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/_package/tests/unit_tests/geometry_tests/multi_poly_intersector_pyt.py b/_package/tests/unit_tests/geometry_tests/multi_poly_intersector_pyt.py index bb7a7a84..4f12439c 100644 --- a/_package/tests/unit_tests/geometry_tests/multi_poly_intersector_pyt.py +++ b/_package/tests/unit_tests/geometry_tests/multi_poly_intersector_pyt.py @@ -50,7 +50,17 @@ def _run_test(self, x1, y1, x2, y2, points, polys, expected_poly_ids, expected_t assert math.isclose(point[i], expected_point[i]), assert_str def test_traverse_line_segment_1_out_out(self): - """A test.""" + """A test. + (10,10) + 3-------------2 + | | + 0------------------1 + | | + | 1 | + | | + 0-------------1 + (0,0) + """ pts = [[0, 0, 0], [10, 0, 0], [10, 10, 0], [0, 10, 0]] polys = [[0, 1, 2, 3]] expected_ids = (1, -1) @@ -58,6 +68,25 @@ def test_traverse_line_segment_1_out_out(self): expected_points = ((0.0, 5.0, 0.0), (10.0, 5.0, 0.0)) self._run_test(-1, 5, 11, 5, pts, polys, expected_ids, expected_t_vals, expected_points) + def test_traverse_line_segment_1_out_in(self): + """A test. + (10,10) + 3-------------2 + | | + 0----------1 | + | | + | 1 | + | | + 0-------------1 + (0,0) + """ + pts = [[0, 0, 0], [10, 0, 0], [10, 10, 0], [0, 10, 0]] + polys = [[0, 1, 2, 3]] + expected_ids = (1, -1) + expected_t_vals = (0.11111111111111111, 1.0) + expected_points = ((0.0, 5.0, 0.0), (8.0, 5.0, 0.0)) + self._run_test(-1, 5, 8, 5, pts, polys, expected_ids, expected_t_vals, expected_points) + if __name__ == '__main__': unittest.main()