MCPcopy Create free account
hub / github.com/SuprDewd/CompetitiveProgramming / polygon_area_signed

Function polygon_area_signed

code/geometry/polygon.cpp:3–6  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1#include "lines.cpp"
2typedef vector<point> polygon;
3double polygon_area_signed(polygon p) {
4 double area = 0; int cnt = size(p);
5 rep(i,1,cnt-1) area += cross(p[i] - p[0], p[i + 1] - p[0]);
6 return area / 2; }
7double polygon_area(polygon p) {
8 return abs(polygon_area_signed(p)); }
9#define CHK(f,a,b,c) \

Callers 3

polygon_areaFunction · 0.85
testFunction · 0.85
polygon_centroidFunction · 0.85

Calls 1

crossFunction · 0.85

Tested by 1

testFunction · 0.68