Given two non-diagonal points $(x_1,y_1)$ and $(x_2,y_2)$ on a plane and guaranteed distance equal to one between them, I need to compute the coordinates of the other two points, that form a square of edge length equal to one.
This is easy, as I can make a $2×2$ system for the third point, with one equation derived from the distance and the other using the fact that the dot product of the vectors should be equal to zero and the same for the fourth point.
However I want to write a program doing this, and thus I want a closed form, not to make the computer solve the system.
Can you help me with a closed form? Any of the two possible answers will do
If you consider your side a vector $(x_2-x_1,y_2-y_1)$ a perpendicular vector is $(y_2-y_1,x_1-x_2)$ so the third point is $(y_2-y_1+x_2,x_1-x_2+y_2)$ and the fourth is $(y_2-y_1+x_1,x_1-x_2+y_1)$. This gives one of the two squares on your given side. The second comes from negating the perpendicular vector I gave.