我绘制了下图,显示了欧元符号:
% http://upload.wikimedia.org/wikipedia/commons/5/57/Euro_Construction.svg
\documentclass{article}
\usepackage{pstricks}
\usepackage{expl3}
\ExplSyntaxOn
\cs_new_eq:NN \calc \fp_eval:n
\ExplSyntaxOff
\begin{document}
\psset{
unit = 0.8,
linejoin = 1
}
\begin{pspicture}(-7.5,-6)(4.26,6)
\pscustom[
fillstyle = solid,
fillcolor = yellow!70
]{
\psline(\calc{6*sin(2*acot(6/5*sec(2/9*pi)+tan(2/9*pi)))},
\calc{6*cos(2*acot(6/5*sec(2/9*pi)+tan(2/9*pi)))})%
(\calc{5*cos(2/9*pi)},\calc{5*sin(2/9*pi)})
\psarc(0,0){5}{40}{\calc{90+round(acosd(3/10),9)}}
\psline(\calc{-sqrt(91)/2},1.5)%
(\calc{75/2*cos(2/9*pi)/(6+5*sin(2/9*pi))},1.5)%
(\calc{65/2*cos(2/9*pi)/(6+5*sin(2/9*pi))},0.5)%
(\calc{-3/2*sqrt(11)},0.5)
\psarc(0,0){5}%
{\calc{ 90+round(acosd(1/10),9)}}%
{\calc{270-round(acosd(1/10),9)}}
\psline(\calc{-3/2*sqrt(11)},-0.5)%
(\calc{55/2*cos(2/9*pi)/(6+5*sin(2/9*pi))},-0.5)%
(\calc{45/2*cos(2/9*pi)/(6+5*sin(2/9*pi))},-1.5)%
(\calc{-sqrt(91)/2},-1.5)
\psarc(0,0){5}{\calc{270-round(acosd(3/10),9)}}{320}
\psline(\calc{ 5*cos(2/9*pi)},\calc{-5*sin(2/9*pi)})%
(\calc{ 5*cos(2/9*pi)},\calc{-sqrt(36-25*cos(2/9*pi)^2)})
\psarcn(0,0){6}%
{\calc{270+round(atand(5*cos(2/9*pi)/sqrt(36-25*cos(2/9*pi)^2)),9)}}%
{\calc{270-round(acosd(1/4),9)}}
\psline(\calc{-6*cos(1/4)},-1.5)%
(-7.5,-1.5)%
(\calc{5*cos(2/9*pi)/(6+5*sin(2/9*pi))-15/2},-0.5)%
(\calc{-6*cos(1/12)},-0.5)
\psarcn(0,0){6}%
{\calc{270-round(acosd(1/12),9)}}%
{\calc{ 90+round(acosd(1/12),9)}}
\psline(\calc{-6*cos(1/12)},0.5)%
(-7.5,0.5)%
(\calc{5*cos(2/9*pi)/(6+5*sin(2/9*pi))-15/2},1.5)%
(\calc{-6*cos(1/4)},1.5)
\psarcn(0,0){6}%
{\calc{90+round(acosd(1/4),9)}}%
{\calc{round(atand(sec(2/9*pi)/10*(36-25*sin(1/18*pi)+60*sin(2/9*pi))%
/(6+5*sin(2/9*pi))),9)}}%
}
\end{pspicture}
\end{document}
有没有办法使用 PSTricks 绘制相同的图形,而无需所有硬编码值?
(请参阅链接以了解如何制作符号的几何构造。)
答案1
欧元符号是硬编码(http://en.wikipedia.org/wiki/File:EuroConstLarge.png)。但是,您可以简化它。可以省略两点之间的直线连接,\pscustom
默认情况下构建路径时会这样做:
\documentclass{minimal}
\usepackage{pstricks}
\begin{document}
\pstVerb{
/c40 {40 cos }bind def
/s40 {40 sin }bind def
/s65 {6 5 s40 mul add }bind def
}
\begin{pspicture}(-7.5,-7.5)(7.5,7.5)
\pscustom[fillstyle=solid,fillcolor=black!20]{%
\psarc(0,0){5}{40}{! 180 0.3 ATAN1 sub }
\psline(! 37.5 c40 mul s65 div 1.5)(! 32.5 c40 mul s65 div 0.5)
\psarc(0,0){5}{!180 0.1 ATAN1 sub}{!180 0.1 ATAN1 add}
\psline(! 27.5 c40 mul s65 div -0.5)(! 22.5 c40 mul s65 div -1.5)
\psarc(0,0){5}{!180 0.3 ATAN1 add}{320}
\psarcn(0,0){6}{! 270 5 c40 mul 36 25 c40 dup mul mul sub sqrt div ATAN1 add }
{! 270 0.25 Acos sub }
\psline(-7.5,-1.5)(!5 c40 mul s65 div 7.5 sub -0.5)
\psarcn(0,0){6}{!180 1 12 atan add}{!180 1 12 atan sub}
\psline(-7.5,0.5)(! 5 c40 mul s65 div 7.5 sub 1.5)
\psarcn(0,0){6}{!180 1.5 6 atan sub}
{! 1 c40 div 10 div 36 25 10 sin mul sub 60 s40 mul add mul s65 div ATAN1}
\closepath
}
\end{pspicture}
\end{document}
答案2
使用 MetaPost 的解决方案只需要半径。使用以下命令运行它context <file>
:
\starttext
\setupcolors[state=start]
\startuseMPgraphic{dummy}
boolean trace_euro ; trace_euro := false ;
vardef euro_symbol = image ( % begin_of_euro
if unknown euro_radius : euro_radius := 2cm; fi;
if unknown euro_width : euro_width := 3euro_radius/16; fi;
if unknown euro_r_offset : euro_r_offset:= euro_width; fi;
if unknown euro_l_offset : euro_l_offset := euro_radius/32 ; fi ;
if unknown euro_l_shift : euro_l_shift := euro_r_offset ; fi ;
if unknown euro_v_delta : euro_v_delta := euro_width/4 ; fi ;
save
outer_circle, inner_circle, hor_bar,
right_line, right_slant, top_slant, bot_slant,
euro_circle, euro_topbar, euro_botbar ;
path
outer_circle, inner_circle, hor_bar,
right_line, right_slant, top_slant, bot_slant,
euro_circle, euro_topbar, euro_botbar ;
outer_circle := fullcircle scaled euro_radius ;
inner_circle := fullcircle scaled (euro_radius-euro_width) ;
if trace_euro :
for i = outer_circle, inner_circle :
draw i withpen pencircle scaled 1pt withcolor .5white ;
endfor ;
fi ;
right_line := (lrcorner outer_circle -- urcorner outer_circle) shifted (-euro_r_offset,0) ;
outer_circle := outer_circle cutbefore right_line ;
right_slant := point 0 of outer_circle -- origin shifted (0,ypart lrcorner outer_circle) ;
euro_circle := buildcycle(outer_circle, right_line, reverse inner_circle, reverse right_slant) ;
hor_bar := (-euro_radius,0) -- (euro_radius,0) ;
top_slant := right_slant shifted (-euro_radius+euro_r_offset-euro_l_offset,0) ;
bot_slant := top_slant shifted (0,-euro_l_shift) ;
if trace_euro :
for i = right_line, right_slant, top_slant, bot_slant :
draw i withpen pencircle scaled 1pt withcolor .5white ;
endfor ;
fi ;
euro_topbar := buildcycle (top_slant, hor_bar shifted (0, euro_v_delta),
right_slant, hor_bar shifted (0, euro_v_delta+euro_width/2)) ;
euro_botbar := buildcycle (bot_slant, hor_bar shifted (0,-euro_v_delta),
right_slant, hor_bar shifted (0,-euro_v_delta-euro_width/2)) ;
for i = euro_circle, euro_topbar, euro_botbar :
draw i withpen pencircle scaled 0 ;
endfor ;
for i = euro_circle, euro_topbar, euro_botbar :
fill i withpen pencircle scaled 0 ;
endfor ;
if trace_euro :
drawpoints euro_circle withcolor red;
drawpoints euro_topbar withcolor green ;
drawpoints euro_botbar withcolor blue ;
fi ;
) enddef ; % end_of_euro
euro_radius := 4cm ; draw euro_symbol withcolor 0.8yellow ;
trace_euro := true ; draw euro_symbol shifted (5cm,0) ;
\stopuseMPgraphic
\useMPgraphic{dummy}
\stoptext