function arcToPoints(s, startX, startY) {
  const points = [];
  const largeArcFlag = !!s[4]; // F.6.3
  const sweepFlag = !!s[5]; // F.6.3
  const rotation = s[3];
  let endX = s[6];
  let endY = s[7];
  let rx = s[1];
  let ry = s[2];
  let cx;
  let cy;
  let sweepAngle;
  let startAngle;

  if (s[0] === 'a') {
    endX += startX;
    endY += startY;
  }

  // F.6.2
  if (startX === endY && startY === endY) {
    return points;
  }

  // Given no radius, threat as lineTo command
  if (!rx || !ry) {
    points.push({ x: endX, y: endY });
    return points;
  }

  ({ cx, cy, rx, ry, sweepAngle, startAngle } = arcToCenter(
    rx,
    ry,
    rotation,
    largeArcFlag,
    sweepFlag,
    endX,
    endY,
    startX,
    startY
  ));

  // Approximation of perimeter
  const p = Math.abs(sweepAngle * Math.sqrt((Math.pow(rx, 2) + Math.pow(ry, 2)) / 2));

  // Generate a point every 10th pixel. Scaling of the node should probably be included in this calculation
  const res = Math.ceil(p / 10);
  const resAngle = sweepAngle / res;

  for (let k = 1; k <= res; k++) {
    const deltaAngle = resAngle * k;
    const radians = (startAngle + deltaAngle) % PI_X2;
    const cos = Math.cos(radians);
    const sin = Math.sin(radians);
    // F.6.3 https://www.w3.org/TR/SVG/implnote.html#ArcImplementationNotes
    points.push({
      x: cx + cos * rx + -sin * cos,
      y: cy + sin * ry + cos * sin,
    });
  }

  // points.push({ x: cx, y: cy });

  return points;
}
/**
 * Transform an arc to a set of points a long the arc.
 * Specifiction F.6 (https://www.w3.org/TR/SVG/implnote.html#ArcImplementationNotes)
 * @ignore
 * @param {array} s - Segments
 * @param {number} startX - X-coordinate for start of arc
 * @param {number} startY - Y-coordinate for start of arc
 */
Transform an arc to a set of points a long the arc.
Transform an arc to a set of points a long the arc .
function arcToPoints(s, startX, startY) {
  const points = [];
  const largeArcFlag = !!s[4]; 
  const sweepFlag = !!s[5]; 
  const rotation = s[3];
  let endX = s[6];
  let endY = s[7];
  let rx = s[1];
  let ry = s[2];
  let cx;
  let cy;
  let sweepAngle;
  let startAngle;
  if (s[0] === 'a') {
    endX += startX;
    endY += startY;
  }
  if (startX === endY && startY === endY) {
    return points;
  }
  if (!rx || !ry) {
    points.push({ x: endX, y: endY });
    return points;
  }
  ({ cx, cy, rx, ry, sweepAngle, startAngle } = arcToCenter(
    rx,
    ry,
    rotation,
    largeArcFlag,
    sweepFlag,
    endX,
    endY,
    startX,
    startY
  ));
  const p = Math.abs(sweepAngle * Math.sqrt((Math.pow(rx, 2) + Math.pow(ry, 2)) / 2));
  const res = Math.ceil(p / 10);
  const resAngle = sweepAngle / res;
  for (let k = 1; k <= res; k++) {
    const deltaAngle = resAngle * k;
    const radians = (startAngle + deltaAngle) % PI_X2;
    const cos = Math.cos(radians);
    const sin = Math.sin(radians);
     https://www.w3.org/TR/SVG/implnote.html#ArcImplementationNotes
    points.push({
      x: cx + cos * rx + -sin * cos,
      y: cy + sin * ry + cos * sin,
    });
  }
  return points;
}
function arcToPoints ( s , startX , startY ) { const points = [ ] ; const largeArcFlag = ! ! s [ 4 ] ; const sweepFlag = ! ! s [ 5 ] ; const rotation = s [ 3 ] ; let endX = s [ 6 ] ; let endY = s [ 7 ] ; let rx = s [ 1 ] ; let ry = s [ 2 ] ; let cx ; let cy ; let sweepAngle ; let startAngle ; if ( s [ 0 ] === 'a' ) { endX += startX ; endY += startY ; } if ( startX === endY && startY === endY ) { return points ; } if ( ! rx || ! ry ) { points . push ( { x : endX , y : endY } ) ; return points ; } ( { cx , cy , rx , ry , sweepAngle , startAngle } = arcToCenter ( rx , ry , rotation , largeArcFlag , sweepFlag , endX , endY , startX , startY ) ) ; const p = Math . abs ( sweepAngle * Math . sqrt ( ( Math . pow ( rx , 2 ) + Math . pow ( ry , 2 ) ) / 2 ) ) ; const res = Math . ceil ( p / 10 ) ; const resAngle = sweepAngle / res ; for ( let k = 1 ; k <= res ; k ++ ) { const deltaAngle = resAngle * k ; const radians = ( startAngle + deltaAngle ) % PI_X2 ; const cos = Math . cos ( radians ) ; const sin = Math . sin ( radians ) ; points . push ( { x : cx + cos * rx + - sin * cos , y : cy + sin * ry + cos * sin , } ) ; } return points ; }
Transform an arc to a set of points a long the arc.
Transform an arc to a set of points a long the arc .
// F.6.3 // F.6.3 // F.6.2 // Given no radius, threat as lineTo command // Approximation of perimeter // Generate a point every 10th pixel. Scaling of the node should probably be included in this calculation // F.6.3 https://www.w3.org/TR/SVG/implnote.html#ArcImplementationNotes // points.push({ x: cx, y: cy });