I need to process some polygons in 3D. They are typically loaded from an OFF or STL file. Then I need to do some transformations (rotation, move, resize), I'd like to check whether points are inside the polygon or not, whether polygons overalp, and I'd like to merge several polygons into one. I'd also like to have raw access on points and surface indices.

It seems that there are many libraries for 2D, but it's difficult to find something for 3D. Preferably usable with Python/NumPy.

  • $\begingroup$ Have you tried Numpy-STL? $\endgroup$ – nicoguaro Jul 8 '16 at 12:56
  • $\begingroup$ If you have installed Blender, maybe you can try their API as well. $\endgroup$ – nicoguaro Jul 8 '16 at 13:03

You may try GEOGRAM [1], a programming library that we are developing with my research team. It has import for several formats, including STL. If you love templates, there is also CGAL that has many functionalities [2] (but with it you will not have by-index access to the elements as you requested, CGAL uses pointers). There is also the GNU Triangulated Surface Library [3] with some interesting functionalities. Finally, you may try libIGL, it has index-based data structures (like geogram) and uses templates (like CGAL).

If you need a graphic user interface, then you can use Graphite [5], it is a shell around Geogram (also developed by my research team).

[1] GEOGRAM: http://alice.loria.fr/software/geogram/doc/html/index.html

[2] CGAL: http://www.cgal.org

[3] GTS: http://gts.sourceforge.net/

[4] libIGL: http://libigl.github.io/libigl/

[5] Graphite: http://alice.loria.fr/software/graphite/doc/html/

  • $\begingroup$ I'm currently evaluating which one to use. Do you know which of the libraries has reasonable Python bindings? $\endgroup$ – Michael Jul 18 '16 at 7:11
  • 1
    $\begingroup$ To my knowledge, there exists some python bindings for CGAL, and my software Graphite has python scripting (but only for high level operations) $\endgroup$ – BrunoLevy Jul 20 '16 at 12:12
  • $\begingroup$ After glancing through the libraries, it seems that CGAL is the largest in terms of functionality, while GTS only offers a relatively small set of functions. liblGL seems to be not as large as CGAL but easier to start with. With GEOGRAM, I do not see any particular strengths at a first glance. But maybe you as the developer can tell? $\endgroup$ – Michael Jul 20 '16 at 14:07
  • 1
    $\begingroup$ GEOGRAM is more specialized (smaller number of functionalities, but faster and uses less memory for what it does). Easier to compile / self contained / has graphics with modern OpenGL. It is also fully documented (including implementation of algorithm). API is simple to use in my opinion (I do not like templates), but its a matter of taste. $\endgroup$ – BrunoLevy Jul 21 '16 at 11:06
  • 1
    $\begingroup$ The tutorial is on its way. In the meanwhile, you can take a look at the example programs in src/bin, src/demos and src/tutorial, they are well commented. src/bin/geobox is a small GUI shell around the main functionalities of geogram, it can be used as a starting point. $\endgroup$ – BrunoLevy Jul 28 '16 at 2:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.