nape-js API
    Preparing search index...

    Class GeomPoly

    A polygon represented as a circular doubly-linked list of vertices.

    Supports construction from Array, Vec2List, or another GeomPoly. Provides geometric queries (area, winding, containment, convexity) and decomposition algorithms (simple, monotone, convex, triangular).

    Index
    • Parameters

      • start: Vec2
      • end: Vec2
      • boundedStart: boolean = false
      • boundedEnd: boolean = false
      • Optionaloutput: any

      Returns any

    • Decompose a (possibly self-intersecting) polygon into simple pieces.

      The pieces are disjoint and together cover the polygon's even-odd region: a point is inside when a ray from it crosses the outline an odd number of times. Where that region touches itself at a single vertex, or where the outline runs back over one of its own edges, a piece may be only weakly simple (it revisits a vertex, so isSimple() is false). Zero-area slivers are dropped.

      Parameters

      • Optionaloutput: any

        Optional GeomPolyList to append to. If omitted, a new one is created.

      Returns any

      The list of pieces.