[Therion] metapost symbols
Stefan Oswald
stefan_oswald at gmx.at
Sun Jan 14 13:05:16 CET 2007
Hello,
here are the results of our Therion meeting yesterday;
An idea would be to add the factor for density/size of symbols in the source code and adjust these variables in the map editor by a -density {} command in the mapeditor\area\options. Also a -diameter {} command for block points would allow to change block size of each point individually.
#POINT BLOCK +size adjust (symbolsize)
code metapost
def p_blocks_UIS (expr pos,theta,sc,al)=
symbolsize:=1.0u; %Factor*u; Factor=size of the blocks
U:=(.5u,.5u);
T:=identity aligned al rotated theta scaled sc shifted pos;
pickup PenC;
thdraw (.0symbolsize,.0symbolsize)--(1.0symbolsize,-.5symbolsize)--(0.0symbolsize,-1.5symbolsize)--(-1.0symbolsize,-1.0symbolsize)--cycle;
thdraw (.5symbolsize,-.25symbolsize)--(1.0symbolsize,.5symbolsize)--(0.0symbolsize,1.5symbolsize)--(-0.5symbolsize,.5symbolsize);
thdraw (.0symbolsize,.0symbolsize)--(.0symbolsize,.5symbolsize)--(-1.5symbolsize,.5symbolsize)--(-1.5symbolsize,-0.5symbolsize)--(-0.5symbolsize,-0.5symbolsize);
enddef;
endcode
#AREA BLOCK +density adjust (distance)
code metapost
def a_blocks (expr p) =
distance:=1;
T:=identity;
pickup PenC;
path q, qq; q = bbox p;
picture tmp_pic;
uu := max(u, (xpart urcorner q - xpart llcorner q)/100, (ypart urcorner q - ypart llcorner q)/100);
tmp_pic := image(
for i = xpart llcorner q step distance*uu until xpart urcorner q:
for j = ypart llcorner q step distance*uu until ypart urcorner q:
qq := punked (((-.5uu,-.5uu)--(.5uu,-.5uu)--(.5uu,.5uu)--(-.5uu,.5uu)--cycle)
randomized (uu/2))
rotated uniformdeviate(360)
shifted ((i,j) randomized 1.0uu);
if xpart (p intersectiontimes qq) < 0:
thclean qq;
thdraw qq;
fi;
endfor;
endfor;
);
clip tmp_pic to p;
draw tmp_pic;
enddef;
endcode
greetings,
Stefan
More information about the Therion
mailing list