distance method

  1. @override
double distance(
  1. List<double> one,
  2. List<double> two
)
override

Implementation

@override
double distance(List<double> one, List<double> two) {
  final dL = (one[0] - two[0]);
  final dA = (one[1] - two[1]);
  final dB = (one[2] - two[2]);
  // Standard CIE 1976 delta E formula also takes the square root, unneeded
  // here. This method is used by quantization algorithms to compare distance,
  // and the relative ordering is the same, with or without a square root.

  // This relatively minor optimization is helpful because this method is
  // called at least once for each pixel in an image.
  return (dL * dL + dA * dA + dB * dB);
}