9

What's the simplest way to draw an triangle (not as a node!) with tikz with a given side and two given angles?

  • Interesting, but how about the orientation of triangle in the plane? Should we assume the given edge is parallel to page borders? – Pouya Apr 24 '14 at 13:34
  • I think you may assume this, because one can easily rotate the result via scope... – student Apr 24 '14 at 13:36
  • Two or three angles? :) – percusse Apr 24 '14 at 13:47
  • @percusse, obviously two would suffice. [edit: oops! didn't see the :) face at the end of your comment...] – Pouya Apr 24 '14 at 13:48
13

Got an example by googling Solving ASA triangles .

\documentclass[tikz]{standalone}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}
% Given
\def\myside{9}
\def\myanga{76}
\def\myangb{34}
%===============
\draw (0,0) -- (0:\myside)
     let \n1={(180-(\myanga+\myangb))},
         \n2={(\myside*(sin(\myanga)/sin(\n1))} in
     -- (\myangb:\n2) -- cycle node{\n1,\n2};
\end{tikzpicture}
\end{document}

enter image description here

  • 3
    Damn you're faster than superman :) – Trefex Apr 24 '14 at 14:08
5

Not as simple as percusse's answer but easy to understand.

\documentclass[tikz, border=2mm]{standalone}
\usetikzlibrary{intersections, angles, quotes}

\begin{document}
\begin{tikzpicture}
\draw coordinate[label=below:a] (a) --++(0:4cm) coordinate[label=below:b] (b);

\path[name path=ac] (a)--++(30:3cm);
\path[name path=bc] (b)--++(180-37:3cm);

\path [name intersections={of = ac and bc, by=c}];

\node[above] at (c) {c};

\draw[use as bounding box] (a)--(b)--(c)--cycle%
     pic[draw, "$30^\circ$", angle eccentricity=1.6] {angle=b--a--c}
    pic[draw, "$37^\circ$", angle eccentricity=1.6] {angle=c--b--a};
\end{tikzpicture}
\end{document}

enter image description here

4

It is too long as a comment but too short for typing exercise.

\documentclass[pstricks,border=24pt]{standalone}
\usepackage{pst-eucl}

\newpsstyle{nolabel}{PointName=none,PointSymbol=none}

\begin{document}
\begin{pspicture}(8,3)
    \pstGeonode[PosAngle=-90]{A}(8,0){B}
    \pstRotation[style=nolabel,RotAngle=30]{A}{B}
    \pstRotation[style=nolabel,RotAngle=-37]{B}{A}
    \pstInterLL[PosAngle=90]{A}{B'}{B}{A'}{C}
    \pspolygon(A)(B)(C)
    \psset{MarkAngleRadius=1.5}
    \pstMarkAngle{B}{A}{C}{$30^\circ$}
    \pstMarkAngle{C}{B}{A}{$37^\circ$}
\end{pspicture}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.