function C = colorcircle(N)
%COLORCIRCLE distribute colors uniformly over the color circle
%   C = COLORCIRCLE(N) returns a colormap C consisting of N colors
%   distributed uniformly over the color circle
%
% Example:
% [x,y,z] = sphere(20);
% C = colorcircle(20);
% surf(x,y,z,atan2(y,x)); colormap(C);
%
% See also: colormap

% Copyright (c) 2012-2014 Peter Fiala

v1 = [0 2 -2]/sqrt(3)/3;
v2 = [4 -2 -2]/9;
b = [1 1 1]/2;

phi = (0:N-1)'/N*2*pi;
C = sin(phi)*v1 + cos(phi)*v2 + repmat(b, N, 1);
end
