#include #include #include #include #include #include typedef struct { int x,y,pred,succ; }punct; typedef punct poligon[10]; poligon p; int n,i; int orientare(punct A, punct B, punct C) { float d; d=(float)(B.x-A.x)*(C.y-A.y)-(C.x-A.x)*(B.y-A.y); if(d>0)return 1; if(d<0)return -1; if(d==0)return 0; } int coliniare(punct A,punct B, punct C) { if(orientare(A,B,C)!=0) return 0; else return 1; } void citire_poligon() { printf("n="); scanf("%d",&n); for(i=0;i=B.x)&&(B.x>=C.x))); else return (((A.y<=B.y)&&(B.y<=C.y))||((A.y>=B.y)&&(B.y>=C.y))); } int intersectie_proprie(punct A,punct B,punct C,punct D) { return((orientare(A,B,C)*orientare(A,B,D)<0)&&(orientare(C,D,A)*orientare(C,D,B)<0)); } int intersectie_improprie(punct A,punct B,punct C,punct D) { if(intre(C,A,D)||intre(C,B,D)||intre(A,C,D)||intre(A,D,B)) return 1; else return 0; } int intersectie_segmente(punct A,punct B,punct C,punct D) { if(intersectie_proprie(A,B,C,D)||intersectie_improprie(A,B,C,D)) return 1; else return 0; } int poligon_simplu(int n, poligon p){ int i,k; for(i=0;ip[i].y)||((p[m].y==p[i].y)&&(p[m].x