[Therion] area file defs
Georg Pacher
georg.pacher at gmail.com
Fri Sep 17 18:08:42 CEST 2010
On 16.09.2010 09:46, Andrew Atkinson wrote:
Hi!
> Thanks for the examples of code you have put on the wiki, it is
> helping me lots with my first play at altering the code. I have moved
> onto playing with the area defs.
>
I would recommend you to check out the included symbol definitions as
well, by downloading the therion source code. There in the directory
/therion/mpost you find all the symbol definitions. In the a_blocks_AUT
definition (in file uAUT.mp, only included since 5.3.3) you can change
the values for symbol_distance and scale_factor to achieve what you want...
Here's your code with two parameters, to change the distance between
blocks and the scale of the blocks:
def a_blocks_AMER (expr p) =
T:=identity;
pickup PenC;
path q, qq; q = bbox p;
picture tmp_pic;
symbol_distance:= 1.0;
scale_factor:= 1.0;
tmp_pic := image(
for i = xpart llcorner q step u*symbol_distance until xpart
urcorner q:
for j = ypart llcorner q step u*symbol_distance until ypart
urcorner q:
qq := punked
(((-.2u,-.2u)--(.2u,-.2u)--(.2u,.2u)--(-.2u,.2u)--cycle)
randomized (u/2))
scaled scale_factor
rotated uniformdeviate(360)
shifted ((i,j) randomized u);
if xpart (p intersectiontimes qq) < 0:
thclean qq;
thdraw qq;
fi;
endfor;
endfor;
);
clip tmp_pic to p;
draw tmp_pic;
enddef;
However, you have to be careful not to run into memory problems with
metapost when drawing lots of small blocks. That's why the a_blocks_AUT
defintion has some more code. It reduces the number of blocks which are
drawn and clipped afterwards.
> Andrew
Georg.
More information about the Therion
mailing list