0 Usuarios y 2 Visitantes están viendo este tema.
% Plane partition% Author: Jang Soo Kim% Modified: Carlos at picuino.com\documentclass{minimal}\usepackage{tikz}% The angles of x,y,z-axes\newcommand\xaxis{210}\newcommand\yaxis{-30}\newcommand\zaxis{90}\definecolor{graytop}{RGB}{160,160,160}\definecolor{grayleft}{RGB}{192,192,192}\definecolor{grayright}{RGB}{228,228,228}% The top side of a cube\newcommand\topside[3]{ \fill[fill=graytop, thick, draw=white, shift={(\xaxis:#1)},shift={(\yaxis:#2)}, shift={(\zaxis:#3)}] (0,0) --(30:1) --(0,1) --(150:1) --(0,0);}% The left side of a cube\newcommand\leftside[3]{ \fill[fill=grayleft, thick, draw=white, shift={(\xaxis:#1)},shift={(\yaxis:#2)}, shift={(\zaxis:#3)}] (0,0) --(0,-1) --(210:1) --(150:1) --(0,0);}% The right side of a cube\newcommand\rightside[3]{ \fill[fill=grayright, thick, draw=white, shift={(\xaxis:#1)},shift={(\yaxis:#2)}, shift={(\zaxis:#3)}] (0,0) --(30:1) --(-30:1) --(0,-1) --(0,0);}% The cube \newcommand\cube[3]{ \topside{#1}{#2}{#3} \leftside{#1}{#2}{#3} \rightside{#1}{#2}{#3}}% Definition of \planepartition% With three counters% To draw the following plane partition, just write \planepartition{ {a, b, c}, {d,e} }.% a b c% d e\newcounter{x}\newcounter{y}\newcounter{z}\newcommand\planepartition[2]{ \setcounter{x}{-1} \foreach \a in {#2} { \addtocounter{x}{1} \setcounter{y}{-1} \foreach \b in \a { \addtocounter{y}{1} \setcounter{z}{#1} \foreach \c in {1,...,\b} { \addtocounter{z}{1} \cube{\value{x}}{\value{y}}{\value{z}} } } }}\begin{document} \begin{tikzpicture}\planepartition {0}{{3,2,2},{2,2,1},{2,1}}\planepartition {-7}{{3,3,2},{2,2,2},{2,1,1}}\end{tikzpicture}\end{document}
% Plane partition% Author: Jang Soo Kim% Modified: Carlos at picuino.com\documentclass{minimal}\usepackage{tikz}%%%<\usepackage{verbatim}\usepackage[active,tightpage]{preview}\PreviewEnvironment{tikzpicture}\setlength\PreviewBorder{30pt}%%%%>% The angles of x,y,z-axes\newcommand\xaxis{210}\newcommand\yaxis{-30}\newcommand\zaxis{90}\definecolor{graytop}{RGB}{160,160,160}\definecolor{grayleft}{RGB}{192,192,192}\definecolor{grayright}{RGB}{228,228,228}% The top side of a cube\newcommand\topside[3]{ \fill[fill=graytop, thick, draw=white, shift={(\xaxis:#1)},shift={(\yaxis:#2)}, shift={(\zaxis:#3)}] (0,0) --(30:1) --(0,1) --(150:1) --(0,0);}% The left side of a cube\newcommand\leftside[3]{ \fill[fill=grayleft, thick, draw=white, shift={(\xaxis:#1)},shift={(\yaxis:#2)}, shift={(\zaxis:#3)}] (0,0) --(0,-1) --(210:1) --(150:1) --(0,0);}% The right side of a cube\newcommand\rightside[3]{ \fill[fill=grayright, thick, draw=white, shift={(\xaxis:#1)},shift={(\yaxis:#2)}, shift={(\zaxis:#3)}] (0,0) --(30:1) --(-30:1) --(0,-1) --(0,0);}% The cube\newcommand\cube[3]{ \topside{#1}{#2}{#3} \leftside{#1}{#2}{#3} \rightside{#1}{#2}{#3}}% Definition of \planepartition% With three counters% To draw the following plane partition, just write \planepartition{ {a, b, c}, {d,e} }.% a b c% d e\newcounter{x}\newcounter{y}\newcounter{z}\newcommand\planepartition[1]{ \setcounter{z}{0} \foreach \a in {#1} { \addtocounter{z}{1} \setcounter{y}{0} \foreach \b in \a { \addtocounter{y}{1} \setcounter{x}{0} \foreach \c in \b { \addtocounter{x}{1} \ifnum \c > 0 \cube{\value{x}}{\value{y}}{\value{z}} \fi } } }}\begin{document}\begin{tikzpicture}\planepartition { {{1,0,1},{0,0,0},{1,0,1}}, {{1,0,1},{0,0,0},{1,0,1}}, {{1,1,1},{1,1,1},{1,1,1}}}\end{tikzpicture}\end{document}
\planepartition { {{1,1,1},{1,1,1},{1,1,1}}, {{1,1,0},{1,1,0},{1,1,0}}, {{1,0,0},{1,0,0},{1,0,0}}}
\planepartition { {{1,1,1},{1,1,1},{1,1,1}}, {{1,1,0},{1,1,0},{0,0,0}}, {{1,0,0},{0,0,0},{0,0,0}}}