ivcurves.compare_curves._find_distance#

ivcurves.compare_curves._find_distance(x, y, xp, yp)#

Calculates the distance between two points \((x, y)\) and \((x_p, y_p)\) using a scaled Euclidean distance.

The scaled Euclidean distance is defined as

\[\sqrt{\left(\frac{x_p - x}{x}\right)^2 + \left(\frac{y_p - y}{y}\right)^2}\]

If \(x\) is zero, it is

\[\sqrt{\left(\frac{y_p - y}{y}\right)^2}\]

If \(y\) is zero, it is

\[\sqrt{\left(\frac{x_p - x}{x}\right)^2}\]

It is assumed that \((x, y) \neq 0\).

Parameters:
  • x (float) – x-coordinate of point on known curve.

  • y (float) – y-coordinate of point on known curve.

  • xp (float) – x-coordinate of point on fitted curve.

  • yp (float) – y-coordinate of point on fitted curve.

Returns:

The calculated distance.

Return type:

mpmath float