Skip to main content

hausdorff-distance

function hausdorffDistance(A: number[][], B: number[][], tolerance?: undefined | number, maxIterations?: undefined | number): number

Defined in simultaneous-properties/hausdorff-distance/hausdorff-distance.ts:28

Calculates and returns the (two-sided) Hausdorff distance between the bezier curves A and B as [min,max] where min is the minimum guaranteed and max is the maximum guaranteed Hausdorff distance. The min value will be a much more accurate result in general.

Note!
Green circles are draggable!
0

Parameters:

NameTypeDescription
Anumber[][]a bezier curve given by an ordered array of its control points e.g. [[0,0],[1,1],[2,1],[2,0]]
Bnumber[][]a bezier curve given by an ordered array of its control points e.g. [[0,0],[1,1],[2,1],[2,0]]
tolerance?undefined | numberoptional; defaults to Math.max(maxAbsCoordinate(A),maxAbsCoordinate(B))/1000_000; if the calculated absolute error bound is less than this, the result is returned; this is not a hard tolerance and the returned bound can be less accurate in hard cases (due to the maxIterations parameter). Luckily however, specifically the lower bound returned will be very accurate due to its fast convergence in such hard cases (see the paper)
maxIterations?undefined | numberoptional; defaults to 50; if the desired guaranteed error bound has not been achieved after maxIterations then the result will be returned