src/iup_colorhsi.c
static double iColorHSI_ImaxS(double h, double cosH, double sinH)
{
  double i, h0, h1;
  double hr, hb, hg;

  if (h == 0.0 || h == rad120 || h == rad240)
    return 1.0 / 3.0;

  if (h == rad60 || h == rad180 || h == rad300)
    return 2.0 / 3.0;

  hr = (2.0 * cosH) / 3.0;
  hg = (-cosH + sinH*sqrt3) / 3.0;
  hb = (-cosH - sinH*sqrt3) / 3.0;

  iColorSmax01(h, hr, hb, hg, &h0, &h1);

  i = h0 / (h0 - h1);

  return fabs(i);
}
/* Given H, returns I where S is max,
The maximum S is where top meets bottom.
- i / h0 = (1 - i) / h1
*/
Given H, returns I where S is max,
The maximum S is where top meets bottom.
Given H returns I where S is max The maximum S is where top meets bottom .
static double iColorHSI_ImaxS(double h, double cosH, double sinH)
{
  double i, h0, h1;
  double hr, hb, hg;
  if (h == 0.0 || h == rad120 || h == rad240)
    return 1.0 / 3.0;
  if (h == rad60 || h == rad180 || h == rad300)
    return 2.0 / 3.0;
  hr = (2.0 * cosH) / 3.0;
  hg = (-cosH + sinH*sqrt3) / 3.0;
  hb = (-cosH - sinH*sqrt3) / 3.0;
  iColorSmax01(h, hr, hb, hg, &h0, &h1);
  i = h0 / (h0 - h1);
  return fabs(i);
}
static double iColorHSI_ImaxS ( double h , double cosH , double sinH ) { double i , h0 , h1 ; double hr , hb , hg ; if ( h == 0.0 || h == rad120 || h == rad240 ) return 1.0 / 3.0 ; if ( h == rad60 || h == rad180 || h == rad300 ) return 2.0 / 3.0 ; hr = ( 2.0 * cosH ) / 3.0 ; hg = ( - cosH + sinH * sqrt3 ) / 3.0 ; hb = ( - cosH - sinH * sqrt3 ) / 3.0 ; iColorSmax01 ( h , hr , hb , hg , & h0 , & h1 ) ; i = h0 / ( h0 - h1 ) ; return fabs ( i ) ; }
Given H, returns I where S is max,
The maximum S is where top meets bottom.
Given H returns I where S is max The maximum S is where top meets bottom .