Competitive Programing Problem Solutions/Geometry/test (2).cpp
bool IsSimple(const vector<PT>p){
    for(int i=0; i<p.size(); i++){
        for(int k=i+1; k<p.size(); k++){
            int j=(i+1)%p.size();
            int l=(k+1)%p.size();
            if(i==l || j==k) continue;
            if(SegmentsIntersect(p[i], p[j], p[k], p[l])) return false;
        }
    }
    return true;
}
/// Checks whether or not a the polygon 'p' (in CW or CCW order) is simple

Checks whether or not a the polygon 'p' (in CW or CCW order) is simple
Checks whether or not a the polygon ' p ' ( in CW or CCW order ) is simple
bool IsSimple(const vector<PT>p){
    for(int i=0; i<p.size(); i++){
        for(int k=i+1; k<p.size(); k++){
            int j=(i+1)%p.size();
            int l=(k+1)%p.size();
            if(i==l || j==k) continue;
            if(SegmentsIntersect(p[i], p[j], p[k], p[l])) return false;
        }
    }
    return true;
}
bool IsSimple ( const vector < PT > p ) { for ( int i = 0 ; i < p . size ( ) ; i ++ ) { for ( int k = i + 1 ; k < p . size ( ) ; k ++ ) { int j = ( i + 1 ) % p . size ( ) ; int l = ( k + 1 ) % p . size ( ) ; if ( i == l || j == k ) continue ; if ( SegmentsIntersect ( p [ i ] , p [ j ] , p [ k ] , p [ l ] ) ) return false ; } } return true ; }
Checks whether or not a the polygon 'p' (in CW or CCW order) is simple
Checks whether or not a the polygon ' p ' ( in CW or CCW order ) is simple