Perpendicular on a line from a given point

前端 未结 14 1639
名媛妹妹
名媛妹妹 2020-11-29 18:34

How can I draw a perpendicular on a line segment from a given point? My line segment is defined as (x1, y1), (x2, y2), If I draw a perpendicular from a point (x3,y3) and it

14条回答
  •  情歌与酒
    2020-11-29 19:08

    This is mostly a duplicate of Arnkrishn's answer. I just wanted to complete his section with a complete Mathematica code snippet:

    m = (y2 - y1)/(x2 - x1)
    eqn1 = y - y3 == -(1/m)*(x - x3)
    eqn2 = y - y1 == m*(x - x1)
    Solve[eqn1 && eqn2, {x, y}]
    

提交回复
热议问题