Asymptote using solids.asy – fig0010

Category: Asymptote,Examples 3D,solids.asyPh. Ivaldi @ 2 h 56 min

Figure 0001
(Compiled with Asymptote version 2.14svn-r5318)
    
import solids;
currentprojection=orthographic(1,2,2);

size(6cm,0);
material m=
  //       diffusepen, ambientpen, emissivepen,  specularpen
  material(  grey,       yellow,     black,        orange);

draw(surface(sphere(1)), m);

Étiquettes : , , , , ,


Asymptote using solids.asy – fig0020

Category: Asymptote,Examples 3D,solids.asyPh. Ivaldi @ 3 h 56 min

Figure 0002
(Compiled with Asymptote version 2.14svn-r5318)
    
import solids;
currentlight=light(paleyellow, viewport=false,
                   (5,-5,10),(0,0,-10));

size(6cm,0);
draw(sphere(1,n=4*nslice), linewidth(bp), m=10);
draw(surface(sphere(1,n=4*nslice)), orange);

Étiquettes : , , , , ,


Asymptote using solids.asy – fig0030

Category: Asymptote,Examples 3D,solids.asyPh. Ivaldi @ 4 h 56 min

Figure 0003
(Compiled with Asymptote version 2.14svn-r5318)
    
// Author: John Bowman.
size(6cm,0);
import solids;
currentprojection=orthographic(0,10,5);

nslice=4*nslice;

revolution r=sphere(O,1);
draw(surface(r), lightgrey+opacity(0.75));

skeleton s;
r.transverse(s,reltime(r.g,0.6));
r.transverse(s,reltime(r.g,0.5));
draw(s.transverse.back,linetype("8 8",8));
draw(s.transverse.front);

r.longitudinal(s);
draw(s.longitudinal.front);
draw(s.longitudinal.back,linetype("8 8",8));

Étiquettes : , , , , , ,


Asymptote using solids.asy – fig0040

Category: Asymptote,Examples 3D,solids.asyPh. Ivaldi @ 5 h 56 min

Figure 0004
(Compiled with Asymptote version 2.14svn-r5318)
    
import solids;
size(6cm,0);

currentprojection=orthographic(100,150,30);

real r=1;

skeleton s;
revolution sph=sphere(O,r);
draw(surface(sph), palegray);

path3 cle=rotate(90,X)*scale3(r)*unitcircle3;

triple cam=unit(currentprojection.camera);
real a=degrees(xypart(cam),false)-90;
real b=-sgn(cam.z)*aCos(sqrt(cam.x^2+cam.y^2)/abs(cam));
cle=rotate(b,cross(Z,cam))*rotate(a,Z)*cle;
draw(cle,4pt+red);

Étiquettes : , , , , ,


Asymptote using solids.asy – fig0050

Category: Asymptote,Examples 3D,solids.asyPh. Ivaldi @ 6 h 56 min

Figure 0005
(Compiled with Asymptote version 2.14svn-r5318)
    
import solids;
size(6cm,0);
currentlight=light(diffuse=yellow, ambient=blue, specular=paleyellow,
                   specularfactor=0, viewport=false,(5,-5,10));
// currentprojection=orthographic(100,100,30);
real r=2;

skeleton s;
revolution sph=sphere(O,r);
draw(surface(sph),red);

triple cam=unit(currentprojection.camera);
revolution cle=revolution(O,r*(rotate(90,Z)*cam),cam);
draw(cle, 8pt+black);

Étiquettes : , , , , , ,


Asymptote using solids.asy – fig0090

Category: Asymptote,Examples 3D,solids.asyPh. Ivaldi @ 10 h 56 min

Figure 0009
(Compiled with Asymptote version 2.14svn-r5318)
    
size(8cm,0);
import solids;
import graph3;

