Competitive Programing Problem Solutions/Geometry/test (2).cpp
double ComputeSignedArea(const vector<PT>p){
    double area=0.0;
    for(int i=0; i<p.size(); i++){
        int j=(i+1)%p.size();
        area+=p[i].x*p[j].y-p[j].x*p[i].y;
    }
    return area/2.0;
}
/// Computes the area of a possibly non-convex polygon, assuming that the coordinates are listed in a clockwise or counterclockwise fashion

Computes the area of a possibly non-convex polygon, assuming that the coordinates are listed in a clockwise or counterclockwise fashion
Computes the area of a possibly non - convex polygon assuming that the coordinates are listed in a clockwise or counterclockwise fashion
double ComputeSignedArea(const vector<PT>p){
    double area=0.0;
    for(int i=0; i<p.size(); i++){
        int j=(i+1)%p.size();
        area+=p[i].x*p[j].y-p[j].x*p[i].y;
    }
    return area/2.0;
}
double ComputeSignedArea ( const vector < PT > p ) { double area = 0.0 ; for ( int i = 0 ; i < p . size ( ) ; i ++ ) { int j = ( i + 1 ) % p . size ( ) ; area += p [ i ] . x * p [ j ] . y - p [ j ] . x * p [ i ] . y ; } return area / 2.0 ; }
Computes the area of a possibly non-convex polygon, assuming that the coordinates are listed in a clockwise or counterclockwise fashion
Computes the area of a possibly non - convex polygon assuming that the coordinates are listed in a clockwise or counterclockwise fashion