8176501: Method Shape.getBounds2D() incorrectly includes Bezier control points in bounding box
This adds a new unit test that calculates a high-precision bounding box (using BigDecimals), and then makes sure our double-based logic contains that high-precision bounds. This restores getBounds2D() to its original contract: it should only ever be *larger* than the actual bounds -- it should never be smaller. Also we want to only apply this margin (aka "padding") when we deal with polynomial-based extrema. We should never apply it to line-based polygons. For ex: a Path2D that represents an int-based rectangle should return the same bounds as before 8176501 was addressed. This test currently only addresses very small cubic curves. I experimented with very large cubic & quadratic curves, but I didn't come up with a unit test that failed before and after this commit. Adding unit tests for large curve segments is a possible area of improvement.
Loading
Please register or sign in to comment