Why is the Polygon class based on ints and not on, say, doubles?
because, iirc, AWT works in the device resolution, thus can only be integer.
Needed subpixel accuray?
That’s correct. But you can work with polygons in a class of your own with floats/doubles and then round them to ints before passing them to the java polygon and polygon render. It’s like a software render.
I need it for offscreen “math”-purposes. I have a polygon (triangle) and I want to check if it intersects a rectangle.
Well, if you can live with a certain accuracy in the coordinates, multiply them by 1000 or so before casting to integers. if not, you’ll have to do the maths yourself or find a geometry lib that would do the calcs for you.
I can live with it… I can actually live with integers, I just thought it was really stupid.
You might consider looking at the classes in java.awt.geom. Most of them have double and float derivitives.
Kev