//Draw 3D right angle (MA,MB)
void drawrightangle(picture pic=currentpicture,
                    triple M, triple A, triple B,
                    real radius=0,
                    pen p=currentpen,
                    pen fillpen=nullpen,
                    projection P=currentprojection)
{
  p=linejoin(0)+linecap(0)+p;
  if (radius==0) radius=arrowfactor*sqrt(2);
  transform3 T=shift(-M);
  triple OA=radius/sqrt(2)*unit(T*A),
    OB=radius/sqrt(2)*unit(T*B),
    OC=OA+OB;
  path3 tp=OA--OC--OB;
  picture tpic;
  draw(tpic, tp, p=p);
  if (fillpen!=nullpen) draw(tpic, surface(O--tp--cycle), fillpen);
  add(pic,tpic,M);
}

currentprojection=orthographic(10,15,3);

real r=10, h=6; // r=sphere radius; h=altitude section
triple Op=(0,0,h);

limits((0,0,0),1.1*(r,r,r));
axes3("x","y","z");

real rs=sqrt(r^2-h^2); // section radius
real ch=180*acos(h/r)/pi;
path3 arcD=Arc(O,r,180,0,ch,0,Y,50);

revolution sphereD=revolution(O,arcD,Z);
draw(surface(sphereD), opacity(0.5)+lightblue);
draw(shift(0,0,h)*scale3(rs)*surface(unitcircle3),opacity(0.5));

path3 arcU=Arc(O,r,ch,0,0,0,Y,10);
revolution sphereU=revolution(O,arcU,Z);
draw(surface(sphereU), opacity(0.33)+lightgrey);

// right triangle OO'A
triple A=rotate(100,Z)*(rs,0,h);
dot("$O$",O,NW);
dot("$O'$",Op,W);
dot("$A$",A,N);
draw(A--O--Op--A);
drawrightangle(Op,O,A);

if(!is3D())
  shipout(format="pdf", bbox(Fill(paleyellow)));

Étiquettes : , , , , ,


Asymptote using solids.asy – fig0100

Category: Asymptote,Examples 3D,solids.asyPh. Ivaldi @ 11 h 56 min

Figure 0010
(Compiled with Asymptote version 2.14svn-r5318)
    
unitsize(1cm);
import solids;

currentprojection=orthographic(0,100,25);

real r=4, h=7;
triple O=(0,0,0);
triple Oprime=(0,0,3);
triple pS=(0,0,h);
triple pA=(r*sqrt(2)/2,r*sqrt(2)/2,0);
revolution rC=cone(O,r,h,axis=Z,n=1);

draw(surface(rC),blue+opacity(0.5));

skeleton s;
real tOprime=abs(Oprime)/h;
rC.transverse(s,reltime(rC.g,tOprime));
triple pAprime=relpoint(pA--pS,tOprime);
draw(s.transverse.back,dashed);
draw(s.transverse.front);

label("$S$",pS,N);
dot(Label("$O$",align=SE),O);
dot(Label("$O'$",align=SE),Oprime);
dot(Label("$A$",align=Z),pA);
dot(Label("$A'$",align=Z),pAprime);

draw(pS--O^^O--pA^^Oprime--pAprime,dashed);

Étiquettes : , , ,


Asymptote using solids.asy – fig0110

Category: Asymptote,Examples 3D,solids.asyPh. Ivaldi @ 12 h 56 min

Figure 0011
(Compiled with Asymptote version 2.14svn-r5318)
    
import solids;
unitsize(4cm);

currentprojection=orthographic(2,2,1);

draw(cylinder(c=(0,0,-1.5),r=1,h=3), m=3);
draw(sphere(r=1), m=2, frontpen=defaultbackpen);

Étiquettes : , , ,


Asymptote using solids.asy – fig0120

Category: Asymptote,Examples 3D,solids.asyPh. Ivaldi @ 13 h 56 min

Figure 0012
(Compiled with Asymptote version 2.14svn-r5318)
    
import solids;

