## Saturday, September 05, 2009

### A 3d graph

... after the example in the tikz gallery.

\usetikzlibrary{calc,3d}

\newcommand{\setxyz}[1]{%

\pgfmathsetmacro{\xone}{cos(180+#1)}%

\pgfmathsetmacro{\yone}{sin(180+#1)}%

\pgfmathsetmacro{\xtwo}{cos(360-#1)}%

\pgfmathsetmacro{\ytwo}{sin(360-#1)}%

}

\setxyz{17}

\begin{tikzpicture}%

[x = {(\xone cm,\yone cm)},

y = {(\xtwo cm,\ytwo cm)},

z = {(0cm,1cm)}]

\GraphInit[vstyle=Shade]

\SetVertexNoLabel

\begin{scope}[canvas is xy plane at z=-5]

\Vertex{x}

\end{scope}

\begin{scope}[canvas is xy plane at z=0]

\grEmptyCycle[prefix=a]{5}

\end{scope}

\EdgeFromOneToAll{x}{a}{}{5}

\Edges(a0,a1,a2,a3,a4,a0)

\begin{scope}[canvas is xy plane at z=5]

\Vertex{y}

\end{scope}

\EdgeFromOneToAll{y}{a}{}{5}

\end{tikzpicture}

Subscribe to:
Post Comments (Atom)

## 1 comment:

Your blog keeps getting better and better! Your older articles are not as good as newer ones you have a lot more creativity and originality now keep it up!

Post a Comment