METADATA 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. Metadata-Version: 2.4
  2. Name: pyclipper
  3. Version: 1.4.0
  4. Summary: Cython wrapper for the C++ translation of the Angus Johnson's Clipper library (ver. 6.4.2)
  5. Home-page: https://github.com/fonttools/pyclipper
  6. Author: Angus Johnson, Maxime Chalton, Lukas Treyer, Gregor Ratajc
  7. Author-email: me@gregorratajc.com
  8. Maintainer: Cosimo Lupo
  9. Maintainer-email: cosimo@anthrotype.com
  10. License: MIT
  11. Keywords: polygon clipping, polygon intersection, polygon union, polygon offsetting, polygon boolean, polygon, clipping, clipper, vatti
  12. Classifier: Programming Language :: Python
  13. Classifier: Programming Language :: Python :: 3
  14. Classifier: Programming Language :: Python :: 3.10
  15. Classifier: Programming Language :: Python :: 3.11
  16. Classifier: Programming Language :: Python :: 3.12
  17. Classifier: Programming Language :: Python :: 3.13
  18. Classifier: Programming Language :: Python :: 3.14
  19. Classifier: Programming Language :: Cython
  20. Classifier: Programming Language :: C++
  21. Classifier: Environment :: Other Environment
  22. Classifier: Development Status :: 4 - Beta
  23. Classifier: Intended Audience :: Developers
  24. Classifier: Operating System :: OS Independent
  25. Classifier: License :: OSI Approved
  26. Classifier: License :: OSI Approved :: MIT License
  27. Classifier: Topic :: Multimedia :: Graphics
  28. Classifier: Topic :: Scientific/Engineering :: Mathematics
  29. Classifier: Topic :: Software Development :: Libraries :: Python Modules
  30. Requires-Python: >=3.10
  31. Description-Content-Type: text/x-rst
  32. License-File: LICENSE
  33. Dynamic: author
  34. Dynamic: author-email
  35. Dynamic: classifier
  36. Dynamic: description
  37. Dynamic: description-content-type
  38. Dynamic: home-page
  39. Dynamic: keywords
  40. Dynamic: license
  41. Dynamic: license-file
  42. Dynamic: maintainer
  43. Dynamic: maintainer-email
  44. Dynamic: requires-python
  45. Dynamic: summary
  46. About
  47. =====
  48. .. image:: https://badge.fury.io/py/pyclipper.svg
  49. :target: https://badge.fury.io/py/pyclipper
  50. .. image:: https://github.com/fonttools/pyclipper/workflows/Build%20+%20Deploy/badge.svg
  51. :target: https://github.com/fonttools/pyclipper/actions?query=workflow%3A%22Build+%2B+Deploy%22
  52. Pyclipper is a Cython wrapper exposing public functions and classes of
  53. the C++ translation of the `Angus Johnson's Clipper library (ver.
  54. 6.4.2) <http://www.angusj.com/delphi/clipper.php>`__.
  55. Source code is available on
  56. `GitHub <https://github.com/fonttools/pyclipper>`__. The package is published on
  57. `PyPI <https://pypi.python.org/pypi/pyclipper>`__.
  58. About Clipper
  59. -------------
  60. Clipper - an open source freeware library for clipping and
  61. offsetting lines and polygons.
  62. The Clipper library performs line & polygon clipping -
  63. intersection, union, difference & exclusive-or, and line &
  64. polygon offsetting. The library is based on Vatti's clipping
  65. algorithm.
  66. \ `Angus Johnson's Clipper
  67. library <http://www.angusj.com/delphi/clipper.php>`__\
  68. Install
  69. =======
  70. From PyPI
  71. ---------
  72. ::
  73. pip install pyclipper
  74. From source
  75. -----------
  76. Clone the repository:
  77. ::
  78. git clone git@github.com:fonttools/pyclipper.git
  79. Install:
  80. ::
  81. pip install .
  82. For development, use an editable install:
  83. ::
  84. pip install -e .
  85. Clippers' preprocessor directives
  86. ---------------------------------
  87. Clipper can be compiled with the following preprocessor directives: ``use_int32``, ``use_xyz``, ``use_lines`` and ``use_deprecated``.
  88. Among these the ``use_int32`` and ``use_lines`` can be used with Pyclipper.
  89. - ``use_int32`` - when enabled 32bit ints are used instead of 64bit ints. This improve performance but coordinate values are limited to the range +/- 46340. In Pyclipper this directive is **disabled** by default.
  90. - ``use_lines`` - enables line clipping. Adds a very minor cost to performance. In Pyclipper this directive is **enabled** by default (since version 0.9.2b0).
  91. In case you would want to change these settings, clone this repository and change the ``define_macros`` collection (``setup.py``, pyclipper extension definition). Add a set like ``('use_int32', 1)`` to enable the directive, or remove the set to disable it. After that you need to rebuild the package.
  92. How to use
  93. ==========
  94. This wrapper library tries to follow naming conventions of the original
  95. library.
  96. - ``ClipperLib`` namespace is represented by the ``pyclipper`` module,
  97. - classes ``Clipper`` and ``ClipperOffset`` ->
  98. ``Pyclipper`` and ``PyclipperOffset``,
  99. - when Clipper is overloading functions with different number of
  100. parameters or different types (eg. ``Clipper.Execute``, one function
  101. fills a list of paths the other PolyTree) that becomes
  102. ``Pyclipper.Execute`` and ``Pyclipper.Execute2``.
  103. Basic clipping example (based on `Angus Johnson's Clipper
  104. library <http://www.angusj.com/delphi/clipper.php>`__):
  105. .. code:: python
  106. import pyclipper
  107. subj = (
  108. ((180, 200), (260, 200), (260, 150), (180, 150)),
  109. ((215, 160), (230, 190), (200, 190))
  110. )
  111. clip = ((190, 210), (240, 210), (240, 130), (190, 130))
  112. pc = pyclipper.Pyclipper()
  113. pc.AddPath(clip, pyclipper.PT_CLIP, True)
  114. pc.AddPaths(subj, pyclipper.PT_SUBJECT, True)
  115. solution = pc.Execute(pyclipper.CT_INTERSECTION, pyclipper.PFT_EVENODD, pyclipper.PFT_EVENODD)
  116. # solution (a list of paths): [[[240, 200], [190, 200], [190, 150], [240, 150]], [[200, 190], [230, 190], [215, 160]]]
  117. Basic offset example:
  118. .. code:: python
  119. import pyclipper
  120. subj = ((180, 200), (260, 200), (260, 150), (180, 150))
  121. pco = pyclipper.PyclipperOffset()
  122. pco.AddPath(subj, pyclipper.JT_ROUND, pyclipper.ET_CLOSEDPOLYGON)
  123. solution = pco.Execute(-7.0)
  124. # solution (a list of paths): [[[253, 193], [187, 193], [187, 157], [253, 157]]]
  125. The Clipper library uses integers instead of floating point values to
  126. preserve numerical robustness. If you need to scale coordinates of your polygons, this library provides helper functions ``scale_to_clipper()`` and ``scale_from_clipper()`` to achieve that.
  127. Migrating from Pyclipper ``0.9.3b0``
  128. ------------------------------------
  129. In previous version of Pyclipper (``0.9.3b0``) polygons could be automatically scaled using the ``SCALING_FACTOR`` variable. This was removed in version ``1.0.0`` due to inexact conversions related to floating point operations. This way the library now provides the original numerical robustness of the base library.
  130. The ``SCALING_FACTOR`` removal **breaks backward compatibility**.
  131. For an explanation and help with migration, see https://github.com/fonttools/pyclipper/wiki/Deprecating-SCALING_FACTOR.
  132. Authors
  133. =======
  134. - The Clipper library is written by `Angus
  135. Johnson <http://www.angusj.com/delphi/clipper.php>`__,
  136. - This wrapper was initially written by `Maxime
  137. Chalton <https://sites.google.com/site/maxelsbackyard/home/pyclipper>`__,
  138. - Adaptions to make it work with version 5 written by `Lukas
  139. Treyer <http://www.lukastreyer.com>`__,
  140. - Adaptions to make it work with version 6.2.1 and PyPI package written by `Gregor Ratajc <http://www.gregorratajc.com>`__,
  141. - ``SCALING_FACTOR`` removal and additions to documentation by Michael Schwarz (@Feuermurmel),
  142. - Bug fix `sympy.Zero` is not a collection by Jamie Bull (@jamiebull1),
  143. - Travis CI and Appveyor CI integration for continuous builds of wheel packages by Cosimo Lupo (@anthrotype).
  144. The package is maintained by Cosimo Lupo (`@anthrotype <https://github.com/anthrotype>`__).
  145. License
  146. =======
  147. - Pyclipper is available under `MIT
  148. license <http://opensource.org/licenses/MIT>`__.
  149. - The core Clipper library is available under `Boost Software
  150. License <http://www.boost.org/LICENSE_1_0.txt>`__. Freeware for both
  151. open source and commercial applications.
  152. Changelog
  153. =========
  154. For recent versions, see the `GitHub Releases page <https://github.com/fonttools/pyclipper/releases>`__.
  155. 1.1.0
  156. -------
  157. - Updated embedded Clipper library to version 6.4.2.
  158. 1.0.6
  159. -------
  160. - Added support for Python 3.6.
  161. 1.0.3
  162. -------
  163. - added Travis CI and Appveyor CI to build wheel packages (thanks to @anthrotype)
  164. 1.0.2
  165. -------
  166. - bug fix: `sympy.Zero` recognized as a collection (thanks to @jamiebull1)
  167. 1.0.0
  168. -------
  169. - **(breaks backwards compatibility)** removes SCALING_FACTOR (thanks to @Feuermurmel)
  170. 0.9.3b0
  171. -------
  172. - Applied SCALING_FACTOR to the relevant function parameters and class properties
  173. - Refactored tests
  174. 0.9.2b1
  175. -------
  176. - bug fix: Fix setting of the PyPolyNode.IsHole property
  177. 0.9.2b0
  178. -------
  179. - enable preprocessor directive ``use_lines`` by default,
  180. - bug fix: PyPolyNode.Contour that is now one path and not a list of paths as it was previously.