: ) wonderful world ( :

the metasyntactic variable

Archive for October 2008

EPSCrop doesn’t work everywhere

without comments

If previous Makefile doesn’t work for you, there’s another way of doing this:

%.png:  %.1
        gs -sFONTPATH=. -sFONTMAP=font.map -dSAFER -dBATCH \
        -dNOPAUSE -sDEVICE=ppmraw -dTextAlphaBits=4 \
        -r600 -sOutputFile=- -q $< -c showpage -c quit | \
        pnmcrop | pnmmargin -white 10 | pnmtopng > $@
        mogrify -resize 480x480! -antialias $@

 

 

where I copied cmr10.pfb into the working directory and

laptop% cat font.map
/cmr10 (cmr10.pfb) ;
laptop%

Written by grault

October 31, 2008 - 11:59 pm at October 31, 2008 - 11:59 pm

Posted in notes, random

synthetic handmade drawings

without comments

I’ve started to create little drawings explaining concepts. I chose MetaPost to experiment with. First of all I needed a Makefile:

FILES=test1 ms test2

all: ${FILES:%=%.png}

%.1: %.mp
        mpost $<

%.png:  %.1
        gs -sFONTPATH=. -dSAFER -dBATCH \
           -dNOPAUSE -sDEVICE=png16 -dEPSCrop \
           -r600 -dTextAlphaBits=4 -sOutputFile=$@ $<
        mogrify -resize 480x480! -antialias $@

clean:
        rm -rf ${FILES:%=%.log} ${FILES:%=%.mpx} ${FILES:%=%.png}

 

 

The output things were boring and I decided to spice them a little. I randomized the paths drawn.

primarydef dev perturbed pt =
  pt+(dev/2-(uniformdeviate dev),
      dev/2-(uniformdeviate dev))
enddef;

primarydef dev pperturbed pat =
  dev perturbed (point 0 of pat) ..
  controls (postcontrol 0 of pat) and
  for i=1 upto (length pat) - 1:
    hide (pair offset; offset := dev perturbed (0,0);)
    (offset + (precontrol i of pat)) ..
    offset + (point i of pat) ..
    controls (offset + (postcontrol i of pat)) and
  endfor
  (precontrol (length pat) of pat) ..
  dev perturbed (point (length pat) of pat)
enddef;

 

 

With these monsters you can do the followings (please find the corresponding code below each picture).

 

 

u=cm;
for i=1 upto 10:
    draw (.02u*i) pperturbed (fullcircle scaled (u*i));
endfor

 

 

u=cm;
for i=1 upto 10:
    draw (.05u*i) pperturbed (unitsquare scaled (u*i) shifted (-.5u*i,-.5u*i));
endfor

 

 

Combined images look like handmade ones, which is fun : ))

draw .3in pperturbed (fullcircle scaled 4in);
draw .5in pperturbed (unitsquare scaled 2in shifted (-in,-in));

 

 

Written by grault

October 29, 2008 - 12:14 am at October 29, 2008 - 12:14 am

Posted in notes, random

suggested book

without comments

The Road to Financial Freedom (Paperback)
by Bodo Schafer (Author) 

Publisher: Griffin Press; 2nd edition (2000)
ISBN-10: 1875401873 

.

Written by grault

October 24, 2008 - 3:38 pm at October 24, 2008 - 3:38 pm

Posted in notes