# Why does \pscustom fail to fill the enclosed region?

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

\def\Major{3}% semi major
\def\Minor{2}% semi minor
\def\Xo{4}% distance from origin to ellipse center
\def\Theta{60}

\pstVerb
{
/Major \Major\space def
/Minor \Minor\space def
/Xo \Xo\space def
/Theta \Theta\space def
/PtX1 180 Theta sub cos Major mul Xo add def
/PtY1 180 Theta sub sin Minor mul def
/PtX2 -180 cos Major mul Xo add def
/PtY2 0 def
}

\begin{document}

\begin{pspicture}[showgrid](-\Major,-\Minor)(\Major,\Minor)
\psset{linecolor=red}
%\pscustom[fillstyle=solid,fillcolor=cyan]
{%
\pnode(!Xo 0){O}%
\pnode(!PtX1 PtY1){A}%
\pnode(!PtX2 PtY2){B}%
\psline(0,0)(0,0|A)(A)%
\psellipticarc[correctAngle=true,origin={O}](O)(!Major Minor){(A)}{(B)}%
\psline(B)(0,0)%
}
\end{pspicture}

\end{document}


Edit: I found almost the same issue here, the problem is that I still don't understand what Herbert answered there. In PSTricks manual, there are no detailed explanation about those topics.

-
Please try to define the nodes outside of pscustom –  Marco Daniel Jul 22 '12 at 10:50

I guess the problem is that the path is not a continous path that can be filled. Instead they are distinct line segments which are probably filled but not displayed since the result is a one dimensional object.

You can zoom in to see the problem on the corners. So fixing the order of that path such that there are no jumps seems like working. But I couldn't get the {(A)}{(B)} syntax working.

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

\def\Major{3}% semi major
\def\Minor{2}% semi minor
\def\Xo{4}% distance from origin to ellipse center
\def\Theta{60}

\pstVerb
{
/Major \Major\space def
/Minor \Minor\space def
/Xo \Xo\space def
/Theta \Theta\space def
/Alpha 180 Theta sub def
/PtX1 Alpha cos Major mul Xo add def
/PtY1 Alpha sin Minor mul def
/PtX2 Major neg Xo add def
/PtY2 0 def
}
\begin{document}
\begin{pspicture}[showgrid](0,-1)(3,2)
\psset{linecolor=red}
\pnode(!Xo 0){O}
\pnode(!PtX1 PtY1){A}
\pnode(!PtX2 PtY2){B}
\pscustom[fillstyle=solid,fillcolor=cyan]
{
\psline(B)(0,0)(0,0|A)(A)
\psellipticarc[correctAngle=false](O)(!Major Minor){!Alpha}{180}
\closepath
}
\end{pspicture}
\end{document}


-
@HiggsBoson Also I think origin=(O) is causing some other problems since we explicitly give the center as a coordinate though I'm not fluent in these. –  percusse Jul 22 '12 at 15:04
Use origin in \pscustom optional argument then it works! –  stalking is prohibited Aug 2 '12 at 16:28

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

\def\Major{3}% semi major
\def\Minor{2}% semi minor
\def\Xo{4}% distance from origin to ellipse center
\def\Theta{60}

\pstVerb
{
/Major \Major\space def
/Minor \Minor\space def
/Xo \Xo\space def
/Theta \Theta\space def
/PtX1 180 Theta sub cos Major mul Xo add def
/PtY1 180 Theta sub sin Minor mul def
/PtX2 -180 cos Major mul Xo add def
/PtY2 0 def
}

\begin{document}

\begin{pspicture}[showgrid](-\Major,-\Minor)(\Major,\Minor)
\psset{linecolor=red}
\pnode(!Xo 0){O}
\pnode(!PtX1 PtY1){A}
\pnode(!PtX2 PtY2){B}
\pnode(0,0){Origin}
\pscustom[fillstyle=solid,fillcolor=cyan,origin={O}]
{
\psline(Origin)(Origin|A)(A)
\psellipticarc[dimen=middle](O)(!Major Minor){(A)}{(B)}%middle must be set!
\closepath
}
\end{pspicture}

\end{document}

-
Still the result shouldn't be different since there is no active coordinate transformations. –  percusse Aug 2 '12 at 16:40
@percusse: origin in \pscustom is mandatory to calculate the arc angles. –  stalking is prohibited Aug 2 '12 at 16:48
But its also the name of the node so what gives? –  percusse Aug 2 '12 at 16:49
@percusse: Without origin={O} in \psellipticarc, the angle will be calculated relative to (0,0) rather than O which is (X0,0). –  stalking is prohibited Aug 2 '12 at 16:54