## Asymptote Generalities – fig1370

Category: Asymptote,Examples 2D,GeneralitiesPh. Ivaldi @ 14 h 39 min

 (Compiled with Asymptote version 2.14svn-r5318)

size(0,0);

path cle=scale(2cm)*unitcircle;

draw(cle);

for(real i=0; i<=length(cle); i+=.2)
draw(point(cle,i)--2cm*dir(cle,i)+point(cle,i),Arrow,p=i/length(cle)*red);



Étiquettes : , , , , ,

## Asymptote Generalities – fig1380

Category: Asymptote,Examples 2D,GeneralitiesPh. Ivaldi @ 15 h 39 min

 (Compiled with Asymptote version 2.14svn-r5318)

size(0,0);

path cle=scale(2cm)*reverse(unitcircle);

draw(cle);

for(real i=0; i<=length(cle); i+=.2)
draw(point(cle,i)--2cm*dir(cle,i)+point(cle,i),Arrow,p=i/length(cle)*red);



Étiquettes : , , , , ,

## Asymptote Generalities – fig1390

Category: Asymptote,Examples 2D,GeneralitiesPh. Ivaldi @ 16 h 39 min

 (Compiled with Asymptote version 2.14svn-r5318)

size(8cm,0);
pair O=(0,0);
path p=(0,0){dir(0)}..{dir(45)}(2,2){dir(-45)}..{dir(0)}(4,0);

pair En1=dir(p, 1, -1);
pair En2=dir(p, 2, -1);
draw(p);
draw(Label("dir(p,1,-1)", EndPoint), point(p,1)--point(p,1)+En1, red, Arrow);
draw(Label("dir(p,2,-1)", EndPoint), point(p,2)--point(p,2)+En2, red, Arrow);

pair Ep0=dir(p, 0, 1);
pair Ep1=dir(p, 1, 1);
draw(Label("dir(p,0,1)", EndPoint), point(p,0)--point(p,0)+Ep0, blue, Arrow);
draw(Label("dir(p,1,1)", EndPoint, E), point(p,1)--point(p,1)+Ep1, blue, Arrow);

draw(p, dot);



Étiquettes : , , ,

## Asymptote Generalities – fig1420

Category: Asymptote,Examples 2D,GeneralitiesPh. Ivaldi @ 19 h 39 min

 (Compiled with Asymptote version 2.14svn-r5318)

size(6cm,0);

path curv=reverse((0,2){dir(-60)}..(1,0)..{dir(60)}(2,2));

draw(curv);

for(real i=0; i<=length(curv); i+=.1)
draw(point(curv,i)--dir(curv,i)+point(curv,i),grey);



Étiquettes : , , , ,

## Asymptote using geometry.asy – fig0440

Category: Asymptote,Examples 2D,geometry.asyPh. Ivaldi @ 1 h 02 min

 (Compiled with Asymptote version 2.14svn-r5318)

import geometry;
size(10cm,0);

// currentcoordsys=cartesiansystem((0,0),i=(1,0.25),j=(-0.5,.75));
show(currentcoordsys, xpen=invisible);

point A=(-1,-1);
point B=(0.75,0.5);
dot("$A$",A,NW,red);
dot("$B$",B,N,red);

circle c1=circle(A,1.5);
circle c2=circle(B,2);
draw(c1^^c2);

point[] inter=intersectionpoints(c1,c2);
dot("$M$", inter[0], 2NW, red);

/* View the definition of line tangent(circle,point) */
draw(tangent(c1,inter[0]), grey);
draw(tangent(c2,inter[0]), grey);

/* View the definition of line tangent(circle,abscissa) */
draw(tangent(c2,angabscissa(135)), grey);



Étiquettes : , , , ,

## Asymptote using geometry.asy – fig0460

Category: Asymptote,Examples 2D,geometry.asyPh. Ivaldi @ 3 h 02 min

 (Compiled with Asymptote version 2.14svn-r5318)

import geometry;
size(10cm,0);

// currentcoordsys=cartesiansystem((0,0),i=(1,0.5),j=(-0.5,.75));
show(currentcoordsys, xpen=invisible);

