enter image description here

If point A($x_1,y_1$) and C($x_3,y_3$) are given i have to find points B($x_2,y_2$) and D($x_4,y_4$),if points B and D are given i need to find point A and C. Edges of rectangle may not be parallel to axes

  • 4
    $\begingroup$ You know that $AC$ and $BD$ are the same length, and cross at the midpoint. However you don't know the angle they cross at; varying this angle will give infinitely many solutions to your problem. $\endgroup$ – vadim123 Feb 11 '15 at 14:27
  • $\begingroup$ a circle with the diameter A-C is handy. $\endgroup$ – Math-fun Feb 11 '15 at 14:32
  • $\begingroup$ Or otherwise: You need the ratio $AD$ : $AB$ $\endgroup$ – mvw Feb 11 '15 at 15:15
  • $\begingroup$ About using a circle also see Thales' theorem. $\endgroup$ – z100 Aug 18 '17 at 14:50

Following on Mehdi's suggestion, take the midpoint of $AC$, namely $$M=\left(\frac{x_1+x_3}{2},\frac{y_1+y_3}{2}\right)=(x_m,y_m)$$ Then take the radius as $$r=|A-M|=\sqrt{(\frac{x_1-x_3}{2})^2+(\frac{y_1-y_3}{2})^2}$$ You may now choose any $B$ on the circle $$(x-x_m)^2+(y-y_m)^2=r^2$$ That is, choose any $x_2$ in the interval $[x_m-r,x_m+r]$, then plug in all the known quantities and solve for the sole unknown $y_2$ in the equation $(x_2-x_m)^2+(y_2-y_m)^2=r^2$ (there are usually two choices for $y_2$).

Once you've found $B$, you may find $D$ via $$D=(M-B)+M=2M-B=(2x_m-x_2,2y_m-y_2)=(x_4,y_4)$$

  • $\begingroup$ just for clarity, as I'm currently tackling a similar problem, am I correct in saying we can calculate multiple forms of triangles with these 2 coordinates, but without knowing the orientation it would be impossible to know what the correct one is? $\endgroup$ – James Feb 14 at 16:56

Given the vertices $A(x_1,y_1)$ and $C(x_3,y_3),$ if the segment $AC$ is not parallel to one of the axes then one solution for $B(x_2,y_2)$ is $(x_2, y_2) = (x_3,y_1)$ and another is $(x_2, y_2) = (x_1,y_3).$ (One of these will give you the four vertices labeled in clockwise order, the other in counterclockwise order.) This will give you a rectangle with sides parallel to the axes; as the question says, that is not the only rectangle with diagonal $AC,$ but it is a rectangle with diagonal $AC.$

In any case, there are an infinite number of other possible solutions. Choose a number $m$ from the set of all real numbers except $\frac{y_1-y_3}{x_1-x_3},$ $-\frac{x_1-x_3}{y_1-y_3},$ and $0.$ Then set up the equations \begin{align} y_2- y_1 &= m(x_2 - x_1) \\ y_2 - y_3 &= -\frac1m(x_2 - x_3) \\ \end{align} Solve those simultaneous equations for the unknown quantities $x_2$ and $y_2,$ given the known quantities $x_1,$ $x_3,$ $y_1,$ $y_3,$ and $m.$

Every possible rectangle with diagonal $AC$ can be found by one or the other of these rules (either put the sides parallel to the axes, or choose a number $m$ and solve the equations).


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.