I'm writing a paper on billiards, and would like to draw the following figures myself. Are there any good packages that can render them?

I've heard that asymptote might be a good choice, but am not familiar with how to draw things there at all.

enter image description here enter image description here


2 Answers 2


Metapost is also good for this type of diagram. Here's a version of the left-hand diagram that shows you how to do tangents and angle marks neatly.


  vardef mark(expr p,q,r,s) =
     s*right rotated angle (p-q) shifted q {up rotated angle(p-q)} ..
     s*right rotated angle (r-q) shifted q {up rotated angle(r-q)}


% define the circle
path C;
C = fullcircle scaled 200;

% ... and the two points (everything else is defined relative to these two)
numeric t[]; t0 = 3.6; t1 = 6.3;
z0 = point t0 of C;
z1 = point t1 of C;

% draw the radiuses and the circle
draw origin -- z0 dashed evenly;
draw origin -- z1 dashed evenly;
draw C withcolor .637 red;

% draw the tangents
z2 = direction t0 of C;
z3 = direction t1 of C;
draw (z0-3z2) -- (z0+3z2);
draw (z1-3z3) -- (z1+3z3);

% define the other points and draw some arrows
z5 = .5[z0,z1];
z6 = 1.3[z0,z1];
z7 = z6 reflectedabout(z1,z1-z3);
drawarrow z0--z5; draw z5--z6; drawarrow z1--z7;

% define, draw and label the angle marks
path m[];
m2 = mark(z0,origin,z1,18); draw m2 dashed evenly; label.llft(btex $\gamma$ etex, point .6 of m2);
m0 = mark(z0+z2,z0,z1,15) ; draw m0 dashed evenly; label.bot (btex $\alpha_0$ etex, point.5 of m0); 
m1 = mark(z6,z1,z1+z3,15) ; draw m1 dashed evenly; label.rt  (btex $\alpha_1=\alpha_0$ etex, point.5 of m1); 

% add the equation
label.llft(btex $\theta_1 = \theta_0 + \gamma$ etex,point (t0+t1)/2 of C);

% and finally the dot labels, including the anonymous one for the origin
fill fullcircle scaled 3;
dotlabel.lft(btex $\theta_0$ etex,z0);
dotlabel.bot(btex $\theta_1$ etex,z1);


enter image description here


You can create using http://www.geogebra.org and export to PGF/Tikz

Here is the code generated by Geogebra for your first example, took a couple of mn to do it with the web interface and I am not a specialist of the software.

\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm]
\clip(-6.54,-11.98) rectangle (17.78,3.7);
\draw [shift={(0,0)},color=ttzzqq,fill=ttzzqq,fill opacity=0.1] (0,0) -- (167.74:0.6) arc (167.74:275.22:0.6) -- cycle;
\draw [shift={(-65.42,14.21)},color=qqwuqq,fill=qqwuqq,fill opacity=0.1] (0,0) -- (-102.26:0.6) arc (-102.26:-48.52:0.6) -- cycle;
\draw [shift={(4.36,-47.67)},color=qqwuqq,fill=qqwuqq,fill opacity=0.1] (0,0) -- (-48.52:0.6) arc (-48.52:5.22:0.6) -- cycle;
\draw(0,0) circle (3cm);
\draw [dash pattern=on 2pt off 2pt] (-2.93,0.64)-- (0,0);
\draw [dash pattern=on 2pt off 2pt] (0,0)-- (0.27,-2.99);
\draw [->] (0.27,-2.99) -- (1.16,-2.26);
\draw (-3.5,0.98) node[anchor=north west] {$θ_0$};
\draw (-2.93,0.64)-- (0.27,-2.99);
\draw (-1.26,-1.25) -- (-1.43,-1.26);
\draw (-1.26,-1.25) -- (-1.23,-1.09);
\draw (3.76,-2.67)-- (-2.56,-3.25);
\draw (-2.34,3.36)-- (-3.55,-2.23);
\draw (-2.93,0.64)-- (1.71,-4.61);
\draw[color=ttzzqq] (0.16,-0.18) node {$\gamma$};
\draw[color=qqwuqq] (-2.4,0.34) node {$\alpha_1$};
\draw[color=qqwuqq] (0.92,-3.06) node {$\alpha$};

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .