Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.postscript > #823

Re: 3D in PS

From luser- -droog <mijoryx@yahoo.com>
Newsgroups comp.lang.postscript
Subject Re: 3D in PS
Date 2012-07-21 13:23 -0700
Organization http://groups.google.com
Message-ID <befb5281-2482-4b0e-b97f-2e1d30faebe1@googlegroups.com> (permalink)
References <ccb3b740-0e77-406a-a7a2-f7d1f07b8d48@googlegroups.com> <pmmrkytn2cfy.xr078m3tiehu.dlg@40tude.net> <e5c825f7-427e-484d-a981-0d01e7e0e83c@googlegroups.com> <wbw650l5itai$.rtaypmzhtha7$.dlg@40tude.net>

Show all headers | View raw


On Saturday, July 21, 2012 12:27:51 AM UTC-5, tlvp wrote:
> On Fri, 20 Jul 2012 20:43:48 -0700 (PDT), luser- -droog wrote:
> 
> &gt; One bonus from my search: I think my new L-system
> &gt; code is slicker than anyone else&#39;s. :)
> &gt; 
> &gt; &lt;&lt;/F{F - G + F + G - F}/G{G G}&gt;&gt;begin
> &gt; {F - G - G}7{[exch{dup where{exch get aload pop}if}forall]}repeat
> &gt; cvx&lt;&lt;/F{3 0 rlineto}/G 1 index/-{120 rotate}/+{-120 rotate}&gt;&gt;begin
> &gt; 100 100 moveto exec fill showpage
> 
> Sure is compact. And terse. As I totally fail to follow the geometric
> motivation of even the tiniest morsel in it, I&#39;d even go so far as to call
> it obscure. And oh! would I appreciate a good commenting on it :-) .
> 
> Including also why &quot;L&quot; for what I see as a &quot;Kuratowski gasket&quot;?
> 
> Cheers (and thanks for the code), -- tlvp
> -- 
> Avant de repondre, jeter la poubelle, SVP.

Well, here's a slightly different one with comments.
Wikipedia should do the rest.

%!
%Reference:
%http://en.wikipedia.org/wiki/L-system#Example_7:_Fractal_plant
%
    << %start constructing a dictionary

%Deterministic Context-Free L-System
%simulated by repeated macro-expansion
%of elements in the array with definitions
%in the currentdict
% proc(ie. array) repeat-count  DOL  expanded-proc
/DOL { % arr M
    { % arr
        [ exch % [ arr
        { % [ ... arr_N  perform substitutions on each element
            currentdict exch 2 copy known % [ ... dict arr_N bool
            {get aload pop}{exch pop}ifelse % [ ... arr_N'
        } forall % [ arr_0 arr_1 ... arr_N-1
        ] % arr'  zip up array
        dup length = %report size of proc
        dup 0 exch { /X eq { 1 add } if } forall = %how many 'X's
        dup 0 exch { /F eq { 1 add } if } forall = %how many 'F's
        ()= %blank line
    } repeat % arr'^M  array transformed M times
    cvx % convert array to proc
}
%transformations (Productions)
/X {F -[[X]+ X]+ F[+ F X]- X}
/F {F F}
    >>begin %define DOL and transformations

{X} % seed-proc
6 DOL % expanded-proc

    << % graphical interpretation of expanded proc
([){gsave}
(]){currentpoint 1 0 180 arc stroke grestore}
/X{}
/F{0 3 rlineto currentpoint stroke moveto}
/a 25
/-{a rotate}
/+{a neg rotate}
    >>begin %define interpretation

200 200 moveto %establish currentpoint
exec %execute the proc
showpage

Back to comp.lang.postscript | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

3D in PS luser- -droog <mijoryx@yahoo.com> - 2012-07-18 23:28 -0700
  Re: 3D in PS tlvp <mPiOsUcB.EtLlLvEp@att.net> - 2012-07-19 03:47 -0400
    Re: 3D in PS luser- -droog <mijoryx@yahoo.com> - 2012-07-20 20:43 -0700
      Re: 3D in PS tlvp <mPiOsUcB.EtLlLvEp@att.net> - 2012-07-21 01:27 -0400
        Re: 3D in PS luser- -droog <mijoryx@yahoo.com> - 2012-07-21 13:23 -0700
          Re: 3D in PS tlvp <mPiOsUcB.EtLlLvEp@att.net> - 2012-07-21 22:16 -0400
            Re: 3D in PS luser- -droog <mijoryx@yahoo.com> - 2012-07-22 02:40 -0700
              Re: 3D in PS tlvp <mPiOsUcB.EtLlLvEp@att.net> - 2012-07-23 03:23 -0400
                Re: 3D in PS luser- -droog <mijoryx@yahoo.com> - 2012-07-23 20:40 -0700
                Re: 3D in PS tlvp <mPiOsUcB.EtLlLvEp@att.net> - 2012-07-24 01:21 -0400
            Re: 3D in PS Bogus@Embarq.com (Steve) - 2012-07-22 11:23 +0000
  Re: 3D in PS gernot.hoffmann@hs-emden-leer.de - 2012-07-20 10:58 -0700
  Re: 3D in PS Herbert Voss <Herbert.Voss@alumni.tu-berlin.de> - 2012-08-08 15:48 +0200
    Re: 3D in PS Peter Billam <peter@www.pjb.com.au> - 2012-08-08 23:17 +0000
    Re: 3D in PS JohnF <john@please.see.sig.for.email.com> - 2012-08-09 01:28 +0000
      Re: 3D in PS Herbert Voss <Herbert.Voss@alumni.tu-berlin.de> - 2012-08-09 12:19 +0200
        Re: 3D in PS JohnF <john@please.see.sig.for.email.com> - 2012-08-10 05:05 +0000
    Re: 3D in PS tlvp <mPiOsUcB.EtLlLvEp@att.net> - 2012-08-08 21:57 -0400
  Re: 3D in PS luser- -droog <mijoryx@yahoo.com> - 2013-08-31 15:42 -0700
    Re: 3D in PS Mark Carroll <mtbc@bcs.org> - 2013-09-01 09:28 +0100
      Re: 3D in PS luser- -droog <mijoryx@yahoo.com> - 2013-09-13 22:17 -0700
    Re: 3D in PS luser- -droog <mijoryx@yahoo.com> - 2013-09-19 02:51 -0700

csiph-web