We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 426a33d commit 1a33f94Copy full SHA for 1a33f94
ocrd_cis/ocropy/segment.py
@@ -731,11 +731,17 @@ def polygon_for_parent(polygon, parent):
731
# (this can happen when shapes valid in floating point are rounded)
732
childp = make_valid(childp)
733
parentp = make_valid(parentp)
734
+ if not childp.is_valid:
735
+ return None
736
+ if not parentp.is_valid:
737
738
# check if clipping is necessary
739
if childp.within(parentp):
740
return childp.exterior.coords[:-1]
741
# clip to parent
742
interp = make_intersection(childp, parentp)
743
+ if not interp:
744
745
return interp.exterior.coords[:-1] # keep open
746
747
def make_intersection(poly1, poly2):
0 commit comments