triangle-angles.tex 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. \documentclass{article}
  2. \usepackage[pdftex,active,tightpage]{preview}
  3. \setlength\PreviewBorder{2mm}
  4. \usepackage{tikz}
  5. \usetikzlibrary{shapes, calc, shapes, decorations}
  6. \usepackage{amsmath,amssymb}
  7. \begin{document}
  8. \begin{preview}
  9. \begin{tikzpicture}[thick]
  10. \newcommand\XC{4}
  11. \newcommand\ALPHA{30}
  12. \newcommand\XB{{(\XC*(cos(\ALPHA)*cos(\ALPHA) - sin(\ALPHA)*sin(\ALPHA)) + \XC)*0.5}}
  13. \newcommand\YB{{sqrt(cos(\ALPHA)*\XC*cos(\ALPHA)*\XC - (\XC*(cos(\ALPHA)*cos(\ALPHA) - sin(\ALPHA)*sin(\ALPHA)) + \XC)*0.5*(\XC*(cos(\ALPHA)*cos(\ALPHA) - sin(\ALPHA)*sin(\ALPHA)) + \XC)*0.5)}}
  14. \newcommand\XBo{{(\XB)+4}}
  15. \newcommand\YBo{{\YB}}
  16. \newcommand\XBp{{\XB*0.5}}
  17. \newcommand\YBp{{\YB*0.5}}
  18. % Draw the triangle
  19. \draw[fill=gray!10] (0, 0) coordinate (A)
  20. -- (\XB,\YB) coordinate (C)
  21. -- (\XC, 0) coordinate (B)
  22. -- (0, 0) -- cycle;
  23. % Draw nodes
  24. \node at (A)[anchor=north] {A};
  25. \node at (B)[anchor=north] {B};
  26. \node at (C)[anchor=south] {C};
  27. % Draw edge text
  28. \node (c) at ($(A)!0.5!(B)$) [below] {c};
  29. \node (b) at ($(A)!0.5!(C)$) [above] {b};
  30. \node (a) at ($(B)!0.6!(C)$) [right] {a};
  31. % draw alpha
  32. \draw[fill=blue!30] (0,0) -- (0:0.75cm) arc (0:\ALPHA:.75cm);
  33. \coordinate[label=right:$\alpha$] (Alpha) at (0.25,0.15);
  34. % draw beta
  35. \begin{scope}[shift={(\XC, 0)}]
  36. \draw[fill=green!30] (0,0) -- (-180:0.50cm) arc (180:{180-(90-\ALPHA)}:0.5cm);
  37. \draw (150:0.35cm) node {$\beta$};
  38. \end{scope}
  39. % draw gamma
  40. \begin{scope}[shift={(\XB, \YB)}]
  41. \draw[fill=red!30] (0,0) -- ({180+\ALPHA}:0.5cm) arc ({180+\ALPHA}:{180+\ALPHA+90}:0.5cm);
  42. \draw (-0.1, -0.05) node[below] {$\gamma$};
  43. \end{scope}
  44. % shifted alpha
  45. \begin{scope}[shift={(4,0)}]
  46. \path[fill=blue!30] (0,0) -- (0:0.5cm) arc (0:\ALPHA:.5cm);
  47. \draw (0:0.5cm) arc (0:\ALPHA:.5cm);
  48. \end{scope}
  49. % shifted gamma
  50. \begin{scope}[shift={(4, 0)},rotate=180]
  51. \path[fill=red!30] (0,0) -- ({180+\ALPHA}:0.5cm) arc ({180+\ALPHA}:{180+\ALPHA+90}:0.5cm);
  52. \draw ({180+\ALPHA}:0.5cm) arc ({180+\ALPHA}:{180+\ALPHA+90}:0.5cm);
  53. \end{scope}
  54. \begin{scope}[shift={(3.13,-0.5)}]
  55. \draw[dashed, red] (0, 0) -- (\XB,\YB);
  56. \end{scope}
  57. \draw[dashed, color=red] (-1, 0) -- (6, 0);
  58. \draw (0, 0) coordinate (X)
  59. -- (\XB,\YB) coordinate (Y)
  60. -- (\XC, 0) coordinate (Z)
  61. -- (0, 0);
  62. \end{tikzpicture}
  63. \end{preview}
  64. \end{document}