Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Given two diagonally opposite points on a rectangle, how to calculate the other two points

Tags:

I'm trying to re-size a div element while dragging from top right or bottom left corners.

In order to calculate the new width and height, i need to know the other two points on the rectangle

how can I get this values given only two point and the rotation degree?

please view the image I've added to fully understand this issue plus, the div can be also rotated (centered origin)

  • to clarify my question: the aim is to resize a div by dragging the cursor of the mouse from top right corner to bottom left. and then to resize the image so the width will be the distance between mouseX to left side. and the height will be from mouseY to the bottom side. for this i nedd to calculate both top left corner and bottom right corner as the mouse cursor moves along. thank you.

enter image description here