I have a line segment defined as its starting and ending points.
L = [(x1, y1), (x2, y2)]
So
(x1, y1) (x2, y2)
L: A-------------------------------B
I now wish to extend the line by pulling apart these two points like so
a a
L: A'--------A-------------------------------B-----------B'
So I need to update the coordinates of point A
and B
.
Suppose A'A = B'B = a
How to do it in Python?
This question may be quite related, but mine mainly focuses on the algorithm that does the task, instead of visualizing it in the figure.