[NO-PARSE]#define ABS(x) ((x) < 1 ? (x) * -1 : (x))
struct coord { double x, y; };
double polygon_surface_area(struct coord *pts, int count)
{
int i;
double x = 0.;
for (i = 0; i < count - 1; i++)
{
x += (pts.x * pts[i + 1].y)
- (pts.y * pts[i + 1].x);
}
x += (pts.x * pts[0].y) - (pts.y * pts[0].x);
return ABS(x) * 0.5;
}[/NO-PARSE]