From a6dc131e8a2ff8ce660543a262d771380fdf1b4e Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 7 Mar 2017 18:10:02 +0000 Subject: asy 2.40 sources git-svn-id: svn://tug.org/texlive/trunk@43422 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/utils/asymptote/base/asymptote.py | 2 +- Build/source/utils/asymptote/base/graph.asy | 1 + Build/source/utils/asymptote/base/graph3.asy | 2 -- Build/source/utils/asymptote/base/ode.asy | 3 +-- Build/source/utils/asymptote/base/palette.asy | 7 ++++--- Build/source/utils/asymptote/base/plain.asy | 22 +++++++++++++++++++--- Build/source/utils/asymptote/base/plain_pens.asy | 3 ++- .../source/utils/asymptote/base/plain_picture.asy | 9 +++++++++ .../source/utils/asymptote/base/smoothcontour3.asy | 3 ++- Build/source/utils/asymptote/base/solids.asy | 2 +- Build/source/utils/asymptote/base/three.asy | 4 ++-- .../source/utils/asymptote/base/three_surface.asy | 17 +++++++---------- 12 files changed, 49 insertions(+), 26 deletions(-) (limited to 'Build/source/utils/asymptote/base') diff --git a/Build/source/utils/asymptote/base/asymptote.py b/Build/source/utils/asymptote/base/asymptote.py index 721c464d36b..71e7b9beed6 100755 --- a/Build/source/utils/asymptote/base/asymptote.py +++ b/Build/source/utils/asymptote/base/asymptote.py @@ -3,7 +3,7 @@ from subprocess import * class asy: def __init__(self): - self.session = Popen(['asy','-quiet','-interactive'],stdin=PIPE) + self.session = Popen(['asy','-quiet','-inpipe=0','-outpipe=2'],stdin=PIPE) self.help() def send(self, cmd): self.session.stdin.write(cmd+'\n') diff --git a/Build/source/utils/asymptote/base/graph.asy b/Build/source/utils/asymptote/base/graph.asy index c50a7a67b2c..7498ce8bfdd 100644 --- a/Build/source/utils/asymptote/base/graph.asy +++ b/Build/source/utils/asymptote/base/graph.asy @@ -657,6 +657,7 @@ tickvalues generateticks(int sign, Label F="", ticklabel ticklabel=null, } if(calcStep) { + if(N == 1) N=2; if(N == 0) N=(int) (len/Step); else Step=len/N; } diff --git a/Build/source/utils/asymptote/base/graph3.asy b/Build/source/utils/asymptote/base/graph3.asy index fd7871e1547..ed098309740 100644 --- a/Build/source/utils/asymptote/base/graph3.asy +++ b/Build/source/utils/asymptote/base/graph3.asy @@ -4,8 +4,6 @@ private import math; import graph; import three; -triple zero3(real) {return O;} - typedef triple direction3(real); direction3 Dir(triple dir) {return new triple(real) {return dir;};} diff --git a/Build/source/utils/asymptote/base/ode.asy b/Build/source/utils/asymptote/base/ode.asy index 712196a3018..51941844fc4 100644 --- a/Build/source/utils/asymptote/base/ode.asy +++ b/Build/source/utils/asymptote/base/ode.asy @@ -98,8 +98,7 @@ void expfactors(real x, coefficients a) } // First-Order Euler -RKTableau Euler=RKTableau(1,new real[][], - new real[] {1}); +RKTableau Euler=RKTableau(1,new real[][], new real[] {1}); // First-Order Exponential Euler RKTableau E_Euler=RKTableau(1,new real[][], new real[] {1}, diff --git a/Build/source/utils/asymptote/base/palette.asy b/Build/source/utils/asymptote/base/palette.asy index 96bbf1550ec..2cb6e7c5475 100644 --- a/Build/source/utils/asymptote/base/palette.asy +++ b/Build/source/utils/asymptote/base/palette.asy @@ -245,12 +245,12 @@ pen[][] palette(real[][] f, pen[] palette) real Min=min(f); real Max=max(f); int n=f.length; - int m=n > 0 ? f[0].length : 0; - pen[][] p=new pen[n][m]; + pen[][] p=new pen[n][]; real step=(Max == Min) ? 0.0 : (palette.length-1)/(Max-Min); for(int i=0; i < n; ++i) { real[] fi=f[i]; - p[i]=sequence(new pen(int j) {return palette[round((fi[j]-Min)*step)];},m); + p[i]=sequence(new pen(int j) {return palette[round((fi[j]-Min)*step)];}, + f[i].length); } return p; } @@ -270,6 +270,7 @@ paletteticks PaletteTicks(Label format="", ticklabel ticklabel=null, } paletteticks PaletteTicks=PaletteTicks(); +paletteticks NoTicks=new ticks(int sign=-1) {return NoTicks;}; void palette(picture pic=currentpicture, Label L="", bounds bounds, pair initial, pair final, axis axis=Right, pen[] palette, diff --git a/Build/source/utils/asymptote/base/plain.asy b/Build/source/utils/asymptote/base/plain.asy index c86cca630a6..3bb8cf7ce93 100644 --- a/Build/source/utils/asymptote/base/plain.asy +++ b/Build/source/utils/asymptote/base/plain.asy @@ -281,6 +281,22 @@ if(settings.autoimport != "") { cputime(); -texpreamble("\ifx\pdfpagewidth\undefined\let\pdfpagewidth\paperwidth\else\let\paperwidth\pdfpagewidth\fi"); -texpreamble("\ifx\pdfpageheight\undefined\let\pdfpageheight\paperheight\else\let\paperheight\pdfpageheight\fi"); -if(settings.tex == "luatex") texpreamble("\input luatex85.sty"); +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/Build/source/utils/asymptote/base/plain_pens.asy b/Build/source/utils/asymptote/base/plain_pens.asy index fcf9d31e638..627ce2e8c84 100644 --- a/Build/source/utils/asymptote/base/plain_pens.asy +++ b/Build/source/utils/asymptote/base/plain_pens.asy @@ -99,7 +99,7 @@ pen deepgreen=rgb(0,0.5,0); pen deepblue=rgb(0,0,0.5); pen deepcyan=rgb(0,0.5,0.5); pen deepmagenta=rgb(0.5,0,0.5); -pen olive=rgb(0.5,0.5,0); +pen deepyellow=rgb(0.5,0.5,0); pen deepgray=gray(0.1); pen darkred=rgb(0.25,0,0); @@ -123,6 +123,7 @@ pen royalblue=rgb(0,0.5,1); pen salmon=lightred; pen brown=deepred; +pen olive=deepyellow; pen darkbrown=darkred; pen pink=palemagenta; pen palegrey=palegray; diff --git a/Build/source/utils/asymptote/base/plain_picture.asy b/Build/source/utils/asymptote/base/plain_picture.asy index 5f4d759663a..f1dccbb8bea 100644 --- a/Build/source/utils/asymptote/base/plain_picture.asy +++ b/Build/source/utils/asymptote/base/plain_picture.asy @@ -1236,6 +1236,15 @@ void fill(picture pic=currentpicture, path[] g, pen p=currentpen, pic.addPath(g); } +void drawstrokepath(picture pic=currentpicture, path g, pen strokepen, + pen p=currentpen) +{ + pic.add(new void(frame f, transform t) { + draw(f,strokepath(t*g,strokepen),p); + },true); + pic.addPath(g,p); +} + void latticeshade(picture pic=currentpicture, path[] g, bool stroke=false, pen fillrule=currentpen, pen[][] p, bool copy=true) { diff --git a/Build/source/utils/asymptote/base/smoothcontour3.asy b/Build/source/utils/asymptote/base/smoothcontour3.asy index 4fe26654283..be6f900a4d1 100644 --- a/Build/source/utils/asymptote/base/smoothcontour3.asy +++ b/Build/source/utils/asymptote/base/smoothcontour3.asy @@ -1574,7 +1574,8 @@ surface implicitsurface(real f(triple) = null, real ff(real,real,real) = null, for (int i = 0; i < patches.length; ++i) { triple center = (patches[i].triangular ? patches[i].point(1/3, 1/3) : patches[i].point(1/2,1/2)); - patches[i] = shift(center) * scale3(1.01) * shift(-center) * patches[i]; + transform3 T=shift(center) * scale3(1.03) * shift(-center); + patches[i] = T * patches[i]; } } return surface(...patches); diff --git a/Build/source/utils/asymptote/base/solids.asy b/Build/source/utils/asymptote/base/solids.asy index 90f01dc935f..a52e9bd5079 100644 --- a/Build/source/utils/asymptote/base/solids.asy +++ b/Build/source/utils/asymptote/base/solids.asy @@ -408,5 +408,5 @@ revolution cone(triple c=O, real r, real h, triple axis=Z, int n=nslice) // Note: unitsphere provides a smoother and more efficient surface. revolution sphere(triple c=O, real r, int n=nslice) { - return revolution(c,Arc(c,r,180,0,0,0,Y,n),Z); + return revolution(c,Arc(c,r,180-sqrtEpsilon,0,sqrtEpsilon,0,Y,n),Z); } diff --git a/Build/source/utils/asymptote/base/three.asy b/Build/source/utils/asymptote/base/three.asy index 210ed55ddfe..01eec97976f 100644 --- a/Build/source/utils/asymptote/base/three.asy +++ b/Build/source/utils/asymptote/base/three.asy @@ -79,7 +79,7 @@ defaultrender.closed=false; defaultrender.tessellate=false; defaultrender.merge=false; defaultrender.margin=0.02; -defaultrender.tubegranularity=0.005; +defaultrender.tubegranularity=0.001; defaultrender.sphere=NURBSsphere; defaultrender.labelfill=true; defaultrender.partnames=false; @@ -218,7 +218,7 @@ triple perp(triple v) } // Return the transformation corresponding to moving the camera from the target -// (looking in the negative z direction) to the point 'eye' (looking at target), +// (looking in the negative z direction) to the point 'eye' (looking at target, // orienting the camera so that direction 'up' points upwards. // Since, in actuality, we are transforming the points instead of the camera, // we calculate the inverse matrix. diff --git a/Build/source/utils/asymptote/base/three_surface.asy b/Build/source/utils/asymptote/base/three_surface.asy index c6d439e9fb0..6e10246c774 100644 --- a/Build/source/utils/asymptote/base/three_surface.asy +++ b/Build/source/utils/asymptote/base/three_surface.asy @@ -1273,13 +1273,15 @@ patch subpatch(patch s, pair a, pair b) return patch(subpatch(s.P,a,b),s.straight,s.planar); } -// return an array containing an intersection times of path p and surface s. +// return an array containing the times for one intersection of path p and +// patch s. real[] intersect(path3 p, patch s, real fuzz=-1) { return intersect(p,s.P,fuzz); } -// return an array containing an intersection times of path p and surface s. +// return an array containing the times for one intersection of path p and +// surface s. real[] intersect(path3 p, surface s, real fuzz=-1) { for(int i=0; i < s.s.length; ++i) { @@ -1402,14 +1404,9 @@ void draw3D(frame f, int type=0, patch s, triple center=O, material m, if(prc()) PRCshininess=PRCshininess(m.shininess); - if(s.triangular) - drawbeziertriangle(f,s.P,center,s.straight && s.planar,m.p, - m.opacity,m.shininess,PRCshininess,s.colors, - interaction.type); - else - draw(f,s.P,center,s.straight && s.planar,m.p,m.opacity,m.shininess, - PRCshininess,s.planar ? s.normal(0.5,0.5) : O,s.colors, - interaction.type,prc); + (s.triangular ? drawbeziertriangle : draw) + (f,s.P,center,s.straight && s.planar,m.p,m.opacity,m.shininess, + PRCshininess,s.colors,interaction.type,prc); } // Draw triangles on a frame. -- cgit v1.2.3