建立方程
设a为直线外一点,b,c为直线上两点
$\left\{ {\begin{array}{*{20}{c}}
{(x - ax,y - ay) \cdot (cx - bx,cy - by) = 0}\\
{\frac{{y - cy}}{{x - cx}} = \frac{{y - by}}{{x - bx}}}
\end{array}} \right.$
解出符号解
使用mathematics工具:
-
Solve[{(x - ax)*(cx - bx) + (y - ay)*(cy - by) ==
-
0, (y - cy)*(x - bx) == (y - by)*(x - cx)}, {x, y}]
得出如下:
-
{{x -> -(((bx - cx) (ax bx + ay by - ax cx - ay cy) - (-by +
-
cy) (by cx - bx cy))/((bx - cx) (-bx + cx) - (-by + cy)^2)),
-
y -> -((-ax bx by - ay by^2 + ax by cx + bx by cx - by cx^2 +
-
ax bx cy - bx^2 cy + 2 ay by cy - ax cx cy + bx cx cy -
-
ay cy^2)/(bx^2 + by^2 - 2 bx cx + cx^2 - 2 by cy + cy^2))}}
然后可以将上式带入需要的程序中,求得垂足。