function segmentToBezier()

in packages/core/src/utils/path.ts [472:502]


function segmentToBezier(
  th2: number,
  th3: number,
  cosTh: number,
  sinTh: number,
  rx: number,
  ry: number,
  cx1: number,
  cy1: number,
  mT: number,
  fromX: number,
  fromY: number
) {
  const costh2 = Math.cos(th2),
    sinth2 = Math.sin(th2),
    costh3 = Math.cos(th3),
    sinth3 = Math.sin(th3),
    toX = cosTh * rx * costh3 - sinTh * ry * sinth3 + cx1,
    toY = sinTh * rx * costh3 + cosTh * ry * sinth3 + cy1,
    cp1X = fromX + mT * (-cosTh * rx * sinth2 - sinTh * ry * costh2),
    cp1Y = fromY + mT * (-sinTh * rx * sinth2 + cosTh * ry * costh2),
    cp2X = toX + mT * (cosTh * rx * sinth3 + sinTh * ry * costh3),
    cp2Y = toY + mT * (sinTh * rx * sinth3 - cosTh * ry * costh3)

  return [
    'C',
    cp1X, cp1Y,
    cp2X, cp2Y,
    toX, toY
  ] as Directive
}