|
\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);
|
|
\A = acos(\b / \c);
|
|
\B = acos(\a / \c);
|
|
\l = 5;
|
|
\a = \a / \c * \l;
|
|
\b = \b / \c * \l;
|
|
\c = \l;
|
|
}
|
|
\def\template#1; {
|
|
\draw #1 rectangle ++(\l, \l);
|
|
\draw[rounded corners=0.01mm] #1 ++(\l, \l) -- +(180-\A:\b) -- +(-\l, 0) -- cycle;
|
|
\draw[rotate around={\B:($#1 + (0, \l)$)}] ($#1 + (0, \l)$) rectangle +(\a, \a);
|
|
\draw[rotate around={90-\A:($#1 + (\l, \l)$)}] ($#1 + (\l, \l)$) rectangle +(\b, \b);
|
|
}
|
|
|
|
\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, \a);
|
|
|
|
\coordinate (C) at ($(B1)+({45+\B}:{sqrt(2)/2*\b})$);
|
|
\coordinate (P1) at ($(C)+(-0.5*\c, 0)$);
|
|
\coordinate (P2) at ($(C)+(0.5*\c, 0)$);
|
|
\coordinate (P3) at ($(C)+(0, 0.5*\c)$);
|
|
\coordinate (P4) at ($(C)+(0, -0.5*\c)$);
|
|
\fill[lightgray] (P1) -- ($(B1)+({\B+90}:\b)$) -- (P4) -- (C) -- cycle;
|
|
\fill[lightgray] (P2) -- ($(B1)+(\B:\b)$) -- (P3) -- (C) -- cycle;
|
|
\fill[gray!80] (P3) -- ($(B1)+({\B+45}:{sqrt(2)*\b})$) -- (P1) -- (C) -- cycle;
|
|
\fill[gray!80] (P4) -- (B1) -- (P2) -- (C) -- cycle;
|
|
\draw (P1) -- (P2);
|
|
\draw (P3) -- (P4);
|
|
|
|
\filldraw[fill=lightgray, transform canvas={shift={($(B1)-(C)$)}}] (P1) -- ($(B1)+({\B+90}:\b)$) -- (P4) -- (C) -- cycle;
|
|
\filldraw[fill=lightgray, transform canvas={shift={($(O1)-(C)$)}}] (P2) -- ($(B1)+(\B:\b)$) -- (P3) -- (C) -- cycle;
|
|
\filldraw[fill=gray!80, transform canvas={shift={($(O1)+(\l, 0)-(C)$)}}] (P3) -- ($(B1)+({\B+45}:{sqrt(2)*\b})$) -- (P1) -- (C) -- cycle;
|
|
\filldraw[fill=gray!80, transform canvas={shift={($(A1)-(C)$)}}] (P4) -- (B1) -- (P2) -- (C) -- cycle;
|
|
\filldraw[fill=gray, transform canvas={shift=($(A1)-(C)$)}] (B1) -- ++(-\A:\a) -- ++(\B:\a) -- ++({180-\A}:\a) -- cycle;
|
|
\template{(0, 0)};
|
|
\end{tikzpicture}
|
|
\end{document}
|
评论
Comments powered by Disqus