## Asymptote using geometry.asy – fig1080

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

 (Compiled with Asymptote version 2.14svn-r5318)

import geometry;

size(10cm);

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

/* View the definition of triangle triangleabc(real,real,real,real,point) */
triangle t=triangleabc(3,4,5);
/* View the definition of void show(picture,Label,Label,Label,Label,Label,Label,triangle,pen,filltype) */
show(La="3", Lb="4", Lc="5",t);

Étiquettes : ,

## Asymptote using geometry.asy – fig1090

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

 (Compiled with Asymptote version 2.14svn-r5318)

import geometry;

size(10cm);

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

/* View the definition of triangle triangleAbc(real,real,real,real,point) */
triangle t=triangleAbc(60,3,5,angle=90);
show(Lb="3", Lc="5",t);
markangle("$60^\circ$",t.B,t.A,t.C);

Étiquettes : , ,

## Asymptote using geometry.asy – fig1100

Category: Asymptote,Examples 2D,geometry.asyPh. Ivaldi @ 19 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));

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 triangle anticomplementary(triangle) */
triangle at=anticomplementary(t);
draw(at, bp+0.8green);
label("$A'$", "$B'$", "$C'$", at, blue);

draw(segment(at.AB), bp+0.8green, StickIntervalMarker(2,1));
draw(segment(at.BC), bp+0.8green, StickIntervalMarker(2,2));
draw(segment(at.CA), bp+0.8green, CrossIntervalMarker(2,3));

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

## Asymptote using geometry.asy – fig1120

Category: Asymptote,Examples 2D,geometry.asyPh. Ivaldi @ 21 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));

drawline(t, linewidth(bp));
label(t,alignFactor=2, alignAngle=90);

/* View the definition of triangle symmedial(triangle) */
triangle st=symmedial(t);
draw(st, bp+0.8green);
label("$A'$", "$B'$", "$C'$", st, alignAngle=45, 0.8green);

/* View the definition of line median(vertex) */
line mA=median(t.VA);
draw(mA, blue);
dot("$M_A$",midpoint(t.BC), 1.5E, blue);
draw(segment(t.BC), bp+blue, StickIntervalMarker(2,2,blue));

/* View the definition of line bisector(vertex,real) */
line bA=bisector(t.VA);
draw(bA, grey);
/* View the definition of point bisectorpoint(side) */
dot("$B_A$", bisectorpoint(t.BC));

/* View the definition of line symmedian(vertex) */
line sA=symmedian(t.VA);
draw(sA, 0.8*green);

draw(symmedian(t.VB), 0.8*green);
draw(symmedian(t.VC), 0.8*green);

/* View the definition of point symmedian(triangle) */
point sP=symmedian(t);
dot(sP);

Étiquettes : , , , , ,

## Asymptote using geometry.asy – fig1130

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

 (Compiled with Asymptote version 2.14svn-r5318)

import geometry;
size(8cm,0);

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

triangle t=rotate(-20)*triangle((-1,0), (2,0), (0,2));
drawline(t, linewidth(bp));
label(t,alignFactor=4);

line bab=bisector(t.AB);
draw(bab, blue);
perpendicularmark(t.AB,bab,quarter=4);

line bac=bisector(t.AC);
draw(bac, blue);
perpendicularmark(t.AC,bac,quarter=4);

line bbc=bisector(t.BC);
draw(bbc, blue);
perpendicularmark(t.BC,bbc,quarter=4);

Étiquettes : , , , , ,

## Asymptote using geometry.asy – fig1140

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

 (Compiled with Asymptote version 2.14svn-r5318)

import geometry;
size(8cm,0);

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

triangle t=rotate(-20)*triangle((-1,0), (2,0), (0,2));
drawline(t, linewidth(bp));
label(t, alignAngle=90, alignFactor=2);

/* View the definition of point incenter(triangle) */
point incenter=incenter(t);

line ba=bisector(t.VA);
draw(ba, blue);
markangle((line) t.AB, (line) t.AC,StickIntervalMarker(i=2,n=1));

line bb=bisector(t.VB);
draw(bb, blue);
markangle((line) t.BC, (line) t.BA, radius=2cm, StickIntervalMarker(i=2,n=2));

line bc=bisector(t.VC);
draw(bc, blue);
markangle((line) t.CA, (line) t.CB, radius=1.5cm, StickIntervalMarker(i=2,n=3));

Étiquettes : , , , ,

## Asymptote using geometry.asy – fig1150

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

 (Compiled with Asymptote version 2.14svn-r5318)

import geometry;
size(8cm);

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

dotfactor *=1.5;
triangle t=triangleabc(3,4,5);
drawline(t, linewidth(bp));
label(t, alignFactor=3);

line l=line((-1,-2), (1,0.5));
draw(l, 0.8*red);
/* View the definition of point[] intersectionpoints(triangle,line,bool) */
dot(intersectionpoints(t,l), 0.8*red);

