function [r,g,b] = rgbfromhsv(hue,sat,bri)
%    [red,green,blue] = hsb2rgb(hue,sat,bright) 
%      enter 'hue' in degrees     
if hue < 60
% first, find r,g,b parts for fully saturated case 
%   evaluating the hue value
% red yellow sector: red=1, green raising
  g = hue;
  rp = 1;
  gp = g/60;
  bp = 0; 
elseif hue < 120
% yellow green sector: red decreasing, green=1
  g = hue-60;
  rp = 1-g/60;
  gp = 1;
  bp = 0; 
elseif hue < 180
% green cyan sector: green=1, blue raising
  g = hue-120;
  rp = 0;
  gp = 1;
  bp = g/60; 
elseif hue < 240
% cyan blue sector: green decreasing, blue=1
  g = hue-180;
  gp = 1-g/60;
  bp = 1;
  rp = 0; 
elseif hue < 300
% blue magenta sector: blue=1, red raising
  g = hue-240;
  gp = 0;
  bp = 1;
  rp = g/60; 
else
%  magenta red  sector: red=1, blue decreasing
  g = hue-300;
  bp = 1-g/60;
  rp = 1;
  gp = 0; 
end
% now, add an even socket (white part) to all
%    which is the complement of sat
clev = max([rp,gp,bp]);
r = rp*sat + (1-sat)*clev;
g = gp*sat + (1-sat)*clev;
b = bp*sat + (1-sat)*clev;
% scale down with brightness
r = r*bri;
g = g*bri;
b = b*bri;
