diff options
author | Karl Berry <karl@freefriends.org> | 2019-04-03 22:33:45 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-04-03 22:33:45 +0000 |
commit | 072987993bdb3cf5495219b96ad4056509ccb7ab (patch) | |
tree | 7db7f28ff1713a570c4ef960d5e4c2dbabf0fdc1 /Master/texmf-dist/doc/asymptote/examples | |
parent | 0714966cf940fe8c3abb344bdffd6744f88eec4d (diff) |
asymptote 2.49
git-svn-id: svn://tug.org/texlive/trunk@50744 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/asymptote/examples')
6 files changed, 57 insertions, 54 deletions
diff --git a/Master/texmf-dist/doc/asymptote/examples/Sierpinski.asy b/Master/texmf-dist/doc/asymptote/examples/Sierpinski.asy index d1664045d9f..c0ff04971d2 100644 --- a/Master/texmf-dist/doc/asymptote/examples/Sierpinski.asy +++ b/Master/texmf-dist/doc/asymptote/examples/Sierpinski.asy @@ -5,8 +5,8 @@ void Sierpinski(pair A, real s, int q, bool top=true) { pair B=A-(1,sqrt(2))*s/2; pair C=B+s; - if(top) draw(A--B--C--cycle); - draw((A+B)/2--(B+C)/2--(A+C)/2--cycle); + if(top) fill(A--B--C--cycle); + unfill((A+B)/2--(B+C)/2--(A+C)/2--cycle); if(q > 0) { Sierpinski(A,s/2,q-1,false); Sierpinski((A+B)/2,s/2,q-1,false); @@ -14,4 +14,4 @@ void Sierpinski(pair A, real s, int q, bool top=true) } } -Sierpinski((0,1),1,5); +Sierpinski((0,1),1,9); diff --git a/Master/texmf-dist/doc/asymptote/examples/arrows3.asy b/Master/texmf-dist/doc/asymptote/examples/arrows3.asy index 57fc4b3d338..06b986ef5fe 100644 --- a/Master/texmf-dist/doc/asymptote/examples/arrows3.asy +++ b/Master/texmf-dist/doc/asymptote/examples/arrows3.asy @@ -5,7 +5,7 @@ size(15cm); defaultrender.merge=true; currentprojection=perspective(24,14,13); -currentlight=light(gray(0.5),specularfactor=3,viewport=false, +currentlight=light(gray(0.5),specularfactor=3, (0.5,-0.5,-0.25),(0.5,0.5,0.25),(0.5,0.5,1),(-0.5,-0.5,-1)); defaultpen(0.75mm); diff --git a/Master/texmf-dist/doc/asymptote/examples/randompath3.asy b/Master/texmf-dist/doc/asymptote/examples/randompath3.asy index 755c3a29128..94f989b1fcb 100644 --- a/Master/texmf-dist/doc/asymptote/examples/randompath3.asy +++ b/Master/texmf-dist/doc/asymptote/examples/randompath3.asy @@ -1,4 +1,4 @@ import three; size(300); -draw(randompath3(100),red,currentlight); +draw(randompath3(100),red,nolight); diff --git a/Master/texmf-dist/doc/asymptote/examples/soccerball.asy b/Master/texmf-dist/doc/asymptote/examples/soccerball.asy index a37063dbb29..5cf0f015055 100644 --- a/Master/texmf-dist/doc/asymptote/examples/soccerball.asy +++ b/Master/texmf-dist/doc/asymptote/examples/soccerball.asy @@ -1,14 +1,14 @@ -import graph3; -size(400); +import graph3; +size(400); currentlight.background=palegreen; defaultrender=render(compression=Zero,merge=true); -real c=(1+sqrt(5))/2; +real c=(1+sqrt(5))/2; -triple[] z={(c,1,0),(-c,1,0),(-c,-1,0),(c,-1,0)}; -triple[] x={(0,c,1),(0,-c,1),(0,-c,-1),(0,c,-1)}; -triple[] y={(1,0,c),(1,0,-c),(-1,0,-c),(-1,0,c)}; +triple[] z={(c,1,0),(-c,1,0),(-c,-1,0),(c,-1,0)}; +triple[] x={(0,c,1),(0,-c,1),(0,-c,-1),(0,c,-1)}; +triple[] y={(1,0,c),(1,0,-c),(-1,0,-c),(-1,0,c)}; triple[][] Q={ {z[0],y[1],x[3],x[0],y[0],z[3]}, @@ -23,65 +23,68 @@ triple[][] Q={ {y[1],y[2],x[2],z[3],z[0],x[3]}, {y[2],y[1],x[3],z[1],z[2],x[2]}, {y[3],y[0],x[0],z[1],z[2],x[1]} -}; +}; -path3 p=arc(O,Q[0][0],Q[0][1]); -real R=abs(point(p,reltime(p,1/3))); +int nArc=4; + +path3 p=Arc(O,Q[0][0],Q[0][1],nArc); +real R=abs(point(p,reltime(p,1/3))); triple[][] P; -for(int i=0; i < Q.length; ++i){ - P[i]=new triple[] ; - for(int j=0; j < Q[i].length; ++j){ - P[i][j]=Q[i][j]/R; +for(int i=0;i < Q.length;++i){ + P[i]=new triple[] ; + for(int j=0;j < Q[i].length;++j){ + P[i][j]=Q[i][j]/R; } } +// FIXME: Use a baryicentric coordinate mesh surface sphericaltriangle(triple center, triple A, triple B, triple C, int nu=3, int nv=nu) { - path3 tri1=arc(center,A,B); - path3 tri2=arc(center,A,C); - path3 tri3=arc(center,B,C); + path3 tri1=Arc(center,A,B,nArc); + path3 tri2=Arc(center,A,C,nArc); + path3 tri3=Arc(center,B,C,nArc); triple tri(pair p) { - path3 cr=arc(O,relpoint(tri2,p.x),relpoint(tri3,p.x)); - return relpoint(cr,p.y); - }; + path3 cr=Arc(O,relpoint(tri2,p.x),relpoint(tri3,p.x),nArc); + return relpoint(cr,p.y); + }; - return surface(tri,(0,0),(1-sqrtEpsilon,1),nu,nv,Spline); + return surface(tri,(0,0),(1-sqrtEpsilon,1),nu,nv,Spline); } -for(int i=0; i < P.length; ++i){ +for(int i=0;i < P.length;++i){ triple[] pentagon=sequence(new triple(int k) { - path3 p=arc(O,P[i][0],P[i][k+1]); - return point(p,reltime(p,1/3)); - },5); - pentagon.cyclic=true; + path3 p=Arc(O,P[i][0],P[i][k+1],nArc); + return point(p,reltime(p,1/3)); + },5); + pentagon.cyclic=true; draw(sequence(new path3(int k) { - return arc(O,pentagon[k],pentagon[k+1]);},5),linewidth(2pt)); - triple M=unit(sum(pentagon)/5); - for(int i=0; i < 5; ++i){ - surface sf=sphericaltriangle(O,pentagon[i],M,pentagon[i+1]); - draw(sf,black); + return Arc(O,pentagon[k],pentagon[k+1],nArc);},5),linewidth(2pt)); + triple M=unit(sum(pentagon)/5); + for(int i=0;i < 5;++i){ + surface sf=sphericaltriangle(O,pentagon[i],M,pentagon[i+1]); + draw(sf,black); } } - -for(int i=0; i < P.length; ++i){ - for(int j=1; j <= 5; ++j){ - triple K=P[i][0]; - triple A=P[i][j]; - triple B=P[i][(j % 5)+1]; - path3[] p={arc(O,K,A),arc(O,A,B),arc(O,B,K)}; - draw(subpath(p[0],reltime(p[0],1/3),reltime(p[0],2/3)),linewidth(4pt)); + +for(int i=0;i < P.length;++i) { + for(int j=1;j <= 5;++j) { + triple K=P[i][0]; + triple A=P[i][j]; + triple B=P[i][(j % 5)+1]; + path3[] p={Arc(O,K,A,nArc),Arc(O,A,B,nArc),Arc(O,B,K,nArc)}; + draw(subpath(p[0],reltime(p[0],1/3),reltime(p[0],2/3)),linewidth(4pt)); triple[] hexagon={point(p[0],reltime(p[0],1/3)), point(p[0],reltime(p[0],2/3)), point(p[1],reltime(p[1],1/3)), point(p[1],reltime(p[1],2/3)), point(p[2],reltime(p[2],1/3)), - point(p[2],reltime(p[2],2/3))}; - hexagon.cyclic=true; - triple M=unit(sum(hexagon)/6); - for(int i=0; i < 6; ++i){ - surface sf=sphericaltriangle(O,hexagon[i],M,hexagon[i+1]); - draw(sf,white); + point(p[2],reltime(p[2],2/3))}; + hexagon.cyclic=true; + triple M=unit(sum(hexagon)/6); + for(int i=0;i < 6;++i) { + surface sf=sphericaltriangle(O,hexagon[i],M,hexagon[i+1]); + draw(sf,white); } } } diff --git a/Master/texmf-dist/doc/asymptote/examples/threeviews.asy b/Master/texmf-dist/doc/asymptote/examples/threeviews.asy index c723abd452b..239a24cc28a 100644 --- a/Master/texmf-dist/doc/asymptote/examples/threeviews.asy +++ b/Master/texmf-dist/doc/asymptote/examples/threeviews.asy @@ -3,7 +3,6 @@ import three; picture pic; unitsize(pic,5cm); -currentlight.viewport=false; if(settings.render < 0) settings.render=4; settings.toolbar=false; viewportmargin=(1cm,1cm); diff --git a/Master/texmf-dist/doc/asymptote/examples/triangles.asy b/Master/texmf-dist/doc/asymptote/examples/triangles.asy index c3b3c2aec84..fc62c58c120 100644 --- a/Master/texmf-dist/doc/asymptote/examples/triangles.asy +++ b/Master/texmf-dist/doc/asymptote/examples/triangles.asy @@ -8,12 +8,13 @@ triple[] n={Z,X}; int[][] vi={{0,1,2},{2,3,0}}; int[][] ni={{0,0,0},{1,1,1}}; +// Adobe Reader exhibits a PRC rendering bug for opacities: pen[] p={red+opacity(0.5),green+opacity(0.5),blue+opacity(0.5), black+opacity(0.5)}; -// Adobe Reader exhibits a PRC rendering bug for opacities in (0.5,1): -//pen[] p={red+opacity(0.9),green+opacity(0.9),blue+opacity(0.9),black+opacity(0.9)}; - int[][] pi={{0,1,2},{2,3,0}}; draw(v,vi,n,ni,red); -draw(v+Z,vi,p,pi); +draw(v+Z,vi,n,ni,p,pi); +//draw(v+Z,vi,p,pi); +//draw(v,vi,red); +//draw(v+Z,vi); |