I’m running into a strange problem getting the bounds of a rotated rectangle and I hope the smarter people than me here can point me in the right direction.

I have a set of rectangles that I want to fill each with a checkerboard. I’m reading in the four cornerpoints of each rectangle from xml and add them to a Path. I can then get the bounds of the path to figure out how big my checkerboard should be, draw it into a graphic context and then end with drawing the path itself as an outline.

All is well until I have to draw a rotated path. The xml I’m using gives me the rotated coordinates of the four corner points and their rotation in radians. I can get the checkerboard to line up correctly by rotating the graphic context around the center of the path with the parsed rotation value, drawing the checkerboard, rotating the context back and drawing the outline. So far so good, but my problem is getting the bounds of the rotated path.

As I said, the points are stored post-rotation, so I figured I could get the original values by applying a rotation on the path, and then getting its bounds. I found the function getBoundsTransformed that seems to do what I need.

```
//rotation is a float for the angle in radians and center is a Point<float> for the path's centerpoint
Rectangle<float> bounds = path.getBoundsTransformed( AffineTransform::rotation( rotation, center.x, center.y ));
```

Strangely enough, when using this function on a square rectangle rotated around a 45 degree angle, the bounds that are returned are twice as big as what they actually are. I would expect a little error for rotating the wrong way or something, but twice as big seems weird. Different aspect ratios and different rotation values give different results, but the returned bounds are always bigger than they need to be.

Can anybody spot what I’m doing wrong? Am I completely misunderstanding what getBoundsTransformed is supposed to do? Or maybe there is a less round about way to go about getting the bounds of the rotated rectangle?

Appreciate anyone that read this far, and happy to elaborate or go into details if I didn’t manage to make myself clear enough.