summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/asymptote/palette.asy
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/asymptote/palette.asy')
-rw-r--r--Master/texmf-dist/asymptote/palette.asy9
1 files changed, 5 insertions, 4 deletions
diff --git a/Master/texmf-dist/asymptote/palette.asy b/Master/texmf-dist/asymptote/palette.asy
index 2cb6e7c5475..e77fa946e6b 100644
--- a/Master/texmf-dist/asymptote/palette.asy
+++ b/Master/texmf-dist/asymptote/palette.asy
@@ -358,10 +358,10 @@ pen[] Wheel(int NColors=32766)
if(settings.gray) return Grayscale(NColors);
int nintervals=6;
+ if(NColors <= nintervals) NColors=nintervals+1;
int n=-quotient(NColors,-nintervals);
pen[] Palette;
- if(n == 0) return Palette;
Palette=new pen[n*nintervals];
real ninv=1.0/n;
@@ -386,10 +386,10 @@ pen[] Rainbow(int NColors=32766)
int offset=1;
int nintervals=5;
+ if(NColors <= nintervals) NColors=nintervals+1;
int n=-quotient(NColors-1,-nintervals);
pen[] Palette;
- if(n == 0) return Palette;
Palette=new pen[n*nintervals+offset];
real ninv=1.0/n;
@@ -418,12 +418,13 @@ private pen[] BWRainbow(int NColors, bool two)
if(two) nintervals += 6;
+ int Nintervals=nintervals*divisor;
+ if(NColors <= Nintervals) NColors=Nintervals+1;
int num=NColors-offset;
- int n=-quotient(num,-nintervals*divisor)*divisor;
+ int n=-quotient(num,-Nintervals)*divisor;
NColors=n*nintervals+offset;
pen[] Palette;
- if(n == 0) return Palette;
Palette=new pen[NColors];
real ninv=1.0/n;