Rectangle2D getY () returns a value less than getMaxY ()

As I interpret the documentation, getY () should return the y-coordinate of the upper left corner of the rectangle; that is, the largest Y coordinate. However, when I call getMaxY () (which is inherited from the RectangularShape class), I return a larger value!

In code:

Path2D bg = polygons.get(polyId2GeoId.get(id));
Rectangle2D bgBox = bg.getBounds2D();
boolean omgwtfbbqrsvp = bgBox.getY()<bgBox.getMaxY();

omgwtfbbqrsvp is true ... What am I missing here?

My x values ​​contain negative idk numbers if that matters. It looks like bgBox.getY () == bgBox.getMinY () (which is not true if getY is top ), but bgBox.getX () == bgBox.getMinX () (this is correct if getX is left ). Height and width are displayed correctly.

Thank!

+3
source share
1 answer

The problem is that the coordinate system used here has its point (0,0) in the upper left corner. Point (n, n) is in the lower right corner.

+2
source

All Articles