def test_reversals(multipolygons_pair: MultipolygonsPair) -> None: left_multipolygon, right_multipolygon = multipolygons_pair result = intersect_multipolygons(left_multipolygon, right_multipolygon) assert result == intersect_multipolygons( reverse_multipolygon(left_multipolygon), right_multipolygon) assert result == intersect_multipolygons( left_multipolygon, reverse_multipolygon(right_multipolygon)) assert result == intersect_multipolygons( reverse_multipolygon_borders(left_multipolygon), right_multipolygon) assert result == intersect_multipolygons( left_multipolygon, reverse_multipolygon_borders(right_multipolygon)) assert result == intersect_multipolygons( reverse_multipolygon_holes(left_multipolygon), right_multipolygon) assert result == intersect_multipolygons( left_multipolygon, reverse_multipolygon_holes(right_multipolygon)) assert result == intersect_multipolygons( reverse_multipolygon_holes_contours(left_multipolygon), right_multipolygon) assert result == intersect_multipolygons( left_multipolygon, reverse_multipolygon_holes_contours(right_multipolygon))
def test_reversals( context_with_multipolygon_and_steps: Tuple[Context, Multipolygon, Scalar, Scalar] ) -> None: context, multipolygon, step_x, step_y = context_with_multipolygon_and_steps result = context.translate_multipolygon(multipolygon, step_x, step_y) assert reverse_multipolygon(result) == context.translate_multipolygon( reverse_multipolygon(multipolygon), step_x, step_y) assert (reverse_multipolygon_coordinates( result) == context.translate_multipolygon( reverse_multipolygon_coordinates(multipolygon), step_y, step_x))
def test_reversals( context_with_multipolygon_and_factors: Tuple[Context, Multipolygon, Scalar, Scalar] ) -> None: (context, multipolygon, factor_x, factor_y) = context_with_multipolygon_and_factors result = context.scale_multipolygon(multipolygon, factor_x, factor_y) assert (not isinstance(result, context.multipolygon_cls) or reverse_multipolygon(result) == context.scale_multipolygon( reverse_multipolygon(multipolygon), factor_x, factor_y)) assert (reverse_geometry_coordinates(result) == context.scale_multipolygon( reverse_multipolygon_coordinates(multipolygon), factor_y, factor_x))
def test_reversals( context_with_polygons: Tuple[Context, Multipolygon]) -> None: context, multipolygon = context_with_polygons result = context.multipolygon_centroid(multipolygon) assert result == context.multipolygon_centroid( reverse_multipolygon(multipolygon)) assert reverse_point_coordinates(result) == context.multipolygon_centroid( reverse_multipolygon_coordinates(multipolygon))
def test_reversals(multipolygons_pair: MultipolygonsPair) -> None: left_multipolygon, right_multipolygon = multipolygons_pair result = symmetric_subtract_multipolygons(left_multipolygon, right_multipolygon) assert are_multipolygons_similar( result, symmetric_subtract_multipolygons( reverse_multipolygon(left_multipolygon), right_multipolygon)) assert are_multipolygons_similar( result, symmetric_subtract_multipolygons( left_multipolygon, reverse_multipolygon(right_multipolygon))) assert are_multipolygons_similar( result, symmetric_subtract_multipolygons( reverse_multipolygon_borders(left_multipolygon), right_multipolygon)) assert are_multipolygons_similar( result, symmetric_subtract_multipolygons( left_multipolygon, reverse_multipolygon_borders(right_multipolygon))) assert are_multipolygons_similar( result, symmetric_subtract_multipolygons( reverse_multipolygon_holes(left_multipolygon), right_multipolygon)) assert are_multipolygons_similar( result, symmetric_subtract_multipolygons( left_multipolygon, reverse_multipolygon_holes(right_multipolygon))) assert are_multipolygons_similar( result, symmetric_subtract_multipolygons( reverse_multipolygon_holes_contours(left_multipolygon), right_multipolygon)) assert are_multipolygons_similar( result, symmetric_subtract_multipolygons( left_multipolygon, reverse_multipolygon_holes_contours(right_multipolygon)))
def test_reversals( multipolygon_with_point: Tuple[Multipolygon, Point]) -> None: multipolygon, point = multipolygon_with_point result = point_in_multipolygon(point, multipolygon) assert result is point_in_multipolygon(point, reverse_multipolygon(multipolygon)) assert result is point_in_multipolygon( point, reverse_multipolygon_borders(multipolygon)) assert result is point_in_multipolygon( point, reverse_multipolygon_holes(multipolygon)) assert result is point_in_multipolygon( point, reverse_multipolygon_holes_contours(multipolygon)) assert result is point_in_multipolygon( reverse_point_coordinates(point), reverse_multipolygon_coordinates(multipolygon))
def test_reversals( multipolygon_with_region: Tuple[Multipolygon, Region]) -> None: multipolygon, region = multipolygon_with_region result = region_in_multipolygon(region, multipolygon) assert result is region_in_multipolygon(reverse_contour(region), multipolygon) assert result is region_in_multipolygon(region, reverse_multipolygon(multipolygon)) assert result is region_in_multipolygon( region, reverse_multipolygon_borders(multipolygon)) assert result is region_in_multipolygon( region, reverse_multipolygon_holes(multipolygon)) assert result is region_in_multipolygon( region, reverse_multipolygon_holes_contours(multipolygon)) assert result is region_in_multipolygon( reverse_contour_coordinates(region), reverse_multipolygon_coordinates(multipolygon))
def test_reversals( multipolygon_with_multisegment: MultipolygonWithMultisegment) -> None: multipolygon, multisegment = multipolygon_with_multisegment result = complete_intersect_multisegment_with_multipolygon( multisegment, multipolygon) assert result == complete_intersect_multisegment_with_multipolygon( multisegment, reverse_multipolygon(multipolygon)) assert result == complete_intersect_multisegment_with_multipolygon( multisegment, reverse_multipolygon_borders(multipolygon)) assert result == complete_intersect_multisegment_with_multipolygon( multisegment, reverse_multipolygon_holes(multipolygon)) assert result == complete_intersect_multisegment_with_multipolygon( multisegment, reverse_multipolygon_holes_contours(multipolygon)) assert result == complete_intersect_multisegment_with_multipolygon( reverse_multisegment(multisegment), multipolygon) assert result == complete_intersect_multisegment_with_multipolygon( reverse_multisegment_endpoints(multisegment), multipolygon)
def test_reversals( multipolygon_with_segment: Tuple[Multipolygon, Segment]) -> None: multipolygon, segment = multipolygon_with_segment result = segment_in_multipolygon(segment, multipolygon) assert result is segment_in_multipolygon(reverse_segment(segment), multipolygon) assert result is segment_in_multipolygon( segment, reverse_multipolygon(multipolygon)) assert result is segment_in_multipolygon( segment, reverse_multipolygon_borders(multipolygon)) assert result is segment_in_multipolygon( segment, reverse_multipolygon_holes(multipolygon)) assert result is segment_in_multipolygon( segment, reverse_multipolygon_holes_contours(multipolygon)) assert result is segment_in_multipolygon( reverse_segment_coordinates(segment), reverse_multipolygon_coordinates(multipolygon))
def test_reversals( multipolygon_with_polygon: Tuple[Multipolygon, Polygon]) -> None: multipolygon, polygon = multipolygon_with_polygon result = polygon_in_multipolygon(polygon, multipolygon) assert result is polygon_in_multipolygon(reverse_polygon_border(polygon), multipolygon) assert result is polygon_in_multipolygon(reverse_polygon_holes(polygon), multipolygon) assert result is polygon_in_multipolygon( reverse_polygon_holes_contours(polygon), multipolygon) assert result is polygon_in_multipolygon( polygon, reverse_multipolygon(multipolygon)) assert result is polygon_in_multipolygon( polygon, reverse_multipolygon_borders(multipolygon)) assert result is polygon_in_multipolygon( polygon, reverse_multipolygon_holes(multipolygon)) assert result is polygon_in_multipolygon( polygon, reverse_multipolygon_holes_contours(multipolygon)) assert result is polygon_in_multipolygon( reverse_polygon_coordinates(polygon), reverse_multipolygon_coordinates(multipolygon))
def test_reversals( multipolygon_with_multisegment: MultipolygonWithMultisegment) -> None: multipolygon, multisegment = multipolygon_with_multisegment result = subtract_multipolygon_from_multisegment(multisegment, multipolygon) assert result == subtract_multipolygon_from_multisegment( multisegment, reverse_multipolygon(multipolygon)) assert result == subtract_multipolygon_from_multisegment( multisegment, reverse_multipolygon_borders(multipolygon)) assert result == subtract_multipolygon_from_multisegment( multisegment, reverse_multipolygon_holes(multipolygon)) assert result == subtract_multipolygon_from_multisegment( multisegment, reverse_multipolygon_holes_contours(multipolygon)) assert are_multisegments_similar( result, subtract_multipolygon_from_multisegment( reverse_multisegment(multisegment), multipolygon)) assert are_multisegments_similar( result, subtract_multipolygon_from_multisegment( reverse_multisegment_endpoints(multisegment), multipolygon))