JohnWrowles
New member
- Joined
- Sep 26, 2007
- Messages
- 2
Note that this is a real world problem rather than one from a textbook.
I need to be alerted when a vehicle crosses a line. The line is defined by start and end points in terms of spatial coordinates (x,y) e.g. start of line x=2662150 (east), y=6494900 (north) end of line x=2662158 (east), y=6494895 (north)- these are actually New Zealand map grid coordinates - but the principle is the same in any coordinate system.
We always know that the coordinates are positive.
The vehicle carries a GPS and so always knows its own x,y position. The challenge is to construct an algorithm that continuously monitors the position and triggers an alert when the vehicle crosses the line (or an extension of the line) within a reasonable distance.
My thinking so far is to set one of the points to the origin and then set the y axis so that it follows the line. If I can translate the x,y of the moving vehicle into this (new) coordinate system then the trigger would simply fire when the x coordinate changes from positive to negative (or vice versa) - i.e. crosses the (new) y axis in either direction. I think that this requires a translation to polar coordinates so that the angle of axis rotation can be calculated, but despite much sketching and figuring I can't figure it out
Any help would be much appreciated.
I need to be alerted when a vehicle crosses a line. The line is defined by start and end points in terms of spatial coordinates (x,y) e.g. start of line x=2662150 (east), y=6494900 (north) end of line x=2662158 (east), y=6494895 (north)- these are actually New Zealand map grid coordinates - but the principle is the same in any coordinate system.
We always know that the coordinates are positive.
The vehicle carries a GPS and so always knows its own x,y position. The challenge is to construct an algorithm that continuously monitors the position and triggers an alert when the vehicle crosses the line (or an extension of the line) within a reasonable distance.
My thinking so far is to set one of the points to the origin and then set the y axis so that it follows the line. If I can translate the x,y of the moving vehicle into this (new) coordinate system then the trigger would simply fire when the x coordinate changes from positive to negative (or vice versa) - i.e. crosses the (new) y axis in either direction. I think that this requires a translation to polar coordinates so that the angle of axis rotation can be calculated, but despite much sketching and figuring I can't figure it out
Any help would be much appreciated.