我尝试分配\i*\pstAngleAOB{A'}{T}{B'}/10
而不是手动计算的值\i*16.626
,RotAngle
如下例所示(参见注释的行)。
平均能量损失
\documentclass[pstricks,border=12pt,12pt]{standalone}
\usepackage{pst-geometrictools}
\usepackage{pst-eucl}
\usepackage{pst-calculate}
\usepackage{pgffor}
\def\offset{30}
\begin{document}
\foreach \i in {0,...,10}{%
\begin{pspicture}[showgrid,linewidth=2pt](-6,-4)(6,7)
\pstGeonode(0,3){T}(-4,0){A}(4,0){B}
\psset{PointName=none,PointSymbol=none}
\pstRotation[RotAngle=-\offset]{T}{A}[A']
\pstRotation[RotAngle=\offset]{T}{B}[B']
% --------------------------------------------------
% I don't like the manually-calculated value 16.626
\pstRotation[RotAngle=\pscalculate{\i*16.626}]{T}{A'}[U]
% I want to use the following but it does not compile.
%\pstRotation[RotAngle=\pscalculate{\i*\pstAngleAOB{A'}{T}{B'}/10}]{T}{A'}[U]
% --------------------------------------------------
\pstArcOAB{T}{A'}{U}
\psCompass{}(T)(U)
\end{pspicture}}
\end{document}
\pstAngleAOB
如何使用 to传递代数表达式RotAngle
?
注意:为了了解其他绘图包(Asymptote、TikZ、Metapost 等)中是否有优雅的技巧或内置宏,请随意提交这些包。
答案1
RotAngle的值直接用作PS代码:
\documentclass[pstricks,border=12pt,12pt]{standalone}
\usepackage{pst-geometrictools}
\usepackage{pst-eucl}
\usepackage{pst-calculate}
\def\offset{30}
\begin{document}
\pgfforeach \i in {0,...,10}{%
\begin{pspicture}[showgrid,linewidth=2pt](-6,-4)(6,7)
\pstGeonode(0,3){T}(-4,0){A}(4,0){B}
\psset{PointName=none,PointSymbol=none}
\pstRotation[RotAngle=-\offset]{T}{A}[A']
\pstRotation[RotAngle=\offset]{T}{B}[B']
\pstRotation[RotAngle={\pstAngleAOB{A'}{T}{B'} 10 div \i\space mul}]{T}{A'}[U]
\pstArcOAB{T}{A'}{U}
\psCompass{}(T)(U)
\end{pspicture}}
\end{document}