Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a geometry library for Java? (not JTS)

I'm hoping for the equivalent of CGAL (in C++)--I want convex partitioning of polygons or at least triangulation. It also has to be free. A previous question suggested JTS, but it doesn't seem to have those functions.

like image 717
user690075 Avatar asked Apr 03 '11 18:04

user690075


4 Answers

GeoTools has a pretty extensive library of geometry manipulation algorithms, but of course just like JTS it is somewhat GIS-oriented.

http://www.geotools.org/

like image 172
Wouter Lievens Avatar answered Nov 13 '22 01:11

Wouter Lievens


You could try GeoLib which is an excellent geometry package.

like image 33
Matthew Minor Avatar answered Sep 22 '22 19:09

Matthew Minor


JTS supports delaunay triangulation, but not constrained triangulation (holes):
http://lin-ear-th-inking.blogspot.com/2009/04/delaunay-triangulation-in-jts-111.html

For constrained delaunay triangulation you can use Poly2Tri. Works quite good, but could not triangulate polygons with holes, where the holes touch the outline or touch another polygon.

At the moment I use the OpenGl Tesselator (glut) with the java wrapper jogl (http://jogamp.org/) for triangulation in java. You have to implement the correct callbacks and do some fiddling in there.

Neither of them satisfies all (my) needs, but until now I haven't found a better one.

like image 7
stryeko Avatar answered Nov 12 '22 23:11

stryeko


CGAL has SWIG driven bindings since 2012. 2D conforming triangulation and meshes is part of it. Please visit the github wiki for furhter info's.

like image 2
huckfinn Avatar answered Nov 12 '22 23:11

huckfinn