You are not logged in.

- Topics: Active | Unanswered

**jjones****Guest**

i posted a while ago finding points on a line as i need to calculate if a given (X,Y) is on a line that spans from (x1,y1) to (x2,y2) i have the following

0= (y2-y1)/(x2-x1)X+ (y1-[(y2-y1)/(x2-x1)]*x1) -Y

but it only seems to work for horizontal lines my maths is pretty bad and i would really appreciate it if any one could explain or even better tell me how i could make it work as i am really lost.

**ganesh****Moderator**- Registered: 2005-06-28
- Posts: 20,786

The equation of the line joining the points

is given by

Now, after forming the equation of the line joining the two points,

substitute the values (x,y) and see if the equation is satisfied. If yes, the point lies on the straight line, if no, it doesn't.

It is no good to try to stop knowledge from going forward. Ignorance is never better than knowledge - Enrico Fermi.

Nothing is better than reading and gaining more and more knowledge - Stephen William Hawking.

Offline