# How to draw 2 similar triangles sharing a vertex using tikz?

Something like the picture below:

-
Have you drawn atleast one triangle? Then put it in a scope and rotate. You may also use rotate around. – Harish Kumar Aug 2 '14 at 23:51

One option:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{angles}

\newcommand\MyTri[3]{
% fill the triangle
\fill[gray!30]
(0,0) coordinate (0) --
(4,0) coordinate (1) --
(5,2) coordinate (a) -- cycle;
;
% draw the marks for the angles
\path
% draw the triangle
\path[draw]
(0) node[below left] {$#1$} --
(1) node[below right] {$#2$} --
(a) node[right] {$#3$} --
cycle
;
\foreach \Coor in {0,1,a}
\node[circle,draw,fill=white,inner sep=1.5pt] at (\Coor) {};
}

\begin{document}

\begin{tikzpicture}
\MyTri{0}{1}{a}
\begin{scope}[rotate=45,scale=0.8]
\MyTri{0}{b}{ab}
\end{scope}
\end{tikzpicture}

\end{document}


-

Here's an approach that doesn't use scoping.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}

\makeatletter
\newcommand\myanglebetween{\my@anglebetween}
\def\my@anglebetween(#1)(#2)and(#3)(#4)#5{%%
\pgfmathanglebetweenlines{\pgfpointanchor{#1}{center}}{\pgfpointanchor{#2}{center}}
{\pgfpointanchor{#3}{center}}{\pgfpointanchor{#4}{center}}
\edef#5{\pgfmathresult}}

\newcommand\myveclen{\my@veclen}
\def\my@veclen(#1)(#2)#3{%%
\pgfpointdiff{\pgfpointanchor{#1}{center}}{\pgfpointanchor{#2}{center}}
\edef\ae@pt@x{\pgf@x}
\edef\ae@pt@y{\pgf@y}
\pgfmathveclen{\ae@pt@x}{\ae@pt@y}
\edef#3{\pgfmathresult}}

\makeatother

\begin{document}

\def\mydistb{6cm}

\begin{tikzpicture}

\coordinate (A) at (0,0);
\coordinate (B) at (3,1);
\coordinate (C) at (5,4);

\draw (A) -- (B) -- (C) -- cycle;

%% measure of the angle CAB
\myanglebetween(A)(B)and(A)(C)\anglea

%% the length to "AB"
\myveclen(A)(B)\mylenAB

%% the length to "AC"
\myveclen(A)(C)\mylenAC

%% scale factor
\pgfmathparse{\mydistb/\mylenAB}
\edef\myscalefactor{\pgfmathresult}

\coordinate (B')  at ($(A)+(80:\mydistb)$);
\coordinate (C')  at ($(A)!\myscalefactor*\mylenAC pt!\anglea:(B')$);

\draw (A) -- (B') -- (C') -- cycle;

\end{tikzpicture}

\end{document}


-