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 – fig0060

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

Figure 0006
(Compiled with Asymptote version 2.14svn-r5318)
    
// Author: John Bowman
import three;
size(6cm,0);
currentprojection=perspective(10,100,50);
real a=2.5;

draw(scale3(a)*unitsphere,lightyellow);
draw(align(unit(currentprojection.vector()))*scale3(a)*unitcircle3,2bp+red);

Étiquettes : , , ,


Asymptote using solids.asy – fig0070

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

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

surface s=surface(sphere(1,n=10));

material[] p={material(0.8*red,yellow,red,blue), invisible, 0.8*(red+blue) , invisible, 0.8*blue};
p.cyclic=true;
draw(s,p);

Étiquettes : , , ,


Asymptote using solids.asy – fig0080

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

Figure 0008
(Compiled with Asymptote version 2.14svn-r5318)
    
import solids;
import palette;
size(14cm,0);
currentlight=light(gray(0.4),specularfactor=3,viewport=false,
                   (-0.5,-0.25,0.45),
                   (0.5,-0.5,0.5),(0.5,0.5,0.75));

nslice=4*nslice;
surface s=surface(sphere(O,1));
draw(s,lightgrey);

path3 pl=plane((1,0,0),(0,1,0),(0,0,-1));
surface pls=shift(3,3,-1e-3)*scale(-6,-6,1)*surface(pl);
draw(pls,0.7*red);

real dist(triple z){return abs(z-Z);}

surface shade;
for (int i=0; i < currentlight.position.length; ++i) {
  shade=planeproject(pl,currentlight.position[i])*s;
  draw(shade,mean(palette((shade.map(dist)),
                          Gradient(black,gray(0.6)))),
       nolight);
}

É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 : , , , ,


Asymptote using solids.asy – fig0140

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

Figure 0014
(Compiled with Asymptote version 2.14svn-r5318)
    
/*
Author: Jens Schwaiger	
With its pleasant authorization.
*/

size(10cm,0);
import bsp;

currentprojection=perspective(10,3,-2);
guide achteck=polygon(8);
real lge=length(point(achteck,1)-point(achteck,0));
int n=8;
face[] faces;
guide3[] sq;
guide3[] tr;
triple a,b,c,d;

a=(point(achteck,0).x,point(achteck,0).y,-lge/2);
b=(point(achteck,1).x,point(achteck,1).y,-lge/2);
c=(point(achteck,1).x,point(achteck,1).y,lge/2);
d=(point(achteck,0).x,point(achteck,0).y,lge/2);

sq[0]=a--b--c--d--cycle;
for(int i=1;i<n;i=i+1) sq[i]=rotate(45*i,Z)*sq[0];
for(int i=0;i<3;i=i+1) sq[n+i]=rotate(90,Y)*sq[i];
for(int i=4;i<7;i=i+1) sq[n-1+i]=rotate(90,Y)*sq[i];
for(int i=2;i<3;i=i+1) sq[12+i]=rotate(90,X)*sq[i];
sq[14]=rotate(90,X)*sq[2];
sq[15]=rotate(90,X)*sq[4];
sq[16]=rotate(90,X)*sq[6];
sq[17]=rotate(90,X)*sq[0];

tr[0]=point(sq[2],3)--point(sq[2],2)--point(sq[14],1)--cycle;
for(int i=1;i<4;i=i+1) tr[i]=rotate(90*i,Z)*tr[0];
tr[4]=reverse(point(sq[2],0)--point(sq[2],1)--point(sq[9],2)--cycle);
for(int i=5;i<8;i=i+1) tr[i]=rotate(90*(i-4),Z)*tr[4];

real hgtsq=3;
triple[][][] pyrsq=new triple[18][4][3];
path3[] pyrsqfc=new path3[4*18];
int nofface=0;
for(int i=0;i<18;i=i+1){
  triple cog=0.5(point(sq[i],0)+point(sq[i],2));
  triple sp=cog+
    hgtsq*unit(cross(point(sq[i],1)-point(sq[i],0),point(sq[i],3)-point(sq[i],0))); 
  for(int j=0;j<3;j=j+1){
    pyrsq[i][j][0]=point(sq[i],j);
    pyrsq[i][j][1]=point(sq[i],j+1);
    pyrsq[i][j][2]=sp;
    pyrsqfc[nofface]=pyrsq[i][j][0]--pyrsq[i][j][1]--pyrsq[i][j][2]--cycle;
    nofface=nofface+1;
  }
  pyrsq[i][3][0]=point(sq[i],3);
  pyrsq[i][3][1]=point(sq[i],0);
  pyrsq[i][3][2]=sp;    
  pyrsqfc[nofface]=pyrsq[i][3][0]--pyrsq[i][3][1]--pyrsq[i][3][2]--cycle;
  nofface=nofface+1;
 }

for(int i=0;i<18*4;i=i+1) faces.push(pyrsqfc[i]);
for(int i=0;i<18*4;i=i+1) filldraw(faces[i],project(pyrsqfc[i]),yellow,black+2.5bp);

path3[] pyrtrfc=new path3[3*8];
real hgttr=2;
int nuoftr=0;

for(int i=0;i<8;i=i+1){
  triple cog=(1/3)*(point(tr[i],0)+point(tr[i],1)+point(tr[i],2));
  triple sp=cog+hgttr*unit(cross(point(tr[i],1)-point(tr[i],0),point(tr[i],2)-point(tr[i],0)));
  pyrtrfc[nuoftr]=point(tr[i],0)--point(tr[i],1)--sp--cycle;
  pyrtrfc[nuoftr+1]=point(tr[i],1)--point(tr[i],2)--sp--cycle;
  pyrtrfc[nuoftr+2]=point(tr[i],2)--point(tr[i],0)--sp--cycle;
  nuoftr=nuoftr+3;
 }

for(int j=0;j<24;j=j+1) faces.push(pyrtrfc[j]);
for(int j=0;j<24;j=j+1) filldraw(faces[4*18+j],project(pyrtrfc[j]),orange+yellow,black+2bp);

add(faces);
shipout(defaultfilename,bbox(0.2cm,black,RadialShade(paleblue,darkblue)));

Étiquettes : , ,


Asymptote using solids.asy – fig0150

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

Figure 0015
(Compiled with Asymptote version 2.14svn-r5318)
    
/*
Author: Jens Schwaiger
With its pleasant authorization.
*/
// PRC/OpenGL version

size(10cm,0);
import graph3;

currentprojection=orthographic(10,3,-2);
// currentlight=nolight;

guide achteck=polygon(8);
real lge=length(point(achteck,1)-point(achteck,0));
int n=8;
guide3[] sq;
guide3[] tr;
triple a,b,c,d;

a=(point(achteck,0).x,point(achteck,0).y,-lge/2);
b=(point(achteck,1).x,point(achteck,1).y,-lge/2);
c=(point(achteck,1).x,point(achteck,1).y,lge/2);
d=(point(achteck,0).x,point(achteck,0).y,lge/2);

sq[0]=a--b--c--d--cycle;
for(int i=1;i<n;i=i+1) sq[i]=rotate(45*i,Z)*sq[0];
for(int i=0;i<3;i=i+1) sq[n+i]=rotate(90,Y)*sq[i];
for(int i=4;i<7;i=i+1) sq[n-1+i]=rotate(90,Y)*sq[i];
for(int i=2;i<3;i=i+1) sq[12+i]=rotate(90,X)*sq[i];
sq[14]=rotate(90,X)*sq[2];
sq[15]=rotate(90,X)*sq[4];
sq[16]=rotate(90,X)*sq[6];
sq[17]=rotate(90,X)*sq[0];

tr[0]=point(sq[2],3)--point(sq[2],2)--point(sq[14],1)--cycle;
for(int i=1;i<4;i=i+1) tr[i]=rotate(90*i,Z)*tr[0];
tr[4]=reverse(point(sq[2],0)--point(sq[2],1)--point(sq[9],2)--cycle);
for(int i=5;i<8;i=i+1) tr[i]=rotate(90*(i-4),Z)*tr[4];

