Soldato
- Joined
- 8 Mar 2007
- Posts
- 10,938
Hi all, probably a simple problem for anyone with a decent knowledge of geometry.
Long story short I'm writing a small application and want to mimic a Sat Navs ability to tell you what road you are on at any given time.
Here's my problem.....
I know the coordinates of all three points; let's call them 'Ax & Ay', 'Bx & By' and 'Cx & Cy'. For my purposes 'A' is the end of the road, 'B' is the start of the road and 'C' is the vehicle.
So I guess the question is, mathematically how do I test if coordinate 'C' is on the line of a joined to 'B'?
* Ignore bends, I will always be using straight lines.
* The angle of the road/line used above is just an example, the road/line could be in * any orientation, 360 degrees round including 'A' being at the bottom and 'B' being at the top.
* 'C' can obviously be on any part of the line between 'A' and 'B'.
Long story short I'm writing a small application and want to mimic a Sat Navs ability to tell you what road you are on at any given time.
Here's my problem.....

I know the coordinates of all three points; let's call them 'Ax & Ay', 'Bx & By' and 'Cx & Cy'. For my purposes 'A' is the end of the road, 'B' is the start of the road and 'C' is the vehicle.
So I guess the question is, mathematically how do I test if coordinate 'C' is on the line of a joined to 'B'?
* Ignore bends, I will always be using straight lines.
* The angle of the road/line used above is just an example, the road/line could be in * any orientation, 360 degrees round including 'A' being at the bottom and 'B' being at the top.
* 'C' can obviously be on any part of the line between 'A' and 'B'.
Last edited: