MCPcopy Create free account
hub / github.com/Stanko/offset-polygon / offsetPolygon

Function offsetPolygon

src/offset-polygon.ts:289–301  ·  view source on GitHub ↗
(
  vertices: Vector[],
  offset: number,
  arcSegments: number = 0
)

Source from the content-addressed store, hash-verified

287}
288
289export default function offsetPolygon(
290 vertices: Vector[],
291 offset: number,
292 arcSegments: number = 0
293): Vector[] {
294 const polygon = createPolygon(vertices);
295
296 if (offset > 0) {
297 return createMarginPolygon(polygon, offset, arcSegments).vertices;
298 } else {
299 return createPaddingPolygon(polygon, -offset, arcSegments).vertices;
300 }
301}

Callers

nothing calls this directly

Calls 3

createPolygonFunction · 0.70
createMarginPolygonFunction · 0.70
createPaddingPolygonFunction · 0.70

Tested by

no test coverage detected