def relate_multipolygon(goal: Multipolygon, test: Multipolygon, context: Context) -> Relation: goal_bounding_box = context.polygons_box(goal.polygons) test_bounding_box = context.polygons_box(test.polygons) events_queue = CompoundEventsQueue(context) events_queue.register(to_oriented_segments(goal, context), from_test=False) events_queue.register(to_oriented_segments(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))