How to check if the Polygon is concave or convex?using openGL. I take points as input from .txt file and I draw with these points a polygon then here comes the problem .. I need an algorithm to detect the type of the polygon .. concave or convex .
void drawPoints() {
glClear(GL_COLOR_BUFFER_BIT); //Clear display window.
if (points.size()<2) {
glPointSize(3.0);
glBegin(GL_POINTS);
}
else {
glLineWidth(3.0);
glBegin(GL_LINE_LOOP);
}
for (int i = 0; i<(int)points.size(); i++) {
Point& p_i = points[i];
glVertex2f(p_i.GetX(), p_i.GetY());
}
glEnd();
glFlush(); //Process all OpenGL routines as quickly as possible.
}