Handwriting with the package trembling.asy
List of pictures
Figure 0001
figure 0001
Figure 0002
figure 0002
Figure 0003
figure 0003
Figure 0004
figure 0004
Figure 0005
figure 0005
Figure 0006
figure 0006
Figure 0007
figure 0007
Figure 0008
figure 0008
Figure 0009
figure 0009
Figure 0010
figure 0010
Figure 0011
figure 0011
Figure 0012
figure 0012
Figure 0013
figure 0013
Figure 0014
figure 0014
Figure 0015
figure 0015
Figure 0001

One can use the routine tremble in order to deform a specific path.

Figure 0001: fig0010.asy
(Compiled with Asymptote version 1.87svn-r4652)
    
import trembling;
size(8cm);

path cle=unitcircle;

/* View the definition of path tremble(path,real,real,real,real) */
path tcle=tremble(cle,frequency=0.25,random=1);
draw(tcle);

path tri=(-1,-0.5)--(1,-0.5)--(0,0.75)--cycle;
path ttri=tremble(tri,frequency=0.5,random=1.5);
draw(ttri);

shipout(bbox(3mm,invisible));

Figure 0002

Using the routine startTrembling, all drawn paths are distorted.

Figure 0002: fig0020.asy
(Compiled with Asymptote version 1.87svn-r4652)
    
import trembling;
size(8cm);

/* View the definition of void startTrembling(real,real,real,real,bool */
startTrembling();

draw(unitcircle);
draw((-1,-0.5)--(1,-0.5)--(0,0.75)--cycle);

shipout(bbox(3mm,invisible));

Figure 0003

When trembling is enabled with the routine startTrembling, all (most ?) doted points become "magnetic" automatically. So, if a path passes through a magnetized point with an numerous precision defined by magneticRadius (unit is bp in postscript coordinates), the resulting distorted path will also pass through the point.

Figure 0003: fig0030.asy
(Compiled with Asymptote version 1.87svn-r4652)
    
import trembling;
startTrembling();

size(8cm);

triangle T=triangleabc(6,7,8);
draw(T,dot);
draw(circle(T));

Figure 0004

One can disabled this feature setting the parameter magnetizePoints to false.

Figure 0004: fig0040.asy
(Compiled with Asymptote version 1.87svn-r4652)
    
import trembling;
startTrembling(magnetizePoints=false);

size(8cm);

triangle T=triangleabc(6,7,8);
draw(T,dot);
draw(circle(T));

Figure 0005

One can magnetize non dotted points with the routines void magnetize(...triangle[]) and void magnetize(...pair[]).

Figure 0005: fig0050.asy
(Compiled with Asymptote version 1.87svn-r4652)
    
import trembling;
startTrembling();

size(8cm);

triangle T=triangleabc(6,7,8);

draw(T);
magnetize(T);/* View the definition of void magnetize(...triangle[]) */
draw(circle(T));

Figure 0006

Here an other example with the incircle of a triangle.
Further examples follow...

Figure 0006: fig0060.asy
(Compiled with Asymptote version 1.87svn-r4652)
    
import trembling;
startTrembling(angle=6, random=10);

size(8cm);

triangle T=triangleabc(6,7,8);
dot(intouch(T));

draw(T);
draw(incircle(T), 0.8*red);

Figure 0007
Figure 0007: fig0070.asy
(Compiled with Asymptote version 1.87svn-r4652)
    
import trembling;
startTrembling(angle=6, frequency=1, random=10);

size(8cm);

triangle T=triangleabc(6,6,6);

draw(T, dot);
draw(bisector(T.AB)^^bisector(T.AC)^^bisector(T.BC), 0.8*red);

addMargins(1cm,1cm);

Figure 0008
Figure 0008: fig0080.asy
(Compiled with Asymptote version 1.87svn-r4652)
    
import trembling;
startTrembling(angle=6, frequency=1);

size(8cm);

triangle T=triangleabc(6,6,6);
magnetize(centroid(T));/* View the definition of void magnetize(...pair[]) */
magnetize(T);

draw(T, dot);
draw(bisector(T.AB)^^bisector(T.AC)^^bisector(T.BC), 0.8*red);

addMargins(1cm,1cm);

Figure 0009
Figure 0009: fig0090.asy
(Compiled with Asymptote version 1.87svn-r4652)
    
/*From Mathematex*/
unitsize(1cm);
import trembling;
import base_pi; // for rotatedLabel.

startTrembling();

point pA = (0,0);
point pB = (0,4);
point pC = pB+6*(rotate(35)*unit(pA-pB));
point pD = pC+4*(rotate(-112)*unit(pB-pC));
point pE = pD+4*(rotate(-78)*unit(pC-pD));
point pFi = rotate(35,pE)*pD;

dot(Label("$A$",align=SE),pA);
dot(Label("$B$",align=NW),pB);
dot(Label("$C$",align=SW),pC);
dot(Label("$D$",align=SE),pD);
dot(Label("$E$",align=NW),pE);

