# Why does the objects get shifted to the left when using clipping?

Without clipping, the output position is correct:

With clipping, the output position is wrong as it gets shifted to the left:

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

\psset
{
unit=0.8cm,
runit=\psunit,
fillstyle=solid,
PointName=none,
PointSymbol=none,
}

\pstVerb
{
true setglobal
globaldict begin
/theta 76 def
/Major 6.0 def
/Minor 3.3 def
/p2c {dup 3 1 roll cos mul 3 1 roll sin mul} bind def
end
false setglobal
}

\def\DeclareNodes
{%
\pstGeonode
(0,-8){Bottom}%
(0,8){Top}%
(0,0){center}%
(0,2.7){A}%
(0.5,2.7){B}%
(1,3.25){C}%
(1.2,1.3){D}%
(1.3,1.0){E}%
(2.0,1.0){F}%
(3.0,1.0){G}%
(3.0,2.2){H}%
(!Minor Major theta p2c){I}%
(!Minor Major theta neg p2c){J}%
(4,-2){K}%
(4,0){L}%
(2.2,-1.8){M}%
(1.5,-1){N}%
(1,-1){O}%
(0,-3.2){P}%
\pstOrtSym{Bottom}{Top}{B,C,D,E,F,G,H,I,J,K,L,M,N,O}%
}

\def\RightPart
{%
\psline(A)(B)(C)%
\psbezier(D)(E)(F)%
\psbezier(G)(H)(I)%
\psellipticarcn[dimen=middle](center)(!Major Minor){(I)}{(J)}%middle must be set!
\psbezier(K)(L)(M)%
\psbezier(N)(O)(P)%
}

\def\LeftPart
{%
\psbezier(O')(N')(M')%
\psbezier(L')(K')(J')%
\psellipticarcn[dimen=middle](center)(!Major Minor){(J')}{(I')}%middle must be set!
\psbezier(H')(G')(F')%
\psbezier(E')(D')(C')%
\psline(B')%
}%

\begin{document}

\begin{pspicture}[showgrid=top](-7,-4)(7,4)
\DeclareNodes
\pscustom*{\RightPart\LeftPart\closepath}
\end{pspicture}

\begin{pspicture}[showgrid=top](-7,-4)(7,4)
\DeclareNodes
\begin{psclip}{\pscustom[linestyle=none]{\RightPart\LeftPart\closepath}}
\psframe*(-7.5,-5)(7.5,5)
\end{psclip}
\end{pspicture}

\end{document}

-
No idea about PSTricks, but in TikZ this is usually because the bounding box includes the control points of bezier curves which makes it a bit bigger than the curve itself. If these are outside the clipping region, then clipping will change the bounding box. If the position is computed from the bounding box, it will then be changed. But this is all conjecture. – Loop Space Aug 2 '12 at 15:53
Not only the position is wrong, there are other details with introduce a small asymetry. Look at the right ear of the bat and the tip of the corresponding wing. Perhaps it is only a rendering problem? – JLDiaz Aug 4 '12 at 17:52
I get no shift after applying JLDiaz's correction. But pst-eucl has changed in the meantime. – egreg Dec 22 '13 at 16:43
@egreg: Because a bug in showgrid has been fixed. See the edit history. :-) – kiss my armpit Dec 22 '13 at 16:50

Disclaimer: I don't use pstricks nor I am able to understand the PostScript code you used to draw the batman figure, but nevertheless I think I can provide some clues about the problems with your example.

As said in a comment, shifting is not the only difference in the second figure, also an asymmetry is introduced. I thought that perhaps that was due to the declaration of the nodes before the clipping, so I tried moving the declaration of the nodes inside the psclip, like this:

\begin{pspicture}[showgrid=top](-7,-4)(7,4)
\begin{psclip}{\DeclareNodes\pscustom[linestyle=none]{\RightPart\LeftPart\closepath}}
\psframe*(-7.5,-5)(7.5,5)
\end{psclip}
\end{pspicture}


With this, the asymmetry disappeared, but the shifting to the left became a small shifting to the right. I'm not sure about this because, for some unknown reason, I don't get the grid overimposed on the figures, so it is difficult to compare them.

This is what I get (I put \fbox around the grid to help myself):

Note that in my output an asymmetry is already present in the first figure, but the second one is identical (with \DeclareNodes before psclip the asymmetry was even more pronunced in the second figure).

-