if known graphstyleloaded:endinput;else:graphstyleloaded:=1;fi

if unknown mode:  
mode:=smoke;
mode:=proof;
grayfont black;
slantfont slantlj; 
if unknown mag: 
mag=.2; 
fi fi

mode_setup;

designsize:=40pt#;   

r#:=20pt#;                % Radius der Link-Auschnitts-Scheibe 
rr#:=1.4r#;               % char 76-78
d#:=15pt#;                % -gon parameter  char 61-70
D#:=22.5pt#;              
D#:=d#;                   % char -81...
DD#:=D#/1.5;                 % char -111...

sur#:=5pt#;               % Char-Surround

thickness#:=.4pt#;   
THICKNESS#:=1pt#;

define_pixels(r,rr,d,D,DD,sur,thickness,THICKNESS);

pen linkpen; linkpen=pencircle scaled (THICKNESS + blacker);
pen diskpen; diskpen=pencircle scaled (thickness + blacker);
pen linepen; linepen=pencircle scaled (.5thickness + blacker);
pen pointpen; pointpen=pencircle scaled (2thickness + blacker);

path p,p[],q,q[];

let CUTDRAW=cutdraw; 
def cutdraw expr p=begingroup;interim autorounding:=0;CUTDRAW p;endgroup;
enddef;


def rotate=currentpicture:=currentpicture rotated 90;enddef;

def circlebetween(expr z,u)=
draw fullcircle scaled length(z-u) shifted .5[z,u];enddef;

def halfcirclebetween(expr z,u)=
draw halfcircle scaled length(z-u) shifted .5[z,u];enddef;

def begingraph(expr c,lw,rw,ht,dp)=
beginchar(c,lw+rw,ht,dp);
save p,q;path p,p[],q,q[];
LEFTWIDTH:=lw*hppp;
let ENDCHAR=endchar;save endchar;def endchar=
scantokens extra_ENDCHAR;extra_ENDCHAR:="";
currentpicture:=currentpicture shifted (LEFTWIDTH,0);
  vardef labels@#(text t) =if proofing>1: forsuffixes $=t:
  makelabel@#(str$,z$+(LEFTWIDTH,0)); endfor fi enddef;
    labels(range 0 thru 10);
ENDCHAR;enddef;
pickup linkpen;
enddef;
string extra_ENDCHAR;extra_ENDCHAR="";

def begingraphhc(expr c,r)= % Y-gon in circle, correct height.
begingraph(c,r,r,.5r,r);
r_fix:=r*hppp;
extra_ENDCHAR:="putincircle(2*r_fix);";
enddef;

def begingraphc(expr c,r)= % central in circle
begingraph(c,r,r,r,r);
r_fix:=r*hppp;
extra_ENDCHAR:="putincircle(2*r_fix);";
enddef;

def begingraphcb(expr c,r)= % central in circle in box with surround
begingraph(c,r+sur#,r+sur#,r,r);
r_fix:=r*hppp;
extra_ENDCHAR:="putincircle(2*r_fix);";
enddef;

def begingraphb(expr c,x,y)= % central in box
begingraph(c,x+sur#,x+sur#,y,y);
enddef;

def begingraphbb(expr c,lw,rw,ht,dp)= % in box with surround
begingraph(c,lw+sur#,rw+sur#,ht,dp);
enddef;

def putincircle(expr rad)=
cullit;
picture savepicture; savepicture:=currentpicture;
clearit;pickup nullpen;
drawdot (0,0) withpen pencircle scaled (rad);
undrawdot (0,0) withpen pencircle scaled (1.5*rad);
currentpicture:=currentpicture + savepicture;
cullit;
if proofing>0:
draw fullcircle scaled rad withpen linepen;fi
enddef;

disk#:=5pt#;
define_pixels(disk);

def drawdisk(expr z)=
pickup nullpen;
drawdot z withpen pencircle scaled disk;enddef;

def drawdisko(expr z)=
pickup nullpen;cullit;
unfilldraw fullcircle scaled disk shifted z;
cullit;pickup diskpen;
draw fullcircle scaled disk shifted z;
enddef;


