PIPRIME.FR BLOG

Live fully to honor life

Generalities about Asymptote

Start with the Asymptote drawing and programming software

A tutorial by examples

đŸ”—generalities-fig001

Figure generalities 001 Generated with Asymptote

Show generalities/fig0010.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Size

unitsize(2cm);

pair A, B, C, D;
A=(0,0);
B=(2,0);
C=(4,0);
D=(4,2);
draw(A--B);
draw(C--D);

đŸ”—generalities-fig002

Figure generalities 002 Generated with Asymptote

Show generalities/fig0020.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Size

size(5cm,0);
pair A, B, C, D;
A=(0,0);
B=(2,0);
C=(4,0);
D=(4,2);
draw(A--B);
draw(C--D);

đŸ”—generalities-fig003

Figure generalities 003 Generated with Asymptote

Show generalities/fig0030.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Size

size(10cm,0);
pair A, B, C, D;
A=(0,0);
B=(2,0);
C=(4,0);
D=(4,2);
draw(A--B);
draw(C--D);

đŸ”—generalities-fig004

Figure generalities 004 Generated with Asymptote

Show generalities/fig0040.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Size

size(5cm, 3cm);
pair A, B, C, D;
A=(0,0);
B=(2,0);
C=(4,0);
D=(4,2);
draw(A--B);
draw(C--D);

đŸ”—generalities-fig005

Figure generalities 005 Generated with Asymptote

Show generalities/fig0050.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Size

size(10cm,2.5cm);
pair A, B, C, D;
A=(0,0);
B=(2,0);
C=(4,0);
D=(4,2);
draw(A--B);
draw(C--D);

đŸ”—generalities-fig006

Figure generalities 006 Generated with Asymptote

Show generalities/fig0060.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Size

size(10cm, 2.5cm, false);
pair A, B, C, D;
A=(0,0);
B=(2,0);
C=(4,0);
D=(4,2);
draw(A--B);
draw(C--D);

đŸ”—generalities-fig007

Figure generalities 007 Generated with Asymptote

Show generalities/fig0070.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Size

size(3cm, 10cm, false);
pair A, B, C, D;
A=(0,0);
B=(2,0);
C=(4,0);
D=(4,2);
draw(A--B);
draw(C--D);

đŸ”—generalities-fig008

Figure generalities 008 Generated with Asymptote

Show generalities/fig0080.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Size

pair A, B, C, D;
A=(0, 0);
B=(3cm, 0);
C=(6cm, 0);
D=(6cm, 4cm);
draw(A--B);
draw(C--D);

đŸ”—generalities-fig009

Figure generalities 009 Generated with Asymptote

Show generalities/fig0090.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Size | #Unitsize

unitsize(1cm);
pair A, B, C, D;
A=(0, 0);
B=(3, 0);
C=(6, 0);
D=(6, 4);
draw(A--B);
draw(C--D);

đŸ”—generalities-fig010

Figure generalities 010 Generated with Asymptote

Show generalities/fig0100.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Size | #Unitsize

unitsize(x=2cm, y=1cm);

pair A, B, C, D;
A=(0, 0);
B=(3, 0);
C=(6, 0);
D=(6, 4);
draw(A--B);
draw(C--D);

đŸ”—generalities-fig011

Figure generalities 011 Generated with Asymptote

Show generalities/fig0110.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Circle | #Fixedscaling | #Size

size(10cm,0);

draw(scale(4)*unitcircle);
dot((0, 0));
dot((4, 0));

fixedscaling((-8, -8),(6, 6));
shipout(bbox(Fill(lightgrey)));

đŸ”—generalities-fig012

Figure generalities 012 Generated with Asymptote

Show generalities/fig0120.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Fixedscaling | #Size | #True size | #Frame | #Deferred drawing

// From Asympote's FAQ
size(10cm,0);

path p=(0,0)--(1,0);

frame object;
draw(object, scale(8cm)*p);

add(object);
add(object, (0, -40));

đŸ”—generalities-fig013

Figure generalities 013 Generated with Asymptote

Show generalities/fig0130.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Fixedscaling | #Deferred drawing | #True size

// From Asympote's FAQ
size(10cm,0);

path p=(0,0)--(1,0);
picture object;
draw(object,scale(8cm)*p);

add(object);
add(object,(0,-40)); // Adds truesize object to currentpicture

đŸ”—generalities-fig014

Figure generalities 014 Generated with Asymptote

Show generalities/fig0140.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Path | #Size

size(6cm,6cm);

pair A=(0,0), B=(1,0), C=(0,1);
draw (A--B--C);

đŸ”—generalities-fig015

Figure generalities 015 Generated with Asymptote

Show generalities/fig0150.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Path | #Size

size(6cm, 6cm);
pair A=(0,0), B=(1,0), C=(0,1);
draw (A--B--C--cycle);

đŸ”—generalities-fig016

Figure generalities 016 Generated with Asymptote

Show generalities/fig0160.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Array | #Path

size(6cm, 6cm);

pair [] A;
A[0]=(-1, -1);
A[1]=( 1, -1);
A[2]=( 1,  1);
A[3]=(-1,  1);
draw (A[0]--A[1]--A[2]--A[3]--cycle);
draw (A[0]--A[2]);
draw (A[1]--A[3]);

đŸ”—generalities-fig017

Figure generalities 017 Generated with Asymptote

Show generalities/fig0170.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Point/Dot | #Path | #Size

size(6cm,6cm);

draw(unitsquare);
dot((0,0)--(1,1)--(0,1)--(1,0));
draw((0,0)--(1,1));
draw((1,0)--(0,1));

đŸ”—generalities-fig018

Figure generalities 018 Generated with Asymptote

Show generalities/fig0180.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Point/Dot | #Path | #Size

size(6cm,3cm,false);

draw(unitsquare);
dot((0,0)--(1,1)--(0,1)--(1,0));
draw((0,0)--(1,1));
draw((1,0)--(0,1));

đŸ”—generalities-fig019

Figure generalities 019 Generated with Asymptote

Show generalities/fig0190.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Point/Dot | #Line type

size(8cm,0);

pair A,B,C;
A=(0,0);B=(1,0);C=(2,0);
draw(A,8bp+black);
draw(B,8bp+blue);
draw(C,linewidth(8bp));

đŸ”—generalities-fig020

Figure generalities 020 Generated with Asymptote

Show generalities/fig0200.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Point/Dot | #Line type | #Transform/scale/shift/rotate | #Unitsize | #Path

unitsize(3cm);

pair A=(0,0), B=(1,0), C=(0,1);
path trig;
trig=A--B--C--cycle;
draw(trig);
dot(trig,linewidth(4bp));
dot(shift(3,0)*trig,red+4bp);

đŸ”—generalities-fig021

Figure generalities 021 Generated with Asymptote

Show generalities/fig0210.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Path | #Position

size(6cm,6cm);

pair A, B, C;
A=(0,0); B=(1,0); C=(0,1);
draw(A--B--C--cycle);
draw (midpoint(A--B) -- C);
draw (B+0.5*(C-B) -- A);
draw (interp(A,C,0.5) -- B);

đŸ”—generalities-fig022

Figure generalities 022 Generated with Asymptote

Show generalities/fig0220.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Path | #Position

size(6cm,6cm);

pair A, B, C;
A=(0,0); B=(1,0); C=(0,1);
draw(A--B--C--cycle);
draw (midpoint(A--B) -- C);
draw (B+0.5*(C-B) -- A);
draw (interp(A,C,0.5) -- B);
dot(A/3 + B/3 + C/3);

đŸ”—generalities-fig023

Figure generalities 023 Generated with Asymptote

Show generalities/fig0230.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Line type | #Path

size(6cm,0);

pair A=(0,0), B=(1,0), C=(0,1);
draw(A--B--C--cycle);
draw(A--B,linewidth(4bp));

đŸ”—generalities-fig024

Figure generalities 024 Generated with Asymptote

Show generalities/fig0240.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Line type | #Path

size(6cm,0);

pair A=(0,0), B=(1,0), C=(0,1);
draw(A--B--C--cycle);
draw(A--B,(red+green));

đŸ”—generalities-fig025

Figure generalities 025 Generated with Asymptote

Show generalities/fig0250.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Line type | #Path

size(6cm,0);

pair A=(0,0), B=(1,0), C=(0,1);

draw(A--B,.8white+6bp);
draw(A--C,.6white+6bp);
draw(B--C,.4white+6bp);

draw(A--B--C--cycle,yellow);

đŸ”—generalities-fig026

Figure generalities 026 Generated with Asymptote

Show generalities/fig0260.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Line type | #Path

size(8cm,0);

path p1=(0,0)--(1,1);
path p2=(2,0)--(3,1);

draw(p1,linewidth(5mm));
draw(p2,linewidth(5mm));
draw(p1--p2, 3mm+.8blue);
draw(reverse(p1)--p2, 1mm+.8red);

đŸ”—generalities-fig027

Figure generalities 027 Generated with Asymptote

Show generalities/fig0270.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Point/Dot | #Label | #Position

size(8cm,0);

pair A=(0,0), B=(1,0);

dot("$A$",A,N);
dot("$B$",B,N);
draw(interp(A,B,-.5)--interp(A,B,1.25));

đŸ”—generalities-fig028

Figure generalities 028 Generated with Asymptote

Show generalities/fig0280.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Line type

unitsize(cm);
path line=(0,0)--(6,0);

draw(line,solid);
draw(shift(0,-1)*line,dotted);
draw(shift(0,-2)*line,dashed);
draw(shift(0,-3)*line,longdashed);
draw(shift(0,-4)*line,dashdotted);
draw(shift(0,-5)*line,longdashdotted);

đŸ”—generalities-fig029

Figure generalities 029 Generated with Asymptote

Show generalities/fig0290.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Line type

unitsize(1cm);
path line=(0,0)--(6,0);
pen my_pen=linetype("24 8 8 8");

draw(line,linetype("24 8 8 8"));
draw(shift(0,-1)*line,my_pen+.8red);
draw(shift(0,-2)*line,my_pen+.7green+4bp);
draw(shift(0,-3)*line,linetype("24 8 8 8",false)+.7blue+4bp);
draw(shift(0,-4)*line,linetype("24 8 8 8",true,false)+4bp);
draw(shift(0,-5)*line,linetype("24 8 8 8",false,false)+.5red+blue+4bp);

đŸ”—generalities-fig030

Figure generalities 030 Generated with Asymptote

Show generalities/fig0300.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Arrows/Bars

size(8cm,0);

transform T=shift(0,-0.125);
path g=(0,0)--(1,0);
int i=-1;
draw(T^(++i)*g, Arrows());
draw(T^(++i)*g, 0.8*green, Arrows(SimpleHead));
draw(T^(++i)*g, 0.8*red, Arrows(SimpleHead,size=5mm));

draw(T^(++i)*g, Arrows(HookHead));
draw(T^(++i)*g, 0.8*green, Arrows(HookHead,size=5mm));
draw(T^(++i)*g, 0.8*red, Arrows(HookHead(barb=20),size=5mm));
draw(T^(++i)*g, 2mm+0.8*blue, Arrows(HookHead(dir=60),size=5mm, Fill));

draw(T^(++i)*g, 0.8*yellow, Arrows(HookHead(barb=-10,dir=40),size=5mm));

draw(T^(++i)*g, Arrows(TeXHead));
draw(T^(++i)*g, 0.8*green, Arrows(TeXHead,size=5bp));
draw(T^(++i)*g, 5bp+0.8*red, Arrows(TeXHead));

đŸ”—generalities-fig031

Figure generalities 031 Generated with Asymptote

Show generalities/fig0310.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Arrows/Bars

path line=(0,0)--(5cm,0);
draw(line,Arrow);
draw(shift(0,-cm)*line, BeginArrow);
draw(shift(0,-2cm)*line, MidArrow);
draw(shift(0,-3cm)*line, Arrows);

draw(shift(0,-4cm)*line, linewidth(3bp), Arrow(20bp));
draw(shift(0,-5cm)*line, linewidth(3bp), BeginArrow(20bp));
draw(shift(0,-6cm)*line, linewidth(3bp), MidArrow(20bp));
draw(shift(0,-7cm)*line, linewidth(3bp), Arrows(20bp));

đŸ”—generalities-fig032

Figure generalities 032 Generated with Asymptote

Show generalities/fig0320.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Arrows/Bars

path line=(0,0)--(5cm,0);
DefaultHead=HookHead;
draw(shift(6cm,0)*line,Arrow());
draw(shift(6cm,-cm)*line, BeginArrow());
draw(shift(6cm,-2cm)*line, MidArrow());
draw(shift(6cm,-3cm)*line, Arrows());

draw(shift(6cm,-4cm)*line, linewidth(3bp), Arrow(20bp));
draw(shift(6cm,-5cm)*line, linewidth(3bp), BeginArrow(20bp));
draw(shift(6cm,-6cm)*line, linewidth(3bp), MidArrow(20bp));
draw(shift(6cm,-7cm)*line, linewidth(3bp), Arrows(20bp));

đŸ”—generalities-fig033

Figure generalities 033 Generated with Asymptote

Show generalities/fig0330.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Arrows/Bars

