PWWs-01-01

The Pythagorean Theorem I

PWWs-01-01
\documentclass[tikz, border=2pt]{standalone}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}[line width=1pt]
  \coordinate (O1) at (-1, 0);
  \coordinate (P11) at ($(O1)+(0, 4)$);
  \coordinate (P12) at ($(O1)+(-1, 1)$);
  \coordinate (P21) at ($(O1)+(-4, 1)$);
  \coordinate (P22) at ($(O1)+(-1, 0)$);
  \filldraw[fill=lightgray, draw=black] (P11) rectangle (P12);
  \filldraw[fill=gray, draw=black] (P21) rectangle (P22);
  \draw (O1) rectangle ($(O1)+(-4, 4)$);
  \draw (P11) -- (P12);
  \draw (P21) -- (P22);
  \foreach \i in {0, 2}{
    \begin{scope}[rotate around={90*\i:(3, 2)}]
      \coordinate (O2) at (1, 0);
      \coordinate (Q0) at ($(O2)+(3, 0)$);
      \coordinate (Q1) at ($(O2)+(0, 1)$);
      \draw[fill=gray] (O2) -- (Q0) -- (Q1) -- (O2) -- cycle;
    \end{scope}
  }
  \foreach \i in {1, 3}{
    \begin{scope}[rotate around={90*\i:(3, 2)}]
      \coordinate (O2) at (1, 0);
      \coordinate (Q0) at ($(O2)+(3, 0)$);
      \coordinate (Q1) at ($(O2)+(0, 1)$);
      \draw[fill=lightgray] (O2) -- (Q0) -- (Q1) -- (O2) -- cycle;
    \end{scope}
  }
\end{tikzpicture}
\end{document}

评论

Comments powered by Disqus