circle C=2*circle(t);
draw(C, 0.8*blue);
/* View the definition of point[] intersectionpoints(triangle,conic,bool) */
dot(intersectionpoints(t,C, true), 0.8*blue);

Étiquettes : , , , ,

## Asymptote using geometry.asy – fig1160

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

 (Compiled with Asymptote version 2.14svn-r5318)

unitsize(1cm);
import geometry;

point pA = (0,0);
point pB = (5,0);
point pC = (5,5);

dot(pA^^pB^^pC);
draw(pA--pB--pC--cycle);

distance(Label("$x \; \mathrm{cm}$",align=S),pA,pB,3mm);
distance(Label("$y \; \mathrm{cm}$",align=E),pB,pC,3mm);
distance(Label("$z \; \mathrm{cm}$",align=I*dir(pA--pC)),pA,pC,-3mm);

shipout(bbox(xmargin=1mm,invisible));

Étiquettes : , , , , , ,

## Asymptote using trembling.asy – fig0010

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

 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

 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

 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

 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 – fig0060

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

 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

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

Étiquettes : , , , ,

## Asymptote using trembling.asy – fig0080

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

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

Étiquettes : , , , , ,

## Fractals with Asymptote – fig0110

Category: Asymptote,Examples 2D,FractalsPh. Ivaldi @ 7 h 53 min

 (Compiled with Asymptote version 1.87svn-r4652)

/* Explanations HERE */
import geometry;
size(10cm,0);

triangle[] dissect(triangle T, int n)
{
if(n <= 0) return new triangle[]{T};
triangle[] OT;
point M=midpoint(T.BC);
triangle[] Tp=dissect(triangle(M,T.A,T.B),n-1);
for(triangle t : Tp) OT.insert(0,t);
triangle[] Tp=dissect(triangle(M,T.C,T.A),n-1);
for(triangle t : Tp) OT.insert(0,t);
return OT;
}

triangle T=rotate(45)*triangle((1,1),(0,0),(2,0));
triangle[] DT=dissect(T,9);
path g;
transform R=reflect(T.BC);

for(int i : DT.keys) {
draw(DT[i],miterjoin+0.9*red);
draw(R*DT[i],miterjoin+0.9*red);
g=g--centroid(DT[i]);
}

draw(scale(sqrt(2))*unitsquare,bp+miterjoin+0.8*blue);
draw(g--reverse(R*g)--cycle,bp+miterjoin+yellow);

shipout(bbox(sqrt(2)*mm, Fill(black)));

Étiquettes : , , , , ,

## Fractals with Asymptote – fig0120

Category: Asymptote,Examples 2D,FractalsPh. Ivaldi @ 8 h 53 min

 (Compiled with Asymptote version 1.87svn-r4652)

/* Explanations HERE */
size(12cm,0);

import geometry;

triangle T=triangleAbc(90,Tan(30),1);

triangle[] reverse(triangle[] arr)
{
triangle[] or;
int l=arr.length;
for(int i=0; i < l; ++i) {
or.push(arr[l-i-1]);
}
return or;
}

triangle[] dissect(triangle T, int n, bool reverse=false)
{
if(n <= 0) return new triangle[]{T};
triangle[] OT;

point M=curpoint(T.AB,T.b()*Tan(30));
point H=projection(T.BC)*M;
triangle[] OT1, OT2, OT3;
OT.append(dissect(triangle(H,T.B,M),n-1,!reverse));
OT.append(reverse((dissect(triangle(H,T.C,M),n-1,!reverse))));
OT.append(dissect(triangle(T.A,T.C,M),n-1,!reverse));
return OT;
}

triangle[] DT=dissect(T,5);
point O=centroid(DT[0]);
path g;
transform Ro=rotate(30,T.B), Re=reflect(T.BC), Roj;

for(int i : DT.keys) {
O=incenter(DT[i]);
g=g--O;
}

g=reverse(g);
path G, g=g--Re*reverse(g) ;
for (int j=0; j < 12; j += 2) G=G--Ro^(-j)*g;

fill(G--cycle,0.3*blue);

for(int i : DT.keys) {
for (int j=0; j < 12; j += 2) {
Roj=Ro^j;
draw(Roj*DT[i],miterjoin+0.8*red);
draw(Roj*(Re*DT[i]),miterjoin+0.8*red);
}
}

draw(G--cycle,bp+miterjoin+0.9*yellow);

shipout(bbox(2mm, FillDraw(black, 1mm+miterjoin+deepblue)));

Étiquettes : , , , , ,

## Official Asymptote example – triangle

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

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

size(0,100);
import geometry;

triangle t=triangle(b=3,alpha=90,c=4);

dot((0,0));

draw(t);
draw(rotate(90)*t,red);
draw(shift((-4,0))*t,blue);
draw(reflect((0,0),(1,0))*t,green);
draw(slant(2)*t,magenta);

Étiquettes : , , ,

## Animation with Asymptote – fig0040

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

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