path line=(0,0)--(5cm,0);
DefaultHead=SimpleHead;
draw(shift(6cm,0)*line,Arrow());
draw(shift(6cm,-cm)*line, BeginArrow());
draw(shift(6cm,-2cm)*line, MidArrow());
draw(shift(6cm,-3cm)*line, Arrows());

draw(shift(6cm,-4cm)*line, linewidth(3bp), Arrow(20bp));
draw(shift(6cm,-5cm)*line, linewidth(3bp), BeginArrow(20bp));
draw(shift(6cm,-6cm)*line, linewidth(3bp), MidArrow(20bp));
draw(shift(6cm,-7cm)*line, linewidth(3bp), Arrows(20bp));

đŸ”—generalities-fig034

Figure generalities 034 Generated with Asymptote

Show generalities/fig0340.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Arrows/Bars

path line=(0,0)--(5cm,0);
DefaultHead=TeXHead;
draw(shift(6cm,0)*line,Arrow());
draw(shift(6cm,-cm)*line, BeginArrow());
draw(shift(6cm,-2cm)*line, MidArrow());
draw(shift(6cm,-3cm)*line, Arrows());

draw(shift(6cm,-4cm)*line, linewidth(bp), Arrow());
draw(shift(6cm,-5cm)*line, linewidth(2bp), BeginArrow(5bp));
draw(shift(6cm,-6cm)*line, linewidth(2bp), MidArrow(5bp));
draw(shift(6cm,-7cm)*line, linewidth(2bp), Arrows(5bp));

đŸ”—generalities-fig035

Figure generalities 035 Generated with Asymptote

Show generalities/fig0350.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Arrows/Bars

path line=(0,0)..(2.5cm,2.5cm)..(5cm,0);
draw(line,ArcArrow);
draw(shift(0,-2cm)*line,BeginArcArrow);
draw(shift(0,-4cm)*line,MidArcArrow);
draw(shift(0,-6cm)*line,ArcArrows);

draw(shift(6cm,0)*line,3bp+.8red,ArcArrow(20bp));
draw(shift(6cm,-2cm)*line,3bp+.8red,BeginArcArrow(20bp));
draw(shift(6cm,-4cm)*line,3bp+.8red,MidArcArrow(20bp));
draw(shift(6cm,-6cm)*line,3bp+.8red,ArcArrows(20bp));

đŸ”—generalities-fig036

Figure generalities 036 Generated with Asymptote

Show generalities/fig0360.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Arrows/Bars

DefaultHead=HookHead;

path line=(0,0)..(2.5cm,2.5cm)..(5cm,0);
draw(line,ArcArrow());
draw(shift(0,-2cm)*line,BeginArcArrow());
draw(shift(0,-4cm)*line,MidArcArrow());
draw(shift(0,-6cm)*line,ArcArrows());

draw(shift(6cm,0)*line,3bp+.8red,ArcArrow(20bp));
draw(shift(6cm,-2cm)*line,3bp+.8red,BeginArcArrow(20bp));
draw(shift(6cm,-4cm)*line,3bp+.8red,MidArcArrow(20bp));
draw(shift(6cm,-6cm)*line,3bp+.8red,ArcArrows(20bp));

đŸ”—generalities-fig037

Figure generalities 037 Generated with Asymptote

Show generalities/fig0370.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Arrows/Bars

DefaultHead=SimpleHead;

path line=(0,0)..(2.5cm,2.5cm)..(5cm,0);
draw(line,ArcArrow());
draw(shift(0,-2cm)*line,BeginArcArrow());
draw(shift(0,-4cm)*line,MidArcArrow());
draw(shift(0,-6cm)*line,ArcArrows());

draw(shift(6cm,0)*line,3bp+.8red,ArcArrow(20bp));
draw(shift(6cm,-2cm)*line,3bp+.8red,BeginArcArrow(20bp));
draw(shift(6cm,-4cm)*line,3bp+.8red,MidArcArrow(20bp));
draw(shift(6cm,-6cm)*line,3bp+.8red,ArcArrows(20bp));

đŸ”—generalities-fig038

Figure generalities 038 Generated with Asymptote

Show generalities/fig0380.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Arrows/Bars

DefaultHead=TeXHead;

path line=(0,0)..(2.5cm,2.5cm)..(5cm,0);
draw(line,Arrow());
draw(shift(0,-2cm)*line,BeginArrow());
draw(shift(0,-4cm)*line,MidArrow());
draw(shift(0,-6cm)*line,Arrows());

draw(shift(6cm,0)*line,3bp+.8red,Arrow(5bp));
draw(shift(6cm,-2cm)*line,3bp+.8red,BeginArrow(5bp));
draw(shift(6cm,-4cm)*line,3bp+.8red,MidArrow(5bp));
draw(shift(6cm,-6cm)*line,3bp+.8red,Arrows(5bp));

đŸ”—generalities-fig039

Figure generalities 039 Generated with Asymptote

Show generalities/fig0390.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Arrows/Bars | #Fill/Unfill

path line=(0,0)--(5cm,0);

draw(line,Arrow(20bp,filltype=NoFill));
draw(shift(0,-cm)*line,Arrow(20bp,filltype=FillDraw(.8red)));
draw(shift(0,-2cm)*line,Arrow(20bp,filltype=Fill(.8red)));
draw(shift(0,-3cm)*line,Arrows(filltype=FillDraw(-10,10,.8red)));

đŸ”—generalities-fig040

Figure generalities 040 Generated with Asymptote

Show generalities/fig0400.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Arrows/Bars | #Fill/Unfill

DefaultHead=HookHead;
path line=(0,0)--(5cm,0);

draw(line,Arrow(20bp,filltype=NoFill));
draw(shift(0,-cm)*line,Arrow(20bp,filltype=FillDraw(.8red)));
draw(shift(0,-2cm)*line,Arrow(20bp,filltype=Fill(.8red)));
draw(shift(0,-3cm)*line,Arrows(filltype=FillDraw(-10,10,.8red)));

đŸ”—generalities-fig041

Figure generalities 041 Generated with Asymptote

Show generalities/fig0410.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Arrows/Bars | #Fill/Unfill

DefaultHead=TeXHead;
path line=(0,0)--(5cm,0);

draw(line,Arrow(10bp,filltype=NoFill));
draw(shift(0,-2cm)*line,Arrow(10bp,filltype=FillDraw(.8red)));
draw(shift(0,-4cm)*line,Arrow(10bp,filltype=Fill(.8red)));
draw(shift(0,-6cm)*line,Arrows(filltype=FillDraw(-10,10,.8red)));

đŸ”—generalities-fig042

Figure generalities 042 Generated with Asymptote

Show generalities/fig0420.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Arrows/Bars

path line=(0,0)--(5cm,0);

draw(line,linewidth(5bp),Arrow);
draw(shift(0,-2cm)*line,linewidth(5bp),Arrow(30bp,10));
draw(shift(0,-5cm)*line,linewidth(30bp),Arrow(20bp,50));
draw(shift(0,-8cm)*line,linewidth(10bp),Arrow(20bp,50,filltype=NoFill));

đŸ”—generalities-fig043

Figure generalities 043 Generated with Asymptote

Show generalities/fig0430.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Arrows/Bars | #Position | #Fill/Unfill

size(5cm,0);
path line=(0,0)--(5,0);

draw(line,Arrow(20bp,position=.75));
draw(shift(0,-2)*line,Arrow(20bp,40,.75,filltype=NoFill));

position pos=BeginPoint;
pos.position=.75;
draw(shift(0,-4)*line,BeginArrow(20bp,pos));
draw(shift(0,-6)*line,BeginArrow(20bp,40,pos,filltype=NoFill));

đŸ”—generalities-fig044

Figure generalities 044 Generated with Asymptote

Show generalities/fig0440.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Arrows/Bars | #Position

unitsize(8cm);

path g=(0,0)--(1,0);
draw(g,Arrow(Relative(0.45)));
add(arrow(g,Relative(0.55)));

đŸ”—generalities-fig045

Figure generalities 045 Generated with Asymptote

Show generalities/fig0450.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Arrows/Bars | #Position | #Fill/Unfill

size(8cm,0);

path g = (0,0)--(1,0);
draw(g,Arrow(Relative(0.75)));
add(arrow(reverse(g), invisible, FillDraw(green,red), Relative(0.75)));

đŸ”—generalities-fig046

Figure generalities 046 Generated with Asymptote

Show generalities/fig0460.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Arrows/Bars | #Position

size(5cm,0);
path line=(0,0)--(5,0);
transform T=shift(0,-1);

draw(line, Bar);
draw(T*line, BeginBar);
draw(T^2*line, Bars);
draw(T^3*line, Arrow, BeginBar);

đŸ”—generalities-fig047

Figure generalities 047 Generated with Asymptote

Show generalities/fig0470.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Arrows/Bars | #Line type

path line=(0,0)--(5cm,0);
transform T=shift(0,-cm);

draw(line,linewidth(1mm),Bars);
draw(T^2*line,Bars(5mm));
draw(T^3*line,linewidth(1mm),Bars(5mm));
draw(T^4*line,dotted+red,Bars);

đŸ”—generalities-fig048

Figure generalities 048 Generated with Asymptote

Show generalities/fig0480.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Arrows/Bars

size(6cm,0);

draw((-.5,0)--(1,0));
draw((0,-.5)--(0,1));
draw((0,0)--(.75,0),linewidth(1mm),Arrow(3mm));
draw((0,0)--(0,.75),linewidth(1mm),Arrow(3mm));

đŸ”—generalities-fig049

Figure generalities 049 Generated with Asymptote

Show generalities/fig0490.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Fill/Unfill

fill((0,0)--(0,6cm)--(6cm,0)--cycle, gray);

đŸ”—generalities-fig050

Figure generalities 050 Generated with Asymptote

Show generalities/fig0500.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Fill/Unfill

filldraw((0,0)--(0,6cm)--(6cm,0)--cycle,gray);

đŸ”—generalities-fig051

Figure generalities 051 Generated with Asymptote

Show generalities/fig0510.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Fill/Unfill

filldraw((0,0)--(0,6cm)--(6cm,0)--cycle, fillpen=gray, drawpen=linewidth(1mm) + 0.8 * red);

đŸ”—generalities-fig052

Figure generalities 052 Generated with Asymptote

Show generalities/fig0520.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Fill/Unfill | #Shading | #Array | #Path

pen[][] p={{rgb(black)}, {rgb(.8red)}};

latticeshade((0,0)--(0,6cm)--(6cm,0)--cycle, p);

đŸ”—generalities-fig053

Figure generalities 053 Generated with Asymptote

Show generalities/fig0530.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Fill/Unfill | #Shading | #Array

pen[][] p={{rgb(black),rgb(black)}, {rgb(red),rgb(green)}};

latticeshade((0,0)--(0,6cm)--(6cm,0)--cycle,p);

đŸ”—generalities-fig054

Figure generalities 054 Generated with Asymptote

Show generalities/fig0540.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Fill/Unfill | #Shading

size(8cm,0);

pen[][] p={{rgb(white),rgb(grey),rgb(black)},
    {red,green,blue},
    {cyan,magenta,yellow}};

latticeshade(unitsquare,p);

đŸ”—generalities-fig055

Figure generalities 055 Generated with Asymptote

Show generalities/fig0550.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Fill/Unfill | #Shading

size(8cm,0);
import palette;

real[][] v={{1,2},{3,4}};
pen[] Palette=Rainbow();

latticeshade(box((0,0),(1,1)),palette(v,Palette));

đŸ”—generalities-fig056

Figure generalities 056 Generated with Asymptote

Show generalities/fig0560.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Fill/Unfill | #Shading | #Circle

size(8cm,0);

pair A=(0.35,0.35), B=(0.6,0.6);

radialshade(unitsquare,black,A,0.15,lightgrey,B,.6);

dot(A,.8red);
dot(B,blue+grey);
draw(shift(A)*scale(.15)*unitcircle,dashed+.8red);
draw(shift(B)*scale(.6)*unitcircle,dashed+blue+grey);
clip(unitsquare);

đŸ”—generalities-fig057

Figure generalities 057 Generated with Asymptote

Show generalities/fig0570.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Fill/Unfill | #Shading | #Transform/scale/shift/rotate | #Direction

size(8cm,0);

transform t=xscale(1.25);
pen p1=blue, p2=yellow;
pair pa=t*dir(135), pb=t*dir(-45);

axialshade(t*unitcircle,p1,pa,p2,pb);
draw(pa--pb, dashed);

đŸ”—generalities-fig058

Figure generalities 058 Generated with Asymptote

Show generalities/fig0580.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Fill/Unfill | #Shading | #Arc | #Loop/for/while | #Transform/scale/shift/rotate

// Author: John Bowman
size(10cm,0);

real r=1;
real R=3.8;

int step=30;
path p=arc(0,r,0,step);
path P=arc(0,R,step,0);
for(int h=0; h < 360; h += step) {
  transform t=rotate(90-h);
  tensorshade(t*p--t*P--cycle,
              new pen[] {white,white,hsv(h-step,1,1),hsv(h,1,1)});
}

for(int h=0; h < 360; h += 30) {
  pair v=R*dir(90-h);
  draw(Label(string(h)+"$^\circ$",EndPoint),(v--1.05v));
}

draw(circle(0,r));
draw(circle(0,R));

đŸ”—generalities-fig059

Figure generalities 059 Generated with Asymptote

