What the problem boils down to is creating a pair of parallel lines through A and C with a second perpendicular pair through B and D. The four intersections of these lines would then be P,Q,R,S. The trick is to make this rectangle a square.
Let the lines through A and C have slope m
so the lines through B and D have slope 1/m
http://en.wikipedia.org/wiki/Parallel_%28geometry%29
gives a nice formula for the distance between parallel lines through two points.
The lines through A and C have distance
(ycya)m(xcxa)/√(m^2+1)
The lines through B and D have distance
(ydyb)(1/m)(xdxb)/√((1/m)^2+1)
Setting these distances equal should allow us to solve for m. I don't have time to finish now but it looks quadratic in m which makes sense since playing with sketchpad indicates we often get two solutions.
Edit:
It's not quadratic. The absolute values are giving the multiple solutions.
Setting the equations equal and simplifying a bit gives
(ycya)m(xcxa) = (ydyb)(1/m)(xdxb)m
(ycya)m(xcxa) = m(ydyb)+(xdxb)
There will be two solutions: one for the possibility that the arguments inside the absolute values have the same sign and one for the possibility that the signs be different.
m = ((ycya)(xdxb))/((xcxa)+(ydyb))
or
m = ((ycya)+(xdxb))/((xcxa)(ydyb))
So the construction is complete.
Edited on January 10, 2013, 11:12 am

Posted by Jer
on 20130109 13:48:50 