Asymptote using geometry.asy – fig0270

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

Figure 0027
(Compiled with Asymptote version 2.14svn-r5318)
    
import geometry;
size(8cm,0);

currentcoordsys=cartesiansystem((0,0),i=(1,1),j=(-0.5,.75));
show("","$\vec{u}$", "$\vec{v}$", currentcoordsys, ipen=blue);
show(defaultcoordsys);

point A=(0,0);

real R=2;
/* View the definition of struct circle */
circle C=circle(A,R);
draw(C,1.5mm+red);

circle Cp=circle(point(defaultcoordsys,A),R);
draw(Cp,0.75mm+blue);

// One can draw in the 'currentcoordsys' a circle definided in
// the 'defaultcoordsys'
/* View the definition of path *(coordsys,path) */
draw(currentcoordsys*Cp, red+blue);

Étiquettes : , , , ,


Asymptote using geometry.asy – fig0290

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

Figure 0029
(Compiled with Asymptote version 2.14svn-r5318)
    
import geometry;
size(8cm,0);

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

point A=(1,1);
dot("$A$",A,S,red);

real R=2;
circle C=circle(A,R);
draw(C,Arrow);

/* View the definition of ellipse *(transform,circle) */
ellipse el=xscale(2)*C;
draw(el,blue,Arrow);

// /* View the definition of transform xscale(real,point) */
ellipse el=xscale(2,A)*C;
draw(el,red,Arrow);

Étiquettes : , , , ,


Asymptote using geometry.asy – fig0300

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

Figure 0030
(Compiled with Asymptote version 2.14svn-r5318)
    
import geometry;
size(8cm,0);

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

point A=(1,1);
dot("$A$",A,S,red);

real R=2;
circle C=circle(A,R);
draw(C,Arrow);

/* View the definition of ellipse *(transform,circle) */
draw(scale(0.5)*C,red,Arrow);

draw(scale(0.5,A)*C,2mm+0.8*blue);

/* View the definition of circle /(explicit circle,real) */
draw(C/2,0.75mm+green,Arrow(4mm));

// Note that the point 'point(C,0)' is always at the same place relatively to 'C'.
draw(rotateO(180)*C/2,0.8*yellow,Arrow);

Étiquettes : , , , ,


Asymptote using geometry.asy – fig0310

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

Figure 0031
(Compiled with Asymptote version 2.14svn-r5318)
    
import geometry;
size(10cm,0);

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

point A=(1,1);
dot("$A$",A,S,red);

real a=3, b=2;
ellipse el=ellipse(A,a,b,0);
draw(el,Arrow);

/* View the definition of ellipse *(transform,ellipse) */
draw(scale(0.5)*el,red,Arrow);

draw(scale(0.5,A)*el,2mm+0.8*blue);

/* View the definition of ellipse /(ellipse,real) */
draw(el/2,0.75mm+green,Arrow(4mm));

// Note that the point 'point(el,0)' is always at the same place relatively to 'el'.
draw(rotateO(135)*el/2,0.8*yellow,Arrow);

Étiquettes : , , , ,


Asymptote using geometry.asy – fig0360

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

Figure 0036
(Compiled with Asymptote version 2.14svn-r5318)
    
import geometry;
size(8cm,0);

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

point A=(-1,0);
point B=(0.5,-3sin(2));
dot("$A$",A,S,red);
dot("$B$",B,N,red);

line l=line(A,B);
ellipse el=ellipse((0,-sqrt(2)/2),3,2,90);
draw(l);
draw(el,Arrow);

/* View the definition of point[] intersectionpoints(line,ellipse) */
point[] inter=intersectionpoints(l,el);
dot("$M$", inter[0], 4N+2W, red);
dot("$N$", inter[1], 2S+0.5E, red);

Étiquettes : , , ,


Asymptote using geometry.asy – fig0400

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

Figure 0040
(Compiled with Asymptote version 2.14svn-r5318)
    
import geometry;

size(8cm,0);

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

point A=(-0.5,.75);
point B=(1,1);
dot("$A$",A,SE);
dot("$B$",B,NW);