point A=(-1,-1);
point B=(0.75,0.5);
dot("$A$",A,NW,red);
dot("$B$",B,N,red);

ellipse el1=ellipse(A,2,1.5);
ellipse el2=ellipse(B,3,2);
draw(el1);
draw(el2,Arrow);

point[] inter=intersectionpoints(el1,el2);
dot("$M$", inter[0], 2NW, red);

/* View the definition of line[] tangents(ellipse,point) */
draw(tangents(el1,inter[0]), grey);
draw(tangents(el2,inter[0]), grey);

/* View the definition of line tangent(ellipse,abscissa) */
draw(tangent(el2,angabscissa(90)), grey);



Étiquettes : , , , , , ,

## Asymptote using geometry.asy – fig0470

Category: Asymptote,Examples 2D,geometry.asyPh. Ivaldi @ 4 h 02 min

 (Compiled with Asymptote version 2.14svn-r5318)

import geometry;
size(12cm);

// currentcoordsys=cartesiansystem((0,0),i=(1,0.5),j=(-0.5,.75));
// show(currentcoordsys, xpen=invisible);

point F1=(0,0);
dot("$F1$",F1,NW);
point F2=(-0.25,0.5);
dot("$F2$",F2,SE);

parabola p=parabola(F1, 0.1, 120);
draw(p, bp+red);

parabola pp=parabola(F2, 0.06, 280);
draw(pp, bp+blue);

abscissa x=angabscissa(180);
dot(point(p,x));
/* View the definition of line tangent(parabola,abscissa) */
draw(tangent(p,x), 0.8*red);

point[] P=intersectionpoints(p,pp);
dot(P);

/* View the definition of line[] tangents(parabola,point) */
draw(tangents(p,P[0]), 0.8*red);
draw(tangents(pp,P[0]), 0.8*blue);

// Enlarge the bounding box
draw(box((-1,-0.4), (0.5,0.6)),invisible);



Étiquettes : , , , , , ,

## Asymptote using geometry.asy – fig0480

Category: Asymptote,Examples 2D,geometry.asyPh. Ivaldi @ 5 h 02 min

 (Compiled with Asymptote version 2.14svn-r5318)

import geometry;
size(10cm);

point C=(4,2);
dot("$C$",C,E+NE,red);

hyperbola h=hyperbola(C,1.5,1,-20);
draw(h, linewidth(bp));

/* View the definition of line tangent(hyperbola,abscissa) */
line l=tangent(h,angabscissa(85));
draw(l, grey);
dot(intersectionpoints(h,l));

l=tangent(h,angabscissa(0,fromCenter));
draw(l, grey);
dot(intersectionpoints(h,l));

// Enlarge the bounding box of the current picture.
draw(box((-1,-0.5), (9,4)), invisible);



Étiquettes : , , , , , ,

## Asymptote using geometry.asy – fig0490

Category: Asymptote,Examples 2D,geometry.asyPh. Ivaldi @ 6 h 02 min

 (Compiled with Asymptote version 2.14svn-r5318)

import geometry;
size(12cm);

point C=(0,0);
dot(C);

hyperbola[] h;
h[0]=hyperbola(C,2,2);
h[1]=hyperbola(C,1.5,1);

draw(h[0], 2bp+0.8*red);
draw(h[1], 2bp+0.8*blue);

point[] P=intersectionpoints(h[0],h[1]);

line[] l;
for (int i=0; i < P.length; ++i) {
for (int j=0; j < 2; ++j) {
/* View the definition of line[] tangents(hyperbola,point) */
l=tangents(h[j],P[i]);
draw(l[0], j == 0 ? red : blue);
}
}

dot(P, yellow);

// Enlarge the bounding box of the current picture.
draw(box((-4,-3), (4,3)), invisible);



Étiquettes : , , , , ,

## Asymptote using geometry.asy – fig0500

Category: Asymptote,Examples 2D,geometry.asyPh. Ivaldi @ 7 h 02 min

 (Compiled with Asymptote version 2.14svn-r5318)

import geometry;
size(10cm,0);

currentcoordsys=cartesiansystem((0,0),i=(1,0.5),j=(-0.5,.75));
show(currentcoordsys, xpen=invisible);

