
バットマンのロゴを描きたいです。垂直線を中心に対称なので、最初に右側部分 (または左側部分) を定義し、それを反転して他の部分を取得する方が便利です。考慮すべき重要な点は、ロゴはクリッピング パスとして使用できる閉じた曲線で構築する必要があることです。
pst-news13
4 ページによると、\reversepath
逆座標で曲線を作成するために使用できるものがあります。
\reversepath
残念ながら、次のコードに示すように使用できませんでした。
\documentclass[pstricks,border=6pt]{standalone}
\SpecialCoor
\pstVerb
{
/theta 72 def
/Major 6.0 def
/Minor 3.3 def
% b a t p2c ---> x y
% where b (semi-minor), a (semi-major), t (theta)
/p2c {dup 3 1 roll cos mul 3 1 roll sin mul} bind def
}
\def\RightPart
{
\psline(0,2.7)(0.5,2.7)(1,3.25)
\psbezier(1.2,1.3)(1.3,1.0)(2.0,1.0)
\psbezier(3.0,1.0)(3.0,2.2)(!Minor Major theta p2c)
\psellipticarcn(0,0)(!Major Minor){(!Minor Major theta p2c)}{(!Minor Major theta neg p2c)}
\psbezier(4,-2)(4,0)(2.2,-1.8)
\psbezier(1.5,-1)(1,-1)(0,-3.2)
}
\def\LeftPart
{
\scale{-1 1}
\reversepath
\psbezier(1.5,-1)(1,-1)(0,-3.2)
\psbezier(4,-2)(4,0)(2.2,-1.8)
\psellipticarcn(0,0)(!Major Minor){(!Minor Major theta p2c)}{(!Minor Major theta neg p2c)}
\psbezier(3.0,1.0)(3.0,2.2)(!Minor Major theta p2c)
\psbezier(1.2,1.3)(1.3,1.0)(2.0,1.0)
\psline(0,2.7)(0.5,2.7)(1,3.25)
\closepath
}
\begin{document}
\begin{pspicture}[showgrid=false](-7.85,-4.85)(7.85,4.85)
\pscustom[dimen=middle]{\RightPart}
\end{pspicture}
\begin{pspicture}[showgrid=false](-7.85,-4.85)(7.85,4.85)
\pscustom[dimen=middle]{\LeftPart}
\end{pspicture}
\begin{pspicture}[showgrid=false](-7.85,-4.85)(7.85,4.85)
\pscustom[dimen=middle,fillstyle=solid,fillcolor=red]{\RightPart\LeftPart}
\end{pspicture}
\end{document}
\reversepath
私の質問は、この場合どのように使用すればよいかということです。
答え1
仕組みを理解するのに多くの時間を費やしましたが\reversepath
、今ではその動作が理解できました。
\reversepath
は、(ほとんどの人が想定している) 後続のパスではなく、前のパスに影響します。その動作は、 に定義されている他のマクロ (、など\scale
)\translate
とは一貫性がありませんpscustom
。これは、PSTricks における他の多くの一貫性のない動作の 1 つです。しかし、それでも楽しいものです。
\documentclass[pstricks,border=12pt]{standalone}
% b a t p2c ---> x y
% where b (semi-minor), a (semi-major), t (theta)
\pstVerb{/p2c {dup 3 1 roll cos mul 3 1 roll sin mul} bind def}
\def\RightPart
{
\psline(0.5,2.7)(1,3.25)
\psbezier(1.2,1.3)(1.3,1.0)(2.0,1.0)
\psbezier(3.0,1.0)(3.0,2.2)(!3.3 6.0 72 p2c)
\psellipticarcn(6.0,3.3){(!3.3 6.0 72 p2c)}{(!3.3 6.0 72 neg p2c)}
\psbezier(4,-2)(4,0)(2.2,-1.8)
\psbezier(1.5,-1)(1,-1)(0,-3.2)
}
\begin{document}
\begin{pspicture}[showgrid](-7,-4)(7,4)
\pscustom[dimen=middle,fillstyle=solid,fillcolor=orange,linewidth=6pt]
{
\RightPart
\reversepath
\scale{-1 1}
\RightPart
\closepath
}
\end{pspicture}
\end{document}