I have a line (P1, P2), and a point on that line (midpoint). What equation can I used to find the perpendicular line of line (P1, P2), that passes through midpoint. The poin
Let define vector
D = P2 - P1 (dx=x2-x1, dy = y2-y1)
and middle point
mx = (x2+x1)/2
my = (y2+y1)/2
Perpendicular to D vector
PD = (-dy, dx)
Unit (normalized) perpendicular vector
U = (-dy / L, dx / L)
where
L = Sqrt (dx * dx + dy * dy)
And coordinates of point lying at distance F from the middle are
x = mx + U.x * F
y = my + U.y * F
or (for point at another side)
x = mx - U.x * F
y = my - U.y * F