开发者

getBounds vs getBounds2D

While reading the Java documentation on a Polygon, i discovered there is a getBounds method and a ge开发者_StackOverflow中文版tBounds2D 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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