tags:

views:

20

answers:

1

Hello World,

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

+3  A: 

getBounds returns a Rectangle, composed of integers, but getBounds2D returns 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 a Polygon's points are integer-based, but for the more general Shape, which Polygon implements, it can matter.

Carl Manaster