forked from conan0220/FloorSet
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_check_overlap.py
More file actions
136 lines (133 loc) · 6.01 KB
/
_check_overlap.py
File metadata and controls
136 lines (133 loc) · 6.01 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
blocks = [
(58.687180,95.000900,6.835015,7.315272),
(52.873478,102.316399,18.348454,19.620180),
(107.253998,67.920082,17.448942,17.193018),
(86.938194,116.576729,18.478287,19.482327),
(107.253998,92.617493,15.792478,15.830321),
(27.738379,102.876404,21.416887,23.906368),
(95.433647,37.000225,19.456882,20.506882),
(18.964600,126.782997,18.504463,22.697226),
(58.640629,37.000225,20.000000,19.000000),
(58.540798,56.000454,17.000000,12.000000),
(123.046700,90.522636,21.018099,20.981916),
(49.155491,121.936806,7.586629,8.699516),
(105.416702,108.448044,13.224165,13.762684),
(61.922333,162.514160,20.697159,24.447802),
(0.000000,120.530861,15.750462,22.856470),
(37.469288,136.964493,5.758538,6.946208),
(59.701687,121.936806,26.346952,28.807886),
(0.000000,143.387573,15.595260,22.314470),
(0.000000,25.000000,22.000000,8.000000),
(124.703156,68.000679,21.498089,21.583313),
(71.222160,95.000900,7.531751,8.364589),
(115.423950,54.000225,13.485259,13.347907),
(15.595486,149.480453,11.993208,17.509909),
(118.641090,111.504784,17.894327,18.106297),
(56.955906,0.000000,17.356859,19.358343),
(92.458900,136.059280,16.644749,17.963621),
(44.000454,150.744919,16.994616,19.006020),
(43.228054,130.636551,16.306753,19.623770),
(22.000227,30.875505,22.000000,22.000000),
(71.222160,105.441475,14.540076,15.474471),
(27.738379,149.480453,15.249993,17.704926),
(80.261337,20.000227,15.172233,15.818370),
(8.265949,167.468216,13.711206,19.691923),
(105.416702,122.210945,10.999123,11.455459),
(96.423721,57.919857,19.000000,10.000000),
(82.619720,154.023132,18.084194,20.349262),
(34.746719,169.751160,25.007267,30.151237),
(0.000000,67.348358,9.104951,12.850151),
(107.253998,85.113319,7.220031,7.479192),
(109.103882,133.666626,14.730120,15.885818),
(123.834221,129.611313,17.749767,18.929825),
(82.619720,174.372620,17.797100,19.722315),
(123.834221,148.541367,13.456491,13.896640),
(15.750688,187.160385,13.709392,16.849762),
(22.000227,167.185608,12.534937,14.918303),
(100.704140,154.023132,17.167536,18.814583),
(34.978386,199.902634,23.262672,30.263079),
(38.955475,52.875732,10.000000,26.000000),
(59.754211,186.962189,18.717527,21.370342),
(100.704140,172.837936,16.722158,18.418676),
(44.000454,37.000225,11.321651,12.718993),
(88.433418,44.994251,7.000000,16.000000),
(54.253540,68.000679,29.000000,27.000000),
(60.995300,150.744919,9.247594,10.705487),
(0.000000,92.530640,5.238272,6.872496),
(136.535645,111.504784,11.926677,12.073774),
(101.722260,191.256851,10.327248,11.522916),
(128.000000,30.000000,20.000000,24.000000),
(83.253769,63.441025,13.000000,10.000000),
(128.909439,54.000225,11.689281,12.318978),
(15.750688,204.010361,17.180838,22.001255),
(117.871910,167.634903,23.595098,25.429008),
(144.065033,96.223885,13.274943,14.237349),
(78.471970,199.586090,23.019859,28.236486),
(58.241283,208.332748,12.718518,15.096099),
(48.000000,26.000000,22.000000,11.000000),
(101.492050,202.779984,24.107899,27.999123),
(12.746490,59.000225,22.000000,14.000000),
(22.955681,0.000000,34.000000,20.000000),
(9.105177,0.000000,11.464063,13.956657),
(83.253769,73.441246,24.000000,32.000000),
(9.105177,226.011841,19.598152,24.798256),
(141.467239,153.331757,25.923920,28.082172),
(141.584213,123.578781,18.842144,21.175934),
(0.000000,191.460999,14.558166,21.431271),
(28.703556,230.165939,13.462521,19.758558),
(15.864051,121.367523,3.938091,5.078604),
(157.340195,105.441475,16.842852,17.811712),
(71.222160,150.744919,10.632579,11.286067),
(46.174728,230.165939,24.048052,31.437056),
(125.600174,193.064148,12.258735,14.357109),
(141.467239,181.414154,10.286911,11.665308),
(70.960030,208.332748,6.535696,7.497290),
(70.223007,227.822815,9.089650,11.001524),
(117.000008,33.000000,11.000000,9.000000),
(79.312881,230.779327,23.501852,27.657394),
(29.460306,249.924728,13.275821,16.571480),
(34.746719,78.875954,15.000000,14.000000),
(10.000000,42.000000,12.000000,17.000000),
(160.426590,126.782997,24.050974,25.612267),
(29.873251,92.876183,23.000000,10.000000),
(146.201477,85.113319,9.810031,10.703330),
(125.600174,207.421494,18.626274,21.904543),
(9.105177,250.810333,19.026030,25.911869),
(151.754379,181.414154,22.231182,23.795406),
(157.340195,85.113319,18.777412,19.384993),
(146.201477,60.994476,18.971464,20.873453),
(95.433647,19.358568,14.922122,17.155737),
(102.814964,230.779327,18.980103,23.709038),
(137.859131,193.079697,11.659531,12.865012),
(42.736355,261.603241,10.949114,14.613054),
(86.048866,144.754944,5.884518,6.797499),
(148.000229,37.000225,19.917576,21.086903),
(167.391388,152.395493,25.641220,28.391783),
(53.685696,261.603241,14.797407,20.814455),
(4.789265,80.530411,29.000000,12.000000),
(5.738153,92.530640,22.000000,28.000000),
(86.695190,105.441475,18.000000,7.000000),
(141.584213,144.754944,7.564054,7.932254),
(70.223007,258.436951,12.293612,15.617867),
(28.131433,266.496429,14.397168,19.100977),
(112.049736,193.064148,6.020071,6.644440),
(0.000000,212.892502,10.806396,12.955290),
(121.795296,230.779327,16.807571,19.277027),
(144.226669,205.944931,16.696627,18.686409),
]
n = len(blocks)
print(f"Total blocks: {n}")
TOL = 1e-6
overlaps = []
for i in range(n):
xi, yi, wi, hi = blocks[i]
for j in range(i+1, n):
xj, yj, wj, hj = blocks[j]
ox = min(xi+wi, xj+wj) - max(xi, xj)
oy = min(yi+hi, yj+hj) - max(yi, yj)
if ox > TOL and oy > TOL:
overlaps.append((i, j, ox, oy))
print(f"OVERLAP block {i:3d} vs {j:3d}: ox={ox:.10f} oy={oy:.10f}")
print(f" block {i:3d}: x={xi:.6f} y={yi:.6f} x2={xi+wi:.6f} y2={yi+hi:.6f}")
print(f" block {j:3d}: x={xj:.6f} y={yj:.6f} x2={xj+wj:.6f} y2={yj+hj:.6f}")
print(f"\nTotal overlaps: {len(overlaps)}")