Package: clipping
clippingIn what followspythonis an alias forpython3.6orpypy3.6or any later version (python3.7,pypy3.7and so on).InstallationInstall the latestpip&setuptoolspackages versionspython-mpipinstall--upgradepipsetuptoolsUserDownload and install the latest stable version fromPyPIrepositorypython-mpipinstall--upgradeclippingDeveloperDownload the latest version fromGitHubrepositorygitclonehttps://github.com/lycantropos/clipping.gitcdclippingInstall dependenciespython-mpipinstall-rrequirements.txtInstallpythonsetup.pyinstallUsage>>>fromground.baseimportget_context>>>context=get_context()>>>EMPTY=context.empty>>>Mix=context.mix_cls>>>Multipoint=context.multipoint_cls>>>Multisegment=context.multisegment_cls>>>Point=context.point_cls>>>Segment=context.segment_cls>>>left_edge=Segment(Point(0,0),Point(0,1))>>>right_edge=Segment(Point(1,0),Point(1,1))>>>bottom_edge=Segment(Point(0,0),Point(1,0))>>>top_edge=Segment(Point(0,1),Point(1,1))>>>main_diagonal=Segment(Point(0,0),Point(1,1))>>>trident=Multisegment([left_edge,main_diagonal,bottom_edge])>>>square_edges=Multisegment([bottom_edge,right_edge,top_edge,left_edge])>>>fromclipping.planarimportintersect_multisegments>>>(intersect_multisegments(trident,square_edges)...==intersect_multisegments(square_edges,trident)...==Multisegment([left_edge,bottom_edge]))True>>>fromclipping.planarimportcomplete_intersect_multisegments>>>(complete_intersect_multisegments(trident,square_edges)...==complete_intersect_multisegments(square_edges,trident)...==Mix(Multipoint([Point(1,1)]),Multisegment([left_edge,bottom_edge]),...EMPTY))True>>>fromclipping.planarimportunite_multisegments>>>(unite_multisegments(trident,square_edges)...==unite_multisegments(square_edges,trident)...==Multisegment([left_edge,bottom_edge,main_diagonal,top_edge,...right_edge]))True>>>fromclipping.planarimportsubtract_multisegments>>>subtract_multisegments(trident,square_edges)==main_diagonalTrue>>>(subtract_multisegments(square_edges,trident)...==Multisegment([top_edge,right_edge]))True>>>fromclipping.planarimportsymmetric_subtract_multisegments>>>(symmetric_subtract_multisegments(trident,square_edges)...==symmetric_subtract_multisegments(square_edges,trident)...==Multisegment([main_diagonal,top_edge,right_edge]))True>>>Contour=context.contour_cls>>>Multipolygon=context.multipolygon_cls>>>Polygon=context.polygon_cls>>>first_square=Contour([Point(0,0),Point(1,0),Point(1,1),...Point(0,1)])>>>second_square=Contour([Point(1,0),Point(2,0),Point(2,1),...Point(1,1)])>>>third_square=Contour([Point(1,1),Point(2,1),Point(2,2),...Point(1,2)])>>>fourth_square=Contour([Point(0,1),Point(1,1),Point(1,2),...Point(0,2)])>>>fromclipping.planarimportintersect_multipolygons>>>(intersect_multipolygons(Multipolygon([Polygon(first_square,[]),...Polygon(third_square,[])]),...Multipolygon([Polygon(second_square,[]),...Polygon(fourth_square,[])]))...isEMPTY)True>>>(intersect_multipolygons(Multipolygon([Polygon(first_square,[]),...Polygon(third_square,[])]),...Multipolygon([Polygon(first_square,[]),...Polygon(third_square,[])]))...==Multipolygon([Polygon(first_square,[]),Polygon(third_square,[])]))True>>>fromclipping.planarimportcomplete_intersect_multipolygons>>>(complete_intersect_multipolygons(...Multipolygon([Polygon(first_square,[]),Polygon(third_square,[])]),...Multipolygon([Polygon(second_square,[]),...Polygon(fourth_square,[])]))...==Multisegment([Segment(Point(0,1),Point(1,1)),...Segment(Point(1,0),Point(1,1)),...Segment(Point(1,1),Point(2,1)),...Segment(Point(1,1),Point(1,2))]))True>>>(complete_intersect_multipolygons(...Multipolygon([Polygon(first_square,[]),Polygon(third_square,[])]),...Multipolygon([Polygon(first_square,[]),Polygon(third_square,[])]))...==Multipolygon([Polygon(first_square,[]),Polygon(third_square,[])]))True>>>fromclipping.planarimportunite_multipolygons>>>(unite_multipolygons(Multipolygon([Polygon(first_square,[]),...Polygon(third_square,[])]),...Multipolygon([Polygon(second_square,[]),...Polygon(fourth_square,[])]))...==Polygon(Contour([Point(0,0),Point(2,0),Point(2,2),Point(0,2)]),...[]))True>>>(unite_multipolygons(Multipolygon([Polygon(first_square,[]),...Polygon(third_square,[])]),...Multipolygon([Polygon(first_square,[]),...Polygon(third_square,[])]))...==Multipolygon([Polygon(first_square,[]),Polygon(third_square,[])]))True>>>fromclipping.planarimportsubtract_multipolygons>>>(subtract_multipolygons(Multipolygon([Polygon(first_square,[]),...Polygon(third_square,[])]),...Multipolygon([Polygon(first_square,[]),...Polygon(third_square,[])]))...isEMPTY)True>>>(subtract_multipolygons(Multipolygon([Polygon(first_square,[]),...Polygon(third_square,[])]),...Multipolygon([Polygon(second_square,[]),...Polygon(fourth_square,[])]))...==Multipolygon([Polygon(first_square,[]),Polygon(third_square,[])]))True>>>fromclipping.planarimportsymmetric_subtract_multipolygons>>>(symmetric_subtract_multipolygons(...Multipolygon([Polygon(first_square,[]),Polygon(third_square,[])]),...Multipolygon([Polygon(first_square,[]),Polygon(third_square,[])]))...isEMPTY)True>>>(symmetric_subtract_multipolygons(...Multipolygon([Polygon(first_square,[]),Polygon(third_square,[])]),...Multipolygon([Polygon(second_square,[]),...Polygon(fourth_square,[])]))...==Polygon(Contour([Point(0,0),Point(2,0),Point(2,2),Point(0,2)]),...[]))TrueDevelopmentBumping versionPreparationInstallbump2version.Pre-releaseChoose which version number category to bump followingsemver
specification.Test bumping versionbump2version--dry-run--verbose$CATEGORYwhere$CATEGORYis the target version number category name, possible
values arepatch/minor/major.Bump versionbump2version--verbose$CATEGORYThis will set version tomajor.minor.patch-alpha.ReleaseTest bumping versionbump2version--dry-run--verbosereleaseBump versionbump2version--verbosereleaseThis will set version tomajor.minor.patch.Running testsInstall dependenciespython-mpipinstall-rrequirements-tests.txtPlainpytestInsideDockercontainer:withCPythondocker-compose--filedocker-compose.cpython.ymlupwithPyPydocker-compose--filedocker-compose.pypy.ymlupBashscript:withCPython./run-tests.shor./run-tests.shcpythonwithPyPy./run-tests.shpypyPowerShellscript:withCPython.\run-tests.ps1or.\run-tests.ps1cpythonwithPyPy.\run-tests.ps1pypy