size(10cm,0);
currentprojection=orthographic(-50,100,40);

//Draw right angle (MA,MB) in 3D
void drawrightangle(picture pic=currentpicture,
                    triple M, triple A, triple B,
                    real radius=0,
                    pen p=currentpen,
                    pen fillpen=nullpen,
                    projection P=currentprojection)
{
  p=linejoin(0)+linecap(0)+p;
  if (radius==0) radius=arrowfactor*sqrt(2);
  transform3 T=shift(-M);
  triple OA=radius/sqrt(2)*unit(T*A),
    OB=radius/sqrt(2)*unit(T*B),
    OC=OA+OB;
  path3 _p=OA--OC--OB;
  picture pic_;
    draw(pic_, _p, p=p);
    if (fillpen!=nullpen) draw(pic_, surface(O--_p--cycle), fillpen);
  add(pic,pic_,M);
}

// *...............Construction starts here................*

real r=1, h=.75;
real gle=60;
real gleA=20;
transform3 tR=rotate(gle,Z);
transform3 tT=shift((0,0,-h));

triple H=(0,0,h),//the label is O in the picture.
  A=rotate(gleA,Z)*(0,r,h),
  F=tR*A,
  B=tR*F,
  D=tT*A,
  C=tT*B,
  Ei=intersectionpoint(H--F,A--B);

revolution r=cylinder(O,r,h,Z);
// draw(surface(r));
draw(r);

draw(O--H, dashed);
draw(O--D--C--cycle^^O--H^^B--C, dashed);

drawrightangle(Ei,H,B,fillpen=black);

dot(Label("$O'$",align=invert(NE+E,O)), O);
// layer();
draw(surface(A--B--C--D--cycle),lightgrey+opacity(.5));

dot(Label("$A$",align=NW), A);
dot(Label("$B$",align=N),B);
dot(Label("$C$",align=S), C);
dot(Label("$D$",align=NW), D);
dot(Label("$E$",align=S), Ei);
dot(Label("$F$",align=S), F);
dot(Label("$O$",align=N), H);

draw(H--B--F--A--cycle^^H--F^^A--B^^A--D);

Étiquettes : , , , ,


Asymptote using solids.asy – fig0130

Category: Asymptote,Examples 3D,solids.asyPh. Ivaldi @ 14 h 56 min

Figure 0013
(Compiled with Asymptote version 2.14svn-r5318)
    
import solids;
size(8cm,0);
currentprojection=orthographic((2, 1, 2));

revolution r=cylinder((0, 0, 0), 1, -10, X);

draw(r);
draw("$x$",O--X,Arrow3);
draw("$y$",O--Y,Arrow3);
draw("$z$",O--Z,Arrow3);

label(XY()*(scale(2.5)*"This is not a cylinder"), (-5,0,1), align=Z);

Étiquettes : , , , ,


Official Asymptote example – cones

Category: Asymptote,Official Gallery One-PagerPh. Ivaldi @ 22 h 57 min

Figure 0032
(Compiled with Asymptote version 2.14svn-r5318)
/* This code comes from The Official Asymptote Gallery */
    
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,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,render);
draw(cone,5,blue);

Étiquettes : , ,


Official Asymptote example – cylinder

Category: Asymptote,Official Gallery One-PagerPh. Ivaldi @ 7 h 57 min

Figure 0043
(Compiled with Asymptote version 2.14svn-r5318)
/* This code comes from The Official Asymptote Gallery */
    
import solids;

size(0,100);
currentlight=Viewport;

revolution r=cylinder(O,1,1.5,Y+Z);
draw(surface(r),green,render(merge=true));
draw(r,blue);

Étiquettes : , ,


Official Asymptote example – cylinderskeleton

Category: Asymptote,Official Gallery One-PagerPh. Ivaldi @ 8 h 57 min

Figure 0044
(Compiled with Asymptote version 2.14svn-r5318)
/* This code comes from The Official Asymptote Gallery */
    
