9

I'm trying to get rid of the middle line. Whatever changes I make it seems that I make it worse. I would appreciate it if anyone could show me how to draw this cobordism properly.

\begin{pspicture}
  \pscustom{
         \psbezier[showpoints=true](1.5,2.5)(1.5,1.1)(.4,1.6)(.5,0)
         \psline(-0.5,0)
         \psbezier[showpoints=true](-0.5,0)(-.4,1.6)(-1.5,1.1)(-1.5,2.5)
         \psline(-.5,2.5)
         \psbezier[showpoints=true](-.5,2.5)(-.6,1.5)(0.6,1.5)(.5,2.5)
         \psline(1.5,2.5)}
\end{pspicture}

cob

  • You need to use liftpen. – kiss my armpit Dec 29 '13 at 10:54
  • Thanks. I've accepted your answer. Herbert's answer was also very useful. So, thank you both. – user43334 Dec 29 '13 at 13:00
7

Normal method

\documentclass[pstricks,border=12pt]{standalone}


\begin{document}
\begin{pspicture}[showgrid=true](-2,-1)(2,3)
    \pscustom
    {
        \psset{showpoints}
        \psbezier(1.5,2.5)(1.5,1.1)(.4,1.6)(.5,0)
        \psbezier(-.5,0)(-.4,1.6)(-1.5,1.1)(-1.5,2.5)
        \psbezier[liftpen=1](-.5,2.5)(-.6,1.5)(.6,1.5)(.5,2.5)
        \closepath
    }
\end{pspicture}
\end{document}

enter image description here

Abnormal method

Symmetrical properties are taken into account with \reversepath, \scale, etc. Unfortunately, \nodexn and (!N-<nodename>.x N-<nodename>.y) cannot be used together here so the code become too complicated.

\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-eucl}
\psset{saveNodeCoors}

\begin{document}

\begin{pspicture}[showgrid=true](-2,-1)(2,3)
\pstGeonode[PointName=none,PointSymbol=none]
    (.5,2.5){A}
    (.6,1.5){B}
    (-.6,1.5){C}
    (-.5,2.5){D}
    % P = (A + B)/2
    (!N-A.x N-B.x add 2 div N-A.y N-B.y add 2 div){P}
    % Q = ((A + C)/2 + B)/2
    (!N-A.x N-C.x add 2 div N-A.y N-C.y add 2 div N-B.y add 2 div exch N-B.x add 2 div exch){Q}
    % R = (A + D + 3(B + C))/8
    (!N-A.x N-D.x add N-B.x N-C.x add 3 mul add 8 div N-A.y N-D.y add N-B.y N-C.y add 3 mul add 8 div){R}
\def\path
{
    \psbezier(.5,0)(.4,1.6)(1.5,1.1)(1.5,2.5)
    \psbezier[liftpen=1](!N-A.x N-A.y)(!N-P.x N-P.y)(!N-Q.x N-Q.y)(!N-R.x N-R.y)
}%
\pscustom
{
    \psset{showpoints}
    \path   
    \reversepath
    \scale{-1 1}    
    \path
    \closepath
}
\end{pspicture}
\end{document}

enter image description here

Warning!

(<nodename>) and (!\pstGetNodeCenter{<nodename>} <nodename>.x <nodename>.y) cannot be scaled by \scale{}. That is why I use (!N-<nodename>.x N-<nodename>.y) here.

6

Inside \pscustom only the first \psbezier has four points, for all others the current point is the first bezier point, too:

\documentclass[border=5mm]{standalone}
\usepackage{pstricks}
\begin{document}

\begin{pspicture}(-2,0)(2,2.5)
\pscustom{
         \psbezier[showpoints](1.5,2.5)(1.5,1.1)(.4,1.6)(.5,0)% 4 points
         \psline(-0.5,0)%% is also the first bezier point for the next \psbezier
         \psbezier[showpoints](-.4,1.6)(-1.5,1.1)(-1.5,2.5)% three
         \psline(-.5,2.5)
         \psbezier[showpoints](-.6,1.5)(0.6,1.5)(.5,2.5)% three
         \closepath
}
\end{pspicture}
\end{document}

enter image description here

If you use 4 points then there is no need for the \psline but one liftpen option:

\documentclass[border=5mm]{standalone}
\usepackage{pstricks}
\begin{document}

\begin{pspicture}(-2,0)(2,2.5)
\pscustom{
         \psbezier[showpoints](1.5,2.5)(1.5,1.1)(.4,1.6)(.5,0)
         \psbezier[showpoints](-0.5,0)(-.4,1.6)(-1.5,1.1)(-1.5,2.5)
         \psbezier[showpoints,liftpen=1](-.5,2.5)(-.6,1.5)(0.6,1.5)(.5,2.5)
         \closepath
}
\end{pspicture}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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