math docs
    Preparing search index...

    Function winding

    • Returns the winding order of the polygon from the sign of its signed area: 1 for counter-clockwise, -1 for clockwise, and 0 for a degenerate (zero-area) polygon.

      Parameters

      • vertices: number[]

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

      • n: number

        number of vertices to read from vertices

      Returns number

      1 (CCW), -1 (CW), or 0 (degenerate)