summaryrefslogtreecommitdiff
path: root/Master/texmf/asymptote/graph.asy
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2009-09-29 14:00:37 +0000
committerKarl Berry <karl@freefriends.org>2009-09-29 14:00:37 +0000
commit93b70a6b5bf985b86b936248e34c810edfb1ebcb (patch)
treee3aef4bed05158dc1a5cdd4178fc531bdf4f04b3 /Master/texmf/asymptote/graph.asy
parentd80f6a20d7b907ac933f687a7a0f1fd100a219f8 (diff)
asy 1.87
git-svn-id: svn://tug.org/texlive/trunk@15555 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf/asymptote/graph.asy')
-rw-r--r--Master/texmf/asymptote/graph.asy73
1 files changed, 40 insertions, 33 deletions
diff --git a/Master/texmf/asymptote/graph.asy b/Master/texmf/asymptote/graph.asy
index 55974c63f7d..e9f01880d67 100644
--- a/Master/texmf/asymptote/graph.asy
+++ b/Master/texmf/asymptote/graph.asy
@@ -609,38 +609,40 @@ tickvalues generateticks(int sign, Label F="", ticklabel ticklabel=null,
if(divisor.length > 0) {
bool autoscale=locate.S.automin && locate.S.automax;
real h=0.5*(b-a);
- for(int d=divisor.length-1; d >= 0; --d) {
- int N0=divisor[d];
- Step=len/N0;
- int N1=N0;
- int m=2;
- while(Step > h) {
- N0=m*N1;
+ if(h > 0) {
+ for(int d=divisor.length-1; d >= 0; --d) {
+ int N0=divisor[d];
Step=len/N0;
- m *= 2;
- }
- if(axiscoverage(N0,T,g,locate,Step,side,sign,Size,F,ticklabel,norm,
- limit)) {
- N=N0;
- if(N0 == 1 && !autoscale && d < divisor.length-1) {
- // Try using 2 ticks (otherwise 1);
- int div=divisor[d+1];
- Step=quotient(div,2)*len/div;
- calcStep=false;
- if(axiscoverage(2,T,g,locate,Step,side,sign,Size,F,ticklabel,
- norm,limit)) N=2;
- else Step=len;
+ int N1=N0;
+ int m=2;
+ while(Step > h) {
+ N0=m*N1;
+ Step=len/N0;
+ m *= 2;
}
- // Found a good divisor; now compute subtick divisor
- if(n == 0) {
- if(step != 0) n=ceil(Step/step);
- else {
- n=quotient(divisor[divisor.length-1],N);
- if(N == 1) n=(a*b >= 0) ? 2 : 1;
- if(n == 1) n=2;
+ if(axiscoverage(N0,T,g,locate,Step,side,sign,Size,F,ticklabel,norm,
+ limit)) {
+ N=N0;
+ if(N0 == 1 && !autoscale && d < divisor.length-1) {
+ // Try using 2 ticks (otherwise 1);
+ int div=divisor[d+1];
+ Step=quotient(div,2)*len/div;
+ calcStep=false;
+ if(axiscoverage(2,T,g,locate,Step,side,sign,Size,F,ticklabel,
+ norm,limit)) N=2;
+ else Step=len;
+ }
+ // Found a good divisor; now compute subtick divisor
+ if(n == 0) {
+ if(step != 0) n=ceil(Step/step);
+ else {
+ n=quotient(divisor[divisor.length-1],N);
+ if(N == 1) n=(a*b >= 0) ? 2 : 1;
+ if(n == 1) n=2;
+ }
}
+ break;
}
- break;
}
}
}
@@ -826,12 +828,17 @@ tickvalues None(tickvalues v) {return v;}
tickmodifier OmitTick(... real[] x) {
return new tickvalues(tickvalues v) {
- if(v.major.length == 0) return v;
- real norm=max(abs(v.major));
- for(int i=0; i < x.length; ++i) {
- int j=find(abs(v.major-x[i]) < zerotickfuzz*norm);
- if(j >= 0) v.major.delete(j);
+ void omit(real[] a) {
+ if(a.length != 0) {
+ real norm=max(abs(a));
+ for(int i=0; i < x.length; ++i) {
+ int j=find(abs(a-x[i]) < zerotickfuzz*norm);
+ if(j >= 0) a.delete(j);
+ }
+ }
}
+ omit(v.major);
+ omit(v.minor);
return v;
};
}