distance method

double distance(
  1. Cam16 other
)

CAM16 instances also have coordinates in the CAM16-UCS space, called J*, a*, b*, or jstar, astar, bstar in code. CAM16-UCS is included in the CAM16 specification, and should be used when measuring distances between colors.

Implementation

double distance(Cam16 other) {
  final double dJ = jstar - other.jstar;
  final double dA = astar - other.astar;
  final double dB = bstar - other.bstar;
  final double dEPrime = math.sqrt(dJ * dJ + dA * dA + dB * dB);
  final double dE = 1.41 * math.pow(dEPrime, 0.63);
  return dE;
}