[pstricks] pst-eucl: Drawing an angle

Claus Behl claus at bempf.de
Tue Jan 18 13:43:43 CET 2005


Hi,

im using pst-eucl for simple geometrical Drawings at school.
A typical problem is to draw an angle BAC, that means im looking for a 
Point C, with A the vertex and B a second point given.

I tried to write a macro (look at my example)

\pstAngleBAC(B)(A){30}{3}{C}

30: Angle in Degree
3: Distance to the vertex

I would like to have this macro in pst-eucl. Is it posible to add it to 
this package?

Claus Behl

\documentclass[a4paper,12pt]{article}
\usepackage{pstricks}
\usepackage{pstricks-add}
\usepackage{pst-eucl}

\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Angle BAC, C to be drawn
%% #1 : B 1.Point
%% #2 : A vertex
%% #3 : angle in degree
%% #4 : distance to A
%% #5 : Pointname ex.: C
\def\pstAngleBAC{\@ifnextchar[{\pstAngleBAC at i}{\pstAngleBAC at i[]}}
\def\pstAngleBAC at i[#1](#2)(#3)#4#5#6{{%
\setkeys{psset}{#1}
\pst at getcoor{#2}\pst at tempb% 1.Schenkel
\pst at getcoor{#3}\pst at tempa% Scheitel
\pstGeonode(!
    /XA \pst at tempa pop \pst at number\psxunit div def
        /YA \pst at tempa exch pop \pst at number\psxunit div def
        /XB \pst at tempb pop  \pst at number\psyunit div def
        /YB \pst at tempb exch pop \pst at number\psxunit div def
    YB YA sub XB XA sub atan #4 add cos #5  mul XA add%
     \space
    YB YA sub XB XA sub atan #4 add sin #5  mul YA add%
){#6}}}%
\makeatother

\begin{document}
\[
\begin{pspicture}(9,6)
\psgrid[gridwidth=0pt,gridcolor=gray,gridlabels=0pt,subgriddiv=2]
\pstGeonode(4,3){A}
\pstGeonode(5,2){B}
\pstLineAB[nodesep=-3,linewidth=0.5pt]{A}{B}
\multido{\i=0+30}{12}{\pstAngleBAC[PointSymbol=x,PtNameMath=false,PointName=$\i^o$](B)(A){\i}{3}{C}}
\end{pspicture}
\]
\end{document}




More information about the PSTricks mailing list