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.

The following figure shows the problem. The corners that are magnified should be smooth (not smooth defined in mathematics).

I have changed liftpen from 0 to 2, but the problem still exists.

How to smooth the corners?

enter image description here

\documentclass{article}
\usepackage{pstricks-add}

\usepackage[active,tightpage]{preview}
\PreviewEnvironment{pspicture}
\PreviewBorder=15pt

\psset{unit=1.5cm}
\begin{document}
\begin{pspicture}[showgrid=false](-7,-5)(7,5)
    \psellipse[fillstyle=solid,opacity=0.75,fillcolor=yellow](0,0)(7.0,4.3)
    \psellipse[linewidth=0.5,dimen=middle](0,0)(6.5,3.8)
    \def\left{
        \pscustom*[fillstyle=solid,linewidth=0.1]{
        \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)(2,3.1)
        % How to smooth the corner between the previous path and the next path?
        \psellipticarcn(0,0)(6.0,3.3){!3.1 2 atan}{!-2.8 3.2 atan}
        \psbezier(4,-2)(4,0)(2.2,-1.8)
        \psbezier(1.5,-1)(1,-1)(0,-3.2)
    }}\left
        \psscalebox{-1 1}{\left}
\end{pspicture}
\end{document}
share|improve this question
    
are you looking for the optional argument linejoin=1 ? –  Herbert Mar 10 '12 at 19:13
    
You have a problem with your path as Werner already pointed out. The end of \psbezier and the beginnung of \psellipticarc is connected by a line! –  Herbert Mar 11 '12 at 6:39
    
@Damian: I do not understand what you mean? \psbezier needs four points. Only in \pscustom the first one is the current point. –  Herbert Mar 11 '12 at 7:10
    
@Damin: sure, you can take the last point for calculating the start angle, but your last point of \psbezier is inside the elliptic arc, the reason why you always have to connect the points. –  Herbert Mar 11 '12 at 7:31
    
@Damin: Again: that is not the source of the problem. The source is your last point which is inside the elliptic arc and not on the arc. –  Herbert Mar 11 '12 at 10:57

3 Answers 3

One approach is to group lines and curves within a \pscustom command: all the pieces now form a unique line. For example

\documentclass{standalone}
\usepackage{pstricks-add}

\begin{document}
\begin{pspicture}(0,0)(2,2)

\psline[linecolor=red](0,0.5)(1,1.5)
\psline[linecolor=red](1,1.5)(0,1.5)

\pscustom{
    \psline(0,0)(1,1)
    \psline(1,1)(0,1)
}

\end{pspicture}
\end{document

The result is

enter image description here

share|improve this answer
    
There is no need for \pscustom, linejoin does it already –  Herbert Mar 10 '12 at 19:14
    
@Herbert: Can you please include an example of linejoin that is not within \pscustom. My understanding of the documentation requires that setting to be specified for use in a \pscustom command. This can be done in two ways: in a \codecommand with the PostScript setlinejoin or by redefining some commands. Either way, the simplest approach is to just place things within a \pscustom command. –  Frédéric Mar 10 '12 at 22:04
    
@Frédéric: there is a misunderstanding: I meant that in your example a \psline(0,0)(1,1)(0,1) would already use an internal setting of linejoin –  Herbert Mar 11 '12 at 6:36
    
@Damian: no reason to downvote it ... –  Herbert Mar 11 '12 at 8:26
    
@Herbert: Thanks for your comment. I had kept the two line segments separate to show what \pscustom does. –  Frédéric Mar 11 '12 at 21:37

The clipping path of \psellipticarc[n] (I think) does not properly join with the former constructs. Otherwise, including linejoin=1 as part of your \pscustom options (see section L.8 Line connections, p 304 of the pstricks documentation). Here I've just extended the \psbezier to line up with \psellipticarcn better, causing the illusion that it worked. Herbert will be able to find out what the actual problem is, I'm sure:

enter image description here

\documentclass{article}
\usepackage{pstricks-add}% http://ctan.org/pkg/pstricks-add
\usepackage[active,tightpage]{preview}% http://ctan.org/pkg/preview
\PreviewEnvironment{pspicture}
\PreviewBorder=15pt

\psset{unit=1.5cm}
\begin{document}
\begin{pspicture}[showgrid=false](-7,-5)(7,5)
  \psellipse[fillstyle=solid,opacity=0.75,fillcolor=yellow](0,0)(7.0,4.3)
  \psellipse[linewidth=0.5,dimen=middle](0,0)(6.5,3.8)
  \def\left{%
    \pscustom*[fillstyle=solid,linewidth=0.1]{%
      \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)(2,3.1112)% Modified last coordinate from (2,3.1)
      \psellipticarcn(0,0)(6.0,3.3){!3.1 2 atan}{!-2.8 3.2 atan}
      \psbezier(4,-2)(4,0)(2.2,-1.8)
      \psbezier(1.5,-1)(1,-1)(0,-3.2)
    }%
  }%
  \left
  \psscalebox{-1 1}{\left}% right
\end{pspicture}
\end{document}
share|improve this answer
up vote 1 down vote accepted

Based on Herbert's comment in many places, here is the solution:

Pass correctAngle=false,dimen=middle options to \psellipticarcn and make the last point of Bezier coincide with the first point of elliptic arc.

\documentclass{article}
\usepackage{pstricks-add}

\usepackage[active,tightpage]{preview}
\PreviewEnvironment{pspicture}
\PreviewBorder=15pt


\begin{document}
\begin{pspicture}[showgrid=false](-7,-5)(7,5)
    \psellipse[fillstyle=solid,opacity=0.75,fillcolor=yellow](0,0)(7.0,4.3)
    \psellipse[linewidth=0.5,dimen=middle](0,0)(6.5,3.8)
    \def\left{
        \pscustom[fillstyle=solid,linewidth=2pt,linecolor=red,fillcolor=black]{
        \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)(!76 cos 6 mul 76 sin 3.3 mul)
        \psellipticarcn[correctAngle=false,dimen=middle](0,0)(6.0,3.3){76}{-76}
        \psbezier(4,-2)(4,0)(2.2,-1.8)
        \psbezier(1.5,-1)(1,-1)(0,-3.2)
    }}\left
        \psscalebox{-1 1}{\left}
\end{pspicture}
\end{document}
share|improve this answer

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.