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.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论