[pstricks] pst-node, ncangles

Herbert Voss LaTeX at zedat.fu-berlin.de
Tue Nov 15 15:07:45 CET 2005


E. Krishnan wrote:
> On Mon, 14 Nov 2005, Herbert Voss wrote:
> 
> 
>>I do not really understand what's your point. ncangles
>>starts with armA and angleA and has 4 segments. By default the
>>segments 2 and 3 are connected by a right angle. The angle
>>between segment 1 and 2 and the angle between segment 3 and 4
>>are calculated.
> 
> 
> The way I see it, ncangles draws "armA" and "armB" using the "arm" and
> "angle"  parameter values for them and then joins their ends using two
> segments at right angles to each other. These conditions alone do not fix
> the picture uniquely, and one way of achieving this is to fix the angle
> which one arm of the right angle makes with "armA". The few pieces of
> documentation I've seen (maybe obsolete) say this angle is also 90
> degrees, but I see that it is actually (90 + 2\times angleA) degrees.  
> Just wanted to check whether this has been noted by other users.
> 
> Maybe the attached file will make my point clear

in the original code it is always 90+2*angleA. The following
examples shows it for two right angles.
The original code is described in
http://www.perce.de/LaTeX/pst-code/pst-code.pdf
lines 2902ff

Herbert


\documentclass[a4paper]{article}
\usepackage[usenames]{pstcol}
\usepackage{pst-node}

\makeatletter
\pst at def{NCAngles}<
   GetEdgeA GetEdgeB GetArmA GetArmB
%  /mtrx AngleA matrix rotate def        % original code
   /mtrx AngleA neg matrix rotate def
   xA2 yA2 mtrx transform pop xB2 yB2 mtrx transform exch pop mtrx
   itransform /y0 ED /x0 ED mark ArmB 0 ne { xB1 yB1 } if
   xB2 yB2 x0 y0 xA2 yA2 ArmA 0 ne { xA1 yA1 } if
   tx at Dict begin false Line end /LPutVar [ xB1
   yB1 xB2 yB2 x0 y0 xA2 yA2 xA1 yA1 ] cvx def /LPutPos { LPutLines } def
   /HPutPos { HPutLines } def /VPutPos { VPutLines } def >
\makeatother

\begin{document}

\begin{center}
   \begin{pspicture}(-1,-0.5)(8,3.5)
     \rput(0,0){\rnode{1}{\LARGE Node A}}
     \rput(4,2){\rnode{2}{\LARGE Node B}}
     \ncangles[angleA=10,armA=2cm,angleB=20,armB=3cm]{1}{2}
     \naput[npos=0.5,nrot=10,labelsep=2pt]{\scriptsize 2\,cm}
     \nbput[npos=3.5,nrot=20,labelsep=2pt]{\scriptsize 3\,cm}
     \naput[labelsep=0pt,npos=2,nrot=-100]{%
       \psline(0.3,0)(0.3,0.3)(0,0.3)}
     \psdots(0,0)(4,2)
     \SpecialCoor
     \psset{linestyle=dotted,dotsep=1pt}
     \psline[unit=1pt]
     (0,0)(!26.7 26.7 10 sin mul 10 cos div)
     \psline[origin={-4,-2},unit=1pt]%
            (0,0)(!6 20 cos mul 20 sin div 6)
     \psset{linestyle=solid}
     \psline[linecolor=Gray](0,0)(4,0)
     \psarc(0,0){1}{0}{10}
     \uput[5](1;5){$\scriptscriptstyle{10^\circ}$}
     \psarc(83.08pt,14.65pt){0.3}{80}{190}
     \uput{0.3}[135](83.08pt,14.65pt){%
       $\scriptstyle{90\;+\;(2\times10)\;=\;110^\circ}$}
      \psline[linecolor=Gray](4,2)(7,2)
      \psarc(4,2){1.2}{0}{20}
     \uput{1.3}[10](4,2){$\scriptscriptstyle{20^\circ}$}
   \end{pspicture}
\end{center}


\end{document}




More information about the PSTricks mailing list