def relate_multiregion(goal: Multiregion, test: Multiregion, context: Context) -> Relation: goal_bounding_box = context.contours_box(goal) test_bounding_box = context.contours_box(test) if box.disjoint_with(goal_bounding_box, test_bounding_box): return Relation.DISJOINT events_queue = CompoundEventsQueue(context) events_queue.register(to_oriented_edges_endpoints(goal, context), from_test=False) events_queue.register(to_oriented_edges_endpoints(test, context), from_test=True) return process_compound_queue( events_queue, min(goal_bounding_box.max_x, test_bounding_box.max_x))
def relate_multiregion(multipolygon: Multipolygon, multiregion: Multiregion, context: Context) -> Relation: multiregion_bounding_box = context.contours_box(multiregion) multipolygon_bounding_box = context.polygons_box(multipolygon.polygons) if box.disjoint_with(multipolygon_bounding_box, multiregion_bounding_box): return Relation.DISJOINT events_queue = CompoundEventsQueue(context) events_queue.register(to_oriented_segments(multipolygon, context), from_test=False) events_queue.register(multiregion_to_oriented_segments( multiregion, context), from_test=True) return process_compound_queue( events_queue, min(multipolygon_bounding_box.max_x, multiregion_bounding_box.max_x))