Filtering/vtkColorTransferFunction.cxx
inline double vtkColorTransferFunctionAdjustHue(const double msh[3],
                                                double unsatM)
{
  if (msh[0] >= unsatM - 0.1)
    {
    // The best we can do is hold hue constant.
    return msh[2];
    }
  else
    {
    // This equation is designed to make the perceptual change of the
    // interpolation to be close to constant.
    double hueSpin = (  msh[1]*sqrt(unsatM*unsatM - msh[0]*msh[0])
                      / (msh[0]*sin(msh[1])) );
    // Spin hue away from 0 except in purple hues.
    if (msh[2] > -0.3*vtkMath::DoublePi())
      {
      return msh[2] + hueSpin;
      }
    else
      {
      return msh[2] - hueSpin;
      }
    }
}
// For the case when interpolating from a saturated color to an unsaturated
// color, find a hue for the unsaturated color that makes sense.
For the case when interpolating from a saturated color to an unsaturated
color, find a hue for the unsaturated color that makes sense.
For the case when interpolating from a saturated color to an unsaturated color find a hue for the unsaturated color that makes sense .
inline double vtkColorTransferFunctionAdjustHue(const double msh[3],
                                                double unsatM)
{
  if (msh[0] >= unsatM - 0.1)
    {
    return msh[2];
    }
  else
    {
    double hueSpin = (  msh[1]*sqrt(unsatM*unsatM - msh[0]*msh[0])
                      / (msh[0]*sin(msh[1])) );
    if (msh[2] > -0.3*vtkMath::DoublePi())
      {
      return msh[2] + hueSpin;
      }
    else
      {
      return msh[2] - hueSpin;
      }
    }
}
inline double vtkColorTransferFunctionAdjustHue ( const double msh [ 3 ] , double unsatM ) { if ( msh [ 0 ] >= unsatM - 0.1 ) { return msh [ 2 ] ; } else { double hueSpin = ( msh [ 1 ] * sqrt ( unsatM * unsatM - msh [ 0 ] * msh [ 0 ] ) / ( msh [ 0 ] * sin ( msh [ 1 ] ) ) ) ; if ( msh [ 2 ] > -0.3 * vtkMath :: DoublePi ( ) ) { return msh [ 2 ] + hueSpin ; } else { return msh [ 2 ] - hueSpin ; } } }
For the case when interpolating from a saturated color to an unsaturated
color, find a hue for the unsaturated color that makes sense.
For the case when interpolating from a saturated color to an unsaturated color find a hue for the unsaturated color that makes sense .
// The best we can do is hold hue constant. // This equation is designed to make the perceptual change of the // interpolation to be close to constant. // Spin hue away from 0 except in purple hues.