図の立方体に関する質問

図の立方体に関する質問

これらの図はどのように描くのでしょうか? さらに、これらの図に色を追加するにはどうすればよいでしょうか?図中の立方体

答え1

活用できるtikz-3dplot立方体を簡単に描くためのパッケージです。下の図では不完全な解を描いていますが、残りは簡単に完成させることができます。

ここに画像の説明を入力してください

\documentclass[border={10}]{standalone}
\usepackage{tikz}
\usepackage{tikz-3dplot}
\usetikzlibrary{calc}

\begin{document}

\tdplotsetmaincoords{80}{125} % perspective angles

\begin{tikzpicture}[tdplot_main_coords]

\coordinate (O) at (0,0,0);


\draw[dashed] (O) -- (4,0,0);
\draw[dashed] (O) -- (0,8,0);
\draw[dashed] (O) -- (0,0,4);

%draw the top and bottom of the cube
\draw[fill=blue!5]      (O) -- (0,2,0) -- (2,2,0) -- (2,0,0) -- cycle;
\draw[fill=red!5 ]      (O) -- (0,2,0) -- (0,2,2) -- (0,0,2) -- cycle;
\draw[fill=red!5 ]      (O) -- (0,0,2) -- (2,0,2) -- (2,0,0) -- cycle;

\draw[fill=red!5 ]  (0,0,2) -- (0,2,2) -- (2,2,2) -- (2,0,2) -- cycle;
\draw[fill=red!5 ]  (2,2,2) -- (2,2,0) -- (2,0,0) -- (2,0,2) -- cycle;
\draw[fill=red!5 ]  (0,2,2) -- (2,2,2) -- (2,2,0) -- (0,2,0) -- cycle;

\node (A) at (2,1,1) {\Huge A};

\draw[very thick, ->] (1,2,1) -- node[midway,above] {$P_{1}$} ( 1,3.3,1);

\draw[fill=blue!5]    (0,4,0) -- (0,4,2) -- (2,4,2) -- (2,4,0) -- cycle;
\draw[fill=blue!5]    (2,4,0) -- (2,4,2) -- (2,6,2) -- (2,6,0) -- cycle;
\draw[fill=blue!5]    (2,6,2) -- (2,6,0) -- (0,6,0) -- (0,6,2) -- cycle;

\node (A) at (2,5,1) {\Huge B};

\end{tikzpicture}

\end{document}

関連情報