IMHO there are few ways of solving your problem. First one which came to my mind is this:
from shapely.geometry import LineString
line1 = LineString([(i, i) for i in range(5)])
line2 = zip(range(5)[::-1], range(5))
if line1.crosses(line2):
print 'yeah!'
add a loop and iterate every waypoint-line
Other possible options:
- simple math calculation using intersection of two strait lines - high school stuff
- import your data into postgres with postgis and use postgis function eg ST_Crosses (if postgres is to heavy for you I would give SpatialLite-sqlite a try)
- pyshp, shapely, gdal/geos, geodjango, geoalchemy
- combine some of the above and write a bit more fancy algo like creating a buffer around one line/point and check if it "ST_Contains" GPS position also checking if any later positions are off buffer zone(?)