This code reads a polygon with n vertices (vx, vy) / (-1 <= vx <= 1) and (-1 <= vy <= 1) and generates 64 lines that may or not cross the polygon. The parts of the lines inside the polygon are colored green and the outside parts are colored gray.
You can understand the method by reading all the comments along the code.
To compile it: g++ main.cpp -o -lGL -lglut -Wall
Below some screenshots of the program running properly and its pathological case:
My solution has one flaw. When a line intersects a polygon right at one of its corners without getting inside of the polygon itself, it will change the color line anyway. See it below: