## Asymptote Generalities – fig0590

Category: Asymptote,Examples 2D,GeneralitiesPh. Ivaldi @ 8 h 39 min

 (Compiled with Asymptote version 2.14svn-r5318)

size(12cm,0);
path[] P=texpath("$\displaystyle\int_{-\infty}^{+\infty}e^{-\alpha x^2}\,dx= \sqrt{\frac{\pi}{\alpha}}$");
pair m=min(P), M=max(P);

draw(P,0.5*blue);
shipout(bbox(3mm,Fill));

Étiquettes : , , , ,

## Asymptote using three.asy – fig0100

Category: Asymptote,Examples 3D,three.asyPh. Ivaldi @ 23 h 50 min

 (Compiled with Asymptote version 2.14svn-r5318)

size(12cm,0);
import bsp;

currentprojection=orthographic(1,1.5,1);

path3 xy=plane((1,0,0),(0,1,0),(0,0,0));
path3 xz=rotate(90,X)*xy;
path3 yz=rotate(-90,Y)*xy;

face[] f;
filldraw(f.push(xy),project(xy),grey);
filldraw(f.push(xz),project(xz),grey);
filldraw(f.push(yz),project(yz),grey);

draw(Label("$x$",EndPoint), O--(1,0,0), Arrow3);
draw(Label("$y$",EndPoint), O--(0,1,0), Arrow3);
draw(Label("$z$",EndPoint), O--(0,0,1), Arrow3);
dot(O);

path[] ph=texpath("$\displaystyle\int_{-\infty}^{+\infty}e^{-\alpha x^2}\,dx= \sqrt{\frac{\pi}{\alpha}}$");
ph =shift((0.5,0.5))*rotate(-45)*scale(1/abs(min(ph)-max(ph)))*ph;

filldraw(project(path3(ph,XYplane)),0.8*yellow);
filldraw(project(path3(ph,ZXplane)),0.8*yellow);
filldraw(project(path3(ph,YZplane)),0.8*yellow);

Étiquettes : , , , , ,

## Asymptote using three.asy – fig0110

Category: Asymptote,Examples 3D,three.asyPh. Ivaldi @ 0 h 50 min

 (Compiled with Asymptote version 2.14svn-r5318)

import three;
size(10cm,0);
currentprojection=orthographic(1,1.5,1);

path3 xy=XY*unitsquare3, xz=ZX*unitsquare3, yz=YZ*unitsquare3;

draw(xy^^xz^^yz, grey);
path3 p3xy=path3(texpath("$\pi$")[0],XYplane);
p3xy=shift((0.5,0.5,0))*scale3(1/abs(min(p3xy)-max(p3xy)))*p3xy;

surface s=surface(p3xy,planar=true);
draw(s, surfacepen=blue, meshpen=orange+3pt);

transform3 Txz=planeproject(xz,(0,-1,1));
draw(Txz*s, red);

transform3 Tyz=planeproject(yz,(-1,0,1));
draw(Tyz*s, green);

path3 p3xz=Txz*p3xy;
path3 p3yz=Tyz*p3xy;

int lg=length(p3xy);
triple p;
for(int i=0;i<=lg;++i) {
p=point(p3xy,i);
draw(p--point(p3xz,i), yellow);
draw(p--point(p3yz,i), orange);
}

Étiquettes : , , , ,

## Official Asymptote example – curvedlabel

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

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

size(200);
import labelpath;
labelpath("This is a test of curved labels in Asymptote (implemented with the {\tt PSTricks pstextpath} macro).",reverse(rotate(-90)*unitcircle));

Étiquettes : , ,

## Official Asymptote example – curvedlabel3

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

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

size(200);
import labelpath3;

path3 g=(1,0,0)..(0,1,1)..(-1,0,0)..(0,-1,1)..cycle;
path3 g2=shift(-Z)*reverse(unitcircle3);

string txt1="\hbox{This is a test of \emph{curved} 3D labels in
\textbf{Asymptote} (implemented with {\tt texpath}).}";

string txt2="This is a test of curved labels in Asymptote\\(implemented
without the {\tt PSTricks pstextpath} macro).";

draw(surface(g),paleblue+opacity(0.5));
draw(labelpath(txt1,subpath(g,0,reltime(g,0.95)),angle=-90),orange);

draw(g2,1bp+red);
draw(labelpath(txt2,subpath(g2,0,3.9),angle=180,optional=rotate(-70,X)*Z));

Étiquettes : ,

## Official Asymptote example – logo3

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

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

import three;

size(560,320,IgnoreAspect);
size3(140,80,15);
currentprojection=perspective(-2,20,10,up=Y);
currentlight=White;

real a=-0.4;
real b=0.95;
real y1=-5;
real y2=-3y1/2;
path A=(a,0){dir(10)}::{dir(89.5)}(0,y2);
path B=(0,y1){dir(88.3)}::{dir(20)}(b,0);
real c=0.5*a;
pair z=(0,2.5);
transform t=scale(1,15);
transform T=inverse(scale(t.yy,t.xx));
path[] g=shift(0,1.979)*scale(0.01)*t*
texpath(Label("{\it symptote}",z,0.25*E+0.169S,fontsize(24pt)));
pair w=(0,1.7);
pair u=intersectionpoint(A,w-1--w);

real h=0.25*linewidth();
real hy=(T*(h,h)).x;
g.push(t*((a,hy)--(b,hy)..(b+hy,0)..(b,-hy)--(a,-hy)..(a-hy,0)..cycle));
g.push(T*((h,y1)--(h,y2)..(0,y2+h)..(-h,y2)--(-h,y1)..(0,y1-h)..cycle));
g.push(shift(0,w.y)*t*((u.x,hy)--(w.x,hy)..(w.x+hy,0)..(w.x,-hy)--(u.x,-hy)..(u.x-hy,0)..cycle));
real f=0.75;
g.push(point(A,0)--shift(-f*hy,f*h)*A--point(A,1)--shift(f*hy,-f*h)*reverse(A)--cycle);
g.push(point(B,0)--shift(f*hy,-f*h)*B--point(B,1)--shift(-f*hy,f*h)*reverse(B)--cycle);

triple H=-0.1Z;
material m=material(lightgray,shininess=1.0);

for(path p : g)
draw(extrude(p,H),m);

surface s=surface(g);
draw(s,red,nolight);
draw(shift(H)*s,m);

Étiquettes : , ,

## Official Asymptote example – textpath

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 */

size(300);

fill(texpath(Label("test",TimesRoman())),pink);
fill(texpath(Label("test",fontcommand('.fam T\n.ps 12')),tex=false),red);

pair z=10S;

fill(texpath(Label("$\sqrt{x^2}$",z,TimesRoman())),pink);
fill(texpath(Label("$sqrt {x sup 2}$",z,fontcommand('.fam T\n.ps 12')),
tex=false),red);

Étiquettes : , , , ,

## Official Asymptote example – trefoilknot

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

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

import tube;
import graph3;
import palette;
currentlight=White;

size(0,8cm);
currentprojection=perspective(1,1,1,up=-Y);

int e=1;
real x(real t) {return cos(t)+2*cos(2t);}
real y(real t) {return sin(t)-2*sin(2t);}
real z(real t) {return 2*e*sin(3t);}

path3 p=scale3(2)*graph(x,y,z,0,2pi,50,operator ..)&cycle;

path sec=scale(0.25)*texpath("$\pi$")[0];