function [rgb] = z2rgb_kawski(z) % function [rgb] = z2rgb_kawski(z) % % converts complex numbers into values in unit RGB cube % % Alex Barnett 11/11/05, influenced by Matthias Kawski m = abs(z) + 1e-15; s = 1 - (m/2 + 1).^-1; x = real(z)./m; % x,y is point on unit circle y = imag(z)./m; w = 3*s.*(1-s); % radius of cone as func of saturation, adjust prefactor rgb(:,:,1) = s + w.*(-y/sqrt(6) + x/sqrt(2)); rgb(:,:,2) = s + w.*(-y/sqrt(6) - x/sqrt(2)); rgb(:,:,3) = s + w.*y*sqrt(2/3);