def test_reversals(polygons_pair: PolygonsPair) -> None: first, second = polygons_pair result = intersect_polygons(first, second) assert result == intersect_polygons(first, reverse_polygon_border(second)) assert result == intersect_polygons(first, reverse_polygon_holes(second)) assert result == intersect_polygons(first, reverse_polygon_holes_contours(second)) assert are_compounds_similar( result, reverse_compound_coordinates(intersect_polygons( reverse_polygon_coordinates(first), reverse_polygon_coordinates(second))))
def test_reversals( context_with_polygon_and_steps: Tuple[Context, Polygon, Scalar, Scalar] ) -> None: context, polygon, step_x, step_y = context_with_polygon_and_steps result = context.translate_polygon(polygon, step_x, step_y) assert reverse_polygon_border(result) == context.translate_polygon( reverse_polygon_border(polygon), step_x, step_y) assert reverse_polygon_holes(result) == context.translate_polygon( reverse_polygon_holes(polygon), step_x, step_y) assert (reverse_polygon_coordinates(result) == context.translate_polygon( reverse_polygon_coordinates(polygon), step_y, step_x))
def test_reversals(polygons_pair: Tuple[Polygon, Polygon]) -> None: left, right = polygons_pair result = polygon_in_polygon(left, right) assert result is polygon_in_polygon(reverse_polygon_border(left), right) assert result is polygon_in_polygon(left, reverse_polygon_border(right)) assert result is polygon_in_polygon(reverse_polygon_holes(left), right) assert result is polygon_in_polygon(left, reverse_polygon_holes(right)) assert result is polygon_in_polygon(reverse_polygon_holes_contours(left), right) assert result is polygon_in_polygon(left, reverse_polygon_holes_contours(right)) assert result is polygon_in_polygon(reverse_polygon_coordinates(left), reverse_polygon_coordinates(right))
def test_reversals(polygon_with_segment: PolygonWithSegment) -> None: polygon, segment = polygon_with_segment result = symmetric_subtract_polygon_from_segment(segment, polygon) assert are_compounds_similar( result, symmetric_subtract_polygon_from_segment( segment, reverse_polygon_border(polygon))) assert are_compounds_similar( result, symmetric_subtract_polygon_from_segment( segment, reverse_polygon_holes(polygon))) assert are_compounds_similar( result, symmetric_subtract_polygon_from_segment( segment, reverse_polygon_holes_contours(polygon))) assert are_compounds_similar( result, symmetric_subtract_polygon_from_segment(reverse_segment(segment), polygon)) assert are_compounds_similar( result, reverse_compound_coordinates( symmetric_subtract_polygon_from_segment( reverse_segment_coordinates(segment), reverse_polygon_coordinates(polygon))))
def test_reversals(polygon_with_multisegment: PolygonWithMultisegment) -> None: polygon, multisegment = polygon_with_multisegment result = unite_multisegment_with_polygon(multisegment, polygon) assert are_compounds_similar( result, unite_multisegment_with_polygon(multisegment, reverse_polygon_border(polygon))) assert are_compounds_similar( result, unite_multisegment_with_polygon(multisegment, reverse_polygon_holes(polygon))) assert are_compounds_similar( result, unite_multisegment_with_polygon( multisegment, reverse_polygon_holes_contours(polygon))) assert are_compounds_similar( result, unite_multisegment_with_polygon(reverse_multisegment(multisegment), polygon)) assert are_compounds_similar( result, unite_multisegment_with_polygon( reverse_multisegment_endpoints(multisegment), polygon)) assert are_compounds_similar( result, reverse_compound_coordinates( unite_multisegment_with_polygon( reverse_multisegment_coordinates(multisegment), reverse_polygon_coordinates(polygon))))
def test_reversals(context_with_polygon: Tuple[Context, Polygon]) -> None: context, polygon = context_with_polygon result = context.polygon_centroid(polygon) assert (result == context.polygon_centroid(reverse_polygon_border(polygon)) == context.polygon_centroid(reverse_polygon_holes(polygon))) assert (reverse_point_coordinates(result) == context.polygon_centroid( reverse_polygon_coordinates(polygon)))
def test_reversals(polygon_with_point: Tuple[Polygon, Point]) -> None: polygon, point = polygon_with_point result = point_in_polygon(point, polygon) assert result is point_in_polygon(point, reverse_polygon_border(polygon)) assert result is point_in_polygon(point, reverse_polygon_holes(polygon)) assert result is point_in_polygon(point, reverse_polygon_holes_contours(polygon)) assert result is point_in_polygon(reverse_point_coordinates(point), reverse_polygon_coordinates(polygon))
def test_reversals(polygon_with_region: Tuple[Polygon, Region]) -> None: polygon, region = polygon_with_region result = region_in_polygon(region, polygon) assert result is region_in_polygon(reverse_contour(region), polygon) assert result is region_in_polygon(region, reverse_polygon_border(polygon)) assert result is region_in_polygon(region, reverse_polygon_holes(polygon)) assert result is region_in_polygon(region, reverse_polygon_holes_contours(polygon)) assert result is region_in_polygon(reverse_contour_coordinates(region), reverse_polygon_coordinates(polygon))
def test_reversals(polygon_with_segment: Tuple[Polygon, Segment]) -> None: polygon, segment = polygon_with_segment result = segment_in_polygon(segment, polygon) assert result is segment_in_polygon(reverse_segment(segment), polygon) assert result is segment_in_polygon(segment, reverse_polygon_border(polygon)) assert result is segment_in_polygon(segment, reverse_polygon_holes(polygon)) assert result is segment_in_polygon( segment, reverse_polygon_holes_contours(polygon)) assert result is segment_in_polygon(reverse_segment_coordinates(segment), reverse_polygon_coordinates(polygon))
def test_reversals(polygon_with_contour: Tuple[Polygon, Contour]) -> None: polygon, contour = polygon_with_contour result = contour_in_polygon(contour, polygon) assert result is contour_in_polygon(reverse_contour(contour), polygon) assert result is contour_in_polygon(contour, reverse_polygon_border(polygon)) assert result is contour_in_polygon(contour, reverse_polygon_holes(polygon)) assert result is contour_in_polygon( contour, reverse_polygon_holes_contours(polygon)) assert result is contour_in_polygon(reverse_contour_coordinates(contour), reverse_polygon_coordinates(polygon))
def test_reversals( context_with_polygon_and_factors: Tuple[Context, Polygon, Scalar, Scalar] ) -> None: context, polygon, factor_x, factor_y = context_with_polygon_and_factors result = context.scale_polygon(polygon, factor_x, factor_y) assert (not isinstance(result, context.polygon_cls) or reverse_polygon_border(result) == context.scale_polygon( reverse_polygon_border(polygon), factor_x, factor_y)) assert (not isinstance(result, context.polygon_cls) or reverse_polygon_holes(result) == context.scale_polygon( reverse_polygon_holes(polygon), factor_x, factor_y)) assert (reverse_geometry_coordinates(result) == context.scale_polygon( reverse_polygon_coordinates(polygon), factor_y, factor_x))
def test_reversals(polygon_with_segment: PolygonWithSegment ) -> None: polygon, segment = polygon_with_segment result = complete_intersect_segment_with_polygon(segment, polygon) assert result == complete_intersect_segment_with_polygon( segment, reverse_polygon_border(polygon)) assert result == complete_intersect_segment_with_polygon( segment, reverse_polygon_holes(polygon)) assert result == complete_intersect_segment_with_polygon( segment, reverse_polygon_holes_contours(polygon)) assert result == complete_intersect_segment_with_polygon( reverse_segment(segment), polygon) assert are_compounds_similar( result, reverse_compound_coordinates( complete_intersect_segment_with_polygon( reverse_segment_coordinates(segment), reverse_polygon_coordinates(polygon))))
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))