signed area , A(T)the triangle T = ((x1, y1), (x2, y2), (x3, y3))defined in 1/2 times the determinant of the following matrix:
|x1 y1 1|
|x2 y2 1|
|x3 y3 1|
Qualifier -y1*x2 + x1*y2 + y1*x3 - y2*x3 - x1*y3 + x2*y3.
Given the polygon (convex or concave) defined by the vertices p[0], p[1], ..., p[N - 1], you can calculate the region of the polygon as follows.
area = 0
for i in [0, N - 2]:
area += A((0, 0), p[i], p[i + 1])
area += A((0, 0), p[N - 1], p[0])
area = abs(area)
, A((0, 0), p, q) 0.5 * (-p.y*q.x + p.x*q.y). , 0.5 :
area = 0
for i in [0, N - 2]:
area += -p[i].y * p[i+1].x + p[i].x * p[i+1].y
area += -p[N-1].y * p[0].x + p[N-1].x * p[0].y
area = 0.5 * abs(area)
, . , , .