## Official Asymptote example – cube

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

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

import three;

currentprojection=orthographic(5,4,2,center=true);

size(5cm);
size3(3cm,5cm,8cm);

draw(unitbox);

dot(unitbox,red);

label("$O$",(0,0,0),NW);
label("(1,0,0)",(1,0,0),S);
label("(0,1,0)",(0,1,0),E);
label("(0,0,1)",(0,0,1),Z);



Mots-clefs : , ,

## Official Asymptote example – cosaddition

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

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

size(0,200);
import geometry;

real A=130;
real B=40;

pair O=(0,0);
pair R=(1,0);
pair P=dir(A);
pair Q=dir(B);

draw(circle(O,1.0));
draw(Q--O--P);
draw(P--Q,red);
draw(O--Q--R--cycle);

draw("$A$",arc(R,O,P,0.3),blue,Arrow,PenMargin);
draw("$B$",arc(R,O,Q,0.6),blue,Arrow,PenMargin);
pair S=(Cos(B),0);
draw(Q--S,blue);
perpendicular(S,NE,blue);

dot(O);
dot("$R=(1,0)$",R);
dot("$P=(\cos A,\sin A)$",P,dir(O--P)+W);
dot("$Q=(\cos B,\sin B)$",Q,dir(O--Q));



Mots-clefs : , , ,

## Official Asymptote example – cos2theta

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

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

import graph;
size(0,100);

real f(real t) {return cos(2*t);}

path g=polargraph(f,0,2pi,operator ..)--cycle;
fill(g,green+white);
xaxis("$x$",above=true);
yaxis("$y$",above=true);
draw(g);

dot(Label,(1,0),NE);
dot(Label,(0,1),NE);



Mots-clefs : ,

## Official Asymptote example – controlsystem

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

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

size(0,4cm);
import flowchart;

block delay=roundrectangle("$e^{-sT_t}$",(0.33,0));
block system=roundrectangle("$\frac{s+3}{s^2+0.3s+1}$",(0.6,0));
block controller=roundrectangle("$0.06\left( 1 + \frac{1}{s}\right)$",
(0.45,-0.25));
block sum1=circle("",(0.15,0),mindiameter=0.3cm);
block junction1=circle("",(0.75,0),fillpen=currentpen);

draw(delay);
draw(system);
draw(controller);
draw(sum1);
draw(junction1);

add(new void(picture pic, transform t) {
blockconnector operator --=blockconnector(pic,t);

block(0,0)--Label("$u$",align=N)--Arrow--sum1--Arrow--delay--Arrow--
system--junction1--Label("$y$",align=N)--Arrow--block(1,0);

junction1--Down--Left--Arrow--controller--Left--Up--
Label("$-$",position=3,align=ESE)--Arrow--sum1;
});



Mots-clefs :

## Official Asymptote example – conicurv

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

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

// Original name : conicurv.mp
// Author : L. Nobre G.
// Translators : J. Pienaar (2004) and John Bowman (2005)

import three;
texpreamble("\usepackage{bm}");

size(300,0);

currentprojection=perspective(10,-5,5.44);

real theta=30, width=3, shortradius=2, bord=2, refsize=1, vecsize=2;
real height=0.3, anglar=1.75, totup=3;

triple central=(0,0,centre.z), refo=(0,0.5*centre.y,centre.z);
triple refx=refsize*(0,Cos(theta),Sin(theta));
triple refy=refsize*(0,-Sin(theta),Cos(theta));

draw("$\theta$",arc(iplow,iplow+0.58*(iphig-iplow),anglebase),E);

draw(central,linewidth(2bp));
draw(iplow--iphig);
draw(oplow--ophig);
draw(aplow--aphig);
draw(eplow--ephig);
draw(iphig--anglebase--aplow,dashed);
draw(oplow--eplow,dashed);
draw(central--centre,dashed);

--(0,0,totup)--cycle);
draw(Label("$y$",1),refo--refo+refy,SW,Arrow3);
draw(Label("$x$",1),refo--refo+refx,SE,Arrow3);

draw(Label("$\vec{R}_N$",1),centre--centre+vecsize*refy,E,Arrow3);
draw(Label("$\vec{F}_a$",1),centre--centre+vecsize*refx,N,Arrow3);
draw(Label("$\vec{F}_c$",1),centre--centre+vecsize*Y,NE,Arrow3);
draw(Label("$\vec{P}$",1),centre--centre-vecsize*Z,E,Arrow3);
draw(Label("$\vec{v}$",1),centre--centre+vecsize*X,E,Arrow3);
draw(centre,10pt+blue);



