@Override
  public void fromRgb(final Rgb srcColor, final ColorSpace3D dstColor) {

    double arithmeticR = srcColor.getFirstChannel() / MAX_RGB;
    double arithmeticG = srcColor.getSecondChannel() / MAX_RGB;
    double arithmeticB = srcColor.getThirdChannel() / MAX_RGB;

    double max = Math.max(arithmeticR, Math.max(arithmeticG, arithmeticB));
    double min = Math.min(arithmeticR, Math.min(arithmeticG, arithmeticB));
    double delta = max - min;

    double h = 0;
    if (delta >= EPS) {
      if (max == arithmeticR) {
        h = DEGREES * ((arithmeticG - arithmeticB) / delta % R_DIVIDER);
      } else if (max == arithmeticG) {
        h = DEGREES * ((arithmeticB - arithmeticR) / delta + G_OFFSET);
      } else if (max == arithmeticB) {
        h = DEGREES * ((arithmeticR - arithmeticG) / delta + B_OFFSET);
      }
    }

    double s = max <= 0 ? 0 : 1 - min / max;
    double v = max;

    dstColor.setChannels(h, s, v);
  }