You will need to know the coordinates of two points on the line separating "left" and "right". It appears that a and b are initially on that line so save those coordinates as, say and . Then the equation of that line is or, equivalently, . Points to the left of that line will have , points to the right will have .

That is, to determine whether a point is left or right of that line, calculate and see if it is positive or negative.