다음 폐곡선을 그리는 데 \reversepath를 유용하게 만드는 방법은 무엇입니까?

다음 폐곡선을 그리는 데 \reversepath를 유용하게 만드는 방법은 무엇입니까?

배트맨 로고를 그리고 싶어요. 수직선을 기준으로 대칭이므로 오른쪽 부분(또는 왼쪽 부분)만 먼저 정의한 후 반영하여 다른 부분을 구하는 것이 더 편리할 것입니다. 고려해야 할 중요한 사항은 로고가 클리핑 경로로 사용될 수 있는 닫힌 곡선으로 구성되어야 한다는 것입니다.

pst-news134페이지 에 따르면 \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의 다른 많은 불일치 중 하나입니다. 하지만 여전히 재미있습니다!

\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}

여기에 이미지 설명을 입력하세요

관련 정보