import { Vector2 } from "three";

export default function getArea(points: Vector2[]): number {
    let sum = 0;
    for (let i = 0; i < points.length; i++) {
        const j = (i + 1) % points.length;
        sum += points[i].x * points[j].y - points[j].x * points[i].y;
    }
    return Math.abs(sum / 2);
}
