path-rite

extractSkeleton

Extract the corner points (skeleton) from a path, stripping curves to reveal the underlying polygon.

extractSkeleton(svgPath: string): { x: number, y: number }[]

svgPath — SVG path d-attribute string.

Returns — An array of { x, y } point objects representing the corner vertices.

// Get corner points from a rounded rectangle
const corners = pathRite.extractSkeleton(roundedRectPath);
// corners === [{ x: 0, y: 0 }, { x: 100, y: 0 }, ...]