/**
  * Create viewing conditions assuming full adaption. This is primarily useful in color management
  * applications.
  *
  * @param XYZ_w XYZ of adopted whitepoint
  * @param L_A average luminance of visual surround
  * @param Y_b adaptation luminance of color background
  * @param sur the surrounding
  * @return a fully adapted viewing conditions instance
  */
 public static ViewingConditions createFullyAdapted(
     CIEXYZ XYZ_w, float L_A, float Y_b, Surrounding sur) {
   double[] xyz_w = MathTools.floatToDoubleArray(XYZ_w.toCIEXYZ100());
   double[] RGB_w = CS_CIECAM02.XYZtoCAT02(xyz_w);
   double[] RGB_c = calcAdaptedRGBc(XYZ_w, RGB_w, 1.0);
   return new ViewingConditions(xyz_w, L_A, Y_b, sur, RGB_w, RGB_c);
 }
 /**
  * Construct a new ViewingConditions instance. The degree of adaption (D) is derived from the
  * background and surround. This is the standard case treated in CIE 159:2004.
  *
  * @param XYZ_w XYZ of adopted whitepoint
  * @param L_A average luminance of visual surround
  * @param Y_b adaptation luminance of color background
  * @param sur the surrounding
  * @return a ViewingConditions instance
  */
 public static ViewingConditions createAdapted(
     CIEXYZ XYZ_w, double L_A, double Y_b, Surrounding sur) {
   double[] xyz_w = MathTools.floatToDoubleArray(XYZ_w.toCIEXYZ100());
   // calculate RGB whitepoint
   double[] RGB_w = CS_CIECAM02.XYZtoCAT02(xyz_w);
   double D = calcD(L_A, sur);
   double[] RGB_c = calcAdaptedRGBc(XYZ_w, RGB_w, D);
   return new ViewingConditions(xyz_w, L_A, Y_b, sur, RGB_w, RGB_c);
 }