I just putted this at the final where const lineLengthExtension = 2.2, lineLengthReduction = 2.2;
.
pointsToConnect.forEach(({ angle }, pointIndex) => {
const innerPoint = polarToCartesian(innerOuterRadius - lineLengthReduction, angle);
const inclinedOuterAngle = angle + (pointIndex === 0 ? inclinationAngle : -inclinationAngle);
const extendedOuterPoint = polarToCartesian(outerInnerRadius + lineLengthExtension, inclinedOuterAngle);
svg.append("line")
.attr("x1", innerPoint.x)
.attr("y1", innerPoint.y)
.attr("x2", extendedOuterPoint.x)
.attr("y2", extendedOuterPoint.y)
.attr("stroke", lineColor)
.attr("stroke-width", 3);
});