-
Notifications
You must be signed in to change notification settings - Fork 1
/
get_haus.py
54 lines (42 loc) · 1.14 KB
/
get_haus.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import sys
from rtree import Rtree, index
if len(sys.argv) != 3:
print 'Usage: get_haus <pt_set_file_1> <pt_set_file_2>'
exit()
p = index.Property()
p.set_index_capacity(4)
p.set_leaf_capacity(10)
def get_points(filename):
for id, l in enumerate(open(filename)):
x,y = l.split()
x,y = float(x), float(y)
yield (id, (x,y,x,y), None)
idx1 = Rtree(get_points(sys.argv[1]), properties=p)
idx2 = Rtree(get_points(sys.argv[2]), properties=p)
idx1.select_mbrs(40);
idx2.select_mbrs(40);
print idx1.hausdorff(idx2,1)
print idx2.hausdorff(idx1,1)
print idx1.hausdorff(idx2,2)
print idx2.hausdorff(idx1,2)
print idx1.hausdorff(idx2,0)
print idx2.hausdorff(idx1,0)
print
idx1.select_mbrs(80);
idx2.select_mbrs(80);
print idx1.hausdorff(idx2,1)
print idx2.hausdorff(idx1,1)
print idx1.hausdorff(idx2,2)
print idx2.hausdorff(idx1,2)
print idx1.hausdorff(idx2,0)
print idx2.hausdorff(idx1,0)
print
idx1.select_mbrs(160);
idx2.select_mbrs(160);
print idx1.hausdorff(idx2,1)
print idx2.hausdorff(idx1,1)
print idx1.hausdorff(idx2,2)
print idx2.hausdorff(idx1,2)
print idx1.hausdorff(idx2,0)
print idx2.hausdorff(idx1,0)
print