PostScript だけで正十二面体

約 1ヶ月前の話題である パラメトロン計算機: 多面体描画道楽2009-03-08 の蒸し返しですが、 PostScript だけで正十二面体を書いてみました。
まず、shinichiro_hさんのコードをほぼ直訳するとこんな感じになります。

%!PS
gsave
    40 dict begin
        % Ruby にあって PostScript に無い配列操作関係の命令
        /reverse{
            [ exch{counttomark 1 roll}forall ]
        }def
        /map{
            [ 3 1 roll forall ]
        }def
        /select{
            1 dict begin
                /proc exch def
                [ exch { dup proc not { pop }if } forall ]
            end
        }def
        /set-sub{
            1 dict begin
                /set2 exch def
                {
                    true set2{2 index ne and}forall
                    exch pop
                }select
            end
        }def
        /each-with-index{
            2 dict begin
                /proc exch def
                /arr exch def
                0 1 arr length 1 sub{
                    arr 1 index get
                    proc
                }for
            end
        }def

        % ここから翻訳部分
        /.x{ 0 get }def
        /.y{ 1 get }def
        /.z{ 2 get }def
        /x{ self .x }def
        /y{ self .y }def
        /z{ self .z }def
        /rot_x{
            1 dict begin
                /self exch def
                [x z y neg]
            end
        }def
        /rot_y{
            1 dict begin
                /self exch def
                [z neg y x]
            end
        }def
        /rot_z{
            1 dict begin
                /self exch def
                [y x neg z]
            end
        }def
        /rev_yz{
            1 dict begin
                /self exch def
                [x neg y z]
            end
        }def
        /rev_zx{
            1 dict begin
                /self exch def
                [x y neg z]
            end
        }def
        /rev_xy{
            1 dict begin
                /self exch def
                [x y z neg]
            end
        }def
        /rot_yv{
            4 dict begin
                /a exch def
                /self exch def
                /c a cos def % PostScript の三角関数は、単位がdegree
                /s a sin def
                [
                    x c mul z s mul sub
                    y
                    z c mul x s mul add
                ]
            end
        }def
        /rot_zv{
            4 dict begin
                /a exch def
                /self exch def
                /c a cos def
                /s a sin def
                [
                    x c mul y s mul add
                    y c mul x s mul sub
                    z
                ]
            end
        }def
        /vec{
            2 dict begin
                /p exch def
                /self exch def
                [ x p .x sub   y p .y sub   z p .z sub ]
            end
        }def
        /dot{
            2 dict begin
                /p exch def
                /self exch def
                [
                    y p .z mul z p .y mul sub
                    z p .x mul x p .z mul sub
                    x p .y mul y p .x mul sub
                ]
            end
        }def

        /l0 5 sqrt 3 add 2 div def
        /l1 5 sqrt 1 add 2 div def
        /l2 1 def

        /a [[l0 l2 neg 0] [l1 l1 neg l1] [l2 0 l0] [l1 l1 l1] [l0 l2 0]]def
        /b a{rev_xy}map reverse def
        /c a{rev_yz}map reverse def
        /d c{rev_xy}map reverse def
        /e a{rot_x}map{rot_y}map def
        /f e{rev_zx}map reverse def
        /g e{rev_xy}map reverse def
        /h g{rev_zx}map reverse def
        /i e{rot_y}map{rot_z}map def
        /j i{rev_yz}map reverse def
        /k i{rev_zx}map reverse def
        /l k{rev_yz}map reverse def

        /dodeca[a b c d e f g h i j k l]def
        /dodeca dodeca{
            1 dict begin
                /pent exch def
                pent{
                    1 dict begin
                        /pt exch def
                        pt 15 rot_zv -15 rot_yv
                    end
                }map
            end
        }map def

        /visible dodeca{
            1 dict begin
                /pent exch def
                pent 0 get pent 1 get vec
                pent 2 get pent 1 get vec
                dot 0 get 0 ge
            end
        }select def
        /invisible dodeca visible set-sub def

        [[invisible 0.8] [visible 0]]{
            2 dict begin
                aload pop
                /color exch def
                /pents exch def
                color setgray
                pents{
                    1 dict begin
                        /pent exch def
                        pent{
                            2 dict begin
                                /pt exch def
                                /i exch def
                                [pt 1 get   pt 2 get]{50 mul 300 add}forall
                                i 0 eq{ moveto }{ lineto }ifelse
                            end
                        }each-with-index
                        closepath
                        stroke
                    end
                }forall
            end
        }forall
        showpage
    end
grestore