point A=(2.5,-1);
point B=A+(3,1);
dot("$A$",A,SW);
dot("$B$",B,2N+0.5W);

circle c1=circle(A,1.5);
draw(c1);

/* View the definition of line[] tangents(circle,point) */
line[] tgt=tangents(c1,B);
draw(tgt,red);
/* View the definition of circle circle(point,point) */
draw(circle(B,A),grey);

// dot(intersectionpoints(c1,circle(B,A)),red);
for (int i=0; i<tgt.length; ++i) {
dot(intersectionpoints(c1,tgt[i]),2mm+red);
}



Étiquettes : , , , , ,

## Asymptote using geometry.asy – fig0510

Category: Asymptote,Examples 2D,geometry.asyPh. Ivaldi @ 8 h 02 min

 (Compiled with Asymptote version 2.14svn-r5318)

import geometry;
size(12cm,0);

// currentcoordsys=cartesiansystem((0,0),i=(1,0.5),j=(-0.5,.75));
// show(currentcoordsys, xpen=invisible);

point A=(2.5,-1);
dot("$A$",A,SW);
ellipse el1=ellipse(A,2,1,10);
draw(el1);

circle C=circle(A,3);
draw(C);
for (int i=0; i < 360; i+=90) {

point B=point(C,angabscissa(i));
dot("$B$",B,locate(unit(B-A)));

line[] tgt=tangents(el1,B);
draw(tgt,0.8*red);

for (int i=0; i < tgt.length; ++i) {
dot(intersectionpoints(el1,tgt[i]),blue);
}

}



Étiquettes : , , , , , ,

## Asymptote using geometry.asy – fig0520

Category: Asymptote,Examples 2D,geometry.asyPh. Ivaldi @ 9 h 02 min

 (Compiled with Asymptote version 2.14svn-r5318)

import geometry;
size(12cm,0);

// currentcoordsys=cartesiansystem((0,0),i=(1,0.5),j=(-0.5,.75));
// show(currentcoordsys, xpen=invisible);

point F=(0,0);
dot("$F$", F, SW);
parabola p=parabola(F, 0.1, 30);
draw(p);

point C=shift(2*(p.V-p.F))*p.V;
circle cle=circle(C, 0.2);
draw(cle);
for (int i=0; i < 360; i+=90) {

point M=point(cle, angabscissa(i));
dot("$M$", M, locate(unit(M-C)));

line[] tgt=tangents(p, M);
draw(tgt, 0.8*red);

for (int i=0; i < tgt.length; ++i) {
dot(intersectionpoints(p, tgt[i]), blue);
}
}



Étiquettes : , , , , , ,

## Asymptote using geometry.asy – fig1030

Category: Asymptote,Examples 2D,geometry.asyPh. Ivaldi @ 12 h 02 min

 (Compiled with Asymptote version 2.14svn-r5318)

import geometry;
size(8cm,0);

currentcoordsys=cartesiansystem((1,2),i=(1,0.5),j=(-0.5,.75));
show(currentcoordsys, xpen=invisible);

real R=2;

point A=(1,1.5);
dot("$A$",A,S,red);
point B=A+(2,1);
dot("$B$",B,S,blue);

arc a=arc(circle(A,R),-40,180);
arc b=arc(circle(B,R),-45,220);

draw(a,red);
draw(b,blue);

point M=intersectionpoints(a,b)[0];
dot(M);

/* View the definition of line tangent(explicit arc,point) */
draw(tangent(a,M), grey);
draw(tangent(b,M), grey);

/* View the definition of line tangent(explicit arc,abscissa) */
draw(tangent(a,angabscissa(45)), grey);



Étiquettes : , , , , , ,

## Asymptote using geometry.asy – fig1040

Category: Asymptote,Examples 2D,geometry.asyPh. Ivaldi @ 13 h 02 min

 (Compiled with Asymptote version 2.14svn-r5318)

import geometry;
size(10cm,0);

// currentcoordsys=cartesiansystem((1,2),i=(1,0.5),j=(-0.5,.75));
// show(currentcoordsys, xpen=invisible);

