User:Azjps/geogebra

< User:Azjps
Revision as of 21:54, 20 June 2010 by Azjps (talk | contribs) (Functions and Integrals)

Gallery of examples: The following Asymptote codes were all generated from Geogebra files (File > Export > Graphics View as Asymptote ...).

Points

[asy] import graph; size(11.6cm); real lsf=0.5; pen dps=linewidth(0.7)+fontsize(10); defaultpen(dps); real xmin=-5.8,xmax=5.8,ymin=-2.2,ymax=5.72;  pen wwqqqq=rgb(0.4,0,0), xdxdff=rgb(0.49,0.49,1), uququq=rgb(0.25,0.25,0.25), ffqqtt=rgb(1,0,0.2); Label laxis; laxis.p=fontsize(10);  xaxis("$x$",-5.8,5.8,defaultpen+wwqqqq+linewidth(1.2),Ticks(laxis,Step=1.0,Size=2),above=true); yaxis("$y$",-3.22,5.72,defaultpen+wwqqqq+linewidth(1.2),Ticks(laxis,Step=1.0,Size=2),above=true); draw(shift((-4,0))*scale(0.11)*(expi(pi/4)--expi(5*pi/4)^^expi(3*pi/4)--expi(7*pi/4)),xdxdff); draw(circle((-3,0),0.11),xdxdff); draw(shift((-2,0))*scale(0.11)*((0,1)--(0,-1)^^(1,0)--(-1,0)),xdxdff); fill(shift((-1,0))*scale(0.11)*((1,0)--(0,1)--(-1,0)--(0,-1)--cycle),xdxdff); draw(shift((0,0))*scale(0.11)*((1,0)--(0,1)--(-1,0)--(0,-1)--cycle),uququq); fill(shift((1,0))*rotate(90)*scale(0.11)*((1,0)--expi(2*pi/3)--expi(4*pi/3)--cycle),xdxdff); fill(shift((2,0))*rotate(270)*scale(0.11)*((1,0)--expi(2*pi/3)--expi(4*pi/3)--cycle),xdxdff); fill(shift((3,0))*scale(0.11)*((1,0)--expi(2*pi/3)--expi(4*pi/3)--cycle),xdxdff); fill(shift((4,0))*rotate(180)*scale(0.11)*((1,0)--expi(2*pi/3)--expi(4*pi/3)--cycle),xdxdff); draw(shift((-4,1))*scale(0.11)*(expi(pi/4)--expi(5*pi/4)^^expi(3*pi/4)--expi(7*pi/4)),blue); draw(circle((-3,1),0.11),blue); draw(shift((-2,1))*scale(0.11)*((0,1)--(0,-1)^^(1,0)--(-1,0)),blue); fill(shift((-1,1))*scale(0.11)*((1,0)--(0,1)--(-1,0)--(0,-1)--cycle),blue); draw(shift((0,1))*scale(0.11)*((1,0)--(0,1)--(-1,0)--(0,-1)--cycle),xdxdff); fill(shift((1,1))*rotate(90)*scale(0.11)*((1,0)--expi(2*pi/3)--expi(4*pi/3)--cycle),blue); fill(shift((2,1))*rotate(270)*scale(0.11)*((1,0)--expi(2*pi/3)--expi(4*pi/3)--cycle),blue); fill(shift((3,1))*scale(0.11)*((1,0)--expi(2*pi/3)--expi(4*pi/3)--cycle),blue); fill(shift((4,1))*rotate(180)*scale(0.11)*((1,0)--expi(2*pi/3)--expi(4*pi/3)--cycle),blue); draw(shift((-4,2))*scale(0.18)*(expi(pi/4)--expi(5*pi/4)^^expi(3*pi/4)--expi(7*pi/4)),ffqqtt); draw(circle((-3,2),0.18),ffqqtt); draw(shift((-2,2))*scale(0.18)*((0,1)--(0,-1)^^(1,0)--(-1,0)),ffqqtt); fill(shift((-1,2))*scale(0.18)*((1,0)--(0,1)--(-1,0)--(0,-1)--cycle),ffqqtt); draw(shift((0,2))*scale(0.18)*((1,0)--(0,1)--(-1,0)--(0,-1)--cycle),ffqqtt); fill(shift((1,2))*rotate(90)*scale(0.11)*((1,0)--expi(2*pi/3)--expi(4*pi/3)--cycle),ffqqtt); fill(shift((2,2))*rotate(270)*scale(0.11)*((1,0)--expi(2*pi/3)--expi(4*pi/3)--cycle),ffqqtt); fill(shift((3,2))*scale(0.11)*((1,0)--expi(2*pi/3)--expi(4*pi/3)--cycle),ffqqtt); fill(shift((4,2))*rotate(180)*scale(0.25)*((1,0)--expi(2*pi/3)--expi(4*pi/3)--cycle),ffqqtt);  dot((-5,0),xdxdff); label("$A$",(-4.92,0.12),NE*lsf,xdxdff); label("$B$",(-3.92,-0.12),NE*lsf,xdxdff); label("$C$",(-2.92,0.12),NE*lsf,xdxdff); label("$D$",(-1.92,0.12),NE*lsf,xdxdff); label("$E$",(-0.92,0.12),NE*lsf,xdxdff); label("$F$",(0.08,0.12),NE*lsf,uququq); label("$G$",(1.08,0.12),NE*lsf,xdxdff); label("$H$",(2.08,0.12),NE*lsf,xdxdff); label("$I$",(3.08,0.12),NE*lsf,xdxdff); label("$J$",(4.08,0.12),NE*lsf,xdxdff); dot((5,0),linewidth(1pt)+xdxdff); label("$K$",(5.08,0.04),NE*lsf,xdxdff); dot((-5,1),blue); label("$L$",(-4.92,1.12),NE*lsf,blue); label("$M$",(-3.92,1.12),NE*lsf,blue); label("$N$",(-2.92,1.12),NE*lsf,blue); label("$O$",(-1.92,1.12),NE*lsf,blue); label("$P$",(-0.92,1.12),NE*lsf,blue); label("$Q$",(0.08,1.12),NE*lsf,xdxdff); label("$R$",(1.08,1.12),NE*lsf,blue); label("$S$",(2.08,1.12),NE*lsf,blue); label("$T$",(3.08,1.12),NE*lsf,blue); label("$U$",(4.08,1.12),NE*lsf,blue); dot((5,1),blue); label("$V$",(5.08,1.12),NE*lsf,blue); dot((-5,2),blue); dot((5,2),linewidth(5pt)+blue); label("$I_1$",(5.08,2.2),NE*lsf,blue); dot((-5,3),blue); dot((-5,4),blue); dot((-5,3.5),uququq);  clip((xmin,ymin)--(xmin,ymax)--(xmax,ymax)--(xmax,ymin)--cycle);  [/asy] Support for drawing many different options of points.

