math docs
    Preparing search index...

    Function signedArea

    • Returns the signed area of the polygon using the shoelace formula. The result is positive when the vertices wind counter-clockwise and negative when they wind clockwise, so the sign can be used to determine winding order.

      Parameters

      • vertices: number[]

        polygon vertices as a flat array [x0, y0, x1, y1, ...]

      • n: number

        number of vertices to read from vertices

      Returns number

      the signed area