real R=2;

point A=(1,1.5);
dot("$A$",A,S,red);
point B=A+(2.5,1);
dot("$B$",B,E,blue);

arc a=arc(ellipse(A,R,R/2,30),-40,180);
// ellispenodesnumberfactor=400;
arc b=arc(ellipse(B,2R,R/2,-10),-30,180);

draw(a,red);
draw(b,blue);

point M=intersectionpoints(a,b)[0];
dot(M);

/* View the definition of line tangent(explicit arc,point) */
draw(tangent(a,M), grey);
draw(tangent(b,M), grey);

/* View the definition of line tangent(explicit arc,abscissa) */
draw(tangent(a,angabscissa(45)), grey);



Étiquettes : , , , , , ,

## Asymptote using geometry.asy – fig1110

Category: Asymptote,Examples 2D,geometry.asyPh. Ivaldi @ 20 h 02 min

 (Compiled with Asymptote version 2.14svn-r5318)

import geometry;
size(10cm,0);

// currentcoordsys=cartesiansystem((2,1),i=(1,0.5),j=(-0.25,0.75));
// show(currentcoordsys);

triangle t=triangle((-1,0), (2,0), (0,2));

/* View the definition of void drawline(picture,triangle,pen) */
drawline(t, linewidth(bp));
/* View the definition of void label(picture,Label,Label,Label,triangle,real,real,pen,filltype) */
label(t,alignFactor=4);

/* View the definition of circle circle(triangle) */
circle cc=circle(t);
draw(cc, 0.8blue);
dot(cc.C, blue);
/* View the definition of triangle tangential(triangle) */
triangle tgt=tangential(t);
draw(tgt, bp+0.8blue);
label("$A_1$", "$B_1$", "$C_1$", tgt, blue);

/* View the definition of circle incircle(triangle) */
circle ic=incircle(t);
draw(ic, 0.8red);
dot(ic.C, red);
triangle intouch=intouch(t);
draw(intouch, bp+0.8red);
label("$A_2$", "$B_2$", "$C_2$", intouch, red);

/* View the definition of circle excircle(side,triangle) */
circle ec=excircle(t.AB);
clipdraw(ec, 0.8green);
dot(ec.C, green);

ec=excircle(t.AC);
clipdraw(ec, 0.8green);
dot(ec.C, green);

ec=excircle(t.BC);
clipdraw(ec, 0.8green);
dot(ec.C, green);

/* View the definition of triangle extouch(triangle) */
triangle ext=extouch(t);
draw(ext, bp+0.8green);
label("$A_3$", "$B_3$", "$C_3$", ext, green);

/* View the definition of point extouch(side) */
dot(extouch(t.AB), 0.8*green);
dot(extouch(t.BC), 0.8*green);
dot(extouch(t.CA), 0.8*green);

/* View the definition of point intouch(side) */
dot(intouch(t.AB), 0.8*red);
dot(intouch(t.BC), 0.8*red);
dot(intouch(t.CA), 0.8*red);

// Enlarge the bounding box of the current picture
draw(box((-2.5,-3), (3.5,3.5)), invisible);



Étiquettes : , , , , , ,

## Unofficial package graph_pi.asy – fig0200

Category: Asymptote,graph_pi.asy,Unofficial packagesPh. Ivaldi @ 0 h 50 min

 (Compiled with Asymptote version 2.14svn-r5318)

import graph_pi;

unitsize(x=2cm,y=4cm);
real f(real x){return abs(sin(x));};
real g(real x){return cos(x);};
real x;

xlimits(-.25, 8);
ylimits(-1.25, 1.25);
xaxis(LeftTicks);
yaxis(Ticks);
path Cf=graph(f, 0, 8,500);
path Cg=graph(g, 0, 8,500);
draw(Cf,bp+red);
draw(Cg,bp+blue);

x=pi/4;
/*MODgraph_pi.asy.html#addtangentMOD*/
addtangent(Cf, x, .5yellow, drawleft=false);
addtangent(Cg, x, .5yellow, drawright=false);
dot((x,f(x))^^(x,g(x)));

