While reading the Java documentation on a Polygon, i discovered there is a getBounds method and a getBounds2D method. It was noted that the first one was less accurate than the second one.
I was wondering what exactly is meant by ‘less accurate’? Does getBounds return a false value or is it about 256 vs 256.3 (example)? Or is it something completely different?
Thanks for any enlightenment,
Samuel
getBoundsreturns a Rectangle, composed of integers, butgetBounds2Dreturns a Rectangle2D, which is composed of floating point numbers, so greater precision is possible.For
Polygon, it shouldn’t make a difference, because all of aPolygon‘s points are integer-based, but for the more generalShape, whichPolygonimplements, it can matter.