4 from __future__
import division
5 import object.Segment
as sg
51 if edge.num_faces < 2:
52 remaining_edges.append(edge)
53 for edge
in remaining_edges:
60 adjacent = sg.adjacent_edges(common_x_edge, common_y_edge, edge, remaining_edges)
71 if (x3 == common_x_edge)
and (y3 == common_y_edge):
74 adjacent2 = sg.adjacent_edges(common_x_a, common_y_a, a, remaining_edges)
78 adjacent2 = sg.adjacent_edges(common_x_a, common_y_a, a, remaining_edges)
84 if (x5 == common_x_a)
and (y5 == common_y_a):
86 if (x6 == x2)
and (y6 == y2):
87 boards.extend((edge, a, b))
99 if (x5 == x2)
and (y5 == y2):
100 boards.extend((edge, a, b))
120 if edge.num_faces < 2:
121 remaining_edges.append(edge)
122 for edge
in remaining_edges:
129 adjacent = sg.adjacent_edges(common_x_edge, common_y_edge, edge, remaining_edges)
139 if (x3 == common_x_edge)
and (y3 == common_y_edge):
142 adjacent2 = sg.adjacent_edges(common_x_a, common_y_a, a, remaining_edges)
146 adjacent2 = sg.adjacent_edges(common_x_a, common_y_a, a, remaining_edges)
152 if (x5 == common_x_a)
and (y5 == common_y_a):
154 if (x6 == x2)
and (y6 == y2):
161 adjacent3 = sg.adjacent_edges(common_x_b, common_y_b, b, remaining_edges)
164 if (x5 == x2)
and (y5 == y2):
170 adjacent3 = sg.adjacent_edges(common_x_b, common_y_b, b, remaining_edges)
176 if (x7 == common_x_b)
and (y7 == common_y_b):
178 if (x8 == x2)
and (y8 == y2):
179 boards.extend((edge, a, b, c))
192 if (x7 == x2)
and (y7 == y2):
193 boards.extend((edge, a, b, c))
213 if edge.num_faces < 2:
214 remaining_edges.append(edge)
215 for edge
in remaining_edges:
222 adjacent = sg.adjacent_edges(common_x_edge, common_y_edge, edge, remaining_edges)
232 if (x3 == common_x_edge)
and (y3 == common_y_edge):
235 adjacent2 = sg.adjacent_edges(common_x_a, common_y_a, a, remaining_edges)
239 adjacent2 = sg.adjacent_edges(common_x_a, common_y_a, a, remaining_edges)
245 if (x5 == common_x_a)
and (y5 == common_y_a):
247 if (x6 == x2)
and (y6 == y2):
254 adjacent3 = sg.adjacent_edges(common_x_b, common_y_b, b, remaining_edges)
257 if (x5 == x2)
and (y5 == y2):
263 adjacent3 = sg.adjacent_edges(common_x_b, common_y_b, b, remaining_edges)
269 if (x7 == common_x_b)
and (y7 == common_y_b):
271 if (x8 == x2)
and (y8 == y2):
277 adjacent4 = sg.adjacent_edges(common_x_c, common_y_c, c, remaining_edges)
280 if (x7 == x2)
and (y7 == y2):
286 adjacent4 = sg.adjacent_edges(common_x_c, common_y_c, c, remaining_edges)
292 if (x9 == common_x_c)
and (y9 == common_y_c):
294 if (x10 == x2)
and (y10 == y2)
and (d != edge):
295 boards.extend((edge,a,b,c,d))
309 if (x9 == x2)
and (y9 == y2)
and (d != edge):
310 boards.extend((edge, a, b, c, d))
331 if edge.num_faces < 2:
332 remaining_edges.append(edge)
333 for edge
in remaining_edges:
340 adjacent = sg.adjacent_edges(common_x_edge, common_y_edge, edge, remaining_edges)
350 if (x3 == common_x_edge)
and (y3 == common_y_edge):
353 adjacent2 = sg.adjacent_edges(common_x_a, common_y_a, a, remaining_edges)
357 adjacent2 = sg.adjacent_edges(common_x_a, common_y_a, a, remaining_edges)
363 if (x5 == common_x_a)
and (y5 == common_y_a):
365 if (x6==x2)
and (y6==y2):
372 adjacent3 = sg.adjacent_edges(common_x_b, common_y_b, b, remaining_edges)
375 if (x5 == x2)
and (y5 == y2):
381 adjacent3 = sg.adjacent_edges(common_x_b, common_y_b, b, remaining_edges)
387 if (x7 == common_x_b)
and (y7 == common_y_b):
389 if (x8 == x2)
and (y8 == y2):
395 adjacent4 = sg.adjacent_edges(common_x_c, common_y_c, c, remaining_edges)
398 if (x7 == x2)
and (y7 == y2):
404 adjacent4 = sg.adjacent_edges(common_x_c, common_y_c, c, remaining_edges)
410 if (x9 == common_x_c)
and (y9 == common_y_c):
412 if (x10 == x2)
and (y10 == y2)
and (d != edge):
417 adjacent5 = sg.adjacent_edges(common_x_d, common_y_d, d, remaining_edges)
420 if (x9 == x2)
and (y9 == y2)
and (d != edge):
425 adjacent5 = sg.adjacent_edges(common_x_d, common_y_d, d, remaining_edges)
431 if (x11 == common_x_d)
and (y11 == common_y_d):
433 if (x12 == x2)
and (y12 == y2)
and (e != edge):
434 boards.extend((edge,a,b,c,d,e))
449 if (x11 == x2)
and (y11 == y2)
and (e != edge):
450 boards.extend((edge,a,b,c,d,e))
472 if edge.num_faces < 2:
473 remaining_edges.append(edge)
474 for edge
in remaining_edges:
481 adjacent = sg.adjacent_edges(common_x_edge, common_y_edge, edge, remaining_edges)
491 if (x3 == common_x_edge)
and (y3 == common_y_edge):
494 adjacent2 = sg.adjacent_edges(common_x_a, common_y_a, a, remaining_edges)
498 adjacent2 = sg.adjacent_edges(common_x_a, common_y_a, a, remaining_edges)
504 if (x5 == common_x_a)
and (y5 == common_y_a):
506 if (x6==x2)
and (y6==y2):
513 adjacent3 = sg.adjacent_edges(common_x_b, common_y_b, b, remaining_edges)
516 if (x5 == x2)
and (y5 == y2):
522 adjacent3 = sg.adjacent_edges(common_x_b, common_y_b, b, remaining_edges)
528 if (x7 == common_x_b)
and (y7 == common_y_b):
530 if (x8 == x2)
and (y8 == y2):
536 adjacent4 = sg.adjacent_edges(common_x_c, common_y_c, c, remaining_edges)
539 if (x7 == x2)
and (y7 == y2):
545 adjacent4 = sg.adjacent_edges(common_x_c, common_y_c, c, remaining_edges)
551 if (x9 == common_x_c)
and (y9 == common_y_c):
553 if (x10 == x2)
and (y10 == y2)
and (d != edge):
558 adjacent5 = sg.adjacent_edges(common_x_d, common_y_d, d, remaining_edges)
561 if (x9 == x2)
and (y9 == y2)
and (d != edge):
566 adjacent5 = sg.adjacent_edges(common_x_d, common_y_d, d, remaining_edges)
572 if (x11 == common_x_c)
and (y11 == common_y_c):
574 if (x12 == x2)
and (y12 == y2)
and (e != edge):
579 adjacent6 = sg.adjacent_edges(common_x_e, common_y_e, e, remaining_edges)
582 if (x11 == x2)
and (y11 == y2)
and (e != edge):
587 adjacent6 = sg.adjacent_edges(common_x_e, common_y_e, e, remaining_edges)
593 if (x13 == common_x_e)
and (y13 == common_y_e):
595 if (x14 == x2)
and (y14 == y2)
and (f != edge):
596 boards.extend((edge,a,b,c,d,e,f))
612 if (x13 == x2)
and (y13 == y2)
and (f != edge):
613 boards.extend((edge,a,b,c,d,e,f))
633 if (edge
in face.borders)
and (a
in face.borders):
642 sides2 = face2.borders
643 if (all(
inside(side, sides2)
for side
in sides))
and (all(
inside(side1, sides)
for side1
in sides2)):
662 for border
in face1.borders:
663 borders1.append(border)
664 for border
in face2.borders:
665 borders2.append(border)
673 for border
in face1.borders:
674 borders1.append(border)
675 for border
in face2.borders:
676 borders2.append(border)