real hgtsq=3;
triple[][][] pyrsq=new triple[18][4][3];
path3[] pyrsqfc=new path3[4*18];
int nofface=0;
for(int i=0;i<18;i=i+1){
  triple cog=0.5(point(sq[i],0)+point(sq[i],2));
  triple sp=cog+
    hgtsq*unit(cross(point(sq[i],1)-point(sq[i],0),point(sq[i],3)-point(sq[i],0)));
  for(int j=0;j<3;j=j+1){
    pyrsq[i][j][0]=point(sq[i],j);
    pyrsq[i][j][1]=point(sq[i],j+1);
    pyrsq[i][j][2]=sp;
    pyrsqfc[nofface]=pyrsq[i][j][0]--pyrsq[i][j][1]--pyrsq[i][j][2]--cycle;
    nofface=nofface+1;
  }
  pyrsq[i][3][0]=point(sq[i],3);
  pyrsq[i][3][1]=point(sq[i],0);
  pyrsq[i][3][2]=sp;
  pyrsqfc[nofface]=pyrsq[i][3][0]--pyrsq[i][3][1]--pyrsq[i][3][2]--cycle;
  nofface=nofface+1;
 }

for(int i=0;i<18*4;i=i+1)
  draw(surface(pyrsqfc[i]),yellow,black+2.5bp);

path3[] pyrtrfc=new path3[3*8];
real hgttr=2;
int nuoftr=0;

for(int i=0;i<8;i=i+1){
  triple cog=(1/3)*(point(tr[i],0)+point(tr[i],1)+point(tr[i],2));
  triple sp=cog+hgttr*unit(cross(point(tr[i],1)-point(tr[i],0),point(tr[i],2)-point(tr[i],0)));
  pyrtrfc[nuoftr]=point(tr[i],0)--point(tr[i],1)--sp--cycle;
  pyrtrfc[nuoftr+1]=point(tr[i],1)--point(tr[i],2)--sp--cycle;
  pyrtrfc[nuoftr+2]=point(tr[i],2)--point(tr[i],0)--sp--cycle;
  nuoftr=nuoftr+3;
 }

for(int j=0;j<24;j=j+1)
  draw(surface(pyrtrfc[j]),orange+yellow,black+2bp);

Étiquettes : , ,


Unofficial package polyhedron_js.asy – fig0010

Category: Asymptote,polyhedron_js.asy,Unofficial packagesPh. Ivaldi @ 23 h 46 min

Figure 0001
(Compiled with Asymptote version 2.14svn-r5318)
    
import polyhedron_js;

// comment the following line for OpenGl
// settings.render=0;

settings.tex="pdflatex";
settings.outformat="pdf"; // for opacity

polyhedron pyramid;
real sq2=sqrt(2)/2;
pyramid[0]=(-sq2,-sq2,0)--(-sq2,sq2,0)--(sq2,sq2,0)--(sq2,-sq2,0)--cycle;
pyramid[1]=(sq2,-sq2,0)--(sq2,sq2,0)--(0,0,1)--cycle;
pyramid[2]=(sq2,sq2,0)--(-sq2,sq2,0)--(0,0,1)--cycle;
pyramid[3]=(-sq2,sq2,0)--(-sq2,-sq2,0)--(0,0,1)--cycle;
pyramid[4]=(-sq2,-sq2,0)--(sq2,-sq2,0)--(0,0,1)--cycle;
size(10cm);
polyhedron[] parr={pyramid};
filldraw(parr,new pen[]{0.8green},op=0.9);

if(!is3D())
  shipout(bbox(3mm,darkblue+3bp+miterjoin,FillDraw(paleblue))); 

Étiquettes : ,


Unofficial package polyhedron_js.asy – fig0020

Category: Asymptote,polyhedron_js.asy,Unofficial packagesPh. Ivaldi @ 0 h 46 min

Figure 0002
(Compiled with Asymptote version 2.14svn-r5318)
    
//Author Jens Schwaiger.
import polyhedron_js;

// comment the following line for OpenGl
settings.render=0;

settings.tex="pdflatex";
settings.outformat="pdf"; // for opacity

size(10cm);

// currentprojection=perspective(7,6,4); //if you want perspectivic look
currentprojection=orthographic(1,0.5,0.5); //if you want othographic look
currentlight=(1,1,2);
// currentlight=nolight;

polyhedron[] parr={cube};
filldraw(parr,new pen[]{0.8green},op=0.9);

if(!is3D()) {
  label("Cube",point(S),align=3S);
  shipout(bbox(3mm,darkblue+3bp+miterjoin,FillDraw(paleblue)));
}

Étiquettes : ,


Unofficial package polyhedron_js.asy – fig0030

Category: Asymptote,polyhedron_js.asy,Unofficial packagesPh. Ivaldi @ 1 h 46 min

Figure 0003
(Compiled with Asymptote version 2.14svn-r5318)
    
//Author Jens Schwaiger.
import polyhedron_js;

// comment the following line for OpenGl
settings.render=0;

settings.tex="pdflatex";
settings.outformat="pdf"; // for opacity

size(10cm);

// currentprojection=perspective(7,6,4); //if you want perspectivic look
currentprojection=orthographic(1,0.5,0.5); //if you want othographic look
currentlight=(1,1,2);
// currentlight=nolight;

polyhedron[] parr={tetrahedron};
filldraw(parr,new pen[]{0.8green},op=0.9);

if(!is3D()) {
  label("Tetrahedron",point(S),align=3S);
  shipout(bbox(3mm,darkblue+3bp+miterjoin,FillDraw(paleblue)));
}

Étiquettes : ,


Unofficial package polyhedron_js.asy – fig0040

Category: Asymptote,polyhedron_js.asy,Unofficial packagesPh. Ivaldi @ 2 h 46 min

Figure 0004
(Compiled with Asymptote version 2.14svn-r5318)
    
//Author Jens Schwaiger.
import polyhedron_js;

// comment the following line for OpenGl
settings.render=0;

settings.tex="pdflatex";
settings.outformat="pdf"; // for opacity

size(10cm);

// currentprojection=perspective(7,6,4); //if you want perspectivic look
currentprojection=orthographic(1,0.5,1); //if you want othographic look
currentlight=(1,1,2);
// currentlight=nolight;

polyhedron[] parr={dodecahedron};
filldraw(parr,new pen[]{0.8green},op=0.9);

if(!is3D()) {
  label("Dodecahedron",point(S),align=3S);
  shipout(bbox(3mm,darkblue+3bp+miterjoin,FillDraw(paleblue)));
}

Étiquettes : ,


Unofficial package polyhedron_js.asy – fig0050

Category: Asymptote,polyhedron_js.asy,Unofficial packagesPh. Ivaldi @ 3 h 46 min

Figure 0005
(Compiled with Asymptote version 2.14svn-r5318)
    
//Author Jens Schwaiger.
import polyhedron_js;

// comment the following line for OpenGl
settings.render=0;

settings.tex="pdflatex";
settings.outformat="pdf"; // for opacity

size(10cm);

// currentprojection=perspective(7,6,4); //if you want perspectivic look
currentprojection=orthographic(1,0.5,1); //if you want othographic look
currentlight=(1,1,2);
// currentlight=nolight;

polyhedron[] parr={icosahedron};
filldraw(parr,new pen[]{0.8green},op=0.9);

if(!is3D()) {
  label("Icosahedron",point(S),align=3S);
  shipout(bbox(3mm,darkblue+3bp+miterjoin,FillDraw(paleblue)));
}

Étiquettes : ,


Unofficial package polyhedron_js.asy – fig0060

Category: Asymptote,polyhedron_js.asy,Unofficial packagesPh. Ivaldi @ 4 h 46 min

Figure 0006
(Compiled with Asymptote version 2.14svn-r5318)
    
