# 如何画 Quiver


\begin{mpdefs}
u=10pt;
vardef pst(expr labdr)=
begingroup
os:=.7u;
pair odr;
if (labdr="u") :  odr:=os*up; fi;
if (labdr="d") :  odr:=os*down; fi;
if (labdr="l") :  odr:=os*left; fi;
if (labdr="r") :  odr:=os*right; fi;
endgroup;
odr
enddef;

vardef quiver(expr P, Q, labP, labQ, labPQ, pstP, pstQ) =
begingroup
os:=0.3u;
pair dr;
dr:=unitvector(Q-P);

pickup pencircle scaled 1pt;
drawarrow P+os*dr--Q-os*dr;

pickup pencircle scaled 1pt;
label(btex $\circ$ etex, P);
label(labP, pst(pstP)+P);
label(btex $\circ$ etex,Q);
label(labQ, pst(pstQ)+ Q);
label (labPQ, os*(dr rotated 90)+(P+Q)/2);
endgroup;
enddef;
\end{mpdefs}

this is a test \begin{mpdisplay}
z1=origin;
z2=3u*(down+right);
z3=z2+3u*(left+down);
z4=z3+6u*(up+left);
quiver(z1,z2,"1","2", btex $\alpha_1$ etex, "u", "r");
quiver(z2,z3,"2","3", btex $\alpha_2$ etex, "r", "d");
quiver(z3,z4,"3","4", btex $\alpha_3$ etex, "d", "l");
quiver(z4,z1,"4","1", btex $\alpha_4$ etex, "l", "u");
\end{mpdisplay}
and this is not right


This is just a basic idea, after a while, I find the following complete package METAGRAPH.