How to determine if 2 points are on opposite sides of a line How can I determine whether the 2 points $(a_x, a_y)$ and $(b_x, b_y)$ are on opposite sides of the line $(x_1,y_1)\to(x_2,y_2)$? 

Writing $A$ and $B$ for the points in question, and $P_1$ and $P_2$ for the points determining the line ...
Compute the "signed" areas of the $\triangle P_1 P_2 A$ and $\triangle P_1 P_2 B$ via the formula (equation 16 here)
$$\frac{1}{2}\left|\begin{array}{ccc}
x_1 & y_1 & 1 \\
x_2 & y_2 & 1 \\
x_3 & y_3 & 1 
\end{array}\right|$$
with $(x_3,y_3)$ being $A$ or $B$. The points $A$ and $B$ will be on opposite sides of the line if the areas differ in sign, which indicates that the triangles are being traced-out in different directions (clockwise vs counterclockwise).
You can, of course, ignore the "$1/2$", as it has not affect the sign of the values. Be sure to keep the row-order consistent in the two computations, though. 