Show generalities/fig0590.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Shading | #Tex/latex features | #Texpath | #Fill/Unfill | #Array

size(16cm,0);

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

axialshade(P,yellow,m,red,(m.x,M.y));
draw(P,0.5*blue);
shipout(bbox(3mm,Fill));

đŸ”—generalities-fig060

Figure generalities 060 Generated with Asymptote

Show generalities/fig0600.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Fill/Unfill | #Path

size(8cm,0);

pair A, B, C, D;
A=(0,0); B=(1,0);
C=(1,1); D=(0,1);
fill(A--C--B--D--cycle,grey);

đŸ”—generalities-fig061

Figure generalities 061 Generated with Asymptote

Show generalities/fig0610.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Fill/Unfill | #Path

size(8cm,0);

pair A, B, C, D;
A=(0,0); B=(1,0);
C=(1,1); D=(0,1);
filldraw(A--C--B--D--cycle,grey);

đŸ”—generalities-fig062

Figure generalities 062 Generated with Asymptote

Show generalities/fig0620.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Opacity | #Fill/Unfill | #Circle | #Transform/scale/shift/rotate

size(10cm, 0);

path cle=unitcircle;

draw((-1.5, 0)--(2.5, 0), linewidth(10mm));
filldraw(cle, red+opacity(.5));
filldraw(shift((1, 0))*cle, blue+opacity(.5));

shipout(format="pdf");

đŸ”—generalities-fig063

Figure generalities 063 Generated with Asymptote

Show generalities/fig0630.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Point/Dot | #Direction

pair O=0;

dot("N",O,N);
dot("S",O,S);
dot("E",O,E);
dot("W",O,W);

đŸ”—generalities-fig064

Figure generalities 064 Generated with Asymptote

Show generalities/fig0640.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Point/Dot | #Direction | #Label | #Labelmargin

pair O=0;
labelmargin=2;

dot("N",O,N);
dot("S",O,S);
dot("E",O,E);
dot("W",O,W);

đŸ”—generalities-fig065

Figure generalities 065 Generated with Asymptote

Show generalities/fig0650.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Point/Dot | #Direction | #Label | #Labelmargin

size(10cm,0);

pair O=0;
dot("N",O,10N);
draw("S",O,10S);
draw("E",O,10E);
draw("W",O,10W);

draw("NE",O,5NE);
draw("SE",O,5SE);
draw("NW",O,5NW);
draw("SW",O,5SW);

đŸ”—generalities-fig066

Figure generalities 066 Generated with Asymptote

Show generalities/fig0660.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Point/Dot | #Direction | #Label | #Labelmargin

pair O=0;
draw(scale(2)*Label("N",.8red),O,10*N,linewidth(3mm));
draw(scale(2)*Label("S",.8red),O,10*S);
draw(scale(2)*Label("E",.8red),O,10*E);
draw(scale(2)*Label("W",.8red),O,10*W);

draw(rotate(45)*Label("NE"),O,5NE);
draw(rotate(-45)*Label("SE"),O,5SE);
draw(rotate(-45)*Label("NW"),O,5NW);
draw(rotate(45)*Label("SW"),O,5SW);

đŸ”—generalities-fig067

Figure generalities 067 Generated with Asymptote

Show generalities/fig0670.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Point/Dot | #Label | #Tex/latex features | #Fraction

pair O=0;
dot(O);
label(scale(5) * "$\frac{\pi^2}{2}$", O);

đŸ”—generalities-fig068

Figure generalities 068 Generated with Asymptote

Show generalities/fig0680.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Point/Dot | #Label | #Tex/latex features | #Fraction | #Align

dot(Label(scale(5) * "$\frac{\pi^2}{2}$", (0,0), align=E));

đŸ”—generalities-fig069

Figure generalities 069 Generated with Asymptote

Show generalities/fig0690.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Label

label(scale(15)*Label("$\pi$"), (0,0));

đŸ”—generalities-fig070

Figure generalities 070 Generated with Asymptote

Show generalities/fig0700.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Label

texpreamble("\usepackage{manfnt}");

label(scale(6)*Label("\textdbend"), (0,0));

đŸ”—generalities-fig071

Figure generalities 071 Generated with Asymptote

Show generalities/fig0710.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Point/Dot | #Label | #Tex/latex features | #Align

dot(Label("$A$"), (0,0), S);

đŸ”—generalities-fig072

Figure generalities 072 Generated with Asymptote

Show generalities/fig0720.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Point/Dot | #Label | #Align | #Shipout

size(6cm, 6cm);

dot(Label("$A$"),(0,0),S);
draw(E--W,invisible);
draw(N--S,invisible);

shipout(bbox());

đŸ”—generalities-fig073

Figure generalities 073 Generated with Asymptote

Show generalities/fig0730.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Point/Dot | #Label | #Tex/latex features | #Align

dot(Label("$A$", fontsize(26pt)), (0,0), NE);

đŸ”—generalities-fig074

Figure generalities 074 Generated with Asymptote

Show generalities/fig0740.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Point/Dot | #Label | #Tex/latex features | #Align | #Defaultpen

defaultpen(fontsize(26pt));

dot(Label("$A$"),(0,0),NE);
dot(Label("$B$"),(2cm,0),NE+N);

đŸ”—generalities-fig075

Figure generalities 075 Generated with Asymptote

Show generalities/fig0750.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Label

label(rotate(45) * scale(5) * "\textbf{Hello}");

đŸ”—generalities-fig076

Figure generalities 076 Generated with Asymptote

Show generalities/fig0760.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Label | #Transform/scale/shift/rotate | #Fill/Unfill

frame f;
label(f,"\textbf{Hello}",yellow,Fill(black));
add(scale(5)*rotate(45)*f);

đŸ”—generalities-fig077

Figure generalities 077 Generated with Asymptote

Show generalities/fig0770.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Label | #Transform/scale/shift/rotate | #Fill/Unfill

frame f;
filldraw(scale(5cm)*unitsquare, black);
label(f,"Hello", 0.8*red, Fill(white));
add(rotate(45) * scale(5) * f, (2.5cm,2.5cm));

đŸ”—generalities-fig078

Figure generalities 078 Generated with Asymptote

Show generalities/fig0780.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Label | #Layer

label(scale(5)*"\textbf{Cancel}");
draw((min(currentpicture).x,0)--(max(currentpicture).x,0), 6bp + red * 0.8);

đŸ”—generalities-fig079

Figure generalities 079 Generated with Asymptote

Show generalities/fig0790.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Label | #Layer

label(scale(6)*"\textbf{Cancel}");
layer();
draw((min(currentpicture).x,0)--(max(currentpicture).x,0), 6bp + red * 0.8);

đŸ”—generalities-fig080

Figure generalities 080 Generated with Asymptote

Show generalities/fig0800.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Direction

size(6cm,0);
path line1=(0,0)--(1,0);
path line2=(0,0)--(1,1);
pair bissec=dir(line1,line2);

draw(line1); draw(line2);
dot(bissec,linewidth(3bp));
draw(-.5bissec--bissec,dotted);
dot("$A$",(0,0),-bissec);

đŸ”—generalities-fig081

Figure generalities 081 Generated with Asymptote

Show generalities/fig0810.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Direction

size(6cm,0);
pair A=0, B=(1,0), C=(2,2);;

draw(A--B--C--cycle);
dot("$A$",A,dir(C--A,B--A));
dot("$B$",B,dir(C--B,A--B));
dot("$C$",C,dir(A--C,B--C));

đŸ”—generalities-fig082

Figure generalities 082 Generated with Asymptote

Show generalities/fig0820.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Align | #Basealign | #Transform/scale/shift/rotate | #Fontsize

size(0,0);
path line=(0,0)--(6cm,0);
transform T=shift(0,-cm);

draw("$A$",line);
draw("$B$",T*line,dir(0));
draw("$C$",T^2*line,N);
draw(Label("$D$",fontsize(14pt)),T^3*line);

đŸ”—generalities-fig083

Figure generalities 083 Generated with Asymptote

Show generalities/fig0830.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Align | #Basealign | #Fill/Unfill | #Position | #Transform/scale/shift/rotate

size(0,0);
path line=(0,0)--(6cm,0);
transform T=shift(0,-cm);

draw(Label("A",align=Center,filltype=UnFill), line);
draw(Label("B",UnFill), T*line, Center);
draw(Label("C",align=Center,position=Relative(.75),UnFill), T^2*line);
draw(Label("D",position=Relative(.25),UnFill), align=Center, T^3*line);

đŸ”—generalities-fig084

Figure generalities 084 Generated with Asymptote

Show generalities/fig0840.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Align | #Basealign | #Transform/scale/shift/rotate | #Shipout

pair c=0;
label("abc xyz ijk",c,Align,basealign);
label("abc xyz ijk",c,Align,red);
draw(c--(c+(2cm,0))); // This is the baseline.

shipout((scale(3)*currentpicture.fit()));

đŸ”—generalities-fig085

Figure generalities 085 Generated with Asymptote

Show generalities/fig0850.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Label | #Path

size(6cm,0);
pair A=0, B=(1,0), C=(1,1);

draw("$1$",A--B);
draw("$1$",B--C);
draw("$\sqrt{2}$",C--A);

đŸ”—generalities-fig086

Figure generalities 086 Generated with Asymptote

Show generalities/fig0860.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Label | #Path | #Tex/latex features | #Align | #Rotate

size(6cm,0);
pair A=0, B=(1,0), C=(1,1);

draw("$1$",A--B);
draw("$1$",B--C);

// draw(rotate(dir(C--A))*"$\sqrt{2}$",C--A);
draw(Label("$\sqrt{2}$",Rotate(-dir(C--A))),C--A);

đŸ”—generalities-fig087

Figure generalities 087 Generated with Asymptote

Show generalities/fig0870.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Label | #Path | #Align | #Rotate

size(6cm,0);
path g=(1,1)--(3,2);
draw(Label("a text",Rotate(dir(g))), g);
draw(Label("a text",red,Rotate(-dir(g)),align=I*dir(g)), g);

đŸ”—generalities-fig088

Figure generalities 088 Generated with Asymptote

Show generalities/fig0880.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Defaultpen | #Point/Dot | #Transform/scale/shift/rotate | #Arrows/Bars | #Margin

size(0,0);
pair A=(0,0), B=(4cm,0);
path line=A--B;
transform TD=shift(0,-cm);
transform TR=shift(2.5cm,0);

defaultpen(linewidth(3bp));

draw("$AB$",line,.8red,Arrows(3mm));  
draw("$A$",A,N); draw("$B$",B,N);

draw("$AB$",TD*line,.8red,Arrows(3mm),PenMargins);  
draw("$A$",TD*A,N); draw("$B$",TD*B,N);

draw("$AB$",TD^2*line,.8red,Arrows(3mm),DotMargins);  
dot("$A$",TD^2*A,dotfactor*NW); dot("$B$",TD^2*B,dotfactor*NE);

margin BigMargins=Margin(2,2);
draw("$AB$",TD^3*line,.8red,Arrows(3mm),BigMargins);  
draw("$A$",TD^3*A,N); draw("$B$",TD^3*B,N);

đŸ”—generalities-fig089

Figure generalities 089 Generated with Asymptote

Show generalities/fig0890.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Deferred drawing | #Arrows/Bars | #Labelmargin | #Margin | #Picture

//From documentation of Asymptote
size(6cm, 0);

void distance(picture pic=currentpicture, pair A, pair B, Label L="", real n=0, pen p=currentpen)
{
  real d=3mm;
  guide g=A--B;
  transform T=shift(-n*d*unit(B-A)*I);
  pic.add(new void(frame f, transform t) {
    picture opic;
    guide G=T*t*g;
    draw(opic, G, p, Arrows(NoFill), Bars, PenMargins);
    label(opic, L, midpoint(G), UnFill(1));
    add(f, opic.fit());
  });
  pic.addBox(min(g), max(g), T*min(p), T*max(p));
}

pair A=(0, 0), B=(3, 3);

dot(A);
dot(B);
distance(A, B, Label("$\ell$", Rotate(dir(A--B))), 1);

đŸ”—generalities-fig090

Figure generalities 090 Generated with Asymptote

Show generalities/fig0900.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Object | #Label

// Author: John Bowman
size(0, 100);
real margin=2mm;
pair z1=(0,1);
pair z0=(0,0);

object label1=draw("small box",box,z1,margin);
object label0=draw("LARGE ELLIPSE",ellipse,z0,margin);

add(new void(frame f, transform t) {
    draw(f,point(label1,S,t)--point(label0,N,t));
  });

đŸ”—generalities-fig091

Figure generalities 091 Generated with Asymptote

Show generalities/fig0910.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Arrows/Bars

size(0,0);
pair A=0;
dot(A);

arrow("1",A,NE, 3cm);
arrow("2",A,SE, 2cm);
arrow("3",A,SW, 2.5cm, Margin(3,0));
arrow("4",A,NW, 2.5cm,N);

đŸ”—generalities-fig092

Figure generalities 092 Generated with Asymptote

Show generalities/fig0920.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Path | #Circle

size(6cm,0);

draw(E--N--W--S--cycle,.5red+1mm);

draw(E..N..W..S..cycle);
dot(E..N..W..S..cycle,red);

đŸ”—generalities-fig093