//Author Jens Schwaiger.
import polyhedron_js;

// comment the following line for OpenGl
settings.render=0;

settings.tex="pdflatex";
settings.outformat="pdf"; // for opacity

size(10cm);

// currentprojection=perspective(7,6,4); //if you want perspectivic look
currentprojection=orthographic(1,0.5,1); //if you want othographic look
currentlight=(1,1,2);
// currentlight=nolight;

polyhedron[] parr={octahedron};
filldraw(parr,new pen[]{0.8green},op=0.9);

if(!is3D()) {
  label("Octahedron",point(S),align=3S);
  shipout(bbox(3mm,darkblue+3bp+miterjoin,FillDraw(paleblue)));
}

Étiquettes : ,


Unofficial package polyhedron_js.asy – fig0070

Category: Asymptote,polyhedron_js.asy,Unofficial packagesPh. Ivaldi @ 5 h 46 min

Figure 0007
(Compiled with Asymptote version 2.14svn-r5318)
    
//Author Jens Schwaiger.
import polyhedron_js;

// comment the following line for OpenGl
settings.render=0;

settings.tex="pdflatex";
settings.outformat="pdf"; // for opacity

currentprojection=orthographic(0.5,0.5,0.5); //if you want othographic look

size(16cm);

polyhedron Plane;
Plane[0]=(-2,-2,-1.5)--(2.5,-2,-1.5)--(2.5,2.5,-1.5)--(-2,2.5,-1.5)--cycle;
Plane[1]=(-2,-2,-1.5)--(-2,2.5,-1.5)--(-2,2.5,0)--(-2,-2,0)--cycle;

pen[] drawcol={black+1bp};
pen[] fcol1={0.8*red,0.8*blue,0.8*green,orange,heavycyan,gray};

triple[] posofsolids;
for(int i=0;i<5;++i) posofsolids[i]=(1.7*cos(2pi/5*i)+1,1.7*sin(2pi/5*i)+1,0);
polyhedron[] parr={ shift(posofsolids[0])*icosahedron,
                    shift(posofsolids[1])*dodecahedron,
                    shift(posofsolids[2])*cube,
                    shift(posofsolids[3])*rotate(45,Z)*octahedron,
                    shift(posofsolids[4])*rotate(90,Z)*tetrahedron,
                    Plane };

filldraw(parr,fcol=fcol1,dcol=drawcol,op=0.9);

if(!is3D()) {
  shipout(bbox(3mm,darkblue+3bp+miterjoin,FillDraw(paleblue)));
}

Étiquettes : ,


Unofficial package polyhedron_js.asy – fig0080

Category: Asymptote,polyhedron_js.asy,Unofficial packagesPh. Ivaldi @ 6 h 46 min

Figure 0008
(Compiled with Asymptote version 2.14svn-r5318)
    
//Author Jens Schwaiger.
import polyhedron_js;

// comment the following line for OpenGl
settings.render=0;

settings.tex="pdflatex";
settings.outformat="pdf"; // for opacity

size(10cm);

// currentprojection=perspective(7,6,4); //if you want perspectivic look
currentprojection=orthographic(1,1,0.5); //if you want othographic look
currentlight=(1,1,2);
// currentlight=nolight;

polyhedron[] parr={truncTetraRight};
filldraw(parr,new pen[]{0.8green},op=0.9);

if(!is3D()) {
  label("truncTetraRight",point(S),align=3S);
  shipout(bbox(3mm,darkblue+3bp+miterjoin,FillDraw(paleblue)));
}

Étiquettes : ,


Unofficial package polyhedron_js.asy – fig0090

Category: Asymptote,polyhedron_js.asy,Unofficial packagesPh. Ivaldi @ 7 h 46 min

Figure 0009
(Compiled with Asymptote version 2.14svn-r5318)
    
//Author Jens Schwaiger.
import polyhedron_js;

// comment the following line for OpenGl
settings.render=0;

settings.tex="pdflatex";
settings.outformat="pdf"; // for opacity

size(10cm);

// currentprojection=perspective(7,6,4); //if you want perspectivic look
currentprojection=orthographic(1,1,0.5); //if you want othographic look
currentlight=(1,1,2);
// currentlight=nolight;

polyhedron[] parr={cubooctahedron};
filldraw(parr,new pen[]{0.8green},op=0.9);

if(!is3D()) {
  label("cubooctahedron",point(S),align=3S);
  shipout(bbox(3mm,darkblue+3bp+miterjoin,FillDraw(paleblue)));
}

Étiquettes : ,


Unofficial package polyhedron_js.asy – fig0100

Category: Asymptote,polyhedron_js.asy,Unofficial packagesPh. Ivaldi @ 8 h 46 min

Figure 0010
(Compiled with Asymptote version 2.14svn-r5318)
    
//Author Jens Schwaiger.
import polyhedron_js;

// comment the following line for OpenGl
settings.render=0;

settings.tex="pdflatex";
settings.outformat="pdf"; // for opacity

size(10cm);

// currentprojection=perspective(7,6,4); //if you want perspectivic look
currentprojection=orthographic(1,1,0.5); //if you want othographic look
currentlight=(1,1,2);
// currentlight=nolight;

polyhedron[] parr={truncCube};
filldraw(parr,new pen[]{0.8green},op=0.9);

if(!is3D()) {
  label("truncCube",point(S),align=3S);
  shipout(bbox(3mm,darkblue+3bp+miterjoin,FillDraw(paleblue)));
}

Étiquettes : ,


Unofficial package polyhedron_js.asy – fig0110

Category: Asymptote,polyhedron_js.asy,Unofficial packagesPh. Ivaldi @ 9 h 46 min

Figure 0011
(Compiled with Asymptote version 2.14svn-r5318)
    
//Author Jens Schwaiger.
import polyhedron_js;

// comment the following line for OpenGl
// settings.render=0;

settings.tex="pdflatex";
settings.outformat="pdf"; // for opacity

size(10cm);

// currentprojection=perspective(7,6,4); //if you want perspectivic look
currentprojection=orthographic(1,1,0.5); //if you want othographic look
currentlight=(1,1,2);
// currentlight=nolight;

polyhedron[] parr={truncOctahedron};
filldraw(parr,new pen[]{0.8green},op=0.9);

if(!is3D()) {
  label("truncOctahedron",point(S),align=3S);
  shipout(bbox(3mm,darkblue+3bp+miterjoin,FillDraw(paleblue)));
}

Étiquettes : ,


Unofficial package polyhedron_js.asy – fig0120

Category: Asymptote,polyhedron_js.asy,Unofficial packagesPh. Ivaldi @ 10 h 46 min

Figure 0012
(Compiled with Asymptote version 2.14svn-r5318)
    
//Author Jens Schwaiger.
import polyhedron_js;

// comment the following line for OpenGl
settings.render=0;

settings.tex="pdflatex";
settings.outformat="pdf"; // for opacity

size(10cm);

// currentprojection=perspective(7,6,4); //if you want perspectivic look
currentprojection=orthographic(1,1,0.5); //if you want othographic look
currentlight=(1,1,2);
// currentlight=nolight;

polyhedron[] parr={rhombiCuboocta};
filldraw(parr,new pen[]{0.8green},op=0.9);

if(!is3D()) {
  label("rhombiCuboocta",point(S),align=3S);
  shipout(bbox(3mm,darkblue+3bp+miterjoin,FillDraw(paleblue)));
}

Étiquettes : ,


Unofficial package polyhedron_js.asy – fig0130

Category: Asymptote,polyhedron_js.asy,Unofficial packagesPh. Ivaldi @ 11 h 46 min

Figure 0013
(Compiled with Asymptote version 2.14svn-r5318)
    
//Author Jens Schwaiger.
import polyhedron_js;

// comment the following line for OpenGl
settings.render=0;

settings.tex="pdflatex";
settings.outformat="pdf"; // for opacity

size(10cm);

