TikZで正十二面体と正二十面体

TikZライブラリを使って,正十二面体・正二十面体を描こうと思いました.

\documentclass{article}
\usepackage[dvipdfmx]{graphicx}
\usepackage{tikz}
\def\PHI{1.61803}
\def\cosA{0.809017}
\def\sinA{0.587785}
\def\cosB{0.309017}
\def\sinB{0.951057}
\begin{document}
\begin{tikzpicture}[line join=bevel,z=4.5,scale=2]
\coordinate (A) at (1,0,0);
\coordinate (B) at (\cosB,\sinB,0);
\coordinate (C) at ( - \cosA,\sinA,0);
\coordinate (D) at ( - \cosA, - \sinA,0);
\coordinate (E) at (\cosB, - \sinB,0);
\coordinate (F) at (\PHI,0,1);
\coordinate (G) at (\PHI * \cosA,\PHI * \sinA,\PHI);
\coordinate (H) at (\PHI * \cosB,\PHI * \sinB,\PHI);
\coordinate (I) at ( - \PHI * \cosB,\PHI * \sinB,\PHI);
\coordinate (J) at ( - \PHI * \cosA,\PHI * \sinA,1);
\coordinate (K) at ( - \PHI,0,\PHI);
\coordinate (L) at ( - \PHI * \cosA, - \PHI * \sinA,1);
\coordinate (M) at ( - \PHI * \cosB, - \PHI * \sinB,\PHI);
\coordinate (N) at (\PHI * \cosB, - \PHI * \sinB,1);
\coordinate (O) at (\PHI * \cosA, - \PHI * \sinA,\PHI);
\coordinate (P) at ( - 1,0,\PHI + 1);
\coordinate (Q) at ( - \cosB, - \sinB,\PHI + 1);
\coordinate (R) at (\cosA, - \sinA,\PHI + 1);
\coordinate (S) at (\cosA,\sinA,\PHI + 1);
\coordinate (T) at ( - \cosB,\sinB,\PHI + 1);

\draw[fill opacity=0.7 , fill=green!20] (A)--(B)--(C)--(D)--(E)--cycle;
\draw[fill opacity=0.7 , fill=green!20] (A)--(B)--(H)--(G)--(F)--cycle;
\draw[fill opacity=0.7 , fill=green!20] (B)--(C)--(J)--(I)--(H)--cycle;
\draw[fill opacity=0.7 , fill=green!20] (C)--(D)--(L)--(K)--(J)--cycle;
\draw[fill opacity=0.7 , fill=green!20] (D)--(E)--(N)--(M)--(L)--cycle;
\draw[fill opacity=0.7 , fill=green!20] (E)--(A)--(F)--(O)--(N)--cycle;
\draw[fill opacity=0.7 , fill=green!20] (S)--(T)--(P)--(Q)--(R)--cycle;
\draw[fill opacity=0.7 , fill=green!20] (S)--(T)--(I)--(H)--(G)--cycle;
\draw[fill opacity=0.7 , fill=green!20] (T)--(P)--(K)--(J)--(I)--cycle;
\draw[fill opacity=0.7 , fill=green!20] (P)--(Q)--(M)--(L)--(K)--cycle;
\draw[fill opacity=0.7 , fill=green!20] (Q)--(R)--(O)--(N)--(M)--cycle;
\draw[fill opacity=0.7 , fill=green!20] (R)--(S)--(G)--(F)--(O)--cycle;
\end{tikzpicture}
\end{document}

正十二面体

\documentclass{article}
\usepackage[dvipdfmx]{graphicx}
\usepackage{tikz}
\def\PHI{1.61803}
\begin{document}
\begin{tikzpicture}[line join=bevel,z=4.5,scale=2]
\coordinate (A) at (\PHI, 1 , 0);
\coordinate (B) at (\PHI, - 1 , 0);
\coordinate (C) at ( - \PHI , - 1 , 0);
\coordinate (D) at ( - \PHI , 1 , 0);
\coordinate (E) at ( - 1, 0 , \PHI);
\coordinate (F) at (1 , 0 , \PHI);
\coordinate (G) at ( - 1 , 0 , - \PHI);
\coordinate (H) at (1 , 0 , - \PHI);
\coordinate (I) at (0 , \PHI , 1);
\coordinate (J) at (0 , \PHI , - 1);
\coordinate (K) at (0 , - \PHI , - 1);
\coordinate (L) at (0 , - \PHI , 1);
\draw[fill opacity=0.7 , fill=green!20] (A)--(B)--(F)--cycle;
\draw[fill opacity=0.7 , fill=green!20] (B)--(L)--(F)--cycle;
\draw[fill opacity=0.7 , fill=green!20] (E)--(F)--(L)--cycle;
\draw[fill opacity=0.7 , fill=green!20] (C)--(E)--(L)--cycle;
\draw[fill opacity=0.7 , fill=green!20] (C)--(D)--(E)--cycle;
\draw[fill opacity=0.7 , fill=green!20] (E)--(D)--(I)--cycle;
\draw[fill opacity=0.7 , fill=green!20] (E)--(I)--(F)--cycle;
\draw[fill opacity=0.7 , fill=green!20] (A)--(F)--(I)--cycle;
\draw[fill opacity=0.7 , fill=green!20] (L)--(K)--(C)--cycle;
\draw[fill opacity=0.7 , fill=green!20] (L)--(K)--(B)--cycle;
\draw[fill opacity=0.7 , fill=green!20] (I)--(J)--(A)--cycle;
\draw[fill opacity=0.7 , fill=green!20] (I)--(J)--(D)--cycle;
\draw[fill opacity=0.7 , fill=green!20] (A)--(B)--(H)--cycle;
\draw[fill opacity=0.7 , fill=green!20] (B)--(K)--(H)--cycle;
\draw[fill opacity=0.7 , fill=green!20] (G)--(H)--(K)--cycle;
\draw[fill opacity=0.7 , fill=green!20] (C)--(G)--(K)--cycle;
\draw[fill opacity=0.7 , fill=green!20] (C)--(D)--(G)--cycle;
\draw[fill opacity=0.7 , fill=green!20] (G)--(D)--(J)--cycle;
\draw[fill opacity=0.7 , fill=green!20] (G)--(J)--(H)--cycle;
\draw[fill opacity=0.7 , fill=green!20] (A)--(H)--(J)--cycle;
\end{tikzpicture}
\end{document}

正二十面体

 

参考:Drawing polyhedra using TikZ with semi-transparent and shading effect

広告

コメントを残す

以下に詳細を記入するか、アイコンをクリックしてログインしてください。

WordPress.com ロゴ

WordPress.com アカウントを使ってコメントしています。 ログアウト / 変更 )

Twitter 画像

Twitter アカウントを使ってコメントしています。 ログアウト / 変更 )

Facebook の写真

Facebook アカウントを使ってコメントしています。 ログアウト / 変更 )

Google+ フォト

Google+ アカウントを使ってコメントしています。 ログアウト / 変更 )

%s と連携中