<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Hi Herbert,<br><br>For me it would definitely useful. I tried to run your example but failed because my LaTeX installation (pdfeTeX) did not recognize<br><br> \tx@ScreenCoor<br><br>and<br><br> \tx@setlinejoin<br><br>Could it be a pdfTeX problem ?<br><br>Regards,<br>Martijn<br><br>--- On <b>Mon, 4/6/09, Herbert Voss <i><Herbert.Voss@FU-Berlin.DE></i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: Herbert Voss <Herbert.Voss@FU-Berlin.DE><br>Subject: [pstricks] tangent and orthogonal line<br>To: "Graphics with PSTricks" <pstricks@tug.org><br>Date: Monday, April 6, 2009, 8:37 AM<br><br><div class="plainMail">Hi all,<br>I played a bit with tangent and orthogonal lines of a curve<br>given by several points and not a function. The
following<br>example can draw a tangent or an othogonal line to a curve<br>defined by three points. Parameters are the coordinates of<br>the three points, the x value, and dx<br><br>If it may be useful, we can put it into one of the packages.<br><br>Herbert<br><br><br>\documentclass{minimal}<br>\usepackage{pst-3dplot}% for the linear equation system solver<br>\makeatletter<br>\def\psOrthLine{\pst@object{psOrthLine}}<br>\def\psOrthLine@i(#1,#2)(#3,#4)(#5,#6)#7#8{%<br> \begin@OpenObj%<br> \addto@pscode{<br> [[#1 dup dup mul exch 1 #2]<br> [#3 dup dup mul exch 1 #4]<br> [#5 dup dup mul exch 1 #6]]<br> tx@3DPlotDict begin SolveLinEqSystem end %<br> /abc ED % save the solution as array<br> abc aload pop % a b c on
stack<br> exch #7 % a c b x<br> mul add exch % c+b*x a<br> #7 dup mul mul add % a*x^2+b*x+c<br> /y0 ED % save value<br> abc aload pop pop exch % b a<br> #7 mul 2 mul add % b+2*a*x0<br> neg 1 exch div % mOrth<br> #8 mul /dy ED % mOrth*dx<br> [<br> #7 #8 add y0 dy add \tx@ScreenCoor % x0+dx y0 +dy<br> #7 y0 \tx@ScreenCoor % x0 y0<br> /Lineto /lineto load def<br> \ifshowpoints true \else false \fi<br> \tx@setlinejoin
% 0 1 or 2 %<br> \tx@Line }% % load the pro function<br> \end@OpenObj\ignorespaces}<br>\def\psTangentLine{\pst@object{psTangentLine}}<br>\def\psTangentLine@i(#1,#2)(#3,#4)(#5,#6)#7#8{%<br> \begin@OpenObj%<br> \addto@pscode{<br> [[#1 dup dup mul exch 1 #2]<br> [#3 dup dup mul exch 1 #4]<br> [#5 dup dup mul exch 1 #6]]<br> tx@3DPlotDict begin SolveLinEqSystem end<br> /abc ED<br> abc aload pop % a b c on stack<br> exch #7 % a c b x<br> mul add exch % c+b*x a<br> #7 dup mul mul add /y0 ED<br> abc aload pop pop exch % b a<br> #7 mul 2 mul add %
b+2*a*x0=mTan<br> dup % mTan mTan<br> #8 mul /dy1 ED % mTan*dx<br> #8 neg mul /dy2 ED % mTan*-dx<br> [<br> #7 #8 add y0 dy1 add \tx@ScreenCoor % x0+dx y0 +dy1<br> #7 #8 sub y0 dy2 add \tx@ScreenCoor % x0-dx y0 +dy2<br> /Lineto /lineto load def<br> \ifshowpoints true \else false \fi<br> \tx@setlinejoin %<br> \tx@Line }%<br> \end@OpenObj\ignorespaces}<br>\makeatother<br>\begin{document}<br><br>\psset{unit=2}<br>\begin{pspicture}[showgrid=true](1,-1)(4,1)<br> \pscurve[showpoints=true](2.1,-0.2)(2.5,0.2)(3.2,0.235)(3.8,-0.2)<br>
\psOrthLine[arrows=->,linecolor=red](2.5,0.2)(3.2,0.235)(3.8,-0.2){3}{0.1}<br><br>\psTangentLine[arrows=<->,linecolor=blue](2.5,0.2)(3.2,0.235)(3.8,-0.2){3}{0.5}<br>\end{pspicture}<br><br>\end{document}<br>_______________________________________________<br>PSTricks mailing list<br><a ymailto="mailto:PSTricks@tug.org" href="/mc/compose?to=PSTricks@tug.org">PSTricks@tug.org</a><br><a href="http://tug.org/mailman/listinfo/pstricks" target="_blank">http://tug.org/mailman/listinfo/pstricks</a><br></div></blockquote></td></tr></table><br>