-
Notifications
You must be signed in to change notification settings - Fork 0
/
checks.py
32 lines (25 loc) · 1.03 KB
/
checks.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from vectorial_base import *
from scheme import *
from scheme_display import setup_display
# Import some predefined test polygons
from test_boundaries import *
def test (actual_value, expected_value) -> str:
if actual_value == expected_value:
return print(str(actual_value) + ' -> ' + 'OK')
return print(str(actual_value) + ' -> ' + 'ERROR')
# Should be false
# However, with rounded float to the 4th deciaml is true (experimentally proved)
point = Point(-22.4997, -19.999)
segment = Segment(Point(-20.0,-20.0),Point(-82.8538,-20.0))
test(point in segment, False)
# Should be false
# However, with the 'isclose' float comparision is true (experimentally proved)
point = Point(-44.9348, -11.8746)
segment = Segment(Point(-22.112,-11.8742),Point(-148.6031,-11.8742))
test(point in segment, False)
# Should be true
# However, with natural float comparision is false (experimentally proved)
point = Point(49.3939, -20.0)
segment = Segment(Point(49.3939, -1.2122), Point(49.3939, -60.0))
test(point in segment, True)
#setup_display()