import solids;

size(0,100);

revolution r=cylinder(O,1,1.5,Y+Z);
draw(r,heavygreen);

Étiquettes : , ,


Official Asymptote example – hyperboloid

Category: Asymptote,Official Gallery One-PagerPh. Ivaldi @ 2 h 57 min

Figure 0093
(Compiled with Asymptote version 2.14svn-r5318)
/* This code comes from The Official Asymptote Gallery */
    
size(200);
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,render(compression=Low,merge=true));
draw(hyperboloid,6,blue,longitudinalpen=nullpen);

Étiquettes : , , ,


Official Asymptote example – hyperboloidsilhouette

Category: Asymptote,Official Gallery One-PagerPh. Ivaldi @ 3 h 57 min

Figure 0094
(Compiled with Asymptote version 2.14svn-r5318)
/* This code comes from The Official Asymptote Gallery */
    
size(200);
import solids;
settings.render=0;
settings.prc=false;

currentprojection=perspective(4,4,3);
revolution hyperboloid=revolution(new real(real x) {return sqrt(1+x*x);},
                                  -2,2,20,operator..,X);
draw(hyperboloid.silhouette(64),blue);

Étiquettes : , , ,


Official Asymptote example – projectrevolution

Category: Asymptote,Official Gallery One-PagerPh. Ivaldi @ 0 h 57 min

Figure 0175
(Compiled with Asymptote version 2.14svn-r5318)
/* This code comes from The Official Asymptote Gallery */
    
import solids; 
import palette; 
 
currentprojection=orthographic(20,0,3); 
 
size(400,300,IgnoreAspect); 
 
revolution r=revolution(new real(real x) {return sin(x)*exp(-x/2);},
                          0,2pi,operator ..,Z); 
surface s=surface(r); 
 
surface S=planeproject(shift(-Z)*unitsquare3)*s;
S.colors(palette(s.map(zpart),Rainbow()));

render render=render(compression=Low,merge=true);
draw(S,render);
draw(s,lightgray,render); 

Étiquettes : , , , , , , ,


Official Asymptote example – sacone3D

Category: Asymptote,Official Gallery One-PagerPh. Ivaldi @ 8 h 57 min

Figure 0187
(Compiled with Asymptote version 2.14svn-r5318)
/* This code comes from The Official Asymptote Gallery */
    
import solids;

size(0,75);
real r=1;
real h=1;

revolution R=cone(r,h);

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);
draw((0,0,0)--(0,0,h),red+dashed);
dot(h*Z);

Étiquettes : , ,


Official Asymptote example – sacylinder3D

Category: Asymptote,Official Gallery One-PagerPh. Ivaldi @ 10 h 57 min

Figure 0189
(Compiled with Asymptote version 2.14svn-r5318)
/* This code comes from The Official Asymptote Gallery */
    
import solids;
size(0,100);

real r=1;
real h=3;

revolution R=cylinder(-h/2*Z,r,h);
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));
draw("$L$",(0,r,-h/2)--(0,r,h/2),W,black);
draw("$r$",(0,0,-h/2)--(0,r,-h/2),red);
draw(arc(O,1,90,90,90,0),red,Arrow3);

Étiquettes : , , ,


Official Asymptote example – shellmethod

Category: Asymptote,Official Gallery One-PagerPh. Ivaldi @ 17 h 57 min

Figure 0197
(Compiled with Asymptote version 2.14svn-r5318)
/* This code comes from The Official Asymptote Gallery */
    
import graph3;
import solids;

size(400);
currentprojection=perspective(0,-1,30,up=Y);
currentlight=light(gray(0.75),(0.25,-0.25,1),(0,1,0));

pen color=green;
real alpha=240;

real f(real x) {return 2x^2-x^3;}
pair F(real x) {return (x,f(x));}
triple F3(real x) {return (x,f(x),0);}

