CODE
\usepackage{tikz}
\usepackage{tikz}
\begin{tikzpicture}
*The code goes here*
\end{tikzpicture}
\draw (0,0) -- (3,3);
We can draw multiples lines by adding coordinates, for example with this code:
\draw (0,0) -- (1,1) -- (2,0) -- (3,1) -- (4,0) -- (5,1) -- (6,0);
Using the extention -- cycle will close the figure by drawing a line from the last coordinate
to the first one, so for example to draw a triangle we can write:
\draw (0,0) -- (3,0) -- (3,3) -- cycle;
Latex has also some predefine figure, so for drawing a rectangle we don't need to draw every
single line, but we just have to set the left down corner and the right upper one:
\draw (0,0) rectangle (5,3);
We can also draw curve lines:
\draw (0,0) parabola (4,3);
Arcs are another possibility, in the final parentesis we add first the starting angle,
then the ending angle and finally the radius:
\draw (0,0) arc (30:120:4cm);
Multiples figure can be combine to create more complex images, for example:
\draw (0,0) ellipse (3cm and 0.5cm);
\draw (0,0) circle (3cm);
\draw (0,-0.5) -- (0,0.5);
\draw (-3,0) -- (3,0);
With the information on this page now we ca draw many figures, now try
to reproduce the following figure:
For the solution move te mouse over the black box on the right.
\draw (0,0) -- (4,0);
\draw (0,0) arc (180:90:2cm);
\draw (2,2) -- (4,2);
\draw (4,0) -- (4,2);