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
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
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)$$
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).