Figure generalities 093 Generated with Asymptote

Show generalities/fig0930.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Size | #Path | #Circle

size(0,0);
pair O=0;

draw(circle(O,4cm));
dot(circle(O,4cm), red+4bp);

đŸ”—generalities-fig094

Figure generalities 094 Generated with Asymptote

Show generalities/fig0940.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Size | #Path | #Circle

size(6cm);

draw(unitcircle, dot);
dotfactor*=3;
draw(shift(-0.5,-0.5)*unitsquare, dot(blue,Fill(red)));

đŸ”—generalities-fig095

Figure generalities 095 Generated with Asymptote

Show generalities/fig0950.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Size | #Path | #Transform/scale/shift/rotate

size(0,0);

real R=4cm;

draw(scale(R)*unitcircle);
dot((0,0),linewidth(4bp));
dot((R*cos(pi/6),R*sin(pi/6)),red+8bp);

đŸ”—generalities-fig096

Figure generalities 096 Generated with Asymptote

Show generalities/fig0960.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Size | #Path

size(6cm,0);

import graph;

path PerfectCircle=Circle((0,0),1);

draw(PerfectCircle,linewidth(2mm));
dot(PerfectCircle,.8red);

đŸ”—generalities-fig097

Figure generalities 097 Generated with Asymptote

Show generalities/fig0970.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Size | #Path | #Circle

size(6cm,0);

//Return Circle AB diameter
path circle(pair A, pair B)
{
  return shift(midpoint(A--B))*scale(abs(A-B)/2)*unitcircle;
}

pair A=(0,0), B=(1,0);

draw(circle(A,B));
dot(A--B);

đŸ”—generalities-fig098

Figure generalities 098 Generated with Asymptote

Show generalities/fig0980.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Size | #Path | #Circle

size(6cm,0);

//Return Circle AB diameter
path circle(pair A, pair B)
{
  return shift(midpoint(A--B))*scale(abs(A-B)/2)*unitcircle;
}

pair A=(0,0), B=(3,0), C=(2,1);

draw(A--B,.8blue);
draw(A--C,.8red);
draw(B--C,.8green);
draw(circle(A,B),.8blue);
draw(circle(A,C),.8red);
draw(circle(B,C),.8green);

đŸ”—generalities-fig099

Figure generalities 099 Generated with Asymptote

Show generalities/fig0990.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Size | #Path | #Circle | #Function creation

size(6cm,0);

//Return Circle AB diameter
path circle(pair A, pair B)
{
  return shift(midpoint(A--B))*scale(abs(A-B)/2)*unitcircle;
}

pair A=(0,0), B=(1,0), C=(2,0);
path cleAB=circle(A,B);
path cleAC=circle(A,C);

for(real t=0; t<length(cleAB); t+=0.01)
  fill(circle(point(cleAB,t),point(cleAC,t)));

đŸ”—generalities-fig100

Figure generalities 100 Generated with Asymptote

Show generalities/fig1000.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Circle | #Arc

size(0,0);
pair O=0;

defaultpen(linewidth(2mm));
draw(arc(O,4cm,0,60), .8red, BeginPenMargin);
draw(arc(O,4cm,60,120), .7green, PenMargins);
draw(arc(O,-4cm,0,120), .7blue);

đŸ”—generalities-fig101

Figure generalities 101 Generated with Asymptote

Show generalities/fig1010.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Circle | #Picture | #Transform/scale/shift/rotate | #Array

size(8cm,0);

picture pic;
pen [] P={.8red,.7green,blue+.5grey,yellow+.6grey};

fill(scale(10)*unitcircle,.2blue);

for (int i = 0; i <= 3; ++i)
  draw(pic, arc((0,0),10,i*90,(i+1)*90), P[i]);

for (real i = 1; i <= 10; i+=.05)
  add(rotate(90*i)*scale(1/i)*pic);

đŸ”—generalities-fig102

Figure generalities 102 Generated with Asymptote

Show generalities/fig1020.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Loop/for/while | #Fill/Unfill | #Arc

size(6cm,0);

real a=360/6;
for (int i = -1; i < 5; ++i)
  fill(arc((0,0),1,i*a,(i+1)*a)--cycle,grey);

đŸ”—generalities-fig103

Figure generalities 103 Generated with Asymptote

Show generalities/fig1030.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Loop/for/while | #Fill/Unfill | #Arc

size(6cm,0);

real n=7, a=360/n;
for (int i = 0; i < n; ++i)
  filldraw((0,0)--arc((0,0),1,i*a,(i+1)*a)--cycle, i/n*blue + (1-i/n)*green + grey);

đŸ”—generalities-fig104

Figure generalities 104 Generated with Asymptote

Show generalities/fig1040.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Loop/for/while | #Fill/Unfill | #Arc | #Label | #Number format | #Align

size(6cm,0);

real a=360/6;
for (int i = -1; i < 5; ++i)
  draw(Label(format("%i",i+1)),arc((0,0),10,i*a,(i+1)*a)--cycle,grey);

đŸ”—generalities-fig105

Figure generalities 105 Generated with Asymptote

Show generalities/fig1050.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Number format

size(0,0);

pair x=0;
pair y=(-6.5cm,0);

label(format(6.66666), x, E);
label("format(6.66666)", y, E);

x+=(0,-1cm);y+=(0,-1cm);
label(format("$x=%f$", 6.66666), x, E);
label("format(\"\$x=\%f\$\", 6.66666)", y, E);

x+=(0,-1cm);y+=(0,-1cm);
label(format("$x=%.1f$", 6.66666), x, E);
label("format(\"\$x=\%.1f\$\", 6.66666)", y, E);

x+=(0,-1cm);y+=(0,-1cm);
label(format("$x=%.2f$", 6.66666), x, E);
label("format(\"\$x=\%.2f\$\", 6.66666)", y, E);

x+=(0,-1cm);y+=(0,-1cm);
label(format("$x=%.0f$", 6.66666), x, E);
label("format(\"\$x=\%.0f\$\", 6.6666)", y, E);

x+=(0,-1cm);y+=(0,-1cm);
label(format("$x=%07.3f$", 6.66666), x, E);
label("format(\"\$x=\%07.3f\$\", 6.6666)", y, E);

x+=(0,-1cm);y+=(0,-1cm);
label(format("$x=%7.3f$", 6.66666), x, E);
label("format(\"\$x=\% 7.3f\$\", 6.6666)", y, E);

x+=(0,-1cm);y+=(0,-1cm);
label(format("$x=%g$", 66.666), x, E);
label("format(\"\$x=\%g\$\", 66.66666)", y, E);

x+=(0,-1cm);y+=(0,-1cm);
label(format("$x=%g$", 666666.666), x, E);
label("format(\"\$x=\%g\$\", 666666.666)", y, E);

x+=(0,-1cm);y+=(0,-1cm);
label(format("$x=%g$", 666666666.666), x, E);
label("format(\"\$x=\%g\$\", 666666666.666)", y, E);

x+=(0,-1cm);y+=(0,-1cm);
label(format("$x=%e$", 666666.666), x, E);
label("format(\"\$x=\%e\$\", 666666.666)", y, E);

x+=(0,-1cm);y+=(0,-1cm);
label(format("$x=%.2e$", 666666.666), x, E);
label("format(\"\$x=\%.2e\$\", 666666.666)", y, E);

x+=(0,-1cm);y+=(0,-1cm);
label(format("$x=%i$", 6), x, E);
label("format(\"\$x=\%i\$\", 6)", y, E);

x+=(0,-1cm);y+=(0,-1cm);
label(format("$x=%f$", 6.0), x, E);
label("format(\"\$x=\%f\$\", 6.0)", y, E);

x+=(0,-1cm);y+=(0,-1cm);
label(format("$x=%+.2f$", 6.66666), x, E);
label("format(\"\$x=\%+.2f\$\", 6.66666)", y, E);

x+=(0,-1cm);y+=(0,-1cm);
label(format("$x=%+.2f$", -6.66666), x, E);
label("format(\"\$x=\%+.2f\$\", -6.66666)", y, E);

x+=(0,-1cm);y+=(0,-1cm);
label(format("$x=% .2f$", 6.666666), x, E);
label("format(\"\$x=\% .2f\$\", 6.666666)", y, E);

đŸ”—generalities-fig106

Figure generalities 106 Generated with Asymptote

Show generalities/fig1070.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis

// This file was compiled with this unix command: LC_NUMERIC="french" asy
size(0,0);
texpreamble("\usepackage[frenchb]{babel}");

pair x=0;

x+=(0,-1cm);
label(format("$x=%f$", 666666.666), x, E);
x+=(0,-1cm);
label(format("$x=%f$", pi), x, E);
x+=(0,-1cm);
label(format("$x=\nombre{%f}$", 666666.666), x, E);
x+=(0,-1cm);
label(format("$x=\nombre{%f}$", pi), x, E);

đŸ”—generalities-fig107

Figure generalities 107 Generated with Asymptote

Show generalities/fig1080.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Number format | #Fraction

size(0,0);

int pgcd(int a, int b)
{
  int a_=abs(a), b_=abs(b), r=a_;
  if (b_>a_) {a_=b_; b_=r; r=a_;}
  while (r>0)
    {
      r=a_%b_;
      a_=b_;
      b_=r;
    }
  return a_;
}

string texfrac(int p, int q,
               string factor="",
               bool signin=false, bool factorin=true,
               bool displaystyle=false,
               bool zero=true)
{
  if (p==0) return (zero ? "$0$" : "");
  string disp= displaystyle ? "$\displaystyle " : "$";
  int pgcd=pgcd(p,q);
  int num= round(p/pgcd), den= round(q/pgcd);
  string nums;
  if (num==1)
    if (factor=="" || (!factorin && (den !=1))) nums="1"; else nums="";
  else
    if (num==-1)
      if (factor=="" || (!factorin && (den !=1))) nums="-1"; else nums="-";
    else nums= (string) num;
  if (den==1) return "$" + nums + factor + "$";
  else
    {
      string dens= (den==1) ? "" : (string) den;
      if (signin || num>0)
        if (factorin)
          return disp + "\frac{" + nums + factor + "}{" + (string) dens + "}$";
        else
          return disp + "\frac{" + nums + "}{" + (string) dens + "}"+ factor + "$";
      else
        {
          if (num==-1)
            if (factor=="" || !factorin) nums="1"; else nums="";
          else nums=(string)(abs(num));
        if (factorin)
          return disp + "-\frac{" + nums + factor + "}{" + (string) dens + "}$";
        else
          return disp + "-\frac{" + nums + "}{" + (string) dens + "}"+ factor + "$";
        }
    }
}

for (int i=-4; i<=4; ++i)
  {
    label(texfrac(i,4), (i*cm,0));
    label(texfrac(i,4,signin=true), (i*cm,-cm));
    label(texfrac(i,4,factor="\pi"), (i*cm,-2cm));
    label(texfrac(i,4,factor="\pi",factorin=false), (i*cm,-3cm));
    label(texfrac(i,4,factor="\pi",signin=true,factorin=true), (i*cm,-4cm));
    label(texfrac(i,4,factor="\pi",signin=true,factorin=false,displaystyle=true,zero=false), (i*cm,-5cm));
  }

đŸ”—generalities-fig108

Figure generalities 108 Generated with Asymptote

Show generalities/fig1090.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Fill/Unfill | #Picture

size(6cm,0);

pair A=0, B=(1,0), C=(.7,1);

void fillangle(picture pic=currentpicture,
	       pair O=0, pair A, pair B,
	       real radius=10,
	       pen p=grey)
{
  picture tpic;
  int n=sgn(radius);
  real a1=degrees(shift(-O)*A,false);
  real a2=degrees(shift(-O)*B,false);
  fill(tpic,(0,0)--arc((0,0), -radius, max(a1,a2), min(a1,a2),true)--cycle, p=p);
  add(pic,tpic,O);
}

draw(A--B--C--cycle);

real r1=15, r2=20;
fillangle(A,B,C,r1,.8red);
fillangle(A,B,C,-r2);
fillangle(B,A,C,r1,.8red);
fillangle(B,A,C,-r2);
fillangle(C,B,A,r1,.8red);
fillangle(C,B,A,-r2);

đŸ”—generalities-fig109

Figure generalities 109 Generated with Asymptote

Show generalities/fig1100.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Transform/scale/shift/rotate

size(0,0);
pair A, B, C;
A=(0,0); B=(4cm,0); C=(0,4cm);

draw(A--B--C--cycle);
filldraw(shift(A)*scale(6bp)*unitcircle, white);
filldraw(shift(B)*scale(6bp)*unitcircle, white);
filldraw(shift(C)*scale(6bp)*unitcircle, white);

đŸ”—generalities-fig110

Figure generalities 110 Generated with Asymptote

Show generalities/fig1110.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Point/Dot

size(8cm,0);
pair A=(0,0), B=(0,1), C=(1,0), D=(1,1);

draw(A..B..C..D);
dot(A);dot(B);dot(C);dot(D);

đŸ”—generalities-fig111

Figure generalities 111 Generated with Asymptote

Show generalities/fig1120.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Point/Dot | #Path

size(6cm,0);
import roundedpath;

pair A=(0,0), B=(0,1), C=(1,0), D=(1,1);

draw(roundedpath(A--B--C--D,.5));
dot(A--B--C--D);

