diff options
author | Karl Berry <karl@freefriends.org> | 2013-04-07 18:26:53 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2013-04-07 18:26:53 +0000 |
commit | b04c2e1a42573e9735547702356c7b9a769a6855 (patch) | |
tree | c0753443f39500a062d7698fe6b94359c813f871 /Master/texmf-dist/doc/asymptote/examples/mergeExample.asy | |
parent | fb0bf13304a356f197bfc1add17f98c07e96f17b (diff) |
texmf -> texmf-dist: doc
git-svn-id: svn://tug.org/texlive/trunk@29714 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/asymptote/examples/mergeExample.asy')
-rw-r--r-- | Master/texmf-dist/doc/asymptote/examples/mergeExample.asy | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/asymptote/examples/mergeExample.asy b/Master/texmf-dist/doc/asymptote/examples/mergeExample.asy new file mode 100644 index 00000000000..e0fdcd0f6c7 --- /dev/null +++ b/Master/texmf-dist/doc/asymptote/examples/mergeExample.asy @@ -0,0 +1,77 @@ +size(16cm); +import bezulate; + +pen edgepen=linewidth(1)+blue; +pen dotpen=deepgreen; +pen labelpen=fontsize(8pt); + +path outer = (0.5,5){E}..(5,-1){S}..{W}(4,-4)..{W}(2.5,-1.5){W}..(-0.3,-2.5){W}..(-3,0)..cycle; +outer = subdivide(outer); +path[] p = {outer,shift(-0.5,1.0)*rotate(-22)*scale(1.5,2.4)*subdivide(unitcircle),shift(2.3,0.3)*scale(0.7)*unitcircle}; + +// a +filldraw(p,lightgrey+evenodd); + +real w = 1.1*(max(p).x-min(p).x); + +// b +p = shift(w)*p; +draw(p); +path l = point(p[1],2)--point(p[0],4); +draw(l,red); +for(int i = 0; i < p.length; ++i) +{ + real[][] ts = intersections(l,p[i]); + for(real[] t:ts) + dot(point(l,t[0])); +} +path l2 = point(l,intersections(l,p[0])[0][0])--point(l,intersections(l,p[2])[1][0]); +real to = intersections(l,p[0])[0][1]; +real ti = intersections(l,p[2])[1][1]; +draw(l2,edgepen); +label("$A$",point(l2,1),2E,labelpen); +label("$B$",point(l2,0),1.5E,labelpen); + +// c +p = shift(w)*p; +l2 = shift(w)*l2; +draw(p); +real timeoffset=2; +path t1=subpath(p[0],to,to+timeoffset); +t1=t1--point(p[2],ti)--cycle; +fill(t1,lightgrey); +draw(point(p[2],ti)--point(p[0],to+4),red); +dot(Label("$A$",labelpen),point(p[2],ti),2E,dotpen); +dot(Label("$B$",labelpen),point(p[0],to),1.5E,dotpen); +dot(Label("$C$",labelpen),point(p[0],to+timeoffset),1.5S,dotpen); +draw(t1,edgepen); +dot(point(p[0],to+4)); +draw(shift(-0.5,-0.5)*subpath(p[0],to+4,to+timeoffset+0.5),Arrow(4)); + +// d +p = shift(w)*p; +p[0] = subpath(p[0],to+timeoffset,to+length(p[0]))--uncycle(p[2],ti)--cycle; +p.delete(2); +draw(p); + +// e +p = shift(w)*p; +path q=point(p[1],0)--subpath(p[0],15.4,16)--cycle; +p[0] = subpath(p[0],16,15.4+length(p[0]))--uncycle(p[1],0)--cycle; +p.delete(1); +filldraw(p,lightgrey); + +// f +p = shift(w)*p; +filldraw(bezulate(p),lightgrey); +filldraw(shift(3w)*t1,lightgrey); +filldraw(shift(w)*q,lightgrey); + + +real x = min(p).x - 4.5w; +string l = "abcdef"; +for(int i = 0; i < 6; ++i) +{ + label("("+substr(l,i,1)+")",(x,min(p).y),3S,fontsize(10pt)); + x += w; +} |