Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want to draw a batman logo. As it is symmetric about the vertical line, it should be more convenient to just define the right part (or the left part) first and then reflect it to get the other part. The important note you must consider is that the logo must be constructed by a closed curve that can be used as a clipping path.

According to pst-news13 on page 4, we have \reversepath that can be used to construct a curve in reversed coordinates.

Unfortunately, I failed to use \reversepath as shown in the following code.

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

enter image description here

So my question is how to use \reversepath in this case?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Having wasted much time for figuring out how \reversepath works, its behavior is now understood.

\reversepath affects the previous paths rather than the following paths (that most people probably assume). Its behavior is inconsistent with other macros (such as \scale, \translate, etc) defined for pscustom. It is one of many other inconsistency in PSTricks. But it is still fun!

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

enter image description here

share|improve this answer
    
And now Stiff Jokes will obtain a bounty from Stiff Jokes. ;-) –  Przemysław Scherwentke Dec 30 '13 at 10:16
    
@PrzemysławScherwentke: It is impossible for the current implementation of the StackExchange system. Stiff Jokes can only obtain a bounty from Steve Jobs or vice verse. –  Who is crazy first Dec 30 '13 at 12:21
    
No, this is not an inconsistency in PSTricks, but behaves like defined in the Postscript Language, see the redbook. –  Christoph May 16 at 19:54
    
@Christoph: OK. Thanks. –  Who is crazy first May 17 at 0:24

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.