đŸ”—generalities-fig112

Figure generalities 112 Generated with Asymptote

Show generalities/fig1130.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Point/Dot

size(6cm,0);
pair A=(0,0), B=(0,1), C=(1,0), D=(1,1);

draw(A--B..C..D);
dot(A--B--C--D);

đŸ”—generalities-fig113

Figure generalities 113 Generated with Asymptote

Show generalities/fig1140.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Point/Dot

size(6cm,0);
pair A=(0,0), B=(0,1), C=(1,0), D=(1,1);

draw(A..B..C..D--cycle);
dot(A);dot(B);dot(C);dot(D);

đŸ”—generalities-fig114

Figure generalities 114 Generated with Asymptote

Show generalities/fig1150.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Point/Dot

size(6cm,0);
pair A=(0,0), B=(0,1), C=(1,0), D=(1,1);

draw(A---B..C..D);
dot(A);dot(B);dot(C);dot(D);

đŸ”—generalities-fig115

Figure generalities 115 Generated with Asymptote

Show generalities/fig1160.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Point/Dot

size(6cm,0);
import roundedpath;

draw(roundedpath(unitsquare,.4));
dot(roundedpath(unitsquare,.4),red);
draw(unitsquare);
dot(unitsquare);

đŸ”—generalities-fig116

Figure generalities 116 Generated with Asymptote

Show generalities/fig1170.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Point/Dot

size(0,0);

pair A=0, B=(6cm,0);

draw(A{N}..B);
dot(A{N}..B);

đŸ”—generalities-fig117

Figure generalities 117 Generated with Asymptote

Show generalities/fig1180.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Point/Dot

size(0,0);

pair A=0, B=(6cm,0);

draw(A{N}..B{E});
dot(A{N}..B{E});

đŸ”—generalities-fig118

Figure generalities 118 Generated with Asymptote

Show generalities/fig1190.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis

size(0,0);

pair A=0, B=(6cm,0);

draw(A{dir(90)}..B{dir(0)});
dot(A{dir(90)}..B{dir(0)});

đŸ”—generalities-fig119

Figure generalities 119 Generated with Asymptote

Show generalities/fig1200.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis

size(0,0);

pair A=0, B=(6cm,0);

draw(A{dir(90)}..B{dir(180)});
dot(A{dir(90)}..B{dir(180)});

đŸ”—generalities-fig120

Figure generalities 120 Generated with Asymptote

Show generalities/fig1210.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis

size(0,0);

pair A=0, B=(6cm,0);

draw(A{N}..B{N});
dot(A{N}..B{N});

đŸ”—generalities-fig121

Figure generalities 121 Generated with Asymptote

Show generalities/fig1220.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis

size(0,0);

pair A=0, B=(6cm,0);

draw(A{N}..B{N}..cycle);
dot(A{N}..B{N}..cycle);

đŸ”—generalities-fig122

Figure generalities 122 Generated with Asymptote

Show generalities/fig1230.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Path | #Fill/Unfill

//From documentation of Asymptote
size(0,6cm);
guide center = (0,1){W}..tension 0.8..(0,0){(1,-.5)}..tension 0.8..{W}(0,-1); 

draw((0,1)..(-1,0)..(0,-1));
filldraw(center{E}..{N}(1,0)..{W}cycle);
unfill(circle((0,0.5),0.125));
fill(circle((0,-0.5),0.125));

đŸ”—generalities-fig123

Figure generalities 123 Generated with Asymptote

Show generalities/fig1240.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Path | #Circle

size(8cm);
draw(unitcircle, linewidth(bp));
pen p;
for (int t=-88; t <= 88; t += 2) {
  if(t%5 == 0) {
    p=linewidth(bp);
    draw((0,1){dir (t-90)}..{dir (270-t)}(0,-1), linewidth(bp));
  } else p=currentpen;
  draw((Cos(t),Sin(t)){dir(180+t)}..{dir(180-t)}(-Cos(t),Sin(t)), p);
}

đŸ”—generalities-fig124

Figure generalities 124 Generated with Asymptote

Show generalities/fig1250.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis

size(0,0);

pair A=0, B=(3cm,3cm), C=(6cm,0);

draw(A..B..C);
draw(A{curl 0}..B..{curl 0}C,red);
dot(A--B--C);

đŸ”—generalities-fig125

Figure generalities 125 Generated with Asymptote

Show generalities/fig1260.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis

size(0,0);

pair A=0, B=(3cm, 3cm), C=(6cm, 0);

draw(A..B..C,linewidth(3mm));
draw(A{curl 1}..B..{curl 1}C,2mm+.8red);
dot(A--B--C);

đŸ”—generalities-fig126

Figure generalities 126 Generated with Asymptote

Show generalities/fig1270.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis

size(0,0);

pair A=0, B=(3cm,4cm), C=(6cm,0);

draw(A..B..C);
draw(A{curl 0}..B..{curl 0}C,1mm+red+grey);
draw(A{curl 5}..B..{curl 0}C,1mm+green+grey);
draw(A{curl 10}..B..{curl 0}C,1mm+blue+grey);
draw(A{curl 10}..B..{curl 10}C,1mm+yellow+grey);
dot(A--B--C);

đŸ”—generalities-fig127

Figure generalities 127 Generated with Asymptote

Show generalities/fig1280.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis

size(0,0);

pair A=0, B=(3cm,0.5cm), C=(6cm,0);

draw(A{N}..B{E}..C{S});
draw(A{N}::B{E}::C{S},red);
dot(A--B--C);

đŸ”—generalities-fig128

Figure generalities 128 Generated with Asymptote

Show generalities/fig1290.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis

size(0,0);

pair A=0, B=(3cm,5cm), C=(6cm,0);
defaultpen(1mm);

draw(A..B..C);
draw(A.. tension .75 ..B.. tension .75 ..C,grey);
draw(A.. tension 1.5 ..B.. tension 1.5 ..C,.8red);
draw(A.. tension 2 ..B.. tension 2 ..C,green+grey);
draw(A.. tension 10 ..B.. tension 10 ..C,blue+grey);
dot(A--B--C,linewidth(6bp));

đŸ”—generalities-fig129

Figure generalities 129 Generated with Asymptote

Show generalities/fig1300.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis

size(0,0);

pair A=0, B=(3cm,5cm), C=(6cm,0);
defaultpen(1mm);

draw(A..B..C);
draw(A.. tension 10 and 1 ..B.. tension 1 and 10 ..C,grey);
draw(A.. tension 1 and 10 ..B.. tension 10 and 1 ..C,.8red);
draw(A.. tension 2 and 1 ..B.. tension 1 and 2 ..C,blue+grey);
dot(A--B--C,linewidth(6bp));

đŸ”—generalities-fig130

Figure generalities 130 Generated with Asymptote

Show generalities/fig1310.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis

size(0,0);

pair A=0, B=(3cm,5cm), C=(6cm,0);
defaultpen(1mm);

draw(A..B..C);
draw(A.. tension 5 and 3 ..B.. tension 1 and 5 ..C,grey);
draw(A.. tension 5 and 1 ..B.. tension 3 and 5 ..C,.8red);
dot(A--B--C,linewidth(6bp));

đŸ”—generalities-fig131

Figure generalities 131 Generated with Asymptote

Show generalities/fig1320.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Path

size(0,0);

pair A=0, B=(3cm,5cm), C=(6cm,0);

pair ctrl_rgt_A, ctrl_lft_B, ctrl_rgt_B, ctrl_lft_C;
ctrl_rgt_A=A+2cm*E;
ctrl_lft_B=B+3cm*W;
ctrl_rgt_B=B+3cm*E;
ctrl_lft_C=C+2cm*W;

draw(A..B..C);
draw(A.. controls ctrl_rgt_A and ctrl_lft_B ..B.. controls ctrl_rgt_B and ctrl_lft_C ..C,1mm+grey);
dot(A--B--C,linewidth(6bp));
draw((A--ctrl_rgt_A),Arrow, p=grey);
draw((B--ctrl_rgt_B),Arrow, p=grey);
draw((B--ctrl_lft_B),Arrow, p=grey);
draw((C--ctrl_lft_C),Arrow, p=grey);

đŸ”—generalities-fig132

Figure generalities 132 Generated with Asymptote

Show generalities/fig1330.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Path

size(0,0);

pair A=0, B=(3cm,5cm), C=(6cm,0);

pair ctrl_rgt_A, ctrl_lft_B, ctrl_rgt_B, ctrl_lft_C;
ctrl_rgt_A=A+2cm*NE;
ctrl_lft_B=B+5cm*SW;
ctrl_rgt_B=B+2cm*SE;
ctrl_lft_C=C+5cm*NW;

draw(A..B..C);
draw(A.. controls ctrl_rgt_A and ctrl_lft_B ..B.. controls ctrl_rgt_B and ctrl_lft_C ..C,1mm+grey);
dot(A--B--C,linewidth(6bp));
draw((A--ctrl_rgt_A),Arrow, p=grey);
draw((B--ctrl_rgt_B),Arrow, p=grey);
draw((B--ctrl_lft_B),Arrow, p=grey);
draw((C--ctrl_lft_C),Arrow, p=grey);

đŸ”—generalities-fig133

Figure generalities 133 Generated with Asymptote

Show generalities/fig1340.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Path

size(8cm);
path p1 = (0,0){up}..(5,4)..(10,0){down};

pair post0=postcontrol(p1,0);
pair pre1=precontrol(p1,1);
pair post1=postcontrol(p1,1);
pair pre2=precontrol(p1,2);

dot(post0^^pre1^^post1^^pre2);
path p2 = (0,0)..controls post0 and pre1..(5,4)..controls post1 and pre2..(10,0); 

draw(p1,2mm+red);
draw(p2,linewidth(1mm));

đŸ”—generalities-fig134

Figure generalities 134 Generated with Asymptote

Show generalities/fig1350.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Path | #Circle

size(0,0);

path pt1=scale(4cm)*unitcircle;
path pt2=scale(2cm)*unitcircle;

draw(pt1^^pt2);
dot(pt1^^pt2);

đŸ”—generalities-fig135

Figure generalities 135 Generated with Asymptote

Show generalities/fig1360.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Path | #Circle | #Point/Dot | #Transform/scale/shift/rotate

size(0,0);

path cle=scale(4cm)*unitcircle;

draw(cle);

for(real i=0; i<=length(cle); i+=.2)
  {
    dot(point(cle,i));
    draw((0,0)--point(cle,i),dotted);
  }

đŸ”—generalities-fig136

Figure generalities 136 Generated with Asymptote

Show generalities/fig1370.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Path | #Circle | #Loop/for/while

size(0,0);

path cle=scale(4cm)*unitcircle;

draw(cle);

for(real i=0; i<=length(cle); i+=.2)
  draw(point(cle,i)--2cm*dir(cle,i)+point(cle,i),Arrow,p=i/length(cle)*red);

đŸ”—generalities-fig137

Figure generalities 137 Generated with Asymptote

Show generalities/fig1380.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Path | #Circle | #Loop/for/while

size(0,0);

path cle=scale(4cm)*reverse(unitcircle);

draw(cle);

for(real i=0; i<=length(cle); i+=.2)
  draw(point(cle,i)--2cm*dir(cle,i)+point(cle,i),Arrow,p=i/length(cle)*red);

đŸ”—generalities-fig138

Figure generalities 138 Generated with Asymptote

Show generalities/fig1390.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Path

size(8cm,0);
pair O=(0,0);
path p=(0,0){dir(0)}..{dir(45)}(2,2){dir(-45)}..{dir(0)}(4,0);

pair En1=dir(p, 1, -1);
pair En2=dir(p, 2, -1);
draw(p);
draw(Label("dir(p,1,-1)", EndPoint), point(p,1)--point(p,1)+En1, red, Arrow);
draw(Label("dir(p,2,-1)", EndPoint), point(p,2)--point(p,2)+En2, red, Arrow);

pair Ep0=dir(p, 0, 1);
pair Ep1=dir(p, 1, 1);
draw(Label("dir(p,0,1)", EndPoint), point(p,0)--point(p,0)+Ep0, blue, Arrow);
draw(Label("dir(p,1,1)", EndPoint, E), point(p,1)--point(p,1)+Ep1, blue, Arrow);

draw(p, dot);

đŸ”—generalities-fig139

Figure generalities 139 Generated with Asymptote

Show generalities/fig1400.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Path | #Circle | #Loop/for/while

size(0,0);

path cle=scale(4cm)*reverse(unitcircle);

draw(cle);

for(real i=0; i<=length(cle); i+=.2)
  draw(point(cle,i)--(1cm*I*dir(cle,i))+point(cle,i),Arrow,p=i/length(cle)*red);

đŸ”—generalities-fig140

Figure generalities 140 Generated with Asymptote

Show generalities/fig1410.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Circle | #Shading

size(6cm,0);

path cle=scale(2)*unitcircle;

radialshade(scale(2)*cle, white, (0,0), 2, yellow, (0,0), 4);
radialshade(cle, white, (1,.5), 0, 0.8*blue, (0,0), 2);

for(real i=0; i<=length(cle); i+=.2)
  draw(point(cle,i)--(-2*I*dir(cle,i)+point(cle,i)),p=2mm+yellow+linecap(0));

đŸ”—generalities-fig141

