diff options
author | Karl Berry <karl@freefriends.org> | 2009-07-20 23:59:26 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-07-20 23:59:26 +0000 |
commit | c575a3e01c48c6807ff66e39df09c16ece08af60 (patch) | |
tree | c3bb87255b16358bb998849d2d83302bedea2e78 /Master/texmf/asymptote | |
parent | 3927b41be4f2831464a2c190c28042b7285dd91b (diff) |
asymptote 1.82
git-svn-id: svn://tug.org/texlive/trunk@14356 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf/asymptote')
-rwxr-xr-x | Master/texmf/asymptote/GUI/xasyVersion.py | 2 | ||||
-rw-r--r-- | Master/texmf/asymptote/labelpath3.asy | 2 | ||||
-rw-r--r-- | Master/texmf/asymptote/three.asy | 15 | ||||
-rw-r--r-- | Master/texmf/asymptote/three_arrows.asy | 54 | ||||
-rw-r--r-- | Master/texmf/asymptote/tube.asy | 11 | ||||
-rw-r--r-- | Master/texmf/asymptote/version.asy | 2 |
6 files changed, 48 insertions, 38 deletions
diff --git a/Master/texmf/asymptote/GUI/xasyVersion.py b/Master/texmf/asymptote/GUI/xasyVersion.py index c9fe270f7f7..a1ab6b203c5 100755 --- a/Master/texmf/asymptote/GUI/xasyVersion.py +++ b/Master/texmf/asymptote/GUI/xasyVersion.py @@ -1,2 +1,2 @@ #!/usr/bin/env python -xasyVersion = "1.81" +xasyVersion = "1.82" diff --git a/Master/texmf/asymptote/labelpath3.asy b/Master/texmf/asymptote/labelpath3.asy index b8a946a07ae..bf2e6d4c084 100644 --- a/Master/texmf/asymptote/labelpath3.asy +++ b/Master/texmf/asymptote/labelpath3.asy @@ -21,7 +21,7 @@ triple[] firstframe(path3 p, triple optional=O) } // Modification of the bishop frame construction contained in -// space_tube.asy(from Philippe Ivaldi's modules). +// space_tube.asy (from Philippe Ivaldi's modules). // For noncyclic path3s only triple[] nextframe(path3 p, real reltimestart, triple[] start, real reltimeend, int subdiv=20) diff --git a/Master/texmf/asymptote/three.asy b/Master/texmf/asymptote/three.asy index 2befc77a9c8..39075193073 100644 --- a/Master/texmf/asymptote/three.asy +++ b/Master/texmf/asymptote/three.asy @@ -1745,7 +1745,7 @@ transform3 align(triple u) } // return a rotation that maps X,Y to the projection plane. -transform3 transform3(projection P) +transform3 transform3(projection P=currentprojection) { triple v=unit(P.oblique ? P.camera : P.vector()); triple u=unit(perp(P.up,v)); @@ -2015,7 +2015,7 @@ draw=new void(frame f, path3 g, material p=currentpen, if(settings.thick) { real width=linewidth(q); if(width > 0) { - surface s=tube(g,width,p.granularity); + tube T=tube(g,width,p.granularity); int L=length(g); if(L >= 0) { if(!cyclic(g)) { @@ -2034,13 +2034,14 @@ draw=new void(frame f, path3 g, material p=currentpen, cap=scale3r*unitcylinder; cap.append(scale3r*shift(Z)*unitdisk); } - s.append(shift(point(g,0))*align(-dir0)*cap); - s.append(shift(point(g,L))*align(dirL)*cap); + T.s.append(shift(point(g,0))*align(-dir0)*cap); + T.s.append(shift(point(g,L))*align(dirL)*cap); } - if(opacity(q) == 1) _draw(f,g,q); + if(opacity(q) == 1) + _draw(f,T.center,q); } - for(int i=0; i < s.s.length; ++i) - draw3D(f,s.s[i],p,light); + for(int i=0; i < T.s.s.length; ++i) + draw3D(f,T.s.s[i],p,light); } else _draw(f,g,q); } else _draw(f,g,q); } diff --git a/Master/texmf/asymptote/three_arrows.asy b/Master/texmf/asymptote/three_arrows.asy index 418065e5e1e..841c4f731f4 100644 --- a/Master/texmf/asymptote/three_arrows.asy +++ b/Master/texmf/asymptote/three_arrows.asy @@ -82,33 +82,41 @@ void render(path3 s, real granularity=tubegranularity, void f(path3, real)) Split(point(s,0),postcontrol(s,0),precontrol(s,1),point(s,1)); } -surface tube(path3 g, real width, real granularity=tubegranularity) +struct tube { - surface tube; - real r=0.5*width; + surface s; + path3 center; - transform3 t=scale3(r); + void operator init(path3 g, real width, real granularity=tubegranularity) { + real r=0.5*width; - int n=length(g); - for(int i=0; i < n; ++i) { - real S=straightness(g,i); - if(S < sqrtEpsilon*r) { - triple v=point(g,i); - triple u=point(g,i+1)-v; - tube.append(shift(v)*align(unit(u))*scale(r,r,abs(u))*unitcylinder); - } else { - render(subpath(g,i,i+1),granularity,new void(path3 q, real) { - real L=arclength(q); - surface segment=scale(r,r,L)*unitcylinder; - bend(segment,q,L); - tube.s.append(segment.s); - }); - } + transform3 t=scale3(r); - if((cyclic(g) || i > 0) && abs(dir(g,i,1)-dir(g,i,-1)) > sqrtEpsilon) - tube.append(shift(point(g,i))*t*align(dir(g,i,-1))*unithemisphere); + int n=length(g); + for(int i=0; i < n; ++i) { + path3 gi=subpath(g,i,i+1); + real S=straightness(g,i); + if(S < sqrtEpsilon*r) { + triple v=point(g,i); + triple u=point(g,i+1)-v; + s.append(shift(v)*align(unit(u))*scale(r,r,abs(u))*unitcylinder); + center=center&gi; + } else { + render(gi,granularity,new void(path3 q, real) { + real L=arclength(q); + surface segment=scale(r,r,L)*unitcylinder; + bend(segment,q,L); + s.s.append(segment.s); + triple a=L*Z/3; + center=center&bend(O,q,L)..controls bend(a,q,L) and bend(2a,q,L).. + bend(3a,q,L); + }); + } + + if((cyclic(g) || i > 0) && abs(dir(g,i,1)-dir(g,i,-1)) > sqrtEpsilon) + s.append(shift(point(g,i))*t*align(dir(g,i,-1))*unithemisphere); + } } - return tube; } // Refine a noncyclic path3 g so that it approaches its endpoint in @@ -168,7 +176,7 @@ struct arrowhead3 } if(draw) for(path3 g : H) - s.append(tube(g,width)); + s.append(tube(g,width).s); return shift(v)*s; } diff --git a/Master/texmf/asymptote/tube.asy b/Master/texmf/asymptote/tube.asy index f62d3897adf..1f8ef950251 100644 --- a/Master/texmf/asymptote/tube.asy +++ b/Master/texmf/asymptote/tube.asy @@ -15,9 +15,9 @@ path3 roundedpath(path3 A, real r) guide3 rounded; triple before, after, indir, outdir; int len=length(A); - bool guideclosed=cyclic(A); + bool cyclic=cyclic(A); if(len < 2) {return A;}; - if(guideclosed) {rounded=point(point(A,0)--point(A,1),r);} + if(cyclic) {rounded=point(point(A,0)--point(A,1),r);} else {rounded=point(A,0);} for(int i=1; i < len; i=i+1) { before=point(point(A,i)--point(A,i-1),r); @@ -26,7 +26,7 @@ path3 roundedpath(path3 A, real r) outdir=dir(point(A,i)--point(A,i+1),1); rounded=rounded--before{indir}..{outdir}after; } - if(guideclosed) { + if(cyclic) { before=point(point(A,0)--point(A,len-1),r); indir=dir(point(A,len-1)--point(A,0),1); outdir=dir(point(A,0)--point(A,1),1); @@ -205,6 +205,7 @@ surface tube(path3 g, coloredpath section, pair M=max(section.p), m=min(section.p); real[] t=sample(g,max(M.x-m.x,M.y-m.y)/max(realEpsilon,abs(corner)), min(abs(relstep),1)); - t.cyclic(cyclic(g)); - return surface(rmf(g,t),section,T,cyclic(g)); + bool cyclic=cyclic(g); + t.cyclic(cyclic); + return surface(rmf(g,t),section,T,cyclic); } diff --git a/Master/texmf/asymptote/version.asy b/Master/texmf/asymptote/version.asy index 79570c6e65a..713dc924f1c 100644 --- a/Master/texmf/asymptote/version.asy +++ b/Master/texmf/asymptote/version.asy @@ -1 +1 @@ -string VERSION="1.81"; +string VERSION="1.82"; |