function findCircle(curve) {
  const midPoint = getCubicBezierPoint(curve, 1 / 2);
  const m1 = [midPoint[0] / 2, midPoint[1] / 2];
  const m2 = [(midPoint[0] + curve[4]) / 2, (midPoint[1] + curve[5]) / 2];
  const center = getIntersection([
    m1[0],
    m1[1],
    m1[0] + m1[1],
    m1[1] - m1[0],
    m2[0],
    m2[1],
    m2[0] + (m2[1] - midPoint[1]),
    m2[1] - (m2[0] - midPoint[0]),
  ]);
  const radius = center && getDistance([0, 0], center);
  const tolerance = Math.min(
    arcThreshold * error,
    // @ts-expect-error
    (arcTolerance * radius) / 100,
  );

  if (
    center &&
    // @ts-expect-error
    radius < 1e15 &&
    [1 / 4, 3 / 4].every(function (point) {
      return (
        Math.abs(
          // @ts-expect-error
          getDistance(getCubicBezierPoint(curve, point), center) - radius,
        ) <= tolerance
      );
    })
  ) {
    // @ts-expect-error
    return { center: center, radius: radius };
  }
}
Finds circle by 3 points of the curve and checks if the curve fits the found circle.

@param {ReadonlyArray<number>} curve
@returns {Circle | undefined}