# point location test and cross products

Problem: cses point location test

C++ solution:

The cross product of vector a and vector b in R^2 is (a.x * b.y) - (b.x * a.y) or the determinant of matrix A = [ a b ].

The cross product is not commutative. If the cross product is 0, then the vectors are colinear. If the cross product is less than 0, then the first vector (in the previous case, a) is to the left of vector b.

The solution is just a matter of using this fact on the vectors: (b - a) and (r - a).

Resources: wikipedia, stack overflow, my drawing