Mercurial > hg > octave-lyh
changeset 16465:e09e58e44c80
pink.m: Simplify calculation in colormap.
* pink.m: Replace switch statement with simple division.
author | Rik <rik@octave.org> |
---|---|
date | Sun, 07 Apr 2013 17:24:53 -0700 |
parents | 328048fd43b8 |
children | ac332eb727dd |
files | scripts/image/pink.m |
diffstat | 1 files changed, 1 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/image/pink.m +++ b/scripts/image/pink.m @@ -51,15 +51,7 @@ elseif (n > 2) x = [0:(n-1)]' / (n-1); idx = floor (3/8 * n); - base = floor (n/8); - switch (mod (n, 8)) - case {0, 1, 2} - base = 1 / (9*base); - case {3, 4, 5} - base = 1 / (9*base + 3); - case {6, 7} - base = 1 / (9*base + 6); - endswitch + base = 1 / (3 * idx); nel = idx; # number of elements r(1:idx,1) = linspace (base, 2/3*x(idx) + 1/3, nel);