GetBounds vs getBounds2D

While reading the Java documentation on Polygon, I discovered that there is a method getBounds

and getBounds2D

. It was noted that the first was less accurate than the second.

I was wondering what exactly is meant by "less accurate"? Does the value return getBounds

false, or roughly 256 versus 256.3 (example)? Or is it something completely different?

Thanks for any enlightenment,

Samuel

+2


a source to share


1 answer


getBounds

returns a Rectangle consisting of integers, but getBounds2D

returns a Rectangle2D which consists of floating point numbers, so higher precision is possible.



For Polygon

this it shouldn't matter because all points Polygon

are based on integers, but for a more general Shape

one that is implemented Polygon

it might matter.

+3


a source







All Articles