多边形

转自:https://www.cnblogs.com/xiexinxinlove/p/3708147.html





直接上代码:

double polygonarea(Point *p, int n){
    double area = 0;
    for(int i = 1; i < n-1; i++){
        area += Cross(p[i]-p[0], p[i+1]-p[0]);
    }
    return area/2;
}

你可能感兴趣的:(多边形)