I found the Computational Geometry Algorithms Library in my search for an algorithm to decompose a concave polygon into the minimum number of convex components. Links off the site and numerous google results indicate there are python bindings for it, which would be really handy, but all the links are dead! What happened to it? Where can I get it now?
A rewrite of the CGAL-Python bindings has been done as part of the cgal-bindings project. Check it out : http://code.google.com/p/cgal-bindings/
You may also be interested in the GEOS library, which is available in Python through Shapely and the GEOS API included in GeoDjango.
CGAL-Python has been inert for over a year but the code (available through the "Download" link) seems to work fine, though not with Python 3.
Bindings for CGAL are inherently difficult. Because the library is heavily template based there's a combinatorial explosion of possible ways to use it. Any binding would need to pick and choose what to include.
However: Python package demakein (which I wrote), includes a module to compile C++ snippets on the fly then load them with cffi. The code snippets are cached to make subsequent runs faster. There's code in there that wraps up the parts of CGAL I needed, these are probably different to what you need but should give you an idea of how to use it. It can be used with CPython or PyPy, on Linux or OS X.
The fastest would probably be just to look at the code and re-implement it yourself in python. carrying around all of CGAL just for this tiny bit seems redundant.
Also this calculation doesn't strike me as something that would extremely benefit by running compiled.
Try this for now:
pip install -i https://test.pypi.org/simple/ cgal
It is experimental, but available on here
© 2022 - 2024 — McMap. All rights reserved.