I have segment line with two points $T_1(x_1,y_1), T_2(x_2,y_2)$ and then I place the $3.$ point $T_3(x_3,y_3)$. Is there a way to check (with given $x_1, x_2, x_3, y_1, y_2, y_3)$ if perpendicular to the segment line $T_1,T_2$ from $T_3$ exists? I've managed to calculate the perpendicular for line but not the segment line. I am programming in C#.
double dx = x2 - x1; double dy = y2 - y1; double mag = Math.Sqrt(dx * dx + dy * dy); dx /= mag; dy /= mag; double lambda = (dx * (x3 - x1)) + (dy * (y3 - y1)); rx1 = (dx * lambda) + x1; ry1 = (dy * lambda) + y1;
rx1 and ry1 are coordinates of a point T3.