[Math] Find the bottom right coordinate of rectangle

geometryrectangles

Given a rectangle with X, Y (Integers) as the top left vertex. Assuming that the rectangle is axis parallel and height and width cannot be negative what can be said about the bottom right vertex of the rectangle? Consider that top left is considered as origin as in many computer applications.

I am raising this point because if there are 2 rectangles then according to the origin the intersection point(top left vertex) may change.

Best Answer

It is true that in some applications of computer science, the upper left corner is considered as the origin of coordinates. For example, digital images assume that system.

In those cases, the x coordinate of the bottom right corner is equal to the width of the image:

$$ x_{br} = w $$

And the y coordinate is equal to the minus height:

$$ y_{br} = -h $$

Therefore, if the top left corner was not found at the origin, but at the coordinates $ \left(x_{tl};y_{tl}\right) $ given, the coordinates of the bottom right corner result:

$$ x_{br} = x_{tl} + w \\ y_{br} = y_{tl} - h $$

Related Question