My math is very rusty, so I figure someone has to have solved this problem, as it is a common feature of many automotive data acquisition systems (which I'm building one of). The issue is when a race car has crossed a start/finish line to calculate lap times. The user will initiate the start finish line by pressing a button (or it can be retrieved from a saved dataset for a given track). when the button gets pressed, I have a GPS point, and a heading (direction the vehicle is moving), this gives me a vector, I can easily calculate a new vector perpendicular to the initial vector establishing a line. My problem comes now to checking and calculating if the vehicle has crossed that line. From my reading, I think I really need to create a rectangular polygon (which should be simple, take the initial point, and the new vector, calculate another point on that line (say 400 feet away), then create an additional line parallel to the initial line (say 25 ft), this gives me 4 points to determine my polygon. Once the polygon has been determined, then I have to take a given point, and determine if its within the polygon or outside of it.

a) is my "theory" here correct

b) has anyone got any sample code for an arduino Mega that already does this or something similar that I can modify.

a) is my "theory" here correct

b) has anyone got any sample code for an arduino Mega that already does this or something similar that I can modify.