PSTricks 图中线条重叠严重

PSTricks 图中线条重叠严重

考虑以下代码(几乎与):

\documentclass{article}

\usepackage{pst-grad,pstricks-add}
\usepackage{animate}
\usepackage[locale=DE]{siunitx}

\def\radius{21.65}
\def\vinkelA{12 }
\pstFPdiv\faktor{1}{3}
\pstFPmul\faktorB{\radius}{\faktor}
\pstFPadd\faktorC{\faktorB}{0.05}
\pstFPadd\faktorD{\faktorB}{2.95}
\makeatletter
  \pst@getsinandcos{\vinkelA}
  \pstFPmul\RelRadius\faktor{\radius}
  \pstFPmul\PSTRadius{1.02}\RelRadius
  \pstFPmul\MaxLW\RelRadius\pst@sin
  \pstFPmul\MaxLW{2}{\MaxLW}
  \def\PolyLine{%
    \psarc(C){\RelRadius}{!90 \vinkelA add}{180}
    \psline(B)(A)(D)
    \psarc(C){\RelRadius}{0}{!90 \vinkelA sub}
  }

\def\light#1{% Sun beams.
\psset{
  unit=0.7
}
 \begin{pspicture}(-\faktorC,-\faktorC)(\faktorC,\faktorD)
   \pst@getsinandcos{#1}
     \ifnum #1 = 90 \let\RelLW\MaxLW
   \else
     \ifnum #1 > 90 \pstFPmul\RelLW{\MaxLW}{\pst@cos}
     \else          \pstFPmul\RelLW{\MaxLW}{\pst@sin}
     \fi
   \fi
   \pnode(-\RelRadius,-\RelRadius){A}
   \pnode(-\RelRadius,0){B}
   \pnode(0,0){C}
   \pnode(\RelRadius,-\RelRadius){D}
   \pnode(!0 \RelRadius\space \vinkelA cos mul){T1}
   % Filling
   \pscustom[
     linewidth=2pt,
     linecolor=red,
     fillstyle=gradient,
     gradbegin=blue!5,
     gradmidpoint=1,
     gradend=blue!35
   ]{\PolyLine}
   \begin{psclip}{% Clipping.
     \pscustom[
       linestyle=none,
       dimen=inner
     ]{%
     \PolyLine
     \psline(\RelRadius,\RelRadius)(!\RelRadius\space dup 3 add)%
            (!\RelRadius\space dup neg exch 3 add)(-\RelRadius,\RelRadius)
     }
   }
   \rput(!0 \RelRadius\space \vinkelA cos mul){%
     \pcline[
       linecolor=yellow,
       linewidth=\RelLW,
       nodesep=-\radius
     ](0,0)(!#1 dup 90 ne {-1 exch neg Tan neg} {0 -1} ifelse)}
   \end{psclip}
   \pscustom[
     linewidth=2pt,
     linecolor=red
   ]{\PolyLine}% Better clipping.
   \psline[
     linestyle=dotted
   ]({-\RelRadius,0}|T1)({\RelRadius,0}|T1)
   \rput(!\RelRadius\space 90 \vinkelA sub PtoC){%
     \pswedge(0,0){1}{!180 #1 sub}{180}
     \uput{1}[!180 #1 2 div sub](0,0){\footnotesize \SI{#1}{\degree}}
     \psline[
       linestyle=dotted
     ](0,0)(!3 180 #1 sub PtoC)
   }
 \end{pspicture}
}

\begin{document}

\begin{animateinline}[poster=first,controls,palindrome]{2}
  \multiframe{121}{iA=30+1}{\light{\iA}}
\end{animateinline}

\end{document}

输出

我不喜欢红色曲线“击中”黄色区域的方式;我该如何改善这种情况?(我不太确定我想要什么,但我会告诉您给出的答案是否是我正在寻找的。)

PS 请随意添加更多标签。

答案1

\documentclass{article}

\usepackage{pst-grad,pstricks-add}
\usepackage{animate}
\usepackage[locale=DE]{siunitx}

\def\radius{21.65}
\def\vinkelA{12 }
\pstFPdiv\faktor{1}{3}
\pstFPmul\faktorB{\radius}{\faktor}
\pstFPadd\faktorC{\faktorB}{0.05}
\pstFPadd\faktorD{\faktorB}{2.95}
\makeatletter
  \pst@getsinandcos{\vinkelA}
  \pstFPmul\RelRadius\faktor{\radius}
  \pstFPmul\PSTRadius{1.02}\RelRadius
  \pstFPmul\MaxLW\RelRadius\pst@sin
  \pstFPmul\MaxLW{2}{\MaxLW}
\newcommand\PolyLine[1][\vinkelA]{%
  \psarc(C){!\RelRadius}{!90 #1 add}{180}
  \psline(B)(A)(D)
  \psarc(C){!\RelRadius}{0}{!90 #1 sub}}

\def\light#1{% Sun beams.
\psset{unit=0.7}
 \begin{pspicture}(-\faktorC,-\faktorC)(\faktorC,\faktorD)
   \pst@getsinandcos{#1}
     \ifnum #1 = 90 \let\RelLW\MaxLW
   \else
     \ifnum #1 > 90 \pstFPmul\RelLW{\MaxLW}{\pst@cos}
     \else          \pstFPmul\RelLW{\MaxLW}{\pst@sin}
     \fi
   \fi
   \pnodes(-\RelRadius,-\RelRadius){A}(-\RelRadius,0){B}(0,0){C}%
          (\RelRadius,-\RelRadius){D}(!0 \RelRadius\space \vinkelA cos mul){T1}
   % Filling
   \pscustom[
     linestyle=none,
     fillstyle=gradient,
     gradbegin=blue!5,gradmidpoint=1,gradend=blue!35]{\PolyLine}
   \pscustom[linewidth=2pt,linecolor=red]{\PolyLine[0]}
     \typeout{====\RelRadius}%
   \begin{psclip}{% Clipping.
     \pscustom[linestyle=none,dimen=inner]{%
       {\edef\RelRadius{\RelRadius\space CLW \pst@number\psrunit div sub}%
        \PolyLine}
       \psline[linewidth=2pt](\RelRadius,\RelRadius)(!\RelRadius\space dup 3 add)%
              (!\RelRadius\space dup neg exch 3 add)(-\RelRadius,\RelRadius)
     }
   }
   \rput(!0 \RelRadius\space \vinkelA cos mul){%
     \pcline[linecolor=yellow,linewidth=\RelLW,nodesep=-\radius
     ](0,0)(!#1 dup 90 ne {-1 exch neg Tan neg} {0 -1} ifelse)}
   \end{psclip}
   \psline[linestyle=dotted]({-\RelRadius,0}|T1)({\RelRadius,0}|T1)
   \rput(!\RelRadius\space 90 \vinkelA sub PtoC){%
     \pswedge(0,0){1}{!180 #1 sub}{180}
     \uput{1}[!180 #1 2 div sub](0,0){\footnotesize \SI{#1}{\degree}}
     \psline[linestyle=dotted](0,0)(!3 180 #1 sub PtoC)
   }
 \end{pspicture}
}

\begin{document}

\begin{animateinline}[poster=first,controls,palindrome]{2}
  \multiframe{121}{iA=30+1}{\light{\iA}}
\end{animateinline}

\end{document}

在此处输入图片描述

相关内容