[asy] import graph; size(11.6cm); real lsf=0.5; pen dps=linewidth(0.7)+fontsize(10); defaultpen(dps); pen ds=black; real xmin=-5.8,xmax=5.8,ymin=-3.22,ymax=5.72;  pen wwqqqq=rgb(0.4,0,0), ffqqtt=rgb(1,0,0.2); Label laxis; laxis.p=fontsize(10);  xaxis("$x$",-5.8,5.8,defaultpen+wwqqqq+linewidth(1.2),Ticks(laxis,Step=1.0,Size=2),above=true); yaxis("$y$",-3.22,5.72,defaultpen+wwqqqq+linewidth(1.2),Ticks(laxis,Step=1.0,Size=2),above=true); draw(shift((-4,0))*scale(0.11)*(expi(pi/4)--expi(5*pi/4)^^expi(3*pi/4)--expi(7*pi/4))); draw(circle((-3,0),0.11)); draw(shift((-2,0))*scale(0.11)*((0,1)--(0,-1)^^(1,0)--(-1,0))); fill(shift((-1,0))*scale(0.11)*((1,0)--(0,1)--(-1,0)--(0,-1)--cycle)); draw(shift((0,0))*scale(0.11)*((1,0)--(0,1)--(-1,0)--(0,-1)--cycle)); fill(shift((1,0))*rotate(90)*scale(0.11)*((1,0)--expi(2*pi/3)--expi(4*pi/3)--cycle)); fill(shift((2,0))*rotate(270)*scale(0.11)*((1,0)--expi(2*pi/3)--expi(4*pi/3)--cycle)); fill(shift((3,0))*scale(0.11)*((1,0)--expi(2*pi/3)--expi(4*pi/3)--cycle)); fill(shift((4,0))*rotate(180)*scale(0.11)*((1,0)--expi(2*pi/3)--expi(4*pi/3)--cycle)); draw(shift((-4,1))*scale(0.11)*(expi(pi/4)--expi(5*pi/4)^^expi(3*pi/4)--expi(7*pi/4))); draw(circle((-3,1),0.11)); draw(shift((-2,1))*scale(0.11)*((0,1)--(0,-1)^^(1,0)--(-1,0))); fill(shift((-1,1))*scale(0.11)*((1,0)--(0,1)--(-1,0)--(0,-1)--cycle)); draw(shift((0,1))*scale(0.11)*((1,0)--(0,1)--(-1,0)--(0,-1)--cycle)); fill(shift((1,1))*rotate(90)*scale(0.11)*((1,0)--expi(2*pi/3)--expi(4*pi/3)--cycle)); fill(shift((2,1))*rotate(270)*scale(0.11)*((1,0)--expi(2*pi/3)--expi(4*pi/3)--cycle)); fill(shift((3,1))*scale(0.11)*((1,0)--expi(2*pi/3)--expi(4*pi/3)--cycle)); fill(shift((4,1))*rotate(180)*scale(0.11)*((1,0)--expi(2*pi/3)--expi(4*pi/3)--cycle)); draw(shift((-4,2))*scale(0.18)*(expi(pi/4)--expi(5*pi/4)^^expi(3*pi/4)--expi(7*pi/4))); draw(circle((-3,2),0.18)); draw(shift((-2,2))*scale(0.18)*((0,1)--(0,-1)^^(1,0)--(-1,0))); fill(shift((-1,2))*scale(0.18)*((1,0)--(0,1)--(-1,0)--(0,-1)--cycle)); draw(shift((0,2))*scale(0.18)*((1,0)--(0,1)--(-1,0)--(0,-1)--cycle)); fill(shift((1,2))*rotate(90)*scale(0.11)*((1,0)--expi(2*pi/3)--expi(4*pi/3)--cycle)); fill(shift((2,2))*rotate(270)*scale(0.11)*((1,0)--expi(2*pi/3)--expi(4*pi/3)--cycle)); fill(shift((3,2))*scale(0.11)*((1,0)--expi(2*pi/3)--expi(4*pi/3)--cycle)); fill(shift((4,2))*rotate(180)*scale(0.25)*((1,0)--expi(2*pi/3)--expi(4*pi/3)--cycle)); draw((-4,3)--(-4,4),ffqqtt);  dot((-5,0),ds); label("$A$",(-4.92,0.12),NE*lsf); label("$B$",(-3.92,0.12),NE*lsf); label("$C$",(-2.92,0.12),NE*lsf); label("$D$",(-1.92,0.12),NE*lsf); label("$E$",(-0.92,0.12),NE*lsf); label("$F$",(0.08,0.12),NE*lsf); label("$G$",(1.08,0.12),NE*lsf); label("$H$",(2.08,0.12),NE*lsf); label("$I$",(3.08,0.12),NE*lsf); label("$J$",(4.08,0.12),NE*lsf); dot((5,0),linewidth(1pt)+ds); label("$K$",(5.08,0.04),NE*lsf); dot((-5,1),ds); label("$L$",(-4.92,1.12),NE*lsf); label("$M$",(-3.92,1.12),NE*lsf); label("$N$",(-2.92,1.12),NE*lsf); label("$O$",(-1.92,1.12),NE*lsf); label("$P$",(-0.92,1.12),NE*lsf); label("$Q$",(0.08,1.12),NE*lsf); label("$R$",(1.08,1.12),NE*lsf); label("$S$",(2.08,1.12),NE*lsf); label("$T$",(3.08,1.12),NE*lsf); label("$U$",(4.08,1.12),NE*lsf); dot((5,1),ds); label("$V$",(5.08,1.12),NE*lsf); dot((-5,2),ds); dot((5,2),linewidth(5pt)+ds); label("$I_1$",(5.08,2.2),NE*lsf); dot((-5,3),ds); dot((-5,4),ds); dot((-5,3.5),ds); dot((-4,3),ds); dot((-4,4),ds);  clip((xmin,ymin)--(xmin,ymax)--(xmax,ymax)--(xmax,ymin)--cycle);  [/asy] Also includes an option to remove the coloring of just points (to avoid Geogebra's default of using different colors for different classes of points).


<geogebra>1c89b124bb471a351bc108d34f8096d1f892e012</geogebra> 


Also has support for different types of axes: bold, with arrows, different colors, different labelling schemes (including with $\pi$ labels as in the next example). Also supports drawing of grid (with for loop constructions). There is a checkbox option to show and hide axes and grids.

Known bugs:

  • Labels may be displaced more from points than shown in Geogebra window. This is not really a bug but a font problem, since Asymptote will write the labels in LaTeX, which has a different size from normal text. The recommended solution is to decrease the font size to fontsize(8) or fontsize(7).
  • In cse5 mode, certain dots will appear smaller (default pointpen nature of cse5).


Functions and Integrals

[asy] import graph; size(15.36cm); real lsf=0.5; pen dps=linewidth(0.7)+fontsize(10); defaultpen(dps); pen ds=black; real xmin=-7.3,xmax=8.06,ymin=-1.44,ymax=5.2;  pen ttqqzz=rgb(0.2,0,0.6), fueaev=rgb(0.96,0.92,0.9), zzttqq=rgb(0.6,0.2,0); real f2(real x){return 2+2*cos(2*x+pi);} filldraw(graph(f2,-6.28,-3.14)--(-3.14,0)--(-6.28,0)--cycle,fueaev,zzttqq); filldraw(box((-3.14,0),(-2.51,0)),fueaev,zzttqq); filldraw(box((-2.51,0),(-1.88,1.38)),fueaev,zzttqq); filldraw(box((-1.88,0),(-1.26,3.62)),fueaev,zzttqq); filldraw(box((-1.26,0),(-0.63,1.38)),fueaev,zzttqq); filldraw(box((-0.63,0),(0,0)),fueaev,zzttqq); filldraw(box((0,0),(0.63,1.38)),fueaev,zzttqq); filldraw(box((0.63,0),(1.26,3.62)),fueaev,zzttqq); filldraw(box((1.26,0),(1.88,4)),fueaev,zzttqq); filldraw(box((1.88,0),(2.51,3.62)),fueaev,zzttqq); filldraw(box((2.51,0),(pi,1.38)),fueaev,zzttqq); filldraw((pi,0)--(3.77,0)--(3.77,1.38)--(pi,0)--cycle,fueaev,zzttqq); filldraw((3.77,0)--(4.4,0)--(4.4,3.62)--(3.77,1.38)--cycle,fueaev,zzttqq); filldraw((4.4,0)--(5.03,0)--(5.03,3.62)--(4.4,3.62)--cycle,fueaev,zzttqq); filldraw((5.03,0)--(5.65,0)--(5.65,1.38)--(5.03,3.62)--cycle,fueaev,zzttqq); filldraw((5.65,0)--(6.28,0)--(6.28,0)--(5.65,1.38)--cycle,fueaev,zzttqq);  Label laxis; laxis.p=fontsize(10); string xlbl(real x){int n=round(x/pi); if(n==-1) return "$-\pi$"; if(n==1) return "$\pi$"; if(n==0) return "$0$"; return "$"+string(round(x/pi))+"\pi$";}  xaxis("$\theta$",-7.3,8.06,linewidth(1.2),Ticks(laxis,xlbl,Step=3.141592653589793,Size=2),Arrows(6),above=true); yaxis(-1.44,5.2,linewidth(1.2),Ticks(laxis,Step=1.0,Size=2),Arrows(6),above=true); real f1(real x){return 2+2*cos(2*x+pi);} draw(graph(f1,-7.29,8.05),linewidth(1.6)+ttqqzz); label("$2 + 2 \cos(2x + \pi)$",(-7.14,4.1),NE*lsf,ttqqzz);  clip((xmin,ymin)--(xmin,ymax)--(xmax,ymax)--(xmax,ymin)--cycle);  [/asy] Supports most functions and can draw integrals and Riemman-like sums. Above, the function is given by $f(x) = 2+2cos(2x)$; the four shaded regions are drawn using the commands Integral[f,-2pi,-pi], LowerSum[f,-pi,0,5], UpperSum[f,0,pi,5], and TrapezoidalSum[f,pi,2pi,5].

<geogebra>6636ccd3479762307d932c319db7ec1998236a4c</geogebra> 

Known bugs:

  • May capitalize certain functions (like trigonometric functions). Please let me know if this happens.
  • Certain functions recognized by Geogebra might not be recognized by Asymptote.
  • Integrals/Sums drawn over functions that reach undefined values (ex, $ln(x)$ at $x=0$) will cause a break when drawn in Asymptote (unlikely to be fixed); drawing the functions themselves will work, however.
  • With certain very contrived function strings, it is possible to break the code (won't fix).
  • Sometimes will render LaTeX commands in function strings. Please let me know if this happens.

Lines and Conics

import graph; size(11.6cm); real lsf=0.5; pen dps=linewidth(0.7)+fontsize(10); defaultpen(dps); pen ds=black; real xmin=-5.06,xmax=6.54,ymin=-3.4,ymax=5.54; 
pen qqzztt=rgb(0,0.6,0.2), qqqqzz=rgb(0,0,0.6), ffqqtt=rgb(1,0,0.2);draw(circle((0,0),1),linewidth(2.8));draw((0,0)--(1,0)); draw((0,ymin)--(0,ymax)); draw((xmin,(-(3.19)-(1.03)*xmin)/3.02)--(xmax,(-(3.19)-(1.03)*xmax)/3.02)); draw((xmin,(-(-3.19)-(-0.88)*xmin)/3.06)--(xmax,(-(-3.19)-(-0.88)*xmax)/3.06)); draw(shift((-2.81,0.83))*rotate(54.75)*xscale(2.12)*yscale(1.91)*unitcircle,linewidth(1.6)+linetype("2pt 8pt 10pt 8pt")+qqzztt);pair hl1(real t){return (0.53*(1+t^2)/(1-t^2),0.74*2*t/(1-t^2));} pair hr1(real t){return (0.53*(-1-t^2)/(1-t^2),0.74*(-2)*t/(1-t^2));} draw(shift((3.63,0.55))*rotate(178.11)*graph(hl1,-0.99,0.99),linewidth(1.6)+linetype("4pt 4pt")+qqqqzz); draw(shift((3.63,0.55))*rotate(178.11)*graph(hr1,-0.99,0.99),linewidth(1.6)+linetype("4pt 4pt")+qqqqzz); real p1(real x){return x^2/2/3.48;} draw(shift((1.16,3.19))*rotate(16.04)*graph(p1,-13.93,13.93),linewidth(2)+ffqqtt); 
dot((0,0),ds); dot((1,0),ds); dot((-3.34,0.08),ds); dot((-2.28,1.58),ds); dot((-3.4,2.72),ds); dot((-0.94,0.34),ds); dot((2.72,0.58),ds); dot((4.54,0.52),ds); dot((0.68,4.86),ds); 
clip((xmin,ymin)--(xmin,ymax)--(xmax,ymax)--(xmax,ymin)--cycle); 
 (Error making remote request. Unknown error_msg)

Support for lines, rays, vectors (not shown), and the different conic sections (which includes circle arcs and sectors), including different line colors, line types, line sizes, and in some cases, fill colors. Lines and rays automatically re-scale to fit the entire window when the diagram size is changed.

<geogebra>f475aec9be4bbeb0d7a8b525fb2cbbe905383c5d</geogebra> 

Known bugs:

  • Circle fills and sectors fills do not work.

Filled objects

import graph; size(9.7cm); real lsf=0.5; pen dps=linewidth(0.7)+fontsize(10); defaultpen(dps); pen ds=black; real xmin=-3.58,xmax=6.12,ymin=-1.1,ymax=6.1; 
pen cqcqcq=rgb(0.75,0.75,0.75), fueaev=rgb(0.96,0.92,0.9), zzttqq=rgb(0.6,0.2,0), evefev=rgb(0.9,0.94,0.9), qqwuqq=rgb(0,0.39,0);
filldraw((0,0)--(2,0)--(3.41,1.41)--(3.41,3.41)--(2,4.83)--(0,4.83)--(-1.41,3.41)--(-1.41,1.41)--cycle,fueaev,zzttqq); filldraw(arc((2,0),0.6,45,180)--(2,0)--cycle,evefev,qqwuqq); filldraw(arc((0,0),0.6,0,135)--(0,0)--cycle,evefev,qqwuqq); filldraw(arc((-1.41,1.41),0.6,-45,90)--(-1.41,1.41)--cycle,evefev,qqwuqq); filldraw(arc((-1.41,3.41),0.6,-90,45)--(-1.41,3.41)--cycle,evefev,qqwuqq); filldraw(arc((0,4.83),0.6,-135,0)--(0,4.83)--cycle,evefev,qqwuqq); filldraw(arc((2,4.83),0.6,180,315)--(2,4.83)--cycle,evefev,qqwuqq); filldraw(arc((3.41,3.41),0.6,135,270)--(3.41,3.41)--cycle,evefev,qqwuqq); filldraw(arc((3.41,1.41),0.6,90,225)--(3.41,1.41)--cycle,evefev,qqwuqq); 
/*grid*/ pen gs=linewidth(0.7)+cqcqcq+linetype("2pt 2pt"); real gx=1,gy=1;
for(real i=ceil(xmin/gx)*gx;i<=floor(xmax/gx)*gx;i+=gx) draw((i,ymin)--(i,ymax),gs); for(real i=ceil(ymin/gy)*gy;i<=floor(ymax/gy)*gy;i+=gy) draw((xmin,i)--(xmax,i),gs); draw((0,0)--(2,0),zzttqq); draw((2,0)--(3.41,1.41),zzttqq); draw((3.41,1.41)--(3.41,3.41),zzttqq); draw((3.41,3.41)--(2,4.83),zzttqq); draw((2,4.83)--(0,4.83),zzttqq); draw((0,4.83)--(-1.41,3.41),zzttqq); draw((-1.41,3.41)--(-1.41,1.41),zzttqq); draw((-1.41,1.41)--(0,0),zzttqq); draw(arc((2,0),0.6,0.79,pi),qqwuqq); draw(arc((2,0),0.5,0.79,pi),qqwuqq); draw(arc((-1.41,1.41),0.6,-45,85.38),qqwuqq,BeginArcArrow(6)); draw(arc((-1.41,3.41),0.6,-90,40.38),qqwuqq,EndArcArrow(6)); draw(arc((0,4.83),0.6,-2.36,0),qqwuqq); draw((0.21,4.33)--(0.25,4.22),qqwuqq); draw((0.14,4.31)--(0.17,4.19),qqwuqq); draw((0.27,4.36)--(0.33,4.26),qqwuqq); draw(arc((2,4.83),0.6,pi,5.5),qqwuqq); draw((1.73,4.36)--(1.67,4.26),qqwuqq); draw((1.86,4.31)--(1.83,4.19),qqwuqq); draw(arc((3.41,3.41),0.6,2.36,4.71),qqwuqq); draw((2.92,3.21)--(2.8,3.16),qqwuqq); draw(arc((3.41,1.41),0.6,1.57,3.93),qqwuqq); draw(arc((3.41,1.41),0.5,1.57,3.93),qqwuqq); draw(arc((3.41,1.41),0.4,1.57,3.93),qqwuqq); draw((0,0)--(2,0),EndArrow(6));
dot((0,0),ds); dot((2,0),ds); dot((3.41,1.41),ds); dot((3.41,3.41),ds); dot((2,4.83),ds); dot((0,4.83),ds); dot((-1.41,3.41),ds); dot((-1.41,1.41),ds); label("$135^\circ$",(2.64,0.12),NE*lsf,qqwuqq); label("$135^\circ$",(0.28,0.78),NE*lsf,qqwuqq); label("$135^\circ$",(-1.1,2.06),NE*lsf,qqwuqq); label("$135^\circ$",(-0.72,3.28),NE*lsf,qqwuqq); label("$135^\circ$",(-1,4.68),NE*lsf,qqwuqq); label("$135^\circ$",(2.2,4.8),NE*lsf,qqwuqq); label("$135^\circ$",(3.38,3.64),NE*lsf,qqwuqq); label("$135^\circ$",(3.5,1.58),NE*lsf,qqwuqq); 
clip((xmin,ymin)--(xmin,ymax)--(xmax,ymax)--(xmax,ymin)--cycle);  (Error making remote request. Unknown error_msg)

Supports certain transparent fills. There are four possible options allowed for fill colors:

  • No fills. Self-explanatory.
  • Opaque fills only. This will only cause filled objects with opaque transparencies, which are arbitrarily defined as shapes with transparency alpha values greater than 0.9 (on a 0 to 1, 1 being fully opaque, scale), to appear filled.
  • With opacity pen. This uses the opacity() pen to draw transparency fills. This option does not work on the AoPS forums.
  • By layering (example above). Filled objects have "fake transparency" where filled objects are simply drawn before any other objects are drawn, and transparencies just cause a lighter shade. However, filled objects will override other filled objects, and so there is no "darker" transparencies along intersecting regions.

Polygons and angles, by default, will have transparent fill colors. Both have support for different line colors and fill colors (with different transparencies, colors, line sizes, etc). Angles include several different styles, including multiple arcs, tick marks, and arc arrows.

<geogebra>008edd5949bd2386cd1b9a7b223f16e44cbaf28c</geogebra> 

Known bugs:

  • Non re-sized arc arrows.
  • Overlapping transparency color problems.

Text

import graph; size(11.58cm); real lsf=0.5; pen dps=linewidth(0.7)+fontsize(10); defaultpen(dps); pen ds=black; real xmin=-4.3,xmax=7.28,ymin=-2.64,ymax=6.3; 
pen cqcqcq=rgb(0.75,0.75,0.75), qqccqq=rgb(0,0.8,0), ccqqtt=rgb(0.8,0,0.2);
/*grid*/ pen gs=linewidth(0.7)+cqcqcq+linetype("3pt 3pt"); real gx=1,gy=1;
for(real i=ceil(xmin/gx)*gx;i<=floor(xmax/gx)*gx;i+=gx) draw((i,ymin)--(i,ymax),gs); for(real i=ceil(ymin/gy)*gy;i<=floor(ymax/gy)*gy;i+=gy) draw((xmin,i)--(xmax,i),gs); 
Label laxis; laxis.p=fontsize(10); 
xaxis(-4.3,7.28,defaultpen+black,Ticks(laxis,Step=1.0,Size=2),Arrows(6),above=true); yaxis(-2.64,6.3,defaultpen+black,Ticks(laxis,Step=1.0,Size=2),Arrows(6),above=true); label("abc",(-3,5.24),SE*lsf); label("a2 b3 c3 o pi e infty otimes sqrt(x)",(-3,4.24),SE*lsf); label("$\parbox{1.4 cm}{abc \\  def \\  ghi}$",(-3,3.24),SE*lsf); label("$  \sqrt{ abc }  $",(-3,2.24),SE*lsf); label("$abc \\ def$",(-3,1.24),SE*lsf); label("$abc$",(-3,0.24),SE*lsf); label("$\alpha\beta\gamma$",(-3,-0.76),SE*lsf); label("alpha beta gamma ",(-3,-1.76),SE*lsf); label("\textit{\textbf{abc}}",(0,5.24),SE*lsf,qqccqq+fontsize(12)); label("\textit{\textbf{alpha beta gamma }}",(0,-1.76),SE*lsf,qqccqq+fontsize(12)); label("$\mathit{\mathbf{ \alpha\beta\gamma }}$",(0,-0.76),SE*lsf,ccqqtt+fontsize(12)); label("\textit{\textbf{$abc$}}",(0,0.24),SE*lsf,qqccqq+fontsize(12)); label("$\mathit{\mathbf{ abcdef }}$",(0,1.24),SE*lsf,ccqqtt+fontsize(12)); label("$\mathit{\mathbf{  \sqrt{ abc }  }}$",(0,2.24),SE*lsf,ccqqtt+fontsize(12)); label("$\parbox{1.5 cm}{\textit{\textbf{abc \\  def \\  ghi}}}$",(0,3.24),SE*lsf,qqccqq+fontsize(12)); label("\textit{\textbf{a2 b3 co pi e infty otimes sqrt(x)}}",(0,4.24),SE*lsf,qqccqq+fontsize(12)); label("\textit{abc}",(3,5.24),SE*lsf,fontsize(8)); label("$\parbox{1.34 cm}{\textit{abc \\  def \\  ghi}}$",(3,3.24),SE*lsf,fontsize(8)); label("$\mathit{  \sqrt{ abc }  }$",(3,2.24),SE*lsf,fontsize(8)); label("$\mathit{abcdef}$",(3,1.24),SE*lsf,fontsize(8)); label("\textit{$abc$}",(3,0.24),SE*lsf,fontsize(8)); label("\textit{alpha beta gamma }",(3,-1.76),SE*lsf,fontsize(8)); label("$\mathit{ \alpha\beta\gamma }$",(3,-0.76),SE*lsf,fontsize(8)); label("pi e infty otimes questeq ne le ge neg wedge vee parallel perp in subseteq subset cong equiv measuredangle triangle ",(3,4.24),SE*lsf); 
dot((-3,0),ds); dot((-3,1),ds); dot((-3,2),ds); dot((-3,3),ds); dot((-3,4),ds); dot((-3,5),ds); dot((0,5),ds); dot((0,4),ds); dot((0,3),ds); dot((0,2),ds); dot((0,1),ds); dot((0,0),ds); dot((0,-1),ds); dot((-3,-1),ds); dot((-3,-2),ds); dot((0,-2),ds); dot((3,5),ds); dot((3,4),ds); dot((3,3),ds); dot((3,2),ds); dot((3,1),ds); dot((3,0),ds); dot((3,-1),ds); dot((3,-2),ds); 
clip((xmin,ymin)--(xmin,ymax)--(xmax,ymax)--(xmax,ymin)--cycle); 
 (Error making remote request. Unknown error_msg)

Supports most text options, including different font styles, bold, italics, and $\LaTeX$.

<geogebra>087e142af582ed87e10a11362584f7ced9b606bd</geogebra> 

Known bugs:

  • Including text strings with dollar signs will convert it to LaTeX. An odd number of dollar signs in a text string will usually cause an error (working on for $\LaTeX$ strings).
  • Certain contrived strings will break the code (may never be fixed).
  • Fontsize might not be correct occasionally, especially for cse5 commands. (working on)


Locus construction

[asy] import graph; size(10.16cm); real lsf=0.5; pen dps=linewidth(0.7)+fontsize(10); defaultpen(dps); real xmin=-3.28,xmax=6.88,ymin=-2.9,ymax=4.3;  pen xdxdff=rgb(0.49,0.49,1), uququq=rgb(0.25,0.25,0.25), ffqqtt=rgb(1,0,0.2);draw((1,ymin)--(1,ymax)); draw(circle((1,0),1.85));draw((xmin,(-(3.7)-(0)*xmin)/-2)--(xmax,(-(3.7)-(0)*xmax)/-2)); draw((1,(-(5.56)-(-3.19)*1)/1.28)--(xmax,(-(5.56)-(-3.19)*xmax)/1.28)); draw((2.48,ymin)--(2.48,ymax)); draw((xmin,(-(-17.1)-(0)*xmin)/12.76)--(xmax,(-(-17.1)-(0)*xmax)/12.76)); draw((2.48,1.34)--(2.43,1.37)--(2.38,1.4)--(2.33,1.43)--(2.28,1.46)--(2.23,1.49)--(2.17,1.51)--(2.08,1.56)--(1.98,1.61)--(1.88,1.65)--(1.79,1.69)--(1.69,1.73)--(1.6,1.76)--(1.5,1.78)--(1.41,1.81)--(1.32,1.82)--(1.23,1.84)--(1.14,1.85)--(1.05,1.85)--(0.96,1.85)--(0.87,1.85)--(0.77,1.84)--(0.68,1.82)--(0.59,1.81)--(0.5,1.78)--(0.41,1.76)--(0.31,1.73)--(0.22,1.69)--(0.12,1.65)--(0.03,1.61)--(-0.07,1.57)--(-0.17,1.51)--(-0.22,1.49)--(-0.27,1.46)--(-0.32,1.43)--(-0.37,1.4)--(-0.43,1.37)--(-0.48,1.34)--(-0.53,1.31)--(-0.59,1.28)--(-0.64,1.24)--(-0.69,1.21)--(-0.75,1.18)--(-0.81,1.14)--(-0.86,1.1)--(-0.92,1.07)--(-0.98,1.03)--(-1.04,0.99)--(-1.1,0.95)--(-1.16,0.91)--(-1.22,0.87)--(-1.28,0.83)--(-1.34,0.79)--(-1.41,0.75)--(-1.47,0.71)--(-1.54,0.67)--(-1.61,0.63)--(-1.67,0.58)--(-1.74,0.54)--(-1.81,0.5)--(-1.89,0.45)--(-1.96,0.41)--(-2.04,0.36)--(-2.11,0.32)--(-2.19,0.27)--(-2.27,0.23)--(-2.35,0.18)--(-2.44,0.14)--(-2.52,0.09)--(-2.61,0.05)--(-2.7,0)--(-2.79,-0.04)--(-2.89,-0.09)--(-2.98,-0.13)--(-3.08,-0.18)--(-3.13,-0.2)--(-3.18,-0.22)--(-3.24,-0.25)^^(6.81,-0.78)--(6.74,-0.76)--(6.66,-0.74)--(6.58,-0.72)--(6.51,-0.7)--(6.44,-0.68)--(6.37,-0.66)--(6.3,-0.64)--(6.23,-0.61)--(6.16,-0.59)--(6.1,-0.57)--(6.03,-0.55)--(5.97,-0.53)--(5.9,-0.51)--(5.84,-0.48)--(5.78,-0.46)--(5.72,-0.44)--(5.66,-0.42)--(5.6,-0.4)--(5.54,-0.37)--(5.49,-0.35)--(5.43,-0.33)--(5.38,-0.31)--(5.32,-0.28)--(5.27,-0.26)--(5.22,-0.24)--(5.17,-0.22)--(5.11,-0.19)--(5.06,-0.17)--(4.97,-0.13)--(4.87,-0.08)--(4.78,-0.04)--(4.73,-0.01)--(4.71,0)--(4.7,0)--(4.7,0)--(4.7,0)--(4.7,0)--(4.7,0)--(4.7,0)--(4.7,0)--(4.7,0)--(4.7,0)--(4.7,0)--(4.7,0)--(4.7,0)--(4.7,0)--(4.7,0)--(4.7,0)--(4.7,0)--(4.7,0)--(4.7,0)--(4.7,0)--(4.7,0)--(4.7,0)--(4.7,0)--(4.7,0)--(4.7,0)--(4.7,0)--(4.69,0)--(4.68,0.01)--(4.66,0.02)--(4.63,0.04)--(4.55,0.08)--(4.48,0.12)--(4.4,0.16)--(4.33,0.19)--(4.26,0.23)--(4.2,0.27)--(4.13,0.31)--(4.06,0.35)--(4,0.39)--(3.93,0.42)--(3.87,0.46)--(3.81,0.5)--(3.75,0.54)--(3.69,0.57)--(3.63,0.61)--(3.57,0.65)--(3.52,0.68)--(3.46,0.72)--(3.4,0.75)--(3.35,0.79)--(3.29,0.82)--(3.24,0.86)--(3.19,0.89)--(3.14,0.93)--(3.08,0.96)--(3.03,0.99)--(2.98,1.03)--(2.88,1.09)--(2.83,1.13)--(2.77,1.16)--(2.72,1.2)--(2.66,1.23)--(2.61,1.26)--(2.55,1.3)--(2.48,1.34),linewidth(2.8)+ffqqtt);  dot((1,0),xdxdff); dot((1,2),blue); dot((-0.66,0.82),blue); dot((1,1.85),uququq); dot((2.28,1.34),xdxdff); dot((1,-1.85),uququq); dot((2.48,1.85),uququq); dot((2.48,1.34),uququq);  clip((xmin,ymin)--(xmin,ymax)--(xmax,ymax)--(xmax,ymin)--cycle);  [/asy] Support for locus constructions, with all of the usual lines options. Shown above is the "witch of aggensi".

<geogebra>d2594993982afff858b6296678b2bab7bbe351d8</geogebra> 

Known bugs: none.

Statistics

Full example

import graph; size(13.92cm); real lsf=0.5; pen dps=linewidth(0.7)+fontsize(10); defaultpen(dps); real xmin=-0.72,xmax=3.2,ymin=-1.81,ymax=1.35; 
pen ffqqcc=rgb(1,0,0.8), uququq=rgb(0.25,0.25,0.25), evefev=rgb(0.9,0.94,0.9), qqwuqq=rgb(0,0.39,0), evffff=rgb(0.9,1,1), qqffff=rgb(0,1,1);
filldraw(arc((2.69,-1.5),0.16,134.59,180)--(2.69,-1.5)--cycle,evefev,qqwuqq); filldraw(arc((2,-0.8),0.16,-113.2,-90)--(2,-0.8)--cycle,evefev,qqwuqq); filldraw(arc((2,-1.5),0.16,0,90)--(2,-1.5)--cycle,evefev,qqwuqq); filldraw(arc((1.7,-1.5),0.16,0,66.8)--(1.7,-1.5)--cycle,evefev,qqwuqq); filldraw(arc((1.31,0),0.16,157.5,180)--(1.31,0)--cycle,evefev,qqwuqq); filldraw(arc((0.38,0),0.16,0,90)--(0.38,0)--cycle,evefev,qqwuqq); filldraw(arc((2.23,0),0.16,90,180)--(2.23,0)--cycle,evefev,qqwuqq); filldraw(arc((1.31,0),0.16,0,22.5)--(1.31,0)--cycle,evefev,qqwuqq); filldraw(arc((1.31,0),0.16,22.5,112.5)--(1.31,0)--cycle,evffff,qqffff); filldraw(arc((0,0),0.16,0,45)--(0,0)--cycle,evffff,qqffff); draw((xmin,(-(0)-(0)*xmin)/1)--(xmax,(-(0)-(0)*xmax)/1)); draw(circle((0,0),1.31),linetype("4pt 4pt")+blue);draw(circle((1.31,0),1),linetype("4pt 4pt")+red);draw((0.92,0.92)--(0,0),linewidth(1.6)); draw((0,0)--(1.31,0),linewidth(1.6)); draw((0.92,0.92)--(1.31,0),linewidth(1.6)); draw((1.31,0)--(2.23,0.38),linewidth(1.6)); draw((2.23,0.38)--(0.92,0.92),linewidth(1.6)); draw((0.38,0.38)--(2.23,0.38),ffqqcc); draw((0,0)--(2.23,0.38),ffqqcc); draw((2.23,0.38)--(2.23,0),dotted); draw((0,0.38)--(0,0),dotted); draw((0,0.38)--(0.38,0.38),dotted); draw((0.38,0.38)--(0.38,0.38),linewidth(1.2)+linetype("1pt 1pt")); draw((0.38,0.38)--(0,0),linewidth(1.2)+linetype("1pt 1pt")); draw((0.38,0.38)--(1.31,0),linewidth(1.2)+linetype("1pt 1pt")); draw((0.38,0.38)--(1.31,0),linewidth(1.2)+linetype("1pt 1pt")); draw((2.69,-1.5)--(2,-0.8)); draw((2,-0.8)--(1.7,-1.5)); draw((1.7,-1.5)--(2.69,-1.5)); draw((2,-0.8)--(2,-1.5)); label("$r $",(2.69,-1.84),SE*lsf); label("r",(2.3,-1.39),SE*lsf); label("$ r\sqrt{ 2 } $",(2.75,-1.24),SE*lsf); label("$r( \sqrt{ 2 } - 1 )$",(2.02,-1.85),SE*lsf); label("$45^\circ$",(2.41,-1.3),SE*lsf); label("$22.5^\circ$",(2.02,-0.96),SE*lsf); draw(circle((2.07,-1.43),0.01),qqwuqq); label("$90^\circ$",(2.15,-1.3),SE*lsf); label("$67.5^\circ$",(1.79,-1.28),SE*lsf); label("$22.5^\circ$",(0.84,0.1),SE*lsf); label("r",(0.71,-0.06),SE*lsf); label("$r( \sqrt{ 2 } - 1 )$",(0.27,0.35),SE*lsf); label("$r( \sqrt{ 2 } - 1 )$",(-0.05,-0.12),SE*lsf); label("$r( \sqrt{ 2 } - 1 )$",(-0.09,0.63),SE*lsf); label("$r( \sqrt{ 2 } - 1 )$",(-0.44,0.31),SE*lsf); draw(circle((0.45,0.07),0.01),qqwuqq); label("$90^\circ$",(0.6,0.1),SE*lsf); draw(circle((2.16,0.07),0.01),qqwuqq); label("$90^\circ$",(2.31,0.17),SE*lsf); label("$22.5^\circ$",(1.64,0.11),SE*lsf); label("r",(2.04,-0.09),SE*lsf); draw((1.4,-0.2)--(1.11,0.17),EndArrow(6));label("$ \sqrt{ (r (\sqrt{ 2 } - 1) + r + r )^2 + (r (\sqrt{ 2 } - 1) )^2 }$",(1.58,-0.2),SE*lsf); label("$ = \sqrt{ (r (\sqrt{ 2 } + 1) )^2 + (r (\sqrt{ 2 } - 1) )^2 } $",(1.53,-0.37),SE*lsf); label("$\mathbf{=r  \sqrt{ 6 }}$",(1.53,-0.72),SE*lsf,blue); label("$= \sqrt{ r^2 (3 + 2 \sqrt{ 2 }) + r^2 (3 - 2 \sqrt{ 2 }) } $",(1.53,-0.54),SE*lsf); label("$\mathbf{2r}$",(1.46,0.64),SE*lsf,blue); label("$\mathbf{\frac{BE}{AE} = \frac{r \sqrt{ 6 }}{2r} = \frac{ \sqrt{ 6 }}{2}}$",(0.78,-1.47),SE*lsf,red+fontsize(14)); draw((1.74,-1.13)--(0.83,-0.06),EndArrow(6));draw(circle((1.34,0.09),0.01),qqffff); label("$45^\circ$",(-0.01,0.13),SE*lsf); label("$90^\circ$",(-0.22,1.47),SE*lsf); label("$90^\circ$",(1.39,0.24),SE*lsf); draw((0.38,0)--(0.38,0.38),linewidth(0.4)+dotted); 
dot((0,0),blue); label("$B$",(-0.06,-0.09),NE*lsf,blue); dot((1.31,0),blue); label("$D$",(1.34,-0.09),NE*lsf,blue); dot((0.92,0.92),blue); label("$C$",(0.91,0.99),NE*lsf,blue); dot((2.23,0.38),blue); label("$E$",(2.27,0.39),NE*lsf,blue); dot((0.38,0.38),blue); label("$A$",(0.33,0.41),NE*lsf,blue); dot((0.38,0),linewidth(1pt)+uququq); label("$G$",(0.41,-0.1),NE*lsf,uququq); dot((0,0.38),linewidth(1pt)+uququq); dot((2.23,0),linewidth(1pt)+uququq); label("$F$",(2.24,-0.1),NE*lsf,uququq); dot((0.38,0.38),uququq); dot((1.7,-1.5),blue); dot((2,-0.8),blue); dot((2.69,-1.5),blue); dot((2,-1.5),blue); 
clip((xmin,ymin)--(xmin,ymax)--(xmax,ymax)--(xmax,ymin)--cycle); 
 (Error making remote request. Unknown error_msg)

Courtesy of User:Kouichi Nakagawa.

<geogebra>9fa91fc57b9e5def39d73828270c8c027c565d85</geogebra>