Idea for the next puzzle to present: draw pretty pictures using

• ```   require 'viewmat'
PP =: 1 : 'viewmat@:(u [: | j./~@:i:)'   NB.  The original  +&.*:/~@:i:  is much slower
f PP n```

where f is some short, elegant J verb and n a positive integer. Examples:

 f description png @ n=60 1 > filled in circle 2 = <. hollow circle 3 <.@:] Bullseye, delta-circumference = 1 4 m ([ * [: <. 0.5 + %~) ] Bullseye, delta-circumference = m 5 2 | <.@:] hard to describe; just try it with various n (10, 50, 100, 250) 6 0 = 5 | <.@:] similar to above, but the concentric circles more discernable 7 +/\@:] rainbow half-hyperbola, gradual descent. 8 (|. -@:,~    )~ rainbow full-hyperbola (inside-out circle) 9 (|. -@:,~@:-:)~ circle vs. hyperbola. 10 <./\ prism/double spectrum/double slit experiment/one dimensional circle 11 >./\ sunrise over the ocean 12 >./\@:] acute rainbow 13 _1     o.  ] concentrate 14 1     o. ] kinda like the m | <.@:] pictures 15 _1 <.@:o. ] i c u 16 _1 >.@:o. ] like the bullsyes, but delta-circumference isn't constant (the bands change widths) 17 [/\ _1 >.@:o. ] LSD sunrise 18 100 | 1000 *       ^. concentric rainbows 19 100 | 1000 *       ^.@:] kindergarten 21 100 | 1000 * (%:2) ^.  ] fractal thingummy 22 [: ?. <.@] paint splatter 23 ,/@:e.@:<.@:] DNA dance (n must be small -- try n=.20 and maximize the resulting plot window 24 =@:] It's for Victory! 25 |:@:(]/.)@:] valentine 26 |:@:(/: /.)@:] louvre 27 |:@:(/:~/.)@:] pyramid power 28 involte@:,~@:>:@:-:@:[ { ,@:] modern art (definition of involute) 29 (- >./@:,)@:involute@:,~@:>:@:-:@:[ { ,@:] modern art 2 30 !~ and in the darkness bind them 31 |~ compass 32 [ | !~ ring around the rosey 33 p..@:] cold front 34 [: |.@:|: 100 | 1000 * ] %~ ({.~_,#)@:p..@:] hallelujah 35 [: |: 100 | 1000 * p.. skipping stone

## Discussion

• Errors represented with [\] -- OlegKobchenko 2008-12-16 08:12:11

• Consider adding glwh to standardize picture size for screenshots. -- OlegKobchenko 2006-12-13 01:37:50

• As samples, pictures for smallest nice rectangular size of viewmat: 121, i.e. n=60 -- OlegKobchenko 2006-12-13 06:35:40

• Here is more compact thumbnail layout:
 1. filled in circle > 2. hollow circle = <. 3. Bullseye, delta-circumference = 1 <.@:] 4. Bullseye, delta-circumference = m m ([ * [: <. 0.5 + %~) ]
• -- OlegKobchenko 2006-12-13 06:50:08

Oleg provided a mechanism to save `viewmat` images to PNG files, so I feel that the following should generate all the image files for this table. However, it does not; I just get a bunch of empty white images.

Debugging indicates that it is probably a repaint/selected window issue. I do not know how to fix it.

```load 'viewmat media/platimg debug'
coinsert 'jgl2'

PP      =:  1 : 'viewmat@:(u [: | j./~@:i:)'
glqall  =:  (|. \$ [:glqpixels 0 0&,)@glqwh
glwh    =:  3 : 'wd''pmovex '',(+0 0,y-glqwh_jgl2_@\$@#)&.".wd''qformx'''

ppp     =:  dyad define           NB. Pretty picture print
wdreset''

". '(',y,') PP 60'

NB.  jvm_g_paint_jviewmat_ :: 0: ''
glwh 4 3*30
NB.  jvm_g_paint_jviewmat_ :: 0: ''

6!:3]0.5
(glqall'') writeimg jpath '~temp\pp\',x,'.png'
6!:3]0.5

wdreset''
)

A       =:  '>' ; '= <.' ; '<.@:]'                              NB.  Etc
B       =:  'filled_in_circle' ; 'hollow_circle' ; 'bullseye'   NB.  Etc

B ppp&.> A```

-- DanBron 2007-03-16 15:42:32 Well this steps into the uncharted treacherous territory of sync programmatic execution and async GUI. So I guess to do it like that, the use of timer might help. But that's an overkill.

I recommend using something that is proven and supported like the animate addon. You can designate each picture as a step in the animation. And all will be saved nicely in a series of files. I guess you could take it further by making code that will convert your boxed list of picture verbs into a script for animate automatically. Or have just one new animate script that will accept a list of picture verbs in some form and derive number of steps, etc. Maybe an Options dialog.

-- OlegKobchenko 2007-03-16 16:35:59

DanBron/Snippets/PrettyPictures (last edited 2008-12-16 08:12:11 by OlegKobchenko)