// currentprojection=perspective(7,6,4); //if you want perspectivic look
currentprojection=orthographic(1,1,0.5); //if you want othographic look
currentlight=(1,1,2);
// currentlight=nolight;

polyhedron[] parr={truncCuboocta};
filldraw(parr,new pen[]{0.8green},op=0.9);

if(!is3D()) {
  label("truncCuboocta",point(S),align=3S);
  shipout(bbox(3mm,darkblue+3bp+miterjoin,FillDraw(paleblue)));
}

Étiquettes : ,


Unofficial package polyhedron_js.asy – fig0140

Category: Asymptote,polyhedron_js.asy,Unofficial packagesPh. Ivaldi @ 12 h 46 min

Figure 0014
(Compiled with Asymptote version 2.14svn-r5318)
    
//Author Jens Schwaiger.
import polyhedron_js;

// comment the following line for OpenGl
settings.render=0;

settings.tex="pdflatex";
settings.outformat="pdf"; // for opacity

size(10cm);

// currentprojection=perspective(7,6,4); //if you want perspectivic look
currentprojection=orthographic(1,1,0.5); //if you want othographic look
currentlight=(1,1,2);
// currentlight=nolight;

polyhedron[] parr={snubCubeRight};
filldraw(parr,new pen[]{0.8green},op=0.9);

if(!is3D()) {
  label("snubCubeRight",point(S),align=3S);
  shipout(bbox(3mm,darkblue+3bp+miterjoin,FillDraw(paleblue)));
}

Étiquettes : ,


Unofficial package polyhedron_js.asy – fig0150

Category: Asymptote,polyhedron_js.asy,Unofficial packagesPh. Ivaldi @ 13 h 46 min

Figure 0015
(Compiled with Asymptote version 2.14svn-r5318)
    
//Author Jens Schwaiger.
import polyhedron_js;

// comment the following line for OpenGl
settings.render=0;

settings.tex="pdflatex";
settings.outformat="pdf"; // for opacity

size(10cm);

// currentprojection=perspective(7,6,4); //if you want perspectivic look
currentprojection=orthographic(1,1,0.5); //if you want othographic look
currentlight=(1,1,2);
// currentlight=nolight;

polyhedron[] parr={snubCubeLeft};
filldraw(parr,new pen[]{0.8green},op=0.9);

if(!is3D()) {
  label("snubCubeLeft",point(S),align=3S);
  shipout(bbox(3mm,darkblue+3bp+miterjoin,FillDraw(paleblue)));
}

Étiquettes : ,


Unofficial package polyhedron_js.asy – fig0160

Category: Asymptote,polyhedron_js.asy,Unofficial packagesPh. Ivaldi @ 14 h 46 min

Figure 0016
(Compiled with Asymptote version 2.14svn-r5318)
    
//Author Jens Schwaiger.
import polyhedron_js;

// comment the following line for OpenGl
settings.render=0;

settings.tex="pdflatex";
settings.outformat="pdf"; // for opacity

size(10cm);

// currentprojection=perspective(7,6,4); //if you want perspectivic look
currentprojection=orthographic(1,1,0.5); //if you want othographic look
currentlight=(1,1,2);
// currentlight=nolight;

polyhedron[] parr={icosDod};
filldraw(parr,new pen[]{0.8green},op=0.9);

if(!is3D()) {
  label("icosDod",point(S),align=3S);
  shipout(bbox(3mm,darkblue+3bp+miterjoin,FillDraw(paleblue)));
}

Étiquettes : ,


Unofficial package polyhedron_js.asy – fig0170

Category: Asymptote,polyhedron_js.asy,Unofficial packagesPh. Ivaldi @ 15 h 46 min

Figure 0017
(Compiled with Asymptote version 2.14svn-r5318)
    
//Author Jens Schwaiger.
import polyhedron_js;

// comment the following line for OpenGl
settings.render=0;

settings.tex="pdflatex";
settings.outformat="pdf"; // for opacity

size(10cm);

// currentprojection=perspective(7,6,4); //if you want perspectivic look
currentprojection=orthographic(1,1,0.5); //if you want othographic look
currentlight=(1,1,2);
// currentlight=nolight;

polyhedron[] parr={truncateDodeca};
filldraw(parr,new pen[]{0.8green},op=0.9);

if(!is3D()) {
  label("truncateDodeca",point(S),align=3S);
  shipout(bbox(3mm,darkblue+3bp+miterjoin,FillDraw(paleblue)));
}

Étiquettes : ,


Unofficial package polyhedron_js.asy – fig0180

Category: Asymptote,polyhedron_js.asy,Unofficial packagesPh. Ivaldi @ 16 h 46 min

Figure 0018
(Compiled with Asymptote version 2.14svn-r5318)
    
//Author Jens Schwaiger.
import polyhedron_js;

// comment the following line for OpenGl
settings.render=0;

settings.tex="pdflatex";
settings.outformat="pdf"; // for opacity

size(10cm);

// currentprojection=perspective(7,6,4); //if you want perspectivic look
currentprojection=orthographic(1,1,0.5); //if you want othographic look
currentlight=(1,1,2);
// currentlight=nolight;

polyhedron[] parr={truncIcos};
filldraw(parr,new pen[]{0.8green},op=0.9);

if(!is3D()) {
  label("truncIcos",point(S),align=3S);
  shipout(bbox(3mm,darkblue+3bp+miterjoin,FillDraw(paleblue)));
}

Étiquettes : ,


Unofficial package polyhedron_js.asy – fig0190

Category: Asymptote,polyhedron_js.asy,Unofficial packagesPh. Ivaldi @ 17 h 46 min

Figure 0019
(Compiled with Asymptote version 2.14svn-r5318)
    
//Author Jens Schwaiger.
import polyhedron_js;

// comment the following line for OpenGl
settings.render=0;

settings.tex="pdflatex";
settings.outformat="pdf"; // for opacity

size(10cm);

// currentprojection=perspective(7,6,4); //if you want perspectivic look
currentprojection=orthographic(1,1,0.5); //if you want othographic look
currentlight=(1,1,2);
// currentlight=nolight;

polyhedron[] parr={rhombicosDodec};
filldraw(parr,new pen[]{0.8green},op=0.9);

if(!is3D()) {
  label("rhombicosDodec",point(S),align=3S);
  shipout(bbox(3mm,darkblue+3bp+miterjoin,FillDraw(paleblue)));
}

Étiquettes : ,


Unofficial package polyhedron_js.asy – fig0200

Category: Asymptote,polyhedron_js.asy,Unofficial packagesPh. Ivaldi @ 18 h 46 min

Figure 0020
(Compiled with Asymptote version 2.14svn-r5318)
    
//Author Jens Schwaiger.
import polyhedron_js;

// comment the following line for OpenGl
settings.render=0;

settings.tex="pdflatex";
settings.outformat="pdf"; // for opacity

size(10cm);

// currentprojection=perspective(7,6,4); //if you want perspectivic look
currentprojection=orthographic(1,1,0.5); //if you want othographic look
currentlight=(1,1,2);
// currentlight=nolight;

polyhedron[] parr={snbDdcleft};
filldraw(parr,new pen[]{0.8green},op=0.9);

if(!is3D()) {
  label("snbDdcleft",point(S),align=3S);
  shipout(bbox(3mm,darkblue+3bp+miterjoin,FillDraw(paleblue)));
}

Étiquettes : ,


Unofficial package polyhedron_js.asy – fig0210

Category: Asymptote,polyhedron_js.asy,Unofficial packagesPh. Ivaldi @ 19 h 46 min

Figure 0021
(Compiled with Asymptote version 2.14svn-r5318)
    
//Author Jens Schwaiger.
import polyhedron_js;

// comment the following line for OpenGl
settings.render=0;

settings.tex="pdflatex";
settings.outformat="pdf"; // for opacity

size(10cm);

// currentprojection=perspective(7,6,4); //if you want perspectivic look
currentprojection=orthographic(1,1,0.5); //if you want othographic look
currentlight=(1,1,2);
// currentlight=nolight;

