Package: gon
gonSummarygonis a pure Python library that provides support
for planar geometry objects built from discrete points,
finite number of straight line segments (e.g. polylines)
and areas bound by closed polylines (e.g. polygons).Main features areconvenience: all geometric objects
areimmutable,hashableand implementset-likeinterface,
i.e. support containment, equality, "is-subset" tests
and boolean set operations (e.g. finding intersection).correctness: all calculations are robust for floating point numbers
& precise for integral numbers (likeint),
each operation corresponds to its mathematical definition
and property-based tested.efficiency: all operations are efficient
in terms of both time & memory complexity,
upper bound for expected time complexity isO(n * log n),
for memory complexity isO(n).In what followspythonis an alias forpython3.7orpypy3.7or any later version (python3.7,pypy3.8and so on).InstallationInstall the latestpip&setuptoolspackages versionspython-mpipinstall--upgradepipsetuptoolsUserDownload and install the latest stable version fromPyPIrepositorypython-mpipinstall--upgradegonDeveloperDownload the latest version fromGitHubrepositorygitclonehttps://github.com/lycantropos/gon.gitcdgonInstall dependenciespython-mpipinstall-rrequirements.txtInstallpythonsetup.pyinstallUsage>>>fromgon.baseimportEMPTY,Angle,Contour,Point,Polygon>>>square=Polygon(Contour([Point(0,0),Point(4,0),Point(4,4),...Point(0,4)]))>>>square==squareTrue>>>square>=squareTrue>>>square<=squareTrue>>>square<squareFalse>>>square>squareFalse>>>square&square==squareTrue>>>square|square==squareTrue>>>square-squareisEMPTYTrue>>>square^squareisEMPTYTrue>>>Point(0,0)insquareTrue>>>square.index()>>>Point(0,0)insquareTrue>>>len(square.border.vertices)==4True>>>len(square.holes)==0True>>>square.is_convexTrue>>>square.convex_hull==squareTrue>>>square.area==16True>>>square.perimeter==16True>>>square.centroid==Point(2,2)True>>>square.distance_to(Point(2,2))==0True>>>square.distance_to(Point(7,8))==5True>>>(square.rotate(Angle(0,1),Point(4,4))...==Polygon(Contour([Point(8,0),Point(8,4),Point(4,4),Point(4,0)])))True>>>(square.scale(1,2)...==Polygon(Contour([Point(0,0),Point(4,0),Point(4,8),Point(0,8)])))True>>>(square.translate(1,2)...==Polygon(Contour([Point(1,2),Point(5,2),Point(5,6),Point(1,6)])))True>>>(square.triangulate().triangles()...==[Contour([Point(0,4),Point(4,0),Point(4,4)]),...Contour([Point(0,0),Point(4,0),Point(0,4)])])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