int n=10;
path3[] blocks=new path3[n];
for(int i=1; i <= n; ++i) {
  real height=f((i-0.5)*2/n);
  real left=(i-1)*2/n;
  real right=i*2/n;
  blocks[i-1]=
    (left,0,0)--(left,height,0)--(right,height,0)--(right,0,0)--cycle;
}

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,render);
draw(rotate(alpha,Y)*s,color,render);
for(int i=0; i < n; ++i)
  draw(surface(blocks[i]),color+opacity(0.5),black,render);
draw(p3);

xaxis3(Label("$x$",1,align=2X),Arrow3);
yaxis3(Label("$y$",1,align=2Y),ymax=1.4,dashed,Arrow3);
arrow("$y=2x^2-x^3$",XYplane(F(1.8)),X+Z,1.5cm,red,Arrow3(DefaultHead2));
draw(arc(1.17Y,0.3,90,0,7.5,180),ArcArrow3);

Étiquettes : , , , ,


Official Asymptote example – shellsqrtx01

Category: Asymptote,Official Gallery One-PagerPh. Ivaldi @ 18 h 57 min

Figure 0198
(Compiled with Asymptote version 2.14svn-r5318)
/* This code comes from The Official Asymptote Gallery */
    
import graph3;
import solids;
size(0,150);
currentprojection=orthographic(1,0,10,up=Y);
pen color=green;
real alpha=-240;

real f(real x) {return sqrt(x);}
pair F(real x) {return (x,f(x));}
triple F3(real x) {return (x,f(x),0);}

path p=graph(F,0,1,n=30,operator ..)--(1,0)--cycle;
path3 p3=path3(p);

revolution a=revolution(p3,X,alpha,0);

render render=render(compression=0,merge=true);
draw(surface(a),color,render);
draw(p3,blue);

surface s=surface(p);
draw(s,color,render);
draw(rotate(alpha,X)*s,color,render);

xaxis3(Label("$x$",1),xmax=1.25,dashed,Arrow3);
yaxis3(Label("$y$",1),Arrow3);

dot("$(1,1)$",(1,1,0));
arrow("$y=\sqrt{x}$",F3(0.8),Y,0.75cm,red);

real r=0.4;
draw(F3(r)--(1,f(r),0),red);
real x=(1+r)/2;

draw("$r$",(x,0,0)--(x,f(r),0),X+0.2Z,red,Arrow3,PenMargin3);
draw(arc(1.1X,0.4,90,90,3,-90),Arrow3);

Étiquettes : , , , ,


Official Asymptote example – spheresilhouette

Category: Asymptote,Official Gallery One-PagerPh. Ivaldi @ 3 h 57 min

Figure 0211
(Compiled with Asymptote version 2.14svn-r5318)
/* This code comes from The Official Asymptote Gallery */
    
import solids;
settings.render=0;
settings.prc=false;

size(200);

revolution r=sphere(O,1);
draw(r,1,longitudinalpen=nullpen);
draw(r.silhouette());

Étiquettes : , , , ,


Official Asymptote example – sphereskeleton

Category: Asymptote,Official Gallery One-PagerPh. Ivaldi @ 4 h 57 min

Figure 0212
(Compiled with Asymptote version 2.14svn-r5318)
/* This code comes from The Official Asymptote Gallery */
    
size(100); 
import solids; 

currentprojection=orthographic(5,4,2);

revolution sphere=sphere(1); 
draw(surface(sphere),green+opacity(0.2));
draw(sphere,m=7,blue);


Étiquettes : , , , ,


Official Asymptote example – sqrtx01

Category: Asymptote,Official Gallery One-PagerPh. Ivaldi @ 12 h 57 min

Figure 0220
(Compiled with Asymptote version 2.14svn-r5318)
/* This code comes from The Official Asymptote Gallery */
    
