How to calculate the area of polygon. For a triangle like:
We can calculate the area:
function cross_product(a, ,b) { return a.x * b.y - a.y * b.x }
function area (a, b) { cross_product(a, b) / 2.0 }
This approach is able to solve all simple polygon areas problem: