Polygon SetΒΆ

[1]:
import skgeom as sg
[2]:
pset1 = sg.PolygonSet([sg.random_polygon(seed=100), sg.random_polygon(seed=300)])
pset1
_images/polygon_set_2_0.svg
[3]:
pset2 = sg.PolygonSet([sg.random_polygon(seed=3), sg.random_polygon(seed=8)])
pset2
_images/polygon_set_3_0.svg
[4]:
pset1.difference(pset2)
_images/polygon_set_4_0.svg
[5]:
pset1.union(pset2)
_images/polygon_set_5_0.svg
[6]:
pset1.intersection(pset2)
_images/polygon_set_6_0.svg
[7]:
pset3 = pset1.complement.intersection(pset2)
pset3
_images/polygon_set_7_0.svg
[8]:
len(pset3)
[8]:
7
[9]:
pset1.symmetric_difference(pset2)
_images/polygon_set_9_0.svg
[10]:
poly = pset3.locate(sg.Point2(-0.1, -0.3))

from skgeom.draw import draw
draw(pset3)
draw(poly, facecolor="red")
_images/polygon_set_10_0.svg