summaryrefslogtreecommitdiff
path: root/info/mathtrip/src/triangle.tex
blob: f663a1263b55091de0575b91a25c97195fb5aabd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
%This document can be run standalone if few comments
%are removed. This is useful to check and modify the drawing.
%
%\documentclass{article}
%\usepackage{calc}
%\usepackage{tikz}
%\usetikzlibrary{arrows,decorations.markings}
%\begin{document}

%length of the base of triangle.
%\newlength{\trianglebase}
%and its height
%\newlength{\triangleheight}
%Length of the mark for the right angle
%\newlength{\ranglesizeB}
%
\setlength{\trianglebase}{2cm}
\setlength{\triangleheight}{1.5cm}
\setlength{\ranglesizeB}{0.15cm}

\savebox\TriangleBox{%
   \begin{tikzpicture}
      %Coordinates of the triangle
      \coordinate (A) at (0,0);
      \coordinate (B) at (\trianglebase,0);
      \coordinate (C) at (.167\trianglebase,\triangleheight);
      \coordinate (HeightBase) at (.167\trianglebase,0);
      %
      %Triangle with origin in (0,0) and a height of \triangleheight
      %arriving at point "HeightBase".
      \draw [thick] (A) -- (C) node[midway,left] {$b$}
                -- (B) node[midway,above] {$a$}
                -- cycle node[midway,below] {$c$};  
      %Draw the height
      \draw (HeightBase) -- (C) node[midway,right]{$h$};
                                         
      %Draw the right angle symbol
      \draw (HeightBase) -- ++ (0, \ranglesizeB) -- ++ (\ranglesizeB, 0) -- ++(0,-\ranglesizeB) -- cycle;

      %Put a letter for the angle.
      \draw (A) node[below,left]{$A$};
      \draw (B) node[below,right]{$B$};
      \draw (C) node[above]{$C$};
   \end{tikzpicture}
}
%\end{document}