[pstricks] Calculer distances entre nœuds avec Pstricks
Herbert Voss
herbert49 at googlemail.com
Wed Sep 3 18:03:52 CEST 2008
agodemar schrieb:
> Thank you for this code above, but I think you understand now that my
> problem
> is a little bit more general: I would like to measure things coming
> from outside
> using psfrag and pstricks (and fp if necessary).
there is an easy but not short solution, you have to rewrite
the existing macros:
\psArc[options]{arrows}(center)(node B for radius A-B){alpha}{beta}
[options] and {arrows} are both optional.
Herbert
\documentclass[12pt,a4paper]{article}
\usepackage[dvips,svgnames,x11names]{pstricks}
\usepackage{pst-eucl}
\makeatletter
\def\psArc{\pst at object{psArc}}
\def\psArc at i{\@ifnextchar({\psArc at iii}{\psArc at ii}}
\def\psarc at ii#1{\addto at par{arrows=#1}%
\@ifnextchar({\psArc at iii}{\psArc at iii(0,0)}%
}
\def\psArc at iii(#1)(#2)#3#4{%
\begin at OpenObj
\pst at getangle{#3}\pst at tempa
\pst at getangle{#4}\pst at tempb
\ifx\pst at tempa\pst at tempb \else
\pst@@getcoor{#1}%
\addto at pscode{\psArc at iv{#1}{#2} \psarc at v}%
\gdef\psarc at type{0}%
\showpointsfalse
\fi
\end at OpenObj%
}
\def\psArc at iv#1#2{%
\pst at coor /y ED /x ED
/r \pstDistAB{#1}{#2} def
/c 57.2957 r \tx at Div def
/angleA
\pst at tempa
\psk at arcsepA c mul 2 div
\ifcase\psarc at type add \or sub \fi
def
/angleB
\pst at tempb
\psk at arcsepB c mul 2 div
\ifcase\psarc at type sub \or add \fi
def
\ifshowpoints\psarc at showpoints\fi
\ifx\psk at arrowA\@empty
\ifnum\psk at liftpen=2
r angleA \tx at PtoC
y add exch x add exch moveto
\fi
\fi}
\makeatother
\begin{document}
\begin{pspicture}[showgrid=true](-5,-5)(5,5)
\pnode(1,0){A}
\pnode(3,3){B}
\psArc(A)(B){215}{-40}
\qdisk(A){2pt}
\qdisk(B){2pt}
\end{pspicture}
\end{document}
More information about the PSTricks
mailing list