threejs-worldgen
    Preparing search index...

    Function insetPolygon

    • Moves every edge of a counter-clockwise polygon inwards by its own distance (d[i] for edge p[i]→p[i+1]) and joins the offset lines at their intersections. Edges that collapse (their offset runs backwards) are removed and the neighbours re-joined, a cheap stand-in for a straight skeleton. Returns null when nothing valid is left.

      Parameters

      • p: readonly Vec2[]
      • d: number | readonly number[]
      • miterLimit: number = 4

        Corners never move further than miterLimit × distance from the source corner.

      Returns Vec2[] | null