Here are some hints.
First say that are the endpoints of the segment on the x-axis and on the y-axis respectively.
Because the line segment has constant length .
If then is the midpoint of the segment, so .
As and visa versa.