Animation with Asymptote – fig0010

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

Figure 0001
(Compiled with Asymptote version 1.43)
Movie flash (swf)
This animation is available in the Syracuse web site.
    
import contour3;
import animate;
// settings.tex="pdflatex";
// settings.outformat="pdf";

size(10cm);
currentprojection=orthographic(15,8,10);
animation A;
A.global=false;

typedef real fct3(real,real,real);
fct3 F(real t)
{
  return new real(real x, real y, real z){return x^2+y^2-t*z^2+t-1;};
}

int n=15;
picture pic;
real tmin=0.1, tmax=2;
real step=(tmax-tmin)/n;
draw(box((-5,-5,-5),(5,5,5)));
for (int i=0; i < n; ++i) {
  save();
  draw(surface(contour3(F(tmin+i*step),(-5,-5,-5),(5,5,5),15)),lightblue);
  pic.erase();
  add(pic,bbox(5mm,FillDraw(lightyellow)));
  A.add(pic);
  restore();
}

A.movie();

Étiquettes : , , ,


Animation with Asymptote – fig0020

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

Figure 0002
(Compiled with Asymptote version 1.43)
Movie flash (swf)
This animation is available in the Syracuse web site.
    
import geometry;
import animate;
settings.tex="pdflatex";

animation A;
size(12cm);

for (int a=1; a < 20; ++a) {
  save();
  point P=(-4.5,0); dot(P);
  inversion inv=inversion(1,P);
  line l1=line((0,0),(-0.35,1)), l2=line((0,0),(0.35,1));
  path g1=inv*l1, g2=inv*l2;
  fill(g1^^g2,evenodd+lightgrey); draw(g1,linewidth(bp));
  draw(g2,linewidth(bp));

  for (int i:new int[]{-1,1}) {
    point P=(0,3i/a);
    triangle t=triangle(shift(P)*hline,l1,l2);
    int n=a;
    for (int j=0; j <= n; ++j) {
      circle C=excircle(t.AB);
      t=triangle(shift(angpoint(C,i*90))*hline,l1,l2);
      circle Cp=inv*C;
      path g=Cp;
      fill(g,0.95*yellow);
      draw(g,bp+red); draw(g,blue);
    }
  }
  picture pic;
  add(pic,bbox(5mm,Fill(rgb(0.95,0.95,0.8))));
  A.add(pic);
  restore();
}

A.pdf(keep=true);

Étiquettes : , ,


Animation with Asymptote – fig0030

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

Figure 0003
(Compiled with Asymptote version 1.43)
This animation is available in the Syracuse web site.
    
import geometry;
import animate;
animation A;

size(15cm);

int nAnim=75;
int nCircle=6;
real astep=360/nAnim;

inversion inv=inversion((-1,-2),1);
line L1=line(N,S);
circle C=inv*L1;
point center=C.C;

for (int i=-nAnim; i < nAnim; ++i) {
  real r;
  r=0.001+4*(i/nAnim)^2;
  line L2=shift(2*r*E)*L1;
  transform T=shift(0,-2*r);
  transform R=rotate(astep*i,center);
  circle C0=circle(r*E+nCircle/2*sqrt(r)*N,r);
  circle[] Ci=sequence(new circle(int i){return T^i*C0;}, nCircle);

  fill(R*(path)C, 0.3*blue);
  circle Cl=R*(inv*L2);
  transform dsh=shift(Cl.r/3*unit(center-Cl.C));
  radialshade((path)Cl,white,dsh*Cl.C,0,black,dsh*Cl.C,Cl.r);
  for (int i=0; i < Ci.length; ++i) {
    circle Ct=inv*Ci[i];
    transform dsh=shift(Ct.r/3*unit(center-Ct.C));
    radialshade(R*(path)Ct,red,dsh*R*Ct.C,0,black,dsh*R*Ct.C,Ct.r);
  }
  A.add();
  erase();
}

A.movie(BBox(2mm,Fill(black)));

Étiquettes : , ,


Animation with Asymptote – fig0040

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

Figure 0004
(Compiled with Asymptote version 1.43)
Movie flash (swf)
This animation is available in the Syracuse web site.
    
import geometry;
import animate;
settings.tex="pdflatex";
settings.outformat="pdf";

animation Anim;

size(10cm,0);