import graph3;
import solids;
size(0,150);
currentprojection=perspective(1.5,0,10,Y);
pen color=green+opacity(0.75);

real f(real x){return sqrt(x);}
pair F(real x){return (x,f(x));}
triple F3(real x){return (x,f(x),0);}

path p=graph(F,0,1,n=20,operator ..);
path3 p3=path3(p);

revolution a=revolution(p3,X,0,360);
draw(surface(a),color,render(compression=Low,merge=true));
draw(p3,blue);

real x=relpoint(p,0.5).x;

xaxis3(Label("$x$",1),xmax=1.5,dashed,Arrow3);
yaxis3(Label("$y$",1),Arrow3);
dot(Label("$(1,1)$"),(1,1,0));
arrow(Label("$y=\sqrt{x}$"),F3(0.7),Y,0.75cm,red);
draw(arc(1.2X,0.4,90,90,175,-40,CW),Arrow3);
draw("$r$",(x,0,0)--F3(x),red,Arrow3,PenMargin3);

Étiquettes : , , , ,


Official Asymptote example – sqrtx01y1

Category: Asymptote,Official Gallery One-PagerPh. Ivaldi @ 13 h 57 min

Figure 0221
(Compiled with Asymptote version 2.14svn-r5318)
/* This code comes from The Official Asymptote Gallery */
    
import graph3;
import solids;
size(0,150);
currentprojection=perspective(0,1,10,up=Y);
currentlight=White;

real f(real x) {return sqrt(x);}
pair F(real x) {return (x,f(x));}
triple F3(real x) {return (x,f(x),0);}

path p=graph(F,0,1,n=25,operator ..);
path3 p3=path3(p);

revolution a=revolution(p3,Y,0,360);
draw(surface(a),green,render(compression=Low,merge=true));
draw(p3,blue);

xtick((0,0,0));
xtick((1,0,0));

xaxis3(Label("$x$",1),Arrow3);
yaxis3(Label("$y$",1),ymax=1.5,dashed,Arrow3);
dot(Label("$(1,1)$"),(1,1,0));
arrow("$y=\sqrt{x}$",F3(0.5),X,0.75cm,red);
draw(arc(1.2Y,0.3,90,0,7.5,140),Arrow3);

Étiquettes : , , , ,


Official Asymptote example – washermethod

Category: Asymptote,Official Gallery One-PagerPh. Ivaldi @ 22 h 57 min

Figure 0258
(Compiled with Asymptote version 2.14svn-r5318)
/* This code comes from The Official Asymptote Gallery */
    
import graph3;
import solids;
size(0,150);
currentprojection=perspective(0,0,11,up=Y);

pen color1=green+opacity(0.25);
pen color2=red;
real alpha=250;

real f(real x) {return 2x^2-x^3;}
pair F(real x) {return (x,f(x));}
triple F3(real x) {return (x,f(x),0);}

ngraph=12;

real x1=0.7476;
real x2=1.7787;
real x3=1.8043;

path[] p={graph(F,x1,x2,Spline),
          graph(F,0.7,x1,Spline)--graph(F,x2,x3,Spline),
          graph(F,0,0.7,Spline)--graph(F,x3,2,Spline)};

pen[] pn=new pen[] {color1,color2,color1};

render render=render(compression=0);

for(int i=0; i < p.length; ++i) {
  revolution a=revolution(path3(p[i]),Y,0,alpha);
  draw(surface(a),pn[i],render);

  surface s=surface(p[i]--cycle);
  draw(s,pn[i],render);
  draw(rotate(alpha,Y)*s,pn[i],render);
}

draw((4/3,0,0)--F3(4/3),dashed);
xtick("$\frac{4}{3}$",(4/3,0,0));

xaxis3(Label("$x$",1),Arrow3);
yaxis3(Label("$y$",1),ymax=1.25,dashed,Arrow3);
arrow("$y=2x^2-x^3$",F3(1.6),X+Y,0.75cm,red);
draw(arc(1.1Y,0.3,90,0,7.5,180),Arrow3);

