I'm trying to come up with a way to draw "parametric" right triangles, meaning that I change the length of the hypotenuse \hypo
and one of the internal angles \alfa
and it should draw the triangle for me. So far I have done this
\documentclass[border=1mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc, angles, intersections}
\begin{document}
\begin{tikzpicture}
\def\alfa{55}
\def\hypo{3}
\draw[name path= A-C] (0,0) node[below left] (A) {A} -- (90-\alfa:3);
\draw (0,0) -- (\hypo,0) node[below right] (B) {B} -- ++ (180-\alfa:3);
\path[name path= B-C] (\hypo,0) -- ++ (180-\alfa:3);
\node [name intersections={of= A-C and B-C}, above] at (intersection-1) {C};
\end{tikzpicture}
\end{document}
I can't figure out how to trim the two catheti at at their intersection.
On top of that I don't think it's a good idea to hard-code their length (here 3 units). I did it because if they are too short, then they don't intersect and Tikz can't find the intersection. It would be better to let LaTeX (or Tikz) figure out the correct length to get to the intersection and not passed it. I've tried to look for a solution in the manual and online, but I can't find anything really helpful. Any idea how to do this?