Skip to content

Commit

Permalink
GmMultiPolyIntersector for python - added a test and some documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
mkennard-aquaveo committed Jan 4, 2024
1 parent c118de4 commit 5bff880
Showing 1 changed file with 30 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,43 @@ 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)
expected_t_vals = (0.08333333333333333, 0.91666666666666667)
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()

0 comments on commit 5bff880

Please sign in to comment.