dotproduct = (c.x - a.x) * (b.x - a.x) + (c.y - a.y) * (b.y - a.y)
if dotproduct < 0:
    return False
squaredlengthba = (b.x - a.x) * (b.x - a.x) + (b.y - a.y) * (b.y - a.y)
if dotproduct > squaredlengthba:
    return False
return True
How can you determine a point is between two other points on a line segment?