Hello Java Topology Suite

There is always a better way, in my case, the better way was to get rid of my crappy implementation and to let others do the work for polygon buffering. And trust me, I tried to patch my simple implementation and next I tried to use the better but still not error-proof JavaGeom one. I ended up using the fine implementation of Java Topology Suite, that worked like a charm (once I managed to understand the subtle details of how things work over there).  So now you can see how the gray color lines are an accurate offset of blue polygons in my software. It did not hurt that JTS is a pure-Java library, so my tool will be multi-platform the easy way. I learned along the process that though SWIG framework does include Java bindings for CGAL library, it does not provide full access to all library functions and, once again, polygon buffer seems to be one of the parts missing. Besides, CGAL install is platform specific (though CGAL is still a terrific library).

Along the process I have learned that JTS is a clean and powerful suite, that seems to be aimed to GIS systems and databases but it is a great graphics tool for 2D (and maybe 3D) topologies. Contrary to other code I have tried (including myself's) JTS does a great offseting job whenever the result is not a single polygon like the one in the Processing sample code you can find below.


Popular posts from this blog

VFD control with Arduino using RS485 link

4xiDraw: Another pen plotter

One Arduino controlling two brushless DC motors