circle C=circle(origin,1);
draw(C);
point A=point(C,0), B, M;
guide locus;


for (real a=0.001; a < 360; a += 5) {
  save();
  B=angpoint(C,a);
  triangle t=triangle(origin,A,B);
  draw(t);
  draw(incircle(t), bp+0.8*blue);
  triangle intouch=intouch(t);
  draw(intouch, dot);
  M=intouch(t.AC);
  label("$N$", Label("$M$", 0.8*red), "$P$", intouch);
  dot(M, 0.8*red);
  locus=locus..M;
  draw(locus, bp+0.8*red);
  Anim.add();
  restore();
}

// Anim.movie();
Anim.pdf(keep=true);


Étiquettes : , , , ,


Animation with Asymptote – fig0050

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

Figure 0005
(Compiled with Asymptote version 1.43)
Movie flash (swf)
This animation is available in the Syracuse web site.
    
/* Author: Nathan Carter. */
include "./makecd.asy";
import animate;
// settings.tex="pdflatex";
settings.keep=true;

animation A;
A.global=false;

real length = 4; // seconds
int fps = 50;
real rad = 6;
real ht = 2;
real pixsz = 300;
real ptsz = 1;
int loops = 6;
pen border = black;

real frames = length*fps;
picture tmp;

size(pixsz);
for (int i=100 ; i < 100+frames ; ++i) {
  save();
  add(CayleyDiagram(nodeLocs, arrows, orders, arrowPens,
                    cam = (rad*cos(2*i*pi/frames),rad*sin(2*i*pi/frames),ht),
                    arrowThickness = 2, nodeSize = 0.02,
                    arrowMargin = 1mm, depthCueing = true ));
  draw(box((-ptsz/2,-ptsz/2), (ptsz/2,ptsz/2)), border);
  A.add();
  write( "Did " + (string)(i-99) + " out of " + (string)frames );
  restore();
}

write( "Merging..." );
A.movie(delay=(int)(100/fps));
write( "Done." );

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


Animation with Asymptote – fig0080

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

Figure 0008
(Compiled with Asymptote version 1.86svn-r4626)
This animation is available in the Syracuse web site.
    
import graph3;
import animation;
import solids;

settings.render=0;
animation A;
A.global=false;

int nbpts=500;
real q=2/5;
real pas=5*2*pi/nbpts;
int angle=3;
real R=3;

unitsize(1cm);

real x(real t){return R*cos(q*t)*cos(t);}
real y(real t){return R*cos(q*t)*sin(t);}
real z(real t){return R*sin(q*t);}

triple[] P;
real t=-pi;
for (int i=0; i<nbpts; ++i) {
  t+=pas;
  P.push((x(t),y(t),z(t)));
}

currentprojection=orthographic((0,5,2));
currentlight=(3,3,5);

pen p=rgb(0.1,0.1,0.58);
transform3 t=rotate(angle,(0,0,0),(1,0.25,0.25));

filldraw(box((-R-0.5,-R-0.5),(R+0.5,R+0.5)), p, 3mm+black+miterjoin);

revolution r=sphere(O,R);
draw(surface(r),p);

for (int phi=0; phi<360; phi+=angle) {
  bool[] back,front;
  save();

  for (int i=0; i<nbpts; ++i) {
    P[i]=t*P[i];
    bool test=dot(P[i],currentprojection.camera) > 0;
    front.push(test);
  }

  draw(segment(P,front,operator ..),linewidth(1mm));
  draw(segment(P,!front,operator ..),grey);
  A.add();
  restore();
}

A.movie(options="-density 350 -resample 96 -quality 100 -depth 8 -strip");

Étiquettes : , , , , , ,


Animation with Asymptote – fig0090

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

Figure 0009
(Compiled with Asymptote version 1.86svn-r4626)
    
size(0,10cm);
import graph3;
import animation;
import solids;

currentlight.background=black;
settings.render=0;
animation A;
A.global=false;

int nbpts=500;
real q=2/5;
real pas=5*2*pi/nbpts;
int angle=4;
real R=0.5;
pen p=rgb(0.1,0.1,0.58);
triple center=(1,1,1);
transform3 T=rotate(angle,center,center+X+0.25*Y+0.3*Z);