line l1 = line(pA,false,pA-(1,0));
line l2 = line(pE,false,pFi);

draw(l1);
draw(l2);
draw(pA--pB, StickIntervalMarker(1,2,size=6,angle=-45,red,true));
draw(rotatedLabel("$6 \; cm$"), pB--pC, N);
draw(rotatedLabel("$4 \; cm$"), pC--pD, S,
     StickIntervalMarker(1,2,size=6,angle=-45,red));
draw(pD--pE,
     StickIntervalMarker(1,2,size=6,angle=-45,red));

markrightangle(pA-(1,0),pA,pB,blue);
markangle(Label("$35^\circ$"),pA,pB,pC,radius=12mm,blue,StickIntervalMarker(i=1,n=1,size=4,blue));
markangle(Label("$112^\circ$"),pB,pC,pD,radius=7mm,blue);
markangle(Label("$78^\circ$"),pC,pD,pE,radius=5mm,blue);
markangle(pD,pE,pFi,radius=12mm,blue,StickIntervalMarker(i=1,n=1,size=4,blue));

addMargins(30mm,0mm,40mm,0mm);
shipout(bbox(xmargin=1mm,invisible));

Figure 0010

Note that the makers are also deformed...

Figure 0010: fig0100.asy
(Compiled with Asymptote version 1.87svn-r4652)
    
import trembling;
size(12cm);
startTrembling();

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

point A=(1,1);
line l1=line(45,A);
dot("$A$",A);
draw("$(l_1)$",l1);

point B=(3,1);
line l2=line(-60,B);
dot("$B$",B);
draw("$(l_2)$",l2);

markangleradiusfactor*=5;
markangle(2,l2,l1,0.8*green,StickIntervalMarker(i=1,n=2));

markangle(2,radius=-0.5*markangleradius(),
          l2,l1,0.8*blue);

markangle(reverse(l2),reverse(l1),Arrow,StickIntervalMarker(i=1,n=2));

markangle((string) sharpdegrees(l2,l1),
          radius=-1.5*markangleradius(),
          reverse(l2),l1,Arrow,red);

Figure 0011

With magnetizePoints=false.

Figure 0011: fig0110.asy
(Compiled with Asymptote version 1.87svn-r4652)
    
import trembling;
startTrembling(magnetizePoints=false);

size(12cm,0);

point A=(0,0), B=(5,2), C=(3,4);

triangle t=triangle(A,B,C),
et1=triangle(A,B,rotate(-60,A)*B),
et2=triangle(B,C,rotate(-60,B)*C),
et3=triangle(C,A,rotate(-60,C)*A);

draw(et1^^et2^^et3, 0.8*red);
dot(et1.Path()^^et2.Path()^^et3.Path());
draw(t); label(t, alignFactor=2.5);

point[] F=fermat(t);
dot("$F_1$",F[0], S, red);
dot("$F_2$",F[1], W, purple);

draw(circle(et1)^^circle(et2)^^circle(et3), 0.8*green);

draw(line(C,et1.C)^^line(A,et2.C)^^line(B,et3.C), 0.8*blue);
label("$N_1$",et1.VC);
label("$N_2$",et2.VC);
label("$N_3$",et3.VC);

Figure 0012

The same code with magnetizePoints=true.

Figure 0012: fig0120.asy
(Compiled with Asymptote version 1.87svn-r4652)
    
import trembling;
startTrembling();

size(12cm,0);

point A=(0,0), B=(5,2), C=(3,4);

triangle t=triangle(A,B,C),
et1=triangle(A,B,rotate(-60,A)*B),
et2=triangle(B,C,rotate(-60,B)*C),
et3=triangle(C,A,rotate(-60,C)*A);

draw(et1^^et2^^et3, 0.8*red);
dot(et1.Path()^^et2.Path()^^et3.Path());
draw(t); label(t, alignFactor=2.5);

point[] F=fermat(t);
dot("$F_1$",F[0], S, red);
dot("$F_2$",F[1], W, purple);

draw(circle(et1)^^circle(et2)^^circle(et3), 0.8*green);

draw(line(C,et1.C)^^line(A,et2.C)^^line(B,et3.C), 0.8*blue);
label("$N_1$",et1.VC);
label("$N_2$",et2.VC);
label("$N_3$",et3.VC);

Figure 0013
Figure 0013: fig0130.asy
(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);
}

Figure 0014

The two further examples show the influence of the parameter frequency.

Figure 0014: fig0140.asy
(Compiled with Asymptote version 1.87svn-r4652)
    
import trembling;

size(8cm);
startTrembling(angle=10, random=10, frequency=0.1);

draw(unitcircle);

Figure 0015
Figure 0015: fig0150.asy
(Compiled with Asymptote version 1.87svn-r4652)
    
import trembling;

size(8cm);
startTrembling(angle=10, random=10, frequency=0.5);

draw(unitcircle);

Dernière modification/Last modified: Sun Sep 20 18:47:44 CEST 2009
Philippe Ivaldi

Valide XHTML