polyhedron[] parr={snbDdcright};
filldraw(parr,new pen[]{0.8green},op=0.9);

if(!is3D()) {
  label("snbDdcright",point(S),align=3S);
  shipout(bbox(3mm,darkblue+3bp+miterjoin,FillDraw(paleblue)));
}

Étiquettes : ,


Unofficial package polyhedron_js.asy – fig0220

Category: Asymptote,polyhedron_js.asy,Unofficial packagesPh. Ivaldi @ 20 h 46 min

Figure 0022
(Compiled with Asymptote version 2.14svn-r5318)
    
//Author Jens Schwaiger.
import polyhedron_js;

// comment the following line for OpenGl
settings.render=0;

settings.tex="pdflatex";
settings.outformat="pdf"; // for opacity

size(10cm);

// currentprojection=perspective(7,6,4); //if you want perspectivic look
currentprojection=orthographic(1,1,0.5); //if you want othographic look
currentlight=(1,1,2);
// currentlight=nolight;

polyhedron[] parr={greatRhombicosDodec};
filldraw(parr,new pen[]{0.8green},op=0.9);

if(!is3D()) {
  label("greatRhombicosDodec",point(S),align=3S);
  shipout(bbox(3mm,darkblue+3bp+miterjoin,FillDraw(paleblue)));
}

Étiquettes : ,


Unofficial package tube_js.asy – fig0010

Category: Asymptote,tube_js.asy,Unofficial packagesPh. Ivaldi @ 22 h 03 min

Figure 0001
(Compiled with Asymptote version 2.14svn-r5318)
    
/* Author: Jens Schwaiger */
settings.render=0;
import tube_js;

size(10cm,0);
currentprojection=perspective(4,3,4);
real x(real t) {return (1/sqrt(1+0.5*t^2))*cos(2pi*t);}
real y(real t) {return (1/sqrt(1+0.5*t^2))*sin(2pi*t);}
real z(real t) {return 0.9*t;}

path3 p=graph(x,y,z,0,2.7,Spline);

draw(spacetube(p,100,16), orange, 1bp+black);

Étiquettes : ,


Unofficial package tube_js.asy – fig0020

Category: Asymptote,tube_js.asy,Unofficial packagesPh. Ivaldi @ 23 h 03 min

Figure 0002
(Compiled with Asymptote version 2.14svn-r5318)
    
/* Author: Jens Schwaiger */
settings.render=0;
import tube_js;

size(10cm,0);
currentprojection=perspective(4,3,4);

guide3 p=roundedguide((1,0,0)--(0,0,0)--(0,0,1)--(0,1,1)--cycle,.4);
p=rotate(30,Y)*p;

guide cs(real s){return scale(0.15)*unitsquare;};

draw(spacetube(p,120,32,cs), lightblue, black);

Étiquettes : ,


Unofficial package tube_js.asy – fig0030

Category: Asymptote,tube_js.asy,Unofficial packagesPh. Ivaldi @ 0 h 03 min

Figure 0003
(Compiled with Asymptote version 2.14svn-r5318)
    
/* Author: Jens Schwaiger */
settings.render=0;
import tube_js;

size(10cm,0);
currentprojection=perspective(4,3,4);
currentlight=(0,0.10,1.3);

real x(real t) {return (1/sqrt(1+0.5*t^2))*cos(2pi*t);}
real y(real t) {return (1/sqrt(1+0.5*t^2))*sin(2pi*t);}
real z(real t) {return 0.9*t;}
path3 p=graph(x,y,z,1,2.7,Spline);

guide cs(real u)
{
  int m=-6;
  real x(real t){ return (1+1/m)*cos(t)-(1/m)*(0.7(1-u))*cos((1+m)*t);};
  real y(real t){ return (1+1/m)*sin(t)-(1/m)*(0.7(1-u))*sin((1+m)*t);};
  return scale(0.25)*(graph(x,y,0,2pi)..cycle);
}

draw(spacetube(p,120,24,cs,cover=true,twist=0), orange,black);

if(!is3D())
  shipout(defaultfilename,bbox(0.2cm,black,RadialShade(white,paleblue)));

Étiquettes : ,


Unofficial package tube_js.asy – fig0040

Category: Asymptote,tube_js.asy,Unofficial packagesPh. Ivaldi @ 1 h 03 min

Figure 0004
(Compiled with Asymptote version 2.14svn-r5318)
    
// settings.render=0;
import tube_js;

size(10cm,0);
currentprojection=orthographic(0,0,1);

real x(real t) {return cos(t)+2*cos(2*t);}
real y(real t) {return sin(t)-2*sin(2*t);}
real z(real t) {return 2*sin(3t);}

path3 p=scale3(4)*graph(x,y,z,0,2*pi,Spline)--cycle;
guide arc=graph(x,y,0,2*pi)--cycle;
guide cs(real s){return arc;};

draw(spacetube(p,200,100,cs,twist=0), 0.8*blue, invisible);

if(!is3D())
  shipout(bbox(0.2cm,black,RadialShade(white,paleblue)));

É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 – cube

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

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

currentprojection=orthographic(5,4,2,center=true);

size(5cm);
size3(3cm,5cm,8cm);

draw(unitbox);

dot(unitbox,red);

label("$O$",(0,0,0),NW);
label("(1,0,0)",(1,0,0),S);
label("(0,1,0)",(0,1,0),E);
label("(0,0,1)",(0,0,1),Z);

É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 – galleon

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

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

size(15cm);
currentprojection=orthographic(0,2,5,up=Y);

// A compressed version of the required data file may be obtained from:
// http://www.cs.technion.ac.il/~irit/data/Viewpoint/galleon.obj.gz

pen[] surfacepen={darkred,brown,darkred+orange,heavyred,heavyred,darkred+orange,
                  palegreen+blue+lightgrey,darkred,darkred,yellow,darkred,white,
                  white,white,white,white,white};
surfacepen.cyclic=true;

draw(obj("galleon.obj",verbose=false,surfacepen));

É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 – label3solid

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

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

currentprojection=perspective(100,100,200,up=Y);

draw(scale3(4)*extrude("$\displaystyle\int_{-\infty}^{+\infty}
e^{-\alpha x^2}\,dx=\sqrt{\frac{\pi}{\alpha}}$",2Z),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 – soccerball

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

Figure 0208
(Compiled with Asymptote version 2.14svn-r5318)
/* This code comes from The Official Asymptote Gallery */
    
import graph3; 
size(400); 
currentlight.background=palegreen;

defaultrender=render(compression=Zero,merge=true);

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[][] Q={
  {z[0],y[1],x[3],x[0],y[0],z[3]},
  {z[1],x[0],x[3],y[2],z[2],y[3]},
  {z[2],z[1],y[2],x[2],x[1],y[3]},
  {z[3],z[0],y[0],x[1],x[2],y[1]},
  {x[0],x[3],z[1],y[3],y[0],z[0]},
  {x[1],x[2],z[2],y[3],y[0],z[3]},
  {x[2],x[1],z[3],y[1],y[2],z[2]},
  {x[3],x[0],z[0],y[1],y[2],z[1]},
  {y[0],y[3],x[1],z[3],z[0],x[0]},
  {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))); 
 
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; 
  } 
} 
 
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); 
  triple tri(pair p) {
    path3 cr=arc(O,relpoint(tri2,p.x),relpoint(tri3,p.x)); 
    return relpoint(cr,p.y); 
  }; 
 
  return surface(tri,(0,0),(1-sqrtEpsilon,1),nu,nv,Spline); 
} 
 
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; 
  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); 
  } 
} 
 
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)); 
    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); 
    } 
  } 
}

Étiquettes : , , , , , ,


Official Asymptote example – sphere

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

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

size(200);
currentprojection=orthographic(5,4,3);

draw(unitsphere,green,render(compression=Zero,merge=true));

