I have the four coordinates of a rectangle in the format: (xi, yi). I want to find out which of the coordinates correspond to the top-left, top-right, bottom-left and bottom-right of the rectangle. Can someone help me in doing this? Any help is much appreciated. Thank you.
Edit: The rectangle can be a rotated rectangle. Is there any algorithm for this?
The $x$ coordinate tells you how far to the right of $(0,0)$ a point is - so the point with the lowest $x$ coordinate is the left most point.
Similarly, the $y$ coordinate tells you how far above $(0,0)$ the point is - the point with the lowest $y$-coordinate is the lowest point in terms of height. For example, the point $(-1,2)$ is to the left of and below the point $(1, 3)$.
Combining these two facts, which corner will be the bottom-left? Likewise for the other corners