Extend a line segment a specific distance

后端 未结 3 1887
感动是毒
感动是毒 2020-12-05 04:52

I am trying to find a way to extend a line segment by a specific distance. For example if I have a line segment starting at 10,10 extending to 20,13 and I want to extend th

3条回答
  •  被撕碎了的回忆
    2020-12-05 05:23

    If you already have the slope you can compute the new point:

    x = old_x + length * cos(alpha);
    y = old_y + length * sin(alpha);
    

    I haven't done this in a while so take it with a grain of salt.

提交回复
热议问题