É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 – teapot

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

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

size(20cm);

currentprojection=perspective(250,-250,250);
currentlight=Viewport;

triple[][][] Q={
  {
    {(39.68504,0,68.0315),(37.91339,0,71.75197),(40.74803,0,71.75197),(42.51969,0,68.0315)},
    {(39.68504,-22.22362,68.0315),(37.91339,-21.2315,71.75197),(40.74803,-22.8189,71.75197),(42.51969,-23.81102,68.0315)},
    {(22.22362,-39.68504,68.0315),(21.2315,-37.91339,71.75197),(22.8189,-40.74803,71.75197),(23.81102,-42.51969,68.0315)},
    {(0,-39.68504,68.0315),(0,-37.91339,71.75197),(0,-40.74803,71.75197),(0,-42.51969,68.0315)}
  },{
    {(0,-39.68504,68.0315),(0,-37.91339,71.75197),(0,-40.74803,71.75197),(0,-42.51969,68.0315)},
    {(-22.22362,-39.68504,68.0315),(-21.2315,-37.91339,71.75197),(-22.8189,-40.74803,71.75197),(-23.81102,-42.51969,68.0315)},
    {(-39.68504,-22.22362,68.0315),(-37.91339,-21.2315,71.75197),(-40.74803,-22.8189,71.75197),(-42.51969,-23.81102,68.0315)},
    {(-39.68504,0,68.0315),(-37.91339,0,71.75197),(-40.74803,0,71.75197),(-42.51969,0,68.0315)}
  },{
    {(-39.68504,0,68.0315),(-37.91339,0,71.75197),(-40.74803,0,71.75197),(-42.51969,0,68.0315)},
    {(-39.68504,22.22362,68.0315),(-37.91339,21.2315,71.75197),(-40.74803,22.8189,71.75197),(-42.51969,23.81102,68.0315)},
    {(-22.22362,39.68504,68.0315),(-21.2315,37.91339,71.75197),(-22.8189,40.74803,71.75197),(-23.81102,42.51969,68.0315)},
    {(0,39.68504,68.0315),(0,37.91339,71.75197),(0,40.74803,71.75197),(0,42.51969,68.0315)}
  },{
    {(0,39.68504,68.0315),(0,37.91339,71.75197),(0,40.74803,71.75197),(0,42.51969,68.0315)},
    {(22.22362,39.68504,68.0315),(21.2315,37.91339,71.75197),(22.8189,40.74803,71.75197),(23.81102,42.51969,68.0315)},
    {(39.68504,22.22362,68.0315),(37.91339,21.2315,71.75197),(40.74803,22.8189,71.75197),(42.51969,23.81102,68.0315)},
    {(39.68504,0,68.0315),(37.91339,0,71.75197),(40.74803,0,71.75197),(42.51969,0,68.0315)}
  },{
    {(42.51969,0,68.0315),(49.60629,0,53.1496),(56.69291,0,38.26771),(56.69291,0,25.51181)},
    {(42.51969,-23.81102,68.0315),(49.60629,-27.77952,53.1496),(56.69291,-31.74803,38.26771),(56.69291,-31.74803,25.51181)},
    {(23.81102,-42.51969,68.0315),(27.77952,-49.60629,53.1496),(31.74803,-56.69291,38.26771),(31.74803,-56.69291,25.51181)},
    {(0,-42.51969,68.0315),(0,-49.60629,53.1496),(0,-56.69291,38.26771),(0,-56.69291,25.51181)}
  },{
    {(0,-42.51969,68.0315),(0,-49.60629,53.1496),(0,-56.69291,38.26771),(0,-56.69291,25.51181)},
    {(-23.81102,-42.51969,68.0315),(-27.77952,-49.60629,53.1496),(-31.74803,-56.69291,38.26771),(-31.74803,-56.69291,25.51181)},
    {(-42.51969,-23.81102,68.0315),(-49.60629,-27.77952,53.1496),(-56.69291,-31.74803,38.26771),(-56.69291,-31.74803,25.51181)},
    {(-42.51969,0,68.0315),(-49.60629,0,53.1496),(-56.69291,0,38.26771),(-56.69291,0,25.51181)}
  },{
    {(-42.51969,0,68.0315),(-49.60629,0,53.1496),(-56.69291,0,38.26771),(-56.69291,0,25.51181)},
    {(-42.51969,23.81102,68.0315),(-49.60629,27.77952,53.1496),(-56.69291,31.74803,38.26771),(-56.69291,31.74803,25.51181)},
    {(-23.81102,42.51969,68.0315),(-27.77952,49.60629,53.1496),(-31.74803,56.69291,38.26771),(-31.74803,56.69291,25.51181)},
    {(0,42.51969,68.0315),(0,49.60629,53.1496),(0,56.69291,38.26771),(0,56.69291,25.51181)}
  },{
    {(0,42.51969,68.0315),(0,49.60629,53.1496),(0,56.69291,38.26771),(0,56.69291,25.51181)},
    {(23.81102,42.51969,68.0315),(27.77952,49.60629,53.1496),(31.74803,56.69291,38.26771),(31.74803,56.69291,25.51181)},
    {(42.51969,23.81102,68.0315),(49.60629,27.77952,53.1496),(56.69291,31.74803,38.26771),(56.69291,31.74803,25.51181)},
    {(42.51969,0,68.0315),(49.60629,0,53.1496),(56.69291,0,38.26771),(56.69291,0,25.51181)}
  },{
    {(56.69291,0,25.51181),(56.69291,0,12.7559),(42.51969,0,6.377957),(42.51969,0,4.251961)},
    {(56.69291,-31.74803,25.51181),(56.69291,-31.74803,12.7559),(42.51969,-23.81102,6.377957),(42.51969,-23.81102,4.251961)},
    {(31.74803,-56.69291,25.51181),(31.74803,-56.69291,12.7559),(23.81102,-42.51969,6.377957),(23.81102,-42.51969,4.251961)},
    {(0,-56.69291,25.51181),(0,-56.69291,12.7559),(0,-42.51969,6.377957),(0,-42.51969,4.251961)}
  },{
    {(0,-56.69291,25.51181),(0,-56.69291,12.7559),(0,-42.51969,6.377957),(0,-42.51969,4.251961)},
    {(-31.74803,-56.69291,25.51181),(-31.74803,-56.69291,12.7559),(-23.81102,-42.51969,6.377957),(-23.81102,-42.51969,4.251961)},
    {(-56.69291,-31.74803,25.51181),(-56.69291,-31.74803,12.7559),(-42.51969,-23.81102,6.377957),(-42.51969,-23.81102,4.251961)},
    {(-56.69291,0,25.51181),(-56.69291,0,12.7559),(-42.51969,0,6.377957),(-42.51969,0,4.251961)}
  },{
    {(-56.69291,0,25.51181),(-56.69291,0,12.7559),(-42.51969,0,6.377957),(-42.51969,0,4.251961)},
    {(-56.69291,31.74803,25.51181),(-56.69291,31.74803,12.7559),(-42.51969,23.81102,6.377957),(-42.51969,23.81102,4.251961)},
    {(-31.74803,56.69291,25.51181),(-31.74803,56.69291,12.7559),(-23.81102,42.51969,6.377957),(-23.81102,42.51969,4.251961)},
    {(0,56.69291,25.51181),(0,56.69291,12.7559),(0,42.51969,6.377957),(0,42.51969,4.251961)}
  },{
    {(0,56.69291,25.51181),(0,56.69291,12.7559),(0,42.51969,6.377957),(0,42.51969,4.251961)},
    {(31.74803,56.69291,25.51181),(31.74803,56.69291,12.7559),(23.81102,42.51969,6.377957),(23.81102,42.51969,4.251961)},
    {(56.69291,31.74803,25.51181),(56.69291,31.74803,12.7559),(42.51969,23.81102,6.377957),(42.51969,23.81102,4.251961)},
    {(56.69291,0,25.51181),(56.69291,0,12.7559),(42.51969,0,6.377957),(42.51969,0,4.251961)}
  },{
    {(-45.35433,0,57.40157),(-65.19685,0,57.40157),(-76.53543,0,57.40157),(-76.53543,0,51.02362)},
    {(-45.35433,-8.503932,57.40157),(-65.19685,-8.503932,57.40157),(-76.53543,-8.503932,57.40157),(-76.53543,-8.503932,51.02362)},
    {(-42.51969,-8.503932,63.77952),(-70.86614,-8.503932,63.77952),(-85.03937,-8.503932,63.77952),(-85.03937,-8.503932,51.02362)},
    {(-42.51969,0,63.77952),(-70.86614,0,63.77952),(-85.03937,0,63.77952),(-85.03937,0,51.02362)}
  },{
    {(-42.51969,0,63.77952),(-70.86614,0,63.77952),(-85.03937,0,63.77952),(-85.03937,0,51.02362)},
    {(-42.51969,8.503932,63.77952),(-70.86614,8.503932,63.77952),(-85.03937,8.503932,63.77952),(-85.03937,8.503932,51.02362)},
    {(-45.35433,8.503932,57.40157),(-65.19685,8.503932,57.40157),(-76.53543,8.503932,57.40157),(-76.53543,8.503932,51.02362)},
    {(-45.35433,0,57.40157),(-65.19685,0,57.40157),(-76.53543,0,57.40157),(-76.53543,0,51.02362)}
  },{
    {(-76.53543,0,51.02362),(-76.53543,0,44.64566),(-70.86614,0,31.88976),(-56.69291,0,25.51181)},
    {(-76.53543,-8.503932,51.02362),(-76.53543,-8.503932,44.64566),(-70.86614,-8.503932,31.88976),(-56.69291,-8.503932,25.51181)},
    {(-85.03937,-8.503932,51.02362),(-85.03937,-8.503932,38.26771),(-75.11811,-8.503932,26.5748),(-53.85826,-8.503932,17.00787)},
    {(-85.03937,0,51.02362),(-85.03937,0,38.26771),(-75.11811,0,26.5748),(-53.85826,0,17.00787)}
  },{
    {(-85.03937,0,51.02362),(-85.03937,0,38.26771),(-75.11811,0,26.5748),(-53.85826,0,17.00787)},
    {(-85.03937,8.503932,51.02362),(-85.03937,8.503932,38.26771),(-75.11811,8.503932,26.5748),(-53.85826,8.503932,17.00787)},
    {(-76.53543,8.503932,51.02362),(-76.53543,8.503932,44.64566),(-70.86614,8.503932,31.88976),(-56.69291,8.503932,25.51181)},
    {(-76.53543,0,51.02362),(-76.53543,0,44.64566),(-70.86614,0,31.88976),(-56.69291,0,25.51181)}
  },{
    {(48.18897,0,40.3937),(73.70078,0,40.3937),(65.19685,0,59.52755),(76.53543,0,68.0315)},
    {(48.18897,-18.70866,40.3937),(73.70078,-18.70866,40.3937),(65.19685,-7.086619,59.52755),(76.53543,-7.086619,68.0315)},
    {(48.18897,-18.70866,17.00787),(87.87401,-18.70866,23.38582),(68.0315,-7.086619,57.40157),(93.5433,-7.086619,68.0315)},
    {(48.18897,0,17.00787),(87.87401,0,23.38582),(68.0315,0,57.40157),(93.5433,0,68.0315)}
  },{
    {(48.18897,0,17.00787),(87.87401,0,23.38582),(68.0315,0,57.40157),(93.5433,0,68.0315)},
    {(48.18897,18.70866,17.00787),(87.87401,18.70866,23.38582),(68.0315,7.086619,57.40157),(93.5433,7.086619,68.0315)},
    {(48.18897,18.70866,40.3937),(73.70078,18.70866,40.3937),(65.19685,7.086619,59.52755),(76.53543,7.086619,68.0315)},
    {(48.18897,0,40.3937),(73.70078,0,40.3937),(65.19685,0,59.52755),(76.53543,0,68.0315)}
  },{
    {(76.53543,0,68.0315),(79.37007,0,70.15748),(82.20472,0,70.15748),(79.37007,0,68.0315)},
    {(76.53543,-7.086619,68.0315),(79.37007,-7.086619,70.15748),(82.20472,-4.251961,70.15748),(79.37007,-4.251961,68.0315)},
    {(93.5433,-7.086619,68.0315),(99.92125,-7.086619,70.68897),(97.79527,-4.251961,71.22047),(90.70866,-4.251961,68.0315)},
    {(93.5433,0,68.0315),(99.92125,0,70.68897),(97.79527,0,71.22047),(90.70866,0,68.0315)}
  },{
    {(93.5433,0,68.0315),(99.92125,0,70.68897),(97.79527,0,71.22047),(90.70866,0,68.0315)},
    {(93.5433,7.086619,68.0315),(99.92125,7.086619,70.68897),(97.79527,4.251961,71.22047),(90.70866,4.251961,68.0315)},
    {(76.53543,7.086619,68.0315),(79.37007,7.086619,70.15748),(82.20472,4.251961,70.15748),(79.37007,4.251961,68.0315)},
    {(76.53543,0,68.0315),(79.37007,0,70.15748),(82.20472,0,70.15748),(79.37007,0,68.0315)}
  },{
    {(0,0,89.29133),(22.67716,0,89.29133),(0,0,80.7874),(5.669294,0,76.53543)},
    {(0,0,89.29133),(22.67716,-12.7559,89.29133),(0,0,80.7874),(5.669294,-3.174809,76.53543)},
    {(0,0,89.29133),(12.7559,-22.67716,89.29133),(0,0,80.7874),(3.174809,-5.669294,76.53543)},
    {(0,0,89.29133),(0,-22.67716,89.29133),(0,0,80.7874),(0,-5.669294,76.53543)}
  },{
    {(0,0,89.29133),(0,-22.67716,89.29133),(0,0,80.7874),(0,-5.669294,76.53543)},
    {(0,0,89.29133),(-12.7559,-22.67716,89.29133),(0,0,80.7874),(-3.174809,-5.669294,76.53543)},
    {(0,0,89.29133),(-22.67716,-12.7559,89.29133),(0,0,80.7874),(-5.669294,-3.174809,76.53543)},
    {(0,0,89.29133),(-22.67716,0,89.29133),(0,0,80.7874),(-5.669294,0,76.53543)}
  },{
    {(0,0,89.29133),(-22.67716,0,89.29133),(0,0,80.7874),(-5.669294,0,76.53543)},
    {(0,0,89.29133),(-22.67716,12.7559,89.29133),(0,0,80.7874),(-5.669294,3.174809,76.53543)},
    {(0,0,89.29133),(-12.7559,22.67716,89.29133),(0,0,80.7874),(-3.174809,5.669294,76.53543)},
    {(0,0,89.29133),(0,22.67716,89.29133),(0,0,80.7874),(0,5.669294,76.53543)}
  },{
    {(0,0,89.29133),(0,22.67716,89.29133),(0,0,80.7874),(0,5.669294,76.53543)},
    {(0,0,89.29133),(12.7559,22.67716,89.29133),(0,0,80.7874),(3.174809,5.669294,76.53543)},
    {(0,0,89.29133),(22.67716,12.7559,89.29133),(0,0,80.7874),(5.669294,3.174809,76.53543)},
    {(0,0,89.29133),(22.67716,0,89.29133),(0,0,80.7874),(5.669294,0,76.53543)}
  },{
    {(5.669294,0,76.53543),(11.33858,0,72.28346),(36.85039,0,72.28346),(36.85039,0,68.0315)},
    {(5.669294,-3.174809,76.53543),(11.33858,-6.349609,72.28346),(36.85039,-20.63622,72.28346),(36.85039,-20.63622,68.0315)},
    {(3.174809,-5.669294,76.53543),(6.349609,-11.33858,72.28346),(20.63622,-36.85039,72.28346),(20.63622,-36.85039,68.0315)},
    {(0,-5.669294,76.53543),(0,-11.33858,72.28346),(0,-36.85039,72.28346),(0,-36.85039,68.0315)}
  },{
    {(0,-5.669294,76.53543),(0,-11.33858,72.28346),(0,-36.85039,72.28346),(0,-36.85039,68.0315)},
    {(-3.174809,-5.669294,76.53543),(-6.349609,-11.33858,72.28346),(-20.63622,-36.85039,72.28346),(-20.63622,-36.85039,68.0315)},
    {(-5.669294,-3.174809,76.53543),(-11.33858,-6.349609,72.28346),(-36.85039,-20.63622,72.28346),(-36.85039,-20.63622,68.0315)},
    {(-5.669294,0,76.53543),(-11.33858,0,72.28346),(-36.85039,0,72.28346),(-36.85039,0,68.0315)},
  },{
    {(-5.669294,0,76.53543),(-11.33858,0,72.28346),(-36.85039,0,72.28346),(-36.85039,0,68.0315)},
    {(-5.669294,3.174809,76.53543),(-11.33858,6.349609,72.28346),(-36.85039,20.63622,72.28346),(-36.85039,20.63622,68.0315)},
    {(-3.174809,5.669294,76.53543),(-6.349609,11.33858,72.28346),(-20.63622,36.85039,72.28346),(-20.63622,36.85039,68.0315)},
    {(0,5.669294,76.53543),(0,11.33858,72.28346),(0,36.85039,72.28346),(0,36.85039,68.0315)}
  },{
    {(0,5.669294,76.53543),(0,11.33858,72.28346),(0,36.85039,72.28346),(0,36.85039,68.0315)},
    {(3.174809,5.669294,76.53543),(6.349609,11.33858,72.28346),(20.63622,36.85039,72.28346),(20.63622,36.85039,68.0315)},
    {(5.669294,3.174809,76.53543),(11.33858,6.349609,72.28346),(36.85039,20.63622,72.28346),(36.85039,20.63622,68.0315)},
    {(5.669294,0,76.53543),(11.33858,0,72.28346),(36.85039,0,72.28346),(36.85039,0,68.0315)},
  },{
    {(0,0,0),(40.3937,0,0),(42.51969,0,2.12598),(42.51969,0,4.251961)},
    {(0,0,0),(40.3937,22.62047,0),(42.51969,23.81102,2.12598),(42.51969,23.81102,4.251961)},
    {(0,0,0),(22.62047,40.3937,0),(23.81102,42.51969,2.12598),(23.81102,42.51969,4.251961)},
    {(0,0,0),(0,40.3937,0),(0,42.51969,2.12598),(0,42.51969,4.251961)}
  },{
    {(0,0,0),(0,40.3937,0),(0,42.51969,2.12598),(0,42.51969,4.251961)},
    {(0,0,0),(-22.62047,40.3937,0),(-23.81102,42.51969,2.12598),(-23.81102,42.51969,4.251961)},
    {(0,0,0),(-40.3937,22.62047,0),(-42.51969,23.81102,2.12598),(-42.51969,23.81102,4.251961)},
    {(0,0,0),(-40.3937,0,0),(-42.51969,0,2.12598),(-42.51969,0,4.251961)}
  },{
    {(0,0,0),(-40.3937,0,0),(-42.51969,0,2.12598),(-42.51969,0,4.251961)},
    {(0,0,0),(-40.3937,-22.62047,0),(-42.51969,-23.81102,2.12598),(-42.51969,-23.81102,4.251961)},
    {(0,0,0),(-22.62047,-40.3937,0),(-23.81102,-42.51969,2.12598),(-23.81102,-42.51969,4.251961)},
    {(0,0,0),(0,-40.3937,0),(0,-42.51969,2.12598),(0,-42.51969,4.251961)}
  },{
    {(0,0,0),(0,-40.3937,0),(0,-42.51969,2.12598),(0,-42.51969,4.251961)},
    {(0,0,0),(22.62047,-40.3937,0),(23.81102,-42.51969,2.12598),(23.81102,-42.51969,4.251961)},
    {(0,0,0),(40.3937,-22.62047,0),(42.51969,-23.81102,2.12598),(42.51969,-23.81102,4.251961)},
    {(0,0,0),(40.3937,0,0),(42.51969,0,2.12598),(42.51969,0,4.251961)}
  }
};

