# [pstricks] perpendicular line similar to \Parallel (pst-optic)

Herbert Voss Herbert.Voss at alumni.TU-Berlin.DE
Sat Oct 23 18:57:19 CEST 2004

Patrick Drechsler wrote:

> is there a function similar to \Parallel' from the package
> pst-optic for drawing perpendicular lines at a choosen position?
>
> Something like:
>
> \Perpendicular[<Options>](nodeA)(nodeB)(Start Node){Endnode}

I did it with

\psperpendicularLine[<Options>](nodeA)(nodeB){length}{Endnode}

the line always starts at nodeA

Herbert

\documentclass[12pt]{article}
\usepackage[T1]{fontenc}
\usepackage{pst-node,pst-optic}

\makeatletter
\def\psperpendicularLine{\pst at object{psperpendicularLine}}
\def\psperpendicularLine at i(#1)(#2)#3#4{{
\use at par
\pnode(!
tx at NodeDict begin
\pst at number\psyunit\space div /YA exch def
\pst at number\psxunit\space div /XA exch def
\pst at number\psyunit\space div /YB exch def
\pst at number\psxunit\space div /XB exch def
YB YA sub #3 mul neg XA add
XB XA sub #3 mul YA add
end){#4}%
\psline(#1)(#4)
}\ignorespaces}
\makeatother

\begin{document}
\psset{xunit=10,yunit=10}
\begin{pspicture}(1,1)\psgrid[subgridcolor=lightgray]
%% Knoten:
\pnode(.3,.35){Vk}
\pnode(.7,.2){Hk}
\pnode(.375,.35){D}
\psline(Vk)(Hk)
%% Force F_1
\Parallel[linecolor=red,length=.3,arrows=->](Vk)(Hk)(D){EN}
\uput[0](EN){$F_{1}$}
%% Normalforce Fn
\psperpendicularLine[linecolor=blue,arrows=->,%
arrowscale=2](D)(EN){-0.75}{ENode}
\qdisk(ENode){2pt}
\psperpendicularLine[linecolor=magenta,arrows=->,%
arrowscale=2](D)(EN){1.5}{ENode}
\qdisk(ENode){2pt}
\psperpendicularLine[linecolor=magenta,arrows=->,%
arrowscale=2](EN)(D){-1.5}{QNode}
\qdisk(QNode){5pt}
\end{pspicture}

\end{document}

--
http://TeXnik.de/
http://PSTricks.de/
ftp://ftp.dante.de/tex-archive/info/math/voss/Voss-Mathmode.pdf
http://www.dante.de/faq/de-tex-faq/
http://www.tex.ac.uk/cgi-bin/texfaq2html?introduction=yes

`