real x(real t){return center.x+R*cos(q*t)*cos(t);}
real y(real t){return center.y+R*cos(q*t)*sin(t);}
real z(real t){return center.z+R*sin(q*t);}

currentprojection=orthographic(1,1,1);
currentlight=(0,center.y-0.5,2*(center.z+R));

triple U=(center.x+1.1*R,0,0), V=(0,center.y+1.1*R,0);
path3 xy=plane(U,V,(0,0,0));
path3 xz=rotate(90,X)*xy;
path3 yz=rotate(-90,Y)*xy;

triple[] P;
path3 curve;
real t=-pi;
for (int i=0; i < nbpts; ++i) {
  t+=pas;
  triple M=(x(t),y(t),z(t));
  P.push(M);
  curve = curve..M;
}

curve=curve..cycle;

draw(surface(xy), grey);
draw(surface(xz), grey);
draw(surface(yz), grey);

triple xyc=(center.x,center.y,0);
path3 cle=shift(xyc)*scale3(R)*unitcircle3;
surface scle=surface(cle);
draw(scle, black);
draw(rotate(90,X)*scle, black);
draw(rotate(-90,Y)*scle, black);

draw(surface(sphere(center,R)), p);

triple vcam=1e5*currentprojection.camera-center;
for (int phi=0; phi<360; phi+=angle) {
  bool[] back,front;
  save();

  for (int i=0; i<nbpts; ++i) {
    P[i]=T*P[i];
    bool test=dot(P[i]-center,vcam) > 0;
    front.push(test);
  }

  curve=T*curve;
  draw(segment(P,front,operator ..), paleyellow);
  draw(segment(P,!front,operator ..),0.5*(paleyellow+p));
  draw((planeproject(xy)*curve)^^
       (planeproject(xz)*curve)^^
       (planeproject(yz)*curve), paleyellow);

  A.add();
  restore();
}

A.movie(options="-density 350 -resample 96 -quality 100 -depth 8 -strip");

Étiquettes : , , , , , , , ,


Animation with Asymptote – fig0100

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

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

settings.tex="pdflatex";
settings.outformat="pdf";

unitsize(x=2cm,y=1.5cm);

typedef real realfcn(real);

real lambda=4;
real T=2;
real [] k=new real[3];
real [] w=new real[3];
k[0]=2pi/lambda;
w[0]=2pi/T;
real dk=-.5;
k[1]=k[0]-dk;
k[2]=k[0]+dk;
real dw=1;
w[1]=w[0]-dw;
w[2]=w[0]+dw;

real vp=w[1]/k[1];
real vg=dw/dk;

realfcn F(real x) {
  return new real(real t) {
    return cos(k[1]*x-w[1]*t)+cos(k[2]*x-w[2]*t);
  };
};

realfcn G(real x) {
  return new real(real t) {
    return 2*cos(0.5*(k[2]-k[1])*x+0.5*(w[1]-w[2])*t);
  };
};

realfcn operator -(realfcn f) {return new real(real t) {return -f(t);};};

animation A;

real tmax=abs(2pi/dk);
real xmax=abs(2pi/dw);

pen envelope=0.8*blue;
pen fillpen=lightgrey;

int n=50;
real step=tmax/(n-1);
for(int i=0; i < n; ++i) {
  save();
  real t=i*step;
  real a=xmax*t/tmax-xmax/pi;
  real b=xmax*t/tmax;
  path f=graph(F(t),a,b);
  path g=graph(G(t),a,b);
  path h=graph(-G(t),a,b);
  fill(buildcycle(reverse(f),g),fillpen);
  draw(f);
  draw(g,envelope);
  draw(h,envelope);
  A.add();
  restore();
}

for(int i=0; i < n; ++i) {
  save();
  real t=i*step;
  real a=-xmax/pi;
  real b=xmax;
  path f=graph(F(t),a,b);
  path g=graph(G(t),a,b);
  path h=graph(-G(t),a,b);
  path B=box((-xmax/pi,-2),(xmax,2));
  fill(buildcycle(reverse(f),g,B),fillpen);
  fill(buildcycle(f,g,reverse(B)),fillpen);
  draw(f);
  draw(g,envelope);
  draw(h,envelope);
  A.add();
  restore();
}

A.movie();

Étiquettes : , , , ,


  • Page 1 of 2
  • 1
  • 2
  • >