draw(surface(Q),blue,render(compression=Low));

Étiquettes : , , ,


Official Asymptote example – triceratops

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

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

size(15cm);
currentprojection=orthographic(0,2,5,up=Y);

// A compressed version of the required data file may be obtained from:
// http://www.cs.technion.ac.il/~irit/data/Viewpoint/triceratops.obj.gz

draw(obj("triceratops.obj",brown));

É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 : , , , ,


Animation with Asymptote – fig0060

Category: Animation,AsymptotePh. Ivaldi @ 13 h 20 min

Figure 0006
(Compiled with Asymptote version 1.86svn-r4626)
Movie flash (swf)
This animation is available in the Syracuse web site.
    
//Author Jens Schwaiger.
import polyhedron_js;
import animate;
settings.render=0;
settings.tex="pdflatex";
settings.outformat="pdf";

size(16cm);
currentprojection=perspective(5,4,2);
currentlight=(5,4,2);

polyhedron Plane;
Plane[0]=(-2,-2,-1.5)--(2.5,-2,-1.5)--(2.5,2.5,-1.5)--(-2,2.5,-1.5)--cycle;
Plane[1]=(-2,-2,-1.5)--(-2,2.5,-1.5)--(-2,2.5,0)--(-2,-2,0)--cycle;

int n=180;
pen[] drawcol={black+1bp};
pen[] fcol1={0.8*red,0.8*blue,0.8*green,orange,heavycyan,gray};