Étiquettes : , , , ,


Official Asymptote example – wedge

Category: Asymptote,Official Gallery One-PagerPh. Ivaldi @ 23 h 57 min

Figure 0259
(Compiled with Asymptote version 2.14svn-r5318)
/* This code comes from The Official Asymptote Gallery */
    
import graph3;
import solids;
size(0,150);
currentprojection=perspective(8,10,2);
currentlight=White;

draw(circle(O,4,Z));
draw(shift(-4Z)*scale(4,4,8)*unitcylinder,green+opacity(0.2));

triple F(real x){return (x,sqrt(16-x^2),sqrt((16-x^2)/3));}
path3 p=graph(F,0,4,operator ..);
path3 q=reverse(p)--rotate(180,(0,4,4/sqrt(3)))*p--cycle;

render render=render(merge=true);
draw(surface(q--cycle),red,render);

real t=2;
path3 triangle=(t,0,0)--(t,sqrt(16-t^2),0)--F(t)--cycle;
draw(surface(triangle),blue,render);

xaxis3("$x$",Arrow3,PenMargin3(0,0.25));
yaxis3("$y$",Arrow3,PenMargin3(0,0.25));
zaxis3("$z$",dashed,Arrow3);

Étiquettes : , , , ,


Official Asymptote example – workcone

Category: Asymptote,Official Gallery One-PagerPh. Ivaldi @ 1 h 57 min

Figure 0261
(Compiled with Asymptote version 2.14svn-r5318)
/* This code comes from The Official Asymptote Gallery */
    
import solids;
size(0,150);
currentprojection=orthographic(0,-30,5);

real r=4;
real h=10;
real s=8;
real x=r*s/h;

real sr=5;
real xr=r*sr/h;

real s1=sr-0.1;
real x1=r*s1/h;

real s2=sr+0.2;
real x2=r*s2/h;

render render=render(compression=0,merge=true);

path3 p=(0,0,0)--(x,0,s);
revolution a=revolution(p,Z);
draw(surface(a,4),lightblue+opacity(0.5),render);

path3 q=(x,0,s)--(r,0,h);
revolution b=revolution(q,Z);
draw(surface(b),white+opacity(0.5),render);

draw((-r-1,0,0)--(r+1,0,0));
draw((0,0,0)--(0,0,h+1),dashed);

path3 w=(x1,0,s1)--(x2,0,s2)--(0,0,s2);
revolution b=revolution(w,Z);
draw(surface(b),blue+opacity(0.5),render);
draw(circle((0,0,s2),x2));
draw(circle((0,0,s1),x1));

draw("$x$",(xr,0,0)--(xr,0,sr),red,Arrow3,PenMargin3);
draw("$r$",(0,0,sr)--(xr,0,sr),N,red);
draw((string) r,(0,0,h)--(r,0,h),N,red);
draw((string) h,(r,0,0)--(r,0,h),red,Arrow3,PenMargin3);
draw((string) s,(-x,0,0)--(-x,0,s),W,red,Arrow3,Bar3,PenMargin3);

Étiquettes : , ,


Official Asymptote example – xxsq01

Category: Asymptote,Official Gallery One-PagerPh. Ivaldi @ 3 h 57 min

Figure 0265
(Compiled with Asymptote version 2.14svn-r5318)
/* This code comes from The Official Asymptote Gallery */
    
import graph3;
import solids;
size(0,150);
currentprojection=perspective(0,0,10,up=Y);

pen color=green;
real alpha=250;

real f(real x) {return x^2;}
pair F(real x) {return (x,f(x));}
triple F3(real x) {return (x,f(x),0);}

path p=graph(F,0,1,n=10,operator ..)--cycle;
path3 p3=path3(p);

