# Top-left and bottom-right coordinates: Distance issue

Hey ,
In the first assignment we see:

• To calculate the area of a rectangle, multiply its height (π¦2βπ¦1) by its width (π₯2βπ₯1). Since (π₯1,π¦1) is the top left and (π₯2,π¦2) are the bottom right, these differences should be non-negative.

In my opinion if we (y2-y1), we get negative number (y1-y2 is right i believe) . Is there issue? What do you think?

The thing to keep in mind is how pixel coordinates work in images. It is not the same way normal coordinates work if youβre just doing analytic geometry: (0, 0) is the upper left corner. As you increase the value of the first index (the vertical index), you go down. As you increase the value of the second index (the horizontal index), you move to the right. So if (x_1, y_1) is the upper left corner and (x_2, y_2) is the lower right corner, then x_2 - x_1 and y_2 - y_1 will be positive numbers.

To give a concrete example, if we have an image that is 1024 x 720 (portrait mode), then the upper left corner is (0, 0) and the lower right corner is (1024, 720).

But if all you care about is the distance, then who really cares? Just take the absolute value and then you donβt have to worry about the order in which the points are specified.

1 Like