animation anim;

triple[] posofsolids;
real angle;
for(int janim=0; janim < n; ++janim){
  for(int i=0; i < 5; ++i) {
    angle=2pi/5*i+2pi*janim/n;
    posofsolids[i]=(1.7*cos(angle)+1,1.7*sin(angle)+1,0);
  }
  transform3 T=rotate(-degrees(2*angle),Z);
  polyhedron[] parr={ shift(posofsolids[0])*T*icosahedron,
                      shift(posofsolids[1])*T*dodecahedron,
                      shift(posofsolids[2])*T*cube,
                      shift(posofsolids[3])*T*rotate(45,Z)*octahedron,
                      shift(posofsolids[4])*T*rotate(90,Z)*tetrahedron,
                      Plane };

  save();
  filldraw(parr,fcol=fcol1,dcol=drawcol,op=0.9);
  anim.add();
  restore();
}

anim.movie(BBox(3mm,darkblue+3bp+miterjoin,FillDraw(paleblue)));

Étiquettes : , ,


Animation with Asymptote – fig0070

Category: Animation,AsymptotePh. Ivaldi @ 14 h 20 min

Figure 0007
(Compiled with Asymptote version 1.86svn-r4626)
Movie flash (swf)
This animation is available in the Syracuse web site.
    
import polyhedron_js;
import animation;

settings.tex="pdflatex";
settings.outformat="pdf"; // for opacity
settings.render=0;

animation A;
size(8cm);

// currentprojection=perspective(7,6,4); //if you want perspectivic look
currentprojection=orthographic(1,0.5,1); //if you want othographic look
currentlight=(1,1,2);
// currentlight=nolight;

int col=0;
pen[] fcol={palegreen+paleblue+lightgrey};
fcol.cyclic=true;

polyhedron[] parr;

for (int i=0; i < 360; i += 2) {
  parr[0]=rotate(i,Z)*rhombicosDodec;
  save();
  filldraw(parr,fcol,op=0.9);
  A.add();
  restore();
}

A.movie();

Étiquettes : , ,