# Coordinate geometry query

1. Jan 23, 2006

### Inquisitus

Not actually homework, but just a general query...

I'm trying to write a program that will predict the trajectory of a moving point by analysing several positions through which the point has passed.

Part of this involves finding the coordiantes of a point B, given the coordinates of another point A, the length of AB and its gradient. Obviously there are two possible points... one to the right A and one to the left, but I'm only interested in the one to the right.

I basically need two simple formulae in terms of the x and y coordinates of B, which I can apply in the program itself, although I wouldn't mind knowing how the formula was reached as well

I've tried getting my head around it but I'm just getting confused. Any help would be greatly appreciated, thanks!

Last edited: Jan 23, 2006
2. Jan 23, 2006

### StatusX

I'm not sure what you mean by the gradient. Is that the slope of the line connecting A to B? Are you asking how to find a point B=(x2,y2) given a point A=(x1,y1), and the length L and slope m of AB?

If so, this can be found by pretending A is at (0,0) (you can add the coordinates of A back in at then end). Then the line containing AB has the equation y=mx, so that points along the line have coordinates like (x,mx). The distance from A to a point (x,mx) is $\sqrt{x^2+m^2 x^2}=x\sqrt{1+m^2}$. Then you want to solve for x using $L= x\sqrt{1+m^2}$. This x is the difference between the x values of A and B, and multiplying it by m gives the difference between the y values.

Last edited: Jan 23, 2006