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.

enter image description here

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

\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.

share|improve this question
    
Please try to define the nodes outside of pscustom –  Marco Daniel Jul 22 '12 at 10:50
add comment

2 Answers

up vote 5 down vote accepted

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}
\usepackage{pstricks-add}

\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}

enter image description here

share|improve this answer
    
@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! –  I am who I say I am Aug 2 '12 at 16:28
add comment

This is the answer!

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

\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}
share|improve this answer
    
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. –  I am who I say I am 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). –  I am who I say I am Aug 2 '12 at 16:54
add comment

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.