Take the 2-minute tour ×

I'm currently working on a cross-platform application (actually a game using libgdx), and I need a constructive area geometry implementation for some algorithms.

The problem is that the Android API does not contain the java.awt.geom.Area implementation. It does contain the android.graphics.Region class 'though, which seems to be able to perform the same thing, meaning in this context defining polygons and then performing basic logical operation on their areas.

The solution seems to be to develop an adapter interface, and have each distribution (Java SE/Android) set the appropriate implementation at startup.

This is simple enough, but after some searching I'm baffled that I haven't yet encountered an implementation of the aforementioned solution.

My question is: is there, after all, a library that actually does already this, or, alternatively, another, easier solution to the problem, e.g. buried somewhere in the "common" Java API?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

You might be able to use the code from the (now defunct?) Apache Harmony project's implementation of the java.awt.geom package: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/awt/src/main/java/common/java/awt/geom/

I have no experience with this code, so I can't say if its complete or any good. Its also not clear how much additional code you would have to bring in to make this work ...

share|improve this answer
Hah, funnily enough, I've used the exact same solution to answer another question :). Thanks for the suggestion, I'll wait a bit for alternative answers and in the event there aren't any, I'll accept yours. –  TheTerribleSwiftTomato Jul 17 '12 at 16:53
add comment

Your Answer


