Skip to content

Commit 028f142

Browse files
committed
Test one moving + one stationary polygon with distlimit
Also tweak the font for all the images and add an exportall batch file to update them easily. Added an "--only" option to all of the tests so you can only open one (or a few) of the images. Example: py an_test_one_moving_one_stationary_distlimit_no_intr.py --only 1 would open only am01 (instead of am01, am02, am03, and am04) * imgs/test/geometry/test_extrapolated/intersection/out/* - reexport to new fonts + imgs/test_geometry/test_extrapolated_intersection/(many).py - add new test images * pygorithm/geometry/extrapolated_intersection.py - Fix confusing behavior regarding point-line movement * tests/test_geometry.py - fix several tests regarding touching that were incorrectly testing for intersection (when no intersection is occuring). Add new tests for one moving one stationary with distlimit (see images am* through ar*)
1 parent 830140c commit 028f142

File tree

82 files changed

+432
-64
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+432
-64
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
from utils import create_newfig, create_moving_polygon, create_still_polygon, run_or_export
2+
3+
func_code = 'am'
4+
func_name = 'test_one_moving_one_stationary_distlimit_no_intr'
5+
6+
def setup_fig01():
7+
fig, ax, renderer = create_newfig('{}01'.format(func_code))
8+
9+
create_moving_polygon(fig, ax, renderer, ((0, 2), (0, 3), (1, 3), (1, 2)), (4, 0), 'topright')
10+
create_still_polygon(fig, ax, renderer, ((2, 0), (3, 1), (4, 0)), 'botleft')
11+
return fig, ax, '{}01_{}'.format(func_code, func_name)
12+
13+
def setup_fig02():
14+
fig, ax, renderer = create_newfig('{}02'.format(func_code))
15+
16+
create_moving_polygon(fig, ax, renderer, ((1, 3), (1, 4), (2, 4), (2, 3)), (5, -3), 'topright')
17+
create_still_polygon(fig, ax, renderer, ((0, 1), (2, 2), (3, 1), (2, 0)), 'botleft')
18+
return fig, ax, '{}02_{}'.format(func_code, func_name)
19+
20+
def setup_fig03():
21+
fig, ax, renderer = create_newfig('{}03'.format(func_code))
22+
23+
create_moving_polygon(fig, ax, renderer, ((2, 4), (3, 4), (3, 3), (1, 3)), (3, -2), 'topright')
24+
create_still_polygon(fig, ax, renderer, ((0, 1), (2, 2), (3, 0), (2, 0)), 'botleft')
25+
return fig, ax, '{}03_{}'.format(func_code, func_name)
26+
27+
def setup_fig04():
28+
fig, ax, renderer = create_newfig('{}04'.format(func_code))
29+
30+
create_moving_polygon(fig, ax, renderer, ((4, 1.75), (5, 2.5), (6, 2.5), (4, 1.25)), (-2, 1), 'topright')
31+
create_still_polygon(fig, ax, renderer, ((0, 1), (2, 2), (3, 1), (2, 0)), 'botleft')
32+
return fig, ax, '{}04_{}'.format(func_code, func_name)
33+
34+
run_or_export(setup_fig01, setup_fig02, setup_fig03, setup_fig04)
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
from utils import create_newfig, create_moving_polygon, create_still_polygon, run_or_export
2+
3+
func_code = 'an'
4+
func_name = 'test_one_moving_one_stationary_distlimit_touching'
5+
6+
def setup_fig01():
7+
fig, ax, renderer = create_newfig('{}01'.format(func_code))
8+
9+
create_moving_polygon(fig, ax, renderer, ((0, 2), (0, 3), (1, 3), (1, 2)), (5, -1.25), 'topright')
10+
create_still_polygon(fig, ax, renderer, ((3, 0), (3, 1), (4, 1), (4, 0)), 'botleft')
11+
return fig, ax, '{}01_{}'.format(func_code, func_name)
12+
13+
def setup_fig02():
14+
fig, ax, renderer = create_newfig('{}02'.format(func_code))
15+
16+
create_moving_polygon(fig, ax, renderer, ((1, 2), (1, 3), (2, 3), (2, 2)), (4, 0), 'topright')
17+
create_still_polygon(fig, ax, renderer, ((2, 1), (4, 2), (5, 0), (1, 0)), 'botleft')
18+
return fig, ax, '{}02_{}'.format(func_code, func_name)
19+
20+
def setup_fig03():
21+
fig, ax, renderer = create_newfig('{}03'.format(func_code))
22+
23+
create_moving_polygon(fig, ax, renderer, ((2, 4), (3, 4), (3, 2), (1, 3)), (3, -2), 'topright')
24+
create_still_polygon(fig, ax, renderer, ((0, 1), (2.5, 2), (3, 0), (2, 0)), 'botleft')
25+
return fig, ax, '{}03_{}'.format(func_code, func_name)
26+
27+
def setup_fig04():
28+
fig, ax, renderer = create_newfig('{}04'.format(func_code))
29+
30+
create_moving_polygon(fig, ax, renderer, ((0, 0), (1, 2), (2, 1)), (3, 3), 'topright')
31+
create_still_polygon(fig, ax, renderer, ((3, 2), (5, 3), (5, 1)), 'botleft')
32+
return fig, ax, '{}04_{}'.format(func_code, func_name)
33+
34+
run_or_export(setup_fig01, setup_fig02, setup_fig03, setup_fig04)
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
from utils import create_newfig, create_moving_polygon, create_still_polygon, run_or_export
2+
3+
func_code = 'ao'
4+
func_name = 'test_one_moving_one_stationary_distlimit_intr_at_start'
5+
6+
def setup_fig01():
7+
fig, ax, renderer = create_newfig('{}01'.format(func_code))
8+
9+
create_moving_polygon(fig, ax, renderer, ((3, 1), (3, 3), (4, 3), (4, 1)), (2, 0), 'topright')
10+
create_still_polygon(fig, ax, renderer, ((3, 0), (3, 1), (4, 1), (4, 0)), 'botleft')
11+
return fig, ax, '{}01_{}'.format(func_code, func_name)
12+
13+
def setup_fig02():
14+
fig, ax, renderer = create_newfig('{}02'.format(func_code))
15+
16+
create_moving_polygon(fig, ax, renderer, ((3, 1), (3, 3), (4, 3), (4, 1)), (2, -0.25), 'topright')
17+
create_still_polygon(fig, ax, renderer, ((3, 0), (3, 1), (4, 1), (4, 0)), 'botleft')
18+
return fig, ax, '{}02_{}'.format(func_code, func_name)
19+
20+
def setup_fig03():
21+
fig, ax, renderer = create_newfig('{}03'.format(func_code), ylim=(-1, 7))
22+
23+
create_moving_polygon(fig, ax, renderer, ((2, 4), (3, 4), (3, 2), (1, 1)), (-1, 2), 'topright')
24+
create_still_polygon(fig, ax, renderer, ((0, 1), (2.5, 2), (3, 0), (2, 0)), 'botleft')
25+
return fig, ax, '{}03_{}'.format(func_code, func_name)
26+
27+
def setup_fig04():
28+
fig, ax, renderer = create_newfig('{}04'.format(func_code), ylim=(-2, 5))
29+
30+
create_moving_polygon(fig, ax, renderer, ((4, 0), (5, 2), (3, 2)), (0, 3), 'topright')
31+
create_still_polygon(fig, ax, renderer, ((3, 0), (5, 1), (5, -1)), 'botleft')
32+
return fig, ax, '{}04_{}'.format(func_code, func_name)
33+
34+
run_or_export(setup_fig01, setup_fig02, setup_fig03, setup_fig04)
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
from utils import create_newfig, create_moving_polygon, create_still_polygon, run_or_export
2+
3+
func_code = 'ap'
4+
func_name = 'test_one_moving_one_stationary_distlimit_intr_later'
5+
6+
def setup_fig01():
7+
fig, ax, renderer = create_newfig('{}01'.format(func_code), xlim=(-1, 10), ylim=(-1, 7))
8+
9+
create_moving_polygon(fig, ax, renderer, ((2, 2), (2, 3, 'topleft'), (3, 3), (3, 2)), (5, 3), 'none')
10+
create_still_polygon(fig, ax, renderer, ((3, 5, 'topleft'), (4, 5), (4, 4), (3, 4)), 'none')
11+
return fig, ax, '{}01_{}'.format(func_code, func_name)
12+
13+
def setup_fig02():
14+
fig, ax, renderer = create_newfig('{}02'.format(func_code), xlim=(-1, 10), ylim=(-1, 7))
15+
16+
create_moving_polygon(fig, ax, renderer, ((8, 5), (6, 3), (7, 3)), (-4, -3), 'topright')
17+
create_still_polygon(fig, ax, renderer, ((4, 3), (4.5, 3.5), (7, 1), (6, 0)), 'top')
18+
return fig, ax, '{}02_{}'.format(func_code, func_name)
19+
20+
def setup_fig03():
21+
fig, ax, renderer = create_newfig('{}03'.format(func_code))
22+
23+
create_moving_polygon(fig, ax, renderer, ((6, 3), (6, 2), (5, 1), (4, 3)), (-3, 0), 'topright')
24+
create_still_polygon(fig, ax, renderer, ((4, 1.25, 'top'), (5, 0, 'none'), (3, 0, 'none')))
25+
return fig, ax, '{}03_{}'.format(func_code, func_name)
26+
27+
def setup_fig04():
28+
fig, ax, renderer = create_newfig('{}04'.format(func_code), ylim=(-1, 6))
29+
30+
create_moving_polygon(fig, ax, renderer, ((5, 0), (6, 1), (2, 1)), (0, 4), 'topright')
31+
create_still_polygon(fig, ax, renderer, ((3, 3, 'top'), (4, 3), (4, 2), (3, 2)), 'none')
32+
return fig, ax, '{}04_{}'.format(func_code, func_name)
33+
34+
run_or_export(setup_fig01, setup_fig02, setup_fig03, setup_fig04)
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
from utils import create_newfig, create_moving_polygon, create_still_polygon, run_or_export
2+
3+
func_code = 'aq'
4+
func_name = 'test_one_moving_one_stationary_distlimit_touch_at_limit'
5+
6+
def setup_fig01():
7+
fig, ax, renderer = create_newfig('{}01'.format(func_code), ylim=(-1, 7))
8+
9+
create_moving_polygon(fig, ax, renderer, ((0, 0), (0, 1), (1, 1), (1, 0)), (4, 3), 'none')
10+
create_still_polygon(fig, ax, renderer, ((3, 5, 'topleft'), (4, 5), (4, 4), (3, 4)), 'none')
11+
return fig, ax, '{}01_{}'.format(func_code, func_name)
12+
13+
def setup_fig02():
14+
fig, ax, renderer = create_newfig('{}02'.format(func_code), xlim=(-1, 8), ylim=(-1, 7))
15+
16+
create_moving_polygon(fig, ax, renderer, ((4, 4), (5, 6), (4, 3)), (2, -1.5), 'topright')
17+
create_still_polygon(fig, ax, renderer, ((1, 3), (2, 3.5), (7, 1), (6, 0)), 'top')
18+
return fig, ax, '{}02_{}'.format(func_code, func_name)
19+
20+
def setup_fig03():
21+
fig, ax, renderer = create_newfig('{}03'.format(func_code))
22+
23+
create_moving_polygon(fig, ax, renderer, ((6, 3), (6, 2), (5, 1), (4, 3)), (-3, 0), 'topright')
24+
create_still_polygon(fig, ax, renderer, ((0, 3, 'none'), (1, 3), (2, 1), (0, 1, 'none')))
25+
return fig, ax, '{}03_{}'.format(func_code, func_name)
26+
27+
def setup_fig04():
28+
fig, ax, renderer = create_newfig('{}04'.format(func_code))
29+
30+
create_moving_polygon(fig, ax, renderer, ((5, 0, 'none'), (6, 1), (2, 1)), (0, 2), 'topright')
31+
create_still_polygon(fig, ax, renderer, ((3, 4, 'top'), (4, 4), (4, 3), (3, 3)), 'none')
32+
return fig, ax, '{}04_{}'.format(func_code, func_name)
33+
34+
run_or_export(setup_fig01, setup_fig02, setup_fig03, setup_fig04)
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
from utils import create_newfig, create_moving_polygon, create_still_polygon, run_or_export
2+
3+
func_code = 'ar'
4+
func_name = 'test_one_moving_one_stationary_distlimit_intr_after_limit'
5+
6+
def setup_fig01():
7+
fig, ax, renderer = create_newfig('{}01'.format(func_code), ylim=(-1, 7))
8+
9+
create_moving_polygon(fig, ax, renderer, ((0, 0), (0, 1), (1, 1), (1, 0)), (4, 3), 'none')
10+
create_still_polygon(fig, ax, renderer, ((5.5, 5.5, 'topleft'), (6.5, 5.5), (6.5, 4.5), (5.5, 4.5)), 'none')
11+
return fig, ax, '{}01_{}'.format(func_code, func_name)
12+
13+
def setup_fig02():
14+
fig, ax, renderer = create_newfig('{}02'.format(func_code), xlim=(-1, 8), ylim=(-1, 7))
15+
16+
create_moving_polygon(fig, ax, renderer, ((4, 4), (5, 6), (4, 3)), (1.2, -0.9), 'topright')
17+
create_still_polygon(fig, ax, renderer, ((1, 3), (2, 3.5), (7, 1), (6, 0)), 'top')
18+
return fig, ax, '{}02_{}'.format(func_code, func_name)
19+
20+
def setup_fig03():
21+
fig, ax, renderer = create_newfig('{}03'.format(func_code))
22+
23+
create_moving_polygon(fig, ax, renderer, ((6, 3), (6, 2), (5, 1), (4, 3)), (-2.5, 0), 'topright')
24+
create_still_polygon(fig, ax, renderer, ((0, 3, 'none'), (1, 3), (2, 1), (0, 1, 'none')))
25+
return fig, ax, '{}03_{}'.format(func_code, func_name)
26+
27+
def setup_fig04():
28+
fig, ax, renderer = create_newfig('{}04'.format(func_code))
29+
30+
create_moving_polygon(fig, ax, renderer, ((5, 0, 'none'), (6, 1), (2, 1)), (0, 1.75), 'topright')
31+
create_still_polygon(fig, ax, renderer, ((3, 4, 'top'), (4, 4), (4, 3), (3, 3)), 'none')
32+
return fig, ax, '{}04_{}'.format(func_code, func_name)
33+
34+
run_or_export(setup_fig01, setup_fig02, setup_fig03, setup_fig04)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
@echo off
2+
setlocal EnableExtensions EnableDelayedExpansion
3+
4+
for %%f in (*.py) do (
5+
set fn="%%~nf"
6+
if not "x!fn:test=!" == "x!fn!" (
7+
echo "exporting !fn!.."
8+
py "!fn!.py" --export
9+
)
10+
)
11+
endlocal
-2.14 KB
-1.89 KB
-2.58 KB

0 commit comments

Comments
 (0)