Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

2D Geometry library: LGPL alternative to CGAL? [closed]

CGAL seems to do just about everything I need and a little more for my upcoming project. It can create polygons out of arc line segments and run boolean operations on them. It has spatial sorting packages already that would save me a lot of time regarding a few things and the whole library seems quite standardized and well planned.

There's just the issue with the license being QPL (GPL for the upcoming version 4.0) for most of the packages (except the very basic ones). I've got a meager budget and can likely not gather funds to buy the commercial licenses for those specific packages in CGAL that require it.

My specific needs of such a library would be:

  • Exact precision 2D euclidean space
  • Complex polygons
  • Polygons able to have curved line (arc) segments
  • Boolean operations on those polygons
  • Polygon offsetting
  • Polygon partitioning or effective triangulation
  • Inscribed area and polygon fitting algorithms
  • Possibly some spatial sorting structures with circular range searches

All in all, I'm looking for a well rounded 2D geometry C++ library with exact precision. Preferably with MIT, LGPL at a stretch, or a low cost one-time royalty-free license below $500.

Boost got some basic structures down, but from what I can tell they lack a lot of the higher level functionality. Any libraries that has expanded on this? I would consider doing it myself, but I lack the expertise to do it well and it'd prolong my project by quite a bit.

Just to be clear, I'm not looking for a 2D graphics library, just pure geometry structures.

like image 805
Zoomulator Avatar asked Feb 19 '12 12:02

Zoomulator


3 Answers

Have a look at Wykobi. It is a templated library and you can template the dimension as 2D.

It is distributed under the MIT License.

like image 103
Ram Avatar answered Nov 20 '22 09:11

Ram


Take a look at Geometric Tools for Computer Graphics.

  • Refined over a decade
  • Unbelievably good documentation, both in hard bound and extensively in PDF form
  • Boost license

It meets all your requirements:

  • Exact precision 2D euclidean space: Yes
  • Complex polygons : Yes
  • Polygons able to have curved line (arc) segments : Nonsensical. By definition, polygons are composed of line segments. If you are looking for splines and NURBS, the library has them.
  • Boolean operations on those polygons : Yes
  • Polygon offsetting : Unclear what you mean. The library certainly supports translation.
  • Polygon partitioning or effective triangulation: Yes, Delaunay triangulation and Voronoi regions
  • Inscribed area and polygon fitting algorithms :Yes
  • Possibly some spatial sorting structures with circular range searches : Yes, spatial sorting and a whole bushel of intersection functions.

All this comes from the book Geomtric Tools for Computer Graphics by Schneider and Eberly. The book is outstanding, with clear presentation of how the algorithms work and what their limitations are. The authors have made the code available online under the Boost license and include most (all?) of the book online as a PDF to accompany each code module. They maintain an very useful website that is indexed in various ways.

I have no connection to the authors nor any monetary interest. I used their book in my thesis and it was extremely pleased with it as an easy to use reference and a powerful library.

like image 29
Jeff Benshetler Avatar answered Nov 20 '22 08:11

Jeff Benshetler


Have you looked at Boost.Geometry library? It's nowhere near CGAL in terms of functionality, but it might help you.

like image 4
foxcub Avatar answered Nov 20 '22 08:11

foxcub