0
$\begingroup$

Is there a formula/calculation to work out how to find the other $2$ coordinates for a rectangle if you only have the bottom left and top right coordinates?

e.g. My bottom-left coordinate would be $(-1, 0)$ and top right would be $(3, -2)$, I can work out the midpoint but I can't seem to get my head around how to work out the other $2$ coordinates?

$\endgroup$
5
  • $\begingroup$ Have you drawn a picture? $\endgroup$ – Ragib Zaman Nov 24 '11 at 13:43
  • $\begingroup$ I think that solution isn't unique... $\endgroup$ – Peđa Terzić Nov 24 '11 at 13:47
  • $\begingroup$ @pedja If it is given that the two points given are diagonal such as in the OP's example, then a unique rectangle is determined. $\endgroup$ – Ragib Zaman Nov 24 '11 at 13:53
  • $\begingroup$ Its a formula I need for programming, obviously drawing it out I can work it out but was wondering if the was a general rule of calculation to work it out?! $\endgroup$ – r0bb077 Nov 24 '11 at 13:59
  • $\begingroup$ @RagibZaman,I am not sure about that..draw the circle with radius half of the diagonal and midpoint as center then each point on the circle can be vertice point of the rectangle $\endgroup$ – Peđa Terzić Nov 24 '11 at 14:01
3
$\begingroup$

Let's observe picture below. Each point $(x,y)$ of the circle that satisfy following equality can be vertice point of the rectangle :

$\left(\sqrt{(x_A-x)^2+(y_A-y)^2}\right)^2 + \left(\sqrt{(x_C-x)^2+(y_C-y)^2}\right)^2=\left(\sqrt{(x_A-x_C)^2+(y_A-y_C)^2}\right)^2$ ,

where $A(-1,0)$ , and $C(3,-2)$ are given vertices.

For example if you choose point $B_1$ you can calculate coordinates of $D_1$ by using equalities :

$x_{D_1}=2x_O-x_{B_1}$ , and $y_{D_1}=2x_O-y_{B_1}$

Answer to sub question :

If you have length of one edge , let's say $|\bar{AB_1}|$ then you can write an extra equality :

$ |\bar{AB_1}|= \sqrt{(x_A - x)^2+(y_A-y)^2}$ , and find relation between $x$ and $y$ coordinates.

enter image description here

$\endgroup$
5
  • $\begingroup$ Hey pedja, thanks for the graphics but how would I find out what B1 actually is?! $\endgroup$ – r0bb077 Nov 24 '11 at 15:07
  • $\begingroup$ @robbo77,coordinates of $B_1$ must satisfy square-root equality above... $\endgroup$ – Peđa Terzić Nov 24 '11 at 15:12
  • $\begingroup$ You can chose $B_1$ freely as any point on the circle. The last corner is that directly opposite it. In Pedja's graphic, $AB_1CD_1$ and $AB_2CD_2$ are two different rectangles that both have AC as diagonal, so you won't get a unique solution without adding more constraints (such as "the edges must be parallel to the coordinate system axes). $\endgroup$ – hmakholm left over Monica Nov 24 '11 at 15:13
  • $\begingroup$ Ahhh, now I've got there!! SO basically I need to know another coordinate or the length of the sides. Thanks guys! $\endgroup$ – r0bb077 Nov 24 '11 at 15:18
  • $\begingroup$ Sorry to be so pre-school but if I did set a length for one of the edges how would I then find the coordinates?! $\endgroup$ – r0bb077 Nov 24 '11 at 15:25
2
$\begingroup$

In your example, the bottom left coordinate is higher up than the top right coordinate.

Suppose that $b<d$ and $a<c$. If the bottom left coordinate is $(a,b)$ and the top right is $(c,d)$, then the top left coordinate would be $(a,d)$ and the bottom right would be $(c,b)$.

Other cases can be worked out similarly.

$\endgroup$
1
  • $\begingroup$ Thanks Joe, just noticed I had my numbers mixed up!! $\endgroup$ – r0bb077 Nov 24 '11 at 14:36
0
$\begingroup$

I agree with top left coordinate would be (a,d) and the bottom right would be (c,b). But, it is taking an assumption that the rectangle is not rotated. If rectangle is rotated wrt to our x,y coordinates then we need to transform our x,y axis.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.