Changeset 8038
 Timestamp:
 Oct 15, 2010, 5:18:20 PM (13 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/anuga_core/source/anuga/geometry/test_polygon.py
r8032 r8038 13 13 plot_polygons, outside_polygon, is_outside_polygon, \ 14 14 intersection, is_complex, polygon_overlap, not_polygon_overlap,\ 15 polyline_overlap, not_polyline_overlap,\ 15 16 is_inside_triangle, interpolate_polyline, inside_polygon, \ 16 17 in_and_outside_polygon … … 502 503 assert num.allclose([0], indices) 503 504 505 def test_polyline_overlap(self): 506 #rectangular polygon, 2 triangles overlap 507 polyline = [[3.,3.],[4.,3.]] 508 triangles = [[7.,10.],#does not overlap 509 [8.,12.], 510 [9.,10.], 511 [3., 2.],#intersect 512 [4., 5.], 513 [5., 3.], 514 [3., 2.],#intersect 515 [4., 5.], 516 [5., 2.], 517 [0., 1.],#polygon inside triangle 518 [5., 50.], 519 [10., 1.], 520 [3.5, 3.25],#no overlap 521 [4., 3.75], 522 [4.5, 3.25], 523 [2., 3.],#overlap 524 [5., 3.], 525 [3., 1.]] 526 527 indices = polyline_overlap(triangles, polyline) 528 assert num.allclose([1, 2, 3, 5], indices) 529 530 def test_not_polyline_overlap(self): 531 #rectangular polygon, 2 triangles overlap 532 polyline = [[3.,3.],[4.,3.]] 533 triangles = [[7.,10.],#does not overlap 534 [8.,12.], 535 [9.,10.], 536 [3., 2.],#intersect 537 [4., 5.], 538 [5., 3.], 539 [3., 2.],#intersect 540 [4., 5.], 541 [5., 2.], 542 [0., 1.],#polygon inside triangle 543 [5., 50.], 544 [10., 1.], 545 [3.5, 3.25],#no overlap 546 [4., 3.75], 547 [4.5, 3.25], 548 [2., 3.],#overlap 549 [5., 3.], 550 [3., 1.]] 551 552 indices = not_polyline_overlap(triangles, polyline) 553 assert num.allclose([4, 0], indices) 554 504 555 def test_is_inside_triangle(self): 505 556 # Simplest case:
Note: See TracChangeset
for help on using the changeset viewer.