Asymptote using trembling.asy – fig0010

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

Figure 0001

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

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

Étiquettes : , ,


Asymptote using trembling.asy – fig0020

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

Figure 0002

Using the routine startTrembling, all drawn paths are distorted.

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

Étiquettes : , ,


Asymptote using trembling.asy – fig0030

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

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.

(Compiled with Asymptote version 1.87svn-r4652)
    
import trembling;
startTrembling();

size(8cm);

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

Étiquettes : , ,


Asymptote using trembling.asy – fig0040

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

Figure 0004

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

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

Étiquettes : , ,


Asymptote using trembling.asy – fig0050

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

Figure 0005

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

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

Étiquettes : ,


Asymptote using trembling.asy – fig0060

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

Figure 0006

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

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

Étiquettes : , , ,


Asymptote using trembling.asy – fig0070

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

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

Étiquettes : , , , ,


Asymptote using trembling.asy – fig0080

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

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

Étiquettes : , , , , ,


Asymptote using trembling.asy – fig0090

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

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

Étiquettes : ,


Asymptote using trembling.asy – fig0100

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

Figure 0010

Note that the makers are also deformed...

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

Étiquettes : , ,


Asymptote using trembling.asy – fig0110

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

Figure 0011

With magnetizePoints=false.

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

Étiquettes : , , , , , ,


Asymptote using trembling.asy – fig0120

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

Figure 0012

The same code with magnetizePoints=true.

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

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


Asymptote using trembling.asy – fig0140

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

Figure 0014

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

(Compiled with Asymptote version 1.87svn-r4652)
    
import trembling;

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

draw(unitcircle);

Étiquettes : ,


Asymptote using trembling.asy – fig0150

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

Figure 0015
(Compiled with Asymptote version 1.87svn-r4652)
    
import trembling;

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

draw(unitcircle);

Étiquettes : ,


Official Asymptote example – floatingdisk

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

Figure 0069
(Compiled with Asymptote version 2.14svn-r5318)
/* This code comes from The Official Asymptote Gallery */
    
import trembling; 
settings.outformat="pdf"; 
size(6cm,0); 
 
real R=1/5; 
real h=0.5; 
real d=1/12; 
real l=.7; 
 
pair pA=(-l,0); 
pair pB=(l,0); 

tremble tr=tremble(angle=10,frequency=0.1,random=50,fuzz=1);
path waterline=tr.deform(pA..pB); 

path disk=shift(0,-d)*scale(R)*unitcircle; 
path water=waterline--(l,-h)--(-l,-h)--(-l,0)--cycle; 
path container=(l,1/7)--(l,-h)--(-l,-h)--(-l,1/7); 
 
filldraw(disk,red,linewidth(.3)); 
fill(water,mediumgrey+opacity(0.5)); 
draw(waterline); 
 
draw(container,linewidth(1.5)); 
 
shipout(bbox(2mm));

Étiquettes : ,