I have a line with (x1,y1) and (x2,y2) endpoints. My task is to find my points in between. I want to find a point (xnew,ynew) from (x1,y1) such that xnew is 0.1 units distance from x1. How do I find ynew here?
My code:
# I know how to find the mid point
def find_line_mid(x1,y1,x2,y2)
xnew = (x1+x2)/2
ynew = (y1+y2)/2
return xnew,ynew
# My attempt
# We know that slope along the line is constant. We use it here
sl = (y2-y1)/(x2-x1)
xnew = x1+0.1
ynew = sl*(xnew)+y1 # from y=mx+c
is this a correct approach?
How can I find a point at a specific distance from the first point?