[pstricks] tangent to \psellipse or \pscircle

Patrick Drechsler patrick at pdrechsler.de
Tue Oct 30 02:53:33 CET 2007


Patrick Drechsler <patrick at pdrechsler.de> writes:

> what is the best way to draw a tangent to \psellipse or \pscircle at
> certain coordinates? And how does one retreive these coordinates?

Using pst-eucl solved the problem at hand.

For the record:

--8<---------------cut here---------------start------------->8---
\documentclass{article}
\usepackage{pstricks}
\usepackage{pst-eucl}
\usepackage{pstricks-add}% needed for \psRelLine
\SpecialCoor%
\begin{document}
\begin{pspicture}[showgrid=true](-3,-3)(2.5,2)
  %% Circle:
  \pstGeonode(0,0){O}%
  \pstGeonode(2,0){A}%
  \pstCircleOA{O}{A}% draw circle
  %% Line:
  \pstGeonode[PosAngle=135](-2,-1.5){W1}%
  \pstGeonode[PosAngle=135](3,-1.5){W2}%
  \psline[linewidth=0.5pt,linecolor=gray](W1)(W2)% draw line
  %% Intersection between line and circle:
  \pstInterLC[PosAngleA=-90,PosAngleB=-45]{W1}{W2}{O}{A}{SP1}{SP2}
  %% Secant between the above intersection points SP1 and SP2:
  \psline[linecolor=blue](SP1)(SP2)
  %% Draw radius:
  \psline[linecolor=cyan](O)(SP1)
  %% Tangent:
  \psRelLine[linecolor=red,angle=90](SP1)(O){0.5}{EndnodeA}
  \psRelLine[linecolor=red,angle=-90](SP1)(O){0.5}{EndnodeB}
  \rput([offset=-.3]EndnodeB){{\color{red}tangent}}
\end{pspicture}
\end{document}
--8<---------------cut here---------------end--------------->8---

There are probably more elegant ways of doing this.

Cheers,

Patrick 
-- 
Statistics are like bikinis. What they reveal is suggestive, but what
they conceal is vital. --Aaron Levenstein




More information about the PSTricks mailing list