line l=line(A,B,false);
line ll=hline()+B;

ellipse el=ellipse((point)(0.5,0.5),3,2);
draw(l^^ll);
draw(complementary(l),dashed+grey);
draw(el);

dotfactor*=2;

/* View the definition of point[] intersectionpoints(line,ellipse) */
dot(intersectionpoints(l,el),red);
dot(intersectionpoints(ll,el),red);

Étiquettes : , , ,


Asymptote using geometry.asy – fig0430

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

Figure 0043
(Compiled with Asymptote version 2.14svn-r5318)
    
import geometry;
size(10cm,0);

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

point C=(0,0);
point Cp=(0.5,0.5);
dot("$C$",C,NW,red);
dot("$C'$",Cp,N,red);

ellipse el1=ellipse(C,2,1);
ellipse el2=ellipse(Cp,3,1,40);
draw(el1^^el2);

dotfactor*=2;

/* View the definition of point[] intersectionpoints(ellipse,ellipse) */
point[] inter=intersectionpoints(el1,el2);
dot(inter);

Étiquettes : , ,


Asymptote using geometry.asy – fig0460

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

Figure 0046
(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 – fig0510

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

Figure 0051
(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

Figure 0052
(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 – fig0540

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

Figure 0054
(Compiled with Asymptote version 2.14svn-r5318)
    
import geometry;
size(8cm,0);

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

point A=(3.5,1),
B=(1.75,3),
C=(-1,2),
D=(-1.5,-0.5),
F=(1.5,-1);

dot("$A$",A);
dot("$B$",B,N);
dot("$C$",C,NW);
dot("$D$",D,SW);
dot("$F$",F,SE);

/* View the definition of ellipse ellipse(point,point,point,point,point) */
ellipse el=ellipse(A,B,C,D,F);
draw(el);

dot("$F_1$",el.F1,NW);
dot("$F_2$",el.F2,NW);

/* View the definition of coordsys canonicalcartesiansystem(ellipse) */
coordsys R=canonicalcartesiansystem(el);
show("$C$", "$\vec{u}$", "$\vec{v}$", R, xpen=blue);

Étiquettes : , , ,


Asymptote using geometry.asy – fig0580

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

Figure 0058
(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,-1.5);
dot("$A$",A,S,red);

ellipse el=ellipse(A,3,1,20);
draw(el);

/* View the definition of point relpoint(explicit ellipse,real) */
dot("relpoint(el, 0)",relpoint(el,0),E);

/* View the definition of point point(ellipse,abscissa) */
dot("relpoint(el, 0.25)",point(el,Relative(0.25)),NW);
// point(el,Relative(0.25)) can be replaced by relpoint(el,0.25) OR point(el,relabscissa(0.25))

dot("relpoint(el, 0.5)",relpoint(el,0.5),W);
dot("relpoint(el, 0.75)",relpoint(el,0.75),SE);
dot("relpoint(el, 1.125)",relpoint(el,1.125),NW);

Étiquettes : , , ,


Asymptote using geometry.asy – fig0610

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

Figure 0061
(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=(4,2);

ellipse el=ellipse(A,3,2,30);
draw(el);
dot("$C$",el.C,S,red);


/* View the definition of pair curpoint(explicit ellipse,real) */
dot("curpoint(el, 0)", curpoint(el,0), E);

real L=arclength(el);


dot("curpoint(el, L/8)", curpoint(el,L/8),NW);

dot("curpoint(el, -L/8)", curpoint(el,-L/8));

/* View the definition of abscissa curabscissa(real) */
dot("point(el,curabscissa(L/4))", point(el,curabscissa(L/4)),NW);
// point(el,curabscissa(pi)) can be replaced by curpoint(el,pi)

dot("curpoint(el, L/2)", curpoint(el,L/2),W);
dot("curpoint(el, 3*L/4)", curpoint(el,3*L/4),SE);
dot("curpoint(el, 9*L/8)", curpoint(el,9*L/8),4N+4W);

Étiquettes : , , ,


Asymptote using geometry.asy – fig0640

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

Figure 0064
(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=(4,2);

ellipse el=ellipse(A,3,2,20);
draw(el);
dot("$C$",el.C,2W,red);

dot("$F_1$",el.F1,S);
dot("$F_2$",el.F2,S);


/* View the definition of point angpoint(explicit ellipse,real,polarconicroutine) */
point P=angpoint(el, 0);
dot("angpoint(el, 0)", P,E);
draw(el.F1--P);

point P=angpoint(el, 90);
dot("angpoint(el, 90)", P,NW);
draw(el.F1--P);

point P=angpoint(el, 90, fromCenter);
dot("angpoint(el,90,fromCenter)", P,NW);
draw(el.C--P);


/* View the definition of abscissa angabscissa(real,polarconicroutine) */
dot("angpoint(el, 180)", point(el,angabscissa(180)), W);
// point(el,angabscissa(180)) can be replaced by angpoint(el,180)

dot("angpoint(el, 270)", angpoint(el,270),SE);
dot("angpoint(el, 370)", angpoint(el,370),NE);
dot("angpoint(el, -45)", angpoint(el,-45),SE);

point P=angpoint(el, -45, fromCenter);
dot("angpoint(el,-45,fromCenter)", P,S);
draw(el.C--P);

Étiquettes : , , ,


Asymptote using geometry.asy – fig0650

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

Figure 0065
(Compiled with Asymptote version 2.14svn-r5318)
    
import geometry;
size(15cm,0);

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

point A=(4,2);

ellipse el=ellipse(A,3,2,20);
draw(el);
dot("$C$",el.C,S,red);

dot("$F_1$",el.F1,S);
dot("$F_2$",el.F2,S);


///////////////////////////////////////
currentpolarconicroutine=fromCenter;//
/////////////////////////////////////

/* View the definition of point angpoint(explicit ellipse,real,polarconicroutine) */
point P=angpoint(el, 0);
dot("angpoint(el, 0)", P,E);
draw(el.C--P);

point P=angpoint(el, 90);
dot("angpoint(el, 90)", P,NW);
draw(el.C--P);

point P=angpoint(el, 90, fromFocus);
dot("angpoint(el,90,fromFocus)", P,NW);
draw(el.F1--P);


/* View the definition of abscissa angabscissa(real,polarconicroutine) */
dot("angpoint(el, 180)", point(el,angabscissa(180)), W);

dot("angpoint(el, 370)", angpoint(el,370),NE);
dot("angpoint(el, -45)", angpoint(el,-45),SE);

point P=angpoint(el, -45, fromFocus);
dot("angpoint(el,-45,fromFocus)", P,S);
draw(el.F1--P);

Étiquettes : , , ,


Asymptote using geometry.asy – fig0700

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

Figure 0070
(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=(4,2);

real a=2, b=3;
ellipse el=ellipse(A,a,b);

dot("$C$",el.C,N,red);
draw(el,linewidth(1mm));

/* View the definition of point point(explicit ellipse,explicit real) */
dot("point(el, 0)", point(el,0),N,3mm+blue);

dot("point(el, 15)", point(el,15),2W,3mm+blue);

/* View the definition of abscissa nodabscissa(real) */
dot("point(el, 40)",
    point(el,nodabscissa(40)),
    2W,3mm+blue);
// point(el,nodabscissa(40)) can be replaced by point(el,40)

/* View the definition of int circlenodesnumber(real) */
dot("point(el, 3*circlenodesnumber(max(a,b))/4)",
    point(el, 3*circlenodesnumber(max(a,b))/4), S, 3mm+blue);

dot((path)el, yellow);

Étiquettes : , , ,


Asymptote using geometry.asy – fig0740

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

Figure 0074
(Compiled with Asymptote version 2.14svn-r5318)
    
import geometry;
unitsize(2cm);

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

point A=(-2,2);
dot("$A$",A,S);
point B=A+(cos(0.5),cos(1));
dot("$B$",B,S);


ellipse el=ellipse(A,3,2,0);
draw(el);
line l=line(A,B);
draw(l);
point M=intersectionpoints(l,el)[0];
point P=intersectionpoints(l,el)[1];

/* View the definition of void dot(picture,Label,explicit point,align,string,pen) */
dot("",M,2E,linewidth(2mm));
dot("$M$",M,2W);
dot("",P,2E);
dot("$P$",P,2W,linewidth(2mm));

pair p=A-(4,2.5);
transform t=shift((0,-0.3));
transform T=shift((4,0));
real x;

/* View the definition of abscissa angabscissa(ellipse,point,polarconicroutine) */
x=angabscissa(el,M).x;
label("angabscissa(el,M).x=$"+(string)x+"^\circ$",p,E);
dot(angpoint(el,x),1mm+red);
x=angabscissa(el,P).x;
label("angabscissa(el,P).x=$"+(string)x+"^\circ$",T*p,E);
dot(angpoint(el,x),1mm+red);

p=t*p;
/* View the definition of abscissa curabscissa(ellipse,point) */
x=curabscissa(el,M).x;
dot(curpoint(el,x),1mm+red);
label("curabscissa(el,M).x="+(string)x,p,E);
x=curabscissa(el,P).x;
label("curabscissa(el,P).x="+(string)x,T*p,E);
dot(curpoint(el,x),1mm+red);

p=t*p;
/* View the definition of abscissa nodabscissa(ellipse,point) */
x=nodabscissa(el,M).x;
label("nodabscissa(el,M).x="+(string)x,p,E);
dot(point(el,x),1mm+red);
x=nodabscissa(el,P).x;
label("nodabscissa(el,P).x="+(string)x,T*p,E);
dot(point(el,x),1mm+red);

p=t*p;
/* View the definition of abscissa relabscissa(ellipse,point) */
x=relabscissa(el,M).x;
label("relabscissa(el,M).x="+(string)x,p,E);
dot(relpoint(el,x),1mm+red);
x=relabscissa(el,P).x;
label("relabscissa(el,P).x="+(string)x,T*p,E);
dot(relpoint(el,x),1mm+red);

Étiquettes : , , ,


Asymptote using geometry.asy – fig0760

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

Figure 0076
(Compiled with Asymptote version 2.14svn-r5318)
    
import geometry;
size(12cm);

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

conic co[];
co[0]=circle((point)(0,0),1);
/* View the definition of void draw(picture,Label,explicit conic,align,pen,arrowbar,arrowbar,margin,Label,marker) */
draw(co[0]);

co[1]=ellipse((point)(0,0),4,1);
draw(co[1]);

co[2]=parabola((0,0),1,90);
draw(co[2]);

hyperbola h=hyperbola((-1,0),(1,0),1.2,byvertices);
co[3]=h;
draw(co[3]);
draw(h.A1,grey);
draw(h.A2,grey);

dotfactor *= 1;

for (int i=0; i < 4; ++i) {
  dot(intersectionpoints(h.A1,co[i]),blue);
  dot(intersectionpoints(h.A2,co[i]),blue);
  for (int j=i+1; j < 4; ++j)
    /* View the definition of point[] intersectionpoints(conic,conic) */
    dot(intersectionpoints(co[i],co[j]), red);
}

Étiquettes : , , , , , , ,


Asymptote using geometry.asy – fig0770

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

Figure 0077
(Compiled with Asymptote version 2.14svn-r5318)
    
import geometry;
size(8cm);

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

point A=(-1,0) ; dot("$A$",A,S);
point B=(1,1)  ; dot("$B$",B,S);
point C=(0,1)  ; dot("$C$",C,SW);
point D=(1,-1) ; dot("$D$",D,SW);

circle c=circle(origin(),2);

line l1=line(A,B); draw(l1);
line l2=line(C,D); draw(l2);

point[] J=intersectionpoints(l1,c);
point[] K=intersectionpoints(l2,c);

/* View the definition of arc arc(ellipse,point,point,bool) */
draw(arc(c,J[0],K[0]),1mm+0.8yellow);
draw(arc(c,K[0],J[1]),1mm+0.8red);
/* View the definition of arc arc(ellipse,abscissa,abscissa,bool) */
draw(arc(c,angabscissa(c,J[1]),angabscissa(c,K[1])),1mm+0.8blue);
draw(arc(c,angabscissa(c,K[1]),angabscissa(c,J[0])),1mm+0.8green);

dot("$J_0$",J[0],2W); dot("$J_1$",J[1],2N);
dot("$K_0$",K[0],2E) ; dot("$K_1$",K[1],2N+W);

Étiquettes : , , ,


Asymptote using geometry.asy – fig0780

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

Figure 0078
(Compiled with Asymptote version 2.14svn-r5318)
    
import geometry;
size(8cm);

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

point A=(-1,0) ; dot("$A$",A,S);
point B=(1,1)  ; dot("$B$",B,S);
point C=(0,1)  ; dot("$C$",C,SW);
point D=(1,-1) ; dot("$D$",D,SW);

ellipse el=ellipse((point)(0,0.5),2,1);

line l1=line(A,B); draw(l1);
line l2=line(C,D); draw(l2);

point[] J=intersectionpoints(l1,el);
point[] K=intersectionpoints(l2,el);

/* View the definition of arc arc(ellipse,point,point,bool) */
draw(arc(el, J[0],K[0]), 1mm+0.8yellow);
draw(arc(el, K[0],J[1]), 1mm+0.8red);
/* View the definition of arc arc(ellipse,abscissa,abscissa,bool) */
draw(arc(el,angabscissa(el,J[1]), angabscissa(el,K[1])), 1mm+0.8blue);
draw(arc(el,angabscissa(el,K[1]), angabscissa(el,J[0])), 1mm+0.8green);

dot("$J_0$", J[0], 2N); dot("$J_1$", J[1], 2S);
dot("$K_0$", K[0], 2NE) ; dot("$K_1$", K[1], 2dir(-35));

Étiquettes : , , ,


Asymptote using geometry.asy – fig0800

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

Figure 0080
(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);

point A=(1,1);
dot("$A$",A,S,0.8red);

real R=2;
/* View the definition of struct arc */
arc C=arc(circle(A,R),45,180);/* View the definition of arc arc(ellipse,real,real,polarconicroutine,bool) */
draw(C,Arrow);

/* View the definition of arc complementary(arc) */
draw(complementary(C),dashed+grey,Arrow(position=Relative(0.75)));

/* View the definition of arc *(transform,explicit arc) */
arc Cp=scale(0.5,A)*C;
draw(Cp,0.8red,Arrow);

arc Cp=scale(-0.5,A)*C;
draw(Cp,0.8blue,Arrow);

arc Cp=scale(1.1,A)*C;
/* View the definition of arc reverse(arc) */
draw(reverse(Cp),0.8*yellow,Arrow);

arc Cp=scale(0.9,A)*C;
draw(rotate(225,A)*Cp,0.8green,Arrow);

Étiquettes : , , , ,


Asymptote using geometry.asy – fig0810

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

Figure 0081
(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);

point A=(1,1);
dot("$A$",A,S,0.8red);

real R=2;
/* View the definition of struct arc */
arc C=arc(ellipse(A,2R,R),45,180,fromCenter);
draw(C,Arrow);

/* View the definition of arc complementary(arc) */
draw(complementary(C),dashed+grey,Arrow(position=Relative(0.75)));

/* View the definition of arc *(transform,explicit arc) */
arc Cp=scale(0.5,A)*C;
draw(Cp,0.8red,Arrow);

arc Cp=scale(-0.5,A)*C;
draw(Cp,0.8blue,Arrow);

arc Cp=scale(1.1,A)*C;
/* View the definition of arc reverse(arc) */
draw(reverse(Cp),0.8*yellow,Arrow);

arc Cp=scale(0.9,A)*C;
draw(rotate(225,A)*Cp,0.8green,Arrow);

Étiquettes : , , , ,


Asymptote using geometry.asy – fig0840

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

Figure 0084
(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);

point C=(1,1);
dot("$C$", C, NE, red);

real R=2;
arc a=arc(ellipse(C,R,R/2), 90, 0, fromCenter);
draw(a, linewidth(4mm));

/* View the definition of void markarc(picture,Label,int,real,real,arc,arrowbar,pen,pen,margin,marker) */
markarc(format("%0g", degrees(a)), radius=-0.5*markangleradius(), a);

/* View the definition of arc *(real, explicit arc) */
draw(0.5*a, 2mm+yellow);

arc ap=a/3;
draw(ap, 1mm+blue);
markarc(format("%0g", degrees(ap)), radius=1.5*markangleradius(), ap, blue);

Étiquettes : , , , ,


Asymptote using geometry.asy – fig0870

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

Figure 0087
(Compiled with Asymptote version 2.14svn-r5318)
    
import geometry;
size(12cm,0);

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

point A=(1,1);
dot("$A$", A, S, red);

arc C=arc(ellipse(A,2,1,45), 45, 270, fromCenter);
// arc C=arc(ellipse(A,2,1), 45, -45);

draw(C, Arrow);
draw(complementary(C), grey+dashed);
distance("$R=2$",A,point(C.el,0),0);

/* View the definition of point relpoint(arc,real) */
dot("relpoint(C, 0)", relpoint(C,0),W);

/* View the definition of point point(arc,abscissa) */
dot("relpoint(C, 0.25)", point(C,Relative(0.25)),W);// point(C,Relative(0.25)) is similar to relpoint(C,0.25)
dot("relpoint(C, -0.5)", relpoint(C,-0.5),E);
dot("relpoint(C, 0.5)",  relpoint(C,0.5),W);
dot("relpoint(C, 0.75)", relpoint(C,0.75),SE);
dot("relpoint(C, 1.25)", relpoint(C,1.25),E);

Étiquettes : , , , ,


Asymptote using geometry.asy – fig0890

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

Figure 0089
(Compiled with Asymptote version 2.14svn-r5318)
    
import geometry;
size(12cm,0);

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

point A=(3.5,0.5);
dot("$A$",A,SW,red);

arc C=arc(ellipse(A,2,1,-30),90,270,fromCenter,CCW);
real l=arclength(C);

draw(C,Arrow);
draw(complementary(C),grey+dashed);
distance("$R=2$",A,point(C.el,0),0);

/* View the definition of point curpoint(arc,real) */
dot("curpoint(C, 0)", curpoint(C,0),E);
dot("curpoint(C, l/4)", curpoint(C,l/4),0.5N+E);
dot("curpoint(C, -l/4)", curpoint(C,-l/4));

dot("curpoint(C, l/2)", point(C,curabscissa(l/2)),W); // point(C,curabscissa(l/2)) is similar to curpoint(C,pi)
dot("curpoint(C, l)", curpoint(C,l), SW);
dot("curpoint(C, 3*l/2)", curpoint(C,3*l/2),E);

Étiquettes : , , , ,


Asymptote using geometry.asy – fig0910

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

Figure 0091
(Compiled with Asymptote version 2.14svn-r5318)
    
import geometry;
size(12cm,0);

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

point A=(3.5,0.5);
dot("$A$", A, S, red);

/* View the definition of arc reverse(arc) */
arc C=reverse(arc(ellipse(A,2,1,20), 45, 270, fromCenter));
draw(C,Arrow);
draw(complementary(C), grey+dashed);
distance("$R=2$",A,point(C.el,0),0);

/* View the definition of point angpoint(arc,real) */
dot("angpoint(C, 90)",  angpoint(C,90), SW);

dot("angpoint(C, 180)", point(C,angabscissa(180)), NW); // point(C,angabscissa(180)) is similar to angpoint(C,180)

dot("angpoint(C, 270)", angpoint(C,270), E);
dot("angpoint(C, -45)", angpoint(C,-45), E);

Étiquettes : , , , ,


Asymptote using geometry.asy – fig0930

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

Figure 0093
(Compiled with Asymptote version 2.14svn-r5318)
    
import geometry;
unitsize(1.5cm);

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

real R=2;
point A=(3.5,1.5);

dot("$A$",A,S,red);

arc C=arc(ellipse(A,2,1,45), 45, 270, fromCenter);
draw(C,Arrow);
draw(complementary(C),grey+dashed);
distance("$R=2$",A,point(C.el,0),0);

/* View the definition of point point(arc,real) */
dot("point(C, 15)", point(C,15), W, 3mm+blue);

dot("point(C, 30)",
    point(C,nodabscissa(30)), // OR point(C,40)
    S,3mm+blue);

/* View the definition of int arcnodesnumber(explicit arc) */
dot(Label("point(C, 3*arcnodesnumber(R)/4)",UnFill),
    point(C, 3*arcnodesnumber(C)/4), 2E, 3mm+blue);

dot((path)C, yellow);

Étiquettes : , , , ,


Asymptote using geometry.asy – fig0950

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

Figure 0095
(Compiled with Asymptote version 2.14svn-r5318)
    
import geometry;
unitsize(2cm);
linemargin=0.5cm;

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

point A=(3.5,0.75);
dot("$A$",A,S);
point B=A+(cos(0.5),cos(1));
dot("$B$",B,S);


arc c=rotate(45,B)*xscale(2,A)*arc(circle(A,2), 45, 270, CCW);
arc cc=complementary(c);
draw(c,Arrow);
draw(cc,dashed+grey);

line l=line(A,B);
draw(l);
point M=intersectionpoints(l,c)[0];
point P=intersectionpoints(l,cc)[0];

dot("", M, 2E);
dot("$M$", M, 2W, linewidth(2mm));
dot("", P, 2E);
dot("$P$", P, 2W, linewidth(2mm));
dot("$O$", point(c,0), SE);

point p=A-(4,2.5);
transform t=shift((0,-0.3));
transform T=shift((4,0));
real x;

/* View the definition of abscissa angabscissa(arc,point) */
x=angabscissa(c,M).x;
label("angabscissa(c,M).x=$"+(string)x+"^\circ$",p,E);
dot(angpoint(c,x),1mm+red);
x=angabscissa(c,P).x;
label("angabscissa(c,P).x=$"+(string)x+"^\circ$",T*p,E);
dot(angpoint(c,x),1mm+red);

p=t*p;
/* View the definition of abscissa curabscissa(arc,point) */
x=curabscissa(c,M).x;
dot(curpoint(c,x),1mm+red);
label("curabscissa(c,M).x="+(string)x,p,E);
x=curabscissa(c,P).x;
label("curabscissa(c,P).x="+(string)x,T*p,E);
dot(curpoint(c,x),1mm+red);

p=t*p;
/* View the definition of abscissa nodabscissa(arc,point) */
x=nodabscissa(c,M).x;
label("nodabscissa(c,M).x="+(string)x,p,E);
dot(point(c,x),1mm+red);
label("nodabscissa(c,P).x= \scriptsize{ERROR (point is not on the arc!)}",T*p,E);

p=t*p;
/* View the definition of abscissa relabscissa(arc,point) */
x=relabscissa(c,M).x;
label("relabscissa(c,M).x="+(string)x,p,E);
dot(relpoint(c,x),1mm+red);
x=relabscissa(c,P).x;
label("relabscissa(c,P).x="+(string)x,T*p,E);
dot(relpoint(c,x),1mm+red);

Étiquettes : , , , ,


Asymptote using geometry.asy – fig0970

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

Figure 0097
(Compiled with Asymptote version 2.14svn-r5318)
    
import geometry;
size(8cm);

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

point A=(-1,0) ; dot("$A$",A,S);
point B=(1,1)  ; dot("$B$",B,S);
point C=(0,0)  ;
point D=(1,-1) ; dot("$D$",D,SW);

arc c=arc(ellipse(C,2,1,20), 0, 270);
draw(complementary(c),dashed+grey);

line l1=line(A,B); draw(l1);
line l2=line(C,D); draw(l2);

point[] J=intersectionpoints(l1,c);
point[] K=intersectionpoints(l2,c);

/* View the definition of arc arc(explicit arc,point,point) */
draw(arc(c,J[0],K[0]),2mm+0.8yellow);
draw(arc(c,K[0],J[1]),2mm+0.8red);
/* View the definition of arc arc(explicit arc,abscissa,abscissa) */
draw(arc(c,relabscissa(c,J[1]),relabscissa(1)),2mm+0.8green);
draw(arc(c,relabscissa(0),relabscissa(c,J[0])),2mm+0.8blue);

dot("$J_0$",J[0],2N);
dot("$J_1$",J[1],N+2W);
dot("$K_0$",K[0],2N);

draw(c, 1mm+white);

Étiquettes : , , , , , ,


Asymptote using geometry.asy – fig0990

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

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

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

point A=(-1,1);
dot("$A$",A,S);

arc a=arc(ellipse(A,2,1,45), 45, 270, fromCenter);
draw(a,linewidth(3mm),ArcArrow(5mm));

/* View the definition of arc arc(explicit arc,abscissa,abscissa) */
draw(arc(a,angabscissa(135),angabscissa(225)),1mm+red,ArcArrow(3mm),TrueMargin(0,0.5mm));

Étiquettes : , , , ,


Asymptote using geometry.asy – fig1020

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

Figure 0102
(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);
dot("$A$", A, S, red);
point B=A+(2,1);
dot("$B$", B, N, blue);

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

line l=line(A,B);

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

/* View the definition of point[] intersectionpoints(arc,arc) */
point[] inter=intersectionpoints(a,b);
dot(inter);

/* View the definition of point[] intersectionpoints(line,arc) */
point[] inter=intersectionpoints(l,a);
dot(inter);

point[] inter=intersectionpoints(l,b);
dot(inter);

Étiquettes : , , , , ,


Asymptote using geometry.asy – fig1040

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

Figure 0104
(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 trembling.asy – fig0130

Category: Asymptote,Examples 2D,trembling.asyPh. Ivaldi @ 14 h 24 min

Figure 0013
(Compiled with Asymptote version 1.87svn-r4652)
    
import trembling;
size(12cm);

startTrembling();

conic co[];
co[0]=circle((0,0),1);
draw(co[0]);

co[1]=ellipse((0,0),4,1);
draw(co[1]);

co[2]=parabola((0,0),1,90);
draw(co[2]);

hyperbola h=hyperbola((-1,0),(1,0),1.2,byvertices);
co[3]=h;
draw(co[3]);
draw(h.A1,grey);

draw(h.A2,grey);

dotfactor *= 1;

for (int i=0; i < 4; ++i) {
  dot(intersectionpoints(h.A1,co[i]),blue);
  dot(intersectionpoints(h.A2,co[i]),blue);
  for (int j=i+1; j < 4; ++j)
    dot(intersectionpoints(co[i],co[j]), red);
}

Étiquettes : , , , , , , , , , ,


Official Asymptote example – hierarchy

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

Figure 0089
(Compiled with Asymptote version 2.14svn-r5318)
/* This code comes from The Official Asymptote Gallery */
    
texpreamble("\def\Ham{\mathop {\rm Ham}\nolimits}");
pair align=2N;
frame f;
ellipse(f,Label("$\Ham(r,2)$",(0,0)),lightblue,Fill,above=false);
ellipse(f,Label("BCH Codes",point(f,N),align),green,Fill,above=false);
ellipse(f,Label("Cyclic Codes",point(f,N),align),lightmagenta,Fill,above=false);
ellipse(f,Label("Linear Codes",point(f,N),align),-4mm,orange,Fill,above=false);
box(f,Label("General Codes",point(f,N),align),2mm,yellow,Fill,above=false);
add(f);

Étiquettes : , , ,


Animation with Asymptote – fig0110

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

Figure 0011
(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

Figure 0012
(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 : , , , ,