# Find a point on a line given, distance from startpoint

1. Aug 10, 2011

### boston

Hi,

I have a line L stretching from point A to ponit B. The startpoint A has the coordinates x1, y1 and endpoint B has the coordinates x2, y2.

I want a formula for calculating the coordinates for point P. Point P lies on the line L and with the distance Z from startpoint A.

BR Boston

2. Aug 10, 2011

### daveyp225

your equation is f(x)=y=(y2-y1)/(x2-x1)(x-x1) + y1 [this is just using y-y0 = m(x-x0)]

Now, a distance Z should be determined by a displacement +/-Z. There are two answers as written, if it is meant "in the direction of b" then replace +/-Z with just Z

Let t = arctan[(y2-y1)/(x2-x1)], this is the angle of the slope.

Then replace x in f(x) with x1+(+/-Z)cos(t). That is, you are finding y when x is at the point when you are +/-Zcos(t) from the coordinate x1. That is how much it changes when you move up or down the slope a displacement of +/-Z. Your point is (x1+(+/-Z)cos(t), f(x1+(+/-Z)cos(t))

Last edited: Aug 10, 2011