code: def calculate_dc_coefficients(contour):
      
      dxy = np.diff(contour, axis=0)
      dt = np.sqrt((dxy ** 2).sum(axis=1))
      t = np.concatenate([([0., ]), np.cumsum(dt)])
      T = t[-1]
  
      xi = np.cumsum(dxy[:, 0]) - (dxy[:, 0] / dt) * t[1:]
      A0 = (1 / T) * np.sum(((dxy[:, 0] / (2 * dt)) * np.diff(t ** 2)) + xi * dt)
      delta = np.cumsum(dxy[:, 1]) - (dxy[:, 1] / dt) * t[1:]
      C0 = (1 / T) * np.sum(((dxy[:, 1] / (2 * dt)) * np.diff(t ** 2)) + delta * dt)
  
      # A0 and CO relate to the first point of the contour array as origin.
      # Adding those values to the coefficients to make them relate to true origin.
      return contour[0, 0] + A0, contour[0, 1] + C0
docs: Calculate the :math:`A_0` and :math:`C_0` coefficients of the elliptic Fourier series.
  
      :param numpy.ndarray contour: A contour array of size ``[M x 2]``.
      :return: The :math:`A_0` and :math:`C_0` coefficients.
      :rtype: tuple