Figure generalities 141 Generated with Asymptote

Show generalities/fig1420.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Path | #Loop/for/while

size(6cm,0);

path curv=reverse((0,2){dir(-60)}..(1,0)..{dir(60)}(2,2));

draw(curv);

for(real i=0; i<=length(curv); i+=.1)
  draw(point(curv,i)--dir(curv,i)+point(curv,i),grey);

đŸ”—generalities-fig142

Figure generalities 142 Generated with Asymptote

Show generalities/fig1430.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Path | #Loop/for/while

size(10cm,0);

path curv=reverse((0,2){dir(10)}..(1,0)..{dir(-50)}(3,2));
guide dirc;

draw(curv,linewidth(1mm)+grey);

for(real i=0; i<=length(curv); i+=.005)
  {
    draw(point(curv,i)--dir(curv,i)+point(curv,i),grey+yellow);
    dirc=dirc..dir(curv,i)+point(curv,i);
  }

draw(dirc,grey);

đŸ”—generalities-fig143

Figure generalities 143 Generated with Asymptote

Show generalities/fig1440.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Path

// Author: John Bowman
pair[] z=new pair[10]; 
z[0]=(0,100); z[1]=(50,0); z[2]=(180,0); 
for(int n=3; n <= 9; ++n) 
  z[n]=z[n-3]+(200,0); 
path p=z[0]..z[1]---z[2]---z[3] 
&z[3]..z[4]--z[5]::{up}z[6] 
&z[6]::z[7]---z[8]..{up}z[9]; 
defaultpen(linewidth(1));
draw(p, grey); 
dot(p); 

real len=50;
for(int i = 0; i < z.length; ++i) {
  pair z=point(p,i);
  draw(z--z+len*dir(p,i,-1),red);
  draw(z--z+len*dir(p,i,1),blue+dashed);
  draw(z-len*dir(p,i)--z+len*dir(p,i),green+Dotted(defaultpen()));
}

đŸ”—generalities-fig144

Figure generalities 144 Generated with Asymptote

Show generalities/fig1450.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Path | #Full line

size(10cm,0);
import math;

path cle=unitcircle;
path curv=reverse((1.5,2){dir(-60)}..(2.5,0)..{dir(60)}(3.5,2));

draw(cle);
draw(curv);

pair pt_cle=point(cle, 1.35);
pair pt_dir_cle=dir(cle, 1.35);

drawline((pt_cle - pt_dir_cle), (pt_cle + pt_dir_cle), red);

pair pt_curv=point(curv, dirtime(curv, pt_dir_cle));

drawline((pt_curv - pt_dir_cle), (pt_curv + pt_dir_cle), blue);

đŸ”—generalities-fig145

Figure generalities 145 Generated with Asymptote

Show generalities/fig1460.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Transform/scale/shift/rotate | #Point/Dot | #Label | #Position

size(0,0);

pair O=(2cm,2cm);
path cle=shift(O)*scale(2cm)*unitcircle;
pair M=point(cle,.6);

dot("$O$",O,SW);
dot("$M$",M,unit(M-O));

draw(cle);
draw((0,0)--(0,4cm),Arrow);
draw((0,0)--(4cm,0),Arrow);

draw(Label("$X_M$",position=EndPoint),M--(xpart(M),0),dotted);
draw(Label("$Y_M$",position=EndPoint),M--(0,ypart(M)),dotted);

đŸ”—generalities-fig146

Figure generalities 146 Generated with Asymptote

Show generalities/fig1470.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Transform/scale/shift/rotate | #Circle

size(0,0);

path p= scale(3cm)*unitcircle;

draw(p,red+1mm);
draw(shift(1mm,2mm)*p);
draw(shift(2*(1mm,2mm))*p);
draw(shift(3*(1mm,2mm))*p);
draw(shift(4*(1mm,2mm))*p);
draw(shift(5*(1mm,2mm))*p);

đŸ”—generalities-fig147

Figure generalities 147 Generated with Asymptote

Show generalities/fig1480.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Path | #Transform/scale/shift/rotate

size(0,0);

path p= (5mm,-5mm){right} .. (4cm,0);

for(int i=10; i<360; i+=10)
  draw(rotate(i)*p);

draw(p,red+1mm);

đŸ”—generalities-fig148

Figure generalities 148 Generated with Asymptote

Show generalities/fig1490.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Path | #Transform/scale/shift/rotate

size(6cm,0);

path p= (1,-1){right} .. (4,0);
pair O=(3,.25);

for(int i=10; i<360; i+=10)
  draw(rotate(i,O)*p);

dot(O,blue);
draw(p,red+1mm);

đŸ”—generalities-fig149

Figure generalities 149 Generated with Asymptote

Show generalities/fig1500.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Path

size(8cm,0);

path curv=(0,0)..(1,1)..(1.5,-1)..(3,0);
pair A=(0,-1), B=(3,.75);

defaultpen(1mm);
draw(curv);
draw(reflect(A,B)*curv,.8red);
draw(A--B,grey);

đŸ”—generalities-fig150

Figure generalities 150 Generated with Asymptote

Show generalities/fig1510.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Path | #Transform/scale/shift/rotate

size(6cm,0);

path cle=unitcircle;

draw(cle,red);
draw(xscale(2)*cle);
draw(yscale(2)*cle);
draw(scale(2)*cle,blue);

đŸ”—generalities-fig151

Figure generalities 151 Generated with Asymptote

Show generalities/fig1520.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Path | #Transform/scale/shift/rotate | #Circle

size(8cm,0);

transform scale(pair center, real k)
{
  return shift(center)*scale(k)*shift(-center);
}

path cle=unitcircle;
pair A=(4,0);
draw(cle);

draw(scale(A,.5)*cle,red);
draw(scale(A,-.75)*cle,blue);

for (real t; t<length(cle); t+=1)
  draw(point(cle,t)--point(scale(A,-.75)*cle,t),dotted);

dot("$A$",A,N);

đŸ”—generalities-fig152

Figure generalities 152 Generated with Asymptote

Show generalities/fig1530.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Path | #Transform/scale/shift/rotate | #Circle | #Function creation

size(0,0);

pair inversion(pair O, real k, pair M)
{
  return (O + k*unit(M-O)/abs(M-O));
}

guide inversion(pair O, real k, path M)
{
  guide opath=inversion(O,k,point(M,0));
  for (real i=0; i<=length(M); i+=length(M)/100)
    opath = opath .. inversion(O,k,point(M,i));
  return opath .. cycle;
}

real u=10cm;
path [] p;
path A = scale(u)*unitcircle;
path B = scale(3)*A;
pair z = rotate(10)*(5u,0);


draw(inversion( z, 2*u^2, A ),linewidth(1pt));
draw(inversion( z, 2*u^2, B ),linewidth(1pt));

p[0] = shift(2u,0)*scale(u)*unitcircle;

for (int i=0; i<=5; ++i)
  {
    if (i!=0) p[i] = rotate(360/6)*p[i-1];
    draw(inversion( z, 2 (u^2), p[i] ));
  }

đŸ”—generalities-fig153

Figure generalities 153 Generated with Asymptote

Show generalities/fig1540.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Path | #Function creation | #Loop/for/while

size(10cm,0);

path unitpolygon(int n)
{
  guide opath;
  for (int i=1; i<=n; ++i)
    opath=opath--rotate((i-1)*360/n)*E;
  return opath--cycle;
}

for (int i=3; i<9; ++i)
  draw(shift(2.5*(i%3),-2.5*quotient(i,3))*unitpolygon(i));

đŸ”—generalities-fig154

Figure generalities 154 Generated with Asymptote

Show generalities/fig1550.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Array | #Path | #Loop/for/while | #Direction | #Label

size(0,0);

pair [] P, Q, R, S;
real u=1cm;

for (int i=0; i<=4; ++i)
  P[i] = rotate(i*360/5)*(0,-u);

P[5] = P[0];
for (int i=0; i<=4; ++i)
  Q[i] = 3*midpoint(P[i]--P[i+1]);

Q[5] = Q[0];
for (int i=0; i<=4; ++i)
  R[i] = 1/3*( Q[i] + Q[i+1] + P[i+1] );

R[5] = R[0];
for (int i=0; i<=5; ++i)
  S[i] = 1.5*Q[i];

for (int i=0; i<=4; ++i)
  {
    draw(P[i]   -- P[i+1]);
    draw(P[i+1] -- R[i]);
    draw(Q[i]   -- R[i]);
    draw(R[i]   -- Q[i+1]);
    draw(Q[i]   -- S[i]);
    draw(S[i]   -- S[i+1]);
    label(format("\small$P_%i$",i),P[i],-unit(P[i]));
    label(format("\small$Q_%i$",i),Q[i],rotate(60)*unit(Q[i]));
    label(format("\small$R_%i$",i),R[i],unit(R[i]));
    label(format("\small$S_%i$",i),S[i],unit(S[i]));
  }

đŸ”—generalities-fig155

Figure generalities 155 Generated with Asymptote

Show generalities/fig1560.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Array | #Path

size(0,0);

pair [] P, Q, R, S;
real u=2cm;

for (int i=0; i<=4; ++i)
  P[i] = rotate(i*360/5)*(0,-u);

P[5] = P[0];
for (int i=0; i<=4; ++i)
  Q[i] = 3*midpoint(P[i]--P[i+1]);

Q[5] = Q[0];
for (int i=0; i<=4; ++i)
  R[i] = 1/3*( Q[i] + Q[i+1] + P[i+1] );

R[5] = R[0];
for (int i=0; i<=5; ++i)
  S[i] = 1.5*Q[i];

for (int i=0; i<=4; ++i)
  {
    draw(P[i]   -- P[i+1]);
    draw(P[i+1] -- R[i]);
    draw(Q[i]   -- R[i]);
    draw(R[i]   -- Q[i+1]);
    draw(Q[i]   -- S[i]);
    draw(S[i]   -- S[i+1]);
  }

draw(P[2] -- P[3] -- P[4] -- P[0] -- P[1] --
     R[0] -- Q[0] -- R[4] -- Q[4] -- R[3]
     -- Q[3] -- R[2] -- Q[2] --
     S[2] -- S[3] -- S[4] -- S[0] -- S[1] --
     Q[1] -- R[1] -- cycle,
     linewidth(2bp));

đŸ”—generalities-fig156

Figure generalities 156 Generated with Asymptote

Show generalities/fig1570.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Array | #Loop/for/while | #Fill/Unfill | #Shading

size(0,0);

pair [] P, Q, R, S;
real u=2cm;

for (int i=0; i<=4; ++i)
  P[i] = rotate(i*360/5)*(0,-u);

P[5] = P[0];
for (int i=0; i<=4; ++i)
  Q[i] = 3*midpoint(P[i]--P[i+1]);

Q[5] = Q[0];
for (int i=0; i<=4; ++i)
  R[i] = 1/3*( Q[i] + Q[i+1] + P[i+1] );

R[5] = R[0];
for (int i=0; i<=5; ++i)
  S[i] = 1.5*Q[i];

fill(shift(-abs(S[0]),-abs(S[0]))*scale(2*abs(S[0]))*unitsquare,.2grey);

radialshade(scale(abs(S[0]))*unitcircle,lightgrey,(0,0),abs(S[0]),
            black,(0,0),abs(.85*midpoint(S[0]--S[1])));

P[6]=P[1];
for (int i=0; i<=4; ++i)
  {
    radialshade(S[i]--Q[i]--R[i]--Q[i+1]--S[i+1]--cycle,
                lightgrey,(0,0),abs(R[i]),
                black,(0,0),abs(S[i]));
    radialshade(R[i]--Q[i+1]--R[i+1]--P[i+2]--P[i+1]--cycle,
                .8red,(0,0),sqrt(1-(2-2cos(pi/5))/4)*u,
                black,(0,0),abs(Q[i+1]));
  }

for (real i=1; i>0; i-=.05)
  fill(rotate(90*(1-i))*scale(i)*(P[0]--P[1]--P[2]--P[3]--P[4]--cycle),
       (1-i)*red);

pen p=linewidth(1pt);
for (int i=0; i<=4; ++i)
  {
    draw(P[i]   -- P[i+1],p);
    draw(P[i+1] -- R[i],p);
    draw(Q[i]   -- R[i],p);
    draw(R[i]   -- Q[i+1],p);
    draw(Q[i]   -- S[i],p);
    draw(S[i]   -- S[i+1],p);
  }

shipout(bbox(0,black+4mm));

đŸ”—generalities-fig157

Figure generalities 157 Generated with Asymptote

Show generalities/fig1580.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Graphic | #Layer | #Label

size(0,0);

label(graphic("dali.eps","width=10cm"));
layer();

draw(scale(2cm)*unitcircle,linewidth(.75mm));
shipout(bbox(.25cm,Fill));

đŸ”—generalities-fig158

Figure generalities 158 Generated with Asymptote

Show generalities/fig1590.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Graphic | #Label

size(0,0);

label(graphic("dali.eps","width=10cm, bb=60 60 235 205, clip=true"));
shipout(bbox(.25cm,Fill));

đŸ”—generalities-fig159

Figure generalities 159 Generated with Asymptote

Show generalities/fig1600.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Number format | #Label | #Tex/latex features

size(0,6cm);

