我在 Metapost 中绘制了以下图表。如何使带有红色边缘的子图的顶点不连接到箭头。我得到的图表是
我希望顶点看起来像下图这样(顶点和与其连接的箭头之间有小空间)。非常感谢。
beginfig(1) ;
pair A[],L[],R[],N[],q[];
path p[];
A[1] := (0,2cm);
for i=2 upto 5:
A[i] := A[i-1] rotated -360/5;
endfor;
label.top(btex 1 etex, A[1]);
label.rt(btex 2 etex, A[2]);
label.bot(btex 3 etex, A[3]);
label.bot(btex 4 etex, A[4]);
label.lft(btex 5 etex, A[5]);
for i=1 upto 5:
q[i]:=A[i] rotated -36;
endfor;
q[6]:=0.5[A[1], A[4]];
for i=1 upto 6:
draw q[i] withpen pencircle scaled 2bp;
endfor;
for i=1 upto 5:
draw A[i] withpen pencircle scaled 2bp;
endfor;
N[1]:=0.5[A[1],A[4]];
N[2]:=1.5[A[5],N[1]];
N[3]:=0.5[A[5],N[1]];
p[1]:=A[1]..N[2]..A[4];
p[2]:=A[4]..N[3]..A[1];
draw p[1];
draw p[2];
drawarrow subpath(0,1) of p[1];
drawarrow subpath(0,0.2) of p[1];
drawarrow subpath(0,1.8) of p[1];
drawarrow subpath(0,1) of p[2];
drawarrow subpath(0,0.2) of p[2];
drawarrow subpath(0,1.8) of p[2];
N[1]:=0.5[A[2],A[5]];
N[2]:=0.5[A[1],N[1]];
p[3]:=A[2]..N[2]..A[5];
draw p[3];
drawarrow subpath(0,1.3) of p[3];
drawarrow subpath(0,0.5) of p[3];
drawarrow subpath(0,1.8) of p[3];
N[1]:=0.5[A[5],A[3]];
N[2]:=0.5[A[4],N[1]];
p[4]:=A[5]..N[2]..A[3];
draw p[4];
drawarrow subpath(0,0.8) of p[4];
drawarrow subpath(0,0.3) of p[4];
drawarrow subpath(0,1.8) of p[4];
p[5]:=A[3]..A[2];
draw p[5];
drawarrow subpath(0,0.5) of p[5];
drawarrow q[2]..A[2]..q[1] withcolor red;
drawarrow q[5]..A[1]..q[1] withcolor red;
drawarrow q[5]..A[5]..q[4] withcolor red;
drawarrow q[3]..A[4]..q[4] withcolor red;
drawarrow q[3]..A[3]..q[2] withcolor red;
drawarrow q[1].. p[1] intersectionpoint p[3] ..q[6] withcolor red;
drawarrow q[6].. p[3] intersectionpoint p[2] ..q[5] withcolor red;
drawarrow q[4].. p[4] intersectionpoint p[2] ..q[6] withcolor red;
drawarrow q[6].. p[4] intersectionpoint p[1] ..q[3] withcolor red;
endfig;
end
答案1
这是一个答案:我设计了你的顶点周围的圆圈,并使用了cutbefore
和cutafter
图元
beginfig(1) ;
pair A[],L[],R[],N[],q[];
path p[];
A[1] := (0,2cm);
for i=2 upto 5:
A[i] := A[i-1] rotated -360/5;
endfor;
label.top(btex 1 etex, A[1]);
label.rt(btex 2 etex, A[2]);
label.bot(btex 3 etex, A[3]);
label.bot(btex 4 etex, A[4]);
label.lft(btex 5 etex, A[5]);
for i=1 upto 5:
q[i]:=A[i] rotated -36;
endfor;
q[6]:=0.5[A[1], A[4]];
for i=1 upto 6:
draw q[i] withpen pencircle scaled 2bp;
endfor;
for i=1 upto 5:
draw A[i] withpen pencircle scaled 2bp;
endfor;
N[1]:=0.5[A[1],A[4]];
N[2]:=1.5[A[5],N[1]];
N[3]:=0.5[A[5],N[1]];
p[1]:=A[1]..N[2]..A[4];
p[2]:=A[4]..N[3]..A[1];
draw p[1];
draw p[2];
drawarrow subpath(0,1) of p[1];
drawarrow subpath(0,0.2) of p[1];
drawarrow subpath(0,1.8) of p[1];
drawarrow subpath(0,1) of p[2];
drawarrow subpath(0,0.2) of p[2];
drawarrow subpath(0,1.8) of p[2];
N[1]:=0.5[A[2],A[5]];
N[2]:=0.5[A[1],N[1]];
p[3]:=A[2]..N[2]..A[5];
draw p[3];
drawarrow subpath(0,1.3) of p[3];
drawarrow subpath(0,0.5) of p[3];
drawarrow subpath(0,1.8) of p[3];
N[1]:=0.5[A[5],A[3]];
N[2]:=0.5[A[4],N[1]];
p[4]:=A[5]..N[2]..A[3];
draw p[4];
drawarrow subpath(0,0.8) of p[4];
drawarrow subpath(0,0.3) of p[4];
drawarrow subpath(0,1.8) of p[4];
p[5]:=A[3]..A[2];
draw p[5];
drawarrow subpath(0,0.5) of p[5];
%circles that will create buffers around your vertice
path c[];
for i=1 upto 6 :
c[i]:= fullcircle scaled 4bp shifted q[i] ;
endfor
path r[];
r[1]:= q[2]..A[2]..q[1] ;
r[2]:= q[5]..A[1]..q[1] ;
r[3]:= q[5]..A[5]..q[4] ;
r[4]:= q[3]..A[4]..q[4] ;
r[5]:= q[3]..A[3]..q[2] ;
r[6]:= q[1].. p[1] intersectionpoint p[3] ..q[6] ;
r[7]:= q[6].. p[3] intersectionpoint p[2] ..q[5] ;
r[8]:= q[4].. p[4] intersectionpoint p[2] ..q[6] ;
r[9]:= q[6].. p[4] intersectionpoint p[1] ..q[3] ;
%cutafter and cutbefore cut path before and after a pair
drawarrow (r[1] cutbefore c[2] cutafter c[1]) withcolor red;
drawarrow (r[2] cutbefore c[5] cutafter c[1]) withcolor red;
drawarrow (r[3] cutbefore c[5] cutafter c[4]) withcolor red;
drawarrow (r[4] cutbefore c[3] cutafter c[4]) withcolor red;
drawarrow (r[5] cutbefore c[3] cutafter c[2]) withcolor red;
drawarrow (r[6] cutbefore c[1] cutafter c[6]) withcolor red;
drawarrow (r[7] cutbefore c[6] cutafter c[5]) withcolor red;
drawarrow (r[8] cutbefore c[4] cutafter c[6]) withcolor red;
drawarrow (r[9] cutbefore c[6] cutafter c[3]) withcolor red;
endfig ;
end