summaryrefslogtreecommitdiff
path: root/graphics/asymptote/base
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-11-24 03:01:06 +0000
committerNorbert Preining <norbert@preining.info>2020-11-24 03:01:06 +0000
commit55c6d66f61a96ba63cd8c141229843ad2ab42632 (patch)
tree64fa3f4bc82828c2475a6a25d23a02cb36502b95 /graphics/asymptote/base
parentf0be59ccfa7046c57199fe35c49e1e8963fcb1a9 (diff)
CTAN sync 202011240301
Diffstat (limited to 'graphics/asymptote/base')
-rw-r--r--graphics/asymptote/base/asy-mode.el2
-rw-r--r--graphics/asymptote/base/geometry.asy4
-rw-r--r--graphics/asymptote/base/graph3.asy143
-rw-r--r--graphics/asymptote/base/plain.asy34
-rw-r--r--graphics/asymptote/base/plain_margins.asy10
-rw-r--r--graphics/asymptote/base/rationalSimplex.asy30
-rw-r--r--graphics/asymptote/base/slide.asy2
-rw-r--r--graphics/asymptote/base/three.asy8
-rw-r--r--graphics/asymptote/base/three_tube.asy4
-rw-r--r--graphics/asymptote/base/tube.asy4
10 files changed, 156 insertions, 85 deletions
diff --git a/graphics/asymptote/base/asy-mode.el b/graphics/asymptote/base/asy-mode.el
index c1960e2303..ec3a3746d7 100644
--- a/graphics/asymptote/base/asy-mode.el
+++ b/graphics/asymptote/base/asy-mode.el
@@ -102,7 +102,7 @@ This package has been tested in:
This package seems to work with XEmacs 21.4 but not all the features are available (in particular syntax highlighting).
-Report bugs to http://asymptote.sourceforge.net
+Report bugs to https://github.com/vectorgraphics/asymptote/issues
Some variables can be customized: M-x customize-group <RET> asymptote <RET>."
diff --git a/graphics/asymptote/base/geometry.asy b/graphics/asymptote/base/geometry.asy
index 2f9d12538b..420d5bdc45 100644
--- a/graphics/asymptote/base/geometry.asy
+++ b/graphics/asymptote/base/geometry.asy
@@ -2636,7 +2636,7 @@ struct hyperbola
this.b = a * sqrt(this.e^2 - 1);
this.p = a * (this.e^2 - 1);
point A = this.C + (a^2/this.c) * unit(P[0]-this.C);
- this.D1 = line(A, A + rotateO(90) * unit(A - this.C));
+ this.D1 = line(A, A + rotate(90,this.C.coordsys.O) * unit(A - this.C));
this.D2 = reverse(rotate(180, C) * D1);
this.V1 = C + a * unit(F1 - C);
this.V2 = C + a * unit(F2 - C);
@@ -6575,7 +6575,7 @@ point[] intersectionpoints(line l, hyperbola h)
point[] op;
coordsys R = coordsys(h);
point A = intersectionpoint(l, h.A1), B = intersectionpoint(l, h.A2);
- point M = midpoint(segment(A, B));
+ point M = 0.5*(A + B);
bool tgt = Finite(M) ? M @ h : false;
if(tgt) {
if(M @ l) op.push(M);
diff --git a/graphics/asymptote/base/graph3.asy b/graphics/asymptote/base/graph3.asy
index 80ca1ec3a5..f690c6a3c1 100644
--- a/graphics/asymptote/base/graph3.asy
+++ b/graphics/asymptote/base/graph3.asy
@@ -650,7 +650,7 @@ void xaxis3At(picture pic=currentpicture, Label L="", axis axis,
pic.scale.x.bound.push(bounds);
}
-// An internal routine to draw an x axis at a particular y value.
+// An internal routine to draw a y axis at a particular value.
void yaxis3At(picture pic=currentpicture, Label L="", axis axis,
real ymin=-infinity, real ymax=infinity, pen p=currentpen,
ticks3 ticks=NoTicks3,
@@ -783,7 +783,7 @@ void yaxis3At(picture pic=currentpicture, Label L="", axis axis,
pic.scale.y.bound.push(bounds);
}
-// An internal routine to draw an x axis at a particular y value.
+// An internal routine to draw a z axis at a particular value.
void zaxis3At(picture pic=currentpicture, Label L="", axis axis,
real zmin=-infinity, real zmax=infinity, pen p=currentpen,
ticks3 ticks=NoTicks3,
@@ -1212,11 +1212,50 @@ triple Scale(picture pic=currentpicture, triple v)
return (pic.scale.x.T(v.x),pic.scale.y.T(v.y),pic.scale.z.T(v.z));
}
+triple[][] Scale(picture pic=currentpicture, triple[][] P)
+{
+ triple[][] Q=new triple[P.length][];
+ for(int i=0; i < P.length; ++i) {
+ triple[] Pi=P[i];
+ Q[i]=new triple[Pi.length];
+ for(int j=0; j < Pi.length; ++j)
+ Q[i][j]=Scale(pic,Pi[j]);
+ }
+ return Q;
+}
+
+real ScaleX(picture pic=currentpicture, real x)
+{
+ return pic.scale.x.T(x);
+}
+
+real ScaleY(picture pic=currentpicture, real y)
+{
+ return pic.scale.y.T(y);
+}
+
real ScaleZ(picture pic=currentpicture, real z)
{
return pic.scale.z.T(z);
}
+real[][] ScaleZ(picture pic=currentpicture, real[][] P)
+{
+ real[][] Q=new real[P.length][];
+ for(int i=0; i < P.length; ++i) {
+ real[] Pi=P[i];
+ Q[i]=new real[Pi.length];
+ for(int j=0; j < Pi.length; ++j)
+ Q[i][j]=ScaleZ(pic,Pi[j]);
+ }
+ return Q;
+}
+
+real[] uniform(real T(real x), real Tinv(real x), real a, real b, int n)
+{
+ return map(Tinv,uniform(T(a),T(b),n));
+}
+
// Draw a tick of length size at triple v in direction dir using pen p.
void tick(picture pic=currentpicture, triple v, triple dir, real size=Ticksize,
pen p=currentpen)
@@ -1596,7 +1635,7 @@ bool vperiodic(triple[][] a) {
}
// return the surface described by a matrix f
-surface surface(triple[][] f, bool[][] cond={})
+surface surface(picture pic=currentpicture, triple[][] f, bool[][] cond={})
{
if(!rectangular(f)) abort("matrix is not rectangular");
@@ -1632,7 +1671,11 @@ surface surface(triple[][] f, bool[][] cond={})
int[] indexi=s.index[i];
for(int j=0; j < ny; ++j) {
if(all || (condi[j] && condi[j+1] && condp[j] && condp[j+1]))
- s.s[++k]=patch(new triple[] {fi[j],fp[j],fp[j+1],fi[j+1]});
+ s.s[++k]=patch(new triple[] {
+ Scale(pic,fi[j]),
+ Scale(pic,fp[j]),
+ Scale(pic,fp[j+1]),
+ Scale(pic,fi[j+1])});
indexi[j]=k;
}
}
@@ -1715,7 +1758,8 @@ surface bispline(real[][] z, real[][] p, real[][] q, real[][] r,
(x1,y2,zippip-qip-hxy*ri[jp]),(x1,yp,zippip)},
{(x2,yj,zpj-ppj),(x2,y1,zpjqpj-ppj-hxy*rp[j]),
(x2,y2,zppmppp-qpp+hxy*rp[jp]),(x2,yp,zppmppp)},
- {(xp,yj,zpj),(xp,y1,zpjqpj),(xp,y2,zpp-qpp),(xp,yp,zpp)}},copy=false);
+ {(xp,yj,zpj),(xp,y1,zpjqpj),(xp,y2,zpp-qpp),(xp,yp,zpp)}},
+ copy=false);
indexi[j]=k;
++k;
}
@@ -1787,11 +1831,11 @@ private real[][][] bispline0(real[][] z, real[][] p, real[][] q, real[][] r,
real zpjqpj=zpj+hy*qp[j];
s[k]=new real[][] {{zij,zijqij,zip-qip,zip},
- {zij+pij,zijqij+pij+hxy*ri[j],
- zippip-qip-hxy*ri[jp],zippip},
- {zpj-ppj,zpjqpj-ppj-hxy*rp[j],
- zppmppp-qpp+hxy*rp[jp],zppmppp},
- {zpj,zpjqpj,zpp-qpp,zpp}};
+ {zij+pij,zijqij+pij+hxy*ri[j],
+ zippip-qip-hxy*ri[jp],zippip},
+ {zpj-ppj,zpjqpj-ppj-hxy*rp[j],
+ zppmppp-qpp+hxy*rp[jp],zppmppp},
+ {zpj,zpjqpj,zpp-qpp,zpp}};
++k;
}
}
@@ -1831,10 +1875,15 @@ real[][][] bispline(real[][] f, real[] x, real[] y,
// return the surface described by a real matrix f, interpolated with
// xsplinetype and ysplinetype.
-surface surface(real[][] f, real[] x, real[] y,
- splinetype xsplinetype=null, splinetype ysplinetype=xsplinetype,
+surface surface(picture pic=currentpicture, real[][] f, real[] x, real[] y,
+ splinetype xsplinetype=null,
+ splinetype ysplinetype=xsplinetype,
bool[][] cond={})
{
+ real[][] f=ScaleZ(pic,f);
+ real[] x=map(pic.scale.x.T,x);
+ real[] y=map(pic.scale.y.T,y);
+
real epsilon=sqrtEpsilon*norm(y);
if(xsplinetype == null)
xsplinetype=(abs(x[0]-x[x.length-1]) <= epsilon) ? periodic : notaknot;
@@ -1863,8 +1912,9 @@ surface surface(real[][] f, real[] x, real[] y,
// return the surface described by a real matrix f, interpolated with
// xsplinetype and ysplinetype.
-surface surface(real[][] f, pair a, pair b, splinetype xsplinetype,
- splinetype ysplinetype=xsplinetype, bool[][] cond={})
+surface surface(picture pic=currentpicture, real[][] f, pair a, pair b,
+ splinetype xsplinetype, splinetype ysplinetype=xsplinetype,
+ bool[][] cond={})
{
if(!rectangular(f)) abort("matrix is not rectangular");
@@ -1873,13 +1923,14 @@ surface surface(real[][] f, pair a, pair b, splinetype xsplinetype,
if(nx == 0 || ny == 0) return nullsurface;
- real[] x=uniform(a.x,b.x,nx);
- real[] y=uniform(a.y,b.y,ny);
- return surface(f,x,y,xsplinetype,ysplinetype,cond);
+ real[] x=uniform(pic.scale.x.T,pic.scale.x.Tinv,a.x,b.x,nx);
+ real[] y=uniform(pic.scale.y.T,pic.scale.y.Tinv,a.y,b.y,ny);
+ return surface(pic,f,x,y,xsplinetype,ysplinetype,cond);
}
// return the surface described by a real matrix f, interpolated linearly.
-surface surface(real[][] f, pair a, pair b, bool[][] cond={})
+surface surface(picture pic=currentpicture, real[][] f, pair a, pair b,
+ bool[][] cond={})
{
if(!rectangular(f)) abort("matrix is not rectangular");
@@ -1891,22 +1942,25 @@ surface surface(real[][] f, pair a, pair b, bool[][] cond={})
bool all=cond.length == 0;
triple[][] v=new triple[nx+1][ny+1];
+
+ pair a=Scale(pic,a);
+ pair b=Scale(pic,b);
for(int i=0; i <= nx; ++i) {
- real x=interp(a.x,b.x,i/nx);
+ real x=pic.scale.x.Tinv(interp(a.x,b.x,i/nx));
bool[] condi=all ? null : cond[i];
triple[] vi=v[i];
real[] fi=f[i];
for(int j=0; j <= ny; ++j)
if(all || condi[j])
- vi[j]=(x,interp(a.y,b.y,j/ny),fi[j]);
+ vi[j]=(x,pic.scale.y.Tinv(interp(a.y,b.y,j/ny)),fi[j]);
}
- return surface(v,cond);
+ return surface(pic,v,cond);
}
// return the surface described by a parametric function f over box(a,b),
// interpolated linearly.
-surface surface(triple f(pair z), pair a, pair b, int nu=nmesh, int nv=nu,
- bool cond(pair z)=null)
+surface surface(picture pic=currentpicture, triple f(pair z), pair a, pair b,
+ int nu=nmesh, int nv=nu, bool cond(pair z)=null)
{
if(nu <= 0 || nv <= 0) return nullsurface;
@@ -1921,23 +1975,25 @@ surface surface(triple f(pair z), pair a, pair b, int nu=nmesh, int nv=nu,
triple[][] v=new triple[nu+1][nv+1];
+ pair a=Scale(pic,a);
+ pair b=Scale(pic,b);
for(int i=0; i <= nu; ++i) {
- real x=interp(a.x,b.x,i*du);
+ real x=pic.scale.x.Tinv(interp(a.x,b.x,i*du));
bool[] activei=all ? null : active[i];
triple[] vi=v[i];
for(int j=0; j <= nv; ++j) {
- pair z=(x,interp(a.y,b.y,j*dv));
+ pair z=(x,pic.scale.y.Tinv(interp(a.y,b.y,j*dv)));
if(all || (activei[j]=cond(z))) vi[j]=f(z);
}
}
- return surface(v,active);
+ return surface(pic,v,active);
}
// return the surface described by a parametric function f evaluated at u and v
// and interpolated with usplinetype and vsplinetype.
-surface surface(triple f(pair z), real[] u, real[] v,
- splinetype[] usplinetype, splinetype[] vsplinetype=Spline,
- bool cond(pair z)=null)
+surface surface(picture pic=currentpicture, triple f(pair z),
+ real[] u, real[] v, splinetype[] usplinetype,
+ splinetype[] vsplinetype=Spline, bool cond(pair z)=null)
{
int nu=u.length-1;
int nv=v.length-1;
@@ -1960,7 +2016,7 @@ surface surface(triple f(pair z), real[] u, real[] v,
for(int j=0; j <= nv; ++j) {
pair z=(ui,v[j]);
if(!all) activei[j]=cond(z);
- triple f=f(z);
+ triple f=Scale(pic,f(z));
fxi[j]=f.x;
fyi[j]=f.y;
fzi[j]=f.z;
@@ -2020,27 +2076,30 @@ surface surface(triple f(pair z), real[] u, real[] v,
// return the surface described by a parametric function f over box(a,b),
// interpolated with usplinetype and vsplinetype.
-surface surface(triple f(pair z), pair a, pair b, int nu=nmesh, int nv=nu,
+surface surface(picture pic=currentpicture, triple f(pair z), pair a, pair b,
+ int nu=nmesh, int nv=nu,
splinetype[] usplinetype, splinetype[] vsplinetype=Spline,
bool cond(pair z)=null)
{
- return surface(f,uniform(a.x,b.x,nu),uniform(a.y,b.y,nv),
- usplinetype,vsplinetype,cond);
+ real[] x=uniform(pic.scale.x.T,pic.scale.x.Tinv,a.x,b.x,nu);
+ real[] y=uniform(pic.scale.y.T,pic.scale.y.Tinv,a.y,b.y,nv);
+ return surface(pic,f,x,y,usplinetype,vsplinetype,cond);
}
// return the surface described by a real function f over box(a,b),
// interpolated linearly.
-surface surface(real f(pair z), pair a, pair b, int nx=nmesh, int ny=nx,
- bool cond(pair z)=null)
+surface surface(picture pic=currentpicture, real f(pair z), pair a, pair b,
+ int nx=nmesh, int ny=nx, bool cond(pair z)=null)
{
- return surface(new triple(pair z) {return (z.x,z.y,f(z));},a,b,nx,ny,cond);
+ return surface(pic,new triple(pair z) {return (z.x,z.y,f(z));},a,b,nx,ny,
+ cond);
}
// return the surface described by a real function f over box(a,b),
// interpolated with xsplinetype and ysplinetype.
-surface surface(real f(pair z), pair a, pair b, int nx=nmesh, int ny=nx,
- splinetype xsplinetype, splinetype ysplinetype=xsplinetype,
- bool cond(pair z)=null)
+surface surface(picture pic=currentpicture, real f(pair z), pair a, pair b,
+ int nx=nmesh, int ny=nx, splinetype xsplinetype,
+ splinetype ysplinetype=xsplinetype, bool cond(pair z)=null)
{
bool[][] active;
bool all=cond == null;
@@ -2052,8 +2111,8 @@ surface surface(real f(pair z), pair a, pair b, int nx=nmesh, int ny=nx,
pair dz=(dx,dy);
real[][] F=new real[nx+1][ny+1];
- real[] x=uniform(a.x,b.x,nx);
- real[] y=uniform(a.y,b.y,ny);
+ real[] x=uniform(pic.scale.x.T,pic.scale.x.Tinv,a.x,b.x,nx);
+ real[] y=uniform(pic.scale.y.T,pic.scale.y.Tinv,a.y,b.y,ny);
for(int i=0; i <= nx; ++i) {
bool[] activei=all ? null : active[i];
real[] Fi=F[i];
@@ -2064,7 +2123,7 @@ surface surface(real f(pair z), pair a, pair b, int nx=nmesh, int ny=nx,
if(!all) activei[j]=cond(z);
}
}
- return surface(F,x,y,xsplinetype,ysplinetype,active);
+ return surface(pic,F,x,y,xsplinetype,ysplinetype,active);
}
guide3[][] lift(real f(real x, real y), guide[][] g,
diff --git a/graphics/asymptote/base/plain.asy b/graphics/asymptote/base/plain.asy
index 57bdb411a9..365aad02c7 100644
--- a/graphics/asymptote/base/plain.asy
+++ b/graphics/asymptote/base/plain.asy
@@ -39,6 +39,8 @@ include plain_markers;
include plain_arrows;
include plain_debugger;
+real RELEASE=(real) split(VERSION,"-")[0];
+
typedef void exitfcn();
void updatefunction()
@@ -145,7 +147,7 @@ void initdefaults()
atexit(null);
}
-// Return the sequence n,...m
+// Return the sequence n,...,m
int[] sequence(int n, int m)
{
return sequence(new int(int x){return x;},m-n+1)+n;
@@ -244,6 +246,7 @@ void beep()
struct processtime {
real user;
real system;
+ real clock;
}
struct cputime {
@@ -257,16 +260,21 @@ cputime cputime()
static processtime last;
real [] a=_cputime();
cputime cputime;
+ real clock=a[4];
cputime.parent.user=a[0];
cputime.parent.system=a[1];
+ cputime.parent.clock=clock;
cputime.child.user=a[2];
cputime.child.system=a[3];
- real user=a[0]+a[2];
- real system=a[1]+a[3];
+ cputime.child.clock=0;
+ real user=cputime.parent.user+cputime.child.user;
+ real system=cputime.parent.system+cputime.child.system;
cputime.change.user=user-last.user;
cputime.change.system=system-last.system;
+ cputime.change.clock=clock-last.clock;
last.user=user;
last.system=system;
+ last.clock=clock;
return cputime;
}
@@ -298,23 +306,3 @@ if(settings.autoimport != "") {
}
cputime();
-
-void nosetpagesize()
-{
- static bool initialized=false;
- if(!initialized && latex()) {
- // Portably pass nosetpagesize option to graphicx package.
- texpreamble("\usepackage{ifluatex}\ifluatex
-\ifx\pdfpagewidth\undefined\let\pdfpagewidth\paperwidth\fi
-\ifx\pdfpageheight\undefined\let\pdfpageheight\paperheight\fi\else
-\let\paperwidthsave\paperwidth\let\paperwidth\undefined
-\usepackage{graphicx}
-\let\paperwidth\paperwidthsave\fi");
- initialized=true;
- }
-}
-
-nosetpagesize();
-
-if(settings.tex == "luatex")
- texpreamble("\input luatex85.sty");
diff --git a/graphics/asymptote/base/plain_margins.asy b/graphics/asymptote/base/plain_margins.asy
index c452275448..fbd0163050 100644
--- a/graphics/asymptote/base/plain_margins.asy
+++ b/graphics/asymptote/base/plain_margins.asy
@@ -5,7 +5,7 @@ struct marginT {
typedef marginT margin(path, pen);
-path trim(path g, real begin, real end) {
+path trim(path g, real begin, real end=begin) {
real a=arctime(g,begin);
real b=arctime(g,arclength(g)-end);
return a <= b ? subpath(g,a,b) : point(g,a);
@@ -36,7 +36,7 @@ margin NoMargin()
};
}
-margin Margin(real begin, real end)
+margin Margin(real begin, real end=begin)
{
return new marginT(path g, pen p) {
marginT margin;
@@ -48,7 +48,7 @@ margin Margin(real begin, real end)
};
}
-margin PenMargin(real begin, real end)
+margin PenMargin(real begin, real end=begin)
{
return new marginT(path g, pen p) {
marginT margin;
@@ -60,7 +60,7 @@ margin PenMargin(real begin, real end)
};
}
-margin DotMargin(real begin, real end)
+margin DotMargin(real begin, real end=begin)
{
return new marginT(path g, pen p) {
marginT margin;
@@ -73,7 +73,7 @@ margin DotMargin(real begin, real end)
};
}
-margin TrueMargin(real begin, real end)
+margin TrueMargin(real begin, real end=begin)
{
return new marginT(path g, pen p) {
marginT margin;
diff --git a/graphics/asymptote/base/rationalSimplex.asy b/graphics/asymptote/base/rationalSimplex.asy
index 823d91c2d0..6070c7cbdb 100644
--- a/graphics/asymptote/base/rationalSimplex.asy
+++ b/graphics/asymptote/base/rationalSimplex.asy
@@ -1,8 +1,8 @@
// Rational simplex solver written by John C. Bowman and Pouria Ramazi, 2018.
import rational;
-void simplexStandard(rational[] c, rational[][] A, int[] s=new int[],
- rational[] b) {}
+void simplexInit(rational[] c, rational[][] A, int[] s=new int[],
+ rational[] b, int count) {}
void simplexTableau(rational[][] E, int[] Bindices, int I=-1, int J=-1) {}
void simplexPhase1(rational[] c, rational[][] A, rational[] b,
int[] Bindices) {}
@@ -35,7 +35,9 @@ struct simplex {
int case;
rational[] x;
+ rational[] xStandard;
rational cost;
+ rational[] d;
int m,n;
int J;
@@ -319,15 +321,26 @@ struct simplex {
case=(dual ? iterateDual : iterate)(D,n,Bindices);
simplexTableau(D,Bindices);
- if(case != OPTIMAL)
- return;
+ x=new rational[n];
for(int j=0; j < n; ++j)
x[j]=0;
for(int k=0; k < m; ++k)
x[Bindices[k]-1]=D[k][0];
+ if(case == UNBOUNDED) {
+ d=new rational[n];
+ for(int j=0; j < n; ++j)
+ d[j]=0;
+ d[J-1]=1;
+ for(int k=0; k < m; ++k)
+ d[Bindices[k]-1]=-D[k][J];
+ }
+
+ if(case != OPTIMAL)
+ return;
+
cost=-Dm[0];
}
@@ -391,10 +404,13 @@ struct simplex {
}
rational[] C=concat(c,array(count,rational(0)));
- if(count > 0) simplexStandard(C,a,b);
+ simplexInit(C,a,b,count);
operator init(C,a,b,phase1,dual);
- if(case == OPTIMAL && count > 0)
- x.delete(n,n+count-1);
+ if(case != INFEASIBLE) {
+ xStandard=copy(x);
+ if(count > 0)
+ x.delete(n,n+count-1);
+ }
}
}
diff --git a/graphics/asymptote/base/slide.asy b/graphics/asymptote/base/slide.asy
index 8a787c37a5..9d26c68065 100644
--- a/graphics/asymptote/base/slide.asy
+++ b/graphics/asymptote/base/slide.asy
@@ -309,7 +309,7 @@ void remark(bool center=false, string s, pair align=0, pen p=itempen,
void center(string s, pen p=itempen)
{
- remark("\center "+s,p);
+ remark(center=true,"\center "+s,p);
}
void vbox(string s, pen p=itempen)
diff --git a/graphics/asymptote/base/three.asy b/graphics/asymptote/base/three.asy
index de03d7c5ec..d7a20b516c 100644
--- a/graphics/asymptote/base/three.asy
+++ b/graphics/asymptote/base/three.asy
@@ -1880,6 +1880,14 @@ transform3 align(triple u)
return c >= 0 ? identity(4) : diagonal(1,-1,-1,1);
}
+// Align Label with normal in direction dir.
+Label align(Label L, triple dir)
+{
+ Label L=L.copy();
+ L.transform3(align(unit(dir)));
+ return L;
+}
+
// return a rotation that maps X,Y to the projection plane.
transform3 transform3(projection P=currentprojection)
{
diff --git a/graphics/asymptote/base/three_tube.asy b/graphics/asymptote/base/three_tube.asy
index 3a7902587e..60085a7d51 100644
--- a/graphics/asymptote/base/three_tube.asy
+++ b/graphics/asymptote/base/three_tube.asy
@@ -159,10 +159,10 @@ struct tube
triple c0=postcontrol(g,0);
triple c1=precontrol(g,1);
triple z1=point(g,1);
- real norm=sqrtEpsilon*max(abs(z0),abs(c0),abs(c1),abs(z1));
+ real norm=sqrtEpsilon*max(abs(z0),abs(c0),abs(c1),abs(z1),r);
surface[] s;
void Split(triple z0, triple c0, triple c1, triple z1,
- real depth=mantissaBits) {
+ int depth=mantissaBits) {
if(depth > 0) {
pair threshold(triple z0, triple c0, triple c1) {
triple u=c1-z0;
diff --git a/graphics/asymptote/base/tube.asy b/graphics/asymptote/base/tube.asy
index cfaf458db4..756eeabdda 100644
--- a/graphics/asymptote/base/tube.asy
+++ b/graphics/asymptote/base/tube.asy
@@ -14,10 +14,10 @@ real tubegranularity=1e-7;
void render(path3 s, real r, void f(path3, real))
{
void Split(triple z0, triple c0, triple c1, triple z1, real t0=0, real t1=1,
- real depth=mantissaBits) {
+ int depth=mantissaBits) {
if(depth > 0) {
real S=straightness(z0,c0,c1,z1);
- if(S > max(tubegranularity*max(abs(z0),abs(c0),abs(c1),abs(z1)))) {
+ if(S > max(tubegranularity*max(abs(z0),abs(c0),abs(c1),abs(z1),r))) {
--depth;
triple m0=0.5*(z0+c0);
triple m1=0.5*(c0+c1);