Mots-clefs : , , ,

## Official Asymptote example – cones

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

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

import solids;

size(200);
currentprojection=orthographic(5,4,2);

render render=render(compression=Low,merge=true);

revolution upcone=cone(-Z,1,1);
revolution downcone=cone(Z,1,-1);
draw(surface(upcone),green,render);
draw(surface(downcone),green,render);
draw(upcone,5,blue,longitudinalpen=nullpen);
draw(downcone,5,blue,longitudinalpen=nullpen);

revolution cone=shift(2Y-2X)*cone(1,1);

draw(surface(cone),green,render);
draw(cone,5,blue);



Mots-clefs : , ,

## Official Asymptote example – condor

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

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

// Peter Luschny's Condor function
// http://www.luschny.de/math/asy/ElCondorYElGamma.html

import palette;
import graph3;

size(300,300,IgnoreAspect);
currentprojection=orthographic(0,-1,0,center=true);
currentlight=White;
real K=7;

triple condor(pair t)
{
real y=t.y;
real x=t.x*y;
real e=gamma(y+1);
real ymx=y-x;
real ypx=y+x;
real a=gamma((ymx+1)/2);
real b=gamma((ymx+2)/2);
real c=gamma((ypx+1)/2);
real d=gamma((ypx+2)/2);
real A=cos(pi*ymx);
real B=cos(pi*ypx);
return (x,y,log(e)+log(a)*((A-1)/2)+log(b)*((-A-1)/2)+log(c)*((B-1)/2)+
log(d)*((-B-1)/2));
}

surface s=surface(condor,(-1,0),(1,K),16,Spline);
s.colors(palette(s.map(zpart),Rainbow()));

draw(s,render(compression=Low,merge=true));



Mots-clefs : , , , ,

## Official Asymptote example – colors

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

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

int i=0;
int j=0;

bool components=false;

pen p;

void col(bool fill=false ... string[] s) {
for(int n=0; n < s.length; ++n) {
j -= 10;
string s=s[n];
eval("p="+s+";",true);
if(components) {
real[] a=colors(p);
for(int i=0; i < a.length; ++i)
s += " "+(string) a[i];
}
if(fill) label(s,(i+10,j),E,p,Fill(gray));
else label(s,(i+10,j),E,p);
fill(box((i,j-5),(i+10,j+5)),p);
}
}

col("palered");
col("lightred");
col("mediumred");
col("red");
col("heavyred");
col("brown");
col("darkbrown");
j -= 10;

col("palegreen");
col("lightgreen");
col("mediumgreen");
col("green");
col("heavygreen");
col("deepgreen");
col("darkgreen");
j -= 10;

col("paleblue");
col("lightblue");
col("mediumblue");
col("blue");
col("heavyblue");
col("deepblue");
col("darkblue");
j -= 10;

i += 150;
j=0;

col("palecyan");
col("lightcyan");
col("mediumcyan");
col("cyan");
col("heavycyan");
col("deepcyan");
col("darkcyan");
j -= 10;

col("pink");
col("lightmagenta");
col("mediummagenta");
col("magenta");
col("heavymagenta");
col("deepmagenta");
col("darkmagenta");
j -= 10;

col("paleyellow");
col("lightyellow");
col("mediumyellow");
col("yellow");
col("lightolive");
col("olive");
col("darkolive");
j -= 10;

col("palegray");
col("lightgray");
col("mediumgray");
col("gray");
col("heavygray");
col("deepgray");
col("darkgray");
j -= 10;

i += 150;
j=0;

col("black");
col("white",fill=true);
j -= 10;

col("orange");
col("fuchsia");
j -= 10;
col("chartreuse");
col("springgreen");
j -= 10;
col("purple");
col("royalblue");
j -= 10;

col("Cyan");
col("Magenta");
col("Yellow");
col("Black");

j -= 10;

col("cmyk(red)");
col("cmyk(blue)");
col("cmyk(green)");



Mots-clefs :

## Official Asymptote example – colorplanes

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

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

size(6cm,0);
import bsp;

real u=2.5;
real v=1;

currentprojection=oblique;

path3 y=plane((2u,0,0),(0,2v,0),(-u,-v,0));
path3 l=rotate(90,Z)*rotate(90,Y)*y;
path3 g=rotate(90,X)*rotate(90,Y)*y;

face[] faces;
pen[] p={red,green,blue,black};
int[] edges={0,0,0,2};
edges);



Mots-clefs : ,

## Official Asymptote example – colons

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

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

draw((0,0){up}::(100,25){right}::(200,0){down});



Mots-clefs : ,