I'm trying to put resizing handles on the four corners of a rectangle, which can be dragged to resize the rectangle. What I'm having trouble with is calculating the new width, new height, and new points of the rectangle after I've translated one of the rectangle's points.
If the rectangle were not rotated, this would obviously be very easy because the width and height would change by the same amount as the offset on the x-axis and offset on the y-axis of the newly translated point. However, this rectangle CAN be rotated, so the translation of x and y don't match up directly to the changes in width/height.
In the image above, I've represented information that I already have in solid black, and information I want to find in light grey. I've tried to show how the rectangle should change if I dragged the a1 corner up and to the right.
Could anyone help me figure out how to calculate the missing information?
Thanks for any help! It's much appreciated.