|
\documentclass[tikz, border=2pt]{standalone}
|
|
\usetikzlibrary{calc}
|
|
\usetikzlibrary{math}
|
|
\begin{document}
|
|
\begin{tikzpicture}[line width=1pt]
|
|
\tikzmath{
|
|
\a = 13; \b = 19; \c = sqrt(\a*\a + \b*\b);
|
|
\l = 5;
|
|
\A = acos(\b / \c);
|
|
\B = acos(\a / \c);
|
|
}
|
|
\def\template#1; {
|
|
\draw #1 rectangle ++(\l, \l);
|
|
\draw[rounded corners=0.01mm] #1 ++(\l, \l) -- +(180-\A:\b/\c*\l) -- +(-\l, 0) -- cycle;
|
|
\draw[rotate around={\B:($#1 + (0, \l)$)}] ($#1 + (0, \l)$) rectangle +(\a/\c*\l, \a/\c*\l);
|
|
\draw[rotate around={90-\A:($#1 + (\l, \l)$)}] ($#1 + (\l, \l)$) rectangle +(\b/\c*\l, \b/\c*\l);
|
|
}
|
|
|
|
\template{(0, 0)};
|
|
\coordinate (O1) at (0, 0);
|
|
\coordinate (A1) at ($(O1)+(0, \l)$);
|
|
\coordinate (B1) at ($(O1)+(\l, \l)$);
|
|
\filldraw[rotate around={\B:(A1)}, fill=gray, draw=black] (A1) rectangle +(\a/\c*\l, \a/\c*\l);
|
|
\filldraw[rotate around={90-\A:(B1)}, fill=gray, draw=black] (B1) rectangle +(\b/\c*\l, \b/\c*\l);
|
|
|
|
\def\trans#1#2#3; {
|
|
\coordinate (O) at #1;
|
|
\coordinate (A) at ($({180-\A}:{(\a+\b)/\c*\l}) + (O) + (\l, \l)$);
|
|
\coordinate (B) at ($(\B:{(\a+\b)/\c*\l}) + (O) + (0, \l)$);
|
|
\coordinate (C) at ($(\B:{\b/\c*\l}) + (A)$);
|
|
\coordinate (D) at ($(-\A:{\a/\c*\l}) + (A)$);
|
|
\draw[dashed, rounded corners=0.01mm] (A) -- (C) -- (B);
|
|
\filldraw[fill=gray, draw=black, rounded corners=0.01mm] ($(O) + (0, \l)$) -- (D) -- ($(\B:{#2*\b/\c*\l}) + (A)$) -- ($({\B-180}:{(\a-#2*\b)/\c*\l}) + (A)$) -- cycle;
|
|
\filldraw[fill=gray, draw=black, rounded corners=0.01mm] ($(O) + (\l, \l)$) -- (D) -- ($({180-\A}:{#3*\a/\c*\l}) + (B)$) -- ($({-\A}:{(\b-#3*\a)/\c*\l}) + (B)$) -- cycle;
|
|
}
|
|
|
|
\trans{(10, 0)}{0.4}{0.6};
|
|
\template{(10, 0)};
|
|
|
|
\trans{(20, 0)}{1}{1};
|
|
\template{(20, 0)};
|
|
|
|
\coordinate (O4) at (5, -12);
|
|
\coordinate (A4) at ($(\B:{\a/\c*\l}) + (O4)$);
|
|
\filldraw[fill=gray, draw=black, rounded corners=0.01mm] (O4) -- (A4) -- ($(O4) + (\l, 0)$) -- ++(0, \l) -- ($(A4) + (0, \l)$) -- ($(O4) + (0, \l)$) -- cycle;
|
|
\template{(5, -12)};
|
|
|
|
\coordinate (O5) at (15, -12);
|
|
\filldraw[fill=gray, draw=black] (O5) rectangle +(5, 5);
|
|
\template{(15, -12)};
|
|
\end{tikzpicture}
|
|
\end{document}
|