x=3*pi/4;
path tg=tangent(Cf, x);
draw(tg);
addtangent(Cg, x);
pair M=intersectionpoint(tg,Cg);
dot("$M$",M,E);
addtangent(Cg, M.x, size=3cm,p=red);
draw((x,f(x))--(x,g(x)),scale(2)*MarkFill[0]);

x=pi;
addtangent(Cg, x, size=2cm,.8(green+blue));
dot((x,g(x)));

x=5*pi/4;
addtangent(Cf, x, size=2cm, v=(1,.25/sin(x)),
drawright=false, p=red, arrow=Arrow(5mm,NoFill));
addtangent(Cf, x, size=2cm, drawleft=false, red);
dot((x,f(x)));

x=2*pi;
addtangent(Cf, x, size=4cm,p=.8green,differentiable=false);
dot((x,f(x)));



Étiquettes : , ,

## Official Asymptote example – Hobbydir

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

 (Compiled with Asymptote version 2.14svn-r5318)
/* This code comes from The Official Asymptote Gallery */

size(200);
pair z0=(0,0);
pair z1=(1,2);
pair z2=(2,1);

path g=z0..z1..z2;

label("$\ell_k$",z0--z1);
draw("$\ell_{k+1}$",z1--z2,dashed);
draw(z0--interp(z0,z1,1.5),dashed);
pair d1=dir(g,1);
draw(z1-d1..z1+d1,blue+dashed);
draw(g,blue);
draw(Label("$\theta_k$",0.4),arc(z1,0.4,degrees(z2-z1),degrees(d1)),blue,Arrow,
EndPenMargin);
draw("$\phi_k$",arc(z1,0.4,degrees(d1),degrees(z1-z0),CCW),Arrow,
EndPenMargin);

dot("$z_{k-1}$",z0,red);
dot("$z_k$",z1,NW,red);
dot("$z_{k+1}$",z2,red);



Étiquettes : , , , ,

## Animation with Asymptote – fig0110

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

 (Compiled with Asymptote version 1.86svn-r4626)
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(12cm);

point F1=(0,0), F2=(0,-3);
dot("F",F1);

ellipse el1=ellipse(F1,F2,2), el2;
point Fp1=shift(0,2*el1.a)*F1;
dot("F'",Fp1);

line tgt, saxe=line(F1,false,-F2);

for (int i=0; i < 360; i += 5) {
save();
ellipse el=rotate(i,F1)*el1;
point M=intersectionpoints(el,saxe)[0];
tgt=tangents(el,M)[0];
draw(tgt, 0.8*red);
draw((reflect(tgt)*el)^^el, linewidth(bp));
anim.add();
restore();
}
erase();
anim.movie();



Étiquettes : , , ,

## Animation with Asymptote – fig0120

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

 (Compiled with Asymptote version 1.86svn-r4626)
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(12cm);

point F1=(0,0), F2=(10,0);
dot("F",F2);
ellipse el1=ellipse(F1,F2,6), el2;
draw(el1, linewidth(bp));
point Fp2=shift(2*el1.a,0)*F2;
line tgt, saxe;
pen[] p=new pen[]{0.8*green,0.8*blue,0.8*yellow,cyan};
path[] locus=sequence(new path(int i){return nullpath;},p.length);
real t=1/(p.length-1);

bool initlocus=true;
for (int i=0; i < 360; i += 1) {
save();
point Fm=rotate(i,F2)*Fp2;
dot("F'",Fm);
draw(Fm--F2, linewidth(2bp));
point M=intersectionpoints(el1, line(F2,false,Fm))[0];
tgt=tangents(el1,M)[0];
draw(tgt, 0.8*red);
el2=reflect(tgt)*el1;
draw(el2.F1--el2.F2);

for (int j=0; j < p.length; ++j) {
point P=point(segment(el2.F2,Fm),0.5+j*t/2);
locus[j]=initlocus ? P : locus[j]--P;
dot(P, p[j]);
draw(locus[j], bp+p[j]);
}

dot(el2.F2);
draw(el2, linewidth(bp));
anim.add();
restore();
initlocus=false;
}
erase();
anim.movie();



Étiquettes : , , , ,