function [newclr, newhue] = HueRot(oldhue, delta)
  % -----------------------------------------------------------------------
  % HueRot - Rotate the given hue angle by the given increment and return
  %          the color with that hue.  The hue angle goes from Red = 0 to
  %          Green = 2pi/3 to Blue = 4pi/3 and back to Red = 2pi.
  %
  % Args: oldhue - the hue angle to operate on
  %       delta - the angle increment
  %
  % Rtns: newhue - the incremented hue angle
  %       newclr - the 100% saturated color with with hue = newhue
  % -----------------------------------------------------------------------

  newhue = oldhue + delta;
  a = mod(newhue, 2*pi) * 6/2/pi; b = fix(a); a = a - b;
  switch b
    case 0, newclr = [ 1   a   0 ];
    case 1, newclr = [1-a  1   0 ];
    case 2, newclr = [ 0   1   a ];
    case 3, newclr = [ 0  1-a  1 ];
    case 4, newclr = [ a   0   1 ];
    case 5, newclr = [ 1   0  1-a];
  end
end
