diff options
Diffstat (limited to 'Build/source/utils/asymptote/examples')
14 files changed, 188 insertions, 15 deletions
diff --git a/Build/source/utils/asymptote/examples/bars3.asy b/Build/source/utils/asymptote/examples/bars3.asy new file mode 100644 index 00000000000..4205d46f37c --- /dev/null +++ b/Build/source/utils/asymptote/examples/bars3.asy @@ -0,0 +1,22 @@ +import three; +import palette; +import graph3; + +size(300); + +currentprojection=perspective(-30,-30,30,up=Z); + +surface s; + +for(int i = 0; i < 10; ++i) { + for(int j = 0; j < 10; ++j) { + s.append(shift(i,j,0)*scale(1,1,i+j)*unitcube); + } +} + +s.colors(palette(s.map(zpart),Rainbow())); +draw(s,meshpen=black+thick(),nolight,render(merge=true)); + +xaxis3("$x$",Bounds,InTicks(endlabel=false,Label,2,2)); +yaxis3(YZ()*"$y$",Bounds,InTicks(beginlabel=false,Label,2,2)); +zaxis3(XZ()*"$z$",Bounds,InTicks); diff --git a/Build/source/utils/asymptote/examples/condor.asy b/Build/source/utils/asymptote/examples/condor.asy index d3b48728ea0..5ce5caa2412 100644 --- a/Build/source/utils/asymptote/examples/condor.asy +++ b/Build/source/utils/asymptote/examples/condor.asy @@ -29,4 +29,4 @@ triple condor(pair t) surface s=surface(condor,(-1,0),(1,K),16,Spline); s.colors(palette(s.map(zpart),Rainbow())); -draw(s); +draw(s,render(compression=Low,merge=true)); diff --git a/Build/source/utils/asymptote/examples/cones.asy b/Build/source/utils/asymptote/examples/cones.asy index 4f28796cb92..e63a4281251 100644 --- a/Build/source/utils/asymptote/examples/cones.asy +++ b/Build/source/utils/asymptote/examples/cones.asy @@ -3,14 +3,16 @@ import solids; size(200); currentprojection=orthographic(5,4,2); +render render=render(compression=Low,merge=true); + revolution upcone=cone(-Z,1,1); revolution downcone=cone(Z,1,-1); -draw(surface(upcone),green); -draw(surface(downcone),green); +draw(surface(upcone),green,render); +draw(surface(downcone),green,render); draw(upcone,5,blue,longitudinalpen=nullpen); draw(downcone,5,blue,longitudinalpen=nullpen); revolution cone=shift(2Y-2X)*cone(1,1); -draw(surface(cone),green); +draw(surface(cone),green,render); draw(cone,5,blue); diff --git a/Build/source/utils/asymptote/examples/cylinder.asy b/Build/source/utils/asymptote/examples/cylinder.asy index d326ea579a2..88ff1394bac 100644 --- a/Build/source/utils/asymptote/examples/cylinder.asy +++ b/Build/source/utils/asymptote/examples/cylinder.asy @@ -4,5 +4,5 @@ size(0,100); currentlight=Viewport; revolution r=cylinder(O,1,1.5,Y+Z); -draw(surface(r),green); +draw(surface(r),green,render(merge=true)); draw(r,blue); diff --git a/Build/source/utils/asymptote/examples/hyperboloid.asy b/Build/source/utils/asymptote/examples/hyperboloid.asy index 10d3609f5d0..0cf6da08c40 100644 --- a/Build/source/utils/asymptote/examples/hyperboloid.asy +++ b/Build/source/utils/asymptote/examples/hyperboloid.asy @@ -4,5 +4,5 @@ import solids; currentprojection=perspective(4,4,3); revolution hyperboloid=revolution(new real(real x) {return sqrt(1+x*x);}, -2,2,20,operator..,X); -draw(surface(hyperboloid),green); +draw(surface(hyperboloid),green,render(compression=Low,merge=true)); draw(hyperboloid,6,blue,longitudinalpen=nullpen); diff --git a/Build/source/utils/asymptote/examples/pipes.asy b/Build/source/utils/asymptote/examples/pipes.asy new file mode 100644 index 00000000000..6b2025f6b35 --- /dev/null +++ b/Build/source/utils/asymptote/examples/pipes.asy @@ -0,0 +1,140 @@ +import solids; +import tube; +import graph3; +import palette; +size(8cm); + +currentprojection=perspective( +camera=(13.3596389245356,8.01038090435314,14.4864483364785), +up=(-0.0207054323419367,-0.00472438375047319,0.0236460907598947), +target=(-1.06042550499095,2.68154529985845,0.795007562120261)); + +defaultpen(fontsize(6pt)); + +// draw coordinates and frames +// axis1 is defined by z axis of TBase +// axis2 is defined by z axis of TEnd +void DrawFrame(transform3 TBase, transform3 TEnd, string s) +{ + triple p1,v1,p2,v2; + p1=TBase*O; + v1=TBase*Z-p1; + p2=TEnd*O; + v2=TEnd*Z-p2; + triple n=cross(v1,v2); + + real[][] A= + { + {v1.x,-v2.x,-n.x}, + {v1.y,-v2.y,-n.y}, + {v1.z,-v2.z,-n.z} + }; + + triple vb=p2-p1; + + real[] b={vb.x,vb.y,vb.z}; + + // Get the extention along vector v1 and v2, + // so, we can get the common normal between two axis + real[] x=solve(A,b); + + real s1=x[0]; + real s2=x[1]; + + // get foot of a perpendicular on both axies + triple foot1=p1+s1*v1; + triple foot2=p2+s2*v2; + + // draw two axis + triple axis_a,axis_b; + axis_a=p1+s1*v1*1.5; + axis_b=p1-s1*v1*1.5; + draw(axis_a--axis_b); + + axis_a=p2+s2*v2*1.5; + axis_b=p2-s2*v2*1.5; + draw(axis_a--axis_b); + + // draw "a"(common normal) + draw(Label("$a_{"+s+"}$"),foot1--foot2,linewidth(1pt)); + + // draw the coordinates frame + triple dx,dy,dz,org; + real length=0.8; + + org=foot1; + dx =length*unit(foot2-foot1); // define the x axis of the frame on "a" + dz =length*unit(v1); // define the z axis which is along axis1 + dy =length*unit(cross(dz,dx)); + + draw(Label("$X_{"+s+"}$",1,align=-dy-dz),org--(org+dx),red+linewidth(1.5pt), + Arrow3(8)); + draw(Label("$Y_{"+s+"}$",1,align=2dy-dz-dx),org--(org+dy), + green+linewidth(1.5pt), Arrow3(8)); + draw(Label("$Z_{"+s+"}$",1,align=-2dx-dy),org--(org+dz), + blue+linewidth(1.5pt), Arrow3(8)); + + dot(Label("$O_{"+s+"}$",align =-dx-dz,black),org,black); // origin + +} + +void DrawLink(transform3 TBase, transform3 TEnd, pen objStyle,string s) +{ + real h=1; + real r=0.5; + path3 generator=(0.5*r,0,h)--(r,0,h)--(r,0,0)--(0.5*r,0,0); + revolution vase=revolution(O,generator,0,360); + surface objSurface=surface(vase); + + render render=render(merge=true); + + // draw two cylinders + draw(TBase*objSurface,objStyle,render); + draw(TEnd*shift((0,0,-h))*objSurface,objStyle,render); + + // draw the link between two cylinders + triple pStart=TBase*(0.5*h*Z); + triple pEnd =TEnd*(-0.5*h*Z); + triple pControl1=0.25*(pEnd-pStart)+TBase*(0,0,h); + triple pControl2=-0.25*(pEnd-pStart)+TEnd*(0,0,-h); + path3 p=pStart..controls pControl1 and pControl2..pEnd; + draw(tube(p,scale(0.2)*unitsquare),objStyle,render); +} + +// t1 and t2 define the starting frame and ending frame of the first link(i-1) +transform3 t1=shift((0,0,1)); +transform3 t2=shift((0,0,-1))*rotate(-20,Y)*shift((0,3,2)); +// as, the two links were connected, so t2 is also the starting frame of link(i) +// t3 defines the ending frame of link(i) +transform3 t3=t2*rotate(40,Z)*shift((0,3,1.5))*rotate(-15,Y)*shift(-1.5*Z); + +// draw link(i-1) +DrawLink(t1,t2,palegreen,"i-1"); +DrawFrame(t1,t2,"i-1"); +// draw link(i) +DrawLink(t2,t3,lightmagenta,"i"); +DrawFrame(t2,t3,"i"); + + +// draw angle alpha, which is the angle between axis(i-1) and axis(i) +triple p0=(0,0,-1); +triple p1=(0,0,2.3); +triple p2=shift((0,0,-1))*rotate(-20,Y)*(0,0,4); +draw(p0--p2,cyan); +draw("$\alpha_{i-1}$",arc(p0,p1,p2,Y,CW),ArcArrow3(3)); + + +// draw angle theta, which is the angle between a_i and a_{i-1} +transform3 tx=shift((0,0,-1))*rotate(-20,Y)*shift((0,3,0)); +p0=tx*O; +p1=tx*(0,3,0); +p2=tx*rotate(40,Z)*(0,3,0); +draw(p0--p1,cyan); +draw(p0--p2,cyan); + +triple p1a=tx*(0,1.5,0); +draw("$\theta_{i}$",arc(p0,p1a,p2),ArcArrow3(3)); + +// draw d_{i-1} +triple org_i =t2*shift((0,0,1.5))*O; +draw(Label("$d_{i}$",0.13),p0--org_i,linewidth(1pt)); diff --git a/Build/source/utils/asymptote/examples/projectrevolution.asy b/Build/source/utils/asymptote/examples/projectrevolution.asy index fe639b3b901..25cbe6d4902 100644 --- a/Build/source/utils/asymptote/examples/projectrevolution.asy +++ b/Build/source/utils/asymptote/examples/projectrevolution.asy @@ -11,5 +11,7 @@ surface s=surface(r); surface S=planeproject(shift(-Z)*unitsquare3)*s; S.colors(palette(s.map(zpart),Rainbow())); -draw(S); -draw(s,lightgray); + +render render=render(compression=Low,merge=true); +draw(S,render); +draw(s,lightgray,render); diff --git a/Build/source/utils/asymptote/examples/sacone3D.asy b/Build/source/utils/asymptote/examples/sacone3D.asy index 1ed60da0351..d8f3aa373d3 100644 --- a/Build/source/utils/asymptote/examples/sacone3D.asy +++ b/Build/source/utils/asymptote/examples/sacone3D.asy @@ -5,7 +5,8 @@ real r=1; real h=1; revolution R=cone(r,h); -draw(surface(R),lightgreen+opacity(0.5)); + +draw(surface(R),lightgreen+opacity(0.5),render(compression=Low)); pen edge=blue+0.25mm; draw("$\ell$",(0,r,0)--(0,0,h),W,edge); draw("$r$",(0,0,0)--(r,0,0),red+dashed); diff --git a/Build/source/utils/asymptote/examples/sacylinder3D.asy b/Build/source/utils/asymptote/examples/sacylinder3D.asy index e44f78e8e72..fcc1a487bbe 100644 --- a/Build/source/utils/asymptote/examples/sacylinder3D.asy +++ b/Build/source/utils/asymptote/examples/sacylinder3D.asy @@ -5,7 +5,7 @@ real r=1; real h=3; revolution R=cylinder(-h/2*Z,r,h); -draw(surface(R),lightgreen+opacity(0.5)); +draw(surface(R),lightgreen+opacity(0.5),render(compression=Low)); draw((0,0,-h/2)--(0,0,h/2),dashed); dot((0,0,-h/2)); dot((0,0,h/2)); diff --git a/Build/source/utils/asymptote/examples/shellmethod.asy b/Build/source/utils/asymptote/examples/shellmethod.asy index c1c0155ae3a..c8e541f2a62 100644 --- a/Build/source/utils/asymptote/examples/shellmethod.asy +++ b/Build/source/utils/asymptote/examples/shellmethod.asy @@ -26,11 +26,13 @@ path p=graph(F,0,2,n,operator ..)--cycle; surface s=surface(p); path3 p3=path3(p); +render render=render(compression=0,merge=true); + revolution a=revolution(p3,Y,0,alpha); -draw(surface(a),color); -draw(rotate(alpha,Y)*s,color); +draw(surface(a),color,render); +draw(rotate(alpha,Y)*s,color,render); for(int i=0; i < n; ++i) - draw(surface(blocks[i]),color+opacity(0.5),black); + draw(surface(blocks[i]),color+opacity(0.5),black,render); draw(p3); xaxis3(Label("$x$",1,align=2X),Arrow3); diff --git a/Build/source/utils/asymptote/examples/splitpatch.asy b/Build/source/utils/asymptote/examples/splitpatch.asy index 200fb2c4c44..f1f5b6b98ba 100644 --- a/Build/source/utils/asymptote/examples/splitpatch.asy +++ b/Build/source/utils/asymptote/examples/splitpatch.asy @@ -1,5 +1,7 @@ import three; +size(300); + currentprojection=orthographic(0,0,1); triple[][] A={ diff --git a/Build/source/utils/asymptote/examples/teapot.asy b/Build/source/utils/asymptote/examples/teapot.asy index 9ec5b0cb370..401ecec5ab9 100644 --- a/Build/source/utils/asymptote/examples/teapot.asy +++ b/Build/source/utils/asymptote/examples/teapot.asy @@ -169,4 +169,4 @@ triple[][][] Q={ } }; -draw(surface(Q),blue); +draw(surface(Q),blue,render(compression=Low)); diff --git a/Build/source/utils/asymptote/examples/torus.asy b/Build/source/utils/asymptote/examples/torus.asy index f89c82cde8b..d0b8673d737 100644 --- a/Build/source/utils/asymptote/examples/torus.asy +++ b/Build/source/utils/asymptote/examples/torus.asy @@ -17,4 +17,4 @@ triple f(pair t) { } surface s=surface(f,(radians(90),0),(radians(345),2pi),8,8,Spline); -draw(s,green,render(merge=true)); +draw(s,green,render(compression=Low,merge=true)); diff --git a/Build/source/utils/asymptote/examples/workcone.asy b/Build/source/utils/asymptote/examples/workcone.asy index 5b4f8c94ad5..37efb5cc86b 100644 --- a/Build/source/utils/asymptote/examples/workcone.asy +++ b/Build/source/utils/asymptote/examples/workcone.asy @@ -16,6 +16,8 @@ real x1=r*s1/h; real s2=sr+0.2; real x2=r*s2/h; +//render render=render(compression=Low,merge=true); + path3 p=(0,0,0)--(x,0,s); revolution a=revolution(p,Z); draw(surface(a,4),lightblue+opacity(0.5)); |