diff options
author | Karl Berry <karl@freefriends.org> | 2009-12-31 01:28:27 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-12-31 01:28:27 +0000 |
commit | e7bbf19e758762cc76a2e8d23e34cd252496b3c3 (patch) | |
tree | 4b36404cb843b4c8fa22d8eada8134eab177f1a3 /Master/texmf-dist/tex/latex/pst-platon | |
parent | 01294f46bb60e2b571fe1cc4b8a4428366240d8b (diff) |
new pstricks package pst-platon 0.01 (25dec09)
git-svn-id: svn://tug.org/texlive/trunk@16538 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/pst-platon')
-rw-r--r-- | Master/texmf-dist/tex/latex/pst-platon/pst-platon.sty | 240 |
1 files changed, 240 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/pst-platon/pst-platon.sty b/Master/texmf-dist/tex/latex/pst-platon/pst-platon.sty new file mode 100644 index 00000000000..b21d9de1e8b --- /dev/null +++ b/Master/texmf-dist/tex/latex/pst-platon/pst-platon.sty @@ -0,0 +1,240 @@ +%% $Id: pst-platon.sty 208 2009-12-25 08:54:53Z herbert $ +%% +%% This is file `pst-platon.sty', +%% +%% This program can be redistributed and/or modified under the terms +%% of the LaTeX Project Public License Distributed from CTAN archives +%% in directory macros/latex/base/lppl.txt. +%% +%% Manuel Luque <Mluque5130 _at_ aol.com> (France) +%% Herbert Voss <hvoss _at_ tug.org (Germany) +%% +%% 2009/12/24 +%% +%% DESCRIPTION: +%% `pst-platon' is a package intended for drawing the +%% platonic solids +% +\NeedsTeXFormat{LaTeX2e} +\RequirePackage{pstricks} +\RequirePackage{pst-3d} +\RequirePackage{pst-xkey} +\ifx\PSTFPloaded\endinput\else\input{pst-fp.tex}\fi +\def\fileversion{0.01} +\def\filedate{2009/12/25} +% +\ProvidesPackage{pst-platon}[\filedate\ v\fileversion\ platonic solids (ml,hv)] +% +\newcommand\colorTypeA{% +\definecolor{ColorA}{cmyk}{0.1,0.1,0.05,0} +\definecolor{ColorB}{cmyk}{0.15,0.15,0.05,0} +\definecolor{ColorC}{cmyk}{0.2,0.2,0.05,0} +\definecolor{ColorD}{cmyk}{0.25,0.25,0.05,0} +\definecolor{ColorE}{cmyk}{0.3,0.3,0.05,0} +\definecolor{ColorF}{cmyk}{0.35,0.35,0.05,0} +\definecolor{ColorG}{cmyk}{0.4,0.4,0.05,0} +\definecolor{ColorH}{cmyk}{0.45,0.45,0.05,0} +\definecolor{ColorI}{cmyk}{0.5,0.5,0.05,0} +\definecolor{ColorJ}{cmyk}{0.55,0.55,0.05,0} +\definecolor{ColorK}{cmyk}{0.6,0.6,0.05,0} +\definecolor{ColorL}{cmyk}{0.65,0.65,0.05,0} +\definecolor{ColorM}{cmyk}{0.2,0.22,0.07,0} +\definecolor{ColorN}{cmyk}{0.32,0.33,0.09,0} +\definecolor{ColorO}{cmyk}{0.22,0.20,0.05,0} +\definecolor{ColorP}{cmyk}{0.32,0.30,0.05,0} +\definecolor{ColorQ}{cmyk}{0.12,0.2,0.07,0} +\definecolor{ColorR}{cmyk}{0.27,0.33,0.09,0} +\definecolor{ColorS}{cmyk}{0.18,0.20,0.05,0} +\definecolor{ColorT}{cmyk}{0.37,0.30,0.05,0}} +\newcommand\colorTypeB{% +\definecolor{ColorA}{cmyk}{0.1,0.2,0.1,0} +\definecolor{ColorB}{cmyk}{0.15,0.2,0.15,0} +\definecolor{ColorC}{cmyk}{0.2,0.2,0.2,0} +\definecolor{ColorD}{cmyk}{0.25,0.2,0.25,0} +\definecolor{ColorE}{cmyk}{0.3,0.2,0.3,0} +\definecolor{ColorF}{cmyk}{0.35,0.2,0.35,0} +\definecolor{ColorG}{cmyk}{0.4,0,0.4,0} +\definecolor{ColorH}{cmyk}{0.45,0,0.45,0}} +% +\def\pst@t{0.333} +\SpecialCoor% +% +\pst@addfams{pst-platon} +\define@boolkey[psset]{pst-platon}[Pst@]{PstPicture}[true]{} +\define@boolkey[psset]{pst-platon}[Pst@]{Frame}[true]{} +\define@key[psset]{pst-platon}{Viewpoint}[1 1 1]{% + \def\psk@platon@Viewpoint{#1}% + \expandafter\psset@platon@viewpoint#1\@nil} +\def\psset@platon@viewpoint#1 #2 #3\@nil{% + \def\psk@platon@Viewpointx{#1}% + \def\psk@platon@Viewpointy{#2}% + \def\psk@platon@Viewpointz{#3}} +\psset[pst-platon]{Viewpoint=1 1 1,Frame=true,PstPicture=true} +\define@key[psset]{pst-platon}{faceName}[\Alph]{\let\pst@faceName#1} +\define@key[psset]{pst-platon}{faceNameFont}[{\huge\sffamily\bfseries}]{\def\psk@faceNameFont{#1}} +\psset[pst-platon]{faceName=\Alph,faceNameFont={\huge\sffamily\bfseries}} +\define@key[psset]{pst-platon}{colorType}[A]{\csname colorType#1\endcsname} +\psset[pst-platon]{colorType=A} +% +\newcounter{face@counter} +% +\def\pst@ifpos(#1,#2,#3){% + \@ifnextchar[{\pst@ifpos@i(#1,#2,#3)}{\pst@ifpos@i(#1,#2,#3)[#1,#2,#3]}} +\def\pst@ifpos@i(#1,#2,#3)[#4,#5,#6]#7#8{% + \pstFPmul\pst@tempA\psk@platon@Viewpointx{#1}% + \pstFPmul\pst@tempB\psk@platon@Viewpointy{#2}% + \pstFPadd\pst@tempC\pst@tempA\pst@tempB% + \pstFPmul\pst@tempA\psk@platon@Viewpointz{#3}% + \pstFPadd\pst@tempB\pst@tempA\pst@tempC% + \ifdim\pst@tempB pt>\z@ \ThreeDput[normal=#1 #2 #3](#4,#5,#6){#7% + \rput(0,0){\psk@faceNameFont\setcounter{face@counter}{#8}% + \pst@faceName{face@counter}}}\fi% +} +% +\def\psTetrahedron{\pst@object{psTetrahedron}} +\def\psTetrahedron@i{{% + \pst@killglue% + \addbefore@par{fillstyle=solid,dimen=middle,radius=1.633,colorType=B}% + \use@par% + \def\faceA[##1]{\pspolygon[##1](\psk@radius;90)(\psk@radius;210)(\psk@radius;330)} + \def\faceB[##1]{\pspolygon[##1](\psk@radius;30)(\psk@radius;150)(\psk@radius;270)} + \psset[pst-3d]{viewpoint=\psk@platon@Viewpoint}% + \psscalebox{\psk@@psscale}{% + \ifPst@PstPicture\pspicture(-1.4,-1.6)(1.4,1.6)\fi% + \pst@ifpos(1,1,-1)[\pst@t,\pst@t,-\pst@t]{\faceA[fillcolor=ColorA]}{1}% face 1 + \pst@ifpos(-1,1,1)[-\pst@t,\pst@t,\pst@t]{\faceB[fillcolor=ColorB]}{2}% face 2 + \pst@ifpos(1,-1,1)[\pst@t,-\pst@t,\pst@t]{\faceB[fillcolor=ColorC]}{3}% face 3 + \pst@ifpos(-1,-1,-1)[-\pst@t,-\pst@t,-\pst@t]{\faceA[fillcolor=ColorC]}{4}% face 4 + \ifPst@Frame\pst@showFrame{}\fi + \ifPst@PstPicture\endpspicture\fi% +}}\ignorespaces} +% +\def\psHexahedron{\pst@object{psHexahedron}} +\def\psHexahedron@i{{% + \pst@killglue% + \addbefore@par{fillstyle=solid,dimen=middle,colorType=B}% + \use@par% + \def\face[##1]{\psframe[##1](-1,-1)(1,1)}% + \psscalebox{\psk@@psscale}{% + \ifPst@PstPicture\pspicture(-1.4,-1.7)(1.4,1.7)\fi% + \psset[pst-3d]{viewpoint=\psk@platon@Viewpoint}% + \pst@ifpos(1,0,0){\face[fillcolor=ColorA]}{1} % face1 + \pst@ifpos(0,1,0){\face[fillcolor=ColorB]}{2} % face2 + \pst@ifpos(-1,0,0){\face[fillcolor=ColorC]}{3}% face3 + \pst@ifpos(0,-1,0){\face[fillcolor=ColorD]}{4}% face4 + \pst@ifpos(0,0,1){\face[fillcolor=ColorE]}{5} % face5 + \pst@ifpos(0,0,-1){\face[fillcolor=ColorF]}{6}% face6 + \ifPst@Frame\pst@showFrame\fi + \ifPst@PstPicture\endpspicture\fi% +}}\ignorespaces} +% +\def\psOctahedron{\pst@object{psOctahedron}} +\def\psOctahedron@i{{% + \pst@killglue% + \addbefore@par{fillstyle=solid,dimen=middle,radius=0.8165,colorType=B}% + \use@par% + \def\faceA[##1]{\pspolygon[##1](\psk@radius;90)(\psk@radius;210)(\psk@radius;330)} + \def\faceB[##1]{\pspolygon[##1](\psk@radius;30)(\psk@radius;150)(\psk@radius;270)} + \psset[pst-3d]{viewpoint=\psk@platon@Viewpoint}% + \psscalebox{\psk@@psscale}{% + \ifPst@PstPicture\pspicture(-1,-1)(1,1)\fi% + \pst@ifpos(1,1,1)[\pst@t,\pst@t,\pst@t]{\faceA[fillcolor=ColorA]}{1}% face 1 + \pst@ifpos(-1,1,1)[-\pst@t,\pst@t,\pst@t]{\faceA[fillcolor=ColorB]}{2}% face 2 + \pst@ifpos(-1,-1,1)[-\pst@t,-\pst@t,\pst@t]{\faceA[fillcolor=ColorC]}{3}% face 3 + \pst@ifpos(1,-1,1)[\pst@t,-\pst@t,\pst@t]{\faceA[fillcolor=ColorD]}{4}% face 4 + \pst@ifpos(1,1,-1)[\pst@t,\pst@t,-\pst@t]{\faceB[fillcolor=ColorE]}{5}% face 5 + \pst@ifpos(-1,1,-1)[-\pst@t,\pst@t,-\pst@t]{\faceB[fillcolor=ColorF]}{6}% face 6 + \pst@ifpos(1,-1,-1)[\pst@t,-\pst@t,-\pst@t]{\faceB[fillcolor=ColorG]}{7}% face 7 + \pst@ifpos(-1,-1,-1)[-\pst@t,-\pst@t,-\pst@t]{\faceB[fillcolor=ColorH]}{8}% face 8 + \ifPst@Frame\pst@showFrame\fi + \ifPst@PstPicture\endpspicture\fi% +}}\ignorespaces} +% +\def\psDodecahedron{\pst@object{psDodecahedron}} +\def\psDodecahedron@i{{% + \pst@killglue% + \addbefore@par{fillstyle=solid,colorType=A}% + \use@par% + \def\RA{1.05146}\def\rb{0.723607}\def\ra{1.17082}% + \def\rc{0.723607}\def\rd{1.17082}% + \psset[pst-3d]{viewpoint=\psk@platon@Viewpoint}% + \def\faceA[##1]{\pspolygon[##1](\RA;18)(\RA;90)(\RA;162)(\RA;234)(\RA;306)}% + \def\faceB[##1]{\pspolygon[##1](\RA;270)(\RA;-18)(\RA;54)(\RA;126)(\RA;198)}% + \def\faceC[##1]{\pspolygon[##1](\RA;0)(\RA;72)(\RA;144)(\RA;216)(\RA;288)}% + \def\faceD[##1]{\pspolygon[##1](\RA;36)(\RA;108)(\RA;180)(\RA;252)(\RA;324)}% + \psscalebox{\psk@@psscale}{% + \ifPst@PstPicture\pspicture(-1.1,-1.8)(1.1,1.8)\fi% + \pst@ifpos(0,\ra,\rb){\faceA[fillcolor=ColorA]}{1}% face1 + \pst@ifpos(0,-\ra,\rb){\faceA[fillcolor=ColorB]}{2}% face2 + \pst@ifpos(0,\ra,-\rb){\faceB[fillcolor=ColorC]}{3}% face3 + \pst@ifpos(0,-\ra,-\rb){\faceB[fillcolor=ColorD]}{4}% face4 + \pst@ifpos(\rc,0,\rd){\faceB[fillcolor=ColorE]}{5}% face5 + \pst@ifpos(-\rc,0,\rd){\faceB[fillcolor=ColorF]}{6}% face6 + \pst@ifpos(\rc,0,-\rd){\faceA[fillcolor=ColorG]}{7}% face7 + \pst@ifpos(-\rc,0,-\rd){\faceA[fillcolor=ColorH]}{8}% face8 + \pst@ifpos(\rd,\rc,0){\faceC[fillcolor=ColorI]}{9}% face9 + \pst@ifpos(-\rd,\rc,0){\faceD[fillcolor=ColorJ]}{10}% face10 + \pst@ifpos(\rd,-\rc,0){\faceD[fillcolor=ColorK]}{11}% face11 + \pst@ifpos(-\rd,-\rc,0){\faceC[fillcolor=ColorL]}{12}%face12 + \ifPst@Frame\pst@showFrame\fi% + \ifPst@PstPicture\endpspicture\fi% +}}\ignorespaces} +% +\def\psIcosahedron{\pst@object{psIcosahedron}} +\def\psIcosahedron@i{{% + \pst@killglue% + \addbefore@par{fillstyle=solid,radius=1.1547,colorType=A}% + \use@par% + \def\rb{0.539345}\def\ra{1.41202}% + \def\rc{0.539345}\def\rd{1.41202}% + \def\Nx{0.381966}\def\Ny{0.381966}\def\Nz{0.381966}% + \def\Ox{0.872678}\def\Oy{0.872678}\def\Oz{0.872678}% + \def\nx{1}\def\ny{0.381966}\def\nz{0}% + \def\ox{1.42102}\def\oy{0.53945}\def\oz{0}% + \def\faceA[##1]{\pspolygon[##1](\psk@radius;90)(\psk@radius;210)(\psk@radius;330)} + \def\faceB[##1]{\pspolygon[##1](\psk@radius;-90)(\psk@radius;30)(\psk@radius;150)} + \def\faceC[##1]{\pspolygon[##1](\psk@radius;-69.0948)(\psk@radius;50.9502)(\psk@radius;170.9502)} + \def\faceD[##1]{\pspolygon[##1](\psk@radius;-110.9052)(\psk@radius;9.4598)(\psk@radius;129.4598)} + \def\faceE[##1]{\pspolygon[##1](\psk@radius;69.0948)(\psk@radius;189.09498)(\psk@radius;309.09498)} + \def\faceF[##1]{\pspolygon[##1](\psk@radius;110.9052)(\psk@radius;230.9052)(\psk@radius;350.9052)} + \def\faceG[##1]{\pspolygon[##1](\psk@radius;0)(\psk@radius;120)(\psk@radius;240)} + \def\faceH[##1]{\pspolygon[##1](\psk@radius;60)(\psk@radius;180)(\psk@radius;300)} + \psscalebox{\psk@@psscale}{% + \ifPst@PstPicture\pspicture(-1,-2)(1,2)\fi% + \psset[pst-3d]{viewpoint=\psk@platon@Viewpoint}% + \pst@ifpos(0,\ra,\rb){\faceA[fillcolor=ColorA]}{1}% face1 + \pst@ifpos(0,-\ra,\rb){\faceA[fillcolor=ColorB]}{2}% face2 + \pst@ifpos(0,\ra,-\rb){\faceB[fillcolor=ColorC]}{3}% face3 + \pst@ifpos(0,-\ra,-\rb){\faceB[fillcolor=ColorD]}{4}% face4 + \pst@ifpos(\rc,0,\rd){\faceB[fillcolor=ColorE]}{5}% face5 + \pst@ifpos(-\rc,0,\rd){\faceB[fillcolor=ColorF]}{6}% face6 + \pst@ifpos(\rc,0,-\rd){\faceA[fillcolor=ColorG]}{7}% face7 + \pst@ifpos(-\rc,0,-\rd){\faceA[fillcolor=ColorH]}{8}% face8 + \pst@ifpos(\Nx,\Ny,\Nz)[\Ox,\Oy,\Oz]{\faceC[fillcolor=ColorI]}{9}% face9 + \pst@ifpos(-\Nx,\Ny,\Nz)[-\Ox,\Oy,\Oz]{\faceD[fillcolor=ColorJ]}{10}% face10 + \pst@ifpos(\Nx,-\Ny,\Nz)[\Ox,-\Oy,\Oz]{\faceD[fillcolor=ColorK]}{11}% face11 + \pst@ifpos(-\Nx,-\Ny,\Nz)[-\Ox,-\Oy,\Oz]{\faceC[fillcolor=ColorL]}{12}% face12 + \pst@ifpos(\Nx,\Ny,-\Nz)[\Ox,\Oy,-\Oz]{\faceE[fillcolor=ColorM]}{13}% face13 + \pst@ifpos(\Nx,-\Ny,-\Nz)[\Ox,-\Oy,-\Oz]{\faceF[fillcolor=ColorN]}{14}% face14 + \pst@ifpos(-\Nx,-\Ny,-\Nz)[-\Ox,-\Oy,-\Oz]{\faceE[fillcolor=ColorO]}{15}% face15 + \pst@ifpos(-\Nx,\Ny,-\Nz)[-\Ox,\Oy,-\Oz]{\faceF[fillcolor=ColorP]}{16}% face16 + \pst@ifpos(\nx,\ny,\nz)[\ox,\oy,\oz]{\faceG[fillcolor=ColorQ]}{17}% face17 + \pst@ifpos(\nx,-\ny,\nz)[\ox,-\oy,\oz]{\faceH[fillcolor=ColorR]}{18}% face18 + \pst@ifpos(-\nx,-\ny,\nz)[-\ox,-\oy,\oz]{\faceG[fillcolor=ColorS]}{19}% face19 + \pst@ifpos(-\nx,\ny,\nz)[-\ox,\oy,\oz]{\faceH[fillcolor=ColorT]}{20}% face20 + \ifPst@Frame\pst@showFrame\fi% + \ifPst@PstPicture\endpspicture\fi% +}}\ignorespaces} +% +\def\pst@showFrame{{% + \psset{fillstyle=none,linestyle=dotted}% + \ThreeDput[normal=1 0 0](1,0,0){\psframe(-1,-1)(1,1)}% + \ThreeDput[normal=0 1 0](0,1,0){\psframe(-1,-1)(1,1)}% + \ThreeDput[normal=0 0 1](0,0,1){\psframe(-1,-1)(1,1)}% + \ThreeDput[normal=0 0 -1](0,0,-1){\psframe(-1,-1)(1,1)}% + \ThreeDput[normal=-1 0 0](-1,0,0){\psframe(-1,-1)(1,1)}% + \ThreeDput[normal=0 -1 0](0,-1,0){\psframe(-1,-1)(1,1)}% +}} +% +\endinput + |