What's the simplest way to draw an triangle (not as a node!) with tikz with a given side and two given angles?
[Tex/LaTex] Simple way to draw a triangle with one side and two angles given
tikz-pgf
Related Solutions
[Tex/LaTex] Labeling sides and angles of a right triangle for an argument of the Pythagorean Theorem
Here's one possibility using "pure" TikZ:
The image was produced using simply
\begin{tikzpicture}
\RectTri{(0,3)}{(1,0)}{6cm}
\begin{scope}[xshift=8.5cm]
\RectTri[black]{(0,0)}{(4,2)}{4cm}
\end{scope}
\end{tikzpicture}
\RectTri
has three mandatory arguments; the first two are the coordinates for the vertices of one of the legs and the third one is the length of the second leg. The optional argument lets you customize the style used to draw the triangle.
The code:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc,angles,quotes,decorations.markings}
\newcommand\RectTri[4][thick,green!50!black,text=black]{%
\coordinate [label=left:$C$] (C) at #2;
\coordinate [label=below right:$B$] (B) at #3;
\coordinate (aux) at ($ #2 ! 1 ! 90:#3 $);
\coordinate [label=above:$A$] (A) at ($ #2 !#4!(aux) $);
\coordinate (perp) at ($(A)!(C)!(B)$);
\draw[purple!70!black,thick,dashed] (C) -- (perp);
\draw[#1]
(C) --
node[auto] {$b$} (A) --
node[auto] {$c$} (B) --
node[auto] {$a$}
(C)
pic ["$\alpha$",draw,cyan,thick,angle radius=1cm] {angle = C--A--B}
pic ["$\alpha$",draw,cyan,thick,angle radius=1cm] {angle = B--C--perp}
pic ["$\beta$",draw,orange!70!black,thick,angle radius=1cm] {angle = A--B--C}
pic ["$\beta$",draw,orange!70!black,thick,angle radius=1cm] {angle = perp--C--A};
}
\begin{document}
\begin{tikzpicture}
\RectTri{(0,3)}{(1,0)}{6cm}
\begin{scope}[xshift=8.5cm]
\RectTri[black]{(0,0)}{(4,2)}{4cm}
\end{scope}
\end{tikzpicture}
\end{document}
And here's an approach using tkz-euclide
:
\documentclass{article}
\usepackage{tkz-euclide}
\usetkzobj{all}
\begin{document}
\begin{tikzpicture}
\tkzDefPoint(0,1){A}
\tkzDefPoint(2,4){C}
\tkzDefPointWith[orthogonal normed,K=7](C,A)
\tkzGetPoint{B}
\tkzLabelPoint[left](A){$A$}
\tkzLabelPoint[right](B){$B$}
\tkzLabelPoint[above](C){$C$}
\tkzMarkRightAngle(A,C,B)
\tkzDrawSegment[green!60!black](A,C)
\tkzDrawSegment[green!60!black](C,B)
\tkzDrawSegment[green!60!black](B,A)
\tkzLabelSegment[auto](B,A){$c$}
\tkzLabelSegment[auto,swap](B,C){$a$}
\tkzLabelSegment[auto,swap](C,A){$b$}
\tkzDrawAltitude[dashed,color=magenta](A,B)(C)
\tkzGetPoint{D}
\tkzMarkAngle[size=1cm,color=cyan,mark=|](C,B,A)
\tkzMarkAngle[size=1cm,color=cyan,mark=|](A,C,D)
\tkzMarkAngle[size=0.75cm,color=orange,mark=||](D,C,B)
\tkzMarkAngle[size=0.75cm,color=orange,mark=||](B,A,C)
\end{tikzpicture}
\end{document}
I'll left to you understand the code but next is a possible solution based in Paul Gaborit's example
%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Author : Paul Gaborit (2009)
% under Creative Commons attribution license.
% Title : Pascal's triangle and Sierpinski triangle
% Note : 17 lines maximum
\documentclass[border=2mm, tikz]{standalone}
%\usepackage[landscape,margin=1cm]{geometry}
%\pagestyle{empty}
%\usepackage[T1]{fontenc}
%\usepackage{lmodern}
\usepackage{tikz}
\usetikzlibrary{positioning,shadows,backgrounds,shapes.geometric}
\begin{document}
\centering
%
% x=\sqrt{3/4}*minimum size
% y=3/4*minimum size
%
\begin{tikzpicture}[y=7.5mm,x=8.66mm]
% some colors
\colorlet{even}{cyan!60!black}
\colorlet{odd}{orange!100!black}
\colorlet{links}{red!70!black}
\colorlet{back}{yellow!20!white}
% some styles
\tikzset{
box/.style={
regular polygon,
regular polygon sides=6,
minimum size=10mm,
inner sep=0mm,
outer sep=0mm,
text centered,
font=\small\bfseries\sffamily,
text=#1!50!black,
draw=#1,
line width=.25mm,
rotate=30,
},
link/.style={black, shorten >=2mm, shorten <=2mm, line width=1mm},
}
% Pascal's triangle
% row #0 => value is 1
\node[box=even] (p-0-0) at (0,0) {\rotatebox{-30}{1}};
\foreach \row in {1,...,11} {
% col #0 => value is 1
\node[box=even] (p-\row-0) at (-\row/2,-\row) {\rotatebox{-30}{1}};
\pgfmathsetmacro{\myvalue}{1};
\foreach \col in {1,...,\row} {
% iterative formula : val = precval * (row-col+1)/col
% (+ 0.5 to bypass rounding errors)
\pgfmathtruncatemacro{\myvalue}{\myvalue*((\row-\col+1)/\col)+0.5};
\global\let\myvalue=\myvalue
% position of each value
\coordinate (pos) at (-\row/2+\col,-\row);
% odd color for odd value and even color for even value
\pgfmathtruncatemacro{\rest}{mod(\myvalue,2)}
\node[box=even] (p-\row-\col) at (pos) {\rotatebox{-30}{\myvalue}};
}
}
\begin{pgfonlayer}{background}
\foreach \i/\j in {4/1,5/1,5/2,6/2,7/6,8/6,8/7,9/7}
\node[box=even,fill=odd] at (p-\i-\j) {};
\end{pgfonlayer}
\draw[link] (p-4-1.center)--(p-6-2.center);
\draw[link] (p-5-1.center)--(p-5-2.center);
\draw[link] (p-7-6.center)--(p-9-7.center);
\draw[link] (p-8-6.center)--(p-8-7.center);
\node[right=5mm of p-8-8.center, align=left] {$(36-7)+(28-8)=49$};
\node[left=5mm of p-5-0.center, align=right] {$(15-4)+(10-5)=16$};
\end{tikzpicture}
\end{document}
(19/11/18) Code updated to avoid problems mentioned in Problem with Pascal triangle example
Best Answer
Got an example by googling Solving ASA triangles .