revolution a=revolution(p3,X,-alpha,0);
render render=render(compression=0,merge=true);
draw(surface(a),color,render);
surface s=surface(p);
draw(s,color,render);
draw(rotate(-alpha,X)*s,color,render);

draw(p3,blue);

xaxis3(Label("$x$",1),xmax=1.25,dashed,Arrow3);
yaxis3(Label("$y$",1),Arrow3);
dot(Label("$(1,1)$"),(1,1,0),X+Y);
arrow("$y=x$",(0.7,0.7,0),Y,0.75cm,red);
arrow("$y=x^2$",F3(0.7),X,0.75cm,red);
draw(arc(1.1X,0.3,90,90,3,-90),Arrow3);

Étiquettes : , , , ,


Official Asymptote example – xxsq01x-1

Category: Asymptote,Official Gallery One-PagerPh. Ivaldi @ 4 h 57 min

Figure 0266
(Compiled with Asymptote version 2.14svn-r5318)
/* This code comes from The Official Asymptote Gallery */
    
import graph3;
import solids;
size(300);
currentprojection=perspective(0,2,10,up=Y);
currentlight=Viewport;

pen color=green;

real f(real x) {return x^2;}
pair F(real x) {return (x,f(x));}
triple F3(real x) {return (x,f(x),0);}

path p=graph(F,0,1,n=10,operator ..)--cycle;
path3 p3=path3(p);

revolution a=revolution(-X,p3,Y,0,180);
render render=render(merge=true);
draw(surface(a),color);
surface s=surface(p);
draw(s,color);
transform3 t=shift(-2X)*rotate(180,Y);
draw(t*s,color);
draw(p3);
draw(t*p3);

draw((-1,0,0)--(-1,1,0),dashed);
xaxis3(Label("$x$",1),Arrow3);
yaxis3(Label("$y$",1),Arrow3);
dot(Label("$(1,1)$"),(1,1,0));
dot(Label("$(-1,1)$"),(-1,1,0),W);
arrow("$y=x^{2}$",F3(0.7),X,1cm,red); 
arrow("$y=x$",(0.3,0.3,0),X,1.5cm,red); 
draw(circle((-1,1,0),2,Y),dashed);
draw((-1,1,0)--(1,1,0),dashed);
draw(shift(-X)*arc(0.02Y,0.3,90,0,0,0,CW),Arrow3);

Étiquettes : , , , ,


Official Asymptote example – xxsq01y

Category: Asymptote,Official Gallery One-PagerPh. Ivaldi @ 5 h 57 min

Figure 0267
(Compiled with Asymptote version 2.14svn-r5318)
/* This code comes from The Official Asymptote Gallery */
    
import solids;
size(0,150);
currentprojection=perspective(0,0,10,up=Y);
pen color=green;
real alpha=240;

real f(real x) {return x^2;}
pair F(real x) {return (x,f(x));}
triple F3(real x) {return (x,f(x),0);}

path p=graph(F,0,1,n=10,operator ..)--cycle;
path3 p3=path3(p);

render render=render(compression=0,merge=true);

draw(surface(revolution(p3,Y,0,alpha)),color,render);

surface s=surface(p);
draw(s,color,render);
draw(rotate(alpha,Y)*s,color,render);

draw(p3,blue);

xaxis3(Label("$x$",1),Arrow3);
yaxis3(Label("$y$",1),ymax=1.25,dashed,Arrow3);

dot("$(1,1)$",(1,1,0),X);
arrow("$y=x^{2}$",F3(0.7),X,0.75cm,red); 
arrow("$y=x$",(0.8,0.8,0),Y,1cm,red); 

real r=0.4;
draw((r,f(r),0)--(r,r,0),red);
draw("$r$",(0,(f(r)+r)*0.5,0)--(r,(f(r)+r)*0.5,0),N,red,Arrows3,PenMargins3);
draw(arc(1.1Y,0.3,90,0,7.5,180),Arrow3);

Étiquettes : , , , ,