4

I'm starting to learn about dealing with complex vs simple polygons, determining whether points are inside/outside polygons, etc. (e.g. http://geomalgorithms.com/a09-_intersect-3.html and related pages). I was hoping to find an R package that provides implementations of the Bentley-Ottmann algorithm, winding number, edge-crossing, and so on.

Alternatively, is there an R interface to the CGAL library or similar toolset? Is Rcpp the best (or only) way to go about this?

Carl Witthoft
  • 20,573
  • 9
  • 43
  • 73

2 Answers2

5

The nearest thing is probably package:rgeos. Meant for geospatial applications, polygon overlay, buffering, intersections etc.

A wrap of CGAL would be very interesting. However, I have a vague feeling there may be licensing issues... Its partly LGPL and partly GPL, but if you don't want to comply with those licenses you can buy a commercial license.

Spacedman
  • 92,590
  • 12
  • 140
  • 224
  • Thanks. I think `rgeos` will suffice, as I'm not working with gigantic (number of vertices) polygons. – Carl Witthoft Jan 22 '13 at 18:26
  • CGAL has had some license changes (according to Wikipedia). Initially only free for academics, then QPL (GPL-incompatible), but only GPL/LGPL with version 4.0 released in March 2012. I was probably recalling issues with the earlier licenses. I was a bit surprised when I discovered it was now GPL/LGPL! – Spacedman Jan 23 '13 at 09:07
  • 1
    Hi, I am the release manager of CGAL. The change of license is indeed since version 4.0 (bump of the major number of the version is for the license change). The chance was announced on CGAL mailing lists. I wonder where I should have announced that change, so that it is more well known. – lrineau Jan 23 '13 at 09:25
2

There are CGAL SWIG bindings: http://code.google.com/p/cgal-bindings/ and SWIG supports R, so it should work, but I don't know if it has been tried.

Marc Glisse
  • 7,550
  • 2
  • 30
  • 53