texpreamble("\usepackage{amsmath}
             \DeclareMathOperator{\e}{e}");

pair A=2*expi(pi/3);

draw((0,-2)--(0,2.5));
draw((0,0)--(1,0),linewidth(1mm),Arrow(2mm));
draw((0,0)--(3.5,0));
draw((0,0)--(0,1),linewidth(1mm),Arrow(2mm));

dot(Label("$A(z_a=2\e^{i\frac{\pi}{3}})$"),A,NE);
label(format("$\vert z_a\vert=%.1f$",length(A)),(.5,-1),E);
label(format("$\arg(z_a)\simeq%.4f$",angle(A)),(.5,-2),E);

đŸ”—generalities-fig160

Figure generalities 160 Generated with Asymptote

Show generalities/fig1610.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Number format | #Label | #Tex/latex features

size(10cm,0);

texpreamble("\usepackage{amsmath}
             \DeclareMathOperator{\e}{e}");

pair A=2*expi(pi/3);
pair B=expi(pi/6);
pair C=A*B;
pair D=C-B;
pair Bp=2*B;
pair E=I*D;

draw((0,-2)--(0,2.5));
draw((0,0)--(1,0),linewidth(1mm),Arrow(2mm));
draw((-3,0)--(3.5,0));
draw((0,0)--(0,1),linewidth(1mm),Arrow(2mm));

dot(Label("$A(z_a=2\e^{i\frac{\pi}{3}})$"),A);
dot(Label("$B(z_a=\e^{i\frac{\pi}{6}})$"),B);
dot(Label("$B'(z_{b'}=2z_b)$"),Bp);
dot(Label("$\overline{A}(\overline{z_a})$"),conj(A));
dot(Label("$C(z_c=z_a z_c)$"),C,NE);
dot(Label("$D(z_d=z_c-z_d)$"),D,NW);
dot(Label("$E(z_e=iz_d)$"),E,NW);

đŸ”—generalities-fig161

Figure generalities 161 Generated with Asymptote

Show generalities/fig1620.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Circle | #Loop/for/while | #Function creation

size(6cm,0);

pair A=2expi(pi/2);

pair homography(pair z)
{
  return (z^2+A)/(z+2);
}

guide image;
pair tpt;

draw(unitcircle);
for(real t=0; t<length(unitcircle);t+=.05)
  {
    tpt=homography(point(unitcircle,t));
    image=image..tpt;
    draw(point(unitcircle,t)--tpt,dotted);
  }
draw(image..cycle,red);

đŸ”—generalities-fig162

Figure generalities 162 Generated with Asymptote

Show generalities/fig1630.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis

size(6cm,0);

path apath=(0,0)..(1,1)..(2,-1){dir(-90)};

draw(apath);

dot(apath);
dot(point(apath,length(apath)),.8green+8pt);
draw(point(apath,0)--point(apath,1)--point(apath,2),.8red);
draw(point(apath,0.5)--point(apath,1.5)--point(apath,2.5),.8blue);

đŸ”—generalities-fig163

Figure generalities 163 Generated with Asymptote

Show generalities/fig1640.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Path

size(8cm,0);

path apath=(0,0)..(1,1)..(2,.5){dir(0)};

draw(subpath(apath,0,length(apath)/2),1pt+.8red,EndPenMargin);
draw(subpath(apath,length(apath)/2,length(apath)),1pt+.8blue,BeginPenMargin);

đŸ”—generalities-fig164

Figure generalities 164 Generated with Asymptote

Show generalities/fig1650.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Path

size(10cm,0);
texpreamble("\usepackage{amsmath}");

path p = (0,0)..(1,1)..(2,.5){dir(0)};
real al    = arclength(p);
real l     = length(p);
pair pt    = point(p,l/2);
pair apt   = arcpoint(p,al/2);

draw(p);
draw(subpath(p,0,arctime(p,al/2)),blue);
dot(pt,red);
dot(apt,blue);

arrow("$\frac{\text{lenght(p)}}{2}$",pt,SSE,1cm);
arrow("$\frac{\text{arclenght(p)}}{2}$",apt,SSW,1cm);
label("\small The sizes of the blue path and the black path are equal",(1,.25));

đŸ”—generalities-fig165

Figure generalities 165 Generated with Asymptote

Show generalities/fig1660.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Path | #Length

size(10cm,0);

path apath=(0,0)..(1,1)..(2,.5){dir(0)};
real l=length(apath);
real step=l/15;

for(real i=0; i<l-step; i+=step)
  draw(subpath(apath,i,i+step),4bp+(i/l*red+(l-i)/l*blue),PenMargins);
draw(apath);

đŸ”—generalities-fig166

Figure generalities 166 Generated with Asymptote

Show generalities/fig1670.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Path | #Length | #Margin

size(10cm,0);

path apath=(0,0)..(1,1)..(2,.5){dir(0)};
real l=arclength(apath);
real step=l/15;

path arcpath(path apath, real t1, real t2)
{
  return subpath(apath, arctime(apath,t1), arctime(apath,t2));
}

for(real i=0; i<l-step; i+=step)
  draw(arcpath(apath,i,i+step),4bp+(i/l*red+(l-i)/l*blue),PenMargins);
draw(apath);

đŸ”—generalities-fig167

Figure generalities 167 Generated with Asymptote

Show generalities/fig1680.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Path | #Label | #Length

unitsize(5cm);

string text="A text along a curve";
path p=(0,0)..(1,1)..(2,0.5){dir(0)};
int n=length(text);
real at=0;
real step=arclength(p)/n;

for (int i=0; i<n; ++i){
  real t=arctime(p,at);
  label(rotate(degrees(angle(dir(p,t),false)))*scale(3)*baseline(substr(text,i,1)),point(p,t));
  at += step;
 }

draw(p,lightgrey);

đŸ”—generalities-fig168

Figure generalities 168 Generated with Asymptote

Show generalities/fig1690.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Path | #Length | #Label

import labelpath;

unitsize(5cm);
string text="\Huge A text along a curve";
path p=(0,0)..(1,1)..(2,0.5){dir(0)};

labelpath(text,p);
draw(p, lightgrey);

đŸ”—generalities-fig169

Figure generalities 169 Generated with Asymptote

Show generalities/fig1700.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Path

size(6cm,0);

path pth1=(0,-0.5)--(2,1);
path pth2=(0,0.5)--(2,-1);

draw(pth1^^pth2);

dot(intersectionpoint(pth1,pth2),red);

đŸ”—generalities-fig170

Figure generalities 170 Generated with Asymptote

Show generalities/fig1710.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Path

size(6cm,0);

path p = (0,0){up} .. (2cm,0){up};
path q = (0,1cm){dir(-60)}..(1cm,-1cm)..{dir(60)}(2cm,1cm);

draw(p^^q);
dot(intersectionpoint(p,q) , red);
dot(intersectionpoint(p,reverse(q)) , blue);

đŸ”—generalities-fig171

Figure generalities 171 Generated with Asymptote

Show generalities/fig1720.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Path

size(6cm,0);
import math;

pair A=(0,-.5), B=A+dir(45);
pair C=(0,1), D=C+5dir(20);

pair I=extension(A,B,C,D);

path AB=A--B;
path CD=C--D;

draw(AB^^CD);
dot("$I$",I,N,red);
draw(B--I,1pt+dotted);
dot("$A$",A,SE);
dot("$B$",B,SE);
dot("$C$",C,N);
dot("$D$",D,N);

đŸ”—generalities-fig172

Figure generalities 172 Generated with Asymptote

Show generalities/fig1730.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Path

size(6cm,0);
import math;

pair A=(0,-.5), B=A+dir(45);
pair C=(0,1)+2dir(20);
path cle=shift(C)*scale(1)*unitcircle;

pair I1=intersectionpoint(A--interp(A,B,2),cle);
pair I2=intersectionpoint(A--interp(A,B,10),cle);

path AB=A--B;

draw(AB^^cle);
dot(I1^^I2,red);
draw(B--I2,1pt+dotted);

đŸ”—generalities-fig173

Figure generalities 173 Generated with Asymptote

Show generalities/fig1740.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Path

size(6cm,0);

path Line(pair A, pair B)
{
  return interp(A,B,-100000/arclength(A--B))--interp(A,B,100000/arclength(A--B));
}

path Parallel(pair A, pair dir)
{
  return Line(A,A+dir);
}

pair A=0, B=(1,0), C=(.7,.7);
draw(A--B, .8red);
draw(A--C, .8green);
draw(B--C, .8blue);

label("$A$",A,SW);
label("$B$",B,SE);
label("$C$",C,N);

pair Ap=intersectionpoint(Parallel(B, A-C), Parallel(C, A-B));
pair Bp=intersectionpoint(Parallel(A, B-C), Parallel(C, A-B));
pair Cp=intersectionpoint(Parallel(A, B-C), Parallel(B, A-C));

draw(Ap--Bp, .8red);
draw(Ap--Cp, .8green);
draw(Bp--Cp, .8blue);

label("$A'$",Ap,NE);
label("$B'$",Bp,NW);
label("$C'$",Cp,S);

đŸ”—generalities-fig174

Figure generalities 174 Generated with Asymptote

Show generalities/fig1750.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Path | #Intersection

size(6cm,0);

path p = (0,0){up} .. (2cm,0){up};
path q = (0,1cm){dir(-60)}..(1cm,-1cm)..{dir(60)}(2cm,1cm);

draw(p, red);
draw(q, blue);
dot(intersectionpoint(p,q));
draw(point(p, intersect(p,q)[0])--postcontrol(p, intersect(p,q)[0]), .8red,Arrow);
draw(point(q, intersect(p,q)[1])--postcontrol(q, intersect(p,q)[1]), .8blue,Arrow);

đŸ”—generalities-fig175

Figure generalities 175 Generated with Asymptote

Show generalities/fig1760.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Graph | #Direction | #Path | #Fill/Unfill | #Shipout

import graph;
size(8cm,0);

path a = polargraph(new real(real t){return t;}, 0, 3pi, operator ..);
path b = polargraph(new real(real t){return 2t;}, 0, 3.75pi, operator ..);

real sharp=40;
path c=relpoint(a,1){relpoint(a,1)-postcontrol(a,length(a)-1)}..{dir(sharp)}relpoint(b,1);

fill(a..c..reverse(b)&cycle,0.8*red);
shipout(bbox(2mm, Fill(0.15*blue)));

đŸ”—generalities-fig176

Figure generalities 176 Generated with Asymptote

Show generalities/fig1770.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Circle | #Intersection | #Function creation

size(6cm,0);

import math;

pair A=(0,0), B=(1,.5);
path cle=shift(1.75,2.5)*unitcircle;
pair pt, ptp;

pair project(pair pt, pair A, pair B)
  {
    return extension(pt,pt-dir(90+degrees(A-B,false)),A,B);
  }

draw(A--B);
draw(cle);

for (real t=0; t<=4; t+=.01)
  {
    pt=point(cle,t);
    ptp=project(pt,A,B);
    dot(ptp, red);
    draw(pt--ptp,dotted);

  }

đŸ”—generalities-fig177

Figure generalities 177 Generated with Asymptote

Show generalities/fig1780.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Geometry | #Intersection

size(6cm,0);

import math;

pair A=(0,0), B=(1,.5), C=(.25,1);

pair project(pair pt, pair A, pair B)
  {
    return extension(pt,pt-dir(90+degrees(A-B,false)),A,B);
  }

pair ocenter(pair A, pair B, pair C)
  {
    return extension(A, project(A,B,C), B, project(B,A,C));
  }

draw(A--B--C--cycle);

pair orth=ocenter(A,B,C);
pair Ap=project(A,B,C);
pair Bp=project(B,A,C);
pair Cp=project(C,A,B);

dot(orth, red);
dot(Ap^^Bp^^Cp);
drawline(A, orth, dotted);
drawline(B, orth, dotted);
drawline(C, orth, dotted);

đŸ”—generalities-fig178

Figure generalities 178 Generated with Asymptote

Show generalities/fig1790.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Circle | #Geometry | #Intersection

size(6cm,0);

import math;

pair A=(0,0), B=(1,.5), C=(.25,1);

pair ccenter(pair A, pair B, pair C)
  {
    pair mAB=midpoint(A--B);
    pair mAC=midpoint(A--C);
    return extension(mAB, rotate(90,mAB)*A, mAC, rotate(90,mAC)*A);
  }

draw(A--B--C--cycle);

pair circ=ccenter(A,B,C);
pair mAB=midpoint(A--B);
pair mAC=midpoint(A--C);
pair mBC=midpoint(B--C);

dot(circ, red);
dot(mAB^^mAC^^mBC);
drawline(mAB, circ, dotted);
drawline(mAC, circ, dotted);
drawline(mBC, circ, dotted);
draw(shift(circ)*scale(abs(circ-A))*unitcircle);

đŸ”—generalities-fig179

Figure generalities 179 Generated with Asymptote

Show generalities/fig1800.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Circle | #Geometry | #Intersection

size(6cm,0);

import math;

pair A=(0,0), B=(1,.5), C=(.25,1);

pair project(pair pt, pair A, pair B)
  {
    return extension(pt,pt-dir(90+degrees(A-B,false)),A,B);
  }

pair icenter(pair A, pair B, pair C)
  {
    return extension(A, A+dir(A--B,A--C), B, B+dir(B--A,B--C));
  }

draw(A--B--C--cycle);

pair ins=icenter(A,B,C);
pair iAB=project(ins,A,B);
pair iAC=project(ins,A,C);
pair iBC=project(ins,B,C);

dot(ins, red);
dot(iAB^^iAC^^iBC);
drawline(A, ins, dotted);
drawline(B, ins, dotted);
drawline(C, ins, dotted);
draw(shift(ins)*scale(abs(ins-iAB))*unitcircle);

đŸ”—generalities-fig180

Figure generalities 180 Generated with Asymptote

Show generalities/fig1810.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Circle | #Geometry | #Intersection | #Function creation

size(6cm,0);
import math;

pair project(pair pt, pair A, pair B)
  {
    return extension(pt,pt-dir(90+degrees(A-B,false)),A,B);
  }


pair ecenter(pair A, pair B, pair C)
  {
    return extension(A, A+rotate(90)*dir(A--B,A--C), B, B+rotate(90)*dir(B--A,B--C));
  }

path ecircle(pair A, pair B, pair C)
  {
    return shift(ecenter(A,B,C))*scale(abs(ecenter(A,B,C)-project(ecenter(A,B,C),B,C)))*unitcircle;
  }

pair A=(0,0), B=(3,0), C=(3,4);
path tr=A--B--C--cycle;

draw(ecircle(A,B,C));
draw(ecircle(B,C,A));

pen p=linewidth(1pt);
drawline(A,B, p);
drawline(A,C, p);
drawline(B,C, p);

đŸ”—generalities-fig181

Figure generalities 181 Generated with Asymptote

Show generalities/fig1830.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Path

size(6cm,0);
defaultpen(2mm+linecap(0));

path p = (0,0){up} .. (2cm,0){up};
path q = (0,1cm){dir(-60)}..(1cm,-1cm)..{dir(60)}(2cm,1cm);


draw(firstcut(p,q).before, .8red);
draw(firstcut(p,q).after, .8blue);

draw(lastcut(q,p).before, .8green);
draw(lastcut(q,p).after, .8yellow);

đŸ”—generalities-fig182

Figure generalities 182 Generated with Asymptote

Show generalities/fig1840.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Path

size(6cm,0);

defaultpen(2mm+linecap(0));

path p = (0,0){up} .. (2cm,0){up};
path q = (0,1cm){dir(-60)}..(1cm,-1cm)..{dir(60)}(2cm,1cm);

real[] ipq=intersect(p,q);
real[] iprq=intersect(p,reverse(q));

draw(subpath(p, 0, ipq[0]), .8red);
draw(subpath(p, ipq[0], iprq[0]), .5red);
draw(subpath(p, iprq[0], length(p)), .3red);

draw(subpath(reverse(q), 0, iprq[1]), .8green);
draw(subpath(reverse(q), iprq[1], length(q)-ipq[1]), .5green);
draw(subpath(reverse(q), length(q)-ipq[1], length(q)), .3green);

đŸ”—generalities-fig183

Figure generalities 183 Generated with Asymptote

Show generalities/fig1850.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Path

size(0,0);

defaultpen(linewidth(1bp));
real u=4cm;
pair A, B, C, D, E;
path p, q, r;

A = u*up;
p = interp(A, rotate(72)*A, -.2) -- interp(A, rotate(72)*A,1.2);
for(int i=0; i<=5; ++i)
  draw(rotate(72i)*p);

B = midpoint(A--rotate(72)*A );
C = .8*B;

p = B --- C .. (rotate(2*72)*C){right};
// On allonge le chemin p
p = (point(p,0) - 4mm*dir(p,0.001))
  --
  point(p,0)
  & p &
  point(p,2)
  --
  (point(p,2) + 4mm*dir(p,2));

E = intersectionpoint(p, rotate(72)*p);
q = firstcut(p,shift(E)*scale(2mm)*unitcircle).before;
r = lastcut(p,shift(E)*scale(2mm)*unitcircle).after;

for(int i=0; i<=4; ++i)
  {
    draw(rotate(72i)*q);
    draw( rotate(72i)*r);
    draw(rotate(72i)*A,linewidth(4bp));
    draw(rotate(72i)*B,linewidth(4bp));
    draw(rotate(72i)*C,linewidth(4bp));
  }

đŸ”—generalities-fig184

Figure generalities 184 Generated with Asymptote

Show generalities/fig1860.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Venn diagram | #Path | #Array

// Venn diagram // Diagramme de Venn
// Edwards' construction // Construction d'Edwards
import roundedpath;
size(14cm,0);

path [] EdVenn(int n)
{
  path [] opath;
  if (n>=1)
    opath.push(shift(-1.4,-.9)*roundedpath(xscale(2.8)*yscale(.9)*unitsquare,.1));
  if (n>=2)
    opath.push(shift(0,-.9)*roundedpath(xscale(1.4)*yscale(1.8)*unitsquare,.1));
  if (n>=3)
    opath.push(scale(.5)*unitcircle);
  for (int i=1; i<=n-3; ++i)
    {
      pair pcle=point(opath[2],1/(2^i)),
        ccle=intersectionpoint(pcle--(pcle-dir(opath[2],1/(2^i))), (0,0)--(1,0));
      path cle=shift(ccle)*scale(abs(pcle-ccle))*unitcircle;
      real[] p1=intersect(cle, opath[2]);
      path ocle=subpath(cle,-p1[0],p1[0]);
      guide tpath;
      real step=360/(2^i), a=0;
      for (int j=0; j<2^i; ++j)
        {
          tpath=tpath..rotate(a)*ocle;
          a+=step;
        }
      opath.push(tpath..cycle);
    }
    return opath;
}

draw(EdVenn(6));

đŸ”—generalities-fig185

Figure generalities 185 Generated with Asymptote

Show generalities/fig1870.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Path | #Intersection

size(15cm,0);

srand(rand());
path p1 = randompath(9);
path p2 = randompath(8);
real Minx=min(min(p1).x,min(p2).x);
real Maxx=max(max(p1).x,max(p2).x);
real Miny=min(min(p1).y,min(p2).y);

pair[] inter=intersectionpoints(p1,p2);
int nb=inter.length;
for (int i=0 ; i<nb; ++i)
  {
    dot(inter[i]);
    label("$" + (string) i +"$", inter[i],N);
  }

draw(p1,.8red);
draw(p2,.8green);
label("I found " + (string) nb + " points of intersection.",((Maxx+Minx)/2,Miny),2S);

đŸ”—generalities-fig186

Figure generalities 186 Generated with Asymptote

Show generalities/fig1880.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Path | #Intersection

size(10cm,0);

pair[] self_intersection(path p, int n=100)
{
  pair[] rpair=new pair[];
  path tpath;
  real [] tpoint;
  real l=length(p);
  int i=1;
  for (real t1=0; t1<l ; t1+=l/n)
    {
      for (real t2=t1+2*l/n; t2<l; t2+=l/n)
        {
          tpoint=intersect(subpath(p,t1,t1+l/n),
                           subpath(p,t2,t2+l/n));
          if (tpoint.length == 2)
            {
              rpair[i]=point(subpath(p,t1,t1+l/n),tpoint[0]);
              ++i;
            }
        }
    }
  return rpair;
}

void dott(pair[] pt, pen p)
{
  for (int i=1 ; i<pt.length; ++i)
    {
      dot(pt[i], p);
    }
}

srand(rand());
path p = randompath(15);

pair[] inter=self_intersection(p);
dott(inter, .8red);
draw(p);

đŸ”—generalities-fig187

Figure generalities 187 Generated with Asymptote

Show generalities/fig1890.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Path | #Intersection | #Buildcycle | #Transform/scale/shift/rotate | #Circle

size(6cm,0);
path [] c;

c[1] = xscale(2)*unitcircle;
c[2] = shift((0,1))*c[1];
draw(c[1]^^c[2]);
draw(buildcycle(c[1],c[2]), .8red+4bp);

đŸ”—generalities-fig188

Figure generalities 188 Generated with Asymptote

Show generalities/fig1900.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Path | #Intersection | #Buildcycle | #Transform/scale/shift/rotate | #Array

size(8cm,0);

path a,b,c,d;
a = (-1,-.2){up} .. tension 1.2 .. (1,-.2){down};
transform r90=rotate(90);
b = r90*a;
c = r90*b;
d = r90*c;
path bound=buildcycle(a,b,c,d);
fill(bound, lightgrey);
draw(a^^b^^c^^d,grey);
draw(bound);

đŸ”—generalities-fig189

Figure generalities 189 Generated with Asymptote

Show generalities/fig1910.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Path | #Intersection | #Buildcycle | #Transform/scale/shift/rotate | #Circle | #Fill/Unfill

size(8cm,0);

path a,b,c;
a = shift(1,0)*scale(2)*unitcircle;
b = rotate(120)*a;
c = rotate(120)*b;

fill(a, red);
fill(b, green);
fill(c, blue);
fill(buildcycle(a,b), red + green);
fill(buildcycle(b,c), green + blue);
fill(buildcycle(c,a), blue + red);
fill(buildcycle(a,b,c), white);

draw(a^^b^^c);

đŸ”—generalities-fig190

Figure generalities 190 Generated with Asymptote

Show generalities/fig1920.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Path | #Circle | #Fill/Unfill

size(0,0);

path pt1=scale(2cm)*unitcircle;
path pt2=scale(1cm)*unitcircle;

filldraw(pt1^^pt2,yellow+.9white);

đŸ”—generalities-fig191

Figure generalities 191 Generated with Asymptote

Show generalities/fig1930.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Path | #Intersection | #Transform/scale/shift/rotate | #Circle

size(0,0);

path pt1=scale(2cm)*unitcircle;
path pt2=scale(1cm)*unitcircle;

filldraw(pt1^^pt2,evenodd+yellow+.9white);

đŸ”—generalities-fig192

Figure generalities 192 Generated with Asymptote

Show generalities/fig1940.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Path | #Intersection | #Transform/scale/shift/rotate | #Circle

size(0,0);

path pt1=scale(2cm)*unitcircle;
path pt2=scale(1cm)*unitcircle;
path pt3=shift(0,.5cm)*pt2;

filldraw(pt1^^pt2^^pt3,evenodd+yellow+.9white);

đŸ”—generalities-fig193

Figure generalities 193 Generated with Asymptote

Show generalities/fig1950.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Path | #Intersection | #Transform/scale/shift/rotate | #Circle

size(0,0);

path pt1=scale(2cm)*unitcircle;
path pt2=scale(1cm)*unitcircle;
path pt3=shift(0,1.5cm)*pt2;

filldraw(pt1^^pt2^^pt3,evenodd+yellow+.9white);

đŸ”—generalities-fig194

Figure generalities 194 Generated with Asymptote

Show generalities/fig1960.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Atexit

size(6cm); 
 
void extra() 
{ 
  label("Read the code to understand...",(0,0),white);
  plain.exitfunction(); 
} 

atexit(extra); 
fill(xscale(2)*unitcircle); 

đŸ”—generalities-fig195

Figure generalities 195 Generated with Asymptote

Show generalities/fig1970.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Basis | #Pattern

size(8cm,0);
import patterns;

add("hatchback",hatch(NW));
filldraw(xscale(2)*unitsquare,pattern("hatchback"));

add("r_hatchback",hatch(2.5mm,NW,.8red));
filldraw(shift(0,-2)*yscale(2)*unitsquare,pattern("r_hatchback"));

add("b_hatchback",hatch(NW,2.5mm+.8blue));
filldraw(shift(1,-2)*yscale(2)*unitsquare,pattern("b_hatchback"));

đŸ”—generalities-fig196

Figure generalities 196 Generated with Asymptote

Show generalities/fig1980.asy on Github.
Generated with Asymptote 3.00-0.
Categories : Examples 2D | Generalities
Tags : #Label | #Object | #Picture

void enclose(picture pic=currentpicture, envelope e,
             Label[] L=new Label[],
             real xmargin=0, real ymargin=xmargin, pen p=currentpen,
             filltype filltype=NoFill, bool above=true)
{

  real H;
  real[] h;
  pic.add(new void (frame f, transform t) {
      frame[] d=new frame[];
      for (int i=0; i<L.length; ++i) {
        d[i]=newframe;
        Label LL=L[i].copy();
        add(d[i],t,LL);
        add(f,d[i]);
        h[i]=ypart(max(d[i])-min(d[i]));
        if(H < h[i]) H=h[i];
      }
      for (int i=0; i<L.length; ++i) {
        real emy=(H-h[i])/2;
        e(f,d[i],xmargin,ymargin+emy,p,filltype,above);
      }
    });
}

void box(picture pic=currentpicture, Label[] L=new Label[],
         real xmargin=0, real ymargin=xmargin, pen p=currentpen,
         filltype filltype=NoFill, bool above=true)
{
  enclose(pic,box,L,xmargin,ymargin,p,filltype,above);
}

box(new Label[] {
    Label("\begin{minipage}{3cm}Some text some text some text.\end{minipage}",(2.2cm,0)),
    Label("Hello.",0),
    Label("\begin{minipage}{3cm}Some text some text some
text some text some text some text some text.\end{minipage}",(5.4cm,0)),
    Label("Bye.\rule{0pt}{1.5cm}",(1cm,-3cm))
      });

0%