Mercurial > octave-nkf
comparison scripts/image/rainbow.m @ 14279:f205d0074687
Update colormap files with faster code.
* autumn.m, bone.m, cool.m, copper.m, flag.m, gmap40.m, gray.m, hot.m, hsv.m,
jet.m, lines.m, ocean.m, pink.m, prism.m, rainbow.m, spring.m, summer.m,
white.m, winter.m: Use indexing in place of kron or repmat for faster code.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Sat, 28 Jan 2012 22:33:57 -0800 |
parents | 11949c9795a0 |
children | 932ba2bb9060 |
comparison
equal
deleted
inserted
replaced
14278:fa894f89b18f | 14279:f205d0074687 |
---|---|
45 | 45 |
46 if (n == 1) | 46 if (n == 1) |
47 map = [1, 0, 0]; | 47 map = [1, 0, 0]; |
48 elseif (n > 1) | 48 elseif (n > 1) |
49 x = linspace (0, 1, n)'; | 49 x = linspace (0, 1, n)'; |
50 r = (x < 2/5) + (x >= 2/5 & x < 3/5) .* (-5 * x + 3)\ | 50 r = (x < 2/5) ... |
51 + (x >= 2/5 & x < 3/5) .* (-5 * x + 3) ... | |
51 + (x >= 4/5) .* (10/3 * x - 8/3); | 52 + (x >= 4/5) .* (10/3 * x - 8/3); |
52 g = (x < 2/5) .* (5/2 * x) + (x >= 2/5 & x < 3/5)\ | 53 g = (x < 2/5) .* (5/2 * x) ... |
54 + (x >= 2/5 & x < 3/5) ... | |
53 + (x >= 3/5 & x < 4/5) .* (-5 * x + 4); | 55 + (x >= 3/5 & x < 4/5) .* (-5 * x + 4); |
54 b = (x >= 3/5 & x < 4/5) .* (5 * x - 3) + (x >= 4/5); | 56 b = (x >= 3/5 & x < 4/5) .* (5 * x - 3) |
57 + (x >= 4/5); | |
55 map = [r, g, b]; | 58 map = [r, g, b]; |
56 else | 59 else |
57 map = []; | 60 map = []; |
58 endif | 61 endif |
59 | 62 |