I want to make the regions bounded as eyes transparent and the other regions opaque with solid fill. Unfortunately, psellipse
(as well as pscircle
) does not move the current point to its starting point before stroking as already questioned by me here (click).
As a result, the rotated ellipses make the moveto
operation need extra transformation before and after invoking it. See the following code for more detailed information.
\documentclass[pstricks,border=12pt]{standalone}
\begin{document}
\begin{pspicture}[showgrid=false,dimen=m](6,8)
\pscustom[fillstyle=eofill,fillcolor=red,linewidth=3pt]
{
% head
\psellipse(3,4)(3,4)
% left eye
\translate(1.5,4.5)
\rotate{30}
\moveto(1,0)
\rotate{-30}
\translate(-1.5,-4.5)
\psellipse[rot=30](1.5,4.5)(1,1.5)
% right eye
\translate(4.5,4.5)
\rotate{-30}
\moveto(1,0)
\rotate{30}
\translate(-4.5,-4.5)
\psellipse[rot=-30](4.5,4.5)(1,1.5)
}
\end{pspicture}
\end{document}
My question is can you simplify the transformation steps, for example,
\translate(4.5,4.5)
\rotate{-30}
\moveto(1,0)
\rotate{30}
\translate(-4.5,-4.5)
to be a reusable operator such that I can save more keystrokes?
My effort
\documentclass[pstricks,border=12pt]{standalone}
\pstVerb
{
/PRE {dup cos exch sin} bind def
/XXX {neg 3 -1 roll mul 3 1 roll mul add} bind def
/YYY {exch 3 -1 roll mul 3 1 roll mul add} bind def
/ROT {PRE 4 copy XXX 5 1 roll YYY} bind def
}
\begin{document}
\begin{pspicture}[showgrid=false,dimen=m](6,8)
\pscustom[fillstyle=eofill,fillcolor=red,linewidth=3pt]
{
% head
\psellipse(3,4)(3,4)
% left eye
\moveto(!1 0 30 ROT 4.5 add exch 1.5 add exch)
\psellipse[rot=30](1.5,4.5)(1,1.5)
% right eye
\moveto(!1 0 -30 ROT 4.5 add exch 4.5 add exch)
\psellipse[rot=-30](4.5,4.5)(1,1.5)
}
\end{pspicture}
\end{document}
But it does not seem to be simpler significantly.
pscircle
andpsellipse
behave as their current implementation in which they do not move the current point to their starting point before stroking? In my opinion, this implementation just adds unnecessary complexity, what do you think?