diff options
author | Karl Berry <karl@freefriends.org> | 2019-10-20 20:57:52 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-10-20 20:57:52 +0000 |
commit | eae6041fbc51527923fdca5ad56e362572fbe940 (patch) | |
tree | cb88961c87432a13ad3505983b922f63b5a6a69f /Master/texmf-dist | |
parent | 5ab5adbe90601f0d4b513e15f6d16b9129ed26a1 (diff) |
pst-eucl (20oct19)
git-svn-id: svn://tug.org/texlive/trunk@52457 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/generic/pst-eucl/Changes | 13 | ||||
-rw-r--r-- | Master/texmf-dist/doc/generic/pst-eucl/pst-eucl-doc.pdf | bin | 543319 -> 1189759 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/generic/pst-eucl/pst-eucl-doc.tex | 2288 | ||||
-rw-r--r-- | Master/texmf-dist/tex/generic/pst-eucl/pst-eucl.tex | 6363 |
4 files changed, 8503 insertions, 161 deletions
diff --git a/Master/texmf-dist/doc/generic/pst-eucl/Changes b/Master/texmf-dist/doc/generic/pst-eucl/Changes index 70509f1f1b4..f05be18cb40 100644 --- a/Master/texmf-dist/doc/generic/pst-eucl/Changes +++ b/Master/texmf-dist/doc/generic/pst-eucl/Changes @@ -1,10 +1,15 @@ pst-eucl.pro -------- -1.01 2012/09/21 - fix for introduced bug -1.00 2011/08/05 - fix bug in /InterLines +1.01 2012/09/21 - fix for introduced bug +1.00 2011/08/05 - fix bug in /InterLines pst-eucl.tex -------- - +1.66 2019/10/20 - add macros to operate the node coordinates, \pstAbscissa, \pstOrdinate, \pstMoveNode etc. + - add optional parameters angleA and angleB for \pstCircleOA and \pstCircleAB. + - add optional parameters to output the inner circle center and outer circle center for \pstTriangleIC and \pstTriangleOC. + - add macros to draw the tangent line and tangent node of circle. + - add macros to draw the external and internal common tangent lines of two circles. + - add macros to draw conics (ellipse, parabola and hyperbola) and their geometrical elements, such as focus, directrix and intersections. 1.65 2019/08/19 - new type for angle 1.64 2019/01/31 - fix for PointName and pstInterCC 1.63 2019/01/27 - fix for PointSymbol=none for pstTriangle @@ -43,7 +48,7 @@ pst-eucl.tex -------- 1.36 2010/08/23 - fix for \pstMarkAngle (hv) 1.35 2009/01/19 - new option labelColor (hv) 1.34 2006/01/28 - use \psscalebox instead of \scalebox - - small tweaks + - small tweaks %% 2000-10-16 : creation of the file from a first LaTeX protype sty file %% 2001-05-7 : distribution of the first beta version %% 2002-03-21 : distribution of the second beta version diff --git a/Master/texmf-dist/doc/generic/pst-eucl/pst-eucl-doc.pdf b/Master/texmf-dist/doc/generic/pst-eucl/pst-eucl-doc.pdf Binary files differindex f1a31520f17..7f37a4e7ae7 100644 --- a/Master/texmf-dist/doc/generic/pst-eucl/pst-eucl-doc.pdf +++ b/Master/texmf-dist/doc/generic/pst-eucl/pst-eucl-doc.pdf diff --git a/Master/texmf-dist/doc/generic/pst-eucl/pst-eucl-doc.tex b/Master/texmf-dist/doc/generic/pst-eucl/pst-eucl-doc.tex index e81b7cf8d52..25aefc74877 100644 --- a/Master/texmf-dist/doc/generic/pst-eucl/pst-eucl-doc.tex +++ b/Master/texmf-dist/doc/generic/pst-eucl/pst-eucl-doc.tex @@ -4,6 +4,8 @@ \usepackage{pst-eucl} \let\pstEuclideFV\fileversion \usepackage{multicol} +\usepackage{ntheorem} +\newtheorem{theorem}{Theorem} \usepackage{pst-plot,paralist} \usepackage[mathscr]{eucal} \lstset{pos=l,wide=false,language=PSTricks, @@ -42,7 +44,7 @@ \item Michael Vulis for his fast testing of the documentation using V\TeX\ which leads to the correction of a bug in the \PS\ code; \item Manuel Luque and Olivier Reboux for their remarks and their examples. - \item Alain Delplanque for its modification propositions on automatic + \item Alain Delplanque for its modification theorems on automatic placing of points name and the ability of giving a list of points in \Lcs{pstGeonode}. \end{compactitem} @@ -51,9 +53,10 @@ \vfill \noindent -Thanks to: +Thanks to: Manuel Luque; -Thomas Söll. +Thomas Söll; +Liao Xiongfei. @@ -195,19 +198,61 @@ Obviously, the nodes appearing in the picture can be used as normal \rnode{ici}{here}. \nccurve[arrowscale=2]{->}{ici}{B_1} +After v1.65, we add macros \Lcs{pstAbscissa} and \Lcs{pstOrdinate} to +get the abscissa and ordinate of the specified node, so it is possible +to define a new node from an already constructed node with them. + +\begin{BDef} +\Lcs{pstAbscissa}\Largb{A}\\ +\Lcs{pstOrdinate}\Largb{A} +\end{BDef} + +Note that the value of abscissa or ordinate are transformed to the \texttt{User coordinate}, +and then put into the stack of \PS, so they can be used to do some compound arithmetic +without concerned the \texttt{xunit} and \texttt{yunit} in the \PST{} \texttt{SpecialCoor} +function. You need the other third package to do float arithmetic operation, +like \Lcs{pscalculate} \footnote{Provided by package \texttt{pst-calculate}, +sometimes it results the numbers more than 9 fraction digits, +which are not supported good by \PST\space with '! number too big' issue.} to generate the numerical values, +or the expandable command \Lcs{fpeval}\footnote{Provided by package \texttt{xfp}, +it can truncate the fraction part digits using the \texttt{trunc} function perfectly, +e.g. \texttt{\textbackslash{}fpeval\{trunc(18/7,3)\}}.} to get a purely numerical result, + +The macro \Lcs{pstMoveNode} use them to move node $A$ by abscissa increment $dx$ +and ordinate increment $dy$ to get the target node $B$. + +\begin{BDef} +\Lcs{pstMoveNode}\OptArgs($dx$,\kern 1pt$dy$)\Largb{$A$}\Largb{$B$} +\end{BDef} + +for example: + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](0,0)(4,4) +\def\ra{3.0}\def\rb{4.0} +\pstGeonode[PosAngle=-90](1.0,1.5){A} +\pstGeonode[PosAngle=90](! \pstAbscissa{A} 1 add \pstOrdinate{A} 2 add){B} +\pstLineAB[linecolor=blue]{A}{B} +\pstMoveNode[PosAngle=-90,PointSymbol=asterisk](3,2){A}{C} +\pstLineAB[linecolor=red]{A}{C} +\pstMoveNode[PosAngle=-90,PointSymbol=diamond](\pscalculate{sqrt(\ra*\ra+\rb*\rb)/2},\pscalculate{\ra*\rb/(2*(\ra+\rb))}){A}{D} +\pstLineAB[linecolor=cyan]{A}{D} +\pstMoveNode[PosAngle=-90](\pstAbscissa{B} 3 div,\pstOrdinate{B} neg 3 div){D}{E} +\pstLineAB[linecolor=green]{A}{E} +\end{pspicture} +\end{LTXexample} + %\subsubsection{User defined axes} -\Lcs{pstOIJGeonode} creates a list of points in the landmark $(O;I;J)$. Possible +\Lcs{pstOIJGeonode} creates a list of points in the landmark $(O;I;J)$. Possible parameters are \Lkeyword{PointName}, \Lkeyword{PointNameSep}, \Lkeyword{PosAngle}, - \Lkeyword{PointSymbol}, and \Lkeyword{PtNameMath}. +\Lkeyword{PointSymbol}, and \Lkeyword{PtNameMath}. + \begin{BDef} \Lcs{pstOIJGeonode}\OptArgs\coord1\Largb{$A_1$}\Largb{$O$}\Largb{$I$}\Largb{$J$} \coord2\Largb{$A_2$}\ldots\cAny\Largb{$A_n$} \end{BDef} -\clearpage - - \begin{LTXexample}[width=5.6cm,pos=l] \psset{unit=.7} \begin{pspicture*}[showgrid=true](-4,-4)(4,4) @@ -268,7 +313,7 @@ Several commands are predefined for marking the segment: The three commands of the family \Lkeyval{MarkHash} draw a line whose inclination is controled by the parameter \Lkeyword{MarkAngle} (default is 45). Their width and colour -depends of the width and color of the line when the drawing is done, ass shown is the +depends of the width and color of the line when the drawing is done, as shown is the next example. @@ -277,12 +322,12 @@ next example. \begin{pspicture}[showgrid=true](-2,-2)(2,2) \rput{18}{% \pstGeonode[PosAngle={0,90,180,-90}](2,0){A}(2;72){B} - (2;144){C}(2;216){D}(2;288){E}} - \pstSegmentMark{A}{B} + (2;144){C}(2;216){D}(2;288){E}} + \pstSegmentMark[SegmentSymbol=none]{A}{B} \pstSegmentMark[linecolor=green]{B}{C} \psset{linewidth=2\pslinewidth} \pstSegmentMark[linewidth=2\pslinewidth]{C}{D} - \pstSegmentMark{D}{E} + \pstSegmentMark[MarkAngle=90]{D}{E} \pstSegmentMark{E}{A} \end{pspicture} \end{LTXexample} @@ -294,18 +339,16 @@ The length and the separation of multiple hases can be set by \Lkeyword{MarkHash \subsection{Triangles} -The more classical figure, it has its own macro for a quick definition: +The more classical figure, it has its own macro \Lcs{pstTriangle} for a quick definition: \begin{BDef} -\Lcs{pstTriangle}\OptArgs\coord1\Largb{A}\coord2\Largb{B}\coord3\Largb{C}\\ -\Lcs{pstTriangleIC}\OptArgs\Largb{A}\Largb{B}\Largb{C}\\ -\Lcs{pstTriangleOC}\OptArgs\Largb{A}\Largb{B}\Largb{C} +\Lcs{pstTriangle}\OptArgs\coord1\Largb{A}\coord2\Largb{B}\coord3\Largb{C} \end{BDef} \begin{sloppypar} Valid optional arguments are \Lkeyword{PointName}, - \Lkeyword{PointNameSep}, %\Lkeyword{PosAngle}, + \Lkeyword{PointNameSep}, %\Lkeyword{PosAngle}, \Lkeyword{PointSymbol}, \Lkeyword{PointNameA}, \Lkeyword{PosAngleA}, \Lkeyword{PointSymbolA}, \Lkeyword{PointNameB}, \Lkeyword{PosAngleB}, \Lkeyword{PointSymbolB}, \Lkeyword{PointNameC}, @@ -326,6 +369,14 @@ for each points: \Lkeyword{PointSymbolA}, \Lkeyword{PointSymbolB} and \Lkeyword{PointSymbol}. The management of the default value followed the same rule. +The macros \Lcs{pstTriangleIC} and \Lcs{pstTriangleOC} are used to draw the inner circle +and outer circle of triangle $ABC$. + +\begin{BDef} +\Lcs{pstTriangleIC}\OptArgs\Largb{A}\Largb{B}\Largb{C}\OptArg{I}\OptArg{H}\\ +\Lcs{pstTriangleOC}\OptArgs\Largb{A}\Largb{B}\Largb{C}\OptArg{O} +\end{BDef} + \begin{LTXexample}[width=5cm,pos=l] \begin{pspicture}[showgrid](-2,-2)(2,2) \pstTriangle[PointSymbol=square,PointSymbolC=o, @@ -336,9 +387,19 @@ same rule. \end{pspicture} \end{LTXexample} -The center of the inner circle is called \verb|IC_O| and the outer circle \verb|OC_O|. They are -only defined, if the macros \Lcs{pstTriangleIC} and \Lcs{pstTriangleOC} are used. +The center of the inner circle is called \verb|IC_O| as default and the outer circle \verb|OC_O| as default, +but you can change the node names by the optional parameters \OptArg{I} \OptArg{H} and \OptArg{O}. +The optional node name $H$ is a node on the inner circle, +so you can operate the inner circle by center $I$ and node $H$ later. +The inner center $I$, node $H$ and outer circle center $O$ are not printed out as default, +but you can setup \Lkeyword{PointSymbol} and \Lkeyword{PointName} to display them. +For example: + +\begin{lstlisting} +\pstTriangleIC[PosAngle={-90,160},PointName={I,none},PointSymbol={*,none}]{A}{B}{C}[I][D] +\pstTriangleOC[PosAngle=90,PointSymbol=*,PointName=X]{A}{B}{C}[X] +\end{lstlisting} \subsection{Angles} @@ -379,7 +440,7 @@ For other angles, there is the command: \begin{sloppypar} -Valid optional arguments are \Lkeyword{MarkAngleRadius}, \Lkeyword{LabelAngleOffset}, +Valid optional arguments are \Lkeyword{MarkAngleRadius}, \Lkeyword{LabelAngleOffset}, \Lkeyword{MarkAngleType} and \Lkeyword{Mark} % @@ -415,18 +476,18 @@ the angle by specifying a \TeX{} command as argument of parameter \Lkeyword{Mark \psset{PointSymbol=none,PointNameMathSize=\scriptstyle,PointNameSep=6pt, RightAngleSize=0.15,PosAngle={135,225,-45,45}} \pstGeonode(1,2){A}(1,1){B}(2,1){C}(2,2){D}% -\pstRightAngle[fillstyle=solid,fillcolor=blue!40]{C}{B}{A} -\pstRightAngle{D}{C}{B} \pstRightAngle{A}{D}{C} +\pstRightAngle[fillstyle=solid,fillcolor=blue!40]{C}{B}{A} +\pstRightAngle{D}{C}{B} \pstRightAngle{A}{D}{C} \pstRightAngle{B}{A}{D} \pspolygon(A)(B)(C)(D) \psset{RightAngleType=suisseromand} \pstGeonode(3,2){A}(3,1){B}(4,1){C}(4,2){D}% -\pstRightAngle[fillstyle=solid,fillcolor=blue!40]{C}{B}{A} -\pstRightAngle{D}{C}{B} \pstRightAngle{A}{D}{C} +\pstRightAngle[fillstyle=solid,fillcolor=blue!40]{C}{B}{A} +\pstRightAngle{D}{C}{B} \pstRightAngle{A}{D}{C} \pstRightAngle{B}{A}{D} \pspolygon(A)(B)(C)(D) \psset{RightAngleType=german} \pstGeonode(5,2){A}(5,1){B}(6,1){C}(6,2){D}% -\pstRightAngle[fillstyle=solid,fillcolor=blue!40]{C}{B}{A} -\pstRightAngle{D}{C}{B} \pstRightAngle{A}{D}{C} +\pstRightAngle[fillstyle=solid,fillcolor=blue!40]{C}{B}{A} +\pstRightAngle{D}{C}{B} \pstRightAngle{A}{D}{C} \pstRightAngle{B}{A}{D} \pspolygon(A)(B)(C)(D) \end{pspicture} \end{LTXexample} @@ -469,34 +530,87 @@ parameters is equal to 0. \begin{LTXexample}[width=5cm,pos=l] \begin{pspicture}[showgrid](-2,-2)(2,2) \pstGeonode(1,1){A}(-1,-1){B} -\pstLineAB[nodesepA=-.4,nodesepB=-1, +\pstLineAB[nodesepA=-.4,nodesepB=-1, linecolor=green]{A}{B} \pstLineAB[nodesep=.4,linecolor=red]{A}{B} \end{pspicture} \end{LTXexample} +The macro \Lcs{pstLine} draws a new line with two nodes, or two coordinates +or one node and one coordinate. This macro is similar with \Lcs{pstLineAB}, +but more compatible. + +\begin{BDef} +\Lcs{pstLine}\OptArgs\Largb{A}\Largb{B}\\ +\Lcs{pstLine}\OptArgs\Largb{A}\cAny\\ +\Lcs{pstLine}\OptArgs\cAny\Largb{B}\\ +\Lcs{pstLine}\OptArgs\cAny\cAny +\end{BDef} + +The macros \Lcs{pstLineAA} and \Lcs{pstLineAS} draw a new line with one node, +the slope \texttt{angle} between the line and the horizontal axis, or the +slope \texttt{gradient} of the line, and create a new node $B$ on the line. + +\begin{BDef} +\Lcs{pstLineAA}\OptArgs\Largb{A}\Largb{angle}\Largb{B}\\ +\Lcs{pstLineAA}\OptArgs\cAny\Largb{angle}\Largb{B}\\ +\Lcs{pstLineAS}\OptArgs\Largb{A}\Largb{gradient}\Largb{B}\\ +\Lcs{pstLineAS}\OptArgs\cAny\Largb{gradient}\Largb{B} +\end{BDef} + +Here are some examples: + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](0,0)(4,4) +\pstGeonode[PosAngle=90](1.5,1.5){A} +% draw a line with angle atan(2/1), about 63.43 degree. +\pstLineAA[linecolor=red,nodesep=-0.5,PosAngle=90]{A}{2 1 atan}{B} +\pstLineAA[linecolor=yellow,nodesep=-0.5,PosAngle=-120]{A}{-45}{C} +\pstLineAS[linecolor=green,nodesep=-0.5,PosAngle=30]{A}{-0.5}{D} +% draw a line with gradient (cos50/sin50). +\pstLineAS[linecolor=cyan,nodesep=-0.5]{A}{50 cos 50 sin div}{E} +\end{pspicture} +\end{LTXexample} + +The macro \Lcs{pstLineAbsNode} creates a new node $C$ whose abscissa +is the given value $x_1$ on the line $AB$. The macro \Lcs{pstLineOrdNode} creates a new node $C$ whose ordinate is the given value $y_1$ on the line $AB$. +You can input $x_1$ or $y_1$ as any number(e.g, 2.0), +or use \Lcs{pscalculate} or \Lcs{fpeval} to get a purely numerical result, +or use \Lcs{pstAbscissa} and \Lcs{pstOrdinate} to get the abscissa and ordinate of any other node. +\begin{BDef} +\Lcs{pstLineAbsNode}\OptArgs\Largb{A}\Largb{B}\Largb{$x_1$}\Largb{C}\\ +\Lcs{pstLineOrdNode}\OptArgs\Largb{A}\Largb{B}\Largb{$y_1$}\Largb{C} +\end{BDef} +For example, +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](0,0)(4,4) +\pstGeonode[PosAngle=-40](0.8,0.5){A} +\pstGeonode[PosAngle=-40](1.2,1.0){B} +\pstLineAB[linecolor=red,nodesep=-0.5]{A}{B} +\pstLineAbsNode[PosAngle=-40,PointSymbol=o]{A}{B}{2.5}{C} +\pstLineOrdNode[PosAngle=-40,PointSymbol=o]{A}{B}{3.0}{D} +\pstLineAB[linecolor=blue,nodesep=-0.5]{C}{D} +\end{pspicture} +\end{LTXexample} - \subsection{Circles} +\subsection{Circles} A circle can be defined either with its center and a point of its circumference, or with two diameterly opposed points. There is two commands : - \begin{BDef} -\Lcs{pstCircleOA}\OptArgs\Largb{O}\Largb{A}\\ -\Lcs{pstCircleAB}\OptArgs\Largb{O}\Largb{A}\\ -\Lcs{pstDistAB}\OptArgs\Largb{A}\Largb{B}\\ -\Lcs{pstDistVal}\OptArgs\Largb{x} +\Lcs{pstCircleOA}\OptArgs\Largb{O}\Largb{A}\OptArg{angleA}\OptArg{angleB}\\ +\Lcs{pstCircleAB}\OptArgs\Largb{O}\Largb{A}\OptArg{angleA}\OptArg{angleB} \end{BDef} -%\Lcs{pstCircleOA} draws the circle of center $O$ crossing $A$. Possible options are \Lkeyword{Radius} and -% \Lkeyword{Diameter}. - -%\Lcs{pstCircleAB} draws the circle of diameter $AB$ with the same options. +\Lcs{pstCircleOA} draws the circle of center $O$ crossing $A$ from \Lkeyword{angleA} to \Lkeyword{angleB}, going counter clockwise. +Possible options are \Lkeyword{Radius} and \Lkeyword{Diameter}. + +\Lcs{pstCircleAB} draws the circle of diameter $AB$ with the same options. For the first macro, it is possible to omit the second point and then @@ -504,12 +618,16 @@ to specify a radius or a diameter using the parameters \Lkeyword{Radius} and \Lkeyword{Diameter}. The values of these parameters must be specified with one of the two following macros : +\begin{BDef} +\Lcs{pstDistAB}\OptArgs\Largb{A}\Largb{B}\\ +\Lcs{pstDistVal}\OptArgs\Largb{x} +\end{BDef} + %\Lcs{pstDistAB} Specifies distance $AB$ for the parameters % \Lkeyword{Radius}, \Lkeyword{Diameter} and \Lkeyword{DistCoef}. - +% %\Lcs{pstDistVal} Specifies a numerical value for the parameters % \Lkeyword{Radius}, \Lkeyword{Diameter}, and \Lkeyword{DistCoef}. - The first specifies a distance between two points. The parameter \Lkeyword{DistCoef} can be used to specify a coefficient to reduce or @@ -529,40 +647,22 @@ We will see later how to draw the circle crossing three points. \item {\color{RoyalBlue} the circle whose diameter is $BC$.} \end{compactitem} -\enlargethispage{3\normalbaselineskip} - -\bigskip -\begin{pspicture}[showgrid](-4,-3.3)(5,3) -\psset{linewidth=2\pslinewidth} -\pstGeonode[PosAngle={0,-135,90},PointSymbol={*,*,square}](1,0){A}(-2,-1){B}(0,1){C} -\pstCircleOA[linecolor=red]{A}{B} -\pstCircleOA[linecolor=green, DistCoef=2 3 div, Radius=\pstDistAB{A}{C}]{A}{} -\pstCircleOA[linecolor=blue, Radius=\pstDistAB{B}{C}]{A}{} -\pstCircleOA[linecolor=Sepia, Radius=\pstDistAB{A}{C}]{B}{} -\pstCircleOA[linecolor=Aquamarine, Diameter=\pstDistAB{A}{C}]{B}{} -\pstCircleAB[linecolor=RoyalBlue]{B}{C} -\end{pspicture} - - \clearpage -\begin{lstlisting} -\begin{pspicture}[showgrid](-4,-4)(5,3) +\begin{LTXexample}[width=\linewidth,pos=t] +\begin{pspicture}[showgrid](-4,-3.3)(4,3) \psset{linewidth=2\pslinewidth} \pstGeonode[PosAngle={0,-135,90},PointSymbol={*,*,square}](1,0){A}(-2,-1){B}(0,1){C} \pstCircleOA[linecolor=red]{A}{B} \pstCircleOA[linecolor=green, DistCoef=2 3 div, Radius=\pstDistAB{A}{C}]{A}{} -\pstCircleOA[linecolor=blue, Radius=\pstDistAB{B}{C}]{A}{} +\pstCircleOA[linecolor=blue, Radius=\pstDistAB{B}{C}]{A}{}[45][270] \pstCircleOA[linecolor=Sepia, Radius=\pstDistAB{A}{C}]{B}{} -\pstCircleOA[linecolor=Aquamarine, Diameter=\pstDistAB{A}{C}]{B}{} +\pstCircleOA[linecolor=Aquamarine, Diameter=\pstDistAB{A}{C}]{B}{}[80][320] \pstCircleAB[linecolor=RoyalBlue]{B}{C} \end{pspicture} -\end{lstlisting} - - - \subsection{Circle arcs} - +\end{LTXexample} +\subsection{Circle arcs} \begin{BDef} \Lcs{pstArcOAB}\OptArgs\Largb{O}\Largb{A}\Largb{B}\\ @@ -588,11 +688,77 @@ two points are at the same distance of $O$. \end{pspicture} \end{LTXexample} -\subsection{Curved abscissa} +\subsection{Circle tangent} -A point can be positioned on a circle using its curved abscissa. +The macro \Lcs{pstCircleTangentLine} is used to draw a tangent line $AT$ from a point $A$ on the circle, +and the macro \Lcs{pstCircleTangentNode} is used to draw the tangent points $T_1$ and $T_2$ from a point $P$ out of the circle. +\begin{BDef} +\Lcs{pstCircleTangentLine}\OptArgs\Largb{O}\Largb{A}\Largb{T}\\ +\Lcs{pstCircleTangentNode}\OptArgs\Largb{O}\Largb{A}\Largb{P}\Largb{T1}\Largb{T2} +\end{BDef} +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](-2,-1)(4,3) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\psset{nodesep=-0.8} +\pstGeonode[PosAngle={90,120,-30}](1,1){O}(-1,0){T}(3,0){S} +\pstCircleOA[Radius=\pstDistVal{1.5},linecolor=red]{O}{} +\pstCircleRotNode[Radius=\pstDistVal{1.5},PosAngle=-30,RotAngle=-30]{O}{}{A} +\pstCircleTangentLine[PosAngle=-10,PointName=A_1]{O}{A}{A1} +\pstCircleRotNode[Radius=\pstDistVal{1.5},PosAngle=90,RotAngle=90]{O}{}{B} +\pstCircleTangentLine[PosAngle=90,PointName=B_1]{O}{B}{B1} +\pstCircleTangentNode[Radius=\pstDistVal{1.5},PosAngle={150,90},PointName={T_1,T_2}]{O}{}{T}{T1}{T2} +\pstCircleTangentNode[PosAngle={80,200},PointName={S_1,S_2}]{O}{A}{S}{S1}{S2} +\end{pspicture} +\end{LTXexample} + +The macro \Lcs{pstCircleExternalCommonTangent} is used to find the external common tangent lines of two circle $A(O_1)$ and $B(O_2)$, +and the macro \Lcs{pstCircleInternalCommonTangent} is used to find the internal common tangent lines of two circle $A(O_1)$ and $B(O_2)$. +They both create four tangent point nodes $T_1,T_2,T_3,T_4$, where $T_1,T_2$ lie on circle $A(O_1)$, and $T_3,T_4$ lie on circle $B(O_2)$. + +\begin{BDef} +\Lcs{pstCircleExternalCommonTangent}\OptArgs\Largb{$O_1$}\Largb{A}\Largb{$O_2$}\Largb{B}\Largb{$T_1$}\Largb{$T_2$}\Largb{$T_3$}\Largb{$T_4$}\\ +\Lcs{pstCircleInternalCommonTangent}\OptArgs\Largb{$O_1$}\Largb{A}\Largb{$O_2$}\Largb{B}\Largb{$T_1$}\Largb{$T_2$}\Largb{$T_3$}\Largb{$T_4$} +\end{BDef} + +You can use \Lkeyword{RadiusA} and \Lkeyword{RadiusB} to define the two circles like as following: +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](-2,-2)(3,3) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\pstGeonode[PosAngle=-90](-1,0){O1} +\pstGeonode[PosAngle=-60](1.5,1.5){O2} +\pstCircleOA[Radius=\pstDistVal{2},linecolor=red]{O1}{} +\pstCircleOA[Radius=\pstDistVal{1},linecolor=blue]{O2}{} +\pstCircleExternalCommonTangent[RadiusA=\pstDistVal{2},RadiusB=\pstDistVal{1},PosAngle={90,-60,90,-60}]{O1}{}{O2}{}{P}{Q}{R}{S} +\pstLine[nodesep=-1]{P}{R} +\pstLine[nodesep=-1]{Q}{S} +\pstCircleInternalCommonTangent[RadiusA=\pstDistVal{2},RadiusB=\pstDistVal{1},PosAngle={120,60,120,60}]{O1}{}{O2}{}{H}{I}{J}{K} +\pstLine[nodesep=-1]{H}{J} +\pstLine[nodesep=-1]{I}{K} +\end{pspicture} +\end{LTXexample} + +You also can use \Lkeyword{DiameterA} and \Lkeyword{DiameterB} to define the two circles like as following: +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](-2,-2)(3,3) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\pstGeonode[PosAngle=-90](-1,0){O1} +\pstGeonode[PosAngle=-60](1.5,1.5){O2} +\pstCircleOA[Diameter=\pstDistVal{3},linecolor=red]{O1}{} +\pstCircleOA[Diameter=\pstDistVal{2},linecolor=blue]{O2}{} +\pstCircleExternalCommonTangent[DiameterA=\pstDistVal{3},DiameterB=\pstDistVal{2},PosAngle={100,-60,90,-60}]{O1}{}{O2}{}{P}{Q}{R}{S} +\pstLine[nodesep=-1]{P}{R} +\pstLine[nodesep=-1]{Q}{S} +\pstCircleInternalCommonTangent[DiameterA=\pstDistVal{3},DiameterB=\pstDistVal{2},PosAngle={80,-60,-90,140}]{O1}{}{O2}{}{H}{I}{J}{K} +\pstLine[nodesep=-1]{H}{J} +\pstLine[nodesep=-1]{I}{K} +\end{pspicture} +\end{LTXexample} + +\subsection{Curved abscissa} + +A point can be positioned on a circle using its curved abscissa. \begin{BDef} @@ -623,6 +789,55 @@ automatically in oirder to be alined with the circle center and the point. \end{pspicture} \end{LTXexample} + +A point can be positioned on a circle using its absolute abscissa or ordinate too. +You can input $x_1$ or $y_1$ as any number(e.g, 2.0), or use \Lcs{pscalculate} or \Lcs{fpeval} to generate the value, +or use \Lcs{pstAbscissa} and \Lcs{pstOrdinate} to get the abscissa and ordinate of any other node. + +\begin{BDef} +\Lcs{pstCircleAbsNode}\OptArgs\Largb{O}\Largb{A}\Largb{$x_1$}\Largb{C}\Largb{C}\\ +\Lcs{pstCircleOrdNode}\OptArgs\Largb{O}\Largb{A}\Largb{$y_1$}\Largb{C}\Largb{C} +\end{BDef} + +for example, +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](-1,-1)(4,4) +\pstGeonode[PosAngle=60](1.5,1.5){O} +\pstGeonode[PosAngle=-30](2.5,0){A} +\pstCircleOA[linecolor=red]{O}{A} +\pstCircleAbsNode[PosAngleA=-60,PosAngleB=60,PointSymbol=*]{O}{A}{1.0}{C}{D} +\pstCircleOrdNode[PosAngleA=150,PosAngleB=30,PointSymbol=*]{O}{A}{1.0}{E}{F} +\pstLineAB[linestyle=dashed,linecolor=gray!40,nodesep=-0.5]{C}{D} +\pstLineAB[linestyle=dashed,linecolor=gray!40,nodesep=-0.5]{E}{F} +\end{pspicture} +\end{LTXexample} + +A point can be positioned on a circle using its rotation angle by macro \Lcs{pstCircleRotNode}. +The rotation angle should be passed by the \Lkeyword{RotAngle} in the \texttt{Options}. +The circle is defined by center $O$ and point $A$ on the circle or \Lkeyword{Radius} in parameter. +If you not set \Lkeyword{RotAngle}, the default value is $60^\circ$. + +\begin{BDef} +\Lcs{pstCircleRotNode}\OptArgs\Largb{O}\Largb{A}\Largb{X} +\end{BDef} + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](-1,-1)(4,4) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\psset{Radius=\pstDistVal{2.0}} +\pstGeonode[PosAngle=0](1.5,1.5){O} +\pstCircleOA[linecolor=red]{O}{} +\pstCircleRotNode[PosAngle=0,RotAngle=0]{O}{}{A} +\pstCircleRotNode[PosAngle=60]{O}{}{B} % default 60 degree +\pstCircleRotNode[PosAngle=90,RotAngle=90]{O}{}{C} +\pstCircleRotNode[PosAngle=150,RotAngle=\pscalculate{3*360/7}]{O}{}{D} +\pstCircleRotNode[PosAngle=180,RotAngle=180]{O}{}{E} +\pstCircleRotNode[PosAngle=230,RotAngle=230]{O}{}{F} +\pstCircleRotNode[PosAngle=270,RotAngle=270]{O}{}{G} +\pstCircleRotNode[PosAngle=-45,RotAngle=-45]{O}{}{H} +\end{pspicture} +\end{LTXexample} + \subsection{Generic curve} It is possible to generate a set of points using a loop, and to give @@ -658,6 +873,1871 @@ used to modify the increment from a point to the next one \end{pspicture} \end{LTXexample} +\section{Conics} +\subsection{Standard Ellipse} +The Standard Ellipse $E$ with coordinate translation is defined by center $O(x_0,y_0)$, +the half of the major axis $max(abs(a),abs(b))$, the half of the minor axis $min(abs(a),abs(b))$, +the equation as following: +\begin{equation}\label{FunctionOfStandardEllipse} +\dfrac{(x-x_0)^2}{a^2}+\dfrac{(y-y_0)^2}{b^2}=1 +\end{equation} +Sometimes we use the parametric function of the Standard Ellipse with coordinate translation: +\begin{equation}\label{ParametricFunctionOfEllipse} +\left\{\begin{array}{l} +x=a\cos\alpha+x_0\\ +y=b\sin\alpha+y_0 +\end{array}\right. +\end{equation} + +The Macro \Lcs{pstEllipse} is used to draw a Standard Ellipse with center $O$ from +\Lkeyword{angleA} to \Lkeyword{angleB}, going counter clockwise. +It combines the function like \Lcs{psellipse} and \Lcs{psellipticarc} in \PST. +If \Lkeyword{angleA} and \Lkeyword{angleB} are not specified, +the macro will draw the whole ellipse. + +\begin{BDef} +\Lcs{pstEllipse}\OptArgs\Largr{O}\Largr{$a,\,b$}\OptArg{angleA}\OptArg{angleB} +\end{BDef} + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](0,0)(4,4) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\ra{2.4}\def\rb{0.8}\def\rot{56} +\pstGeonode[PosAngle=-90,PointNameSep=0.2](2,2){O} +%\psellipse[linecolor=red!60](O)(\ra,\rb) +\pstEllipse[linecolor=red!60](O)(\ra,\rb)[0][120] +\pstEllipse[linecolor=green!60,linestyle=dashed,arrows=->,arrowscale=1.2](O)(\ra,\rb)[120][200] +\pstEllipse[linecolor=blue!60](O)(\ra,\rb)[200][300] +\pstEllipse[linecolor=purple!60,linestyle=dashed,arrows=->,arrowscale=1.2](O)(\ra,\rb)[300][360] +\pstEllipse[linecolor=cyan!60](O)(\rb,\ra) +\end{pspicture} +\end{LTXexample} + +Now you can draw some points on this Ellipse using macro \Lcs{pstEllipseNode} or \Lcs{pstEllipseRotNode}. +The macro \Lcs{pstEllipseNode} requires an explicit parameter $t$ as $\alpha$ in equation (\ref{ParametricFunctionOfEllipse}) +to calculate the point; but the macro \Lcs{pstEllipseRotNode} requires an implicit parameter \Lkeyword{RotAngle} +as $\alpha$ in equation (\ref{ParametricFunctionOfEllipse}) to calculate the point. + +\begin{BDef} +\Lcs{pstEllipseNode}\OptArgs\Largr{O}\Largr{$a,b$}\Largb{$t$}\Largb{P}\\ +\Lcs{pstEllipseRotNode}\OptArgs\Largr{O}\Largr{$a,b$}\Largb{P} +\end{BDef} + +The following is the example, note that the \Lkeyword{RotAngle} is not $\angle{HOX}$ in geometrical, +but $\angle{HOA}$ or $\angle{HOB}$. +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](0,0)(4,4) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\ra{2.4}\def\rb{0.8}\def\rot{56} +\pstGeonode[PosAngle=-90,PointNameSep=0.2](2,2){O} +%\psellipse[linecolor=red!60](O)(\ra,\rb) +\pstEllipse[linecolor=red!60](O)(\ra,\rb) +\pstEllipseNode[PosAngle=180](O)(\ra,\rb){180}{P} +\pstEllipseRotNode[PosAngle=0,RotAngle=0](O)(\ra,\rb){Q} +\pstEllipseRotNode[PosAngle=90,RotAngle=90](O)(\ra,\rb){M} +\pstEllipseRotNode[PosAngle=-90,RotAngle=-90](O)(\ra,\rb){N} +\pstCircleOA[linecolor=blue!60,Radius=\pstDistVal{\ra}]{O}{} +\pstCircleRotNode[PosAngle=\rot,RotAngle=\rot,Radius=\pstDistVal{\ra}]{O}{}{A} +\pstCircleOA[linecolor=green!60,Radius=\pstDistVal{\rb}]{O}{} +\pstCircleRotNode[PosAngle=180,RotAngle=\rot,Radius=\pstDistVal{\rb}]{O}{}{B} +\pstEllipseRotNode[PosAngle=30,RotAngle=\rot](O)(\ra,\rb){X} +\pstProjection[PosAngle=-90]{P}{Q}{A}[H] +\pstLineAB[linestyle=dashed]{A}{O} +\pstLineAB[linestyle=dashed]{A}{H} +\pstLineAB[linestyle=dashed]{B}{X} +\pstLineAB[linestyle=dashed]{O}{H} +\pstMarkAngle[LabelSep=.6,MarkAngleRadius=.3,MarkAngleType=double,fillcolor=red!30,fillstyle=solid]{H}{O}{A}{$\rot^\circ$} +\end{pspicture} +\end{LTXexample} + +The macros \Lcs{pstEllipseAbsNode} and \Lcs{pstEllipseOrdNode} are used to get the two nodes $A$ and $B$ +whose abscissas or ordinates are the given value $x_1$ or $y_1$ on the Standard Ellipse $E$. + +If there is no such point satisfied this condition, then the nodes $A$ and $B$ will be put at the origin. + +\begin{BDef} +\Lcs{pstEllipseAbsNode}\OptArgs\Largr{O}\Largr{$a,b$}\Largb{$x_1$}\Largb{A}\Largb{B}\\ +\Lcs{pstEllipseOrdNode}\OptArgs\Largr{O}\Largr{$a,b$}\Largb{$y_1$}\Largb{A}\Largb{B} +\end{BDef} + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](0,0)(4,4) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\ra{2.0}\def\rb{-1.2} +\pstGeonode[PosAngle=-50,PointNameSep=0.2](2,2){O} +\pstEllipse[linecolor=red!40](O)(\ra,\rb) +\pstEllipse[linecolor=blue!40](O)(\rb,\ra) +\pstEllipseAbsNode[PosAngle={120,200}](O)(\ra,\rb){2.5}{A}{B} +\pstEllipseAbsNode(O)(\ra,\rb){6}{X}{Y} % not exist +\pstEllipseOrdNode(O)(\ra,\rb){2.5}{A'}{B'} +\pstEllipseOrdNode(O)(\ra,\rb){6}{X'}{Y'} % not exist +\end{pspicture} +\end{LTXexample} + +Here we find the focus node of Standard Ellipse! Please use macro \Lcs{pstEllipseFocusNode} to do this work. + +\begin{BDef} +\Lcs{pstEllipseFocusNode}\OptArgs\Largr{O}\Largr{$a,b$}\Largb{A}\Largb{B} +\end{BDef} + +For example: + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](0,0)(4,4) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\ra{2.0}\def\rb{-1.2} +\pstGeonode[PosAngle=-50,PointNameSep=0.2](2,2){O} +\pstEllipse[linecolor=red!40](O)(\ra,\rb) +\pstEllipse[linecolor=blue!40](O)(\rb,\ra) +\pstEllipseFocusNode(O)(\ra,\rb){L}{R} +\pstEllipseFocusNode(O)(\rb,\ra){D}{U} +\end{pspicture} +\end{LTXexample} + +The macro \Lcs{pstEllipseDirectrixLine} is used to draw the two directrix lines of Standard Ellipse, +and create two new nodes on each of them. The nodes $L_x$, $L_y$ are on the left/down directrix line, +and $R_x$, $R_y$ are on the right/up directrix line. They are lie on the tangent line of the vertex +on the other axis. + +\begin{BDef} +\Lcs{pstEllipseDirectrixLine}\OptArgs\Largr{O}\Largr{$a,b$}\Largb{$L_x$}\Largb{$L_y$}\Largb{$R_x$}\Largb{$R_y$} +\end{BDef} + +For example: + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](0,0)(4,4) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\ra{2.0}\def\rb{-1.2} +\pstGeonode[PosAngle=-50,PointNameSep=0.2](2,2){O} +\pstEllipse[linecolor=red!40](O)(\ra,\rb) +\pstEllipse[linecolor=blue!40](O)(\rb,\ra) +\pstEllipseDirectrixLine[PointName={L_x,L_y,R_x,R_y},PosAngle={210,210,-30,-30},nodesep=-1,linecolor=red!40](O)(\ra,\rb){Lx}{Ly}{Rx}{Ry} +\pstEllipseDirectrixLine[PointName={D_x,D_y,U_x,U_y},PosAngle={-30,-30,30,30},nodesep=-1,linecolor=blue!40](O)(\rb,\ra){Dx}{Dy}{Ux}{Uy} +\pstLine[nodesep=-0.5,linecolor=black!40,linestyle=dashed]{Lx}{Rx} +\pstLine[nodesep=-0.5,linecolor=black!40,linestyle=dashed]{Ly}{Ry} +\pstLine[nodesep=-0.5,linecolor=black!40,linestyle=dashed]{Dx}{Ux} +\pstLine[nodesep=-0.5,linecolor=black!40,linestyle=dashed]{Dy}{Uy} +\end{pspicture} +\end{LTXexample} + +Sometimes we need to find the intersection of Ellipse and line, +the Macro \Lcs{pstEllipseLineInter} can do this work, and it can handle any type of line, +i.e, horizontal, vertical or others lines. It get the two intersection $C$ and $D$ of the +Standard Ellipse $E$ and the given line $AB$. When there is none intersection, +$C$ and $D$ are both put at the origin; When there is only on intersection, it will be saved +at node $C$, and $D$ will be put at the origin. + +\begin{BDef} +\Lcs{pstEllipseLineInter}\OptArgs\Largr{O}\Largr{$a,b$}\Largb{$A$}\Largb{$B$}\Largb{$C$}\Largb{$D$} +\end{BDef} + +Here is examples: + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](0,0)(4,4) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\ra{2.0}\def\rb{-1.2} +\pstGeonode[PosAngle=-50,PointNameSep=0.2](2,2){O} +\pstEllipse[linecolor=red!40](O)(\ra,\rb) +\pstEllipse[linecolor=blue!40](O)(\rb,\ra) +\pstLine[nodesep=-0.5,linecolor=black!40,linestyle=dashed]{0,1}{3,4} +\pstEllipseLineInter[PosAngle={-90,90}](O)(\ra,\rb){0,1}{3,4}{C}{D} +\pstEllipseLineInter[PosAngle={-90,90}](O)(\rb,\ra){0,1}{3,4}{C'}{D'} +\pstLine[nodesep=-0.5,linecolor=black!40,linestyle=dashed]{1.5,0}{1.5,4} +\pstEllipseLineInter[PosAngle={40,60}](O)(\ra,\rb){1.5,0}{1.5,4}{E}{F} +\pstEllipseLineInter[PosAngle={40,130}](O)(\rb,\ra){1.5,1}{1.5,4}{E'}{F'} +\pstLine[nodesep=-0.5,linecolor=black!40,linestyle=dashed]{4,2.5}{0,2.5} +\pstEllipseLineInter[PosAngle={130,50}](O)(\ra,\rb){4,2.5}{0,2.5}{G}{H} +\pstEllipseLineInter[PosAngle={130,50}](O)(\rb,\ra){4,2.5}{0,2.5}{G'}{H'} +\end{pspicture} +\end{LTXexample} + +The macro \Lcs{pstEllipsePolarNode} is use to draw the tangent line of a point $A$ or $B$ +on the Standard Ellipse. It draws the every tangent line through the point $A$ and $B$ on +the Standard Ellipse $E$ and get the insection node $T$ of the two tangent lines. +We call $T$ as the polar point of chord $AB$ as normal. + +\begin{BDef} +\Lcs{pstEllipsePolarNode}\OptArgs\Largr{O}\Largr{$a,b$}\Largb{$A$}\Largb{$B$}\Largb{$T$} +\end{BDef} + +We use the following theorem to find the node $T$: +\begin{theorem}\label{EllipsePolarPointTheorem} +Give chord $AB$ on the ellipse, we draw any other two chords $PQ$ and $RS$, $AB$ and $PQ$ intersect at $I$, +$AQ$ and $BP$ intersect at $X$, $AP$ and $BQ$ intersect at $Y$, we call $XY$ is the polar line of point $I$. +Also $AB$ and $RS$ intersect at $J$, $AR$ and $BS$ intersect at $M$, $AS$ and $BR$ intersect at $N$, +we call $MN$ is the polar line of point $J$. Then the intersection $T$ of $XY$ and $MN$ is the polar point of chord $AB$, +i.e. $TA$ is the tangent line through $A$ and $TB$ is the tangent line through $B$. +\end{theorem} + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](0,0)(4,4) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\rb{2.0}\def\ra{-1.2} +\pstGeonode[PosAngle=-50,PointNameSep=0.2](2,2){O} +\pstEllipse[linecolor=red!40](O)(\ra,\rb) +\pstLine[nodesep=-0.8,linecolor=black!40,linestyle=dashed]{1,2}{2.5,3.5} +\pstEllipseLineInter[PosAngle={-100,90}](O)(\ra,\rb){1,2}{2.5,3.5}{A}{B} +\pstEllipsePolarNode[PosAngle=120](O)(\ra,\rb){A}{B}{T} +% Here are the auxiliary lines to explain Theorem 1. +\pstEllipseRotNode[PosAngle=0,RotAngle=5](O)(\ra,\rb){P} +\pstEllipseRotNode[PosAngle=-10,RotAngle=-61](O)(\ra,\rb){Q} +\pstEllipseRotNode[PosAngle=-100,RotAngle=-92](O)(\ra,\rb){R} +\pstEllipseRotNode[PosAngle=0,RotAngle=-30](O)(\ra,\rb){S} +\pstInterLL[PosAngle=-90]{A}{Q}{B}{P}{X} +\pstInterLL[PosAngle=-10]{A}{P}{B}{Q}{Y} +\pstInterLL[PosAngle=-90]{A}{R}{B}{S}{M} +\pstInterLL[PosAngle=190]{A}{S}{B}{R}{N} +\psset{linestyle=dashed,linecolor=gray!40} +\pstLine{A}{Q}\pstLine{B}{P}\pstLine{A}{P}\pstLine{B}{Q} +\pstLine{A}{R}\pstLine{B}{S}\pstLine{A}{S}\pstLine{B}{R} +\pstLine{Q}{X}\pstLine{Q}{Y}\pstLine{P}{X}\pstLine{P}{Y} +\pstLine{R}{M}\pstLine{S}{M}\pstLine{T}{Y}\pstLine{T}{N} +\pstLine[linestyle=dashed,linecolor=red!40]{X}{Y} +\pstLine[linestyle=dashed,linecolor=red!40]{M}{N} +\end{pspicture} +\end{LTXexample} + +The macro \Lcs{pstEllipseTangentNode} is use to draw the tangent line of a point $T$ +out of the Standard Ellipse $E$. It draw the two tangent lines through the point $T$ +to the Standard Ellipse $E$ and get the node $A$ and $B$ on the Ellipse. + +\begin{BDef} +\Lcs{pstEllipseTangentNode}\OptArgs\Largr{O}\Largr{$a,b$}\Largb{$T$}\Largb{$A$}\Largb{$B$} +\end{BDef} + +We use the following theorem to find the tangent node of the given $T$: +\begin{theorem}\label{EllipseTangentPointTheorem} +Give point $T$ outside of the ellipse, we draw any other two chords $TPQ$ and $TRS$, +let $PS$ and $QR$ intersect at $I$, $PR$ and $QS$ intersect at $X$, $XI$ and Ellipse intersect at $A$ and $B$, +then $TA$ is the tangent line through $A$ and $TB$ is the tangent line through $B$. +\end{theorem} + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](0,0)(4,4) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\ra{2.0}\def\rb{-1.2} +\pstGeonode[PosAngle=-50,PointNameSep=0.2](2,2){O} +\pstEllipse[linecolor=red!40](O)(\ra,\rb) +\pstGeonode[PosAngle=-50,PointNameSep=0.2](-1,-1){T} +\pstEllipseTangentNode[PosAngle=120](O)(\ra,\rb){T}{A}{B} +% Here are the auxiliary lines to explain Theorem 2. +\pstEllipseRotNode[PointName=none,RotAngle=71](O)(\ra,\rb){P0} +\pstEllipseRotNode[PointName=none,RotAngle=31](O)(\ra,\rb){R0} +\pstEllipseLineInter[PosAngle=0](O)(\ra,\rb){T}{P0}{P}{Q} +\pstEllipseLineInter[PosAngle=0](O)(\ra,\rb){T}{R0}{R}{S} +\pstInterLL[PosAngle=0]{P}{S}{Q}{R}{I} +\pstInterLL[PosAngle=0]{P}{R}{Q}{S}{X} +\psset{linestyle=dashed,linecolor=gray!40} +\pstLine{T}{P}\pstLine{P}{Q}\pstLine{T}{R}\pstLine{R}{S} +\pstLine{P}{S}\pstLine{Q}{R}\pstLine{P}{R}\pstLine{Q}{S} +\end{pspicture} +\end{LTXexample} + +\subsection{General Ellipse} +Now we will introduce some macros for the General Ellipse as same as the Standard Ellipse. +The General Ellipse $E$ with coordinate translation and rotation is defined by center $O(x_0,y_0)$, +the half of the major axis $max(abs(a),abs(b))$, the half of the minor axis $min(abs(a),abs(b))$, +and the rotation angle $\theta$ of the major axis. + +The equation can be got from the parametric function of the ellipse equation (\ref{ParametricFunctionOfEllipse}), +using the rotation transform formula: +\begin{equation}\label{RotationTransformFormula} +\left\{\begin{array}{l} +x'=x\cos\theta-y\sin\theta\\ +y'=x\sin\theta+y\cos\theta +\end{array}\right. +\end{equation} +then we have +\begin{equation} +\left\{\begin{array}{l} +x'=(a\cos\alpha+x_0)\cos\theta-(b\sin\alpha+y_0)\sin\theta=a\cos\alpha\cos\theta-b\sin\alpha\sin\theta+x_0'\\ +y'=(a\cos\alpha+x_0)\sin\theta+(b\sin\alpha+y_0)\cos\theta=a\cos\alpha\sin\theta+b\sin\alpha\cos\theta+y_0' +\end{array}\right. +\end{equation} +where the $x_0'$ and $y_0'$ are the coordinate of the given center $O$ after rotation. +So we get the parametric function of the General Ellipse with coordinate translation and rotation as following: +\begin{equation}\label{ParametricFunctionOfGeneralEllipse} +\left\{\begin{array}{l} +x=a\cos\alpha\cos\theta-b\sin\alpha\sin\theta+x_0\\ +y=a\cos\alpha\sin\theta+b\sin\alpha\cos\theta+y_0 +\end{array}\right. +\end{equation} + +The Macro \Lcs{pstGeneralEllipse} is used to draw a General Ellipse with center $O$ from +\Lkeyword{angleA} to \Lkeyword{angleB}, going counter clockwise. +If \Lkeyword{angleA} and \Lkeyword{angleB} are not specified, +the macro will draw the whole ellipse. +If you not input rotation angle $\theta$, the default value is $0^\circ$, +at this time, the result of this macro is same as \Lcs{pstEllipse}. +That is, \Lcs{pstGeneralEllipse} is more complex than \Lcs{pstEllipse}! + +\begin{BDef} +\Lcs{pstGeneralEllipse}\OptArgs\Largr{O}\Largr{$a,\,b$}\OptArg{$\theta$}\OptArg{angleA}\OptArg{angleB} +\end{BDef} + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](0,0)(4,4) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\ra{2.4}\def\rb{-1.5} +\pstGeonode[PosAngle=-90,PointNameSep=0.2](2,2){O} +\pstGeneralEllipse[linecolor=red!40](O)(\ra,\rb)[0] +\pstGeneralEllipse[linecolor=gray!10](O)(\ra,\rb)[10] +\pstGeneralEllipse[linecolor=gray!20](O)(\ra,\rb)[20] +\pstGeneralEllipse[linecolor=gray!30](O)(\ra,\rb)[30] +\pstGeneralEllipse[linecolor=gray!40](O)(\ra,\rb)[40] +\pstGeneralEllipse[linecolor=magenta!40](O)(\ra,\rb)[50] +\end{pspicture} +\end{LTXexample} + +Similarly, we can location the points on the General Ellipse using the macros +\Lcs{pstGeneralEllipseNode}, \Lcs{pstGeneralEllipseRotNode}, \Lcs{pstGeneralEllipseAbsNode} +and \Lcs{pstGeneralEllipseOrdNode} as following. + +\begin{BDef} +\Lcs{pstGeneralEllipseNode}\OptArgs\Largr{O}\Largr{$a,\,b$}\OptArg{$\theta$}\Largb{$t$}\Largb{A}\\ +\Lcs{pstGeneralEllipseRotNode}\OptArgs\Largr{O}\Largr{$a,\,b$}\OptArg{$\theta$}\Largb{A}\\ +\Lcs{pstGeneralEllipseAbsNode}\OptArgs\Largr{O}\Largr{$a,\,b$}\OptArg{$\theta$}\Largb{$x_1$}\Largb{A}\Largb{B}\\ +\Lcs{pstGeneralEllipseOrdNode}\OptArgs\Largr{O}\Largr{$a,\,b$}\OptArg{$\theta$}\Largb{$y_1$}\Largb{A}\Largb{B} +\end{BDef} + +Some examples all together: +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](0,0)(4,4) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\ra{2.4}\def\rb{-1.5} +\pstGeonode[PosAngle=-90,PointNameSep=0.2](2,2){O} +\pstGeneralEllipse[linecolor=magenta!40](O)(\ra,\rb)[50] +\pstGeneralEllipseNode[PosAngle=30](O)(\ra,\rb)[50]{30}{A} +\pstGeneralEllipseRotNode[PosAngle=120,RotAngle=120](O)(\ra,\rb)[50]{B} +\pstGeneralEllipseRotNode[PosAngle=0,RotAngle=0](O)(\ra,\rb)[50]{C} +\pstGeneralEllipseRotNode[PosAngle=0,RotAngle=90](O)(\ra,\rb)[50]{D} +\pstGeneralEllipseRotNode[PosAngle=-90,RotAngle=180](O)(\ra,\rb)[50]{E} +\pstGeneralEllipseRotNode[PosAngle=90,RotAngle=-90](O)(\ra,\rb)[50]{F} +\pstGeneralEllipseAbsNode[PosAngle={60,240}](O)(\ra,\rb)[50]{2}{I}{J} +\pstGeneralEllipseOrdNode[PosAngle={-40,210}](O)(\ra,\rb)[50]{1}{M}{N} +\pstLineAB[nodesep=-1,linecolor=blue!40]{C}{E} +\pstLineAB[nodesep=-1,linecolor=blue!40]{D}{F} +\end{pspicture} +\end{LTXexample} + +Using macro \Lcs{pstGeneralEllipseFocusNode} to find the two focus nodes, and macro \\ +\Lcs{pstGeneralEllipseDirectrixLine} to get the two directrix lines. + +\begin{BDef} +\Lcs{pstGeneralEllipseFocusNode}\OptArgs\Largr{O}\Largr{$a,\,b$}\OptArg{$\theta$}\Largb{$t$}\Largb{A}\\ +\Lcs{pstGeneralEllipseDirectrixLine}\OptArgs\Largr{O}\Largr{$a,\,b$}\OptArg{$\theta$}\Largb{A} +\end{BDef} + +for example, +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](0,0)(4,4) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\ra{2.4}\def\rb{-1.5} +\pstGeonode[PosAngle=-90,PointNameSep=0.2](2,2){O} +\pstGeneralEllipse[linecolor=magenta!40](O)(\ra,\rb)[50] +\pstGeneralEllipseFocusNode[PosAngle={-40,-40}](O)(\ra,\rb)[50]{L}{R} +\pstGeneralEllipseDirectrixLine[PointName={L_x,L_y,R_x,R_y},nodesep=-1,linecolor=magenta](O)(\ra,\rb)[50]{Lx}{Ly}{Rx}{Ry} +\pstLine[nodesep=-1,linecolor=red!40]{L}{R} +\pstLine[nodesep=-1,linecolor=red!40,linestyle=dashed]{Lx}{Rx} +\pstLine[nodesep=-1,linecolor=red!40,linestyle=dashed]{Ly}{Ry} +\end{pspicture} +\end{LTXexample} + +Using \Lcs{pstGeneralEllipseLineInter} to get the two intersections $C$ and $D$ of the General Ellipse $E$ and the given line $AB$! + +\begin{BDef} +\Lcs{pstGeneralEllipseLineInter}\OptArgs\Largr{O}\Largr{$a,\,b$}\OptArg{$\theta$}\Largb{A}\Largb{B}\Largb{C}\Largb{D} +\end{BDef} + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](0,0)(4,4) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\ra{1.5}\def\rb{-2.4} +\pstGeonode[PosAngle=-90,PointNameSep=0.2](2,2){O} +\pstGeneralEllipse[linecolor=blue!40](O)(\ra,\rb)[50] +\pstLine[nodesep=-0.5,linecolor=black!40,linestyle=dashed]{0,1}{1.5,4} +\pstGeneralEllipseLineInter[PosAngle={-90,90}](O)(\ra,\rb)[50]{0,1}{1.5,4}{A}{B} +\pstLine[nodesep=-0.5,linecolor=black!40,linestyle=dashed]{0,3}{3,3} +\pstGeneralEllipseLineInter[PosAngle={-90,240}](O)(\ra,\rb)[50]{0,3}{3,3}{C}{D} +\pstLine[nodesep=-0.5,linecolor=black!40,linestyle=dashed]{1,0}{1,4} +\pstGeneralEllipseLineInter[PosAngle={30,10}](O)(\ra,\rb)[50]{1,1}{1,4}{E}{F} +\end{pspicture} +\end{LTXexample} + +Using \Lcs{pstGeneralEllipsePolarNode} to find the polar point $T$ of chord $AB$, +please refer to Theorem \ref{EllipsePolarPointTheorem}. + +\begin{BDef} +\Lcs{pstGeneralEllipsePolarNode}\OptArgs\Largr{O}\Largr{$a,\,b$}\OptArg{$\theta$}\Largb{A}\Largb{B}\Largb{T} +\end{BDef} + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](0,0)(4,4) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\ra{1.5}\def\rb{-2.4} +\pstGeonode[PosAngle=-90,PointNameSep=0.2](2,2){O} +\pstGeneralEllipse[linecolor=blue!40](O)(\ra,\rb)[50] +\pstLine[nodesep=-0.5,linecolor=black!40,linestyle=dashed]{0,1}{1.5,4} +\pstGeneralEllipseLineInter[PosAngle={-90,90}](O)(\ra,\rb)[50]{0,1}{1.5,4}{A}{B} +\pstGeneralEllipsePolarNode[PosAngle=90](O)(\ra,\rb)[50]{A}{B}{T} +\end{pspicture} +\end{LTXexample} + +Using \Lcs{pstGeneralEllipseTangentNode} to find the tangent point $A$ and $B$ of outside point $T$, +please refer to Theorem \ref{EllipseTangentPointTheorem}. + +\begin{BDef} +\Lcs{pstGeneralEllipseTangentNode}\OptArgs\Largr{O}\Largr{$a,\,b$}\OptArg{$\theta$}\Largb{T}\Largb{A}\Largb{B} +\end{BDef} + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](0,0)(4,4) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\ra{1.5}\def\rb{-2.4} +\pstGeonode[PosAngle=-90,PointNameSep=0.2](2,2){O} +\pstGeneralEllipse[linecolor=blue!40](O)(\ra,\rb)[50] +\pstGeonode[PosAngle=-90,PointNameSep=0.2](-1,-1){P} +\pstGeneralEllipseTangentNode[PosAngle=90](O)(\ra,\rb)[50]{P}{X}{Y} +\end{pspicture} +\end{LTXexample} + +\clearpage + +\subsection{Standard Parabola} +The Standard Parabola $P$ with coordinate translation is defined by vertex $O(x_0,y_0)$, +the half of the focus chord axis $abs(p)$. +Note that the sign of $p$ indicates the direction of the parabola. + +The equation can be written as: +\begin{equation}\label{FunctionOfStandardParabola} +(x-x_0)^2=2p(y-y_0) +\end{equation} +and the parametric function can be written as: +\begin{equation}\label{ParametricFunctionOfStandardParabola} +\left\{\begin{array}{l} +x=t+x_0\\ +y=\dfrac{t^2}{2p}+y_0 +\end{array}\right. +\end{equation} + +The macro \Lcs{pstParabola} is used to draw a Parabola from $x_1$ to $x_2$ with Vertex $O$, +the half of the focus chord axis $abs(p)$. + +\begin{BDef} + \Lcs{pstParabola}\OptArgs\Largr{O}\Largb{$p$}\Largb{$x_1$}\Largb{$x_2$} +\end{BDef} + +The macro \Lcs{pstParabolaNode} is used to draw a node whose parameter is the given value $t$ on parabola, +please refer to equation (\ref{ParametricFunctionOfStandardParabola}). +The macro \Lcs{pstParabolaAbsNode} is used to draw a node whose abscissa is the given value $x_1$ on parabola. +The macro \Lcs{pstParabolaOrdNode} is used to draw a node whose ordinate is the given value $y_1$ on parabola. +Note that \Lcs{pstParabolaOrdNode} will create two nodes $A$ and $B$ at most time. + +\begin{BDef} +\Lcs{pstParabolaNode}\OptArgs\Largr{O}\Largb{$p$}\Largb{$t$}\Largb{A}\\ +\Lcs{pstParabolaAbsNode}\OptArgs\Largr{O}\Largb{$p$}\Largb{$x_1$}\Largb{A}\\ +\Lcs{pstParabolaOrdNode}\OptArgs\Largr{O}\Largb{$p$}\Largb{$y_1$}\Largb{A}\Largb{B} +\end{BDef} + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](0,-1)(4,3) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\p{0.4} +\pstGeonode[PosAngle=-130,PointNameSep=0.2](2,0){O} +\pstParabola[linecolor=red!40](O){\p}{-1.5}{1.5} +\pstParabolaNode[PosAngle=-90](O){\p}{1.5}{A} +\pstParabolaAbsNode[PosAngle=-90,PointName=X_1](O){\p}{1.5}{X1} +\pstParabolaOrdNode[PosAngle=40,PointName={Y_1,Y_2}](O){\p}{1.5}{Y1}{Y2} +\end{pspicture} +\end{LTXexample} + +The macro \Lcs{pstParabolaFocusNode} is used to find the focus of the parabola, +and the macro \Lcs{pstParabolaDirectrixLine} is used to find the directrix line of the parabola. + +\begin{BDef} +\Lcs{pstParabolaFocusNode}\OptArgs\Largr{O}\Largb{$p$}\Largb{F}\\ +\Lcs{pstParabolaDirectrixLine}\OptArgs\Largr{O}\Largb{$p$}\Largb{$L_x$}\Largb{$L_y$} +\end{BDef} + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](0,-1)(4,3) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\p{0.4} +\pstGeonode[PosAngle=-130,PointNameSep=0.2](2,0){O} +\pstParabola[linecolor=red!40](O){\p}{-1.5}{1.5} +\pstParabolaFocusNode[linecolor=red!40,PosAngle=50](O){\p}{F} +\pstParabolaDirectrixLine[linecolor=red!40,nodesepA=-1.8,nodesepB=-1,PosAngle={-50,-50}](O){\p}{A}{B} +\pstLine[linecolor=red!40,nodesepA=-0.8,nodesepB=-2.5]{A}{F} +\end{pspicture} +\end{LTXexample} + +The macro \Lcs{pstParabolaLineInter} is used to find the intersections $C$ and $D$ of the parabola and the given line $AB$. + +\begin{BDef} +\Lcs{pstParabolaLineInter}\OptArgs\Largr{O}\Largb{$p$}\Largb{A}\Largb{B}\Largb{C}\Largb{D} +\end{BDef} + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](0,-1)(4,3) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\p{0.4} +\pstGeonode[PosAngle=-90,PointNameSep=0.2](2,0){O} +\pstParabola[linecolor=red!40](O){\p}{-1.5}{1.5} +\pstLine[linecolor=gray!40,nodesepA=-0.8,nodesepB=-0.8]{0,2}{4,1} +\pstParabolaLineInter[linecolor=gray!40,PosAngle={120,210}](O){\p}{0,2}{4,1}{P}{Q} +\pstLine[linecolor=purple!40,nodesepA=-0.8,nodesepB=-0.8]{2.5,0}{2.5,3} +\pstParabolaLineInter[linecolor=purple!40,PosAngle={0,210}](O){\p}{2.5,0}{2.5,3}{U}{V} +\pstLine[linecolor=green!40,nodesepA=-2.5,nodesepB=-1.6]{1.5,2.5}{0.5,2.5} +\pstParabolaLineInter[linecolor=green!40,PosAngle={210,210}](O){\p}{1.5,2.5}{0.5,2.5}{M}{N} +\end{pspicture} +\end{LTXexample} + +The macro \Lcs{pstParabolaPolarNode} is used to find the polar point $T$ of chord $AB$ on Parabola $P$. + +\begin{BDef} +\Lcs{pstParabolaPolarNode}\OptArgs\Largr{O}\Largb{$p$}\Largb{A}\Largb{B}\Largb{T}\\ +\Lcs{pstParabolaPolarNode}\OptArgs\Largr{O}\Largb{$p$}\Largr{F}\Largb{A}\Largb{B}\Largb{T}\\ +\Lcs{pstParabolaPolarNode}\OptArgs\Largr{O}\Largb{$p$}\Largr{F}\OptArg{$L_x$}\OptArg{$L_y$}\Largb{A}\Largb{B}\Largb{T} +\end{BDef} + +We use the following theorem to find the polar point $T$ of chord $AB$: +\begin{theorem}\label{ParabolaPolarPointTheorem} +Give any chord $AB$ on parabola, drawing two focal chord $AFC$ and $BFD$, where $F$ is the focus of parabola, +then drawing $FX$ which is perpendicular to $AFC$ at point $F$, and intersect with the directrix line at $X$; +also drawing $FY$ which is perpendicular to $BFD$ at point $F$, and intersect with the directrix line at $Y$. +Then the intersection $T$ of $AX$ and $BY$ is the polar point of chord $AB$. +\end{theorem} + +If you don't know the focus $F$, or the directrix line, we will find them automated, otherwise you can pass them to this macro. + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](-1,-2)(4,4) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\p{0.4} +\pstGeonode[PosAngle=-130,PointNameSep=0.2](2,0){O} +\pstParabola[linecolor=red!40](O){\p}{-1.5}{1.5} +\pstLine[linecolor=gray!40,nodesepA=-0.8,nodesepB=-0.8]{0,2}{4,1} +\pstParabolaLineInter[linecolor=gray!40,PosAngle={120,210}](O){\p}{0,2}{4,1}{P}{Q} +% if you don't know focus F or directrix line +\pstParabolaPolarNode[linecolor=purple!40,PosAngle=-90](O){\p}{P}{Q}{T} +\end{pspicture} +\end{LTXexample} + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](-1,-2)(4,4) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\p{0.4} +\pstGeonode[PosAngle=-130,PointNameSep=0.2](2,0){O} +\pstParabola[linecolor=red!40](O){\p}{-1.5}{1.5} +\pstParabolaFocusNode[linecolor=red!40](O){\p}{F} +\pstLine[linecolor=gray!40,nodesepA=-0.8,nodesepB=-0.8]{0,2}{4,1} +\pstParabolaLineInter[linecolor=gray!40,PosAngle={120,210}](O){\p}{0,2}{4,1}{P}{Q} +% if you know focus F, but don't known directrix line +\pstParabolaPolarNode[linecolor=purple!40,PosAngle=-90](O){\p}(F){P}{Q}{T} +\end{pspicture} +\end{LTXexample} + +\vspace{1cm} + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](-1,-2)(4,4) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\p{0.4} +\pstGeonode[PosAngle=-130,PointNameSep=0.2](2,0){O} +\pstParabola[linecolor=red!40](O){\p}{-1.5}{1.5} +\pstParabolaFocusNode[linecolor=red!40](O){\p}{F} +\pstParabolaDirectrixLine[linecolor=red!40,nodesepA=-2.8,nodesepB=-2,PosAngle={-50,-50}](O){\p}{A}{B} +\pstLineAB[linecolor=red!40,nodesepA=-0.8,nodesepB=-2.5]{A}{F} +\pstLine[linecolor=gray!40,nodesepA=-0.8,nodesepB=-0.8]{0,2}{4,1} +\pstParabolaLineInter[linecolor=gray!40,PosAngle={120,210}](O){\p}{0,2}{4,1}{P}{Q} +% if you know focus F and also directrix line +\pstParabolaPolarNode[linecolor=purple!40,PosAngle=-90](O){\p}(F)[A][B]{P}{Q}{T} +\end{pspicture} +\end{LTXexample} + +\vspace{10pt} + +The macro \Lcs{pstParabolaTangentNode} is used to find the two nodes $A$ and $B$ on the Parabola through the point $T$. + +\begin{BDef} +\Lcs{pstParabolaTangentNode}\OptArgs\Largr{O}\Largb{$p$}\Largb{T}\Largb{A}\Largb{B} +\end{BDef} + +We use the following theorem to find the tangent node $A$ and $B$ of outside point $T$: +\begin{theorem}\label{ParabolaTangentPointTheorem} +Give point $T$ outside of the parabola, we draw any other two chords $TPQ$ and $TRS$, +$PS$ and $QR$ intersect at $I$, $PR$ and $QS$ intersect at $X$, $XI$ and Parabola intersect at $A$ and $B$, +then $TA$ is the tangent line through $A$ and $TB$ is the tangent line through $B$. +\end{theorem} + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](0,-2)(4,4) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\p{0.4} +\pstGeonode[PosAngle=-130,PointNameSep=0.2](2,0){O} +\pstParabola[linecolor=red!40](O){\p}{-1.5}{1.5} +\pstGeonode[PosAngle=-90](1.5,-1){T} +\pstParabolaTangentNode[linecolor=red!50,PosAngle={80,140},PointName={T_1,T_2}](O){\p}{T}{T1}{T2} +\pstGeonode[PosAngle=-90](2,-1){P} +\pstParabolaTangentNode[linecolor=red!50,PosAngle={80,140},PointName={P_1,P_2}](O){\p}{P}{P1}{P2} +\pstGeonode[PosAngle=-90](2.3,-1){X} +\pstParabolaTangentNode[linecolor=red!50,PosAngle={80,140},PointName={X_1,X_2}](O){\p}{X}{X1}{X2} +\end{pspicture} +\end{LTXexample} + +\subsection{Standard Inversion Parabola} +The Inversion Parabola $P$ with coordinate translation is defined by vertex $O(x_0,y_0)$, +the half of the focus chord axis $abs(p)$. +Note that the sign of $p$ indicates the direction of the parabola. +The equation can be written as: +\begin{equation}\label{StandardInversionParabola} +(y-y_0)^2=2p(x-x_0) +\end{equation} +and the parametric function can be written as: +\begin{equation}\label{ParametricFunctionOfStandardInversionParabola} +\left\{\begin{array}{l} +x=\dfrac{t^2}{2p}+x_0\\ +y=t+y_0 +\end{array}\right. +\end{equation} + +The macro \Lcs{pstIParabola} is used to draw a Standard Inversion Parabola from $y_1$ to $y_2$ with Vertex $O$, +the half of the focus chord axis $abs(p)$. + +\begin{BDef} +\Lcs{pstIParabola}\OptArgs\Largr{O}\Largb{$p$}\Largb{$y_1$}\Largb{$y_2$} +\end{BDef} + +The macro \Lcs{pstIParabolaNode} is used to draw a node whose parameter is the given value $t$ on parabola, +please refer to equation (\ref{ParametricFunctionOfStandardInversionParabola}). +The macro \Lcs{pstIParabolaAbsNode} is used to draw a node whose abscissa is the given value $x_1$ on parabola. +The macro \Lcs{pstIParabolaOrdNode} is used to draw a node whose ordinate is the given value $y_1$ on parabola. +Note that \Lcs{pstIParabolaAbsNode} will create two nodes $A$ and $B$ at most time. + +\begin{BDef} +\Lcs{pstIParabolaNode}\OptArgs\Largr{O}\Largb{$p$}\Largb{$t$}\Largb{A}\\ +\Lcs{pstIParabolaAbsNode}\OptArgs\Largr{O}\Largb{$p$}\Largb{$x_1$}\Largb{A}\Largb{B}\\ +\Lcs{pstIParabolaOrdNode}\OptArgs\Largr{O}\Largb{$p$}\Largb{$y_1$}\Largb{A} +\end{BDef} + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](-2,-2)(3,2) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\p{0.4} +\pstGeonode[PosAngle=0,PointNameSep=0.2](2,0){O} +\pstIParabola[linecolor=blue!40](O){-\p}{-1.5}{1.5} +\pstIParabolaNode[PosAngle=90](O){-\p}{1}{A} +\pstIParabolaAbsNode[PosAngle=90,PointName={X_2,X_3},PosAngle={-90,90}](O){-\p}{1.5}{X2}{X3} +\pstIParabolaOrdNode[PosAngle=-90,PointName=Y_3](O){-\p}{-1}{Y3} +\end{pspicture} +\end{LTXexample} + +The macro \Lcs{pstIParabolaFocusNode} is used to find the focus of the parabola, +and the macro \Lcs{pstIParabolaDirectrixLine} is used to find the directrix line of the parabola. + +\begin{BDef} +\Lcs{pstIParabolaFocusNode}\OptArgs\Largr{O}\Largb{$p$}\Largb{F}\\ +\Lcs{pstIParabolaDirectrixLine}\OptArgs\Largr{O}\Largb{$p$}\Largb{$L_x$}\Largb{$L_y$} +\end{BDef} + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](-2,-2)(3,2) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\p{0.4} +\pstGeonode[PosAngle=-30,PointNameSep=0.2](2,0){O} +\pstIParabola[linecolor=blue!40](O){-\p}{-1.5}{1.5} +\pstIParabolaFocusNode[linecolor=blue!40,PosAngle=120](O){-\p}{F} +\pstIParabolaDirectrixLine[linecolor=blue!40,nodesepA=-2,nodesepB=-1,PosAngle={50,20}](O){-\p}{C}{D} +\pstLine[linecolor=blue!40,nodesepA=-0.8,nodesepB=-2.5]{C}{F} +\end{pspicture} +\end{LTXexample} + +The macro \Lcs{pstIParabolaLineInter} is used to find the intersections $C$ and $D$ of the parabola and the given line $AB$. + +\begin{BDef} +\Lcs{pstIParabolaLineInter}\OptArgs\Largr{O}\Largb{$p$}\Largb{A}\Largb{B}\Largb{C}\Largb{D} +\end{BDef} + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](-2,-2)(3,2) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\p{0.4} +\pstGeonode[PosAngle=0,PointNameSep=0.2](2,0){O} +\pstIParabola[linecolor=blue!40](O){-\p}{-1.5}{1.5} +\pstLine[linecolor=gray!40]{0,2}{1,-2} +\pstIParabolaLineInter[linecolor=gray!40,PosAngle={70,-90}](O){-\p}{1,-2}{0,2}{P}{Q} +\pstLine[linecolor=purple!40]{1.2,-1.5}{1.2,1.5} +\pstIParabolaLineInter[linecolor=purple!40,PosAngle={-40,210}](O){-\p}{1.2,-1.5}{1.2,1.5}{U}{V} +\pstLine[linecolor=green!40]{-1,0.5}{2.5,0.5} +\pstIParabolaLineInter[linecolor=green!40,PosAngle={70,-90}](O){-\p}{-1,0.5}{2.5,0.5}{M}{N} +\end{pspicture} +\end{LTXexample} + +The macro \Lcs{pstIParabolaPolarNode} is used to find the polar point $T$ of chord $AB$ on Parabola $P$. + +\begin{BDef} +\Lcs{pstIParabolaPolarNode}\OptArgs\Largr{O}\Largb{$p$}\Largb{A}\Largb{B}\Largb{T}\\ +\Lcs{pstIParabolaPolarNode}\OptArgs\Largr{O}\Largb{$p$}\Largr{F}\Largb{A}\Largb{B}\Largb{T}\\ +\Lcs{pstIParabolaPolarNode}\OptArgs\Largr{O}\Largb{$p$}\Largr{F}\OptArg{$L_x$}\OptArg{$L_y$}\Largb{A}\Largb{B}\Largb{T} +\end{BDef} + +We also use the theorem \ref{ParabolaPolarPointTheorem} to find the polar point $T$ of chord $AB$. +If you don't know the focus $F$, or the directrix line, we will find them automated, otherwise you can pass them to this macro. + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](1,-2)(5,2) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\p{0.4} +\pstGeonode[PosAngle=-130,PointNameSep=0.2](2,0){O} +\pstIParabola[linecolor=red!40](O){\p}{-1.5}{1.5} +\pstLine[linecolor=gray!40,nodesepA=-0.5]{2,1}{4,-2} +\pstIParabolaLineInter[PosAngle={80,-100}](O){\p}{2,1}{4,-2}{P}{Q} +% if you don't know focus F or directrix line +\pstIParabolaPolarNode[linecolor=purple!40,PosAngle=-90](O){\p}{P}{Q}{T} +\end{pspicture} +\end{LTXexample} + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](1,-2)(5,2) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\p{0.4} +\pstGeonode[PosAngle=-130,PointNameSep=0.2](2,0){O} +\pstIParabola[linecolor=red!40](O){\p}{-1.5}{1.5} +\pstIParabolaFocusNode[linecolor=red!40](O){\p}{F} +\pstLine[linecolor=gray!40,nodesepA=-0.5]{2,1}{4,-2} +\pstIParabolaLineInter[PosAngle={80,-100}](O){\p}{2,1}{4,-2}{P}{Q} +% if you know focus F, but don't known directrix line +\pstIParabolaPolarNode[linecolor=purple!40,PosAngle=-90](O){\p}(F){P}{Q}{T} +\end{pspicture} +\end{LTXexample} + +\vspace{1cm} + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](1,-2)(5,2) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\p{0.4} +\pstGeonode[PosAngle=-130,PointNameSep=0.2](2,0){O} +\pstIParabola[linecolor=red!40](O){\p}{-1.5}{1.5} +\pstIParabolaFocusNode[linecolor=red!40](O){\p}{F} +\pstIParabolaDirectrixLine[linecolor=red!40,nodesepA=-2,nodesepB=-1,PosAngle={180,180}](O){\p}{A}{B} +\pstLine[linecolor=gray!40,nodesepA=-0.5]{2,1}{4,-2} +\pstIParabolaLineInter[PosAngle={80,-100}](O){\p}{2,1}{4,-2}{P}{Q} +% if you know focus F and also directrix line +\pstIParabolaPolarNode[linecolor=purple!40,PosAngle=-90](O){\p}(F)[A][B]{P}{Q}{T} +\end{pspicture} +\end{LTXexample} + +\vspace{10pt} + +The macro \Lcs{pstIParabolaTangentNode} is used to find the two nodes $A$ and $B$ on the Parabola through the point $T$. + +\begin{BDef} +\Lcs{pstIParabolaTangentNode}\OptArgs\Largr{O}\Largb{$p$}\Largb{T}\Largb{A}\Largb{B} +\end{BDef} + +We also use the theorem \ref{ParabolaTangentPointTheorem} to find the tangent node $A$ and $B$ of outside point $T$! + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](1,0)(5,4) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\p{0.4} +\pstGeonode[PosAngle=-45,PointNameSep=0.2](4,2){O} +\pstIParabola[linecolor=blue!40](O){-\p}{-1.5}{1.5} +\pstGeonode[PosAngle=0](5,1.5){T} +\pstIParabolaTangentNode[linecolor=red!50,PosAngle={80,-100},PointName={T_1,T_2}](O){-\p}{T}{T1}{T2} +\pstGeonode[PosAngle=0](5,2.5){P} +\pstIParabolaTangentNode[linecolor=red!50,PosAngle={80,90},PointName={P_1,P_2}](O){-\p}{P}{P1}{P2} +\pstGeonode[PosAngle=0](5,2){X} +\pstIParabolaTangentNode[linecolor=red!50,PosAngle={80,-100},PointName={X_1,X_2}](O){-\p}{X}{X1}{X2} +\end{pspicture} +\end{LTXexample} + +\subsection{General Parabola} +The General Parabola $P$ with coordinate translation and rotation is defined by vertex $O(x_0,y_0)$, +the half of the focus chord axis $abs(p)$, the sign of $p$ indicates the direction of the parabola, +and the rotation angle $\theta$ of the symmetrical axis. + +The equation can be got from the parametric function of the parabola equation (\ref{ParametricFunctionOfStandardParabola}), +using the rotation transform formula (\ref{RotationTransformFormula}), then we have +\begin{equation} +\left\{\begin{array}{l} +x'=(t+x_0)\cos\theta-(\dfrac{t^2}{2p}+y_0)\sin\theta=x_0'+t\cos\theta-t^2\dfrac{\sin\theta}{2p}\\ +y'=(t+x_0)\sin\theta+(\dfrac{t^2}{2p}+y_0)\cos\theta=y_0'+t\sin\theta+t^2\dfrac{\cos\theta}{2p} +\end{array}\right. +\end{equation} +where the $x_0'$ and $y_0'$ are the coordinate of the given vertex O after rotation. +So we get the parametric function of the General Parabola with coordinate translation and rotation as following: +\begin{equation}\label{ParametricFunctionOfGeneralParabola} +\left\{\begin{array}{l} +x=x_0+t\cos\theta-t^2\dfrac{\sin\theta}{2p}\\ +y=y_0+t\sin\theta+t^2\dfrac{\cos\theta}{2p} +\end{array}\right. +\end{equation} + +The macro \Lcs{pstGeneralParabola} is used to draw a General Parabola from $x_1$ to $x_2$ with Vertex $O$, +the half of the focus chord axis $abs(p)$. + +\begin{BDef} +\Lcs{pstGeneralParabola}\OptArgs\Largr{O}\Largb{$p$}\OptArg{$\theta$}\Largb{$x_1$}\Largb{$x_2$} +\end{BDef} + +The macro \Lcs{pstGeneralParabolaNode} is used to draw a node whose parameter is the given value $t$ on parabola, +please refer to equation (\ref{ParametricFunctionOfGeneralParabola}). +The macro \Lcs{pstGeneralParabolaAbsNode} is used to draw a node whose abscissa is the given value $x_1$ on parabola. +The macro \Lcs{pstGeneralParabolaOrdNode} is used to draw a node whose ordinate is the given value $y_1$ on parabola. + +Note that \Lcs{pstGeneralParabolaAbsNode} and \Lcs{pstGeneralParabolaOrdNode} both create two nodes $A$ and $B$ +at most time. + +\begin{BDef} +\Lcs{pstGeneralParabolaNode}\OptArgs\Largr{O}\Largb{$p$}\OptArg{$\theta$}\Largb{$t$}\Largb{A}\\ +\Lcs{pstGeneralParabolaAbsNode}\OptArgs\Largr{O}\Largb{$p$}\OptArg{$\theta$}\Largb{$x_1$}\Largb{A}\Largb{B}\\ +\Lcs{pstGeneralParabolaOrdNode}\OptArgs\Largr{O}\Largb{$p$}\OptArg{$\theta$}\Largb{$y_1$}\Largb{A}\Largb{B} +\end{BDef} + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](-1,-1)(4,4) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\p{0.4} +\pstGeonode[PosAngle=-40,PointNameSep=0.2](2,0){O} +\pstGeneralParabola[linecolor=red!10](O){\p}[0]{-1.5}{1.5} +\pstGeneralParabola[linecolor=red!15](O){\p}[10]{-1.5}{1.5} +\pstGeneralParabola[linecolor=red!25](O){\p}[30]{-1.5}{1.5} +\pstGeneralParabola[linecolor=red!40](O){\p}[50]{-1.5}{1.5} +\pstGeneralParabola[linecolor=red!60](O){\p}[90]{-1.5}{1.5} +\pstGeneralParabolaNode[PosAngle=0,linecolor=blue!60](O){\p}[30]{1.0}{A} +\pstGeneralParabolaAbsNode[PosAngle={0,0},linecolor=blue!60](O){\p}[30]{1.0}{D}{E} +\pstGeneralParabolaAbsNode[PosAngle={0,0},linecolor=blue!60](O){\p}[50]{1.0}{F}{G} +\pstGeneralParabolaAbsNode[PosAngle={0,0},linecolor=blue!60](O){\p}[90]{1.0}{H}{I} +\pstGeneralParabolaOrdNode[PosAngle={90,0},linecolor=purple!60](O){\p}[30]{0.5}{U}{V} +\pstGeneralParabolaOrdNode[PosAngle={90,90},linecolor=purple!60](O){\p}[50]{0.5}{M}{N} +\pstGeneralParabolaOrdNode[PosAngle={90,-90},linecolor=purple!60](O){\p}[90]{0.5}{S}{T} +\end{pspicture} +\end{LTXexample} + +The macro \Lcs{pstGeneralParabolaFocusNode} is used to find the focus of the parabola, +and the macro \Lcs{pstGeneralParabolaDirectrixLine} is used to find the directrix line of the parabola. + +\begin{BDef} +\Lcs{pstGeneralParabolaFocusNode}\OptArgs\Largr{O}\Largb{$p$}\OptArg{$\theta$}\Largb{F}\\ +\Lcs{pstGeneralParabolaDirectrixLine}\OptArgs\Largr{O}\Largb{$p$}\OptArg{$\theta$}\Largb{$L_x$}\Largb{$L_y$} +\end{BDef} + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](0,-1)(4,3) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\p{0.4} +\pstGeonode[PosAngle=-90,PointNameSep=0.2](2,0){O} +\pstGeneralParabola[linecolor=red!40](O){\p}[50]{-1.5}{1.5} +\pstGeneralParabolaFocusNode[linecolor=red!40,PosAngle=90](O){\p}[50]{F} +\pstLineAB[linestyle=dashed,linecolor=black!25,nodesepA=-0.5,nodesepB=-2.5]{O}{F} +\pstGeneralParabolaDirectrixLine[linecolor=red!40,nodesepA=-2,nodesepB=-1,PosAngle={-60,-60},PointName={L_1,L_2}](O){\p}[50]{L1}{L2} +\pstGeneralParabolaNode[linecolor=red!60](O){\p}[50]{1.0}{A} +\end{pspicture} +\end{LTXexample} + +The macro \Lcs{pstGeneralParabolaLineInter} is used to find the intersections $C$ and $D$ of the parabola and the given line $AB$. + +\begin{BDef} +\Lcs{pstGeneralParabolaLineInter}\OptArgs\Largr{O}\Largb{$p$}\OptArg{$\theta$}\Largb{A}\Largb{B}\Largb{C}\Largb{D} +\end{BDef} + +When General Parabola becomes a Standard Parabola, the intersections with any kind of lines: +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](0,-1)(4,3) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\p{0.4} +\pstGeonode[PosAngle=-90,PointNameSep=0.2](2,0){O} +\pstGeneralParabola[linecolor=red!40](O){\p}[0]{-1.5}{1.5} +\pstGeneralParabolaFocusNode[linecolor=red!40,PosAngle=50](O){\p}[0]{F} +\pstLineAB[linestyle=dashed,linecolor=black!25,nodesepA=-0.2,nodesepB=-2.5]{O}{F} +\pstLine[linestyle=dashed,linecolor=gray!40,nodesep=-0.8]{1,0}{1,2} +\pstGeneralParabolaLineInter[linecolor=red!40,PosAngle={40,-90}](O){\p}[0]{1,0}{1,2}{A}{B} +\pstLine[linestyle=dashed,linecolor=gray!40,nodesep=0]{0.5,0.5}{3.5,1} +\pstGeneralParabolaLineInter[linecolor=red!40,PosAngle={-110,-60}](O){\p}[0]{0.5,0.5}{3.5,1}{C}{D} +\end{pspicture} +\end{LTXexample} + +Here is the intersections of a real General Parabola with any kind of lines: +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](-1,-1)(3,3) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\p{0.4} +\pstGeonode[PosAngle=-60,PointNameSep=0.2](2,0){O} +\pstGeneralParabola[linecolor=red!40](O){\p}[50]{-1.5}{1.5} +\pstGeneralParabolaFocusNode[linecolor=red!40,PosAngle=80](O){\p}[50]{F} +\pstLineAB[linestyle=dashed,linecolor=black!25,nodesepA=-0.2,nodesepB=-2.5]{O}{F} +\pstLine[linestyle=dashed,linecolor=gray!40,nodesep=-0.8]{1,-1}{1,3} +\pstGeneralParabolaLineInter[linecolor=red!40,PosAngle={-150,40}](O){\p}[50]{1,-1}{1,3}{A}{B} +\pstLine[linestyle=dashed,linecolor=gray!40,nodesep=0.0]{-1,0}{3,2} +\pstGeneralParabolaLineInter[linecolor=red!40,PosAngle={90,70}](O){\p}[50]{-1,0}{3,2}{C}{D} +% a line with gradient k=-\cos50/\sin50 parallel to OF +\pstLineAS[linestyle=dashed,linecolor=gray!40,nodesep=-0.8,PointName=none,PointSymbol=none](0,1){50 cos 50 sin div neg}{X} +\pstGeneralParabolaLineInter[linecolor=red!40,PosAngle={-90,-90}](O){\p}[50]{0,1}{X}{E}{G} +\end{pspicture} +\end{LTXexample} + +When General Parabola becomes a Standard Inversion Parabola, the intersections with any kind of lines: +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](-1,-2)(3,2) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\p{0.4} +\pstGeonode[PosAngle=0,PointNameSep=0.2](2,0){O} +\pstGeneralParabola[linecolor=red!40](O){\p}[90]{-1.5}{1.5} +\pstGeneralParabolaFocusNode[linecolor=red!40,PosAngle=120](O){\p}[90]{F} +\pstLineAB[linestyle=dashed,linecolor=black!25,nodesepA=-0.2,nodesepB=-2.5]{O}{F} +\pstLine[linestyle=dashed,linecolor=gray!40,nodesep=-0.8]{1,-1}{1,2} +\pstGeneralParabolaLineInter[linecolor=red!40,PosAngle={-60,60}](O){\p}[90]{1,-1}{1,2}{A}{B} +\pstLine[linestyle=dashed,linecolor=gray!40,nodesep=-0.8]{0,-1}{2,1} +\pstGeneralParabolaLineInter[linecolor=red!40,PosAngle={-90,5}](O){\p}[90]{0,-1}{2,1}{C}{D} +\end{pspicture} +\end{LTXexample} + +The macro \Lcs{pstGeneralParabolaPolarNode} is used to find the polar point $T$ of chord $AB$ on Parabola $P$. + +\begin{BDef} +\Lcs{pstGeneralParabolaPolarNode}\OptArgs\Largr{O}\Largb{$p$}\OptArg{$\theta$}\Largb{A}\Largb{B}\Largb{T}\\ +\Lcs{pstGeneralParabolaPolarNode}\OptArgs\Largr{O}\Largb{$p$}\OptArg{$\theta$}\Largr{F}\Largb{A}\Largb{B}\Largb{T}\\ +\Lcs{pstGeneralParabolaPolarNode}\OptArgs\Largr{O}\Largb{$p$}\OptArg{$\theta$}\Largr{F}\OptArg{$L_x$}\OptArg{$L_y$}\Largb{A}\Largb{B}\Largb{T} +\end{BDef} + +We also use the theorem \ref{ParabolaPolarPointTheorem} to find the polar point $T$ of chord $AB$. +If you don't know the focus $F$, or the directrix line, we will find them automated, otherwise you can pass them to this macro. + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](-1,-2)(3,2) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\p{0.4} +\pstGeonode[PosAngle=-60,PointNameSep=0.2](2,0){O} +\pstGeneralParabola[linecolor=red!40](O){\p}[80]{-1.5}{1.5} +\pstGeneralParabolaFocusNode[linecolor=red!40,PosAngle=200](O){\p}[80]{F} +\pstGeneralParabolaDirectrixLine[linecolor=red!40,nodesepA=-2,nodesepB=-1,PosAngle={0,0},PointName={L_x,L_y}](O){\p}[80]{Lx}{Ly} +\pstLine[linestyle=dashed,linecolor=black!25,nodesepA=-0.2,nodesepB=-2.5]{O}{F} +\pstLine[linestyle=dashed,linecolor=gray!40,nodesep=-0.4]{0.5,-1.2}{2,1} +\pstGeneralParabolaLineInter[linecolor=red!40,PosAngle={-60,90}](O){\p}[80]{0.5,-1.2}{2,1}{A}{B} +%\pstGeneralParabolaPolarNode[linecolor=red!40,PosAngle=-90](O){\p}[80]{A}{B}{T} +%\pstGeneralParabolaPolarNode[linecolor=red!40,PosAngle=-90](O){\p}[80](F){A}{B}{T} +\pstGeneralParabolaPolarNode[linecolor=red!40,PosAngle=-90](O){\p}[80](F)[Lx][Ly]{A}{B}{T} +\end{pspicture} +\end{LTXexample} + +The macro \Lcs{pstGeneralParabolaTangentNode} is used to find the two nodes $A$ and $B$ on the Parabola through the point $T$. + +\begin{BDef} +\Lcs{pstGeneralParabolaTangentNode}\OptArgs\Largr{O}\Largb{$p$}\OptArg{$\theta$}\Largb{T}\Largb{A}\Largb{B} +\end{BDef} + +We also use the theorem \ref{ParabolaTangentPointTheorem} to find the tangent node $A$ and $B$ of outside point $T$. + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](-1,-2)(3,2) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\p{0.4} +\pstGeonode[PosAngle=0,PointNameSep=0.2](2,0){O} +\pstGeneralParabola[linecolor=red!40](O){\p}[80]{-1.5}{1.5} +\pstGeonode[PosAngle=0](2.5,-0.5){R}(2.5,-0.2){T}(2.5,0.6){S} +\pstGeneralParabolaTangentNode[linecolor=red!40,PosAngle={-90,220},PointName={R_1,R_2}](O){\p}[80]{R}{R1}{R2} +\pstGeneralParabolaTangentNode[linecolor=red!40,PosAngle={-90,170},PointName={T_1,T_2}](O){\p}[80]{T}{T1}{T2} +\pstGeneralParabolaTangentNode[linecolor=red!40,PosAngle={-90,180},PointName={S_1,S_2}](O){\p}[80]{S}{S1}{S2} +\end{pspicture} +\end{LTXexample} + +\subsection{General Inversion Parabola} +The General Inversion Parabola $P$ with coordinate translation and rotation is defined by vertex $O$, +the half of the focus chord axis $abs(p)$, the sign of $p$ indicates the direction of the parabola, +and the rotation angle $\theta$ of the symmetrical axis. + +The equation can be got from the parametric function of the inversion parabola (\ref{ParametricFunctionOfStandardInversionParabola}), +using the rotation transform formula (\ref{RotationTransformFormula}), then we have +\begin{equation} +\left\{\begin{array}{l} +x'=(\dfrac{t^2}{2p}+x_0)\cos\theta-(t+y_0)\sin\theta=x_0'-t\sin\theta+t^2\dfrac{\cos\theta}{2p}\\ +y'=(\dfrac{t^2}{2p}+x_0)\sin\theta+(t+y_0)\cos\theta=y_0'+t\cos\theta+t^2\dfrac{\sin\theta}{2p} +\end{array}\right. +\end{equation} +where the $x_0'$ and $y_0'$ are the coordinate of the given vertex O after rotation. +So we get the parametric function of the General Inversion Parabola with coordinate translation and rotation as following: +\begin{equation}\label{ParametricFunctionOfGeneralInversionParabola} +\left\{\begin{array}{l} +x=x_0-t\sin\theta+t^2\dfrac{\cos\theta}{2p}\\ +y=y_0+t\cos\theta+t^2\dfrac{\sin\theta}{2p} +\end{array}\right. +\end{equation} + +The macro \Lcs{pstGeneralIParabola} is used to draw a Standard Inversion Parabola from $y_1$ to $y_2$ with Vertex $O$, +the half of the focus chord axis $abs(p)$. + +\begin{BDef} +\Lcs{pstGeneralIParabola}\OptArgs\Largr{O}\Largb{$p$}\OptArg{$\theta$}\Largb{$y_1$}\Largb{$y_2$} +\end{BDef} + +The macro \Lcs{pstGeneralIParabolaNode} is used to draw a node whose parameter is the given value $t$ on parabola, +please refer to equation (\ref{ParametricFunctionOfGeneralInversionParabola}). +The macro \Lcs{pstGeneralIParabolaAbsNode} is used to draw a node whose abscissa is the given value $x_1$ on parabola. +The macro \Lcs{pstGeneralIParabolaOrdNode} is used to draw a node whose ordinate is the given value $y_1$ on parabola. + +Note that \Lcs{pstGeneralIParabolaAbsNode} and \Lcs{pstGeneralIParabolaOrdNode} will create two nodes $A$ and $B$ at most time. + +\begin{BDef} +\Lcs{pstGeneralIParabolaNode}\OptArgs\Largr{O}\Largb{$p$}\OptArg{$\theta$}\Largb{$t$}\Largb{A}\\ +\Lcs{pstGeneralIParabolaAbsNode}\OptArgs\Largr{O}\Largb{$p$}\OptArg{$\theta$}\Largb{$x_1$}\Largb{A}\Largb{B}\\ +\Lcs{pstGeneralIParabolaOrdNode}\OptArgs\Largr{O}\Largb{$p$}\OptArg{$\theta$}\Largb{$y_1$}\Largb{A}\Largb{B} +\end{BDef} + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](-1,0)(3,5) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\p{0.4} +\pstGeonode[PosAngle=210,PointNameSep=0.2](0,2){O} +\pstGeneralIParabola[linecolor=blue!10](O){\p}[0]{-1.5}{1.5} +\pstGeneralIParabola[linecolor=blue!15](O){\p}[10]{-1.5}{1.5} +\pstGeneralIParabola[linecolor=blue!25](O){\p}[30]{-1.5}{1.5} +\pstGeneralIParabola[linecolor=blue!30](O){\p}[40]{-1.5}{1.5} +\pstGeneralIParabola[linecolor=blue!40](O){\p}[50]{-1.5}{1.5} +\pstGeneralIParabola[linecolor=blue!60](O){\p}[90]{-1.5}{1.5} +\pstGeneralIParabolaNode[linecolor=red!60,PosAngle=90](O){\p}[30]{1.0}{A} +\pstGeneralIParabolaNode[linecolor=red!60,PosAngle=170](O){\p}[50]{1.0}{B} +\pstGeneralIParabolaAbsNode[linecolor=red!40,PosAngle={-45,90}](O){\p}[50]{1.0}{C}{D} +\pstGeneralIParabolaAbsNode[linecolor=red!60,PosAngle={0,-90}](O){\p}[90]{1.0}{E}{F} +\pstGeneralIParabolaOrdNode[linecolor=red!60,PosAngle={90,150}](O){\p}[50]{2.5}{G}{H} +\pstGeneralIParabolaOrdNode[linecolor=blue!60,PosAngle={180,-90}](O){\p}[90]{2.5}{J}{K} +\end{pspicture} +\end{LTXexample} + +The macro \Lcs{pstGeneralIParabolaFocusNode} is used to find the focus of the parabola, +and the macro \Lcs{pstGeneralIParabolaDirectrixLine} is used to find the directrix line of the parabola. + +\begin{BDef} +\Lcs{pstGeneralIParabolaFocusNode}\OptArgs\Largr{O}\Largb{$p$}\OptArg{$\theta$}\Largb{F}\\ +\Lcs{pstGeneralIParabolaDirectrixLine}\OptArgs\Largr{O}\Largb{$p$}\OptArg{$\theta$}\Largb{$L_x$}\Largb{$L_y$} +\end{BDef} + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](-2,0)(2,4) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\psset{PointName=none,nodesepA=-2,nodesepB=-1} +\pstGeonode(0,2){O}\def\p{0.8} +\psset{linecolor=blue!60} +\pstGeneralIParabola(O){\p}[0]{-1.5}{1.5} +\pstGeneralIParabolaFocusNode(O){\p}[0]{A} +\pstGeneralIParabolaDirectrixLine(O){\p}[0]{A1}{A2} +\psset{linecolor=red!60} +\pstGeneralIParabola(O){\p}[45]{-1.5}{1.5} +\pstGeneralIParabolaFocusNode(O){\p}[45]{B} +\pstGeneralIParabolaDirectrixLine(O){\p}[45]{B1}{B2} +\psset{linecolor=green!60} +\pstGeneralIParabola(O){\p}[90]{-1.5}{1.5} +\pstGeneralIParabolaFocusNode(O){\p}[90]{C} +\pstGeneralIParabolaDirectrixLine(O){\p}[90]{C1}{C2} +\psset{linecolor=cyan!60} +\pstGeneralIParabola(O){\p}[135]{-1.5}{1.5} +\pstGeneralIParabolaFocusNode(O){\p}[135]{D} +\pstGeneralIParabolaDirectrixLine(O){\p}[135]{D1}{D2} +\psset{linecolor=purple!60} +\pstGeneralIParabola(O){\p}[180]{-1.5}{1.5} +\pstGeneralIParabolaFocusNode(O){\p}[180]{E} +\pstGeneralIParabolaDirectrixLine(O){\p}[180]{E1}{E2} +\psset{linecolor=yellow!60} +\pstGeneralIParabola(O){\p}[225]{-1.5}{1.5} +\pstGeneralIParabolaFocusNode(O){\p}[225]{F} +\pstGeneralIParabolaDirectrixLine(O){\p}[225]{F1}{F2} +\psset{linecolor=black!60} +\pstGeneralIParabola(O){\p}[270]{-1.5}{1.5} +\pstGeneralIParabolaFocusNode(O){\p}[270]{G} +\pstGeneralIParabolaDirectrixLine(O){\p}[270]{G1}{G2} +\psset{linecolor=brown!60} +\pstGeneralIParabola(O){\p}[315]{-1.5}{1.5} +\pstGeneralIParabolaFocusNode(O){\p}[315]{H} +\pstGeneralIParabolaDirectrixLine(O){\p}[315]{H1}{H2} +\end{pspicture} +\end{LTXexample} + +The macro \Lcs{pstGeneralIParabolaLineInter} is used to find the intersections $C$ and $D$ of the parabola and the given line $AB$. + +\begin{BDef} +\Lcs{pstGeneralIParabolaLineInter}\OptArgs\Largr{O}\Largb{$p$}\OptArg{$\theta$}\Largb{A}\Largb{B}\Largb{C}\Largb{D} +\end{BDef} + +When $\theta=0$, the intersections with any kind of lines: + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](1,-2)(5,2) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\p{0.4} +\pstGeonode[PosAngle=180,PointNameSep=0.2](2,0){O} +\pstGeneralIParabola[linecolor=red!40](O){\p}[0]{-1.5}{1.5} +\pstLine[linestyle=dashed,linecolor=gray!40]{3,-2}{3,2} +\pstGeneralIParabolaLineInter[linecolor=red!40,PosAngle={40,150}](O){\p}[0]{3,-2}{3,2}{A}{B} +\pstLine[linestyle=dashed,linecolor=gray!40]{2,-2}{4,2} +\pstGeneralIParabolaLineInter[linecolor=red!40,PosAngle={100,210}](O){\p}[0]{2,-2}{4,2}{C}{D} +\pstLine[linestyle=dashed,linecolor=gray!40]{1.5,0.5}{4.5,0.5} +\pstGeneralIParabolaLineInter[linecolor=red!40,PosAngle={120,-90}](O){\p}[0]{1.5,0.5}{4.5,0.5}{E}{F} +\end{pspicture} +\end{LTXexample} + +When $\theta=50$, the intersections with any kind of lines: + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](1,-1)(5,4) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\p{0.4} +\pstGeonode[PosAngle=-70,PointNameSep=0.2](2,0){O} +\pstGeneralIParabola[linecolor=red!40](O){\p}[50]{-1.5}{1.5} +\pstGeneralIParabolaFocusNode[linecolor=red!40,PosAngle=80](O){\p}[50]{F} +\pstLineAB[linestyle=dashed,linecolor=black!25,nodesepA=-0.2,nodesepB=-2.5]{O}{F} +\pstLine[linestyle=dashed,linecolor=gray!40,nodesep=-0.8]{3,-1}{3,3} +\pstGeneralIParabolaLineInter[linecolor=red!40,PosAngle={-60,40}](O){\p}[50]{3,-1}{3,3}{A}{B} +\pstLine[linestyle=dashed,linecolor=gray!40,nodesep=0.0]{2,3}{4,0} +\pstGeneralIParabolaLineInter[linecolor=red!40,PosAngle={-10,170}](O){\p}[50]{2,3}{4,0}{C}{D} +% a line with gradient k=\tan50 parallel to OF +\pstLineAS[linestyle=dashed,linecolor=gray!40,nodesep=-0.8,PointName=none,PointSymbol=none](2,1){50 tan}{X} +\pstGeneralIParabolaLineInter[linecolor=red!40,PosAngle={180,-90}](O){\p}[50]{2,1}{X}{E}{G} +\end{pspicture} +\end{LTXexample} + +When $\theta=90$, the intersections with any kind of lines: + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](0,-1)(4,4) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\p{0.4} +\pstGeonode[PosAngle=-90,PointNameSep=0.2](2,0){O} +\pstGeneralIParabola[linecolor=red!40](O){\p}[90]{-1.5}{1.5} +\pstLine[linestyle=dashed,linecolor=gray!40,nodesep=-0.5]{1,0}{1,2} +\pstGeneralIParabolaLineInter[linecolor=red!40,PosAngle={180,-90}](O){\p}[90]{1,0}{1,2}{A}{B} +\pstLine[linestyle=dashed,linecolor=gray!40,nodesep=-0.5]{1,0}{3,1} +\pstGeneralIParabolaLineInter[linecolor=red!40,PosAngle={-60,-90}](O){\p}[90]{1,0}{3,1}{C}{D} +\pstLine[linestyle=dashed,linecolor=gray!40,nodesep=-0.5]{0.8,2}{3,2} +\pstGeneralIParabolaLineInter[linecolor=red!40,PosAngle={120,60}](O){\p}[90]{0.8,2}{3,2}{E}{G} +\end{pspicture} +\end{LTXexample} + +The macro \Lcs{pstGeneralIParabolaPolarNode} is used to find the polar point $T$ of chord $AB$ on Parabola $P$. + +\begin{BDef} +\Lcs{pstGeneralIParabolaPolarNode}\OptArgs\Largr{O}\Largb{$p$}\OptArg{$\theta$}\Largb{A}\Largb{B}\Largb{T}\\ +\Lcs{pstGeneralIParabolaPolarNode}\OptArgs\Largr{O}\Largb{$p$}\OptArg{$\theta$}\Largr{F}\Largb{A}\Largb{B}\Largb{T}\\ +\Lcs{pstGeneralIParabolaPolarNode}\OptArgs\Largr{O}\Largb{$p$}\OptArg{$\theta$}\Largr{F}\OptArg{$L_x$}\OptArg{$L_y$}\Largb{A}\Largb{B}\Largb{T} +\end{BDef} + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](1,-1)(5,4) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\p{0.4} +\pstGeonode[PosAngle=240,PointNameSep=0.4](2,0){O} +\pstGeneralIParabola[linecolor=red!40](O){\p}[50]{-1.5}{1.5} +\pstGeneralIParabolaFocusNode[linecolor=red!40,PosAngle=80](O){\p}[50]{F} +\pstLine[linestyle=dashed,linecolor=gray!40,nodesep=0.0]{2,3}{4,0} +\pstGeneralIParabolaLineInter[linecolor=red!40,PosAngle={-10,170}](O){\p}[50]{2,3}{4,0}{A}{B} +\pstGeneralIParabolaPolarNode[linecolor=red!40,PosAngle=-90](O){\p}[50](F){A}{B}{T} +\end{pspicture} +\end{LTXexample} + +We also use the theorem \ref{ParabolaPolarPointTheorem} to find the polar point $T$ of chord $AB$. +If you don't know the focus $F$, or the directrix line, we will find them automated, otherwise you can pass them to this macro. + +The macro \Lcs{pstGeneralIParabolaTangentNode} is used to find the two nodes $A$ and $B$ on the Parabola through the point $T$. + +\begin{BDef} +\Lcs{pstGeneralIParabolaTangentNode}\OptArgs\Largr{O}\Largb{$p$}\OptArg{$\theta$}\Largb{T}\Largb{A}\Largb{B} +\end{BDef} + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](1,-1)(5,4) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\p{0.4} +\pstGeonode[PosAngle=-90,PointNameSep=0.2](2,0){O} +\pstGeneralIParabola[linecolor=red!40](O){\p}[60]{-1.5}{1.5} +\pstGeonode[PosAngle=-90](1,-1){R}(2,-1){T}(2.5,-1){S} +\pstGeneralIParabolaTangentNode[linecolor=red!40,PosAngle={90,220},PointName={R_1,R_2}](O){\p}[60]{R}{R1}{R2} +\pstGeneralIParabolaTangentNode[linecolor=red!40,PosAngle={160,60},PointName={T_1,T_2}](O){\p}[60]{T}{T1}{T2} +\pstGeneralIParabolaTangentNode[linecolor=red!40,PosAngle={-60,40},PointName={S_1,S_2}](O){\p}[60]{S}{S1}{S2} +\end{pspicture} +\end{LTXexample} + +\subsection{Standard Hyperbola} +The Standard Hyperbola $H$ with coordinate translation is defined by center $O$, +the half of the real axis $a$, the half of the imaginary axis $b$. +The equation can be written as: +\begin{equation}\label{FunctionOfStandardHyperbola} +\dfrac{(x-x_0)^2}{a^2}-\dfrac{(y-y_0)^2}{b^2}=1 +\end{equation} +and the parametric function can be written as: +\begin{equation}\label{ParametricFunctionOfStandardHyperbola} +\left\{\begin{array}{l} +x=a\sec\alpha+x_0\\ +y=b\tan\alpha+y_0 +\end{array}\right. +\end{equation} + +The macro \Lcs{pstHyperbola} is used to draw a Standard Hyperbola with Center $O$, +the half of the real axis $a$, the half of the imaginary axis $b$. +The parameter \texttt{angleX} is used to truncate the width of the figure, +it should be setup from 0 to 90. + +\begin{BDef} +\Lcs{pstHyperbola}\OptArgs\Largr{O}\Largr{$a,\,b$}\OptArg{angleX} +\end{BDef} + +The macro \Lcs{pstHyperbolaNode} is used to draw a node whose parameter is the given value $t$ on Hyperbola, +please refer to equation (\ref{ParametricFunctionOfStandardHyperbola}). +The macro \Lcs{pstHyperbolaAbsNode} is used to draw the nodes whose abscissa are the given value $x_1$ on Hyperbola. +The macro \Lcs{pstHyperbolaOrdNode} is used to draw the nodes whose ordinate are the given value $y_1$ on Hyperbola. + +Note that \Lcs{pstHyperbolaAbsNode} and \Lcs{pstHyperbolaOrdNode} will create two nodes $A$ and $B$ at most time. + +\begin{BDef} +\Lcs{pstHyperbolaNode}\OptArgs\Largr{O}\Largr{$a,\,b$}\Largb{$t$}\Largb{A}\\ +\Lcs{pstHyperbolaAbsNode}\OptArgs\Largr{O}\Largr{$a,\,b$}\Largb{$x_1$}\Largb{A}\Largb{B}\\ +\Lcs{pstHyperbolaOrdNode}\OptArgs\Largr{O}\Largr{$a,\,b$}\Largb{$y_1$}\Largb{A}\Largb{B} +\end{BDef} + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](-2,-2)(4,4) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\a{0.5}\def\b{0.3} +\pstGeonode[PosAngle=-90,PointNameSep=0.2](1,1){O} +\pstHyperbola[linecolor=blue!40](O)(\a,\b)[80] +\pstHyperbolaNode[linecolor=blue!40,PosAngle=90](O)(\a,\b){80}{A} +\pstHyperbolaAbsNode[linecolor=blue!40,PointName={X_1,X_2},PosAngle=0](O)(\a,\b){0}{X1}{X2} +\pstHyperbolaOrdNode[linecolor=blue!40,PointName={Y_1,Y_2},PosAngle=-90](O)(\a,\b){0}{Y1}{Y2} +\pstHyperbola[linecolor=red!40](O)(\b,\a)[78] +\pstHyperbolaNode[linecolor=red!40](O)(\b,\a){-75}{B} +\pstHyperbolaAbsNode[linecolor=red!40,PointName={X_3,X_4},PosAngle=0](O)(\b,\a){0}{X3}{X4} +\pstHyperbolaOrdNode[linecolor=red!40,PointName={Y_3,Y_4},PosAngle=-90](O)(\b,\a){0}{Y3}{Y4} +\end{pspicture} +\end{LTXexample} + +The macro \Lcs{pstHyperbolaFocusNode} is used to find the focus nodes of the Hyperbola, +and the macro \Lcs{pstHyperbolaDirectrixLine} is used to find the directrix lines of the Hyperbola. + +\begin{BDef} +\Lcs{pstHyperbolaFocusNode}\OptArgs\Largr{O}\Largr{$a,\,b$}\Largb{$F_1$}\Largb{$F_2$}\\ +\Lcs{pstHyperbolaDirectrixLine}\OptArgs\Largr{O}\Largr{$a,\,b$}\Largb{$L_x$}\Largb{$L_y$}\Largb{$R_x$}\Largb{$R_y$} +\end{BDef} + +Note that you can use \Lcs{pstLineAS} to draw the asymptote line of the hyperbola by passing the slope gradient $k=\pm\dfrac{b}{a}$; +or you can use the macro \Lcs{pstHyperbolaAsymptoteLine} to get them, this macro only create one node on each asymptote line, +as the other one is the center of the hyperbola. + +\begin{BDef} +\Lcs{pstHyperbolaAsymptoteLine}\OptArgs\Largr{O}\Largr{$a,\,b$}\Largb{$L_1$}\Largb{$L_2$} +\end{BDef} + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](-2,-2)(4,4) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\a{0.5}\def\b{0.3} +\pstGeonode[PosAngle=-90,PointNameSep=0.2](1,1){O} +\pstHyperbola[linecolor=blue!40](O)(\a,\b)[80] +\pstHyperbolaNode[linecolor=blue!40](O)(\a,\b){80}{A} +\pstLineAS[PointName=S_1,PosAngle=90,nodesepA=-3,nodesepB=-1.5,linecolor=blue!20]{O}{\b\space \a\space div}{S1} +\pstLineAS[PointName=S_2,PosAngle=-90,nodesepA=-3,nodesepB=-1.5,linecolor=blue!20]{O}{\b\space \a\space div neg}{S2} +\pstHyperbolaFocusNode[linecolor=blue!40,PointName={F_1,F_2},PosAngle={180,0}](O)(\a,\b){F1}{F2} +\pstHyperbolaDirectrixLine[linecolor=blue!40,nodesepA=-2,nodesepB=-1,PointName={1,2,3,4},PosAngle=90,PointNameSep=0.2](O)(\a,\b){Lx}{Ly}{Rx}{Ry} +\pstHyperbola[linecolor=red!40](O)(\b,\a)[78] +\pstHyperbolaFocusNode[linecolor=red!40,PointName={H_1,H_2},PosAngle={180,0}](O)(\b,\a){H1}{H2} +\pstHyperbolaDirectrixLine[linecolor=red!40,nodesepA=-2,nodesepB=-1,PointName={5,6,7,8},PosAngle=90,PointNameSep=0.2](O)(\b,\a){Mx}{My}{Nx}{Ny} +\pstHyperbolaAsymptoteLine[linecolor=red!40,nodesepA=-2,nodesepB=-1,PointName={T_1,T_2},PosAngle=90,PointNameSep=0.2](O)(\b,\a){T1}{T2} +\end{pspicture} +\end{LTXexample} + +The macro \Lcs{pstHyperbolaLineInter} is used to find the intersections $C$ and $D$ of the hyperbola and the given line $AB$. + +\begin{BDef} +\Lcs{pstHyperbolaLineInter}\OptArgs\Largr{O}\Largr{$a,\,b$}\Largb{$A$}\Largb{$B$}\Largb{$C$}\Largb{$D$} +\end{BDef} + +In the following example, the Line $CX$ and $CY$ are parallel to the asymptote of the hyperbola. + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](-2,-1)(4,3) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\a{0.5}\def\b{0.3}\psset{PointNameSep=0.3} +\pstGeonode[PosAngle={-90,90},PointNameSep=0.2](1,1){O}(1,1.5){C} +\pstHyperbola[linecolor=blue!40](O)(\a,\b)[80] +\pstLine[linestyle=dashed,linecolor=gray!40]{2,-1}{2,3} +\pstHyperbolaLineInter[linecolor=blue!40,PosAngle={210,-40}](O)(\a,\b){2,-1}{2,3}{I}{J} +\pstLineAS[linestyle=dashed,linecolor=gray!60,nodesep=-2,PosAngle=150]{1,1.5}{\b\space \a\space div}{X} +\pstLineAS[linestyle=dashed,linecolor=gray!60,nodesep=-2,PosAngle=-10]{1,1.5}{\b\space \a\space div neg}{Y} +\pstLineAS[linestyle=dashed,linecolor=gray!60,nodesep=-2,PosAngle=150]{1,1.5}{0.2}{Z} +\pstHyperbolaLineInter[linecolor=blue!40,PosAngle={-10,-90}](O)(\a,\b){1,1.5}{X}{P}{Q} +\pstHyperbolaLineInter[linecolor=blue!40,PosAngle={90,-30}](O)(\a,\b){1,1.5}{Y}{M}{N} +\pstHyperbolaLineInter[linecolor=blue!40,PosAngle={90,90}](O)(\a,\b){1,1.5}{Z}{D}{E} +\end{pspicture} +\end{LTXexample} + +The macro \Lcs{pstHyperbolaPolarNode} is used to find the polar point $T$ of chord $AB$ on the hyperbola. + +\begin{BDef} +\Lcs{pstHyperbolaPolarNode}\OptArgs\Largr{O}\Largr{$a,\,b$}\Largb{$A$}\Largb{$B$}\Largb{$T$} +\end{BDef} + +We use the following theorem to find the polar point $T$ of chord $AB$: +\begin{theorem}\label{HyperbolaPolarPointTheorem} +Let $P$, $Q$ are vertex points of the hyperbola, for any chord $AB$ of hyperbola, suppose $PA$ and $BQ$ intersect at $E$, +$PB$ and $AQ$ intersect at $F$, then the middle point $T$ of $EF$ is the polar point of chord $AB$. +\end{theorem} + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](-2,-1)(4,3) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\a{0.5}\def\b{0.3}\psset{PointNameSep=0.3} +\pstGeonode[PosAngle=90,PointNameSep=0.2](1,1){O} +\pstHyperbola[linecolor=blue!40](O)(\a,\b)[80] +\pstHyperbolaNode[linecolor=blue!40,PosAngle=80](O)(\a,\b){50}{A} +\pstHyperbolaNode[linecolor=blue!40,PosAngle=-100](O)(\a,\b){-70}{B} +\pstHyperbolaPolarNode[linecolor=red!40,PosAngle=-100](O)(\a,\b){A}{B}{T} +\pstLine[linestyle=dashed,linecolor=gray!40,nodesep=-1]{A}{B} +\end{pspicture} +\end{LTXexample} + +The macro \Lcs{pstHyperbolaTangentNode} is used to find the tangent point $A$ and $B$ of point $T$ outside of the hyperbola. + +\begin{BDef} +\Lcs{pstHyperbolaTangentNode}\OptArgs\Largr{O}\Largr{$a,\,b$}\Largb{$T$}\Largb{$A$}\Largb{$B$} +\end{BDef} + +We use the following theorem to find the tangent points $A$ and $B$ of $T$: +\begin{theorem}\label{HyperbolaTangentPointTheorem} +Let $T$ is a point out of the hyperbola, for any two chords $TPQ$ and $TRS$ of the hyperbola, suppose $PR$ and $QS$ intersect at $X$, +$RQ$ and $PS$ intersect at $Y$, then the intersection point $A$ and $B$ of $XY$ and the hyperbola are the tangent points from $T$. +\end{theorem} + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](-2,-1)(4,3) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\a{0.5}\def\b{0.3}\psset{PointNameSep=0.3} +\pstGeonode[PosAngle=90,PointNameSep=0.2](1,1){O} +\pstHyperbola[linecolor=blue!40](O)(\a,\b)[80] +\pstGeonode[PosAngle=-90](1.2,0.8){T} +\pstHyperbolaTangentNode[linecolor=red!40,PosAngle={90,90},nodesep=-0.5](O)(\a,\b){T}{A}{B} +\end{pspicture} +\end{LTXexample} + +\subsection{Standard Inversion Hyperbola} +The Standard Inversion Hyperbola $H$ with coordinate translation is defined by center $O$, +the half of the real axis $a$, the half of the imaginary axis $b$. +The equation can be written as: +\begin{equation}\label{FunctionOfStandardInversionHyperbola} +\dfrac{(y-y_0)^2}{a^2}-\dfrac{(x-x_0)^2}{b^2}=1 +\end{equation} +and the parametric function can be written as: +\begin{equation}\label{ParametricFunctionOfStandardInversionHyperbola} +\left\{\begin{array}{l} +x=b\tan\alpha+x_0\\ +y=a\sec\alpha+y_0 +\end{array}\right. +\end{equation} + +The macro \Lcs{pstIHyperbola} is used to draw a Standard Inversion Hyperbola with Center $O$, +the half of the real axis $a$, the half of the imaginary axis $b$. +The parameter \texttt{angleY} is used to truncate the height of the figure, +it should be setup from 0 to 90. + +\begin{BDef} +\Lcs{pstIHyperbola}\OptArgs\Largr{O}\Largr{$a,\,b$}\OptArg{angleY} +\end{BDef} + +The macro \Lcs{pstIHyperbolaNode} is used to draw a node whose parameter is the given value $t$ on Inversion Hyperbola, +please refer to equation (\ref{ParametricFunctionOfStandardInversionHyperbola}). +The macro \Lcs{pstIHyperbolaAbsNode} is used to draw the nodes whose abscissa are the given value $x_1$ on Inversion Hyperbola. +The macro \Lcs{pstIHyperbolaOrdNode} is used to draw the nodes whose ordinate are the given value $y_1$ on Inversion Hyperbola. + +Note that \Lcs{pstIHyperbolaAbsNode} and \Lcs{pstIHyperbolaOrdNode} will create two nodes $A$ and $B$ at most time. + +\begin{BDef} +\Lcs{pstIHyperbolaNode}\OptArgs\Largr{O}\Largr{$a,\,b$}\Largb{$t$}\Largb{A}\\ +\Lcs{pstIHyperbolaAbsNode}\OptArgs\Largr{O}\Largr{$a,\,b$}\Largb{$x_1$}\Largb{A}\Largb{B}\\ +\Lcs{pstIHyperbolaOrdNode}\OptArgs\Largr{O}\Largr{$a,\,b$}\Largb{$y_1$}\Largb{A}\Largb{B} +\end{BDef} + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](-2,-2)(4,4) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\a{0.5}\def\b{0.3} +\pstGeonode[PosAngle=-90,PointNameSep=0.2](1,1){O} +\pstIHyperbola[linecolor=blue!40](O)(\a,\b)[80] +\pstIHyperbolaNode[linecolor=blue!40](O)(\a,\b){75}{A} +\pstIHyperbolaAbsNode[linecolor=blue!40,PointName={Y_1,Y_2},PosAngle=0](O)(\a,\b){0}{Y1}{Y2} +\pstIHyperbolaOrdNode[linecolor=red!40,PointName={X_1,X_2},PosAngle=-90](O)(\a,\b){0}{X1}{X2} +\pstIHyperbola[linecolor=red!40](O)(\b,\a)[78] +\pstIHyperbolaNode[linecolor=red!40](O)(\b,\a){-75}{B} +\pstIHyperbolaAbsNode[linecolor=red!40,PointName={Y_3,Y_4},PosAngle=0](O)(\b,\a){0}{Y3}{Y4} +\pstIHyperbolaOrdNode[linecolor=red!40,PointName={X_3,X_4},PosAngle=-90](O)(\b,\a){0}{X3}{X4} +\end{pspicture} +\end{LTXexample} + +The macro \Lcs{pstIHyperbolaFocusNode} is used to find the focus nodes of the Inversion Hyperbola, +and the macro \Lcs{pstIHyperbolaDirectrixLine} is used to find the directrix lines of the Inversion Hyperbola. + +\begin{BDef} +\Lcs{pstIHyperbolaFocusNode}\OptArgs\Largr{O}\Largr{$a,\,b$}\Largb{$F_1$}\Largb{$F_2$}\\ +\Lcs{pstIHyperbolaDirectrixLine}\OptArgs\Largr{O}\Largr{$a,\,b$}\Largb{$L_x$}\Largb{$L_y$}\Largb{$R_x$}\Largb{$R_y$} +\end{BDef} + +Note that you can use \Lcs{pstLineAS} to draw the asymptote line of the hyperbola by passing the slope gradient $k=\pm\dfrac{a}{b}$; +or you can use the macro \Lcs{pstIHyperbolaAsymptoteLine} to get them, this macro only create one node on each asymptote line, +as the other one is the center of the hyperbola. + +\begin{BDef} +\Lcs{pstHyperbolaAsymptoteLine}\OptArgs\Largr{O}\Largr{$a,\,b$}\Largb{$L_1$}\Largb{$L_2$} +\end{BDef} + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](-2,-2)(4,4) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\a{0.5}\def\b{0.3} +\pstGeonode[PosAngle=180,PointNameSep=0.2](1,1){O} +\pstIHyperbola[linecolor=blue!40](O)(\a,\b)[80] +\pstIHyperbolaFocusNode[linecolor=blue!40,PointName={F_1,F_2},PosAngle={-90,90}](O)(\a,\b){F1}{F2} +\pstIHyperbolaDirectrixLine[linecolor=blue!40,nodesepA=-2,nodesepB=-1,PointName={1,2,3,4},PosAngle=180,PointNameSep=0.2](O)(\a,\b){Lx}{Ly}{Rx}{Ry} +\pstLineAS[PointName=S_1,PosAngle=90,nodesepA=-3,nodesepB=-1.5,linecolor=blue!20]{O}{\a\space \b\space div}{S1} +\pstLineAS[PointName=S_2,PosAngle=-90,nodesepA=-3,nodesepB=-1.5,linecolor=blue!20]{O}{\a\space \b\space div neg}{S2} +\pstIHyperbola[linecolor=red!40](O)(\b,\a)[78] +\pstIHyperbolaFocusNode[linecolor=red!40,PointName={H_1,H_2},PosAngle={-90,90}](O)(\b,\a){H1}{H2} +\pstIHyperbolaDirectrixLine[linecolor=red!40,nodesepA=-2,nodesepB=-1,PointName={5,6,7,8},PosAngle=0,PointNameSep=0.2](O)(\b,\a){Mx}{My}{Nx}{Ny} +\pstIHyperbolaAsymptoteLine[linecolor=red!40,nodesepA=-2,nodesepB=-1,PointName={T_1,T_2},PosAngle=90,PointNameSep=0.2](O)(\b,\a){T1}{T2} +\end{pspicture} +\end{LTXexample} + +The macro \Lcs{pstIHyperbolaLineInter} is used to find the intersections $C$ and $D$ of the hyperbola and the given line $AB$. + +\begin{BDef} +\Lcs{pstIHyperbolaLineInter}\OptArgs\Largr{O}\Largr{$a,\,b$}\Largb{$A$}\Largb{$B$}\Largb{$C$}\Largb{$D$} +\end{BDef} + +In the following example, the Line $CX$ and $CY$ are parallel to the asymptote of the hyperbola. + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](-2,-2)(4,4) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\a{0.5}\def\b{0.3}\psset{PointNameSep=0.35} +\pstGeonode[PosAngle={0,180}](1,1){O}(0,1){C} +\pstIHyperbola[linecolor=blue!40](O)(\a,\b)[82] +\pstLine[linestyle=dashed,linecolor=gray!40]{2,-2}{2,4} +\pstIHyperbolaLineInter[linecolor=blue!40,PosAngle={0,-30}](O)(\a,\b){2,-2}{2,4}{I}{J} +\pstLineAS[linestyle=dashed,linecolor=gray!60,nodesep=-2,PosAngle=150]{0,1}{\a\space \b\space div}{X} +\pstLineAS[linestyle=dashed,linecolor=gray!60,nodesep=-2,PosAngle=150]{0,1}{\a\space \b\space div neg}{Y} +\pstLineAS[linestyle=dashed,linecolor=gray!60,nodesepA=-4,PosAngle=210]{0,1}{-3.5}{Z} +\pstIHyperbolaLineInter[linecolor=blue!40,PosAngle={180,-100}](O)(\a,\b){0,1}{X}{P}{Q} +\pstIHyperbolaLineInter[linecolor=blue!40,PosAngle={0,180}](O)(\a,\b){0,1}{Y}{M}{N} +\pstIHyperbolaLineInter[linecolor=blue!40,PosAngle={190,-100}](O)(\a,\b){0,1}{Z}{D}{E} +\end{pspicture} +\end{LTXexample} + +The macro \Lcs{pstIHyperbolaPolarNode} is used to find the polar point $T$ of chord $AB$ on the hyperbola. + +\begin{BDef} +\Lcs{pstIHyperbolaPolarNode}\OptArgs\Largr{O}\Largr{$a,\,b$}\Largb{$A$}\Largb{$B$}\Largb{$T$} +\end{BDef} + +We also use the theorem \ref{HyperbolaPolarPointTheorem} to find the polar point $T$ of chord $AB$: + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](-1,-1)(3,3) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\a{0.5}\def\b{0.3}\psset{PointNameSep=0.3} +\pstGeonode[PosAngle=0,PointNameSep=0.2](1,1){O} +\pstIHyperbola[linecolor=blue!40](O)(\a,\b)[76] +\pstIHyperbolaNode[linecolor=blue!40,PosAngle=80](O)(\a,\b){50}{A} +\pstIHyperbolaNode[linecolor=blue!40,PosAngle=-100](O)(\a,\b){-70}{B} +\pstIHyperbolaPolarNode[linecolor=red!40,PosAngle=180](O)(\a,\b){A}{B}{T} +\pstLine[linestyle=dashed,linecolor=gray!40,nodesep=-1]{A}{B} +\end{pspicture} +\end{LTXexample} + +The macro \Lcs{pstIHyperbolaTangentNode} is used to find the tangent point $A$ and $B$ of point $T$ outside of the hyperbola. + +\begin{BDef} +\Lcs{pstIHyperbolaTangentNode}\OptArgs\Largr{O}\Largr{$a,\,b$}\Largb{$T$}\Largb{$A$}\Largb{$B$} +\end{BDef} + +We also use the following theorem \ref{HyperbolaTangentPointTheorem} to find the tangent points $A$ and $B$ of $T$. + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](-2,-1)(4,3) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\a{0.5}\def\b{0.3}\psset{PointNameSep=0.3} +\pstGeonode[PosAngle=180](1,1){O} +\pstIHyperbola[linecolor=blue!40](O)(\a,\b)[78] +\pstGeonode[PosAngle=0](1.2,0.8){T} +\pstIHyperbolaTangentNode[linecolor=red!40,PosAngle={80,-90},nodesep=-0.5](O)(\a,\b){T}{A}{B} +\end{pspicture} +\end{LTXexample} + +\subsection{General Hyperbola} +The General Hyperbola $H$ with coordinate translation and rotation is defined by center $O$, +the half of the real axis $a$, the half of the imaginary axis $b$, +and the rotation angle $\theta$ of the principal axis. +The equation can be got from the parametric function of the Standard Hyperbola equation (\ref{ParametricFunctionOfStandardHyperbola}), +using the rotation transform formula (\ref{RotationTransformFormula}), then we have +\begin{equation} +\left\{\begin{array}{l} +x'=(a\sec\alpha+x_0)\cos\theta-(b\tan\alpha+y_0)\sin\theta=x_0'+a\sec\alpha\cos\theta-b\tan\alpha\sin\theta\\ +y'=(a\sec\alpha+x_0)\sin\theta+(b\tan\alpha+y_0)\cos\theta=y_0'+a\sec\alpha\sin\theta+b\tan\alpha\cos\theta +\end{array}\right. +\end{equation} +where the $x_0'$ and $y_0'$ are the coordinate of the given center $O$ after rotation. +So we get the parametric function of the General Hyperbola with coordinate translation and rotation as following: +\begin{equation}\label{ParametricFunctionOfGeneralHyperbola} +\left\{\begin{array}{l} +x=x_0+a\sec\alpha\cos\theta-b\tan\alpha\sin\theta\\ +y=y_0+a\sec\alpha\sin\theta+b\tan\alpha\cos\theta +\end{array}\right. +\end{equation} + +The macro \Lcs{pstGeneralHyperbola} is used to draw a General Hyperbola with Center $O$, +the half of the real axis $a$, the half of the imaginary axis $b$, +and the rotation angle $\theta$ of the symmetrical axis. +The parameter \texttt{angleX} is used to truncate the width of the figure, +it should be setup from 0 to 90. + +\begin{BDef} +\Lcs{pstGeneralHyperbola}\OptArgs\Largr{O}\Largr{$a,\,b$}\OptArg{$\theta$}\OptArg{angleX} +\end{BDef} + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](-2,-1)(4,3) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\a{0.5}\def\b{0.3}\psset{PointNameSep=0.3} +\pstGeonode[PosAngle=-90](1,1){O} +\pstGeneralHyperbola[linecolor=red!20](O)(\a,\b)[0][80] +\pstGeneralHyperbolaNode[linecolor=red!80,PosAngle=5](O)(\a,\b)[0]{0}{A} +\pstGeneralHyperbola[linecolor=blue!40](O)(\a,\b)[40][80] +\pstGeneralHyperbolaNode[linecolor=blue!40,PosAngle=10](O)(\a,\b)[40]{40}{B} +\pstGeneralHyperbola[linecolor=green!60](O)(\a,\b)[90][80] +\pstGeneralHyperbolaNode[linecolor=green!60,PosAngle=-90](O)(\a,\b)[90]{200}{C} +\pstGeneralHyperbola[linecolor=purple!80](O)(\a,\b)[150][80] +\pstGeneralHyperbolaNode[linecolor=purple!80,PosAngle=150](O)(\a,\b)[150]{50}{D} +\end{pspicture} +\end{LTXexample} + +The macro \Lcs{pstGeneralHyperbolaNode} is used to draw a node whose parameter is the given value $t$ on General Hyperbola, +please refer to equation (\ref{ParametricFunctionOfGeneralHyperbola}). +The macro \Lcs{pstGeneralHyperbolaAbsNode} is used to draw the nodes whose abscissa are the given value $x_1$ on General Hyperbola. +The macro \Lcs{pstGeneralHyperbolaOrdNode} is used to draw the nodes whose ordinate are the given value $y_1$ on General Hyperbola. + +Note that \Lcs{pstGeneralHyperbolaAbsNode} and \Lcs{pstGeneralHyperbolaOrdNode} will create two nodes $A$ and $B$ at most time. + +\begin{BDef} +\Lcs{pstGeneralHyperbolaNode}\OptArgs\Largr{O}\Largr{$a,\,b$}\OptArg{$\theta$}\Largb{$t$}\Largb{A}\\ +\Lcs{pstGeneralHyperbolaAbsNode}\OptArgs\Largr{O}\Largr{$a,\,b$}\OptArg{$\theta$}\Largb{$x_1$}\Largb{A}\Largb{B}\\ +\Lcs{pstGeneralHyperbolaOrdNode}\OptArgs\Largr{O}\Largr{$a,\,b$}\OptArg{$\theta$}\Largb{$y_1$}\Largb{A}\Largb{B} +\end{BDef} + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](-2,-1)(4,3) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\a{0.5}\def\b{0.3}\psset{PointNameSep=0.3} +\pstGeonode[PosAngle=-90](1,1){O} +\pstGeneralHyperbola[linecolor=purple!80](O)(\a,\b)[150][80] +\pstGeneralHyperbolaAbsNode[linecolor=purple!80,PosAngle={200,90}](O)(\a,\b)[150]{2}{P}{Q} +\pstGeneralHyperbolaAbsNode[linecolor=purple!80,PosAngle={-90,200}](O)(\a,\b)[150]{0}{X}{Y} +\pstGeneralHyperbolaAbsNode[linecolor=purple!80,PosAngle={40,-40}](O)(\a,\b)[150]{0.59378}{M}{N} +\pstLine[linestyle=dashed,linecolor=gray!40]{0.59378,-1}{0.59378,3} +\pstGeneralHyperbolaOrdNode[linecolor=purple!80,PosAngle={200,90}](O)(\a,\b)[150]{2}{G}{H} +\pstGeneralHyperbolaOrdNode[linecolor=purple!80,PosAngle={-90,200}](O)(\a,\b)[150]{0}{I}{J} +\pstGeneralHyperbolaOrdNode[linecolor=purple!80,PosAngle={90,-90}](O)(\a,\b)[150]{1}{K}{L} +\pstLine[linestyle=dashed,linecolor=gray!80,nodesep=-1.5]{K}{L} +\end{pspicture} +\end{LTXexample} + +The macro \Lcs{pstGeneralHyperbolaFocusNode} is used to find the focus nodes of the General Hyperbola, +the macro \Lcs{pstGeneralHyperbolaVertexNode} is used to find the vertex nodes of the General Hyperbola, +and the macro \Lcs{pstGeneralHyperbolaDirectrixLine} is used to find the directrix lines of the General Hyperbola. + +\begin{BDef} +\Lcs{pstGeneralHyperbolaFocusNode}\OptArgs\Largr{O}\Largr{$a,\,b$}\OptArg{$\theta$}\Largb{$F_1$}\Largb{$F_2$}\\ +\Lcs{pstGeneralHyperbolaVertexNode}\OptArgs\Largr{O}\Largr{$a,\,b$}\OptArg{$\theta$}\Largb{$V_1$}\Largb{$V_2$}\\ +\Lcs{pstGeneralHyperbolaDirectrixLine}\OptArgs\Largr{O}\Largr{$a,\,b$}\OptArg{$\theta$}\Largb{$L_x$}\Largb{$L_y$}\Largb{$R_x$}\Largb{$R_y$} +\end{BDef} + +Note that you can use the macro \Lcs{pstGeneralHyperbolaAsymptoteLine} to get the asymptote lines, this macro only create one node on each asymptote line, +as the other one is the center of the hyperbola. + +\begin{BDef} +\Lcs{pstGeneralHyperbolaAsymptoteLine}\OptArgs\Largr{O}\Largr{$a,\,b$}\OptArg{$\theta$}\Largb{$L_1$}\Largb{$L_2$} +\end{BDef} + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](-2,-2)(4,4) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\a{0.5}\def\b{0.3} +\pstGeonode[PosAngle=180,PointNameSep=0.2](1,1){O} +\pstGeneralHyperbola[linecolor=red!40](O)(\a,\b)[0][80] +\pstGeneralHyperbolaFocusNode[linecolor=red!40,PointName={X_1,X_2},PosAngle={180,0}](O)(\a,\b)[0]{X1}{X2} +\pstGeneralHyperbolaDirectrixLine[linecolor=red!40,nodesepA=-2,nodesepB=-1,PointName=none](O)(\a,\b)[0]{Lx}{Ly}{Rx}{Ry} +\pstGeneralHyperbolaAsymptoteLine[linecolor=red!40,nodesepA=-2,nodesepB=-1,PointName=none](O)(\a,\b)[0]{L1}{L2} +\pstGeneralHyperbola[linecolor=blue!40](O)(\a,\b)[40][80] +\pstGeneralHyperbolaFocusNode[linecolor=blue!40,PointName={F_1,F_2},PosAngle={220,40}](O)(\a,\b)[40]{F1}{F2} +\pstGeneralHyperbolaDirectrixLine[linecolor=blue!40,nodesepA=-2,nodesepB=-1,PointName=none](O)(\a,\b)[40]{Dx}{Dy}{Ux}{Uy} +\pstGeneralHyperbolaAsymptoteLine[linecolor=blue!40,nodesepA=-2,nodesepB=-1,PointName=none](O)(\a,\b)[40]{S1}{S2} +\pstGeneralHyperbola[linecolor=brown!40](O)(\a,\b)[90][80] +\pstGeneralHyperbolaFocusNode[linecolor=brown!40,PointName={Y_1,Y_2},PosAngle={-90,90}](O)(\a,\b)[90]{Y1}{Y2} +\pstGeneralHyperbolaDirectrixLine[linecolor=brown!40,nodesepA=-2,nodesepB=-1,PointName=none](O)(\a,\b)[90]{Tx}{Ty}{Sx}{Sy} +\pstGeneralHyperbolaAsymptoteLine[linecolor=brown!40,nodesepA=-2,nodesepB=-1,PointName=none](O)(\a,\b)[90]{T1}{T2} +\end{pspicture} +\end{LTXexample} + +The macro \Lcs{pstGeneralHyperbolaLineInter} is used to find the intersections $C$ and $D$ of the general hyperbola and the given line $AB$. + +\begin{BDef} +\Lcs{pstGeneralHyperbolaLineInter}\OptArgs\Largr{O}\Largr{$a,\,b$}\OptArg{$\theta$}\Largb{$A$}\Largb{$B$}\Largb{$C$}\Largb{$D$} +\end{BDef} + +In the following example, the lines $YY'$ and $ZZ'$ are parallel to the asymptote of the hyperbola, +so there are only one intersection $M$ and $P$ for each line, and the second node $N$ and $Q$ are put at the origin. + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](-2,-1)(4,3) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\a{0.5}\def\b{0.3}\psset{PointNameSep=0.3} +\pstGeonode[PosAngle=-90](1,1){O} +\pstGeneralHyperbola[linecolor=blue!40](O)(\a,\b)[30][80] +\pstLine[linestyle=dashed,linecolor=gray!40]{0.5,-1}{0.5,3} +\pstGeneralHyperbolaLineInter[linecolor=blue!40,PosAngle={-30,210}](O)(\a,\b)[30]{0.5,-1}{0.5,3}{A}{B} +\pstLine[linestyle=dashed,linecolor=gray!40]{-2,0}{3,3} +\pstGeneralHyperbolaLineInter[linecolor=blue!40,PosAngle={130,-90}](O)(\a,\b)[30]{-2,0}{3,3}{C}{D} +\pstGeonode[PosAngle={0,100}](2,0){Y}(1,1.8){Z} +\pstLineAA[nodesepA=-3,nodesepB=-2,linecolor=gray!40,PointName=none,PointSymbol=none]{O}{\b\space \a\space div 1 atan 30 add}{U} +\pstLineAA[nodesepA=-3,nodesepB=-2,linecolor=red!40,PointName=none,PointSymbol=none]{O}{\b\space \a\space div neg 1 atan 30 add}{V} +\pstLineAA[nodesepA=-3,nodesepB=-2,linecolor=gray!40,PosAngle=-30]{Y}{\b\space \a\space div 1 atan 30 add}{Y'} +\pstLineAA[nodesepA=-3,nodesepB=-2,linecolor=red!40,PosAngle=80]{Z}{\b\space \a\space div neg 1 atan 30 add}{Z'} +\pstGeneralHyperbolaLineInter[linecolor=blue!40,PosAngle={-50,-90}](O)(\a,\b)[30]{Z}{Z'}{M}{N} +\pstGeneralHyperbolaLineInter[linecolor=blue!40,PosAngle={30,210}](O)(\a,\b)[30]{Y}{Y'}{P}{Q} +\end{pspicture} +\end{LTXexample} + +The macro \Lcs{pstGeneralHyperbolaPolarNode} is used to find the polar point $T$ of chord $AB$ on the general hyperbola. + +\begin{BDef} +\Lcs{pstGeneralHyperbolaPolarNode}\OptArgs\Largr{O}\Largr{$a,\,b$}\OptArg{$\theta$}\Largb{$A$}\Largb{$B$}\Largb{$T$} +\end{BDef} + +We also use the theorem \ref{HyperbolaPolarPointTheorem} to find the polar point $T$ of chord $AB$: + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](-1,-1)(3,3) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\a{0.5}\def\b{0.3}\psset{PointNameSep=0.3} +\pstGeonode[PosAngle=120,PointNameSep=0.2](1,1){O} +\pstGeneralHyperbola[linecolor=blue!40](O)(\a,\b)[40][80] +\pstGeneralHyperbolaNode[linecolor=blue!40,PosAngle=110](O)(\a,\b)[40]{50}{A} +\pstGeneralHyperbolaNode[linecolor=blue!40,PosAngle=-100](O)(\a,\b)[40]{-70}{B} +\pstGeneralHyperbolaPolarNode[linecolor=red!40,PosAngle=-90](O)(\a,\b)[40]{A}{B}{T} +\pstLine[linestyle=dashed,linecolor=gray!40,nodesep=-1]{A}{B} +\end{pspicture} +\end{LTXexample} + +The macro \Lcs{pstGeneralHyperbolaTangentNode} is used to find the tangent point $A$ and $B$ of point $T$ outside of the general hyperbola. + +\begin{BDef} +\Lcs{pstGeneralHyperbolaTangentNode}\OptArgs\Largr{O}\Largr{$a,\,b$}\OptArg{$\theta$}\Largb{$T$}\Largb{$A$}\Largb{$B$} +\end{BDef} + +We also use the following theorem \ref{HyperbolaTangentPointTheorem} to find the tangent points $A$ and $B$ of $T$. + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](-2,-1)(4,3) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\a{0.5}\def\b{0.3}\psset{PointNameSep=0.3} +\pstGeonode[PosAngle=120](1,1){O} +\pstGeneralHyperbola[linecolor=blue!40](O)(\a,\b)[40][80] +\pstGeonode[PosAngle=-40](1.2,0.8){T} +\pstGeneralHyperbolaTangentNode[linecolor=red!40,PosAngle={140,-90},nodesep=-0.5](O)(\a,\b)[40]{T}{A}{B} +\end{pspicture} +\end{LTXexample} + +\subsection{General Inversion Hyperbola} +The General Inversion Hyperbola $H$ with coordinate translation and rotation is defined by center $O$, +the half of the real axis $a$, the half of the imaginary axis $b$, +and the rotation angle $\theta$ of the principal axis. +The equation can be got from the parametric function of the Standard Inversion Hyperbola equation (\ref{ParametricFunctionOfStandardInversionHyperbola}), +using the rotation transform formula (\ref{RotationTransformFormula}), then we have +\begin{equation} +\left\{\begin{array}{l} +x'=(b\tan\alpha+x_0)\cos\theta-(a\sec\alpha+y_0)\sin\theta=x_0'+b\tan\alpha\cos\theta-a\sec\alpha\sin\theta\\ +y'=(b\tan\alpha+x_0)\sin\theta+(a\sec\alpha+y_0)\cos\theta=y_0'+b\tan\alpha\sin\theta+a\sec\alpha\cos\theta +\end{array}\right. +\end{equation} +where the $x_0'$ and $y_0'$ are the coordinate of the given center $O$ after rotation. +So we get the parametric function of the General Inversion Hyperbola with coordinate translation and rotation as following: +\begin{equation}\label{ParametricFunctionOfGeneralInversionHyperbola} +\left\{\begin{array}{l} +x=x_0+b\tan\alpha\cos\theta-a\sec\alpha\sin\theta\\ +y=y_0+b\tan\alpha\sin\theta+a\sec\alpha\cos\theta +\end{array}\right. +\end{equation} + +The macro \Lcs{pstGeneralIHyperbola} is used to draw a General Inversion Hyperbola with Center $O$, +the half of the real axis $a$, the half of the imaginary axis $b$, +and the rotation angle $\theta$ of the symmetrical axis. +The parameter \texttt{angleY} is used to truncate the height of the figure, +it should be setup from 0 to 90. + +\begin{BDef} +\Lcs{pstGeneralIHyperbola}\OptArgs\Largr{O}\Largr{$a,\,b$}\OptArg{$\theta$}\OptArg{angleY} +\end{BDef} + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](-2,-1)(4,3) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\a{0.5}\def\b{0.3}\psset{PointNameSep=0.3} +\pstGeonode[PosAngle=-90](1,1){O} +\pstGeneralIHyperbola[linecolor=red!20](O)(\a,\b)[0][80] +\pstGeneralIHyperbolaNode[linecolor=red!80,PosAngle=-90](O)(\a,\b)[0]{0}{A} +\pstGeneralIHyperbola[linecolor=blue!40](O)(\a,\b)[40][80] +\pstGeneralIHyperbolaNode[linecolor=blue!40,PosAngle=190](O)(\a,\b)[40]{40}{B} +\pstGeneralIHyperbola[linecolor=green!60](O)(\a,\b)[90][80] +\pstGeneralIHyperbolaNode[linecolor=green!60,PosAngle=0](O)(\a,\b)[90]{200}{C} +\pstGeneralIHyperbola[linecolor=purple!80](O)(\a,\b)[150][80] +\pstGeneralIHyperbolaNode[linecolor=purple!80,PosAngle=-90](O)(\a,\b)[150]{50}{D} +\end{pspicture} +\end{LTXexample} + +The macro \Lcs{pstGeneralIHyperbolaNode} is used to draw a node whose parameter is the given value $t$ on General Inversion Hyperbola, +please refer to equation (\ref{ParametricFunctionOfGeneralInversionHyperbola}). + +The macro \Lcs{pstGeneralIHyperbolaAbsNode} is used to draw the nodes whose abscissa are the given value $x_1$ on General Inversion Hyperbola. +The macro \Lcs{pstGeneralIHyperbolaOrdNode} is used to draw the nodes whose ordinate are the given value $y_1$ on General Inversion Hyperbola. + +Note that \Lcs{pstGeneralIHyperbolaAbsNode} and \Lcs{pstGeneralIHyperbolaOrdNode} will create two nodes $A$ and $B$ at most time. + +\begin{BDef} +\Lcs{pstGeneralIHyperbolaNode}\OptArgs\Largr{O}\Largr{$a,\,b$}\OptArg{$\theta$}\Largb{$t$}\Largb{A}\\ +\Lcs{pstGeneralIHyperbolaAbsNode}\OptArgs\Largr{O}\Largr{$a,\,b$}\OptArg{$\theta$}\Largb{$x_1$}\Largb{A}\Largb{B}\\ +\Lcs{pstGeneralIHyperbolaOrdNode}\OptArgs\Largr{O}\Largr{$a,\,b$}\OptArg{$\theta$}\Largb{$y_1$}\Largb{A}\Largb{B} +\end{BDef} + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](-2,-1)(4,3) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\a{0.5}\def\b{0.3}\psset{PointNameSep=0.3} +\pstGeonode[PosAngle=180](1,1){O} +\pstGeneralIHyperbola[linecolor=purple!80](O)(\a,\b)[150][80] +\pstGeneralIHyperbolaAbsNode[linecolor=purple!80,PosAngle={200,90}](O)(\a,\b)[150]{2}{P}{Q} +\pstGeneralIHyperbolaAbsNode[linecolor=purple!80,PosAngle={90,200}](O)(\a,\b)[150]{0}{X}{Y} +\pstGeneralIHyperbolaAbsNode[linecolor=purple!80,PosAngle={40,-40}](O)(\a,\b)[150]{1}{M}{N} +\pstLine[linestyle=dashed,linecolor=gray!40,nodesep=-1.5]{M}{N} +\pstGeneralIHyperbolaOrdNode[linecolor=purple!80,PosAngle={180,90}](O)(\a,\b)[150]{2}{G}{H} +\pstGeneralIHyperbolaOrdNode[linecolor=purple!80,PosAngle={90,240}](O)(\a,\b)[150]{0}{I}{J} +\pstGeneralIHyperbolaOrdNode[linecolor=purple!80,PosAngle={-100,-60}](O)(\a,\b)[150]{1.4063}{K}{L} +\pstLine[linestyle=dashed,linecolor=gray!80,nodesep=-1]{I}{J} +\pstLine[linestyle=dashed,linecolor=gray!80,nodesep=-1]{-1,1.4063}{3,1.4063} +\end{pspicture} +\end{LTXexample} + +The macro \Lcs{pstGeneralIHyperbolaFocusNode} is used to find the focus nodes of the General Inversion Hyperbola, +the macro \Lcs{pstGeneralIHyperbolaVertexNode} is used to find the vertex nodes of the General Inversion Hyperbola, +and the macro \Lcs{pstGeneralIHyperbolaDirectrixLine} is used to find the directrix lines of the General Inversion Hyperbola. + +\begin{BDef} +\Lcs{pstGeneralIHyperbolaFocusNode}\OptArgs\Largr{O}\Largr{$a,\,b$}\OptArg{$\theta$}\Largb{$F_1$}\Largb{$F_2$}\\ +\Lcs{pstGeneralIHyperbolaVertexNode}\OptArgs\Largr{O}\Largr{$a,\,b$}\OptArg{$\theta$}\Largb{$V_1$}\Largb{$V_2$}\\ +\Lcs{pstGeneralIHyperbolaDirectrixLine}\OptArgs\Largr{O}\Largr{$a,\,b$}\OptArg{$\theta$}\Largb{$L_x$}\Largb{$L_y$}\Largb{$R_x$}\Largb{$R_y$} +\end{BDef} + +Note that you can use the macro \Lcs{pstGeneralIHyperbolaAsymptoteLine} to get the asymptote lines, this macro only create one node on each asymptote line, +as the other one is the center of the hyperbola. + +\begin{BDef} +\Lcs{pstGeneralHyperbolaAsymptoteLine}\OptArgs\Largr{O}\Largr{$a,\,b$}\OptArg{$\theta$}\Largb{$L_1$}\Largb{$L_2$} +\end{BDef} + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](-2,-2)(4,4) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\a{0.5}\def\b{0.3} +\pstGeonode[PosAngle=180,PointNameSep=0.2](1,1){O} +\pstGeneralIHyperbola[linecolor=red!40](O)(\a,\b)[0][80] +\pstGeneralIHyperbolaFocusNode[linecolor=red!40,PointName={X_1,X_2},PosAngle={90,-90}](O)(\a,\b)[0]{X1}{X2} +\pstGeneralIHyperbolaDirectrixLine[linecolor=red!40,nodesepA=-2,nodesepB=-1,PointName=none](O)(\a,\b)[0]{Lx}{Ly}{Rx}{Ry} +\pstGeneralIHyperbolaAsymptoteLine[linecolor=red!40,nodesepA=-2,nodesepB=-1,PointName=none](O)(\a,\b)[0]{T1}{T2} +\pstGeneralIHyperbola[linecolor=blue!40](O)(\a,\b)[40][80] +\pstGeneralIHyperbolaFocusNode[linecolor=blue!40,PointName={F_1,F_2},PosAngle={130,-40}](O)(\a,\b)[40]{F1}{F2} +\pstGeneralIHyperbolaDirectrixLine[linecolor=blue!40,nodesepA=-2,nodesepB=-1,PointName=none](O)(\a,\b)[40]{Dx}{Dy}{Ux}{Uy} +\pstGeneralIHyperbolaAsymptoteLine[linecolor=blue!40,nodesepA=-2,nodesepB=-1,PointName=none](O)(\a,\b)[40]{S1}{S2} +\pstGeneralIHyperbola[linecolor=brown!40](O)(\a,\b)[90][80] +\pstGeneralIHyperbolaFocusNode[linecolor=brown!40,PointName={Y_1,Y_2},PosAngle={180,0}](O)(\a,\b)[90]{Y1}{Y2} +\pstGeneralIHyperbolaDirectrixLine[linecolor=brown!40,nodesepA=-2,nodesepB=-1,PointName=none](O)(\a,\b)[90]{Tx}{Ty}{Sx}{Sy} +\pstGeneralIHyperbolaAsymptoteLine[linecolor=brown!40,nodesepA=-2,nodesepB=-1,PointName=none](O)(\a,\b)[90]{R1}{R2} +\end{pspicture} +\end{LTXexample} + + +The macro \Lcs{pstGeneralIHyperbolaLineInter} is used to find the intersections $C$ and $D$ of the general inversion hyperbola and the given line $AB$. + +\begin{BDef} +\Lcs{pstGeneralIHyperbolaLineInter}\OptArgs\Largr{O}\Largr{$a,\,b$}\OptArg{$\theta$}\Largb{$A$}\Largb{$B$}\Largb{$C$}\Largb{$D$} +\end{BDef} + +In the following example, the lines $YY'$ and $ZZ'$ are parallel to the asymptote of the hyperbola, +so there are only one intersection $M$ and $P$ for each line, and the second node $N$ and $Q$ are put at the origin. + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](-2,-1)(4,3) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\a{0.5}\def\b{0.3}\psset{PointNameSep=0.3} +\pstGeonode[PosAngle=225](1,1){O} +\pstGeneralIHyperbola[linecolor=blue!40](O)(\a,\b)[30][80] +\pstLine[linestyle=dashed,linecolor=gray!40]{-1,-1}{-1,3} +\pstGeneralIHyperbolaLineInter[linecolor=blue!40,PosAngle={-30,210}](O)(\a,\b)[30]{-1,-1}{-1,3}{A}{B} +\pstLine[linestyle=dashed,linecolor=gray!40]{-2,1}{3,3} +\pstGeneralIHyperbolaLineInter[linecolor=blue!40,PosAngle={130,-90}](O)(\a,\b)[30]{-2,1}{3,3}{C}{D} +\pstGeonode[PosAngle={-20,100}](2,0){Y}(1.8,2){Z} +\pstLineAA[nodesepA=-3,nodesepB=-2,linecolor=gray!40,PointName=none,PointSymbol=none]{O}{\a\space \b\space div 1 atan 30 add}{U} +\pstLineAA[nodesepA=-3,nodesepB=-2,linecolor=red!40,PointName=none,PointSymbol=none]{O}{\a\space \b\space div neg 1 atan 30 add}{V} +\pstLineAA[nodesepA=-3,nodesepB=-2,linecolor=gray!40,PosAngle=10]{Y}{\a\space \b\space div 1 atan 30 add}{Y'} +\pstLineAA[nodesepA=-3,nodesepB=-2,linecolor=red!40,PosAngle=80]{Z}{\a\space \b\space div neg 1 atan 30 add}{Z'} +\pstGeneralIHyperbolaLineInter[linecolor=blue!40,PosAngle={30,-90}](O)(\a,\b)[30]{Z}{Z'}{M}{N} +\pstGeneralIHyperbolaLineInter[linecolor=blue!40,PosAngle={30,210}](O)(\a,\b)[30]{Y}{Y'}{P}{Q} +\end{pspicture} +\end{LTXexample} + +The macro \Lcs{pstGeneralIHyperbolaPolarNode} is used to find the polar point $T$ of chord $AB$ on the general inversion hyperbola. + +\begin{BDef} +\Lcs{pstGeneralIHyperbolaPolarNode}\OptArgs\Largr{O}\Largr{$a,\,b$}\OptArg{$\theta$}\Largb{$A$}\Largb{$B$}\Largb{$T$} +\end{BDef} + +We also use the theorem \ref{HyperbolaPolarPointTheorem} to find the polar point $T$ of chord $AB$: + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](-1,-1)(3,3) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\a{0.5}\def\b{0.3}\psset{PointNameSep=0.3} +\pstGeonode[PosAngle=40,PointNameSep=0.2](1,1){O} +\pstGeneralIHyperbola[linecolor=blue!40](O)(\a,\b)[40][80] +\pstGeneralIHyperbolaNode[linecolor=blue!40,PosAngle=40](O)(\a,\b)[40]{50}{A} +\pstGeneralIHyperbolaNode[linecolor=blue!40,PosAngle=-100](O)(\a,\b)[40]{-70}{B} +\pstGeneralIHyperbolaPolarNode[linecolor=red!40,PosAngle=-90](O)(\a,\b)[40]{A}{B}{T} +\pstLine[linestyle=dashed,linecolor=gray!40,nodesep=-1]{A}{B} +\end{pspicture} +\end{LTXexample} + +The macro \Lcs{pstGeneralIHyperbolaTangentNode} is used to find the tangent point $A$ and $B$ of point $T$ outside of the general inversion hyperbola. + +\begin{BDef} +\Lcs{pstGeneralIHyperbolaTangentNode}\OptArgs\Largr{O}\Largr{$a,\,b$}\OptArg{$\theta$}\Largb{$T$}\Largb{$A$}\Largb{$B$} +\end{BDef} + +We also use the following theorem \ref{HyperbolaTangentPointTheorem} to find the tangent points $A$ and $B$ of $T$. + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid=true](-2,-1)(4,3) +\psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize +\def\a{0.5}\def\b{0.3}\psset{PointNameSep=0.3} +\pstGeonode[PosAngle=20](1,1){O} +\pstGeneralIHyperbola[linecolor=blue!40](O)(\a,\b)[40][80] +\pstGeonode[PosAngle=-40](0,1){T} +\pstGeneralIHyperbolaTangentNode[linecolor=red!40,PosAngle={-80,120},nodesep=-0.5](O)(\a,\b)[40]{T}{A}{B} +\end{pspicture} +\end{LTXexample} + \section{Geometric Transformations} The geometric transformations are the ideal tools to construct geometric figures. All @@ -686,7 +2766,7 @@ line crossing all images, and thus allow a quick description of a transformed fi \end{BDef} \begin{sloppypar} -Possible optional arguments are +Possible optional arguments are \Lkeyword{PointSymbol}, \Lkeyword{PosAngle}, \Lkeyword{PointName}, \Lkeyword{PointNameSep}, \Lkeyword{PtNameMath}, \Lkeyword{CodeFig}, \Lkeyword{CodeFigColor}, and \Lkeyword{CodeFigStyle}. @@ -699,7 +2779,7 @@ following functions. \begin{pspicture}[showgrid](-2,-2)(2,2) \psset{CodeFig=true} \pstGeonode[PosAngle={20,90,0}]{O}(-.6,1.5){A}(1.6,-.5){B} -\pstSymO[CodeFigColor=blue, +\pstSymO[CodeFigColor=blue, PosAngle={-90,180}]{O}{A, B}[C, D] \pstLineAB{A}{B}\pstLineAB{C}{D} \pstLineAB{A}{D}\pstLineAB{C}{B} @@ -713,7 +2793,7 @@ following functions. \end{BDef} \begin{sloppypar} -Possible optional arguments are +Possible optional arguments are \Lkeyword{PointSymbol}, \Lkeyword{PosAngle}, \Lkeyword{PointName}, \Lkeyword{PointNameSep}, \Lkeyword{PtNameMath}, \Lkeyword{CodeFig}, \Lkeyword{CodeFigColor}, and \Lkeyword{CodeFigStyle}. @@ -745,7 +2825,7 @@ Draws the symmetric point in relation to line $(AB)$. \end{BDef} \begin{sloppypar} -Possible optional arguments are +Possible optional arguments are \Lkeyword{PointSymbol}, \Lkeyword{PosAngle}, \Lkeyword{PointName}, \Lkeyword{PointNameSep}, \Lkeyword{PtNameMath}, and \Lkeyword{RotAngle} for \Lcs{pstRotation} and \Lkeyword{AngleCoef}, \Lkeyword{RotAngle} for \Lcs{pstAngleABC}. @@ -770,13 +2850,13 @@ contain some text, it is put on the corresponding angle in mathematical mode. \pstRotation[PosAngle=90,RotAngle=60, CodeFig,CodeFigColor=blue, TransformLabel=\frac{\pi}{3}]{A}{B}[C] -\pstRotation[AngleCoef=.5, +\pstRotation[AngleCoef=.5, RotAngle=\pstAngleAOB{B}{A}{C}, CodeFigColor=red, CodeFig, TransformLabel=\frac{1}{2}\widehat{BAC}]{A}{D}[E] \end{pspicture} \end{LTXexample} - + \subsection{Translation} @@ -785,7 +2865,7 @@ contain some text, it is put on the corresponding angle in mathematical mode. \end{BDef} \begin{sloppypar} -Possible optional arguments are +Possible optional arguments are \Lkeyword{PointSymbol}, \Lkeyword{PosAngle}, \Lkeyword{PointName}, \Lkeyword{PointNameSep}, \Lkeyword{PtNameMath}, and \Lkeyword{DistCoef} % @@ -822,7 +2902,7 @@ text specified with \Lkeyword{TransformLabel} \DefaultVal{none}. \end{BDef} \begin{sloppypar} -Possible optional arguments are +Possible optional arguments are \Lkeyword{HomCoef}, \Lkeyword{PointSymbol}, \Lkeyword{PosAngle}, \Lkeyword{PointName}, \Lkeyword{PointNameSep}, \Lkeyword{PtNameMath}, and \Lkeyword{HomCoef}. @@ -852,7 +2932,7 @@ coefficient specified with the parameter \Lkeyword{HomCoef}. \end{BDef} \begin{sloppypar} -Possible optional arguments are +Possible optional arguments are \Lkeyword{PointSymbol}, \Lkeyword{PosAngle}, \Lkeyword{PointName}, \Lkeyword{PointNameSep}, \Lkeyword{PtNameMath}, \Lkeyword{CodeFig}, \Lkeyword{CodeFigColor}, and\Lkeyword{CodeFigStyle} @@ -911,7 +2991,7 @@ automatically put below the segment. \end{BDef} \begin{sloppypar} -Possible optional arguments are +Possible optional arguments are \Lkeyword{PointName}, \Lkeyword{PointNameSep}, \Lkeyword{PosAngle}, \Lkeyword{PointSymbol}, and \Lkeyword{PtNameMath} % @@ -936,12 +3016,12 @@ Draw the $ABC$ triangle centre of gravity $G$. \end{BDef} \begin{sloppypar} -Possible optional arguments are +Possible optional arguments are \Lkeyword{PointName}, \Lkeyword{PointNameSep}, \Lkeyword{PosAngle}, \Lkeyword{PointSymbol}, \Lkeyword{PtNameMath}, \Lkeyword{DrawCirABC}, \Lkeyword{CodeFig}, \Lkeyword{CodeFigColor}, \Lkeyword{CodeFigStyle}, \Lkeyword{SegmentSymbolA}, \Lkeyword{SegmentSymbolB}, and \Lkeyword{SegmentSymbolC}. -% +% Draws the circle crossing three points (the circum circle) and put its center $O$. The effective drawing is controlled by the boolean parameter \Lkeyword{DrawCirABC} \DefaultVal{true}. Moreover the intermediate constructs (mediator lines) can @@ -967,7 +3047,7 @@ points are marked on the segemnts using three different marks given by the param \end{BDef} \begin{sloppypar} -Possible optional arguments are +Possible optional arguments are \Lkeyword{PointName}, \Lkeyword{PointNameSep}, \Lkeyword{PosAngle}, \Lkeyword{PointSymbol}, \Lkeyword{PtNameMath}, \Lkeyword{CodeFig}, \Lkeyword{CodeFigColor}, \Lkeyword{CodeFigStyle}, and \Lkeyword{SegmentSymbol}. @@ -1015,7 +3095,7 @@ construction is controlled by the following parameters: \end{BDef} \begin{sloppypar} -Possible optional arguments are +Possible optional arguments are \Lkeyword{PointSymbol}, \Lkeyword{PosAngle}, \Lkeyword{PointName}, \Lkeyword{PointNameSep}, and \Lkeyword{PtNameMath}. % @@ -1067,7 +3147,7 @@ manage the existence of these points. \end{BDef} \begin{sloppypar} -Possible optional arguments are +Possible optional arguments are \Lkeyword{PointSymbol}, \Lkeyword{PosAngle}, \Lkeyword{PointName}, \Lkeyword{PointNameSep}, and \Lkeyword{PtNameMath}. % @@ -1110,11 +3190,11 @@ Draw the intersection point between lines $(AB)$ and $(CD)$. \end{BDef} \begin{sloppypar} -Possible optional arguments are +Possible optional arguments are \Lkeyword{PointSymbol}, \Lkeyword{PosAngle}, \Lkeyword{PointName}, \Lkeyword{PointNameSep}, \Lkeyword{PtNameMath}, \Lkeyword{PointSymbolA}, \Lkeyword{PosAngleA}, \Lkeyword{PointNameA}, - \Lkeyword{PointSymbolB}, \Lkeyword{PosAngleB}, \Lkeyword{PointNameB}, + \Lkeyword{PointSymbolB}, \Lkeyword{PosAngleB}, \Lkeyword{PointNameB}, \Lkeyword{Radius}, and \Lkeyword{Diameter}. % Draw the one or two intersection point(s) between the line $(AB)$ and @@ -1177,7 +3257,7 @@ trigonometric (by default) or clockwise. Here is a first example. \pstCircleOA[linecolor=red]{C}{B} \pstInterCC[PosAngleA=135, CodeFigA=true, CodeFigAarc=false, CodeFigColor=magenta]{O}{A}{C}{B}{D}{E} -\pstInterCC[PosAngleA=170, CodeFigA=true, +\pstInterCC[PosAngleA=170, CodeFigA=true, CodeFigAarc=false, CodeFigColor=green]{B}{E}{C}{B}{F}{G} \end{pspicture} @@ -1304,23 +3384,23 @@ of centre $O$ and radius $OA$. Calculates and prints the values. This is only possible on PostScript level! -\begin{pspicture}[showgrid](-1,0)(11,8) +\begin{pspicture}[showgrid](-1,-1)(8,7) \def\sideC{6} \def\sideA{7} \def\sideB{8} -\psset{PointSymbol=none,linejoin=1,linewidth=0.4pt,PtNameMath=false,labelsep=0.07,MarkAngleRadius=1.1,decimals=1,comma} -\pstGeonode[PosAngle={90,90}](0,0){A}(\sideC;10){B} -\psset{PointName=} -\pstInterCC[RadiusA=\pstDistVal{\sideB},RadiusB=\pstDistVal{\sideA},PosAngle=-90,PointNameA=C]{A}{}{B}{}{C}{C-} +\psset{unit=0.8cm,PointSymbol=none,linejoin=1,linewidth=0.4pt,PtNameMath=false,labelsep=0.07,MarkAngleRadius=1.1,decimals=1} +\pstGeonode[PosAngle={-90,-90}](0,0){A}(\sideC;10){B} +\pstInterCC[RadiusA=\pstDistVal{\sideB},RadiusB=\pstDistVal{\sideA},PosAngleA=90,PointNameA=C]{A}{}{B}{}{C}{C-} \pstInterCC[RadiusA=\pstDistAB{A}{B},RadiusB=\pstDistAB{B}{C}]{C}{}{A}{}{D-}{D} +\psset{PointName=none} \pstInterLC[Radius=\pstDistAB{A}{C}]{C}{D}{C}{}{A'-}{A'} \pstInterCC[RadiusA=\pstDistAB{A}{B},RadiusB=\pstDistAB{B}{C}]{A'}{}{C}{}{B'}{B'-} -\pstInterLL[PosAngle=90,PointName=default]{B'}{C}{A}{B}{E} +\pstInterLL[PosAngle=-90,PointName=default]{B'}{C}{A}{B}{E} \pspolygon(A)(B)(C) \pspolygon[fillstyle=solid,fillcolor=magenta,opacity=0.1](C)(E)(B) % -\psGetAngleABC[ArcColor=blue,AngleValue=true,LabelSep=0.7,arrows=->,decimals=0,PSfont=Palatino-Roman](B)(A)(C){} -\psGetAngleABC[AngleValue=true,ArcColor=red,arrows=->,WedgeOpacity=0.6,WedgeColor=yellow!30,LabelSep=0.5](C)(B)(A){$\beta$} -\psGetAngleABC[LabelSep=0.7,WedgeColor=green,xShift=-6,yShift=-10](A)(C)(B){$\gamma$} -\psGetAngleABC[LabelSep=0.7,AngleArc=false,WedgeColor=green,arrows=->,xShift=-15,yShift=0](C)(E)(B){\color{blue}$\gamma$} +\psGetAngleABC[ArcColor=blue,AngleValue=true,LabelSep=0.4,arrows=->,decimals=0,PSfont=Palatino-Roman](B)(A)(C){} +\psGetAngleABC[AngleValue=true,ArcColor=red,arrows=->,WedgeOpacity=0.6,WedgeColor=yellow!30,LabelSep=0.4](C)(B)(A){$\beta$} +\psGetAngleABC[LabelSep=0.4,AngleValue=true,WedgeColor=green,xShift=-6,yShift=-10](A)(C)(B){$\gamma$} +\psGetAngleABC[LabelSep=0.4,AngleValue=true,AngleArc=false,WedgeColor=green,arrows=->,xShift=-15,yShift=0](C)(E)(B){\color{blue}$\gamma$} \psGetAngleABC[AngleValue=true,MarkAngleRadius=1.0,LabelSep=0.5,ShowWedge=false,xShift=-5,yShift=7,arrows=->](E)(B)(C){} % \pcline[linestyle=none](A)(B)\nbput{\sideC} @@ -1330,19 +3410,13 @@ Calculates and prints the values. This is only possible on PostScript level! \psGetDistanceAB[xShift=-17,decimals=2](E)(C){MEC} \end{pspicture} - - - - \begin{lstlisting} \begin{pspicture}(-1,0)(11,8) \psgrid[gridlabels=0pt,subgriddiv=2,gridwidth=0.4pt,subgridwidth=0.2pt,gridcolor=black!60,subgridcolor=black!40] \def\sideC{6} \def\sideA{7} \def\sideB{8} \psset{PointSymbol=none,linejoin=1,linewidth=0.4pt,PtNameMath=false,labelsep=0.07,MarkAngleRadius=1.1,decimals=1,comma} -\pstGeonode[PosAngle={90,90}](0,0){A}(\sideC;10){B} -% \pstGeonode[PosAngle={225,-75}](0,0){A}(\sideC;10){B} -\psset{PointName=} -\pstInterCC[RadiusA=\pstDistVal{\sideB},RadiusB=\pstDistVal{\sideA},PosAngle=-90,PointNameA=C]{A}{}{B}{}{C}{C-} +\pstGeonode[PosAngle={-90,-90}](0,0){A}(\sideC;10){B} +\pstInterCC[RadiusA=\pstDistVal{\sideB},RadiusB=\pstDistVal{\sideA},PosAngle=90,PointNameA=C]{A}{}{B}{}{C}{C-} \pstInterCC[RadiusA=\pstDistAB{A}{B},RadiusB=\pstDistAB{B}{C}]{C}{}{A}{}{D-}{D} \pstInterLC[Radius=\pstDistAB{A}{C}]{C}{D}{C}{}{A'-}{A'} \pstInterCC[RadiusA=\pstDistAB{A}{B},RadiusB=\pstDistAB{B}{C}]{A'}{}{C}{}{B'}{B'-} @@ -1350,10 +3424,10 @@ Calculates and prints the values. This is only possible on PostScript level! \pspolygon(A)(B)(C) \pspolygon[fillstyle=solid,fillcolor=magenta,opacity=0.1](C)(E)(B) % -\psGetAngleABC[ArcColor=blue,AngleValue=true,LabelSep=0.7,arrows=->,decimals=0,PSfont=Palatino-Roman](B)(A)(C){} +\psGetAngleABC[ArcColor=blue,AngleValue=true,LabelSep=0.8,arrows=->,decimals=0,PSfont=Palatino-Roman](B)(A)(C){} \psGetAngleABC[AngleValue=true,ArcColor=red,arrows=->,WedgeOpacity=0.6,WedgeColor=yellow!30,LabelSep=0.5](C)(B)(A){$\beta$} -\psGetAngleABC[LabelSep=0.7,WedgeColor=green,xShift=-6,yShift=-10](A)(C)(B){$\gamma$} -\psGetAngleABC[LabelSep=0.7,AngleArc=false,WedgeColor=green,arrows=->,xShift=-15,yShift=0](C)(E)(B){\color{blue}$\gamma$} +\psGetAngleABC[LabelSep=0.8,WedgeColor=green,xShift=-6,yShift=-10](A)(C)(B){$\gamma$} +\psGetAngleABC[LabelSep=0.8,AngleArc=false,WedgeColor=green,arrows=->,xShift=-15,yShift=0](C)(E)(B){\color{blue}$\gamma$} \psGetAngleABC[AngleValue=true,MarkAngleRadius=1.0,LabelSep=0.5,ShowWedge=false,xShift=-5,yShift=7,arrows=->](E)(B)(C){} % \pcline[linestyle=none](A)(B)\nbput{\sideC} @@ -1697,7 +3771,7 @@ Drawing of Manuel Luque. \pstBissectBAC[PointSymbol=none,PointName=none]{C}{A}{B}{AB} \pstBissectBAC[PointSymbol=none,PointName=none]{A}{B}{C}{BB} \pstBissectBAC[PointSymbol=none,PointName=none]{B}{C}{A}{CB} -\pstInterLL{A}{AB}{B}{BB}{I} +\pstInterLL{A}{AB}{B}{BB}{I} \psset{linecolor=magenta, linestyle=dashed} \pstProjection{A}{B}{I}[I_C] \pstLineAB{I}{I_C}\pstRightAngle[linestyle=solid]{A}{I_C}{I} \pstProjection{A}{C}{I}[I_B] @@ -1842,7 +3916,7 @@ distance of two points (the focus) is constant. \begin{LTXexample} \begin{pspicture}[showgrid](-4,-4)(4,4) \newcommand\Sommet{1.4142135623730951 } \newcounter{i} \setcounter{i}{1} -\newcommand\PosFoyer{2 } \newcommand\HypAngle{0} +\newcommand\PosFoyer{2 } \newcommand\HypAngle{0} \newcounter{CoefDiv}\setcounter{CoefDiv}{20} \newcounter{Inc}\setcounter{Inc}{2} \newcounter{n}\setcounter{n}{2} \newcommand\Ri{ \PosFoyer \Sommet sub \arabic{i}\space\arabic{CoefDiv}\space div add } @@ -1933,7 +4007,7 @@ is an astroid, a deltoid and in the general case hypo-cycloids. \begin{pspicture}[showgrid](-3.5,-3.4)(3.5,4) \HypoCyclo[3]{3}{1}{17} \psset{linecolor=blue,linewidth=1.5\pslinewidth} -\pstGenericCurve[GenCurvFirst=P]{N}{1}{6} +\pstGenericCurve[GenCurvFirst=P]{N}{1}{6} \pstGenericCurve{N}{6}{12} \pstGenericCurve[GenCurvLast=P]{N}{12}{17} \end{pspicture} diff --git a/Master/texmf-dist/tex/generic/pst-eucl/pst-eucl.tex b/Master/texmf-dist/tex/generic/pst-eucl/pst-eucl.tex index df8d75a0093..8979b313bea 100644 --- a/Master/texmf-dist/tex/generic/pst-eucl/pst-eucl.tex +++ b/Master/texmf-dist/tex/generic/pst-eucl/pst-eucl.tex @@ -7,20 +7,21 @@ %% of the LaTeX Project Public License Distributed from CTAN %% archives in directory macros/latex/base/lppl.txt. %% -%% Author : Dominique RODRIGUEZ (EN) <dominique.rodriguez@waika9.com> +%% Author : Dominique RODRIGUEZ (EN) <dominique.rodriguez@waika9.com> %% : hv hvoss@tug.org %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Require PSTricks and pst-node packages \ifx\PSTnodesLoaded\endinput\else\input pst-node.tex\fi \ifx\PSTArrowLoaded\endinput\else\input pst-arrow.tex\fi \ifx\PSTtoolsLoaded\endinput\else\input pst-tools.tex\fi +\ifx\PSTplotLoaded\endinput\else\input pst-plot.tex\fi %\ifx\PSTXKeyLoaded\endinput\else \input pst-xkey\fi \ifx\MultidoLoaded\endinput \else\input multido.tex \fi \csname PSTEuclideLoaded\endcsname \let\PSTEuclideLoaded\endinput % -\def\fileversion{1.65} -\def\filedate{2019/08/19} +\def\fileversion{1.66} +\def\filedate{2019/10/20} %% \message{`PST-Euclide v\fileversion, \filedate\space (dr,hv)}% %% prologue for postcript @@ -151,12 +152,12 @@ PointSymbol=*, %PointSymbolA=*, PointSymbolB=*, PointSymbolC=*, PointName=default, PointNameA=undef, PointNameB=undef, PointNameC=undef, PtNameMath=true, PointNameMathSize=\textstyle, PointNameSize=\normalsize, - PointNameSep=default, PosAngle=undef, + PointNameSep=default, PosAngle=undef, PosAngleA=undef, PosAngleB=undef, PosAngleC=undef, Mark=undef, mark=undef,SegmentSymbol=MarkHashh, SegmentSymbolA=MarkHashh, SegmentSymbolB=MarkHash, SegmentSymbolC=MarkHashhh, RightAngleSize=.4, RightAngleType=default, LabelAngleOffset=0, LabelSep=1, - LabelRefPt=c, MarkAngle=undef, MarkAngleType=default, MarkAngleRadius=.4, + LabelRefPt=c, MarkAngle=undef, MarkAngleType=default, MarkAngleRadius=.4, HomCoef=.5, RotAngle=60, CurveType=none, TransformLabel=none, Central@Sym=false, DrawCirABC=true, CodeFig=false, CodeFigColor=cyan, CodeFigStyle=dashed, CodeFigA=undef, @@ -228,7 +229,7 @@ \edef\psk@PosAngle{\expandafter\PstParamListLasts\OldPosAngle,undef/}% \edef\psk@PointSymbol{\expandafter\PstParamListLasts\OldPointSymbol,undef/}}% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% create a point with an associated node, +%% Create a point with an associated node, %% #1 -> options %% #2 -> coordinates %% #3 -> node name @@ -247,7 +248,7 @@ \@ifnextchar(\Pst@Geonode@ii{\pst@MngTransformCurve\endgroup}}% DR 22032005 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% create a point with an associated node, in a new +%% Create a point with an associated node, in a new %% landmark %% #1 -> options %% #2 -> coordinates @@ -458,7 +459,7 @@ \ifx\psk@fillstylename\@none\else \pscustom[linestyle=none,linewidth=0.01pt,arrows=-]{% \psline(0,0) - \psarc(0,0){\psk@MarkAngleRadius}{(#2)}{(#4)} + \psarc(0,0){\psk@MarkAngleRadius}{(#2)}{(#4)} \psline(0,0) } \fi @@ -567,49 +568,70 @@ %% #2 #3 -> 2 nodes defining the line \def\pstLineAB{\ncline}%@ifnextchar[\Pst@LineAB{\Pst@LineAB[]}}% %\def\Pst@LineAB[#1]#2#3{\ncline[#1]{#2}{#3}}% -%% #2 #3 -> 2 nodes defining the center and a point on the circle -\def\pstCircleOA{\pst@object{pstCircleOA}}% -\def\pstCircleOA@i#1#2{% - \bgroup\use@par% - \rput(#1){% - \begin@ClosedObj +% +%% \pstCircleOA[Options]{O}{A}[angleA][angleB] +%% Draw a Circle with center O from angleA to angleB, going counter clockwise. +%% The circle is defined by center $O$ and the other node $A$ on the circle, +%% or the center $O$ and the given Radius/Diameter in options. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the circle center O +%% #3 -> [input] the node A on the circle or empty if you setup Radius/Diameter +%% #4 -> [input] optional. start angle from angleA to angleB, going counter clockwise. +%% #5 -> [input] optional, start angle from angleA to angleB, going counter clockwise. +\def\pstCircleOA{\@ifnextchar[\Pst@CircleOA{\Pst@CircleOA[]}} +\def\Pst@CircleOA[#1]#2#3{% + \begingroup + \psset{#1}% + \def\pst@circle@center{#2} + \def\pst@circle@node{#3} + \@ifnextchar[\pstCircleOA@i{\pstCircleOA@i[0][360]}}% +\def\pstCircleOA@i[#1][#2]{% + \rput(\pst@circle@center){% + \begin@OpenObj \def\pst@linetype{4}% \addto@pscode{% tx@EcldDict begin - /N@#1 GetNode + /N@\pst@circle@center\space GetNode \ifx\psk@Radius\@none \ifx\psk@Diameter\@none - 2 copy /N@#2 GetNode ABDist - \else\psk@Diameter 2 div + 2 copy /N@\pst@circle@node\space GetNode ABDist + \else\psk@Diameter\space 2 div \fi \else\psk@Radius\space \fi end - \psk@dimen CLW mul sub 0 360 arc closepath}% + %\psk@dimen CLW mul sub 0 360 arc closepath}% + #1 #2 arc}% \showpointsfalse - \end@ClosedObj + \end@OpenObj }% - \egroup% + \endgroup% }% %% #2 #3 -> 2 nodes defining a diameter of the circle -\def\pstCircleAB{\pst@object{pstCircleAB}}% -\def\pstCircleAB@i#1#2{% - \bgroup\use@par% - \Pst@MiddleAB[PointSymbol=none, PointName=none]{#2}{#1}{@MAB}{} - \rput(#1){% - \begin@ClosedObj +\def\pstCircleAB{\@ifnextchar[\Pst@CircleAB{\Pst@CircleAB[]}} +\def\Pst@CircleAB[#1]#2#3{% + \begingroup + \psset{#1}% + \def\pst@circle@diameter@A{#2} + \def\pst@circle@diameter@B{#3} + \@ifnextchar[\pstCircleAB@i{\pstCircleAB@i[0][360]}}% +\def\pstCircleAB@i[#1][#2]{% + \Pst@MiddleAB[PointSymbol=none, PointName=none]{\pst@circle@diameter@B}{\pst@circle@diameter@A}{PST@CIRCLE@MAB} + \rput(\pst@circle@diameter@A){% + \begin@OpenObj \def\pst@linetype{4}% \addto@pscode{% tx@NodeDict begin - tx@NodeDict /N@@MAB load GetCenter + tx@NodeDict /N@PST@CIRCLE@MAB load GetCenter end 2 copy - tx@EcldDict begin /N@#2 GetNode ABDist end - \psk@dimen CLW mul sub 0 360 arc closepath}% + tx@EcldDict begin /N@\pst@circle@diameter@B\space GetNode ABDist end + \psk@dimen\space CLW mul sub #1 #2 arc}% \showpointsfalse - \end@ClosedObj + \end@OpenObj }% - \egroup% + \endgroup% }% %% #2 #3 #4 -> 3 nodes defining the center and two points on the circle \def\pstArcOAB{\pst@object{pstArcOAB}}% @@ -1582,29 +1604,73 @@ %% Special macros for parameters %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -\def\pstTriangleIC{\pst@object{pstTriangleIC}}% inner circle of a triangle -\def\pstTriangleIC@i#1#2#3{% - \begingroup - \psset{PointSymbol=none,PointName=none,linestyle=none,CodeFig=false} - \pstBissectBAC{#3}{#1}{#2}{IC_BC} - \pstBissectBAC{#2}{#3}{#1}{IC_AB} - \pstInterLL{#3}{IC_AB}{#1}{IC_BC}{IC_O} - \pstProjection{#1}{#2}{IC_O}[IC_OAB] - \endgroup +%% \pstTriangleIC[Options]{A}{B}{C}[I][D] +%% Draw the inner circle of triangle ABC +%% Parameters: +%% #1 -> options +%% #2 -> [input] the node A +%% #3 -> [input] the node B +%% #4 -> [input] the node C +%% #5 -> [output] optional, the inner circle center I +%% #6 -> [output] optional, the node on inner circle +\def\pstTriangleIC{\@ifnextchar[\Pst@TriangleIC{\Pst@TriangleIC[]}} +\def\Pst@TriangleIC[#1]#2#3#4{% \begingroup - \use@par - \pstCircleOA{IC_O}{IC_OAB} + \@InitListMng % + % we should output none point name and symbol as default + % to compat with the old version. + \psset{PointName=none,PointSymbol=none} + % then comes the user local options. + \psset{#1}% + \def\pst@triangle@node@a{#2} + \def\pst@triangle@node@b{#3} + \def\pst@triangle@node@c{#4} + \@ifnextchar[\Pst@TriangleIC@i{\Pst@TriangleIC@i[IC_O]}} +\def\Pst@TriangleIC@i[#1]{% + \def\pst@triangle@inner@center{#1} + \@ifnextchar[\Pst@TriangleIC@j{\Pst@TriangleIC@j[IC_OAB]}} +\def\Pst@TriangleIC@j[#1]{% + \begingroup + \psset{PointSymbol=none,PointName=none,linestyle=none,CodeFig=false} + \pstBissectBAC{\pst@triangle@node@c}{\pst@triangle@node@a}{\pst@triangle@node@b}{@PST@TRIANGLE@IC_BC} + \pstBissectBAC{\pst@triangle@node@b}{\pst@triangle@node@c}{\pst@triangle@node@a}{@PST@TRIANGLE@IC_AB} + \pstInterLL{\pst@triangle@node@c}{@PST@TRIANGLE@IC_AB}{\pst@triangle@node@a}{@PST@TRIANGLE@IC_BC}{\pst@triangle@inner@center} + \pstProjection{\pst@triangle@node@a}{\pst@triangle@node@b}{\pst@triangle@inner@center}[#1] + \endgroup + \pstCircleOA{\pst@triangle@inner@center}{#1} + \Pst@ManageParamList{\pst@triangle@inner@center}% + \Pst@ManageParamList{#1}% \endgroup -} +}% % -\def\pstTriangleOC{\pst@object{pstTriangleOC}}% inner circle of a triangle -\def\pstTriangleOC@i#1#2#3{% +%% \pstTriangleOC[Options]{A}{B}{C}[O] +%% Draw the outer circle of triangle ABC +%% Parameters: +%% #1 -> options +%% #2 -> [input] the node A +%% #3 -> [input] the node B +%% #4 -> [input] the node C +%% #5 -> [output] optional, the outer circle center O +\def\pstTriangleOC{\@ifnextchar[\Pst@TriangleOC{\Pst@TriangleOC[]}} +\def\Pst@TriangleOC[#1]#2#3#4{% \begingroup - \addbefore@par{PointSymbol=none,PointName=none} - \use@par - \pstCircleABC{#1}{#2}{#3}{OC_O} + % we should output none point name and symbol as default + % to compat with the old version. + \psset{PointName=none,PointSymbol=none} + % then comes the user local options. + \psset{#1}% + \def\pst@triangle@node@a{#2} + \def\pst@triangle@node@b{#3} + \def\pst@triangle@node@c{#4} + \@ifnextchar[\Pst@TriangleOC@i{\Pst@TriangleOC@i[OC_O]}} +\def\Pst@TriangleOC@i[#1]{% + \begingroup + \psset{PointSymbol=none,PointName=none,CodeFig=false} + \pstCircleABC{\pst@triangle@node@a}{\pst@triangle@node@b}{\pst@triangle@node@c}{#1} + \endgroup + \Pst@geonodelabel{#1}% \endgroup -} +}% % %% Distance between two points \def\pstDistAB#1#2{% @@ -1704,7 +1770,7 @@ \fi \pnode(! % /dec \psk@decimals\space def - \psk@PSfont findfont \psk@fontscale scalefont setfont \pst@usecolor\pslinecolor + \psk@PSfont findfont \psk@fontscale scalefont setfont \pst@usecolor\pslinecolor \ifpst@psfonts /s1 { /Symbol findfont \psk@fontscale\space scalefont setfont } bind def \else @@ -1730,6 +1796,6203 @@ \ignorespaces } % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Here are some functions to operate the Coordinate +%% of a given node. +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +%% \pstAbscissa{A} +%% return the abscissa value of node A, which can be transformed to a new abscissa by pstricks raw code. +%% Parameters: +%% #1 -> [input] the input node +\def\pstAbscissa#1{% + tx@EcldDict begin /N@#1 GetNode pop \pst@number\psxunit div end +}% +% +%% \pstOrdinate{A} +%% return the ordinate value of node A, which can be transformed to a new ordinate by pstricks raw code. +%% Parameters: +%% #1 -> [input] the input node +\def\pstOrdinate#1{% + tx@EcldDict begin /N@#1 GetNode exch pop \pst@number\psyunit div end +}% +% +%% \pstMoveNode[Options](dx,dy){A}{B} +%% move node A by abscissa increment dx and ordinate increment dy to the target node B. +%% This Macro will create the new node B. +%% Parameters: +%% #1 -> options +%% #2 -> abscissa increment +%% #3 -> ordinate increment +%% #4 -> orignal node name +%% #5 -> target node name +\def\pstMoveNode{\@ifnextchar[\Pst@MoveNode{\Pst@MoveNode[]}} +\def\Pst@MoveNode[#1]{% + \begingroup + \psset{#1}% + \Pst@MoveNode@i} +\def\Pst@MoveNode@i(#1,#2)#3#4{% + \pnode(! \pstAbscissa{#3} #1 add \pstOrdinate{#3} #2 add){#4}% + \Pst@geonodelabel{#4}% + \endgroup% +}% +% +%% \pstLine[Options]{node}{node} +%% \pstLine[Options]{node}(coor) +%% \pstLine[Options](coor){node} +%% \pstLine[Options](coor)(coor) +%% Create a new line with two nodes, or two coordinate or one node and one coordinate. This macro is similar with \pstLineAB, but more compatible. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the node or coordinate +%% #3 -> [input] the node or coordinate +\def\pstLine{\@ifnextchar[\Pst@Line{\Pst@Line[]}} +\def\Pst@Line[#1]{% + \begingroup + \psset{#1}% + \@ifnextchar(\Pst@Line@i{\Pst@Line@j}} +\def\Pst@Line@i(#1){% + \pnode(#1){@PSTLINE@AUXNODE@A} + \@ifnextchar(\Pst@Line@ii{\Pst@Line@jj}} +\def\Pst@Line@j#1{% + \pnode(#1){@PSTLINE@AUXNODE@A} + \@ifnextchar(\Pst@Line@ii{\Pst@Line@jj}} +\def\Pst@Line@ii(#1){% + \pnode(#1){@PSTLINE@AUXNODE@B} + \ncline{@PSTLINE@AUXNODE@A}{@PSTLINE@AUXNODE@B} + \endgroup} +\def\Pst@Line@jj#1{% + \pnode(#1){@PSTLINE@AUXNODE@B} + \ncline{@PSTLINE@AUXNODE@A}{@PSTLINE@AUXNODE@B} + \endgroup}% +% +%% \pstLineAA[Options]{A}{angle}{B} +%% \pstLineAS[Options]{A}{gradient}{B} +%% Create a new line with Point A and the slope angle or the gradient. This macro will create the new node B on the line. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the point A on the line +%% #3 -> [input] the slope angle or the gradient +%% #4 -> [output] the new node B on the line +\def\pstLineAA{\@ifnextchar[\Pst@LineAA{\Pst@LineAA[]}} +\def\Pst@LineAA[#1]{% + \begingroup + \psset{#1}% + \@ifnextchar(\Pst@LineAA@i{\Pst@LineAA@j}} +\def\Pst@LineAA@i(#1)#2#3{% + \pnode(#1){@PSTLINEASAUX} + \Pst@LineAA@k{@PSTLINEASAUX}{#2}{#3}} +\def\Pst@LineAA@j#1#2#3{% + \pnode(#1){@PSTLINEASAUX} + \Pst@LineAA@k{@PSTLINEASAUX}{#2}{#3}} +\def\Pst@LineAA@k#1#2#3{% + \pnode(! + \pstAbscissa{#1} #2 cos add + \pstOrdinate{#1} #2 sin add + ){#3} + \Pst@geonodelabel{#3}% + \pstLine{#1}{#3} + \endgroup% +}% +% +\def\pstLineAS{\@ifnextchar[\Pst@LineAS{\Pst@LineAS[]}} +\def\Pst@LineAS[#1]{% + \begingroup + \psset{#1}% + \@ifnextchar(\Pst@LineAS@i{\Pst@LineAS@j}} +\def\Pst@LineAS@i(#1)#2#3{% + \pnode(#1){@PSTLINEASAUX} + \Pst@LineAS@k{@PSTLINEASAUX}{#2}{#3}} +\def\Pst@LineAS@j#1#2#3{% + \pnode(#1){@PSTLINEASAUX} + \Pst@LineAS@k{@PSTLINEASAUX}{#2}{#3}} +\def\Pst@LineAS@k#1#2#3{% + \pnode(! + \pstAbscissa{#1} 1 add + \pstOrdinate{#1} #2 add + ){#3} + \Pst@geonodelabel{#3}% + \pstLine{#1}{#3} + \endgroup% +}% +% +%% \pstLineAbsNode[Options]{A}{B}{$x_0$}{C} +%% Create a new node C on the line AB whose abscissa is the given value $x_0$. +%% You can input $x_0$ as any number(e.g, 2.0), and use \pscalculate{} to generate the value, +%% or use \pstAbscissa to get the abscissa of any node. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the line point A +%% #3 -> [input] the line point B +%% #4 -> [input] the abscissa value +%% #5 -> [output] the target node name +\def\pstLineAbsNode{\@ifnextchar[\Pst@LineAbsNode{\Pst@LineAbsNode[]}} +\def\Pst@LineAbsNode[#1]{% + \begingroup + \psset{#1}% + \Pst@LineAbsNode@i} +\def\Pst@LineAbsNode@i#1#2#3#4{% + \pnode(! #3 0){@LINEABSAUXA#1#2}\pnode(! #3 1){@LINEABSAUXB#1#2}% + \pstInterLL{#1}{#2}{@LINEABSAUXA#1#2}{@LINEABSAUXB#1#2}{#4}% + \Pst@geonodelabel{#4}% + \endgroup% +}% +% +%% \pstLineOrdNode[Options]{A}{B}{$y_0$}{C} +%% Create a new node C on the line AB whose ordinate is the given value $y_0$. +%% You can input $y_0$ as any number(e.g, 2.0), and use \pscalculate{} to generate the value, +%% or use \pstOrdinate to get the ordinate of any node. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the line point A +%% #3 -> [input] the line point B +%% #4 -> [input] the ordinate value +%% #5 -> [output] the target node name +\def\pstLineOrdNode{\@ifnextchar[\Pst@LineOrdNode{\Pst@LineOrdNode[]}} +\def\Pst@LineOrdNode[#1]{% + \begingroup + \psset{#1}% + \Pst@LineOrdNode@i} +\def\Pst@LineOrdNode@i#1#2#3#4{% + \pnode(! 0 #3){@LINEORDAUXA#1#2}\pnode(! 1 #3){@LINEORDAUXB#1#2}% + \pstInterLL{#1}{#2}{@LINEORDAUXA#1#2}{@LINEORDAUXB#1#2}{#4}% + \Pst@geonodelabel{#4}% + \endgroup% +}% +% +%% \pstCircleAbsNode[Options]{O}{A}{$x_0$}{C}{D} +%% Create the new nodes C and D on the Circle O whose abscissas are the given value $x_0$. +%% The circle O is defined by center O and point A on the circle or Radius in parameter. +%% You can input $x_0$ as any number(e.g, 2.0), and use \pscalculate{} to generate the value, +%% or use \pstAbscissa to get the abscissa of any node. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the circle center O +%% #3 -> [input] the circle point A or empty with Radius parameter +%% #4 -> [input] the abscissa value +%% #5 -> [output] the target node name +%% #6 -> [output] the target node name +\def\pstCircleAbsNode{\@ifnextchar[\Pst@CircleAbsNode{\Pst@CircleAbsNode[]}} +\def\Pst@CircleAbsNode[#1]{% + \begingroup + \psset{#1}% + \Pst@CircleAbsNode@i} +\def\Pst@CircleAbsNode@i#1#2#3#4#5{% + \pnode(! #3 0){@LINEABSAUXA#1#2}\pnode(! #3 1){@LINEABSAUXB#1#2}% + \pstInterLC{@LINEABSAUXA#1#2}{@LINEABSAUXB#1#2}{#1}{#2}{#4}{#5}% + \endgroup% +}% +% +%% \pstCircleOrdNode[Options]{O}{A}{$y_0$}{C}{D} +%% Create the new nodes C and D on the Circle O whose ordinates are the given value. +%% The circle O is defined by center O and point A on the circle or Radius in parameter. +%% You can input $y_0$ as any number(e.g, 2.0), and use \pscalculate{} to generate the value, +%% or use \pstOrdinate to get the ordinate of any node. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the circle center O +%% #3 -> [input] the circle point A or empty with Radius parameter +%% #4 -> [input] the ordinate value +%% #5 -> [output] the target node name +%% #6 -> [output] the target node name +\def\pstCircleOrdNode{\@ifnextchar[\Pst@CircleOrdNode{\Pst@CircleOrdNode[]}} +\def\Pst@CircleOrdNode[#1]{% + \begingroup + \psset{#1}% + \Pst@CircleOrdNode@i} +\def\Pst@CircleOrdNode@i#1#2#3#4#5{% + \pnode(! 0 #3){@LINEORDAUXA#1#2}\pnode(! 1 #3){@LINEORDAUXB#1#2}% + \pstInterLC{@LINEORDAUXA#1#2}{@LINEORDAUXB#1#2}{#1}{#2}{#4}{#5}% + \endgroup% +}% +% +%% \pstCircleRotNode[Options]{O}{A}{X} +%% Create a new node X on the Circle O whose RotAngle is the given value. +%% The circle O is defined by center O and point A on the circle or Radius in parameter. +%% If you not set RotAngle, the default value is $60^\circ$. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the circle center O +%% #3 -> [input] the circle point A or empty with Radius parameter +%% #4 -> [output] the target node name +\def\pstCircleRotNode{\@ifnextchar[\Pst@CircleRotNode{\Pst@CircleRotNode[]}} +\def\Pst@CircleRotNode[#1]{% + \begingroup + \psset{#1}% + \Pst@CircleRotNode@i} +\def\Pst@CircleRotNode@i#1#2#3{% + \pnode(! + tx@EcldDict begin + /N@#1 GetNode + \ifx\psk@Radius\@none + \ifx\psk@Diameter\@none + 2 copy /N@#2 GetNode ABDist + \else\psk@Diameter 2 div + \fi + \else\psk@Radius\space + \fi + end + \psk@RotAngle\space sin \psk@RotAngle\space cos % + 2 index mul 4 index add \pst@number\psxunit\space div % + 5 1 roll mul add \pst@number\psyunit\space div exch pop% + ){#3}% + \Pst@geonodelabel{#3}% + \endgroup% +}% +% +%% \pstCircleTangentLine[Options]{O}{A}{T} +%% Draw the tangent line from A on the circle, and give the other node B on the line. +%% The circle O is defined by center O and point A on the circle. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the circle center O +%% #3 -> [input] the circle point A. +%% #4 -> [output] the target node name on the tangent line +\def\pstCircleTangentLine{\@ifnextchar[\Pst@CircleTangentLine{\Pst@CircleTangentLine[]}} +\def\Pst@CircleTangentLine[#1]{% + \begingroup + \psset{#1}% + \Pst@CircleTangentLine@i} +\def\Pst@CircleTangentLine@i#1#2#3{% + \pst@getcoor{#1}\pst@tempO% + \pst@getcoor{#2}\pst@tempA% + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempA \tx@UserCoor % x1,y1 + 0 index 3 index sub abs 1E-5 lt { % if y1=y0 + 1 index 1 index 1 add + 6 2 roll pop pop pop pop + } { + 1 index 4 index sub abs 1E-5 lt { % if x1=x0 + 1 index 1 add 1 index + 6 2 roll pop pop pop pop + } { + 1 index 4 index sub % x1-x0 + 1 index 4 index sub % y1-y0 + div neg 1 index add % -(x1-x0)/(y1-y0) + y1 + 2 index 1 add % x=x1+1 + exch 6 2 roll pop pop pop pop + } ifelse + } ifelse + ){#3}% + \Pst@geonodelabel{#3}% + \pstLine{#2}{#3} + \endgroup% +}% +% +%% \pstCircleTangentNode[Options]{O}{A}{P}{T1}{T2} +%% Draw the tangent line from P out of the circle A(O), and give the two tangent nodes T1/T2 on the line. +%% The circle O is defined by center O and point A on the circle or Radius in parameter. +%% Suppose the coordinate of tangent node is (x,y), and node T is (a,b), the circle radius is r, then we have +%% $$(y-y0)(y-b)+(x-x0)(x-a)=0$$ +%% but (x,y) is on the circle, so we have +%% $$x=rcos\theta+x_0, y=rcos\theta+y_0$$ +%% then +%% $$(x_0-a)\cos\theta+(b-y_0)\sin\theta=r$$ +%% if we take $e=a-x_0$, $f=b-y_0$, we have +%% $$(e^2+f^2)\sin^\theta-2rf\sin\theta+r^2-e^2=0$$ +%% so +%% $$\sin\theta=\dfrac{rf\pm{}e\sqrt{e^2+f^2-r^2}}{e^2+f^2}$$ +%% $$\cos\theta=\dfrac{re\mp{}f\sqrt{e^2+f^2-r^2}}{e^2+f^2}$$ +%% Parameters: +%% #1 -> options +%% #2 -> [input] the circle center O +%% #3 -> [input] the circle point A or empty with Radius parameter +%% #4 -> [input] the node name T out of circle +%% #5 -> [output] the first target name on the circle +%% #6 -> [output] the second target name on the circle +\def\pstCircleTangentNode{\@ifnextchar[\Pst@CircleTangentNode{\Pst@CircleTangentNode[]}} +\def\Pst@CircleTangentNode[#1]{% + \begingroup + \@InitListMng % + \psset{#1}% + \Pst@CircleTangentNode@i} +\def\Pst@CircleTangentNode@i#1#2#3#4#5{% + \pst@getcoor{#1}\pst@tempO% + \ifx\relax#2\relax\else\pst@getcoor{#2}\pst@tempV\fi% + \pst@getcoor{#3}\pst@tempT% + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempT \tx@UserCoor % a,b + \ifx\psk@Radius\@none + \ifx\psk@Diameter\@none + \pst@tempV \tx@UserCoor % nx,ny + 4 index sub dup mul exch 5 index sub dup mul add sqrt + \else\psk@Diameter\space 2 div \pst@number\psxunit div + \fi + \else\psk@Radius\space \pst@number\psxunit div + \fi % r + 2 index 5 index sub % e=a-x0 + 2 index 5 index sub % f=b-y0 + 1 index dup mul 1 index dup mul add % e^2+f^2 + 0 index 4 index dup mul sub + dup abs 1E-5 lt { + pop pop pop pop pop pop + pop pop pop 0 0 + } { + sqrt % sqrt(e^2+f^2-r^2) + 4 index 3 index mul 4 index 2 index mul sub 2 index div % \sin\theta + 5 index 5 index mul 4 index 3 index mul add 3 index div % \cos\theta + 6 index 1 index mul 11 index add % x_1 + 7 index 3 index mul 11 index add % y_1 + 13 2 roll pop pop pop pop pop + pop pop pop pop pop pop + } ifelse + ){#4}% + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempT \tx@UserCoor % a,b + \ifx\psk@Radius\@none + \ifx\psk@Diameter\@none + \pst@tempV \tx@UserCoor % nx,ny + 4 index sub dup mul exch 5 index sub dup mul add sqrt + \else\psk@Diameter\space 2 div \pst@number\psxunit div + \fi + \else\psk@Radius\space \pst@number\psxunit div + \fi % r + 2 index 5 index sub % e=a-x0 + 2 index 5 index sub % f=b-y0 + 1 index dup mul 1 index dup mul add % e^2+f^2 + 0 index 4 index dup mul sub + dup abs 1E-5 lt { + pop pop pop pop pop pop + pop pop pop 0 0 + } { + sqrt % sqrt(e^2+f^2-r^2) + 4 index 3 index mul 4 index 2 index mul add 2 index div % \sin\theta + 5 index 5 index mul 4 index 3 index mul sub 3 index div % \cos\theta + 6 index 1 index mul 11 index add % x_1 + 7 index 3 index mul 11 index add % y_1 + 13 2 roll pop pop pop pop pop + pop pop pop pop pop pop + } ifelse + ){#5}% + \Pst@ManageParamList{#4}% + \Pst@ManageParamList{#5}% + \pstLine{#3}{#4} + \pstLine{#3}{#5} + \endgroup% +}% +% +%% \pstCircleExternalCommonTangent[Options]{O1}{A}{O2}{B}{T1}{T2}{T3}{T4} +%% Find the external common tangent lines of the circle A(O1) and B(O2), mark the two tangent nodes T1/T2 on circle A(O1), +%% and the two tangent nodes T3/T4 on circle B(O2). +%% The circle A(O1) is defined by center O1 and point A on the circle or RadiusA/DiameterA in parameter. +%% The circle B(O1) is defined by center O2 and point B on the circle or RadiusB/DiameterB in parameter. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the circle center O +%% #3 -> [input] the circle point A or empty with Radius parameter +%% #4 -> [input] the node name T out of circle +%% #5 -> [output] the first target name on the circle +%% #6 -> [output] the second target name on the circle +\def\pstCircleExternalCommonTangent{\@ifnextchar[\Pst@CircleExternalCommonTangent{\Pst@CircleExternalCommonTangent[]}} +\def\Pst@CircleExternalCommonTangent[#1]{% + \begingroup + \@InitListMng % + \psset{#1}% + \Pst@CircleExternCommonTangent@i} +\def\Pst@CircleExternCommonTangent@i#1#2#3#4#5#6#7#8{% + % use edef to save the second Radius or Diameter. + \edef\pst@RadiusB@temp{\psk@RadiusB} + \edef\pst@DiameterB@temp{\psk@DiameterB} + % use RadiusA or DiameterA to find the intersection of A(O1) and O1O2. + \ifx\psk@RadiusA\@undef + \ifx\psk@DiameterA\@undef\relax\else + \psset{Diameter=\psk@DiameterA} + \fi + \else\psset{Radius=\psk@RadiusA}\fi + \pstInterLC[PointName=none,PointSymbol=none]{#1}{#3}{#1}{#2}{@PST@CIRCLE@INTER@A}{@PST@CIRCLE@INTER@C} + % clear the used options + \let\psk@Radius\@none\let\psk@Diameter\@none + % use RadiusB or DiameterB to find the intersection of B(O2) and O1O2. + \ifx\psk@RadiusB\@undef + \ifx\psk@DiameterB\@undef\relax\else + \psset{Diameter=\psk@DiameterB} + \fi + \else\psset{Radius=\psk@RadiusB}\fi + \pstInterLC[PointName=none,PointSymbol=none]{#1}{#3}{#3}{#4}{@PST@CIRCLE@INTER@B}{@PST@CIRCLE@INTER@D} + % clear the used options + \let\psk@Radius\@none\let\psk@Diameter\@none + \pstRotation[RotAngle=90,PointName=none,PointSymbol=none]{#1}{@PST@CIRCLE@INTER@A}[@PST@CIRCLE@INTER@AA] + \pstRotation[RotAngle=90,PointName=none,PointSymbol=none]{#3}{@PST@CIRCLE@INTER@B}[@PST@CIRCLE@INTER@BB] + \pstInterLL[PointName=none,PointSymbol=none]{#1}{#3}{@PST@CIRCLE@INTER@AA}{@PST@CIRCLE@INTER@BB}{@PST@CIRCLE@INTER@K} + \pstMiddleAB[PointName=none,PointSymbol=none]{#1}{@PST@CIRCLE@INTER@K}{@PST@CIRCLE@CENTER@X} + \pstMiddleAB[PointName=none,PointSymbol=none]{#3}{@PST@CIRCLE@INTER@K}{@PST@CIRCLE@CENTER@Y} + % use RadiusA or DiameterA to find the intersection of A(O1) and K(X). + % Note that we should set Radius to @none and set RadiusB and DiameterB to @undef. + \ifx\psk@RadiusA\@undef\relax\else\psset{RadiusA=\psk@RadiusA}\fi + \ifx\psk@RadiusA\@undef + \ifx\psk@DiameterA\@undef\relax\else + \psset{DiameterA=\psk@DiameterA} + \fi + \else\psset{RadiusA=\psk@RadiusA}\fi + \let\psk@Radius\@none\let\psk@Diameter\@none + \let\psk@RadiusB\@undef\let\psk@DiameterB\@undef + \pstInterCC[PointName=none,PointSymbol=none]{#1}{#2}{@PST@CIRCLE@CENTER@X}{#1}{#5}{#6} + % use RadiusB or DiameterB to find the intersection of B(O2) and K(Y). + % Note that we should set Radius to @none and set RadiusB and DiameterB to @undef. + \ifx\pst@RadiusB@temp\@undef + \ifx\pst@DiameterB@temp\@undef\relax\else + \psset{DiameterA=\pst@DiameterB@temp} + \fi + \else\psset{RadiusA=\pst@RadiusB@temp}\fi + \let\psk@Radius\@none\let\psk@Diameter\@none + \let\psk@RadiusB\@undef\let\psk@DiameterB\@undef + \pstInterCC[PointName=none,PointSymbol=none]{#3}{#4}{@PST@CIRCLE@CENTER@Y}{#3}{#7}{#8} + % CodeFig: + %\pstLine{#1}{@PST@CIRCLE@INTER@AA} + %\pstLine{#3}{@PST@CIRCLE@INTER@BB} + %\pstLine{#1}{@PST@CIRCLE@INTER@K} + %\pstLine{@PST@CIRCLE@INTER@K}{@PST@CIRCLE@INTER@AA} + %\let\psk@Radius\@none\let\psk@Diameter\@none + %\pstCircleOA[linestyle=dashed,linecolor=gray!30]{@PST@CIRCLE@CENTER@X}{#1} + %\pstCircleOA[linestyle=dashed,linecolor=blue!30]{@PST@CIRCLE@CENTER@Y}{#3} + \Pst@ManageParamList{#5}% + \Pst@ManageParamList{#6}% + \Pst@ManageParamList{#7}% + \Pst@ManageParamList{#8}% + \endgroup% +}% +% +%% \pstCircleInternalCommonTangent[Options]{O1}{A}{O2}{B}{T1}{T2}{T3}{T4} +%% Find the internal common tangent lines of the circle A(O1) and B(O2), mark the two tangent nodes T1/T2 on circle A(O1), +%% and the two tangent nodes T3/T4 on circle B(O2). +%% The circle A(O1) is defined by center O1 and point A on the circle or RadiusA/DiameterA in parameter. +%% The circle B(O1) is defined by center O2 and point B on the circle or RadiusB/DiameterB in parameter. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the circle center O +%% #3 -> [input] the circle point A or empty with Radius parameter +%% #4 -> [input] the node name T out of circle +%% #5 -> [output] the first target name on the circle +%% #6 -> [output] the second target name on the circle +\def\pstCircleInternalCommonTangent{\@ifnextchar[\Pst@CircleInternalCommonTangent{\Pst@CircleInternalCommonTangent[]}} +\def\Pst@CircleInternalCommonTangent[#1]{% + \begingroup + \@InitListMng % + \psset{#1}% + \Pst@CircleInternalCommonTangent@i} +\def\Pst@CircleInternalCommonTangent@i#1#2#3#4#5#6#7#8{% + % use edef to save the second Radius or Diameter. + \edef\pst@RadiusB@temp{\psk@RadiusB} + \edef\pst@DiameterB@temp{\psk@DiameterB} + % use RadiusA or DiameterA to find the intersection of A(O1) and O1O2. + \ifx\psk@RadiusA\@undef + \ifx\psk@DiameterA\@undef\relax\else + \psset{Diameter=\psk@DiameterA} + \fi + \else\psset{Radius=\psk@RadiusA}\fi + \pstInterLC[PointName=none,PointSymbol=none]{#1}{#3}{#1}{#2}{@PST@CIRCLE@INTER@A}{@PST@CIRCLE@INTER@C} + % clear the used options + \let\psk@Radius\@none\let\psk@Diameter\@none + % use RadiusB or DiameterB to find the intersection of B(O2) and O1O2. + \ifx\psk@RadiusB\@undef + \ifx\psk@DiameterB\@undef\relax\else + \psset{Diameter=\psk@DiameterB} + \fi + \else\psset{Radius=\psk@RadiusB}\fi + \pstInterLC[PointName=none,PointSymbol=none]{#1}{#3}{#3}{#4}{@PST@CIRCLE@INTER@B}{@PST@CIRCLE@INTER@D} + % clear the used options + \let\psk@Radius\@none\let\psk@Diameter\@none + \pstRotation[RotAngle=90,PointName=none,PointSymbol=none]{#1}{@PST@CIRCLE@INTER@A}[@PST@CIRCLE@INTER@AA] + \pstRotation[RotAngle=-90,PointName=none,PointSymbol=none]{#3}{@PST@CIRCLE@INTER@B}[@PST@CIRCLE@INTER@BB] + \pstInterLL[PointName=none,PointSymbol=none]{#1}{#3}{@PST@CIRCLE@INTER@AA}{@PST@CIRCLE@INTER@BB}{@PST@CIRCLE@INTER@K} + \pstMiddleAB[PointName=none,PointSymbol=none]{#1}{@PST@CIRCLE@INTER@K}{@PST@CIRCLE@CENTER@X} + \pstMiddleAB[PointName=none,PointSymbol=none]{#3}{@PST@CIRCLE@INTER@K}{@PST@CIRCLE@CENTER@Y} + % use RadiusA or DiameterA to find the intersection of A(O1) and K(X). + % Note that we should set Radius to @none and set RadiusB and DiameterB to @undef. + \ifx\psk@RadiusA\@undef\relax\else\psset{RadiusA=\psk@RadiusA}\fi + \ifx\psk@RadiusA\@undef + \ifx\psk@DiameterA\@undef\relax\else + \psset{DiameterA=\psk@DiameterA} + \fi + \else\psset{RadiusA=\psk@RadiusA}\fi + \let\psk@Radius\@none\let\psk@Diameter\@none + \let\psk@RadiusB\@undef\let\psk@DiameterB\@undef + \pstInterCC[PointName=none,PointSymbol=none]{#1}{#2}{@PST@CIRCLE@CENTER@X}{#1}{#5}{#6} + % use RadiusB or DiameterB to find the intersection of B(O2) and K(Y). + % Note that we should set Radius to @none and set RadiusB and DiameterB to @undef. + \ifx\pst@RadiusB@temp\@undef + \ifx\pst@DiameterB@temp\@undef\relax\else + \psset{DiameterA=\pst@DiameterB@temp} + \fi + \else\psset{RadiusA=\pst@RadiusB@temp}\fi + \let\psk@Radius\@none\let\psk@Diameter\@none + \let\psk@RadiusB\@undef\let\psk@DiameterB\@undef + \pstInterCC[PointName=none,PointSymbol=none]{#3}{#4}{@PST@CIRCLE@CENTER@Y}{#3}{#7}{#8} + % CodeFig: + %\pstLine{#1}{@PST@CIRCLE@INTER@AA} + %\pstLine{#3}{@PST@CIRCLE@INTER@BB} + %\pstLine{#1}{@PST@CIRCLE@INTER@K} + %\pstLine{@PST@CIRCLE@INTER@K}{@PST@CIRCLE@INTER@AA} + %\let\psk@Radius\@none\let\psk@Diameter\@none + %\pstCircleOA[linestyle=dashed,linecolor=gray!30]{@PST@CIRCLE@CENTER@X}{#1} + %\pstCircleOA[linestyle=dashed,linecolor=blue!30]{@PST@CIRCLE@CENTER@Y}{#3} + \Pst@ManageParamList{#5}% + \Pst@ManageParamList{#6}% + \Pst@ManageParamList{#7}% + \Pst@ManageParamList{#8}% + \endgroup% +}% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Here are some functions to operate the conic curves. +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% 1. Standard Ellipse with coordinate translation +%% ---------------------------------------------------------- +%% The Ellipse E is defined by center O, the half of the major axis $max(abs(a),abs(b))$, +%% the half of the minor axis $min(abs(a),abs(b))$, the equation as following: +%% \begin{equation}\label{FunctionOfStandardEllipse} +%% \dfrac{(x-x_o)^2}{a^2}+\dfrac{(y-y_o)^2}{b^2}=1 +%% \end{equation} +%% Sometimes we use the parametric function of the ellipse: +%% \begin{equation}\label{ParametricFunctionOfEllipse} +%% \left\{\begin{array}{l} +%% x=a\cos\alpha+x_o\\ +%% y=b\sin\alpha+y_0 +%% \end{array}\right. +%% \end{equation} +% +%% \pstEllipse[Options](O)(a,b)[angleA][angleB] +%% Draw a Ellipse with center O from angleA to angleB, going counter clockwise, +%% the half of the major axis $max(abs(a),abs(b))$, and the half of the minor axis $min(abs(a),abs(b))$. +%% This macro is like \psellipse and \psellipticarc in \PST. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the ellipse center O +%% #3 -> [input] the horizontal and vertical radii +%% #4 -> [input] start angle from angleA to angleB, going counter clockwise. +%% #5 -> [input] start angle from angleA to angleB, going counter clockwise. +\def\pstEllipse{\@ifnextchar[\Pst@Ellipse{\Pst@Ellipse[]}} +\def\Pst@Ellipse[#1](#2)(#3){% + \begingroup + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pst@getcoor{#3}\pst@tempR% + \@ifnextchar[\Pst@Ellipse@i{\Pst@Ellipse@i[0][360]}}% +\def\Pst@Ellipse@i[#1][#2]{% + \parametricplot{#1}{#2}{% + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + 3 index 2 index t cos mul add % x0+a\cos{t} + 3 index 2 index t sin mul add % y0+b\sin{t} + 6 2 roll pop pop pop pop + }% + \endgroup% +}% +% +%% \pstEllipseNode[Options](O)(a,b){t}{P} +%% Create a new node P on the Ellipse E whose parameter is the given value $t$. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the ellipse center O +%% #3 -> [input] the horizontal and vertical radii +%% #4 -> [input] the parametric argument t. +%% #5 -> [output] the target node name. +\def\pstEllipseNode{\@ifnextchar[\Pst@pstEllipseNode{\Pst@pstEllipseNode[]}} +\def\Pst@pstEllipseNode[#1](#2)(#3)#4#5{% + \begingroup + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pst@getcoor{#3}\pst@tempR% + \pnode(! + \pst@tempO \tx@UserCoor % x_o,y_o + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + 3 index 2 index #4 cos mul add % x0+a\cos{t} + 3 index 2 index #4 sin mul add % y0+b\sin{t} + 6 2 roll pop pop pop pop + ){#5}% + \Pst@geonodelabel{#5}% + \endgroup% +}% +% +%% \pstEllipseRotNode[Options](O)(a,b){P} +%% Create a new node P on the Ellipse E whose RotAngle is the given value. +%% If you not set RotAngle, the default value is $60^\circ$. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the ellipse center O +%% #3 -> [input] the horizontal and vertical radii +%% #4 -> [output] the target node name +\def\pstEllipseRotNode{\@ifnextchar[\Pst@EllipseRotNode{\Pst@EllipseRotNode[]}} +\def\Pst@EllipseRotNode[#1]{% + \begingroup + \psset{#1}% + \Pst@EllipseRotNode@i} +\def\Pst@EllipseRotNode@i(#1)(#2)#3{% + \pst@getcoor{#1}\pst@tempO% + \pst@getcoor{#2}\pst@tempR% + \pnode(! + \pst@tempO \tx@UserCoor % x_o,y_o + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + 3 index 2 index \psk@RotAngle\space cos mul add % x0+a\cos{t} + 3 index 2 index \psk@RotAngle\space sin mul add % y0+b\sin{t} + 6 2 roll pop pop pop pop + ){#3}% + \Pst@geonodelabel{#3}% + \endgroup% +}% +% +%% \pstEllipseAbsNode[Options](O)(a,b){x_1}{A}{B} +%% Create the two nodes A and B whose abscissas are the given value $x_1$ on the Ellipse E. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the ellipse center O +%% #3 -> [input] the horizontal and vertical radii +%% #4 -> [input] the given abscissa value $x_1$ +%% #5 -> [output] the first target node name $A$ +%% #6 -> [output] the second target node name $B$ +\def\pstEllipseAbsNode{\@ifnextchar[\Pst@EllipseAbsNode{\Pst@EllipseAbsNode[]}} +\def\Pst@EllipseAbsNode[#1]{% + \begingroup + \@InitListMng % + \psset{#1}% + \Pst@EllipseAbsNode@i} +\def\Pst@EllipseAbsNode@i(#1)(#2)#3#4#5{% + \pst@getcoor{#1}\pst@tempO% + \pst@getcoor{#2}\pst@tempR% + \pnode(! + \pst@tempO \tx@UserCoor % x_o,y_o + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + #3 % x_1 + 2 index dup mul 1 index 6 index sub dup mul sub % a^2-(x_1-x_o)^2 + dup 0 lt { + pop pop pop pop pop pop 0 0 + }{ + sqrt 2 index mul 3 index div % b/a sqrt(a^2-(x_1-x_o)^2) + 4 index exch sub % y_o-ditto + 6 2 roll pop pop pop pop + } ifelse + ){#4}% + \pnode(! + \pst@tempO \tx@UserCoor % x_o,y_o + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + #3 % x_1 + 2 index dup mul 1 index 6 index sub dup mul sub % a^2-(x_1-x_o)^2 + dup 0 lt { + pop pop pop pop pop pop 0 0 + }{ + sqrt 2 index mul 3 index div % b/a sqrt(a^2-(x_1-x_o)^2) + 4 index add % y_o+ditto + 6 2 roll pop pop pop pop + } ifelse + ){#5}% + \Pst@ManageParamList{#4}% + \Pst@ManageParamList{#5}% + \endgroup% +}% +% +%% \pstEllipseOrdNode[Options](O)(a,b){y_1}{A}{B} +%% Create the two nodes A and B whose ordinates are the given value $y_1$ on the Ellipse E. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the ellipse center O +%% #3 -> [input] the horizontal and vertical radii +%% #4 -> [input] the given ordinate value $y_1$ +%% #5 -> [output] the first target node name $A$ +%% #6 -> [output] the second target node name $B$ +\def\pstEllipseOrdNode{\@ifnextchar[\Pst@EllipseOrdNode{\Pst@EllipseOrdNode[]}} +\def\Pst@EllipseOrdNode[#1]{% + \begingroup + \@InitListMng % + \psset{#1}% + \Pst@EllipseOrdNode@i} +\def\Pst@EllipseOrdNode@i(#1)(#2)#3#4#5{% + \pst@getcoor{#1}\pst@tempO% + \pst@getcoor{#2}\pst@tempR% + \pnode(! + \pst@tempO \tx@UserCoor % x_o,y_o + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + #3 % y_1 + 1 index dup mul 1 index 5 index sub dup mul sub % b^2-(y_1-y_o)^2 + dup 0 lt { + pop pop pop pop pop pop 0 0 + }{ + sqrt 3 index mul 2 index div % a/b sqrt(b^2-(y_1-y_o)^2) + 5 index exch sub % x_o-ditto + exch 6 2 roll pop pop pop pop + } ifelse + ){#4}% + \pnode(! + \pst@tempO \tx@UserCoor % x_o,y_o + \pst@tempR \tx@UserCoor % a,b + abs exch abs exch % |a|,|b| + #3 % y_1 + 1 index dup mul 1 index 5 index sub dup mul sub % b^2-(y_1-y_o)^2 + dup 0 lt { + pop pop pop pop pop pop 0 0 + }{ + sqrt 3 index mul 2 index div % a/b sqrt(b^2-(y_1-y_o)^2) + 5 index add % x_o+ditto + exch 6 2 roll pop pop pop pop + } ifelse + ){#5}% + \Pst@ManageParamList{#4}% + \Pst@ManageParamList{#5}% + \endgroup% +}% +% +%% \pstEllipseFocusNode[Options](O)(a,b){$F_1$}{$F_2$} +%% Get the two focus $F_1$ and $F_2$ point of the Ellipse E and create two new nodes. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the ellipse center O +%% #3 -> [input] the horizontal and vertical radii +%% #4 -> [output] the left/down node name +%% #5 -> [output] the right/up node name +\def\pstEllipseFocusNode{\@ifnextchar[\Pst@EllipseFocusNode{\Pst@EllipseFocusNode[]}} +\def\Pst@EllipseFocusNode[#1]{% + \begingroup + \@InitListMng % + \psset{#1}% + \Pst@EllipseFocusNode@i} +\def\Pst@EllipseFocusNode@i(#1)(#2)#3#4{% + \pst@getcoor{#1}\pst@tempO% + \pst@getcoor{#2}\pst@tempR% + \pnode(! + \pst@tempO % x0,y0 + \pst@tempR % a,b + abs exch abs exch % |a|,|b| + 2 copy gt {% Focus on haxis + 1 index dup mul 1 index dup mul sub sqrt % c=sqrt(a^2-b^2) + 4 index exch sub % x0-c + 3 index 6 2 roll pop pop pop pop % Left(x0-c,y0) + }{% Focus on vaxis + 0 index dup mul 2 index dup mul sub sqrt % c=sqrt(b^2-a^2) + 3 index exch sub % y0-c + 4 index exch 6 2 roll pop pop pop pop % Down(x0,y0-c) + } ifelse + \tx@UserCoor % + ){#3}% + \pnode(! + \pst@tempO % x0,y0 + \pst@tempR % a,b + abs exch abs exch % |a|,|b| + 2 copy gt {% Focus on haxis + 1 index dup mul 1 index dup mul sub sqrt % c=sqrt(a^2-b^2) + 4 index add % x0+c + 3 index 6 2 roll pop pop pop pop % Right(x0+c,y0) + }{% Focus on vaxis + 0 index dup mul 2 index dup mul sub sqrt % c=sqrt(b^2-a^2) + 3 index add % y0+c + 4 index exch 6 2 roll pop pop pop pop % Up(x0,y0+c) + } ifelse + \tx@UserCoor % + ){#4}% + \Pst@ManageParamList{#3}% + \Pst@ManageParamList{#4}% + \endgroup% +}% +% +%% \pstEllipseDirectrixLine[Options](O)(a,b){Lx}{Ly}{Rx}{Ry} +%% Get the two directrix line of the Ellipse E and create two new nodes on each of them. +%% the nodes Lx Ly Rx Ry lie on the tangent line of the vertex on the other axis. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the ellipse center O +%% #3 -> [input] the horizontal and vertical radii +%% #4 -> [output] the A node name on the left/down directrix line +%% #5 -> [output] the B node name on the left/down directrix line +%% #6 -> [output] the A node name on the right/up directrix line +%% #7 -> [output] the B node name on the right/up directrix line +\def\pstEllipseDirectrixLine{\@ifnextchar[\Pst@EllipseDirectrixLine{\Pst@EllipseDirectrixLine[]}} +\def\Pst@EllipseDirectrixLine[#1]{% + \begingroup + \@InitListMng % + \psset{#1} % + \Pst@EllipseDirectrixLine@i} +\def\Pst@EllipseDirectrixLine@i(#1)(#2)#3#4#5#6{% + \pst@getcoor{#1}\pst@tempO% + \pst@getcoor{#2}\pst@tempR% + \pnode(! + \pst@tempO % x0,y0 + \pst@tempR % a,b + abs exch abs exch % |a|,|b| + 2 copy gt {% left directrix line perpendicular to the haxis + 1 index dup mul 1 index dup mul sub sqrt % c=sqrt(a^2-b^2) + 2 index dup mul exch div % a^2/c + 4 index exch sub % x0-a^2/c + 3 index 2 index sub % y0-b + 6 2 roll pop pop pop pop % First A(x0-a^2/c,y0-b) + }{% down directrix line perpendicular to the vaxis + 0 index dup mul 2 index dup mul sub sqrt % c=sqrt(b^2-a^2) + 1 index dup mul exch div % b^2/c + 3 index exch sub % y0-b^2/c + 4 index 3 index sub % x0-a + exch 6 2 roll pop pop pop pop % Fisrt A(x0-a,y0-b^2/c) + } ifelse + \tx@UserCoor % + ){#3}% + \pnode(! + \pst@tempO % x0,y0 + \pst@tempR % a,b + abs exch abs exch % |a|,|b| + 2 copy gt {% left directrix line perpendicular to the haxis + 1 index dup mul 1 index dup mul sub sqrt % c=sqrt(a^2-b^2) + 2 index dup mul exch div % a^2/c + 4 index exch sub % x0-a^2/c + 3 index 2 index add % y0+b + 6 2 roll pop pop pop pop % First B(x0-a^2/c,y0+b) + }{% down directrix line perpendicular to the vaxis + 0 index dup mul 2 index dup mul sub sqrt % c=sqrt(b^2-a^2) + 1 index dup mul exch div % b^2/c + 3 index exch sub % y0-b^2/c + 4 index 3 index add % x0+a + exch 6 2 roll pop pop pop pop % Fisrt B(x0+a,y0-b^2/c) + } ifelse + \tx@UserCoor % + ){#4}% + \pnode(! + \pst@tempO % x0,y0 + \pst@tempR % a,b + abs exch abs exch % |a|,|b| + 2 copy gt {% right directrix line perpendicular to the haxis + 1 index dup mul 1 index dup mul sub sqrt % c=sqrt(a^2-b^2) + 2 index dup mul exch div % a^2/c + 4 index add % x0+a^2/c + 3 index 2 index sub % y0-b + 6 2 roll pop pop pop pop % Second A(x0+a^2/c,y0-b) + }{% up directrix line perpendicular to the vaxis + 0 index dup mul 2 index dup mul sub sqrt % c=sqrt(b^2-a^2) + 1 index dup mul exch div % b^2/c + 3 index add % y0+b^2/c + 4 index 3 index sub % x0-a + exch 6 2 roll pop pop pop pop % Second A(x0-a,y0+b^2/c) + } ifelse + \tx@UserCoor % + ){#5}% + \pnode(! + \pst@tempO % x0,y0 + \pst@tempR % a,b + abs exch abs exch % |a|,|b| + 2 copy gt {% right directrix line perpendicular to the haxis + 1 index dup mul 1 index dup mul sub sqrt % c=sqrt(a^2-b^2) + 2 index dup mul exch div % a^2/c + 4 index add % x0+a^2/c + 3 index 2 index add % y0+b + 6 2 roll pop pop pop pop % Second B(x0+a^2/c,y0+b) + }{% up directrix line perpendicular to the vaxis + 0 index dup mul 2 index dup mul sub sqrt % c=sqrt(b^2-a^2) + 1 index dup mul exch div % b^2/c + 3 index add % y0+b^2/c + 4 index 3 index add % x0+a + exch 6 2 roll pop pop pop pop % Second B(x0+a,y0+b^2/c) + } ifelse + \tx@UserCoor % + ){#6}% + \Pst@ManageParamList{#3}% + \Pst@ManageParamList{#4}% + \Pst@ManageParamList{#5}% + \Pst@ManageParamList{#6}% + \pstLineAB{#3}{#4} + \pstLineAB{#5}{#6} + \endgroup% +}% +% +%% \pstEllipseLineInter[Options](O)(a,b){A}{B}{C}{D} +%% Get the two intersection $C$ and $D$ of the Ellipse E and the given line AB. +%% We can represent the line AB as the following function when line AB is not vertical: +%% $$y=kx+t$$ where $$k=\dfrac{y_2-y_1}{x_2-x_1}, t=\dfrac{x_2y_1-x_1y_2}{x_2-x_1}$$ +%% the intersection points are: +%% $$x1=x_o-\dfrac{a^2km+ab\sqrt{w}}{u}, x2=x_o-\dfrac{a^2km-ab\sqrt{w}}{u}$$ +%% $$y_{1,2}=kx_{1,2}+t$$ +%% where, +%% $$u=a^2k^2+b^2, m=kx_o-y_o+t, w=u-m^2$$ +%% Parameters: +%% #1 -> options +%% #2 -> [input] the ellipse center O +%% #3 -> [input] the horizontal and vertical radii +%% #4 -> [input] the node name A on the given line +%% #5 -> [input] the node name B on the given line +%% #6 -> [output] the first intersection node name +%% #7 -> [output] the second intersection node name +\def\pstEllipseLineInter{\@ifnextchar[\Pst@EllipseLineInter{\Pst@EllipseLineInter[]}} +\def\Pst@EllipseLineInter[#1](#2)(#3)#4#5#6#7{% + \begingroup + \@InitListMng % + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pst@getcoor{#3}\pst@tempR% + \pst@getcoor{#4}\pst@tempA% + \pst@getcoor{#5}\pst@tempB% + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + \pst@tempA \tx@UserCoor % x1,y1 + \pst@tempB \tx@UserCoor % x2,y2 + 3 index 2 index sub abs 1E-5 lt { % if the line AB is vertical + pop pop pop + 2 index dup mul 1 index 6 index sub dup mul sub % a^2-(x_1-x_o)^2 + dup 0 lt { + pop pop pop pop pop pop 0 0 + }{ + sqrt 2 index mul 3 index div % b/a sqrt(a^2-(x_1-x_o)^2) + 4 index exch sub % y_o-ditto + 6 2 roll pop pop pop pop + } ifelse + } { + 0 index 3 index sub 2 index 5 index sub div % k + 2 index 4 index mul 2 index 6 index mul sub 3 index 6 index sub div % t + 7 index dup mul 2 index dup mul mul 7 index dup mul add % u + 2 index 11 index mul 10 index sub 2 index add % m + 1 index 1 index dup mul sub dup 0 lt { % w + pop pop pop pop pop pop pop pop pop pop pop pop pop 0 0 + } { + sqrt 10 index mul 9 index mul 10 index dup mul 2 index mul 5 index mul add 2 index div 12 index exch sub % x1 + dup 5 index mul 4 index add % y1 + 14 2 roll pop pop pop pop pop pop pop pop pop pop pop pop + } ifelse + } ifelse + ){#6}% + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + \pst@tempA \tx@UserCoor % x1,y1 + \pst@tempB \tx@UserCoor % x2,y2 + 3 index 2 index sub abs 1E-5 lt { % if the line AB is vertical + pop pop pop + 2 index dup mul 1 index 6 index sub dup mul sub % a^2-(x_1-x_o)^2 + dup 0 lt { + pop pop pop pop pop pop 0 0 + }{ + sqrt 2 index mul 3 index div % b/a sqrt(a^2-(x_1-x_o)^2) + 4 index add % y_o+ditto + 6 2 roll pop pop pop pop + } ifelse + } { + 0 index 3 index sub 2 index 5 index sub div % k + 2 index 4 index mul 2 index 6 index mul sub 3 index 6 index sub div % t + 7 index dup mul 2 index dup mul mul 7 index dup mul add % u + 2 index 11 index mul 10 index sub 2 index add % m + 1 index 1 index dup mul sub dup 0 lt { % w + pop pop pop pop pop pop pop pop pop pop pop pop pop 0 0 + } { + sqrt 10 index mul 9 index mul 10 index dup mul 2 index mul 5 index mul sub 2 index div 12 index add % x2 + dup 5 index mul 4 index add % y2 + 14 2 roll pop pop pop pop pop pop pop pop pop pop pop pop + } ifelse + } ifelse + ){#7}% + \Pst@ManageParamList{#6}% + \Pst@ManageParamList{#7}% + \endgroup% +}% +% +%% \pstEllipsePolarNode[Options](O)(a,b){A}{B}{T} +%% Draw the every tangent line through the point $A$ and $B$ on the Ellipse E and get the insection node T of the two tangent lines. We call T as the polar point of chord AB. +%% We use the intersection of two polar lines to get the tangent line. The proposition can be represented as: +%% Give chord AB on the ellipse, we draw any other two chords PQ and RS, AB and PQ intersect at I, AQ and BP intersect at X, AP and BQ intersect at Y, we call XY is the polar line of point I. Also AB and RS intersect at J, AR and BS intersect at M, AS and BR intersect at N, we call MN is the polar line of point J. Then the intersection T of XY and MN is the polar point of chord AB, i.e. TA is the tangent line through A and TB is the tangent line through B. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the ellipse center O +%% #3 -> [input] the horizontal and vertical radii +%% #4 -> [input] the node name A on the ellipse +%% #5 -> [input] the node name B on the ellipse +%% #6 -> [output] the polar point of chord AB +\def\pstEllipsePolarNode{\@ifnextchar[\Pst@EllipsePolarNode{\Pst@EllipsePolarNode[]}} +\def\Pst@EllipsePolarNode[#1](#2)(#3)#4#5#6{% + \begingroup + \psset{#1}% + \pstEllipseRotNode[PointName=none,PointSymbol=none,RotAngle=71](#2)(#3){@PSTELLIPSE@POLARAUX@P} + \pstEllipseRotNode[PointName=none,PointSymbol=none,RotAngle=-31](#2)(#3){@PSTELLIPSE@POLARAUX@Q} + \pstEllipseRotNode[PointName=none,PointSymbol=none,RotAngle=-122](#2)(#3){@PSTELLIPSE@POLARAUX@R} + \pstEllipseRotNode[PointName=none,PointSymbol=none,RotAngle=13](#2)(#3){@PSTELLIPSE@POLARAUX@S} + \pstInterLL[PointName=none,PointSymbol=none]{#4}{@PSTELLIPSE@POLARAUX@Q}{#5}{@PSTELLIPSE@POLARAUX@P}{@PSTELLIPSE@POLARAUX@X} + \pstInterLL[PointName=none,PointSymbol=none]{#4}{@PSTELLIPSE@POLARAUX@P}{#5}{@PSTELLIPSE@POLARAUX@Q}{@PSTELLIPSE@POLARAUX@Y} + \pstInterLL[PointName=none,PointSymbol=none]{#4}{@PSTELLIPSE@POLARAUX@R}{#5}{@PSTELLIPSE@POLARAUX@S}{@PSTELLIPSE@POLARAUX@M} + \pstInterLL[PointName=none,PointSymbol=none]{#4}{@PSTELLIPSE@POLARAUX@S}{#5}{@PSTELLIPSE@POLARAUX@R}{@PSTELLIPSE@POLARAUX@N} + \pstInterLL[PointName=none,PointSymbol=none]{@PSTELLIPSE@POLARAUX@X}{@PSTELLIPSE@POLARAUX@Y}{@PSTELLIPSE@POLARAUX@M}{@PSTELLIPSE@POLARAUX@N}{#6} + \Pst@geonodelabel{#6}% + \pstLineAB{#4}{#6} + \pstLineAB{#5}{#6} + \endgroup% +}% +% +%% \pstEllipseTangentNode[Options](O)(a,b){T}{A}{B} +%% Draw the two tangent lines through the point $T$ to the Ellipse E and get the node A and B on the Ellipse. +%% We use the following proposition to find the tangent node of T: +%% Give point T outside of the ellipse, we draw any other two chords TPQ and TRS, PS and QR intersect at I, PR and QS intersect at X, XI and Ellipse intersect at A and B, then TA is the tangent line through A and TB is the tangent line through B. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the ellipse center O +%% #3 -> [input] the horizontal and vertical radii +%% #4 -> [input] the node name T outside the ellipse +%% #5 -> [output] the node name A on the ellipse +%% #6 -> [output] the node name B on the ellipse +\def\pstEllipseTangentNode{\@ifnextchar[\Pst@EllipseTangentNode{\Pst@EllipseTangentNode[]}} +\def\Pst@EllipseTangentNode[#1](#2)(#3)#4#5#6{% + \begingroup + \@InitListMng % + \psset{#1}% + \pstEllipseRotNode[PointName=none,PointSymbol=none,RotAngle=71](#2)(#3){@PSTELLIPSE@TANGENTAUX@P0} + \pstEllipseRotNode[PointName=none,PointSymbol=none,RotAngle=31](#2)(#3){@PSTELLIPSE@TANGENTAUX@R0} + \pstEllipseLineInter[PointName=none,PointSymbol=none](#2)(#3){#4}{@PSTELLIPSE@TANGENTAUX@P0}{@PSTELLIPSE@TANGENTAUX@P}{@PSTELLIPSE@TANGENTAUX@Q} + \pstEllipseLineInter[PointName=none,PointSymbol=none](#2)(#3){#4}{@PSTELLIPSE@TANGENTAUX@R0}{@PSTELLIPSE@TANGENTAUX@R}{@PSTELLIPSE@TANGENTAUX@S} + \pstInterLL[PointName=none,PointSymbol=none]{@PSTELLIPSE@TANGENTAUX@P}{@PSTELLIPSE@TANGENTAUX@S}{@PSTELLIPSE@TANGENTAUX@Q}{@PSTELLIPSE@TANGENTAUX@R}{@PSTELLIPSE@TANGENTAUX@I} + \pstInterLL[PointName=none,PointSymbol=none]{@PSTELLIPSE@TANGENTAUX@P}{@PSTELLIPSE@TANGENTAUX@R}{@PSTELLIPSE@TANGENTAUX@Q}{@PSTELLIPSE@TANGENTAUX@S}{@PSTELLIPSE@TANGENTAUX@X} + \pstEllipseLineInter[PointName=none,PointSymbol=none](#2)(#3){@PSTELLIPSE@TANGENTAUX@X}{@PSTELLIPSE@TANGENTAUX@I}{#5}{#6} + \Pst@ManageParamList{#5}% + \Pst@ManageParamList{#6}% + \pstLineAB{#4}{#5} + \pstLineAB{#4}{#6} + \endgroup% +}% +% +% 2. General Ellipse with coordinate translation and rotation +%% ---------------------------------------------------------- +%% The General Ellipse E is defined by center O, the half of the major axis $max(abs(a),abs(b))$, +%% the half of the minor axis $min(abs(a),abs(b))$, and the rotation angle $\theta$ of the major axis. +%% +%% The equation can be got from the parametric function of the ellipse \ref{ParametricFunctionOfEllipse}, +%% using the rotation transform formula: +%% \begin{equation}\label{RotationTransformFormula} +%% \left\{\begin{array}{l} +%% x'=x\cos\theta-y\sin\theta\\ +%% y'=x\sin\theta+y\cos\theta +%% \end{array}\right. +%% \end{equation} +%% then we have +%% \begin{equation} +%% \left\{\begin{array}{l} +%% x'=(a\cos\alpha+x_o)\cos\theta-(b\sin\alpha+y_o)\sin\theta=a\cos\alpha\cos\theta-b\sin\alpha\sin\theta+x_o'\\ +%% y'=(a\cos\alpha+x_o)\sin\theta+(b\sin\alpha+y_o)\cos\theta=a\cos\alpha\sin\theta+b\sin\alpha\cos\theta+y_o' +%% \end{array}\right. +%% \end{equation} +%% where the $x_o'$ and $y_o'$ are the coordinate of the given center O after rotation. +%% So we get the parametric function of the general Ellipse with coordinate translation and rotation as following: +%% \begin{equation}\label{ParametricFunctionOfGeneralEllipse} +%% \left\{\begin{array}{l} +%% x=a\cos\alpha\cos\theta-b\sin\alpha\sin\theta+x_o\\ +%% y=a\cos\alpha\sin\theta+b\sin\alpha\cos\theta+y_o +%% \end{array}\right. +%% \end{equation} +% +%% \pstGeneralEllipse[Options](O)(a,b)[rotation][angleA][angleB] +%% Draw a General Ellipse with center O from angleA to angleB, going counter clockwise, +%% the half of the major axis $max(abs(a),abs(b))$, the half of the minor axis $min(abs(a),abs(b))$, +%% and the rotation angle $\theta$ of the major axis. +%% If you not input rotation angle, the default value is $0^\circ$, which is same as \pstEllipse. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the ellipse center O +%% #3 -> [input] the horizontal and vertical radii +%% #4 -> [input] the rotation angle $\theta$ of the major axis. +%% #5 -> [input] start angle from angleA to angleB, going counter clockwise. +%% #6 -> [input] start angle from angleA to angleB, going counter clockwise. +\def\pstGeneralEllipse{\@ifnextchar[\Pst@GeneralEllipse{\Pst@GeneralEllipse[]}} +\def\Pst@GeneralEllipse[#1](#2)(#3){% + \begingroup + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pst@getcoor{#3}\pst@tempR% + \@ifnextchar[\Pst@GeneralEllipse@i{\Pst@GeneralEllipse[0]}}% +\def\Pst@GeneralEllipse@i[#1]{% + \def\PST@GENERALELLIPSE@ROTATION{#1}% + \@ifnextchar[\Pst@GeneralEllipse@ii{\Pst@GeneralEllipse@ii[0][360]}}% +\def\Pst@GeneralEllipse@ii[#1][#2]{% + \parametricplot{#1}{#2}{% + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempR \tx@UserCoor % a,b + abs exch abs exch % |a|,|b| + \PST@GENERALELLIPSE@ROTATION\space dup cos exch sin % \cos\theta \sin\theta + 3 index 2 index mul % a\cos\theta + 3 index 2 index mul % b\sin\theta + 5 index 3 index mul % a\sin\theta + 5 index 5 index mul % b\cos\theta + 10 4 roll pop pop pop pop % a\cos\theta b\sin\theta a\sin\theta b\cos\theta x0 y0 + 5 index t cos mul % a\cos\theta\cos{t} + 5 index t sin mul sub 2 index add % a\cos\theta\cos{t}-b\sin\theta\sin{t}+x0 + 4 index t cos mul % a\sin\theta\cos{t} + 4 index t sin mul add 2 index add % a\sin\theta\cos{t}+b\cos\theta\sin{t}+y0 + 8 2 roll pop pop pop pop pop pop + } + \endgroup% +}% +% +%% \pstGeneralEllipseNode[Options](O)(a,b)[rotation]{t}{A} +%% Get the new node A whose parameter is the given value $t$ on the General Ellipse E. +%% If you not input rotation angle, the default value is $0^\circ$, which is same as \pstEllipse. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the ellipse center O +%% #3 -> [input] the horizontal and vertical radii +%% #4 -> [input] the rotation angle $\theta$ of the major axis. +%% #5 -> [input] the parameter value $t$. +%% #6 -> [output] the new node name on the ellipse +\def\pstGeneralEllipseNode{\@ifnextchar[\Pst@GeneralEllipseNode{\Pst@GeneralEllipseNode[]}} +\def\Pst@GeneralEllipseNode[#1](#2)(#3){% + \begingroup + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pst@getcoor{#3}\pst@tempR% + \@ifnextchar[\Pst@GeneralEllipseNode@i{\Pst@GeneralEllipseNode@i[0]}} +\def\Pst@GeneralEllipseNode@i[#1]#2#3{% + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + #1 dup cos exch sin % \cos\theta \sin\theta + #2 cos #2 sin % + 5 index 4 index mul 2 index mul % a\cos\theta\cos\alpha + 5 index 4 index mul 2 index mul % b\sin\theta\sin\alpha + sub 8 index add % a\cos\theta\cos\alpha - b\sin\theta\sin\alpha + x_o + 6 index 4 index mul 3 index mul % a\sin\theta\cos\alpha + 6 index 6 index mul 3 index mul % b\cos\theta\sin\alpha + add 8 index add % a\sin\theta\cos\alpha + b\cos\theta\sin\alpha + y_o + 10 2 roll pop pop pop pop pop pop pop pop + ){#3}% + \Pst@geonodelabel{#3}% + \endgroup% +}% +% +%% \pstGeneralEllipseRotNode[Options,RotAngle=<degree>](O)(a,b)[rotation]{A} +%% Get the new node A whose RotAngle is the given value on the General Ellipse E. +%% If you not input rotation angle, the default value is $0^\circ$, which is same as \pstEllipse. +%% If you not set RotAngle, the default value is $60^\circ$. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the ellipse center O +%% #3 -> [input] the horizontal and vertical radii +%% #4 -> [input] the rotation angle $\theta$ of the major axis. +%% #5 -> [output] the new node name on the ellipse +\def\pstGeneralEllipseRotNode{\@ifnextchar[\Pst@GeneralEllipseRotNode{\Pst@GeneralEllipseRotNode[]}} +\def\Pst@GeneralEllipseRotNode[#1](#2)(#3){% + \begingroup + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pst@getcoor{#3}\pst@tempR% + \@ifnextchar[\Pst@GeneralEllipseRotNode@i{\Pst@GeneralEllipseRotNode@i[0]}} +\def\Pst@GeneralEllipseRotNode@i[#1]#2{% + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + #1 dup cos exch sin % \cos\theta \sin\theta + \psk@RotAngle\space cos \psk@RotAngle\space sin % + 5 index 4 index mul 2 index mul % a\cos\theta\cos\alpha + 5 index 4 index mul 2 index mul % b\sin\theta\sin\alpha + sub 8 index add % a\cos\theta\cos\alpha - b\sin\theta\sin\alpha + x_o + 6 index 4 index mul 3 index mul % a\sin\theta\cos\alpha + 6 index 6 index mul 3 index mul % b\cos\theta\sin\alpha + add 8 index add % a\sin\theta\cos\alpha + b\cos\theta\sin\alpha + y_o + 10 2 roll pop pop pop pop pop pop pop pop + ){#2}% + \Pst@geonodelabel{#2}% + \endgroup% +}% +% +%% \pstGeneralEllipseAbsNode[Options](O)(a,b)[rotation]{x_1}{A}{B} +%% Create the node A and B whose abbscissa are the given value $x_1$ on the General Ellipse E. +%% If you not input rotation angle, the default value is $0^\circ$, which is same as \pstEllipse. +%% When x equals $x_1$, we have +%% $$y_{1,2}=gc_{1,2}+hs_{1,2}+y_o$$ +%% where, +%% $$c_1=\dfrac{de+f\sqrt{w}}{u}, s_1=\dfrac{-df+e\sqrt{w}}{u}$$ +%% $$c_2=\dfrac{de-f\sqrt{w}}{u}, s_2=\dfrac{-df-e\sqrt{w}}{u}$$ +%% $$e=a\cos\theta,f=b\sin\theta,g=a\sin\theta,h=b\cos\theta$$ +%% $$d=x_1-x_o,u=e^2+f^2,w=u-d^2$$ +%% Parameters: +%% #1 -> options +%% #2 -> [input] the ellipse center O +%% #3 -> [input] the horizontal and vertical radii +%% #4 -> [input] the rotation angle $\theta$ of the major axis. +%% #5 -> [input] the given abscissa value $x_1$. +%% #6 -> [output] the first intersection node $A$ +%% #7 -> [output] the second intersection node $B$ +\def\pstGeneralEllipseAbsNode{\@ifnextchar[\Pst@GeneralEllipseAbsNode{\Pst@GeneralEllipseAbsNode[]}} +\def\Pst@GeneralEllipseAbsNode[#1](#2)(#3){% + \begingroup + \@InitListMng % + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pst@getcoor{#3}\pst@tempR% + \@ifnextchar[\Pst@GeneralEllipseAbsNode@i{\Pst@GeneralEllipseAbsNode@i[0]}} +\def\Pst@GeneralEllipseAbsNode@i[#1]#2#3#4{% + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + #1 dup cos exch sin % \cos\theta \sin\theta + 3 index 2 index mul % e=a\cos\theta + 3 index 2 index mul % f=b\sin\theta + 5 index 3 index mul % g=a\sin\theta + 5 index 5 index mul % h=b\cos\theta + #2 9 index sub % d=x_1-x_o + 4 index dup mul 4 index dup mul add % u=e^2+f^2 + 0 index 2 index dup mul sub dup 0 lt { % w=u-d^2 + pop pop pop pop pop pop pop + pop pop pop pop pop pop + 0 0 + } { + sqrt % sqrt(w) + %% c_1=(de+f sqrt(w))/u, s_1=(-df+e sqrt(w))/u + 2 index 7 index mul 6 index 2 index mul add 2 index div % c1 + 3 index 7 index mul 8 index 3 index mul exch sub 3 index div % s1 + %% y_{1,2}=gc_{1,2}+hs_{1,2}+y_o + 6 index 2 index mul 6 index 2 index mul add 14 index add % y1 + #2 exch 17 2 roll pop pop pop pop pop + pop pop pop pop pop + pop pop pop pop pop + } ifelse + ){#3}% + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + #1 dup cos exch sin % \cos\theta \sin\theta + 3 index 2 index mul % e=a\cos\theta + 3 index 2 index mul % f=b\sin\theta + 5 index 3 index mul % g=a\sin\theta + 5 index 5 index mul % h=b\cos\theta + #2 9 index sub % d=x_1-x_o + 4 index dup mul 4 index dup mul add % u=e^2+f^2 + 0 index 2 index dup mul sub dup 0 lt { % w=u-d^2 + pop pop pop pop pop pop pop + pop pop pop pop pop pop + 0 0 + } { + sqrt % sqrt(w) + %% c_2=(de-f sqrt(w))/u, s_2=(-df-e sqrt(w))/u + 2 index 7 index mul 6 index 2 index mul sub 2 index div % c2 + 3 index 7 index mul 8 index 3 index mul add neg 3 index div % s2 + %% y_{1,2}=gc_{1,2}+hs_{1,2}+y_o + 6 index 2 index mul 6 index 2 index mul add 14 index add % y2 + #2 exch 17 2 roll pop pop pop pop pop + pop pop pop pop pop + pop pop pop pop pop + } ifelse + ){#4}% + \Pst@ManageParamList{#3}% + \Pst@ManageParamList{#4}% + \endgroup% +}% +% +%% \pstGeneralEllipseOrdNode[Options](O)(a,b)[rotation]{y_1}{A}{B} +%% Create the node A and B whose ordinates are the given value $y_1$ on the General Ellipse E. +%% If you not input rotation angle, the default value is $0^\circ$, which is same as \pstEllipse. +%% when y equals $y_1$, we have +%% x_{1,2}=ec_{1,2}-fs_{1,2}+x_o +%% where, +%% $$c_1=\dfrac{dg+h\sqrt{w}}{u}, s_1=\dfrac{dh-g\sqrt{w}}{u}$$ +%% $$c_2=\dfrac{dg-h\sqrt(w}}{u}, s_2=\dfrac{dh+g\sqrt{w}}{u}$$ +%% $$e=a\cos\theta,f=b\sin\theta,g=a\sin\theta,h=b\cos\theta$$ +%% $$d=y_1-y_o,u=h^2+g^2,w=u-d^2$$ +%% Parameters: +%% #1 -> options +%% #2 -> [input] the ellipse center O +%% #3 -> [input] the horizontal and vertical radii +%% #4 -> [input] the rotation angle $\theta$ of the major axis. +%% #5 -> [input] the given ordinate value $y_1$. +%% #6 -> [output] the first intersection node $A$ +%% #7 -> [output] the second intersection node $B$ +\def\pstGeneralEllipseOrdNode{\@ifnextchar[\Pst@GeneralEllipseOrdNode{\Pst@GeneralEllipseOrdNode[]}} +\def\Pst@GeneralEllipseOrdNode[#1](#2)(#3){% + \begingroup + \@InitListMng % + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pst@getcoor{#3}\pst@tempR% + \@ifnextchar[\Pst@GeneralEllipseOrdNode@i{\Pst@GeneralEllipseOrdNode@i[0]}} +\def\Pst@GeneralEllipseOrdNode@i[#1]#2#3#4{% + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + #1 dup cos exch sin % \cos\theta \sin\theta + 3 index 2 index mul % e=a\cos\theta + 3 index 2 index mul % f=b\sin\theta + 5 index 3 index mul % g=a\sin\theta + 5 index 5 index mul % h=b\cos\theta + #2 9 index sub % d=y_1-y_o + 2 index dup mul 2 index dup mul add % u=h^2+g^2 + 0 index 2 index dup mul sub dup 0 lt { % w=u-d^2 + pop pop pop pop pop pop pop + pop pop pop pop pop pop + 0 0 + } { + sqrt % sqrt(w) + %% c_1=(dg+h sqrt(w))/u, s_1=(dh-g sqrt(w))/u + 2 index 5 index mul 4 index 2 index mul add 2 index div % c1 + 3 index 5 index mul 6 index 3 index mul sub 3 index div % s1 + %% x_{1,2}=ec_{1,2}-fs_{1,2}+x_o + 8 index 2 index mul 8 index 2 index mul sub 15 index add % x1 + #2 17 2 roll pop pop pop pop pop + pop pop pop pop pop + pop pop pop pop pop + } ifelse + ){#3}% + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + #1 dup cos exch sin % \cos\theta \sin\theta + 3 index 2 index mul % e=a\cos\theta + 3 index 2 index mul % f=b\sin\theta + 5 index 3 index mul % g=a\sin\theta + 5 index 5 index mul % h=b\cos\theta + #2 9 index sub % d=y_1-y_o + 2 index dup mul 2 index dup mul add % u=h^2+g^2 + 0 index 2 index dup mul sub dup 0 lt { % w=u-d^2 + pop pop pop pop pop pop pop + pop pop pop pop pop pop + 0 0 + } { + sqrt % sqrt(w) + %% c_2=(dg-h sqrt(w))/u, s_2=(dh+g sqrt(w))/u + 2 index 5 index mul 4 index 2 index mul sub 2 index div % c2 + 3 index 5 index mul 6 index 3 index mul add 3 index div % s2 + %% x_{1,2}=ec_{1,2}-fs_{1,2}+x_o + 8 index 2 index mul 8 index 2 index mul sub 15 index add % x2 + #2 17 2 roll pop pop pop pop pop + pop pop pop pop pop + pop pop pop pop pop + } ifelse + ){#4}% + \Pst@ManageParamList{#3}% + \Pst@ManageParamList{#4}% + \endgroup% +}% +% +%% \pstGeneralEllipseFocusNode[Options](O)(a,b)[rotation]{$F_1$}{$F_2$} +%% Get the two focus $F_1$ and $F_2$ point of the General Ellipse E and create two new nodes. +%% If you not input rotation angle, the default value is $0^\circ$, which is same as \pstEllipse. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the ellipse center O +%% #3 -> [input] the horizontal and vertical radii +%% #4 -> [input] the rotation angle $\theta$ of the major axis. +%% #5 -> [output] the left/down node name +%% #6 -> [output] the right/up node name +\def\pstGeneralEllipseFocusNode{\@ifnextchar[\Pst@GeneralEllipseFocusNode{\Pst@GeneralEllipseFocusNode[]}} +\def\Pst@GeneralEllipseFocusNode[#1](#2)(#3){% + \begingroup + \@InitListMng % + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pst@getcoor{#3}\pst@tempR% + \@ifnextchar[\Pst@GeneralEllipseFocusNode@i{\Pst@GeneralEllipseFocusNode@i[0]}} +\def\Pst@GeneralEllipseFocusNode@i[#1]#2#3{% + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempR \tx@UserCoor % a,b + abs exch abs exch % |a|,|b| + 2 copy gt {% Focus on haxis + 1 index dup mul 1 index dup mul sub sqrt % c=sqrt(a^2-b^2) + 4 index 1 index #1 cos mul sub % x_o-c\cos\alpha + 4 index 2 index #1 sin mul sub % y_o-c\sin\alpha + }{% Focus on vaxis + 0 index dup mul 2 index dup mul sub sqrt % c=sqrt(b^2-a^2) + 4 index 1 index #1 sin mul add % x_o+c\sin\alpha + 4 index 2 index #1 cos mul sub % y_o-c\cos\alpha + } ifelse + 7 2 roll pop pop pop pop pop + ){#2}% + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempR \tx@UserCoor % a,b + abs exch abs exch % |a|,|b| + 2 copy gt {% Focus on haxis + 1 index dup mul 1 index dup mul sub sqrt % c=sqrt(a^2-b^2) + 4 index 1 index #1 cos mul add % x_o+c\cos\alpha + 4 index 2 index #1 sin mul add % y_o+c\sin\alpha + }{% Focus on vaxis + 0 index dup mul 2 index dup mul sub sqrt % c=sqrt(b^2-a^2) + 4 index 1 index #1 sin mul sub % x_o-c\sin\alpha + 4 index 2 index #1 cos mul add % y_o+c\cos\alpha + } ifelse + 7 2 roll pop pop pop pop pop + ){#3}% + \Pst@ManageParamList{#2}% + \Pst@ManageParamList{#3}% + \endgroup% +}% +% +%% \pstGeneralEllipseDirectrixLine[Options](O)(a,b)[rotation]{Lx}{Ly}{Rx}{Ry} +%% Get the two directrix line of the General Ellipse E and create two new nodes for each one. +%% If you not input rotation angle, the default value is $0^\circ$, which is same as \pstEllipse. +%% the nodes Lx Ly Rx Ry lie on the tangent line of the vertex on the other axis, +%% they can be got after the orig nodes rotation $\theta$ about the center $O$, we have +%% \begin{equation}\label{ExtensionRotationTransformFormula} +%% \left\{\begin{array}{l} +%% x=x_o+(x-x_o)\cos\theta-(y-y_o)\sin\theta\\ +%% y=y_o+(x-x_o)\sin\theta+(y-y_o)\cos\theta +%% \end{array}\right. +%% \end{equation} +%% Parameters: +%% #1 -> options +%% #2 -> [input] the ellipse center O +%% #3 -> [input] the horizontal and vertical radii +%% #4 -> [input] the rotation angle $\theta$ of the major axis. +%% #5 -> [output] the A node name on the left/down directrix line +%% #6 -> [output] the B node name on the left/down directrix line +%% #7 -> [output] the A node name on the right/up directrix line +%% #8 -> [output] the B node name on the right/up directrix line +\def\pstGeneralEllipseDirectrixLine{\@ifnextchar[\Pst@GeneralEllipseDirectrixLine{\Pst@GeneralEllipseDirectrixLine[]}} +\def\Pst@GeneralEllipseDirectrixLine[#1](#2)(#3){% + \begingroup + \@InitListMng % + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pst@getcoor{#3}\pst@tempR% + \@ifnextchar[\Pst@GeneralEllipseDirectrixLine@i{\Pst@GeneralEllipseDirectrixLine@i[0]}} +\def\Pst@GeneralEllipseDirectrixLine@i[#1]#2#3#4#5{% + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempR \tx@UserCoor % a,b + abs exch abs exch % |a|,|b| + 2 copy gt {% Focus on haxis + 1 index dup mul 1 index dup mul sub sqrt % c=sqrt(a^2-b^2) + 4 index 3 index dup mul 2 index div sub % x0-a^2/c + 4 index 3 index sub + 7 2 roll pop pop pop % (x0-a^2/c,y0-b) + }{% Focus on vaxis + 0 index dup mul 2 index dup mul sub sqrt % c=sqrt(b^2-a^2) + 4 index 3 index sub % x0-a + 4 index 3 index dup mul 3 index div sub + 7 2 roll pop pop pop % (x0-a,y0-b^2/c) + } ifelse + #1 cos #1 sin % x y x0 y0 \cos\theta \sin\theta + 3 index 6 index 5 index sub 3 index mul add 5 index 4 index sub 2 index mul sub % x0+(x-x0)\cos\theta-(y-y0)\sin\theta + 3 index 7 index 6 index sub 3 index mul add 6 index 5 index sub 4 index mul add % y0+(x-x0)\sin\theta+(y-y0)\cos\theta + 8 2 roll pop pop pop pop pop pop + ){#2}% + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempR \tx@UserCoor % a,b + abs exch abs exch % |a|,|b| + 2 copy gt {% Focus on haxis + 1 index dup mul 1 index dup mul sub sqrt % c=sqrt(a^2-b^2) + 4 index 3 index dup mul 2 index div sub % x0-a^2/c + 4 index 3 index add + 7 2 roll pop pop pop % (x0-a^2/c,y0+b) + }{% Focus on vaxis + 0 index dup mul 2 index dup mul sub sqrt % c=sqrt(b^2-a^2) + 4 index 3 index add % x0+a + 4 index 3 index dup mul 3 index div sub + 7 2 roll pop pop pop % (x0+a,y0-b^2/c) + } ifelse + #1 cos #1 sin % x y x0 y0 \cos\theta \sin\theta + 3 index 6 index 5 index sub 3 index mul add 5 index 4 index sub 2 index mul sub % x0+(x-x0)\cos\theta-(y-y0)\sin\theta + 3 index 7 index 6 index sub 3 index mul add 6 index 5 index sub 4 index mul add % y0+(x-x0)\sin\theta+(y-y0)\cos\theta + 8 2 roll pop pop pop pop pop pop + ){#3}% + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempR \tx@UserCoor % a,b + abs exch abs exch % |a|,|b| + 2 copy gt {% Focus on haxis + 1 index dup mul 1 index dup mul sub sqrt % c=sqrt(a^2-b^2) + 4 index 3 index dup mul 2 index div add % x0+a^2/c + 4 index 3 index sub + 7 2 roll pop pop pop % (x0+a^2/c,y0-b) + }{% Focus on vaxis + 0 index dup mul 2 index dup mul sub sqrt % c=sqrt(b^2-a^2) + 4 index 3 index sub % x0-a + 4 index 3 index dup mul 3 index div add + 7 2 roll pop pop pop % (x0-a,y0+b^2/c) + } ifelse + #1 cos #1 sin % x y x0 y0 \cos\theta \sin\theta + 3 index 6 index 5 index sub 3 index mul add 5 index 4 index sub 2 index mul sub % x0+(x-x0)\cos\theta-(y-y0)\sin\theta + 3 index 7 index 6 index sub 3 index mul add 6 index 5 index sub 4 index mul add % y0+(x-x0)\sin\theta+(y-y0)\cos\theta + 8 2 roll pop pop pop pop pop pop + ){#4}% + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempR \tx@UserCoor % a,b + abs exch abs exch % |a|,|b| + 2 copy gt {% Focus on haxis + 1 index dup mul 1 index dup mul sub sqrt % c=sqrt(a^2-b^2) + 4 index 3 index dup mul 2 index div add % x0+a^2/c + 4 index 3 index add + 7 2 roll pop pop pop % (x0+a^2/c,y0+b) + }{% Focus on vaxis + 0 index dup mul 2 index dup mul sub sqrt % c=sqrt(b^2-a^2) + 4 index 3 index add % x0+a + 4 index 3 index dup mul 3 index div add + 7 2 roll pop pop pop % (x0+a,y0+b^2/c) + } ifelse + #1 cos #1 sin % x y x0 y0 \cos\theta \sin\theta + 3 index 6 index 5 index sub 3 index mul add 5 index 4 index sub 2 index mul sub % x0+(x-x0)\cos\theta-(y-y0)\sin\theta + 3 index 7 index 6 index sub 3 index mul add 6 index 5 index sub 4 index mul add % y0+(x-x0)\sin\theta+(y-y0)\cos\theta + 8 2 roll pop pop pop pop pop pop + ){#5}% + \Pst@ManageParamList{#2}% + \Pst@ManageParamList{#3}% + \Pst@ManageParamList{#4}% + \Pst@ManageParamList{#5}% + \pstLineAB{#2}{#3} + \pstLineAB{#4}{#5} + \endgroup% +}% +% +%% \pstGeneralEllipseLineInter[Options](O)(a,b)[rotation]{A}{B}{C}{D} +%% Get the two intersection $C$ and $D$ of the General Ellipse E and the given line AB. +%% If you not input rotation angle, the default value is $0^\circ$, which is same as \pstEllipse. +%% We can represent the line AB as the following function when line AB is not vertical: +%% $$y=kx+t$$ where $$k=\dfrac{y_2-y_1}{x_2-x_1},t=\dfrac{x_2y_1-x_1y_2}{x_2-x_1}$$ +%% The intersections are: +%% $$x_{1,2}=ec_{1,2}-fs_{1,2}+x_o,y_{1,2}=kx_{1,2}+t$$ +%% where, +%% $$e=a\cos\theta,f=b\sin\theta,g=a\sin\theta,h=b\cos\theta$$ +%% $$c_1=\dfrac{mA+B\sqrt{w}}{A^2+B^2}$$ +%% $$s_1=\dfrac{mB-A\sqrt{w}}{A^2+B^2}$$ +%% $$c_2=\dfrac{mA-B\sqrt{w}}{A^2+B^2}$$ +%% $$s_2=\dfrac{mB+A\sqrt{w}}{A^2+B^2}$$ +%% $$w=A^2+B^2-m^2, m=kx_o-y_o+t, A=g-ke, B=h+kf$$ +%% Parameters: +%% #1 -> options +%% #2 -> [input] the ellipse center O +%% #3 -> [input] the horizontal and vertical radii +%% #4 -> [input] the rotation angle $\theta$ of the major axis. +%% #5 -> [input] the node name A on the given line +%% #6 -> [input] the node name B on the given line +%% #7 -> [output] the first intersection node name +%% #8 -> [output] the second intersection node name +\def\pstGeneralEllipseLineInter{\@ifnextchar[\Pst@GeneralEllipseLineInter{\Pst@GeneralEllipseLineInter[]}} +\def\Pst@GeneralEllipseLineInter[#1](#2)(#3){% + \begingroup + \@InitListMng % + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pst@getcoor{#3}\pst@tempR% + \@ifnextchar[\Pst@GeneralEllipseLineInter@i{\Pst@GeneralEllipseLineInter@i[0]}} +\def\Pst@GeneralEllipseLineInter@i[#1]#2#3#4#5{% + \pst@getcoor{#2}\pst@tempA% + \pst@getcoor{#3}\pst@tempB% + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + \pst@tempA \tx@UserCoor % x1,y1 + \pst@tempB \tx@UserCoor % x2,y2 + 3 index 2 index sub abs 1E-5 lt { % if the line AB is vertical + pop pop pop pop + #1 dup cos exch sin % \cos\theta \sin\theta + 3 index 2 index mul % e=a\cos\theta + 3 index 2 index mul % f=b\sin\theta + 5 index 3 index mul % g=a\sin\theta + 5 index 5 index mul % h=b\cos\theta + \pst@tempA \tx@UserCoor pop % x1 + 9 index sub % d=x_1-x_o + 4 index dup mul 4 index dup mul add % u=e^2+f^2 + 0 index 2 index dup mul sub dup 0 lt { % w=u-d^2 + pop pop pop pop pop pop pop + pop pop pop pop pop pop + 0 0 + } { + sqrt % sqrt(w) + %% c_1=(de+f sqrt(w))/u, s_1=(-df+e sqrt(w))/u + 2 index 7 index mul 6 index 2 index mul add 2 index div % c1 + 3 index 7 index mul 8 index 3 index mul exch sub 3 index div % s1 + %% y_{1,2}=gc_{1,2}+hs_{1,2}+y_o + 6 index 2 index mul 6 index 2 index mul add 14 index add % y1 + \pst@tempA \tx@UserCoor pop % x1 + exch 17 2 roll pop pop pop pop pop + pop pop pop pop pop + pop pop pop pop pop + } ifelse + }{ + 0 index 3 index sub 2 index 5 index sub div % k + 2 index 4 index mul 2 index 6 index mul sub 3 index 6 index sub div % t + #1 dup cos exch sin % \cos\theta \sin\theta + 9 index 2 index mul % e=a\cos\theta + 9 index 2 index mul % f=b\sin\theta + 11 index 3 index mul % g=a\sin\theta + 11 index 5 index mul % h=b\cos\theta + 1 index 8 index 5 index mul sub % A=g-ke + 1 index 9 index 5 index mul add % B=h+kf + 1 index dup mul 1 index dup mul add % C=A^2+B^2 + 10 index 19 index mul 18 index sub 10 index add % m=kx_o-y_o+t + 1 index 1 index dup mul sub dup 0 lt { % w=C-m^2 + pop pop pop pop pop pop pop + pop pop pop pop pop pop pop + pop pop pop pop pop pop pop + 0 0 + } { + sqrt % sqrt(w) + 1 index 5 index mul 4 index 2 index mul add 3 index div % c1 + 2 index 5 index mul 6 index 3 index mul sub 4 index div % s1 + %% x_{1,2}=ec_{1,2}-fs_{1,2}+x_o,y_{1,2}=kx_{1,2}+t + 10 index 2 index mul 10 index 2 index mul sub 23 index add % x1 + dup 16 index mul 15 index add % y1 + 25 2 roll pop pop + pop pop pop pop pop pop pop + pop pop pop pop pop pop pop + pop pop pop pop pop pop pop + } ifelse + } ifelse + ){#4}% + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + \pst@tempA \tx@UserCoor % x1,y1 + \pst@tempB \tx@UserCoor % x2,y2 + 3 index 2 index sub abs 1E-5 lt { % if the line AB is vertical + pop pop pop pop + #1 dup cos exch sin % \cos\theta \sin\theta + 3 index 2 index mul % e=a\cos\theta + 3 index 2 index mul % f=b\sin\theta + 5 index 3 index mul % g=a\sin\theta + 5 index 5 index mul % h=b\cos\theta + \pst@tempA \tx@UserCoor pop % x1 + 9 index sub % d=x_1-x_o + 4 index dup mul 4 index dup mul add % u=e^2+f^2 + 0 index 2 index dup mul sub dup 0 lt { % w=u-d^2 + pop pop pop pop pop pop pop + pop pop pop pop pop pop + 0 0 + } { + sqrt % sqrt(w) + %% c_2=(de-f sqrt(w))/u, s_2=(-df-e sqrt(w))/u + 2 index 7 index mul 6 index 2 index mul sub 2 index div % c2 + 3 index 7 index mul 8 index 3 index mul add neg 3 index div % s2 + %% y_{1,2}=gc_{1,2}+hs_{1,2}+y_o + 6 index 2 index mul 6 index 2 index mul add 14 index add % y2 + \pst@tempA \tx@UserCoor pop % x1 + exch 17 2 roll pop pop pop pop pop + pop pop pop pop pop + pop pop pop pop pop + } ifelse + }{ + 0 index 3 index sub 2 index 5 index sub div % k + 2 index 4 index mul 2 index 6 index mul sub 3 index 6 index sub div % t + #1 dup cos exch sin % \cos\theta \sin\theta + 9 index 2 index mul % e=a\cos\theta + 9 index 2 index mul % f=b\sin\theta + 11 index 3 index mul % g=a\sin\theta + 11 index 5 index mul % h=b\cos\theta + 1 index 8 index 5 index mul sub % A=g-ke + 1 index 9 index 5 index mul add % B=h+kf + 1 index dup mul 1 index dup mul add % C=A^2+B^2 + 10 index 19 index mul 18 index sub 10 index add % m=kx_o-y_o+t + 1 index 1 index dup mul sub dup 0 lt { % w=C-m^2 + pop pop pop pop pop pop pop + pop pop pop pop pop pop pop + pop pop pop pop pop pop pop + 0 0 + } { + sqrt % sqrt(w) + 1 index 5 index mul 4 index 2 index mul sub 3 index div % c2 + 2 index 5 index mul 6 index 3 index mul add 4 index div % s2 + %% x_{1,2}=ec_{1,2}-fs_{1,2}+x_o,y_{1,2}=kx_{1,2}+t + 10 index 2 index mul 10 index 2 index mul sub 23 index add % x2 + dup 16 index mul 15 index add % y2 + 25 2 roll pop pop + pop pop pop pop pop pop pop + pop pop pop pop pop pop pop + pop pop pop pop pop pop pop + } ifelse + } ifelse + ){#5}% + \Pst@ManageParamList{#4}% + \Pst@ManageParamList{#5}% + \endgroup% +}% +% +%% \pstGeneralEllipsePolarNode[Options](O)(a,b)[rotation]{A}{B}{T} +%% Draw the every tangent line through the point $A$ and $B$ on the General Ellipse E and get the insection node T of the two tangent lines. +%% If you not input rotation angle, the default value is $0^\circ$, which is same as \pstEllipse. +%% We call T as the polar point of chord AB, which can be got by the following proposition: +%% Give chord AB on the ellipse, we draw any other two chords PQ and RS, AB and PQ intersect at I, AQ and BP intersect at X, AP and BQ intersect at Y, we call XY is the polar line of point I. Also AB and RS intersect at J, AR and BS intersect at M, AS and BR intersect at N, we call MN is the polar line of point J. Then the intersection T of XY and MN is the polar point of chord AB, i.e. TA is the tangent line through A and TB is the tangent line through B. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the ellipse center O +%% #3 -> [input] the horizontal and vertical radii +%% #4 -> [input] the rotation angle $\theta$ of the major axis. +%% #5 -> [input] the node name A on the ellipse +%% #6 -> [input] the node name B on the ellipse +%% #7 -> [output] the polar point of chord AB +\def\pstGeneralEllipsePolarNode{\@ifnextchar[\Pst@GeneralEllipsePolarNode{\Pst@GeneralEllipsePolarNode[]}} +\def\Pst@GeneralEllipsePolarNode[#1](#2)(#3){% + \begingroup + \psset{#1}% + \def\PST@GENERALELLIPSE@CENTER{#2}% + \def\PST@GENERALELLIPSE@RADIUS{#3}% + \@ifnextchar[\Pst@GeneralEllipsePolarNode@i{\Pst@GeneralEllipsePolarNode@i[0]}} +\def\Pst@GeneralEllipsePolarNode@i[#1]#2#3#4{% + \pstGeneralEllipseRotNode[PointName=none,PointSymbol=none,RotAngle=71](\PST@GENERALELLIPSE@CENTER)(\PST@GENERALELLIPSE@RADIUS)[#1]{@PST@GENERALELLIPSE@POLARAUX@P} + \pstGeneralEllipseRotNode[PointName=none,PointSymbol=none,RotAngle=-31](\PST@GENERALELLIPSE@CENTER)(\PST@GENERALELLIPSE@RADIUS)[#1]{@PST@GENERALELLIPSE@POLARAUX@Q} + \pstGeneralEllipseRotNode[PointName=none,PointSymbol=none,RotAngle=-122](\PST@GENERALELLIPSE@CENTER)(\PST@GENERALELLIPSE@RADIUS)[#1]{@PST@GENERALELLIPSE@POLARAUX@R} + \pstGeneralEllipseRotNode[PointName=none,PointSymbol=none,RotAngle=13](\PST@GENERALELLIPSE@CENTER)(\PST@GENERALELLIPSE@RADIUS)[#1]{@PST@GENERALELLIPSE@POLARAUX@S} + \pstInterLL[PointName=none,PointSymbol=none]{#2}{@PST@GENERALELLIPSE@POLARAUX@Q}{#3}{@PST@GENERALELLIPSE@POLARAUX@P}{@PST@GENERALELLIPSE@POLARAUX@X} + \pstInterLL[PointName=none,PointSymbol=none]{#2}{@PST@GENERALELLIPSE@POLARAUX@P}{#3}{@PST@GENERALELLIPSE@POLARAUX@Q}{@PST@GENERALELLIPSE@POLARAUX@Y} + \pstInterLL[PointName=none,PointSymbol=none]{#2}{@PST@GENERALELLIPSE@POLARAUX@R}{#3}{@PST@GENERALELLIPSE@POLARAUX@S}{@PST@GENERALELLIPSE@POLARAUX@M} + \pstInterLL[PointName=none,PointSymbol=none]{#2}{@PST@GENERALELLIPSE@POLARAUX@S}{#3}{@PST@GENERALELLIPSE@POLARAUX@R}{@PST@GENERALELLIPSE@POLARAUX@N} + \pstInterLL[PointName=none,PointSymbol=none]{@PST@GENERALELLIPSE@POLARAUX@X}{@PST@GENERALELLIPSE@POLARAUX@Y}{@PST@GENERALELLIPSE@POLARAUX@M}{@PST@GENERALELLIPSE@POLARAUX@N}{#4} + \Pst@geonodelabel{#4}% + \pstLineAB{#2}{#4} + \pstLineAB{#3}{#4} + \endgroup% +}% +% +%% \pstGeneralEllipseTangentNode[Options](O)(a,b)[rotation]{T}{A}{B} +%% Draw the two tangent lines through the point $T$ to the General Ellipse E and get the node A and B on the Ellipse. +%% If you not input rotation angle, the default value is $0^\circ$, which is same as \pstEllipse. +%% We use the following proposition to find the tangent node of T: +%% Give point T outside of the ellipse, we draw any other two chords TPQ and TRS, PS and QR intersect at I, PR and QS intersect at X, XI and Ellipse intersect at A and B, then TA is the tangent line through A and TB is the tangent line through B. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the ellipse center O +%% #3 -> [input] the horizontal and vertical radii +%% #4 -> [input] the rotation angle $\theta$ of the major axis. +%% #5 -> [input] the node name T outside the ellipse +%% #6 -> [output] the node name A on the ellipse +%% #7 -> [output] the node name B on the ellipse +\def\pstGeneralEllipseTangentNode{\@ifnextchar[\Pst@GeneralEllipseTangentNode{\Pst@GeneralEllipseTangentNode[]}} +\def\Pst@GeneralEllipseTangentNode[#1](#2)(#3){% + \begingroup + \@InitListMng % + \psset{#1}% + \def\PST@GENERALELLIPSE@CENTER{#2}% + \def\PST@GENERALELLIPSE@RADIUS{#3}% + \@ifnextchar[\Pst@GeneralEllipseTangentNode@i{\Pst@GeneralEllipseTangentNode@i[0]}} +\def\Pst@GeneralEllipseTangentNode@i[#1]#2#3#4{% + \pstGeneralEllipseRotNode[PointName=none,PointSymbol=none,RotAngle=71](\PST@GENERALELLIPSE@CENTER)(\PST@GENERALELLIPSE@RADIUS)[#1]{@PST@GENERALELLIPSE@TANGENTAUX@P0} + \pstGeneralEllipseRotNode[PointName=none,PointSymbol=none,RotAngle=31](\PST@GENERALELLIPSE@CENTER)(\PST@GENERALELLIPSE@RADIUS)[#1]{@PST@GENERALELLIPSE@TANGENTAUX@R0} + \pstGeneralEllipseLineInter[PointName=none,PointSymbol=none](\PST@GENERALELLIPSE@CENTER)(\PST@GENERALELLIPSE@RADIUS)[#1]{#2}{@PST@GENERALELLIPSE@TANGENTAUX@P0}{@PST@GENERALELLIPSE@TANGENTAUX@P}{@PST@GENERALELLIPSE@TANGENTAUX@Q} + \pstGeneralEllipseLineInter[PointName=none,PointSymbol=none](\PST@GENERALELLIPSE@CENTER)(\PST@GENERALELLIPSE@RADIUS)[#1]{#2}{@PST@GENERALELLIPSE@TANGENTAUX@R0}{@PST@GENERALELLIPSE@TANGENTAUX@R}{@PST@GENERALELLIPSE@TANGENTAUX@S} + \pstInterLL[PointName=none,PointSymbol=none]{@PST@GENERALELLIPSE@TANGENTAUX@P}{@PST@GENERALELLIPSE@TANGENTAUX@S}{@PST@GENERALELLIPSE@TANGENTAUX@Q}{@PST@GENERALELLIPSE@TANGENTAUX@R}{@PST@GENERALELLIPSE@TANGENTAUX@I} + \pstInterLL[PointName=none,PointSymbol=none]{@PST@GENERALELLIPSE@TANGENTAUX@P}{@PST@GENERALELLIPSE@TANGENTAUX@R}{@PST@GENERALELLIPSE@TANGENTAUX@Q}{@PST@GENERALELLIPSE@TANGENTAUX@S}{@PST@GENERALELLIPSE@TANGENTAUX@X} + \pstGeneralEllipseLineInter[PointName=none,PointSymbol=none](\PST@GENERALELLIPSE@CENTER)(\PST@GENERALELLIPSE@RADIUS)[#1]{@PST@GENERALELLIPSE@TANGENTAUX@X}{@PST@GENERALELLIPSE@TANGENTAUX@I}{#3}{#4} + \Pst@ManageParamList{#3}% + \Pst@ManageParamList{#4}% + \pstLineAB{#2}{#3} + \pstLineAB{#2}{#4} + \endgroup% +}% +% +% 3. Standard Parabola with coordinate translation +%% ---------------------------------------------------------- +%% The Parabola P is defined by vertex O, the half of the focus chord axis $abs(p)$, the sign of $p$ indicates the direction of the parabola. +%% The equation can be written as: +%% \begin{equation}\label{FunctionOfStandardParabola} +%% (x-x0)^2=2p(y-y0) +%% \end{equation} +%% and the parametric function can be written as: +%% \begin{equation}\label{ParametricFunctionOfStandardParabola} +%% \left\{\begin{array}{l} +%% x=t+x_o\\ +%% y=\dfrac{t^2}{2p}+y_o +%% \end{array}\right. +%% \end{equation} +% +%% \pstParabola[Options](O){p}{x0}{x1} +%% Draw a Parabola from x0 to x1 with Vertex O, the half of the focus chord axis $abs(p)$, the sign of $p$ indicates the direction of the parabola. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the parabola vertex O +%% #3 -> [input] the half of focal chord $p$ +%% #4 -> [input] the start of independent variable $x$ +%% #5 -> [input] the end of independent variable $x$ +\def\pstParabola{\@ifnextchar[\Pst@Parabola{\Pst@Parabola[]}} +\def\Pst@Parabola[#1](#2)#3#4#5{% + \begingroup + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \parametricplot{#4}{#5}{% + \pst@tempO \tx@UserCoor % x0,y0 + #3 % p + 2 index t add % t+x0 + 2 index t dup mul 3 index 2 mul div add % t^2/(2p)+y0 + 5 2 roll pop pop pop % t+x0,t^2/(2p)+y0 + } + \endgroup% +}% +% +%% \pstParabolaNode[Options](O){p}{$t$}{A} +%% Draw the node whose parameter is the given value $t$ on the Parabola P. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the parabola vertex O +%% #3 -> [input] the half of focal chord $p$ +%% #4 -> [input] the given parameter value $t$ +%% #5 -> [output] the node $A$ on the parabola +\def\pstParabolaNode{\@ifnextchar[\Pst@ParabolaNode{\Pst@ParabolaNode[]}} +\def\Pst@ParabolaNode[#1](#2)#3#4#5{% + \begingroup + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + #3 % p + 2 index #4 add % t+x0 + 2 index #4 dup mul 3 index 2 mul div add % t^2/(2p)+y0 + 5 2 roll pop pop pop % t+x0,t^2/(2p)+y0 + ){#5} + \Pst@geonodelabel{#5}% + \endgroup% +}% +% +%% \pstParabolaAbsNode[Options](O){p}{$x_1$}{A} +%% Draw the node whose abscissa is the given value $x_1$ on the Parabola P. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the parabola vertex O +%% #3 -> [input] the half of focal chord $p$ +%% #4 -> [input] the given abscissa value $x_1$ +%% #5 -> [output] the node $A$ on the parabola +\def\pstParabolaAbsNode{\@ifnextchar[\Pst@ParabolaAbsNode{\Pst@ParabolaAbsNode[]}} +\def\Pst@ParabolaAbsNode[#1](#2)#3#4#5{% + \begingroup + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + #3 #4 % p x_1 + 2 index 1 index 5 index sub dup mul 3 index 2 mul div add % y0+(x_1-x_0)^2/(2p) + 5 2 roll pop pop pop + ){#5} + \Pst@geonodelabel{#5}% + \endgroup% +}% +% +%% \pstParabolaOrdNode[Options](O){p}{$y_1$}{A}{B} +%% Draw the nodes whose ordinate is the given value $y_1$ on the Parabola P. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the parabola vertex O +%% #3 -> [input] the half of focal chord $p$ +%% #4 -> [input] the given abscissa value $x_1$ +%% #5 -> [output] the first node $A$ on the parabola +%% #6 -> [output] the second node $B$ on the parabola +\def\pstParabolaOrdNode{\@ifnextchar[\Pst@ParabolaOrdNode{\Pst@ParabolaOrdNode[]}} +\def\Pst@ParabolaOrdNode[#1](#2)#3#4#5#6{% + \begingroup + \@InitListMng % + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + #3 #4 % p y_1 + 2 index sub mul 2 mul dup 0 lt { + pop pop pop 0 0 + }{ + sqrt 2 index exch sub + #4 4 2 roll pop pop + } ifelse + ){#5} + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + #3 #4 % p y_1 + 2 index sub mul 2 mul dup 0 lt { + pop pop pop 0 0 + }{ + sqrt 2 index add + #4 4 2 roll pop pop + } ifelse + ){#6} + \Pst@ManageParamList{#5}% + \Pst@ManageParamList{#6}% + \endgroup% +}% +% +%% \pstParabolaFocusNode[Options](O){p}{F} +%% Draw the focus node of a Parabola P. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the parabola vertex O +%% #3 -> [input] the half of focal chord $p$ +%% #4 -> [output] the focus node $F$ +\def\pstParabolaFocusNode{\@ifnextchar[\Pst@ParabolaFocusNode{\Pst@ParabolaFocusNode[]}} +\def\Pst@ParabolaFocusNode[#1](#2)#3#4{% + \begingroup + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + #3 %p + 2 index % x0 + 2 index 2 index 2 div add % y0+p/2 + 5 2 roll pop pop pop + ){#4} + \Pst@geonodelabel{#4}% + \endgroup% +}% +% +%% \pstParabolaDirectrixLine[Options](O){p}{LA}{LB} +%% Draw the directrix line of a Parabola P. +%% The node LA also lies on the symmetrical axis line, and node LB is another one on the directrix line. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the parabola vertex O +%% #3 -> [input] the half of focal chord $p$ +%% #4 -> [output] the first node $A$ on the directrix line +%% #5 -> [output] the second node $B$ on the directrix line +\def\pstParabolaDirectrixLine{\@ifnextchar[\Pst@ParabolaDirectrixLine{\Pst@ParabolaDirectrixLine[]}} +\def\Pst@ParabolaDirectrixLine[#1](#2)#3#4#5{% + \begingroup + \@InitListMng % + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + #3 %p + 2 index % x0 + 2 index 2 index 2 div sub % y0-p/2 + 5 2 roll pop pop pop + ){#4} + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + #3 %p + 2 index 1 add % x0+1 + 2 index 2 index 2 div sub % y0-p/2 + 5 2 roll pop pop pop + ){#5} + \Pst@ManageParamList{#4}% + \Pst@ManageParamList{#5}% + \pstLineAB{#4}{#5} + \endgroup% +}% +% +%% \pstParabolaLineInter[Options](O){p}{A}{B}{C}{D} +%% Find the intersections C and D of line AB and the Parabola P. +%% We can represent the line AB as the following function when line AB is not vertical: +%% $$y=kx+t$$ where $$k=\dfrac{y_2-y_1}{x_2-x_1},t=\dfrac{x_2y_1-x_1y_2}{x_2-x_1}$$ +%% The intersections are: +%% $$x_{1,2}=e\pm\sqrt{w}+x_o, y_{1,2}=kx_{1,2}+t$$ +%% where, +%% $$e=pk, w=e^2+2f, f=pm, m=kx_o-y_o+t$$ +%% Parameters: +%% #1 -> options +%% #2 -> [input] the parabola vertex O +%% #3 -> [input] the half of focal chord $p$ +%% #4 -> [input] the node $A$ on the given line +%% #5 -> [input] the node $B$ on the given line +%% #6 -> [output] the first intersection node $C$ +%% #7 -> [output] the second intersection node $D$ +\def\pstParabolaLineInter{\@ifnextchar[\Pst@ParabolaLineInter{\Pst@ParabolaLineInter[]}} +\def\Pst@ParabolaLineInter[#1](#2)#3#4#5#6#7{% + \begingroup + \@InitListMng % + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pst@getcoor{#4}\pst@tempA% + \pst@getcoor{#5}\pst@tempB% + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempA \tx@UserCoor % x1,y1 + \pst@tempB \tx@UserCoor % x2,y2 + 3 index 2 index sub abs 1E-5 lt { % if the line AB is vertical + 3 index 6 index sub dup mul #3 2 mul div 5 index add % y=(x1-x0)^2/(2p)+y0 + 2 index exch 8 2 roll pop pop pop pop pop pop + } { + 0 index 3 index sub 2 index 5 index sub div % k + 2 index 4 index mul 2 index 6 index mul sub 3 index 6 index sub div % t + #3 %p + 2 index 1 index mul % e=pk + 3 index 10 index mul 9 index sub 3 index add % m=kx_o-y_o+t + 2 index 1 index mul % f=pm + 2 index dup mul 1 index 2 mul add % w=e^2+2f + dup 0 lt { + pop pop pop pop pop pop pop + pop pop pop pop pop pop 0 0 + } { + sqrt % sqrt(w) + %% x_{1,2}=e \pm sqrt(w)+x_o,y_{1,2}=kx_{1,2}+t + 3 index 1 index sub 13 index add % x1 + 7 index 1 index mul 7 index add % y1 + 15 2 roll + pop pop pop pop pop pop pop + pop pop pop pop pop pop + } ifelse + } ifelse + ){#6} + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempA \tx@UserCoor % x1,y1 + \pst@tempB \tx@UserCoor % x2,y2 + 3 index 2 index sub abs 1E-5 lt { % if the line AB is vertical + pop pop pop pop pop pop 0 0 + } { + 0 index 3 index sub 2 index 5 index sub div % k + 2 index 4 index mul 2 index 6 index mul sub 3 index 6 index sub div % t + #3 %p + 2 index 1 index mul % e=pk + 3 index 10 index mul 9 index sub 3 index add % m=kx_o-y_o+t + 2 index 1 index mul % f=pm + 2 index dup mul 1 index 2 mul add % w=e^2+2f + dup 0 lt { + pop pop pop pop pop pop pop + pop pop pop pop pop pop 0 0 + } { + sqrt % sqrt(w) + %% x_{1,2}=e \pm sqrt(w)+x_o,y_{1,2}=kx_{1,2}+t + 3 index 1 index add 13 index add % x2 + 7 index 1 index mul 7 index add % y2 + 15 2 roll + pop pop pop pop pop pop pop + pop pop pop pop pop pop + } ifelse + } ifelse + ){#7} + \Pst@ManageParamList{#6}% + \Pst@ManageParamList{#7}% + \endgroup% +}% +% +%% \pstParabolaPolarNode[Options](O){p}(F)[L1][L2]{A}{B}{T} +%% Find the polar point of chord AB on Parabola P. +%% We use the following proposition to find the polar point of chord AB: +%% Give any chord AB, drawing two focal chord AFC and BFD, where F is the focus, then drawing FX which is perpendicular to AFC at point F, and intersect with the directrix line at X; also drawing FY which is perpendicular to BFD at point F, and intersect with the directrix line at Y. Then the intersection T of AX and BY is the polar point of chord AB. +%% If you don't know the focus F, or the directrix line, we will find them automated, otherwise you can pass them to this macro. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the parabola vertex O +%% #3 -> [input] the half of focal chord $p$ +%% #4 -> [input] optional, the focus node/coordinate F of the parabola. +%% #5 -> [input] optional, the node/coordinate L1 on the directrix line of the parabola. +%% #6 -> [input] optional, the node/coordinate L2 on the directrix line of the parabola. +%% #7 -> [input] the node A on the parabola. +%% #8 -> [input] the node B on the parabola. +%% #9 -> [output] the polar node T of chord AB. +\def\pstParabolaPolarNode{\@ifnextchar[\Pst@ParabolaPolarNode{\Pst@ParabolaPolarNode[]}} +\def\Pst@ParabolaPolarNode[#1](#2)#3{% + \begingroup + \psset{#1}% + \def\pst@parabola@vertex{#2}% + \def\pst@parabola@semifocalchord{#3}% + \@ifnextchar(\Pst@ParabolaPolarNode@i{\Pst@ParabolaPolarNode@j}}% +\def\Pst@ParabolaPolarNode@i(#1){% + \def\pst@parabola@focus{#1}% + \@ifnextchar[\Pst@ParabolaPolarNode@ii{\Pst@ParabolaPolarNode@jj}}% +\def\Pst@ParabolaPolarNode@j{% + \pstParabolaFocusNode[PointName=none,PointSymbol=none](\pst@parabola@vertex){\pst@parabola@semifocalchord}{@PST@PARABOLA@FOCUS} + \Pst@ParabolaPolarNode@i(@PST@PARABOLA@FOCUS)}% +\def\Pst@ParabolaPolarNode@jj{% + \pstParabolaDirectrixLine[PointName=none,PointSymbol=none,linestyle=none](\pst@parabola@vertex){\pst@parabola@semifocalchord}{@PST@PARABOLA@LA}{@PST@PARABOLA@LB} + \Pst@ParabolaPolarNode@ii[@PST@PARABOLA@LA][@PST@PARABOLA@LB]}% +\def\Pst@ParabolaPolarNode@ii[#1][#2]#3#4#5{% + \pstParabolaLineInter[PointName=none,PointSymbol=none,linestyle=none](\pst@parabola@vertex){\pst@parabola@semifocalchord}{#3}{\pst@parabola@focus}{@PST@PARABOLA@FOCALCHORDAFC@A}{@PST@PARABOLA@FOCALCHORDAFC@C} + \pstParabolaLineInter[PointName=none,PointSymbol=none,linestyle=none](\pst@parabola@vertex){\pst@parabola@semifocalchord}{#4}{\pst@parabola@focus}{@PST@PARABOLA@FOCALCHORDBFD@B}{@PST@PARABOLA@FOCALCHORDBFD@D} + \pstRotation[PointName=none,PointSymbol=none,RotAngle=90]{\pst@parabola@focus}{@PST@PARABOLA@FOCALCHORDAFC@A}[@PST@PARABOLA@FOCALCHORDAFC@AA] + \pstRotation[PointName=none,PointSymbol=none,RotAngle=90]{\pst@parabola@focus}{@PST@PARABOLA@FOCALCHORDBFD@B}[@PST@PARABOLA@FOCALCHORDBFD@BB] + \pstInterLL[PointName=none,PointSymbol=none]{#1}{#2}{\pst@parabola@focus}{@PST@PARABOLA@FOCALCHORDAFC@AA}{@PST@PARABOLA@FOCALCHORD@X} + \pstInterLL[PointName=none,PointSymbol=none]{#1}{#2}{\pst@parabola@focus}{@PST@PARABOLA@FOCALCHORDBFD@BB}{@PST@PARABOLA@FOCALCHORD@Y} + \pstInterLL{#3}{@PST@PARABOLA@FOCALCHORD@X}{#4}{@PST@PARABOLA@FOCALCHORD@Y}{#5} + \Pst@geonodelabel{#5}% + \pstLineAB{#3}{#5} + \pstLineAB{#4}{#5} + \endgroup +}% +% +%% \pstParabolaTangentNode[Options](O){p}{T}{A}{B} +%% Draw the two tangent lines through the point $T$ to the Parabola P and get the node A and B on the Parabola. +%% We use the following proposition to find the tangent node of T: +%% Give point T outside of the parabola, we draw any other two chords TPQ and TRS, PS and QR intersect at I, PR and QS intersect at X, XI and Parabola intersect at A and B, then TA is the tangent line through A and TB is the tangent line through B. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the parabola vertex O +%% #3 -> [input] the half of focal chord $p$ +%% #4 -> [input] the node name T outside the parabola +%% #5 -> [output] the tangent node name A on the parabola +%% #6 -> [output] the tangent node name B on the parabola +\def\pstParabolaTangentNode{\@ifnextchar[\Pst@ParabolaTangentNode{\Pst@ParabolaTangentNode[]}} +\def\Pst@ParabolaTangentNode[#1](#2)#3#4#5#6{% + \begingroup + \@InitListMng % + \psset{#1}% + \pstParabolaAbsNode[PointName=none,PointSymbol=none](#2){#3}{\pstAbscissa{#4} \pstAbscissa{#2} le {\pstAbscissa{#2} #3 abs 2 div add}{\pstAbscissa{#2} #3 abs 2 div sub} ifelse}{@PST@PARABOLA@TANGENTAUX@P0} + \pstParabolaAbsNode[PointName=none,PointSymbol=none](#2){#3}{\pstAbscissa{#4} \pstAbscissa{#2} le {\pstAbscissa{#2} #3 abs 4 div add}{\pstAbscissa{#2} #3 abs 4 div sub} ifelse}{@PST@PARABOLA@TANGENTAUX@R0} + \pstParabolaLineInter[PointName=none,PointSymbol=none](#2){#3}{#4}{@PST@PARABOLA@TANGENTAUX@P0}{@PST@PARABOLA@TANGENTAUX@P}{@PST@PARABOLA@TANGENTAUX@Q} + \pstParabolaLineInter[PointName=none,PointSymbol=none](#2){#3}{#4}{@PST@PARABOLA@TANGENTAUX@R0}{@PST@PARABOLA@TANGENTAUX@R}{@PST@PARABOLA@TANGENTAUX@S} + \pstInterLL[PointName=none,PointSymbol=none]{@PST@PARABOLA@TANGENTAUX@P}{@PST@PARABOLA@TANGENTAUX@S}{@PST@PARABOLA@TANGENTAUX@Q}{@PST@PARABOLA@TANGENTAUX@R}{@PST@PARABOLA@TANGENTAUX@I} + \pstInterLL[PointName=none,PointSymbol=none]{@PST@PARABOLA@TANGENTAUX@P}{@PST@PARABOLA@TANGENTAUX@R}{@PST@PARABOLA@TANGENTAUX@Q}{@PST@PARABOLA@TANGENTAUX@S}{@PST@PARABOLA@TANGENTAUX@X} + \pstParabolaLineInter(#2){#3}{@PST@PARABOLA@TANGENTAUX@X}{@PST@PARABOLA@TANGENTAUX@I}{#5}{#6} + \Pst@ManageParamList{#5}% + \Pst@ManageParamList{#6}% + \pstLineAB{#4}{#5} + \pstLineAB{#4}{#6} + \endgroup% +}% +% +% 4. Standard Inversion Parabola with coordinate translation +%% ---------------------------------------------------------- +%% The Inversion Parabola P is defined by vertex O, the half of the focus chord axis $abs(p)$, the sign of $p$ indicates the direction of the parabola. +%% The equation can be written as: +%% \begin{equation}\label{StandardInversionParabola} +%% (y-y0)^2=2p(x-x0) +%% \end{equation} +%% and the parametric function can be written as: +%% \begin{equation}\label{ParametricFunctionOfStandardInversionParabola} +%% \left\{\begin{array}{l} +%% x=\dfrac{t^2}{2p}+x_o\\ +%% y=t+y_o +%% \end{array}\right. +%% \end{equation} +% +%% \pstIParabola[Options](O){p}{y0}{y1} +%% Draw a Inversion Parabola from y0 to y1 with Vertex O, the half of the focus chord axis $abs{p}$, the sign of $p$ indicates the direction of the parabola. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the parabola vertex O +%% #3 -> [input] the half of focal chord $p$ +%% #4 -> [input] the start of independent variable $y$ +%% #5 -> [input] the end of independent variable $y$ +\def\pstIParabola{\@ifnextchar[\Pst@IParabola{\Pst@IParabola[]}} +\def\Pst@IParabola[#1](#2)#3#4#5{% + \begingroup + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \parametricplot{#4}{#5}{% + \pst@tempO \tx@UserCoor % x0,y0 + #3 % p + 1 index t add % t+y0 + 3 index t dup mul 3 index 2 mul div add % t^2/(2p)+x0 + 5 2 roll pop pop pop % t+y0,t^2/(2p)+x0 + exch % 2pt^2+x0,t+y0 + } + \endgroup% +}% +% +%% \pstIParabolaNode[Options](O){p}{t}{A} +%% Draw the node whose paramater is the given value $t$ on the Inversion Parabola P. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the parabola vertex O +%% #3 -> [input] the half of focal chord $p$ +%% #4 -> [input] the given parameter value $t$ +%% #5 -> [output] the node $A$ on the parabola +\def\pstIParabolaNode{\@ifnextchar[\Pst@IParabolaNode{\Pst@IParabolaNode[]}} +\def\Pst@IParabolaNode[#1](#2)#3#4#5{% + \begingroup + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + #3 % p + 1 index #4 add % t+y0 + 3 index #4 dup mul 3 index 2 mul div add % t^2/(2p)+x0 + 5 2 roll pop pop pop % t+y0,t^2/(2p)+x0 + exch % 2pt^2+x0,t+y0 + ){#5} + \Pst@geonodelabel{#5}% + \endgroup% +}% +% +%% \pstIParabolaOrdNode[Options](O){p}{$y_1$}{A} +%% Draw the node whose ordinate is the given value $y_1$ on the Inversion Parabola P. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the parabola vertex O +%% #3 -> [input] the half of focal chord $p$ +%% #4 -> [input] the given ordinate value $y_1$ +%% #5 -> [output] the node $A$ on the parabola +\def\pstIParabolaOrdNode{\@ifnextchar[\Pst@IParabolaOrdNode{\Pst@IParabolaOrdNode[]}} +\def\Pst@IParabolaOrdNode[#1](#2)#3#4#5{% + \begingroup + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + #3 #4 % p y_1 + 3 index 1 index 4 index sub dup mul 3 index 2 mul div add % x0+(y_1-y_0)^2/(2p) + exch 5 2 roll pop pop pop + ){#5} + \Pst@geonodelabel{#5}% + \endgroup% +}% +% +%% \pstIParabolaAbsNode[Options](O){p}{$x_1$}{A}{B} +%% Draw the nodes whose abscissa is the given value $x_1$ on the Inversion Parabola P. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the parabola vertex O +%% #3 -> [input] the half of focal chord $p$ +%% #4 -> [input] the given abscissa value $x_1$ +%% #5 -> [output] the first node $A$ on the parabola +%% #6 -> [output] the second node $B$ on the parabola +\def\pstIParabolaAbsNode{\@ifnextchar[\Pst@IParabolaAbsNode{\Pst@IParabolaAbsNode[]}} +\def\Pst@IParabolaAbsNode[#1](#2)#3#4#5#6{% + \begingroup + \@InitListMng % + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + #3 #4 % p x_1 + 3 index sub mul 2 mul dup 0 lt { + pop pop pop 0 0 + }{ + sqrt 1 index exch sub + #4 exch 4 2 roll pop pop + } ifelse + ){#5} + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + #3 #4 % p x_1 + 3 index sub mul 2 mul dup 0 lt { + pop pop pop 0 0 + }{ + sqrt 1 index add + #4 exch 4 2 roll pop pop + } ifelse + ){#6} + \Pst@ManageParamList{#5}% + \Pst@ManageParamList{#6}% + \endgroup% +}% +% +%% \pstIParabolaFocusNode[Options](O){p}{F} +%% Draw the focus node of a Inversion Parabola P. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the parabola vertex O +%% #3 -> [input] the half of focal chord $p$ +%% #4 -> [output] the focus node $F$ +\def\pstIParabolaFocusNode{\@ifnextchar[\Pst@IParabolaFocusNode{\Pst@IParabolaFocusNode[]}} +\def\Pst@IParabolaFocusNode[#1](#2)#3#4{% + \begingroup + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + #3 %p + 2 index 1 index 2 div add % x0+p/2 + 2 index % y0 + 5 2 roll pop pop pop + ){#4} + \Pst@geonodelabel{#4}% + \endgroup% +}% +% +%% \pstIParabolaDirectrixLine[Options](O){p}{LA}{LB} +%% Draw the directrix line of a Inversion Parabola P. +%% The node LA also lies on the symmetrical axis line, and node LB is another one on the directrix line. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the parabola vertex O +%% #3 -> [input] the half of focal chord $p$ +%% #4 -> [output] the first node $A$ on the directrix line +%% #5 -> [output] the second node $B$ on the directrix line +\def\pstIParabolaDirectrixLine{\@ifnextchar[\Pst@IParabolaDirectrixLine{\Pst@IParabolaDirectrixLine[]}} +\def\Pst@IParabolaDirectrixLine[#1](#2)#3#4#5{% + \begingroup + \@InitListMng % + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + #3 %p + 2 index 1 index 2 div sub % x0-p/2 + 2 index % y0 + 5 2 roll pop pop pop + ){#4} + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + #3 %p + 2 index 1 index 2 div sub % x0-p/2 + 2 index 1 add % y0+1 + 5 2 roll pop pop pop + ){#5} + \Pst@ManageParamList{#4}% + \Pst@ManageParamList{#5}% + \pstLineAB{#4}{#5} + \endgroup% +}% +% +%% \pstIParabolaLineInter[Options](O){p}{A}{B}{C}{D} +%% Find the intersections C and D of line AB and the Inversion Parabola P. +%% We can represent the line AB as the following function when line AB is not vertical: +%% $$y=kx+t$$ where $$k=\dfrac{y_2-y_1}{x_2-x_1}, t=\dfrac{x_2y_1-x_1y_2}{x_2-x_1}$$ +%% The intersections are: +%% $$x_{1,2}=\dfrac{e\pm\sqrt{w}{k^2+x_o}, y_{1,2}=kx_{1,2}+t$$ +%% where, +%% $$e=p-km, w=p^2-2pkm, m=kx_o-y_o+t$$ +%% Parameters: +%% #1 -> options +%% #2 -> [input] the parabola vertex O +%% #3 -> [input] the half of focal chord $p$ +%% #4 -> [input] the node $A$ on the given line +%% #5 -> [input] the node $B$ on the given line +%% #6 -> [output] the first intersection node $C$ +%% #7 -> [output] the second intersection node $D$ +\def\pstIParabolaLineInter{\@ifnextchar[\Pst@IParabolaLineInter{\Pst@IParabolaLineInter[]}} +\def\Pst@IParabolaLineInter[#1](#2)#3#4#5#6#7{% + \begingroup + \@InitListMng % + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pst@getcoor{#4}\pst@tempA% + \pst@getcoor{#5}\pst@tempB% + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempA \tx@UserCoor % x1,y1 + \pst@tempB \tx@UserCoor % x2,y2 + 2 index 1 index sub abs 1E-5 lt { % if the line AB is horizontal + 2 index 5 index sub dup mul #3 2 mul div 6 index add % x=(y1-y0)^2/(2p)+x0 + 3 index 8 2 roll pop pop pop pop pop pop + } { + 3 index 2 index sub abs 1E-5 lt { % if the line AB is vertical + % y_{1,2}=y0 \pm sqrt(2p(x1-x0)) + 4 index #3 2 mul 5 index 8 index sub mul dup 0 lt { + pop pop pop pop pop pop pop pop 0 0 + }{ + sqrt sub % y1 + 2 index exch 8 2 roll pop pop pop pop pop pop + } ifelse + } { + 0 index 3 index sub 2 index 5 index sub div % k + 2 index 4 index mul 2 index 6 index mul sub 3 index 6 index sub div % t + #3 %p + 2 index 9 index mul 8 index sub 2 index add % m=kx_o-y_o+t + 1 index 4 index 2 index mul sub % e=p-km + 2 index dup mul 3 index 2 mul 3 index mul 6 index mul sub % w=p^2-2pkm + dup 0 lt { + pop pop pop pop pop pop + pop pop pop pop pop pop 0 0 + } { + sqrt % sqrt(w) + %% x_{1,2}=(e \pm sqrt(w))/k^2+x_o,y_{1,2}=kx_{1,2}+t + 1 index 1 index sub 6 index dup mul div 12 index add % x1 + 6 index 1 index mul 6 index add % y1 + 14 2 roll + pop pop pop pop pop pop + pop pop pop pop pop pop + } ifelse + } ifelse + } ifelse + ){#6} + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempA \tx@UserCoor % x1,y1 + \pst@tempB \tx@UserCoor % x2,y2 + 2 index 1 index sub abs 1E-5 lt { % if the line AB is horizontal + pop pop pop pop pop pop 0 0 + } { + 3 index 2 index sub abs 1E-5 lt { % if the line AB is vertical + % y_{1,2}=y0 \pm sqrt(2p(x1-x0)) + 4 index #3 2 mul 5 index 8 index sub mul dup 0 lt { + pop pop pop pop pop pop pop pop 0 0 + }{ + sqrt add % y2 + 2 index exch 8 2 roll pop pop pop pop pop pop + } ifelse + } { + 0 index 3 index sub 2 index 5 index sub div % k + 2 index 4 index mul 2 index 6 index mul sub 3 index 6 index sub div % t + #3 %p + 2 index 9 index mul 8 index sub 2 index add % m=kx_o-y_o+t + 1 index 4 index 2 index mul sub % e=p-km + 2 index dup mul 3 index 2 mul 3 index mul 6 index mul sub % w=p^2-2pkm + dup 0 lt { + pop pop pop pop pop pop + pop pop pop pop pop pop 0 0 + } { + sqrt % sqrt(w) + %% x_{1,2}=(e \pm sqrt(w))/k^2+x_o,y_{1,2}=kx_{1,2}+t + 1 index 1 index add 6 index dup mul div 12 index add % x1 + 6 index 1 index mul 6 index add % y1 + 14 2 roll + pop pop pop pop pop pop + pop pop pop pop pop pop + } ifelse + } ifelse + } ifelse + ){#7} + \Pst@ManageParamList{#6}% + \Pst@ManageParamList{#7}% + \endgroup% +}% +% +%% \pstIParabolaPolarNode[Options](O){p}(F)[L1][L2]{A}{B}{T} +%% Find the polar point of chord AB on Inversion Parabola P. +%% We use the following proposition to find the polar point of chord AB: +%% Give any chord AB, drawing two focal chord AFC and BFD, where F is the focus, then drawing FX which is perpendicular to AFC at point F, and intersect with the directrix line at X; also drawing FY which is perpendicular to BFD at point F, and intersect with the directrix line at Y. Then the intersection T of AX and BY is the polar point of chord AB. +%% If you don't know the focus F, or the directrix line, we will find them automated, otherwise you can pass them to this macro. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the parabola vertex O +%% #3 -> [input] the half of focal chord $p$ +%% #4 -> [input] optional, the focus node/coordinate F of the parabola. +%% #5 -> [input] optional, the node/coordinate L1 on the directrix line of the parabola. +%% #6 -> [input] optional, the node/coordinate L2 on the directrix line of the parabola. +%% #7 -> [input] the node A on the parabola. +%% #8 -> [input] the node B on the parabola. +%% #9 -> [output] the polar node T of chord AB. +\def\pstIParabolaPolarNode{\@ifnextchar[\Pst@IParabolaPolarNode{\Pst@IParabolaPolarNode[]}} +\def\Pst@IParabolaPolarNode[#1](#2)#3{% + \begingroup + \psset{#1}% + \def\pst@parabola@vertex{#2}% + \def\pst@parabola@semifocalchord{#3}% + \@ifnextchar(\Pst@IParabolaPolarNode@i{\Pst@IParabolaPolarNode@j}}% +\def\Pst@IParabolaPolarNode@i(#1){% + \def\pst@parabola@focus{#1}% + \@ifnextchar[\Pst@IParabolaPolarNode@ii{\Pst@IParabolaPolarNode@jj}}% +\def\Pst@IParabolaPolarNode@j{% + \pstIParabolaFocusNode[PointName=none,PointSymbol=none](\pst@parabola@vertex){\pst@parabola@semifocalchord}{@PST@IPARABOLA@FOCUS} + \Pst@IParabolaPolarNode@i(@PST@IPARABOLA@FOCUS)}% +\def\Pst@IParabolaPolarNode@jj{% + \pstIParabolaDirectrixLine[PointName=none,PointSymbol=none,linestyle=none](\pst@parabola@vertex){\pst@parabola@semifocalchord}{@PST@IPARABOLA@LA}{@PST@IPARABOLA@LB} + \Pst@IParabolaPolarNode@ii[@PST@IPARABOLA@LA][@PST@IPARABOLA@LB]}% +\def\Pst@IParabolaPolarNode@ii[#1][#2]#3#4#5{% + \pstIParabolaLineInter[PointName=none,PointSymbol=none,linestyle=none](\pst@parabola@vertex){\pst@parabola@semifocalchord}{#3}{\pst@parabola@focus}{@PST@IPARABOLA@FOCALCHORDAFC@A}{@PST@IPARABOLA@FOCALCHORDAFC@C} + \pstIParabolaLineInter[PointName=none,PointSymbol=none,linestyle=none](\pst@parabola@vertex){\pst@parabola@semifocalchord}{#4}{\pst@parabola@focus}{@PST@IPARABOLA@FOCALCHORDBFD@B}{@PST@IPARABOLA@FOCALCHORDBFD@D} + \pstRotation[PointName=none,PointSymbol=none,RotAngle=90]{\pst@parabola@focus}{@PST@IPARABOLA@FOCALCHORDAFC@A}[@PST@IPARABOLA@FOCALCHORDAFC@AA] + \pstRotation[PointName=none,PointSymbol=none,RotAngle=90]{\pst@parabola@focus}{@PST@IPARABOLA@FOCALCHORDBFD@B}[@PST@IPARABOLA@FOCALCHORDBFD@BB] + \pstInterLL[PointName=none,PointSymbol=none]{#1}{#2}{\pst@parabola@focus}{@PST@IPARABOLA@FOCALCHORDAFC@AA}{@PST@IPARABOLA@FOCALCHORD@X} + \pstInterLL[PointName=none,PointSymbol=none]{#1}{#2}{\pst@parabola@focus}{@PST@IPARABOLA@FOCALCHORDBFD@BB}{@PST@IPARABOLA@FOCALCHORD@Y} + \pstInterLL{#3}{@PST@IPARABOLA@FOCALCHORD@X}{#4}{@PST@IPARABOLA@FOCALCHORD@Y}{#5} + \Pst@geonodelabel{#5}% + \pstLineAB{#3}{#5} + \pstLineAB{#4}{#5} + \endgroup +}% +% +%% \pstIParabolaTangentNode[Options](O){p}{T}{A}{B} +%% Draw the two tangent lines through the point $T$ to the Inversion Parabola P and get the node A and B on the Inversion Parabola. +%% We use the following proposition to find the tangent node of T: +%% Give point T outside of the parabola, we draw any other two chords TPQ and TRS, PS and QR intersect at I, PR and QS intersect at X, XI and Parabola intersect at A and B, then TA is the tangent line through A and TB is the tangent line through B. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the parabola vertex O +%% #3 -> [input] the half of focal chord $p$ +%% #4 -> [input] the node name T outside the parabola +%% #5 -> [output] the tangent node name A on the parabola +%% #6 -> [output] the tangent node name B on the parabola +\def\pstIParabolaTangentNode{\@ifnextchar[\Pst@IParabolaTangentNode{\Pst@IParabolaTangentNode[]}} +\def\Pst@IParabolaTangentNode[#1](#2)#3#4#5#6{% + \begingroup + \@InitListMng % + \psset{#1}% + \pstIParabolaOrdNode[PointName=none,PointSymbol=none](#2){#3}{\pstOrdinate{#4} \pstOrdinate{#2} le {\pstOrdinate{#2} #3 abs 2 div add}{\pstOrdinate{#2} #3 abs 2 div sub} ifelse}{@PST@IPARABOLA@TANGENTAUX@P0} + \pstIParabolaOrdNode[PointName=none,PointSymbol=none](#2){#3}{\pstOrdinate{#4} \pstOrdinate{#2} le {\pstOrdinate{#2} #3 abs 4 div add}{\pstOrdinate{#2} #3 abs 4 div sub} ifelse}{@PST@IPARABOLA@TANGENTAUX@R0} + \pstIParabolaLineInter[PointName=none,PointSymbol=none](#2){#3}{#4}{@PST@IPARABOLA@TANGENTAUX@P0}{@PST@IPARABOLA@TANGENTAUX@P}{@PST@IPARABOLA@TANGENTAUX@Q} + \pstIParabolaLineInter[PointName=none,PointSymbol=none](#2){#3}{#4}{@PST@IPARABOLA@TANGENTAUX@R0}{@PST@IPARABOLA@TANGENTAUX@R}{@PST@IPARABOLA@TANGENTAUX@S} + \pstInterLL[PointName=none,PointSymbol=none]{@PST@IPARABOLA@TANGENTAUX@P}{@PST@IPARABOLA@TANGENTAUX@S}{@PST@IPARABOLA@TANGENTAUX@Q}{@PST@IPARABOLA@TANGENTAUX@R}{@PST@IPARABOLA@TANGENTAUX@I} + \pstInterLL[PointName=none,PointSymbol=none]{@PST@IPARABOLA@TANGENTAUX@P}{@PST@IPARABOLA@TANGENTAUX@R}{@PST@IPARABOLA@TANGENTAUX@Q}{@PST@IPARABOLA@TANGENTAUX@S}{@PST@IPARABOLA@TANGENTAUX@X} + \pstIParabolaLineInter(#2){#3}{@PST@IPARABOLA@TANGENTAUX@X}{@PST@IPARABOLA@TANGENTAUX@I}{#5}{#6} + \Pst@ManageParamList{#5}% + \Pst@ManageParamList{#6}% + \pstLineAB{#4}{#5} + \pstLineAB{#4}{#6} + \endgroup% +}% +% +% 5. General Parabola with coordinate translation and rotation +%% ---------------------------------------------------------- +%% The General Parabola P is defined by vertex O, the half of the focus chord axis $abs(p)$, the sign of $p$ indicates the direction of the parabola, +%% and the rotation angle $\theta$ of the symmetrical axis. +%% +%% The equation can be got from the parametric function of the parabola \ref{ParametricFunctionOfStandardParabola}, +%% using the rotation transform formula \ref{RotationTransformFormula}, then we have +%% \begin{equation} +%% \left\{\begin{array}{l} +%% x'=(t+x_o)\cos\theta-(\dfrac{t^2}{2p}+y_o)\sin\theta=x_o'+t\cos\theta-t^2\dfrac{\sin\theta}{2p}\\ +%% y'=(t+x_o)\sin\theta+(\dfrac{t^2}{2p}+y_o)\cos\theta=y_o'+t\sin\theta+t^2\dfrac{\cos\theta}{2p} +%% \end{array}\right. +%% \end{equation} +%% where the $x_o'$ and $y_o'$ are the coordinate of the given vertex O after rotation. +%% So we get the parametric function of the General Parabola with coordinate translation and rotation as following: +%% \begin{equation}\label{ParametricFunctionOfGeneralParabola} +%% \left\{\begin{array}{l} +%% x=x_o+t\cos\theta-t^2\dfrac{\sin\theta}{2p}\\ +%% y=y_o+t\sin\theta+t^2\dfrac{\cos\theta}{2p} +%% \end{array}\right. +%% \end{equation} +% +%% \pstGeneralParabola[Options](O){p}[rotation]{x0}{x1} +%% Draw a General Parabola from x0 to x1 with Vertex O, the half of the focus chord axis $p$, the sign of $p$ indicates the direction of the parabola, +%% and the rotation angle $\theta$ of the symmetrical axis. +%% If you not input the rotation angle, the default value is $0^\circ$. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the parabola vertex O +%% #3 -> [input] the half of focal chord $p$ +%% #4 -> [input] the rotation angle $\theta$ of the symmetrical axis. +%% #5 -> [input] the start of independent variable $x$ +%% #6 -> [input] the end of independent variable $x$ +\def\pstGeneralParabola{\@ifnextchar[\Pst@GeneralParabola{\Pst@GeneralParabola[]}} +\def\Pst@GeneralParabola[#1](#2)#3{% + \begingroup + \psset{#1}% + \pst@getcoor{#2}\pst@tempO % + \def\pst@parabola@semifocalchord{#3}% + \@ifnextchar[\Pst@GeneralParabola@i{\Pst@GeneralParabola@i[0]}}% +\def\Pst@GeneralParabola@i[#1]#2#3{% + \parametricplot{#2}{#3}{% + \pst@tempO \tx@UserCoor % x0,y0 + \pst@parabola@semifocalchord\space % p + #1 dup cos exch sin % \cos\theta \sin\theta + 4 index 2 index t mul add % x_o+t\cos\theta + 3 index 2 mul t dup mul exch div % t^2/(2p) + 2 index mul sub % x_o+t\cos\theta-t^2\dfrac{\sin\theta}{2p} + 4 index 2 index t mul add % y_o+t\sin\theta + 4 index 2 mul t dup mul exch div % t^2/(2p) + 4 index mul add % y_o+t\sin\theta+t^2\dfrac{\cos\theta}{2p} + 7 2 roll pop pop pop pop pop + } + \endgroup% +}% +% +%% \pstGeneralParabolaNode[Options](O){p}[rotation]{t}{A} +%% Create a new node on the given General Parabola P. +%% If you not input the rotation angle, the default value is $0^\circ$. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the parabola vertex O +%% #3 -> [input] the half of focal chord $p$ +%% #4 -> [input] the rotation angle $\theta$ of the symmetrical axis. +%% #5 -> [input] the parameter t to get the node on the parabola. +%% #6 -> [output] the target node A on the parabola. +\def\pstGeneralParabolaNode{\@ifnextchar[\Pst@GeneralParabolaNode{\Pst@GeneralParabolaNode[]}} +\def\Pst@GeneralParabolaNode[#1](#2)#3{% + \begingroup + \psset{#1}% + \pst@getcoor{#2}\pst@tempO % + \def\pst@parabola@semifocalchord{#3}% + \@ifnextchar[\Pst@GeneralParabolaNode@i{\Pst@GeneralParabolaNode@i[0]}}% +\def\Pst@GeneralParabolaNode@i[#1]#2#3{% + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@parabola@semifocalchord\space % p + #1 dup cos exch sin % \cos\theta \sin\theta + 4 index 2 index #2 mul add % x_o+t\cos\theta + 3 index 2 mul #2 dup mul exch div % t^2/(2p) + 2 index mul sub % x_o+t\cos\theta-t^2\dfrac{\sin\theta}{2p} + 4 index 2 index #2 mul add % y_o+t\sin\theta + 4 index 2 mul #2 dup mul exch div % t^2/(2p) + 4 index mul add % y_o+t\sin\theta+t^2\dfrac{\cos\theta}{2p} + 7 2 roll pop pop pop pop pop + ){#3} + \Pst@geonodelabel{#3}% + \endgroup% +}% +% +%% \pstGeneralParabolaAbsNode[Options](O){p}[rotation]{$x_1$}{A}{B} +%% Draw the nodes whose abscissas are the given value $x_1$ on the General Parabola P. +%% If you not input the rotation angle, the default value is $0^\circ$. +%% We use the parametric function \ref{ParametricFunctionOfGeneralParabola}, when $x$ equals $x_1$, we have +%% $$t=\dfrac{p\cos\theta \pm \sqrt{p^2\cos^2\theta-2p(x_1-x_o)\sin\theta}}{\sin\theta} or x_1-x_o when \sin\theta=0$$ +%% Parameters: +%% #1 -> options +%% #2 -> [input] the parabola vertex O +%% #3 -> [input] the half of focal chord $p$ +%% #4 -> [input] the rotation angle $\theta$ of the symmetrical axis. +%% #5 -> [input] the given abscissa value $x_1$ +%% #6 -> [output] the target node A on the parabola. +%% #7 -> [output] the target node B on the parabola. +\def\pstGeneralParabolaAbsNode{\@ifnextchar[\Pst@GeneralParabolaAbsNode{\Pst@GeneralParabolaAbsNode[]}} +\def\Pst@GeneralParabolaAbsNode[#1](#2)#3{% + \begingroup + \@InitListMng % + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \def\pst@parabola@semifocalchord{#3}% + \@ifnextchar[\Pst@GeneralParabolaAbsNode@i{\Pst@GeneralParabolaAbsNode@i[0]}}% +\def\Pst@GeneralParabolaAbsNode@i[#1]#2#3#4{% + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@parabola@semifocalchord\space #2 % p x_1 + #1 dup cos exch sin % \cos\theta \sin\theta + dup abs 1E-5 lt { % like ZeroEq + 2 index 6 index sub % t + 5 index 1 index dup mul 6 index 2 mul div add % y=y_o+t^2/(2p) + 4 index exch 9 2 roll pop pop pop pop pop pop pop + } { + 3 index dup mul 2 index dup mul mul % p^2\cos^2\theta + 4 index 2 mul 4 index 8 index sub mul 2 index mul % 2p(x_1-x_o)\sin\theta + sub dup 0 lt { + pop pop pop pop pop pop pop 0 0 + } { + sqrt 4 index 3 index mul exch sub 1 index div % t_1 + 5 index 1 index 3 index mul add 1 index dup mul 6 index 2 mul div 4 index mul add % y_1 + 4 index exch 9 2 roll pop pop pop pop pop pop pop + } ifelse + } ifelse + ){#3} + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@parabola@semifocalchord\space #2 % p x_1 + #1 dup cos exch sin % \cos\theta \sin\theta + dup abs 1E-5 lt { % like ZeroEq + pop pop pop pop pop pop 0 0 + } { + 3 index dup mul 2 index dup mul mul % p^2\cos^2\theta + 4 index 2 mul 4 index 8 index sub mul 2 index mul % 2p(x_1-x_o)\sin\theta + sub dup 0 lt { + pop pop pop pop pop pop pop 0 0 + } { + sqrt 4 index 3 index mul add 1 index div % t_2 + 5 index 1 index 3 index mul add 1 index dup mul 6 index 2 mul div 4 index mul add % y_2 + 4 index exch 9 2 roll pop pop pop pop pop pop pop + } ifelse + } ifelse + ){#4} + \Pst@ManageParamList{#3}% + \Pst@ManageParamList{#4}% + \endgroup% +}% +% +%% \pstGeneralParabolaOrdNode[Options](O){p}[rotation]{$y_1$}{A}{B} +%% Draw the nodes whose ordinates are the given value $y_1$ on the General Parabola P. +%% If you not input the rotation angle, the default value is $0^\circ$. +%% We use the parametric function \ref{ParametricFunctionOfGeneralParabola}, when y equals $y_1$, we have +%% $$t=\dfrac{-p\sin\theta \pm \sqrt{p^2\sin^2\theta+2p(y_1-y_0)\cos\theta}{\cos\theta} or y_1-y_o when \cos\theta=0$$ +%% Parameters: +%% #1 -> options +%% #2 -> [input] the parabola vertex O +%% #3 -> [input] the half of focal chord $p$ +%% #4 -> [input] the rotation angle $\theta$ of the symmetrical axis. +%% #5 -> [input] the given ordinate value $y_1$ +%% #6 -> [output] the target node A on the parabola. +%% #7 -> [output] the target node B on the parabola. +\def\pstGeneralParabolaOrdNode{\@ifnextchar[\Pst@GeneralParabolaOrdNode{\Pst@GeneralParabolaOrdNode[]}} +\def\Pst@GeneralParabolaOrdNode[#1](#2)#3{% + \begingroup + \@InitListMng % + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \def\pst@parabola@semifocalchord{#3}% + \@ifnextchar[\Pst@GeneralParabolaOrdNode@i{\Pst@GeneralParabolaOrdNode@i[0]}}% +\def\Pst@GeneralParabolaOrdNode@i[#1]#2#3#4{% + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@parabola@semifocalchord\space #2 % p y_1 + #1 dup cos exch sin % \cos\theta \sin\theta + 1 index abs 1E-5 lt { % if \cos\theta=0 + 2 index 5 index sub % t + 6 index 1 index dup mul 6 index 2 mul div sub % x=x_o-t^2/(2p) + 4 index 9 2 roll pop pop pop pop pop pop pop + } { + 3 index dup mul 1 index dup mul mul % p^2\sin^2\theta + 4 index 2 mul 4 index 7 index sub mul 3 index mul % 2p(y_1-y_o)\cos\theta + add dup 0 lt { + pop pop pop pop pop pop pop 0 0 + } { + sqrt 4 index 2 index mul add neg 2 index div % t_1 + 6 index 1 index 4 index mul add 1 index dup mul 6 index 2 mul div 3 index mul sub % x_1 + 4 index 9 2 roll pop pop pop pop pop pop pop + } ifelse + } ifelse + ){#3} + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@parabola@semifocalchord\space #2 % p y_1 + #1 dup cos exch sin % \cos\theta \sin\theta + 1 index abs 1E-5 lt { % if \cos\theta=0 + pop pop pop pop pop pop 0 0 + } { + 3 index dup mul 1 index dup mul mul % p^2\sin^2\theta + 4 index 2 mul 4 index 7 index sub mul 3 index mul % 2p(y_1-y_o)\cos\theta + add dup 0 lt { + pop pop pop pop pop pop pop 0 0 + } { + sqrt 4 index 2 index mul sub 2 index div % t_2 + 6 index 1 index 4 index mul add 1 index dup mul 6 index 2 mul div 3 index mul sub % x_2 + 4 index 9 2 roll pop pop pop pop pop pop pop + } ifelse + } ifelse + ){#4} + \Pst@ManageParamList{#3}% + \Pst@ManageParamList{#4}% + \endgroup% +}% +% +%% \pstGeneralParabolaFocusNode[Options](O){p}[rotation]{F} +%% Draw the focus nodes of the General Parabola P. +%% If you not input the rotation angle, the default value is $0^\circ$. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the parabola vertex O +%% #3 -> [input] the half of focal chord $p$ +%% #4 -> [input] the rotation angle $\theta$ of the symmetrical axis. +%% #5 -> [output] the focus node A of the parabola. +\def\pstGeneralParabolaFocusNode{\@ifnextchar[\Pst@GeneralParabolaFocusNode{\Pst@GeneralParabolaFocusNode[]}} +\def\Pst@GeneralParabolaFocusNode[#1](#2)#3{% + \begingroup + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \def\pst@parabola@semifocalchord{#3}% + \@ifnextchar[\Pst@GeneralParabolaFocusNode@i{\Pst@GeneralParabolaFocusNode@i[0]}}% +\def\Pst@GeneralParabolaFocusNode@i[#1]#2{% + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@parabola@semifocalchord\space 2 div % p/2 + #1 dup cos exch sin % \cos\theta \sin\theta + 4 index 3 index 2 index mul sub % x=x0-p/2\sin\theta + 4 index 4 index 4 index mul add % y=y0+p/2\cos\theta + 7 2 roll pop pop pop pop pop + ){#2} + \Pst@geonodelabel{#2}% + \endgroup% +}% +% +%% \pstGeneralParabolaDirectrixLine[Options](O){p}[rotation]{LA}{LB} +%% Draw the directrix line of the General Parabola P. +%% If you not input the rotation angle, the default value is $0^\circ$. +%% The node LA also lies on the symmetrical axis line, and node LB is another one on the directrix line. +%% they can be got after the orig nodes rotation $\theta$ about the vertex $O$, +%% please refer to the extension rotation formula \ref{ExtensionRotationTransformFormula}. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the parabola vertex O +%% #3 -> [input] the half of focal chord $p$ +%% #4 -> [input] the rotation angle $\theta$ of the symmetrical axis. +%% #5 -> [output] the first node LA on the directrix line. +%% #6 -> [output] the second node LB on the directrix line. +\def\pstGeneralParabolaDirectrixLine{\@ifnextchar[\Pst@GeneralParabolaDirectrixLine{\Pst@GeneralParabolaDirectrixLine[]}} +\def\Pst@GeneralParabolaDirectrixLine[#1](#2)#3{% + \begingroup + \@InitListMng % + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \def\pst@parabola@semifocalchord{#3}% + \@ifnextchar[\Pst@GeneralParabolaDirectrixLine@i{\Pst@GeneralParabolaDirectrixLine@i[0]}}% +\def\Pst@GeneralParabolaDirectrixLine@i[#1]#2#3{% + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@parabola@semifocalchord\space 2 div % p/2 + 2 index 2 index 2 index sub 5 2 roll pop + #1 cos #1 sin % x y x0 y0 \cos\theta \sin\theta + 3 index 6 index 5 index sub 3 index mul add 5 index 4 index sub 2 index mul sub % x0+(x-x0)\cos\theta-(y-y0)\sin\theta + 3 index 7 index 6 index sub 3 index mul add 6 index 5 index sub 4 index mul add % y0+(x-x0)\sin\theta+(y-y0)\cos\theta + 8 2 roll pop pop pop pop pop pop + ){#2} + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@parabola@semifocalchord\space 2 div % p/2 + 2 index 1 add 2 index 2 index sub 5 2 roll pop + #1 cos #1 sin % x y x0 y0 \cos\theta \sin\theta + 3 index 6 index 5 index sub 3 index mul add 5 index 4 index sub 2 index mul sub % x0+(x-x0)\cos\theta-(y-y0)\sin\theta + 3 index 7 index 6 index sub 3 index mul add 6 index 5 index sub 4 index mul add % y0+(x-x0)\sin\theta+(y-y0)\cos\theta + 8 2 roll pop pop pop pop pop pop + ){#3} + \Pst@ManageParamList{#2}% + \Pst@ManageParamList{#3}% + \pstLineAB{#2}{#3} + \endgroup% +}% +% +%% \pstGeneralParabolaLineInter[Options](O){p}[rotation]{A}{B}{C}{D} +%% Find the intersections C and D of line AB and the General Parabola P. +%% If you not input the rotation angle, the default value is $0^\circ$. +%% +%% Case 1. When line AB is vertical, i.e, $x_1=x_2$, we have +%% Case 1.1 When $\sin\theta=0$, we have +%% $$t=x_1-x_o$$ +%% and $x_{C}=x_1,y_{C}=y_o+\dfrac{t^2}{2p}$, but D is not defined. +%% Case 1.2 When $\sin\theta\neq0$, we have +%% $$t_{1,2}=\dfrac{p\cos\theta \pm \sqrt{p^2\cos^2\theta-2p(x_1-x_o)\sin\theta}}{\sin\theta}$$ +%% and $x_{C,D}=x_1,y_{C,D}=y_o+t_{1,2}\sin\theta+\dfrac{t_{1,2}^2}{2p}\cos\theta$. +%% Case 2. When line AB is not vertical, we can represent the line AB as the following function: +%% $$y=kx+d$$ where $$k=\dfrac{y_2-y_1}{x_2-x_1}, d=\dfrac{x_2y_1-x_1y_2}{x_2-x_1} +%% refer to equation (\ref{ParametricFunctionOfGeneralParabola}), we have +%% $$ft^2-2pet-2pm=0$$ +%% where +%% $$m=kx_o-y_o+d,e=k\cos\theta-\sin\theta,f=k\sin\theta+\cos\theta$$ +%% Case 2.1 When $f=k\sin\theta+\cos\theta=0$, which gives $\sin\theta\neq0$ and $k=-\dfrac{\cos\theta}{\sin\theta}$, +%% at this time, we have $t=m\sin\theta$ and then +%% $$x_{C}=x_o+t\cos\theta-\dfrac{t^2}{2p}\sin\theta, y_{C}=y_o+t\sin\theta+\dfrac{t^2}{2p}\cos\theta$$ +%% but D is not defined. +%% Case 2.2 When $f=k\sin\theta+\cos\theta\neq0$, we have $t_{1,2}=\dfrac{pe\pm\sqrt{(pe)^2+2fmp}}{f}$, and then +%% $$x_{C,D}=x_o+t_{1,2}\cos\theta-\dfrac{t_{1,2}^2}{2p}\sin\theta, y_{C,D}=y_o+t_{1,2}\sin\theta+\dfrac{t_{1,2}^2}{2p}\cos\theta$$ +%% Parameters: +%% #1 -> options +%% #2 -> [input] the parabola vertex O +%% #3 -> [input] the half of focal chord $p$ +%% #4 -> [input] the rotation angle $\theta$ of the symmetrical axis. +%% #5 -> [input] the node $A$ on the given line +%% #6 -> [input] the node $B$ on the given line +%% #7 -> [output] the first intersection node $C$ +%% #8 -> [output] the second intersection node $D$ +\def\pstGeneralParabolaLineInter{\@ifnextchar[\Pst@GeneralParabolaLineInter{\Pst@GeneralParabolaLineInter[]}} +\def\Pst@GeneralParabolaLineInter[#1](#2)#3{% + \begingroup + \@InitListMng % + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \def\pst@parabola@semifocalchord{#3}% + \@ifnextchar[\Pst@GeneralParabolaLineInter@i{\Pst@GeneralParabolaLineInter@i[0]}}% +\def\Pst@GeneralParabolaLineInter@i[#1]#2#3#4#5{% + \pst@getcoor{#2}\pst@tempA% + \pst@getcoor{#3}\pst@tempB% + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempA \tx@UserCoor % x1,y1 + \pst@tempB \tx@UserCoor % x2,y2 + 3 index 2 index sub abs 1E-5 lt { % if the line AB is vertical + #1 dup cos exch sin % \cos\theta \sin\theta + dup abs 1E-5 lt { % like ZeroEq % if \sin\theta=0 + 5 index 8 index sub % t=x1-x0 + 7 index 1 index dup mul \pst@parabola@semifocalchord\space 2 mul div add % y=y_o+t^2/(2p) + 7 index exch 9 2 roll pop pop pop pop pop pop pop + } { + \pst@parabola@semifocalchord\space %p + 2 index 1 index mul % p\cos\theta + dup dup mul 2 index 2 mul 9 index 12 index sub mul 4 index mul sub % p^2\cos^2\theta-2p(x_1-x_o)\sin\theta + dup 0 lt { + pop pop pop pop pop + pop pop pop pop pop + pop 0 0 + } { + sqrt 1 index exch sub 3 index div % t_1 + 9 index 1 index 5 index mul add 1 index dup mul 4 index 2 mul div 6 index mul add % y_1 + 9 index exch 11 2 roll pop pop pop pop + pop pop pop pop pop + } ifelse + } ifelse + } { + 0 index 3 index sub 2 index 5 index sub div % k + 2 index 4 index mul 2 index 6 index mul sub 3 index 6 index sub div % d + \pst@parabola@semifocalchord\space %p + 2 index 9 index mul 8 index sub 2 index add % m=kx_o-y_o+t + #1 dup cos exch sin % \cos\theta \sin\theta + 5 index 2 index mul 1 index sub % e=k\cos\theta-\sin\theta + 6 index 2 index mul 3 index add % f=k\sin\theta+\cos\theta + % (aaaaaa----) print pstack (aaaaaa===) print + dup abs 1E-5 lt { % like ZeroEq + 4 index 3 index mul % t=m\sin\theta + 14 index 1 index 6 index mul add 1 index dup mul 8 index 2 mul div 5 index mul sub % x_1 + 14 index 2 index 6 index mul add 2 index dup mul 9 index 2 mul div 7 index mul add % y_1 + % (xxxxxx----) print pstack (xxxxxx===) print + 17 2 roll pop pop pop pop pop pop + pop pop pop pop pop pop + pop pop pop + } { + 5 index 2 index mul % pe + dup dup mul 2 index 7 index mul 8 index 2 mul mul add % (pe)^2+2fmp + dup 0 lt { + pop pop pop pop pop pop pop pop pop pop + pop pop pop pop pop pop 0 0 + } { + sqrt 1 index exch sub 2 index div % t_1 + 15 index 1 index 7 index mul add 1 index dup mul 9 index 2 mul div 6 index mul sub % x_1 + 15 index 2 index 7 index mul add 2 index dup mul 10 index 2 mul div 8 index mul add % y_1 + % (bbbbbb----) print pstack (bbbbbb===) print + 18 2 roll pop pop pop pop pop pop + pop pop pop pop pop pop + pop pop pop pop + } ifelse + } ifelse + } ifelse + ){#4} + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempA \tx@UserCoor % x1,y1 + \pst@tempB \tx@UserCoor % x2,y2 + 3 index 2 index sub abs 1E-5 lt { % if the line AB is vertical + #1 dup cos exch sin % \cos\theta \sin\theta + dup abs 1E-5 lt { % like ZeroEq % if \sin\theta=0 + pop pop pop pop pop pop pop pop 0 0 + } { + \pst@parabola@semifocalchord\space %p + 2 index 1 index mul % p\cos\theta + dup dup mul 2 index 2 mul 9 index 12 index sub mul 4 index mul sub % p^2\cos^2\theta-2p(x_1-x_o)\sin\theta + dup 0 lt { + pop pop pop pop pop + pop pop pop pop pop + pop 0 0 + } { + sqrt 1 index add 3 index div % t_2 + 9 index 1 index 5 index mul add 1 index dup mul 4 index 2 mul div 6 index mul add % y_2 + 9 index exch 11 2 roll pop pop pop pop + pop pop pop pop pop + } ifelse + } ifelse + } { + 0 index 3 index sub 2 index 5 index sub div % k + 2 index 4 index mul 2 index 6 index mul sub 3 index 6 index sub div % d + \pst@parabola@semifocalchord\space %p + 2 index 9 index mul 8 index sub 2 index add % m=kx_o-y_o+d + #1 dup cos exch sin % \cos\theta \sin\theta + 5 index 2 index mul 1 index sub % e=k\cos\theta-\sin\theta + 6 index 2 index mul 3 index add % f=k\sin\theta+\cos\theta + dup abs 1E-5 lt { % like ZeroEq + pop pop pop pop pop pop pop + pop pop pop pop pop pop pop 0 0 + } { + 5 index 2 index mul % pe + dup dup mul 2 index 7 index mul 8 index 2 mul mul add % (pe)^2+2fmp + dup 0 lt { + pop pop pop pop pop pop pop pop pop pop + pop pop pop pop pop pop 0 0 + } { + sqrt 1 index add 2 index div % t_2 + 15 index 1 index 7 index mul add 1 index dup mul 9 index 2 mul div 6 index mul sub % x_2 + 15 index 2 index 7 index mul add 2 index dup mul 10 index 2 mul div 8 index mul add % y_2 + % (ccccccc----) print pstack (ccccccc===) print + 18 2 roll pop pop pop pop pop pop + pop pop pop pop pop pop + pop pop pop pop + } ifelse + } ifelse + } ifelse + ){#5} + \Pst@ManageParamList{#4}% + \Pst@ManageParamList{#5}% + \endgroup% +}% +% +%% \pstGeneralParabolaPolarNode[Options](O){p}[rotation](F)[L1][L2]{A}{B}{T} +%% Find the polar point of chord AB on General Parabola P. +%% If you not input the rotation angle, the default value is $0^\circ$. +%% We use the following proposition to find the polar point of chord AB: +%% Give any chord AB, drawing two focal chord AFC and BFD, where F is the focus, then drawing FX which is perpendicular to AFC at point F, and intersect with the directrix line at X; also drawing FY which is perpendicular to BFD at point F, and intersect with the directrix line at Y. Then the intersection T of AX and BY is the polar point of chord AB. +%% If you don't know the focus F, or the directrix line, we will find them automated, otherwise you can pass them to this macro. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the parabola vertex O +%% #3 -> [input] the half of focal chord $p$ +%% #4 -> [input] the rotation angle $\theta$ of the symmetrical axis. +%% #5 -> [input] optional, the focus node/coordinate F of the parabola. +%% #6 -> [input] optional, the node/coordinate L1 on the directrix line of the parabola. +%% #7 -> [input] optional, the node/coordinate L2 on the directrix line of the parabola. +%% #8 -> [input] the node A on the parabola. +%% #9 -> [input] the node B on the parabola. +%% #10 -> [output] the polar node T of chord AB. +\def\pstGeneralParabolaPolarNode{\@ifnextchar[\Pst@GeneralParabolaPolarNode{\Pst@GeneralParabolaPolarNode[]}} +\def\Pst@GeneralParabolaPolarNode[#1](#2)#3{% + \begingroup + \psset{#1}% + \def\pst@generalparabola@vertex{#2}% + \def\pst@generalparabola@semifocalchord{#3}% + \@ifnextchar[\Pst@GeneralParabolaPolarNode@i{\Pst@GeneralParabolaPolarNode@i[0]}}% +\def\Pst@GeneralParabolaPolarNode@i[#1]{% + \def\pst@generalparabola@gradientangle{#1}% + \@ifnextchar(\Pst@GeneralParabolaPolarNode@j{\Pst@GeneralParabolaPolarNode@k}}% +\def\Pst@GeneralParabolaPolarNode@j(#1){% + \def\pst@generalparabola@focus{#1}% + \@ifnextchar[\Pst@GeneralParabolaPolarNode@jj{\Pst@GeneralParabolaPolarNode@kk}}% +\def\Pst@GeneralParabolaPolarNode@k{% + \pstGeneralParabolaFocusNode[PointName=none,PointSymbol=none](\pst@generalparabola@vertex){\pst@generalparabola@semifocalchord}[\pst@generalparabola@gradientangle]{@PST@GENERALPARABOLA@FOCUS} + \Pst@GeneralParabolaPolarNode@j(@PST@GENERALPARABOLA@FOCUS)}% +\def\Pst@GeneralParabolaPolarNode@kk{% + \pstGeneralParabolaDirectrixLine[linestyle=none,PointName=none,PointSymbol=none](\pst@generalparabola@vertex){\pst@generalparabola@semifocalchord}[\pst@generalparabola@gradientangle]{@PST@GENERALPARABOLA@DIRECTRIXLINEA}{@PST@GENERALPARABOLA@DIRECTRIXLINEB} + \Pst@GeneralParabolaPolarNode@jj[@PST@GENERALPARABOLA@DIRECTRIXLINEA][@PST@GENERALPARABOLA@DIRECTRIXLINEB]}% +\def\Pst@GeneralParabolaPolarNode@jj[#1][#2]#3#4#5{% + \pstGeneralParabolaLineInter[PointName=none,PointSymbol=none,linestyle=none](\pst@generalparabola@vertex){\pst@generalparabola@semifocalchord}[\pst@generalparabola@gradientangle]{#3}{\pst@generalparabola@focus}{@PST@GENERALPARABOLA@FOCALCHORDAFC@A}{@PST@GENERALPARABOLA@FOCALCHORDAFC@C} + \pstGeneralParabolaLineInter[PointName=none,PointSymbol=none,linestyle=none](\pst@generalparabola@vertex){\pst@generalparabola@semifocalchord}[\pst@generalparabola@gradientangle]{#4}{\pst@generalparabola@focus}{@PST@GENERALPARABOLA@FOCALCHORDBFD@B}{@PST@GENERALPARABOLA@FOCALCHORDBFD@D} + \pstRotation[PointName=none,PointSymbol=none,RotAngle=90]{\pst@generalparabola@focus}{@PST@GENERALPARABOLA@FOCALCHORDAFC@A}[@PST@GENERALPARABOLA@FOCALCHORDAFC@AA] + \pstRotation[PointName=none,PointSymbol=none,RotAngle=90]{\pst@generalparabola@focus}{@PST@GENERALPARABOLA@FOCALCHORDBFD@B}[@PST@GENERALPARABOLA@FOCALCHORDBFD@BB] + \pstInterLL[PointName=none,PointSymbol=none]{#1}{#2}{\pst@generalparabola@focus}{@PST@GENERALPARABOLA@FOCALCHORDAFC@AA}{@PST@GENERALPARABOLA@FOCALCHORD@X} + \pstInterLL[PointName=none,PointSymbol=none]{#1}{#2}{\pst@generalparabola@focus}{@PST@GENERALPARABOLA@FOCALCHORDBFD@BB}{@PST@GENERALPARABOLA@FOCALCHORD@Y} + \pstInterLL{#3}{@PST@GENERALPARABOLA@FOCALCHORD@X}{#4}{@PST@GENERALPARABOLA@FOCALCHORD@Y}{#5} + \Pst@geonodelabel{#5}% + \pstLineAB{#3}{#5} + \pstLineAB{#4}{#5} + \endgroup +}% +% +%% \pstGeneralParabolaTangentNode[Options](O){p}[rotation]{T}{A}{B} +%% Draw the two tangent lines through the point $T$ to the General Parabola P and get the node A and B on the General Parabola. +%% We use the following proposition to find the tangent node of T: +%% Give point T outside of the parabola, we draw any other two chords TPQ and TRS, PS and QR intersect at I, PR and QS intersect at X, XI and GeneralParabola intersect at A and B, then TA is the tangent line through A and TB is the tangent line through B. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the parabola vertex O +%% #3 -> [input] the half of focal chord $p$ +%% #4 -> [input] the rotation angle $\theta$ of the symmetrical axis. +%% #5 -> [input] the given node T outside the parabola +%% #6 -> [output] the tangent node name A on the parabola +%% #7 -> [output] the tangent node name B on the parabola +\def\pstGeneralParabolaTangentNode{\@ifnextchar[\Pst@GeneralParabolaTangentNode{\Pst@GeneralParabolaTangentNode[]}} +\def\Pst@GeneralParabolaTangentNode[#1](#2)#3{% + \begingroup + \@InitListMng % + \psset{#1}% + \def\pst@generalparabola@vertex{#2}% + \def\pst@generalparabola@semifocalchord{#3}% + \@ifnextchar[\Pst@GeneralParabolaTangentNode@i{\Pst@GeneralParabolaTangentNode@i[0]}}% +\def\Pst@GeneralParabolaTangentNode@i[#1]#2#3#4{% + \pstGeneralParabolaAbsNode[PointName=none,PointSymbol=none](\pst@generalparabola@vertex){\pst@generalparabola@semifocalchord}[#1]{\pstAbscissa{#2} \pstAbscissa{\pst@generalparabola@vertex} le {\pstAbscissa{\pst@generalparabola@vertex} \pst@generalparabola@semifocalchord\space abs 2 div add}{\pstAbscissa{\pst@generalparabola@vertex} \pst@generalparabola@semifocalchord\space abs 2 div sub} ifelse}{@PST@GENERALPARABOLA@TANGENTAUX@P0}{@PST@GENERALPARABOLA@TANGENTAUX@P1} + \pstGeneralParabolaAbsNode[PointName=none,PointSymbol=none](\pst@generalparabola@vertex){\pst@generalparabola@semifocalchord}[#1]{\pstAbscissa{#2} \pstAbscissa{\pst@generalparabola@vertex} le {\pstAbscissa{\pst@generalparabola@vertex} \pst@generalparabola@semifocalchord\space abs 4 div add}{\pstAbscissa{\pst@generalparabola@vertex} \pst@generalparabola@semifocalchord\space abs 4 div sub} ifelse}{@PST@GENERALPARABOLA@TANGENTAUX@R0}{@PST@GENERALPARABOLA@TANGENTAUX@R1} + \pstGeneralParabolaLineInter[PointName=none,PointSymbol=none](\pst@generalparabola@vertex){\pst@generalparabola@semifocalchord}[#1]{#2}{@PST@GENERALPARABOLA@TANGENTAUX@P0}{@PST@GENERALPARABOLA@TANGENTAUX@P}{@PST@GENERALPARABOLA@TANGENTAUX@Q} + \pstGeneralParabolaLineInter[PointName=none,PointSymbol=none](\pst@generalparabola@vertex){\pst@generalparabola@semifocalchord}[#1]{#2}{@PST@GENERALPARABOLA@TANGENTAUX@R0}{@PST@GENERALPARABOLA@TANGENTAUX@R}{@PST@GENERALPARABOLA@TANGENTAUX@S} + \pstInterLL[PointName=none,PointSymbol=none]{@PST@GENERALPARABOLA@TANGENTAUX@P}{@PST@GENERALPARABOLA@TANGENTAUX@S}{@PST@GENERALPARABOLA@TANGENTAUX@Q}{@PST@GENERALPARABOLA@TANGENTAUX@R}{@PST@GENERALPARABOLA@TANGENTAUX@I} + \pstInterLL[PointName=none,PointSymbol=none]{@PST@GENERALPARABOLA@TANGENTAUX@P}{@PST@GENERALPARABOLA@TANGENTAUX@R}{@PST@GENERALPARABOLA@TANGENTAUX@Q}{@PST@GENERALPARABOLA@TANGENTAUX@S}{@PST@GENERALPARABOLA@TANGENTAUX@X} + \pstGeneralParabolaLineInter(\pst@generalparabola@vertex){\pst@generalparabola@semifocalchord}[#1]{@PST@GENERALPARABOLA@TANGENTAUX@X}{@PST@GENERALPARABOLA@TANGENTAUX@I}{#3}{#4} + \Pst@ManageParamList{#3}% + \Pst@ManageParamList{#4}% + \pstLineAB{#2}{#3} + \pstLineAB{#2}{#4} + \endgroup% +}% +% +% 6. General Inversion Parabola with coordinate translation and rotation +%% ---------------------------------------------------------- +%% The General Inversion Parabola P is defined by vertex O, the half of the focus chord axis $abs(p)$, the sign of $p$ indicates the direction of the parabola, +%% and the rotation angle $\theta$ of the symmetrical axis. +%% +%% The equation can be got from the parametric function of the inversion parabola \ref{ParametricFunctionOfStandardInversionParabola}, +%% using the rotation transform formula \ref{RotationTransformFormula}, then we have +%% \begin{equation} +%% \left\{\begin{array}{l} +%% x'=(\dfrac{t^2}{2p}+x_o)\cos\theta-(t+y_o)\sin\theta=x_o'-t\sin\theta+t^2\dfrac{\cos\theta}{2p}\\ +%% y'=(\dfrac{t^2}{2p}+x_o)\sin\theta+(t+y_o)\cos\theta=y_o'+t\cos\theta+t^2\dfrac{\sin\theta}{2p} +%% \end{array}\right. +%% \end{equation} +%% where the $x_o'$ and $y_o'$ are the coordinate of the given vertex O after rotation. +%% So we get the parametric function of the General Inversion Parabola with coordinate translation and rotation as following: +%% \begin{equation}\label{ParametricFunctionOfGeneralInversionParabola} +%% \left\{\begin{array}{l} +%% x=x_o-t\sin\theta+t^2\dfrac{\cos\theta}{2p}\\ +%% y=y_o+t\cos\theta+t^2\dfrac{\sin\theta}{2p} +%% \end{array}\right. +%% \end{equation} +% +%% \pstGeneralIParabola[Options](O){p}[rotation]{y0}{y1} +%% Draw a General Inversion Parabola from y0 to y1 with Vertex O, the half of the focus chord axis $p$, +%% and the rotation angle $\theta$ of the symmetrical axis. +%% If you not input the rotation angle, the default value is $0^\circ$. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the parabola vertex O +%% #3 -> [input] the half of focal chord $p$ +%% #4 -> [input] the rotation angle $\theta$ of the symmetrical axis. +%% #5 -> [input] the start of independent variable $y$ +%% #6 -> [input] the end of independent variable $y$ +\def\pstGeneralIParabola{\@ifnextchar[\Pst@GeneralIParabola{\Pst@GeneralIParabola[]}} +\def\Pst@GeneralIParabola[#1](#2)#3{% + \begingroup + \psset{#1}% + \pst@getcoor{#2}\pst@tempO % + \def\pst@parabola@semifocalchord{#3}% + \@ifnextchar[\Pst@GeneralIParabola@i{\Pst@GeneralIParabola@i[0]}}% +\def\Pst@GeneralIParabola@i[#1]#2#3{% + \parametricplot{#2}{#3}{% + \pst@tempO \tx@UserCoor % x0,y0 + \pst@parabola@semifocalchord\space % p + #1 dup cos exch sin % \cos\theta \sin\theta + 4 index 1 index t mul sub % x_o-t\sin\theta + 3 index 2 mul t dup mul exch div % t^2/(2p) + 3 index mul add % x_o-t\sin\theta+t^2\dfrac{\cos\theta}{2p} + 4 index 3 index t mul add % y_o+t\cos\theta + 4 index 2 mul t dup mul exch div % t^2/(2p) + 3 index mul add % y_o+t\cos\theta+t^2\dfrac{\sin\theta}{2p} + 7 2 roll pop pop pop pop pop + } + \endgroup% +}% +% +%% \pstGeneralIParabolaNode[Options](O){p}[rotation]{t}{A} +%% Create a new node $A$ whose parameter is the the given value $t$ on the given General Inversion Parabola P. +%% If you not input the rotation angle, the default value is $0^\circ$. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the parabola vertex O +%% #3 -> [input] the half of focal chord $p$ +%% #4 -> [input] the rotation angle $\theta$ of the symmetrical axis. +%% #5 -> [input] the parameter t to get the node on the parabola. +%% #6 -> [output] the target node A on the parabola. +\def\pstGeneralIParabolaNode{\@ifnextchar[\Pst@GeneralIParabolaNode{\Pst@GeneralIParabolaNode[]}} +\def\Pst@GeneralIParabolaNode[#1](#2)#3{% + \begingroup + \psset{#1}% + \pst@getcoor{#2}\pst@tempO % + \def\pst@parabola@semifocalchord{#3}% + \@ifnextchar[\Pst@GeneralIParabolaNode@i{\Pst@GeneralIParabolaNode@i[0]}}% +\def\Pst@GeneralIParabolaNode@i[#1]#2#3{% + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@parabola@semifocalchord\space % p + #1 dup cos exch sin % \cos\theta \sin\theta + 4 index 1 index #2 mul sub % x_o-t\sin\theta + 3 index 2 mul #2 dup mul exch div % t^2/(2p) + 3 index mul add % x_o-t\sin\theta+t^2\dfrac{\cos\theta}{2p} + 4 index 3 index #2 mul add % y_o+t\cos\theta + 4 index 2 mul #2 dup mul exch div % t^2/(2p) + 3 index mul add % y_o+t\cos\theta+t^2\dfrac{\sin\theta}{2p} + 7 2 roll pop pop pop pop pop + ){#3} + \Pst@geonodelabel{#3}% + \endgroup% +}% +% +%% \pstGeneralIParabolaAbsNode[Options](O){p}[rotation]{x_1}{A}{B} +%% Find the nodes $A$ and $B$ whose abscissa are the the given value $x_1$ on the given General Inversion Parabola P. +%% If you not input the rotation angle, the default value is $0^\circ$. +%% when $x=x_1$, we have +%% $$t^2\dfrac{\cos\theta}{2p}-t\sin\theta-(x_1-x_o)=0$$ +%% when $\cos\theta=0$, we have $t=-(x_1-x_o)$, so +%% $$x=x_1, y=y_o+\dfrac{t^2}{2p}$$ +%% when $\cos\theta\neq0$, we have +%% $$t_{1,2}=\dfrac{-b\pm\sqrt{b^2-4ac}}{2a}=\dfrac{\sin\theta\pm\sqrt{\sin^2\theta+4\cos\theta/(2p)(x_1-x_o)}}{2\cos\theta/(2p)}$$ +%% Parameters: +%% #1 -> options +%% #2 -> [input] the parabola vertex O +%% #3 -> [input] the half of focal chord $p$ +%% #4 -> [input] the rotation angle $\theta$ of the symmetrical axis. +%% #5 -> [input] the abscissa $x_1$ to get the node on the parabola. +%% #6 -> [output] the first node A on the parabola. +%% #7 -> [output] the second node B on the parabola. +\def\pstGeneralIParabolaAbsNode{\@ifnextchar[\Pst@GeneralIParabolaAbsNode{\Pst@GeneralIParabolaAbsNode[]}} +\def\Pst@GeneralIParabolaAbsNode[#1](#2)#3{% + \begingroup + \@InitListMng % + \psset{#1}% + \pst@getcoor{#2}\pst@tempO % + \def\pst@parabola@semifocalchord{#3}% + \@ifnextchar[\Pst@GeneralIParabolaAbsNode@i{\Pst@GeneralIParabolaAbsNode@i[0]}}% +\def\Pst@GeneralIParabolaAbsNode@i[#1]#2#3#4{% + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@parabola@semifocalchord\space % p + #1 dup cos exch sin % \cos\theta \sin\theta + 1 index abs 1E-5 lt { % if \cos\theta=0 + 4 index #2 sub % t=x0-x1 + 4 index 1 index dup mul 5 index 2 mul div add % y=y0+t^2/(2p) + #2 exch 8 2 roll pop pop pop pop pop pop + } { + 1 index 3 index div % \cos\theta/p + #2 6 index sub 1 index mul 2 mul 2 index dup mul add % 2(x1-x0)\cos\theta/p+\sin^2\theta + dup 0 lt { + pop pop pop pop pop pop pop 0 0 + } { + sqrt 2 index exch sub 1 index div % t1 + 5 index 1 index 5 index mul add 1 index dup mul 4 index mul 6 index 2 mul div add % y1 + #2 exch 9 2 roll pop pop pop pop pop pop pop + } ifelse + } ifelse + ){#3} + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@parabola@semifocalchord\space % p + #1 dup cos exch sin % \cos\theta \sin\theta + 1 index abs 1E-5 lt { % if \cos\theta=0 + pop pop pop pop pop 0 0 + } { + 1 index 3 index div % \cos\theta/p + #2 6 index sub 1 index mul 2 mul 2 index dup mul add % 2(x1-x0)\cos\theta/p+\sin^2\theta + dup 0 lt { + pop pop pop pop pop pop pop 0 0 + } { + sqrt 2 index add 1 index div % t2 + 5 index 1 index 5 index mul add 1 index dup mul 4 index mul 6 index 2 mul div add % y2 + #2 exch 9 2 roll pop pop pop pop pop pop pop + } ifelse + } ifelse + ){#4} + \Pst@ManageParamList{#3}% + \Pst@ManageParamList{#4}% + \endgroup% +}% +% +%% \pstGeneralIParabolaOrdNode[Options](O){p}[rotation]{y_1}{A}{B} +%% Find the nodes $A$ and $B$ whose ordinate are the the given value $y_1$ on the given General Inversion Parabola P. +%% If you not input the rotation angle, the default value is $0^\circ$. +%% when $y=y_1$, we have +%% $$t^2\dfrac{\sin\theta}{2p}+t\cos\theta-(y_1-y_o)=0$$ +%% when $\sin\theta=0$, we have $t=(y_1-y_o)$, so +%% $$y=y_1, x=x_o+\dfrac{t^2}{2p}$$ +%% when $\sin\theta\neq0$, we have +%% $$t_{1,2}=\dfrac{-b\pm\sqrt{b^2-4ac}}{2a}=\dfrac{-\cos\theta\pm\sqrt{\cos^2\theta+4\sin\theta/(2p)(y_1-y_o)}}{2\sin\theta/(2p)}$$ +%% Parameters: +%% #1 -> options +%% #2 -> [input] the parabola vertex O +%% #3 -> [input] the half of focal chord $p$ +%% #4 -> [input] the rotation angle $\theta$ of the symmetrical axis. +%% #5 -> [input] the ordinate $y_1$ to get the node on the parabola. +%% #6 -> [output] the first node A on the parabola. +%% #7 -> [output] the second node B on the parabola. +\def\pstGeneralIParabolaOrdNode{\@ifnextchar[\Pst@GeneralIParabolaOrdNode{\Pst@GeneralIParabolaOrdNode[]}} +\def\Pst@GeneralIParabolaOrdNode[#1](#2)#3{% + \begingroup + \@InitListMng % + \psset{#1}% + \pst@getcoor{#2}\pst@tempO % + \def\pst@parabola@semifocalchord{#3}% + \@ifnextchar[\Pst@GeneralIParabolaOrdNode@i{\Pst@GeneralIParabolaOrdNode@i[0]}}% +\def\Pst@GeneralIParabolaOrdNode@i[#1]#2#3#4{% + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@parabola@semifocalchord\space % p + #1 dup cos exch sin % \cos\theta \sin\theta + 0 index abs 1E-5 lt { % if \sin\theta=0 + #2 4 index sub % t=y1-y0 + 5 index 1 index dup mul 5 index 2 mul div add % x=x0+t^2/(2p) + #2 exch 8 2 roll pop pop pop pop pop pop + } { + 0 index 3 index div % \sin\theta/p + #2 5 index sub 1 index mul 2 mul 3 index dup mul add % 2(y1-y0)\sin\theta/p+\cos^2\theta + dup 0 lt { + pop pop pop pop pop pop pop 0 0 + } { + sqrt 3 index add neg 1 index div % t1 + 6 index 1 index 4 index mul sub 1 index dup mul 5 index mul 6 index 2 mul div add % x1 + #2 9 2 roll pop pop pop pop pop pop pop + } ifelse + } ifelse + ){#3} + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@parabola@semifocalchord\space % p + #1 dup cos exch sin % \cos\theta \sin\theta + 0 index abs 1E-5 lt { % if \sin\theta=0 + #2 4 index sub % t=y1-y0 + 5 index 1 index dup mul 5 index 2 mul div add % x=x0+t^2/(2p) + #2 exch 8 2 roll pop pop pop pop pop pop + } { + 0 index 3 index div % \sin\theta/p + #2 5 index sub 1 index mul 2 mul 3 index dup mul add % 2(y1-y0)\sin\theta/p+\cos^2\theta + dup 0 lt { + pop pop pop pop pop pop pop 0 0 + } { + sqrt 3 index sub 1 index div % t2 + 6 index 1 index 4 index mul sub 1 index dup mul 5 index mul 6 index 2 mul div add % x2 + #2 9 2 roll pop pop pop pop pop pop pop + } ifelse + } ifelse + ){#4} + \Pst@ManageParamList{#3}% + \Pst@ManageParamList{#4}% + \endgroup% +}% +% +%% \pstGeneralIParabolaFocusNode[Options](O){p}[rotation]{F} +%% Find the focus node $F$ of the given General Inversion Parabola P. +%% If you not input the rotation angle, the default value is $0^\circ$. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the parabola vertex O +%% #3 -> [input] the half of focal chord $p$ +%% #4 -> [input] the rotation angle $\theta$ of the symmetrical axis. +%% #5 -> [output] the focus node F of the parabola. +\def\pstGeneralIParabolaFocusNode{\@ifnextchar[\Pst@GeneralIParabolaFocusNode{\Pst@GeneralIParabolaFocusNode[]}} +\def\Pst@GeneralIParabolaFocusNode[#1](#2)#3{% + \begingroup + \psset{#1}% + \pst@getcoor{#2}\pst@tempO % + \def\pst@parabola@semifocalchord{#3}% + \@ifnextchar[\Pst@GeneralIParabolaFocusNode@i{\Pst@GeneralIParabolaFocusNode@i[0]}}% +\def\Pst@GeneralIParabolaFocusNode@i[#1]#2{% + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@parabola@semifocalchord\space 2 div % p/2 + #1 dup cos exch sin % \cos\theta \sin\theta + 4 index 3 index 3 index mul add % x=x0+p/2\cos\theta + 4 index 4 index 3 index mul add % y=y0+p/2\sin\theta + 7 2 roll pop pop pop pop pop + ){#2} + \Pst@geonodelabel{#2}% + \endgroup% +}% +% +%% \pstGeneralIParabolaDirectrixLine[Options](O){p}[rotation]{LA}{LB} +%% Draw the directrix line of the General Inversion Parabola P. +%% If you not input the rotation angle, the default value is $0^\circ$. +%% The node LA also lies on the symmetrical axis line, and node LB is another one on the directrix line. +%% they can be got after the orig nodes rotation $\theta$ about the vertex $O$, +%% please refer to the extension rotation formula \ref{ExtensionRotationTransformFormula}. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the parabola vertex O +%% #3 -> [input] the half of focal chord $p$ +%% #4 -> [input] the rotation angle $\theta$ of the symmetrical axis. +%% #5 -> [output] the first node LA on the directrix line. +%% #6 -> [output] the second node LB on the directrix line. +\def\pstGeneralIParabolaDirectrixLine{\@ifnextchar[\Pst@GeneralIParabolaDirectrixLine{\Pst@GeneralIParabolaDirectrixLine[]}} +\def\Pst@GeneralIParabolaDirectrixLine[#1](#2)#3{% + \begingroup + \@InitListMng % + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \def\pst@parabola@semifocalchord{#3}% + \@ifnextchar[\Pst@GeneralIParabolaDirectrixLine@i{\Pst@GeneralIParabolaDirectrixLine@i[0]}}% +\def\Pst@GeneralIParabolaDirectrixLine@i[#1]#2#3{% + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@parabola@semifocalchord\space 2 div % p/2 + 2 index 1 index sub 2 index 5 2 roll pop + #1 cos #1 sin % x y x0 y0 \cos\theta \sin\theta + 3 index 6 index 5 index sub 3 index mul add 5 index 4 index sub 2 index mul sub % x0+(x-x0)\cos\theta-(y-y0)\sin\theta + 3 index 7 index 6 index sub 3 index mul add 6 index 5 index sub 4 index mul add % y0+(x-x0)\sin\theta+(y-y0)\cos\theta + 8 2 roll pop pop pop pop pop pop + ){#2} + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@parabola@semifocalchord\space 2 div % p/2 + 2 index 1 index sub 2 index 1 add 5 2 roll pop + #1 cos #1 sin % x y x0 y0 \cos\theta \sin\theta + 3 index 6 index 5 index sub 3 index mul add 5 index 4 index sub 2 index mul sub % x0+(x-x0)\cos\theta-(y-y0)\sin\theta + 3 index 7 index 6 index sub 3 index mul add 6 index 5 index sub 4 index mul add % y0+(x-x0)\sin\theta+(y-y0)\cos\theta + 8 2 roll pop pop pop pop pop pop + ){#3} + \Pst@ManageParamList{#2}% + \Pst@ManageParamList{#3}% + \pstLineAB{#2}{#3} + \endgroup% +}% +% +%% \pstGeneralIParabolaLineInter[Options](O){p}[rotation]{A}{B}{C}{D} +%% Find the intersections C and D of line AB and the General Imversion Parabola P. +%% If you not input the rotation angle, the default value is $0^\circ$. +%% +%% Case 1. When line AB is vertical, i.e, $x_1=x_2$, we have +%% $$t^2\dfrac{\cos\theta}{2p}-t\sin\theta-(x_1-x_o)=0$$ +%% Case 1.1 When $\cos\theta=0$, we have $t=x_o-x_1$,and then +%% $$x_{C}=x_1,y_{C}=y_o+\dfrac{t^2}{2p}$$ +%% but D is not defined. +%% +%% Case 1.2 When $\cos\theta\neq0$, we have +%% $$t_{1,2}=\dfrac{p\sin\theta \pm \sqrt{p^2\sin^2\theta+2p(x_1-x_o)\cos\theta}}{\cos\theta}$$ +%% and then +%% $$x_{C,D}=x_1,y_{C,D}=y_o+t_{1,2}\sin\theta+\dfrac{t_{1,2}^2}{2p}\cos\theta$$ +%% +%% Case 2. When line AB is not vertical, we can represent the line AB as the following function: +%% $$y=kx+d$$ where $$k=\dfrac{y_2-y_1}{x_2-x_1}, d=\dfrac{x_2y_1-x_1y_2}{x_2-x_1}$$ +%% refer to equation (\ref{ParametricFunctionOfGeneralInversionParabola}), we have +%% $$ft^2+2pet-2pm=0$$ +%% where +%% $$m=kx_o-y_o+d,e=\cos\theta+k\sin\theta,f=\sin\theta-k\cos\theta$$ +%% +%% Case 2.1 When $f=0$, which gives $\sin\theta\neq0$ and $k=\dfrac{\sin\theta}{\cos\theta}$, +%% at this time, we have $t=m\cos\theta$, and then +%% $$x_{C}=x_o-t\sin\theta+t^2\dfrac{\cos\theta}{2p},y_{C}=y_o+t\cos\theta+t^2\dfrac{\sin\theta}{2p}$$ +%% but D is not defined. +%% Case 2.2 When $f\neq0$, we have +%% $$t_{1,2}=\dfrac{-pe\pm\sqrt{(pe)^2+2fmp}}{f}$$ +%% and then +%% $$x_{C,D}=x_o-t_{1,2}\sin\theta+t_{1,2}^2\dfrac{\cos\theta}{2p},y_{C,D}=y_o+t_{1,2}\cos\theta+t_{1,2}^2\dfrac{\sin\theta}{2p}$$ +%% Parameters: +%% #1 -> options +%% #2 -> [input] the parabola vertex O +%% #3 -> [input] the half of focal chord $p$ +%% #4 -> [input] the rotation angle $\theta$ of the symmetrical axis. +%% #5 -> [input] the node $A$ on the given line +%% #6 -> [input] the node $B$ on the given line +%% #7 -> [output] the first intersection node $C$ +%% #8 -> [output] the second intersection node $D$ +\def\pstGeneralIParabolaLineInter{\@ifnextchar[\Pst@GeneralIParabolaLineInter{\Pst@GeneralIParabolaLineInter[]}} +\def\Pst@GeneralIParabolaLineInter[#1](#2)#3{% + \begingroup + \@InitListMng % + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \def\pst@parabola@semifocalchord{#3}% + \@ifnextchar[\Pst@GeneralIParabolaLineInter@i{\Pst@GeneralIParabolaLineInter@i[0]}}% +\def\Pst@GeneralIParabolaLineInter@i[#1]#2#3#4#5{% + \pst@getcoor{#2}\pst@tempA% + \pst@getcoor{#3}\pst@tempB% + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempA \tx@UserCoor % x1,y1 + \pst@tempB \tx@UserCoor % x2,y2 + 3 index 2 index sub abs 1E-5 lt { % if the line AB is vertical + #1 dup cos exch sin % \cos\theta \sin\theta + 1 index abs 1E-5 lt { % like ZeroEq % if \cos\theta=0 + 7 index 6 index sub % t=x0-x1 + 7 index 1 index dup mul \pst@parabola@semifocalchord\space 2 mul div add % y=y_o+t^2/(2p) + 7 index exch 9 2 roll pop pop pop pop pop pop pop + } { + \pst@parabola@semifocalchord\space %p + 1 index 1 index mul % p\sin\theta + dup dup mul 2 index 2 mul 9 index 12 index sub mul 5 index mul add % p^2\sin^2\theta+2p(x_1-x_o)\cos\theta + dup 0 lt { + pop pop pop pop pop + pop pop pop pop pop + pop 0 0 + } { + sqrt 1 index exch sub 4 index div % t_1 + 9 index 1 index 6 index mul add 1 index dup mul 4 index 2 mul div 5 index mul add % y_1 + 9 index exch 11 2 roll pop pop pop pop + pop pop pop pop pop + } ifelse + } ifelse + } { + 0 index 3 index sub 2 index 5 index sub div % k + 2 index 4 index mul 2 index 6 index mul sub 3 index 6 index sub div % d + \pst@parabola@semifocalchord\space %p + 2 index 9 index mul 8 index sub 2 index add % m=kx_o-y_o+d + #1 dup cos exch sin % \cos\theta \sin\theta + 5 index 1 index mul 2 index add % e=k\sin\theta+\cos\theta + 6 index 3 index mul 2 index exch sub % f=\sin\theta-k\cos\theta + dup abs 1E-5 lt { % like ZeroEq + 4 index 4 index mul % t=m\cos\theta + 14 index 1 index 5 index mul sub 1 index dup mul 8 index 2 mul div 6 index mul add % x_1 + 14 index 2 index 7 index mul add 2 index dup mul 9 index 2 mul div 6 index mul add % y_1 + 17 2 roll pop pop pop pop pop pop + pop pop pop pop pop pop + pop pop pop + } { + 5 index 2 index mul % pe + dup dup mul 2 index 7 index mul 8 index 2 mul mul add % (pe)^2+2fmp + dup 0 lt { + pop pop pop pop pop pop pop pop pop pop + pop pop pop pop pop pop 0 0 + } { + sqrt 1 index add neg 2 index div % t_1 + 15 index 1 index 6 index mul sub 1 index dup mul 9 index 2 mul div 7 index mul add % x_1 + 15 index 2 index 8 index mul add 2 index dup mul 10 index 2 mul div 7 index mul add % y_1 + 18 2 roll pop pop pop pop pop pop + pop pop pop pop pop pop + pop pop pop pop + } ifelse + } ifelse + } ifelse + ){#4} + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempA \tx@UserCoor % x1,y1 + \pst@tempB \tx@UserCoor % x2,y2 + 3 index 2 index sub abs 1E-5 lt { % if the line AB is vertical + #1 dup cos exch sin % \cos\theta \sin\theta + 1 index abs 1E-5 lt { % like ZeroEq % if \cos\theta=0 + pop pop pop pop pop pop pop pop 0 0 + } { + \pst@parabola@semifocalchord\space %p + 1 index 1 index mul % p\sin\theta + dup dup mul 2 index 2 mul 9 index 12 index sub mul 5 index mul add % p^2\sin^2\theta+2p(x_1-x_o)\cos\theta + dup 0 lt { + pop pop pop pop pop + pop pop pop pop pop + pop 0 0 + } { + sqrt 1 index add 4 index div % t_2 + 9 index 1 index 6 index mul add 1 index dup mul 4 index 2 mul div 5 index mul add % y_2 + 9 index exch 11 2 roll pop pop pop pop + pop pop pop pop pop + } ifelse + } ifelse + } { + 0 index 3 index sub 2 index 5 index sub div % k + 2 index 4 index mul 2 index 6 index mul sub 3 index 6 index sub div % d + \pst@parabola@semifocalchord\space %p + 2 index 9 index mul 8 index sub 2 index add % m=kx_o-y_o+t + #1 dup cos exch sin % \cos\theta \sin\theta + 5 index 1 index mul 2 index add % e=k\sin\theta+\cos\theta + 6 index 3 index mul 2 index exch sub % f=\sin\theta-k\cos\theta + dup abs 1E-5 lt { % like ZeroEq + pop pop pop pop pop pop pop + pop pop pop pop pop pop pop + 0 0 + } { + 5 index 2 index mul % pe + dup dup mul 2 index 7 index mul 8 index 2 mul mul add % (pe)^2+2fmp + dup 0 lt { + pop pop pop pop pop pop pop pop pop pop + pop pop pop pop pop pop 0 0 + } { + sqrt 1 index sub 2 index div % t_2 + 15 index 1 index 6 index mul sub 1 index dup mul 9 index 2 mul div 7 index mul add % x_2 + 15 index 2 index 8 index mul add 2 index dup mul 10 index 2 mul div 7 index mul add % y_2 + 18 2 roll pop pop pop pop pop pop + pop pop pop pop pop pop + pop pop pop pop + } ifelse + } ifelse + } ifelse + ){#5} + \Pst@ManageParamList{#4}% + \Pst@ManageParamList{#5}% + \endgroup% +}% +% +%% \pstGeneralIParabolaPolarNode[Options](O){p}[rotation](F)[L1][L2]{A}{B}{T} +%% Find the polar point of chord AB on General Inversion Parabola P. +%% If you not input the rotation angle, the default value is $0^\circ$. +%% We use the following proposition to find the polar point of chord AB: +%% Give any chord AB, drawing two focal chord AFC and BFD, where F is the focus, then drawing FX which is perpendicular to AFC at point F, and intersect with the directrix line at X; also drawing FY which is perpendicular to BFD at point F, and intersect with the directrix line at Y. Then the intersection T of AX and BY is the polar point of chord AB. +%% If you don't know the focus F, or the directrix line, we will find them automated, otherwise you can pass them to this macro. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the parabola vertex O +%% #3 -> [input] the half of focal chord $p$ +%% #4 -> [input] the rotation angle $\theta$ of the symmetrical axis. +%% #5 -> [input] optional, the focus node/coordinate F of the parabola. +%% #6 -> [input] optional, the node/coordinate L1 on the directrix line of the parabola. +%% #7 -> [input] optional, the node/coordinate L2 on the directrix line of the parabola. +%% #8 -> [input] the node A on the parabola. +%% #9 -> [input] the node B on the parabola. +%% #10 -> [output] the polar node T of chord AB. +\def\pstGeneralIParabolaPolarNode{\@ifnextchar[\Pst@GeneralIParabolaPolarNode{\Pst@GeneralIParabolaPolarNode[]}} +\def\Pst@GeneralIParabolaPolarNode[#1](#2)#3{% + \begingroup + \psset{#1}% + \def\pst@generalparabola@vertex{#2}% + \def\pst@generalparabola@semifocalchord{#3}% + \@ifnextchar[\Pst@GeneralIParabolaPolarNode@i{\Pst@GeneralIParabolaPolarNode@i[0]}}% +\def\Pst@GeneralIParabolaPolarNode@i[#1]{% + \def\pst@generalparabola@gradientangle{#1}% + \@ifnextchar(\Pst@GeneralIParabolaPolarNode@j{\Pst@GeneralIParabolaPolarNode@k}}% +\def\Pst@GeneralIParabolaPolarNode@j(#1){% + \def\pst@generalparabola@focus{#1}% + \@ifnextchar[\Pst@GeneralIParabolaPolarNode@jj{\Pst@GeneralIParabolaPolarNode@kk}}% +\def\Pst@GeneralIParabolaPolarNode@k{% + \pstGeneralIParabolaFocusNode[PointName=none,PointSymbol=none](\pst@generalparabola@vertex){\pst@generalparabola@semifocalchord}[\pst@generalparabola@gradientangle]{@PST@GENERALIPARABOLA@FOCUS} + \Pst@GeneralIParabolaPolarNode@j(@PST@GENERALIPARABOLA@FOCUS)}% +\def\Pst@GeneralIParabolaPolarNode@kk{% + \pstGeneralIParabolaDirectrixLine[linestyle=none,PointName=none,PointSymbol=none](\pst@generalparabola@vertex){\pst@generalparabola@semifocalchord}[\pst@generalparabola@gradientangle]{@PST@GENERALIPARABOLA@DIRECTRIXLINEA}{@PST@GENERALIPARABOLA@DIRECTRIXLINEB} + \Pst@GeneralIParabolaPolarNode@jj[@PST@GENERALIPARABOLA@DIRECTRIXLINEA][@PST@GENERALIPARABOLA@DIRECTRIXLINEB]}% +\def\Pst@GeneralIParabolaPolarNode@jj[#1][#2]#3#4#5{% + \pstGeneralIParabolaLineInter[PointName=none,PointSymbol=none,linestyle=none](\pst@generalparabola@vertex){\pst@generalparabola@semifocalchord}[\pst@generalparabola@gradientangle]{#3}{\pst@generalparabola@focus}{@PST@GENERALIPARABOLA@FOCALCHORDAFC@A}{@PST@GENERALIPARABOLA@FOCALCHORDAFC@C} + \pstGeneralIParabolaLineInter[PointName=none,PointSymbol=none,linestyle=none](\pst@generalparabola@vertex){\pst@generalparabola@semifocalchord}[\pst@generalparabola@gradientangle]{#4}{\pst@generalparabola@focus}{@PST@GENERALIPARABOLA@FOCALCHORDBFD@B}{@PST@GENERALIPARABOLA@FOCALCHORDBFD@D} + \pstRotation[PointName=none,PointSymbol=none,RotAngle=90]{\pst@generalparabola@focus}{@PST@GENERALIPARABOLA@FOCALCHORDAFC@A}[@PST@GENERALIPARABOLA@FOCALCHORDAFC@AA] + \pstRotation[PointName=none,PointSymbol=none,RotAngle=90]{\pst@generalparabola@focus}{@PST@GENERALIPARABOLA@FOCALCHORDBFD@B}[@PST@GENERALIPARABOLA@FOCALCHORDBFD@BB] + \pstInterLL[PointName=none,PointSymbol=none]{#1}{#2}{\pst@generalparabola@focus}{@PST@GENERALIPARABOLA@FOCALCHORDAFC@AA}{@PST@GENERALIPARABOLA@FOCALCHORD@X} + \pstInterLL[PointName=none,PointSymbol=none]{#1}{#2}{\pst@generalparabola@focus}{@PST@GENERALIPARABOLA@FOCALCHORDBFD@BB}{@PST@GENERALIPARABOLA@FOCALCHORD@Y} + \pstInterLL{#3}{@PST@GENERALIPARABOLA@FOCALCHORD@X}{#4}{@PST@GENERALIPARABOLA@FOCALCHORD@Y}{#5} + \Pst@geonodelabel{#5}% + \pstLineAB{#3}{#5} + \pstLineAB{#4}{#5} + \endgroup +}% +% +%% \pstGeneralIParabolaTangentNode[Options](O){p}[rotation]{T}{A}{B} +%% Draw the two tangent lines through the point $T$ to the General Inversion Parabola P and get the node A and B on the General Inversion Parabola. +%% We use the following proposition to find the tangent node of T: +%% Give point T outside of the parabola, we draw any other two chords TPQ and TRS, PS and QR intersect at I, PR and QS intersect at X, XI and GeneralIParabola intersect at A and B, then TA is the tangent line through A and TB is the tangent line through B. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the parabola vertex O +%% #3 -> [input] the half of focal chord $p$ +%% #4 -> [input] the rotation angle $\theta$ of the symmetrical axis. +%% #5 -> [input] the given node T outside the parabola +%% #6 -> [output] the tangent node name A on the parabola +%% #7 -> [output] the tangent node name B on the parabola +\def\pstGeneralIParabolaTangentNode{\@ifnextchar[\Pst@GeneralIParabolaTangentNode{\Pst@GeneralIParabolaTangentNode[]}} +\def\Pst@GeneralIParabolaTangentNode[#1](#2)#3{% + \begingroup + \@InitListMng % + \psset{#1}% + \def\pst@generalparabola@vertex{#2}% + \def\pst@generalparabola@semifocalchord{#3}% + \@ifnextchar[\Pst@GeneralIParabolaTangentNode@i{\Pst@GeneralIParabolaTangentNode@i[0]}}% +\def\Pst@GeneralIParabolaTangentNode@i[#1]#2#3#4{% + \pstGeneralIParabolaAbsNode[PointName=none,PointSymbol=none](\pst@generalparabola@vertex){\pst@generalparabola@semifocalchord}[#1]{\pstAbscissa{#2} \pstAbscissa{\pst@generalparabola@vertex} le {\pstAbscissa{\pst@generalparabola@vertex} \pst@generalparabola@semifocalchord\space abs 2 div add}{\pstAbscissa{\pst@generalparabola@vertex} \pst@generalparabola@semifocalchord\space abs 2 div sub} ifelse}{@PST@GENERALIPARABOLA@TANGENTAUX@P0}{@PST@GENERALIPARABOLA@TANGENTAUX@P1} + \pstGeneralIParabolaAbsNode[PointName=none,PointSymbol=none](\pst@generalparabola@vertex){\pst@generalparabola@semifocalchord}[#1]{\pstAbscissa{#2} \pstAbscissa{\pst@generalparabola@vertex} le {\pstAbscissa{\pst@generalparabola@vertex} \pst@generalparabola@semifocalchord\space abs 4 div add}{\pstAbscissa{\pst@generalparabola@vertex} \pst@generalparabola@semifocalchord\space abs 4 div sub} ifelse}{@PST@GENERALIPARABOLA@TANGENTAUX@R0}{@PST@GENERALIPARABOLA@TANGENTAUX@R1} + \pstGeneralIParabolaLineInter[PointName=none,PointSymbol=none](\pst@generalparabola@vertex){\pst@generalparabola@semifocalchord}[#1]{#2}{@PST@GENERALIPARABOLA@TANGENTAUX@P0}{@PST@GENERALIPARABOLA@TANGENTAUX@P}{@PST@GENERALIPARABOLA@TANGENTAUX@Q} + \pstGeneralIParabolaLineInter[PointName=none,PointSymbol=none](\pst@generalparabola@vertex){\pst@generalparabola@semifocalchord}[#1]{#2}{@PST@GENERALIPARABOLA@TANGENTAUX@R0}{@PST@GENERALIPARABOLA@TANGENTAUX@R}{@PST@GENERALIPARABOLA@TANGENTAUX@S} + \pstInterLL[PointName=none,PointSymbol=none]{@PST@GENERALIPARABOLA@TANGENTAUX@P}{@PST@GENERALIPARABOLA@TANGENTAUX@S}{@PST@GENERALIPARABOLA@TANGENTAUX@Q}{@PST@GENERALIPARABOLA@TANGENTAUX@R}{@PST@GENERALIPARABOLA@TANGENTAUX@I} + \pstInterLL[PointName=none,PointSymbol=none]{@PST@GENERALIPARABOLA@TANGENTAUX@P}{@PST@GENERALIPARABOLA@TANGENTAUX@R}{@PST@GENERALIPARABOLA@TANGENTAUX@Q}{@PST@GENERALIPARABOLA@TANGENTAUX@S}{@PST@GENERALIPARABOLA@TANGENTAUX@X} + \pstGeneralIParabolaLineInter(\pst@generalparabola@vertex){\pst@generalparabola@semifocalchord}[#1]{@PST@GENERALIPARABOLA@TANGENTAUX@X}{@PST@GENERALIPARABOLA@TANGENTAUX@I}{#3}{#4} + \Pst@ManageParamList{#3}% + \Pst@ManageParamList{#4}% + \pstLineAB{#2}{#3} + \pstLineAB{#2}{#4} + \endgroup% +}% +% +% +% 7. Standard Hyperbola with coordinate translation +%% ---------------------------------------------------------- +%% The Standard Hyperbola H is defined by center O, the half of the real axis $a$, the half of the imaginary axis $b$. +%% The equation can be written as: +%% \begin{equation}\label{FunctionOfStandardHyperbola} +%% \dfrac{(x-x0)^2}{a^2}-\dfrac{(y-y0)^2}{b^2}=1 +%% \end{equation} +%% and the parametric function can be written as: +%% \begin{equation}\label{ParametricFunctionOfStandardHyperbola} +%% \left\{\begin{array}{l} +%% x=a\sec\alpha+x_o\\ +%% y=b\tan\alpha+y_o +%% \end{array}\right. +%% \end{equation} +% +%% \pstHyperbola[Options](O)(a,b)[maxAngleX] +%% Draw a Hyperbola with center O, the half of the real axis $abs(a)$, and the half of the imaginary axis $abs(b)$. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the hyperbola center O +%% #3 -> [input] the radii of real and imaginary axis +%% #4 -> [input] the maximal angle to draw the branch. +\def\pstHyperbola{\@ifnextchar[\Pst@Hyperbola{\Pst@Hyperbola[]}} +\def\Pst@Hyperbola[#1](#2)(#3){% + \begingroup + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pst@getcoor{#3}\pst@tempR% + \@ifnextchar[\Pst@Hyperbola@i{\Pst@Hyperbola@i[85]}}% +\def\Pst@Hyperbola@i[#1]{% + \pst@cnth=#1\pst@cntg=180\pst@cntm=180\pst@cntn=360 + \ifnum\pst@cnth<0 + \loop\advance\pst@cnth by 90 + \ifnum\pst@cnth<0 + \repeat + \fi + \ifnum\pst@cnth>90 + \loop\advance\pst@cnth by -90 + \ifnum\pst@cnth>90 + \repeat + \fi + \ifnum\pst@cnth>85 + \advance\pst@cnth by -5 + \fi + \advance\pst@cntg by -\pst@cnth + \advance\pst@cntm by \pst@cnth + \advance\pst@cntn by -\pst@cnth + \Pst@Hyperbola@ii[0][\number\pst@cnth]% + \Pst@Hyperbola@ii[\number\pst@cntg][180]% + \Pst@Hyperbola@ii[180][\number\pst@cntm]% + \Pst@Hyperbola@ii[\number\pst@cntn][360]% + \endgroup% +}% +\def\Pst@Hyperbola@ii[#1][#2]{% + \parametricplot{#1}{#2}{% + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + t dup cos exch sin % cos{t} sin{t} + 1 index abs 1E-5 lt { + pop pop pop pop + } { + 5 index 4 index 3 index div add % x0+a\sec{t} + 5 index 4 index 3 index mul 4 index div add % y0+b\tan{t} + 8 2 roll pop pop pop pop pop pop + } ifelse + }% +}% +% +%% \pstHyperbolaNode[Options](O)(a,b){t}{P} +%% Create a new node P on the Hyperbola E whose parameter is the given value $t$. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the hyperbola center O +%% #3 -> [input] the radii of real and imaginary axis +%% #4 -> [input] the parametric argument t. +%% #5 -> [output] the target node name. +\def\pstHyperbolaNode{\@ifnextchar[\Pst@HyperbolaNode{\Pst@HyperbolaNode[]}} +\def\Pst@HyperbolaNode[#1](#2)(#3)#4#5{% + \begingroup + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pst@getcoor{#3}\pst@tempR% + \pnode(! + \pst@tempO \tx@UserCoor % x_o,y_o + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + #4 dup cos exch sin % cos{t} sin{t} + 1 index abs 1E-5 lt { + pop pop pop pop + }{ + 5 index 4 index 3 index div add % x0+a\sec{t} + 5 index 4 index 3 index 5 index div mul add % y0+b\tan{t} + } ifelse + 8 2 roll pop pop pop pop pop pop + ){#5}% + \Pst@geonodelabel{#5}% + \endgroup% +}% +% +%% \pstHyperbolaAbsNode[Options](O)(a,b){x_1}{A}{B} +%% Create a new node P on the Hyperbola E whose abscissa is the given value $x_1$. +%% when $x=x_1$, we have +%% $$\dfrac{(x_1-x_0)^2}{a^2}-\dfrac{(y-y_0)^2}{b^2}=1$$ +%% $$(y-y_0)^2=\dfrac{b^2(x_1-x_0)^2-a^2b^2}{a^2}$$ +%% $$y=y_0\pm\dfrac{b}{a}\sqrt{(x_1-x_0)^2-a^2}$$ +%% Parameters: +%% #1 -> options +%% #2 -> [input] the hyperbola center O +%% #3 -> [input] the radii of real and imaginary axis +%% #4 -> [input] the abbscissa value $x_1$. +%% #5 -> [output] the first target node name. +%% #6 -> [output] the first second node name. +\def\pstHyperbolaAbsNode{\@ifnextchar[\Pst@HyperbolaAbsNode{\Pst@HyperbolaAbsNode[]}} +\def\Pst@HyperbolaAbsNode[#1](#2)(#3)#4#5#6{% + \begingroup + \@InitListMng % + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pst@getcoor{#3}\pst@tempR% + \pnode(! + \pst@tempO \tx@UserCoor % x_o,y_o + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + #4 4 index sub dup mul 2 index dup mul sub % (x_1-x_0)^2-a^2 + dup 0 lt { + pop pop pop pop pop 0 0 + } { + sqrt 1 index mul 2 index div 3 index exch sub % y1 + #4 exch 6 2 roll pop pop pop pop + } ifelse + ){#5}% + \pnode(! + \pst@tempO \tx@UserCoor % x_o,y_o + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + #4 4 index sub dup mul 2 index dup mul sub % (x_1-x_0)^2-a^2 + dup 0 lt { + pop pop pop pop pop 0 0 + } { + sqrt 1 index mul 2 index div 3 index add % y2 + #4 exch 6 2 roll pop pop pop pop + } ifelse + ){#6}% + \Pst@ManageParamList{#5}% + \Pst@ManageParamList{#6}% + \endgroup% +}% +% +%% \pstHyperbolaOrdNode[Options](O)(a,b){y_1}{A}{B} +%% Create a new node P on the Hyperbola E whose ordinate is the given value $y_1$. +%% when $y=y_1$, we have +%% $$\dfrac{(x-x_0)^2}{a^2}-\dfrac{(y_1-y_0)^2}{b^2}=1$$ +%% $$(x-x_0)^2=\dfrac{a^2(y_1-y_0)^2+a^2b^2}{b^2}$$ +%% $$x=x_0\pm\dfrac{a}{b}\sqrt{(y_1-y_0)^2+b^2}$$ +%% Parameters: +%% #1 -> options +%% #2 -> [input] the hyperbola center O +%% #3 -> [input] the radii of real and imaginary axis +%% #4 -> [input] the ordinate value $y_1$. +%% #5 -> [output] the first target node name. +%% #6 -> [output] the first second node name. +\def\pstHyperbolaOrdNode{\@ifnextchar[\Pst@HyperbolaOrdNode{\Pst@HyperbolaOrdNode[]}} +\def\Pst@HyperbolaOrdNode[#1](#2)(#3)#4#5#6{% + \begingroup + \@InitListMng % + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pst@getcoor{#3}\pst@tempR% + \pnode(! + \pst@tempO \tx@UserCoor % x_o,y_o + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + #4 3 index sub dup mul 1 index dup mul add % (y_1-y_0)^2+b^2 + sqrt 2 index mul 1 index div 4 index exch sub % x1 + #4 6 2 roll pop pop pop pop + ){#5}% + \pnode(! + \pst@tempO \tx@UserCoor % x_o,y_o + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + #4 3 index sub dup mul 1 index dup mul add % (y_1-y_0)^2+b^2 + sqrt 2 index mul 1 index div 4 index add % x2 + #4 6 2 roll pop pop pop pop + ){#6}% + \Pst@ManageParamList{#5}% + \Pst@ManageParamList{#6}% + \endgroup% +}% +% +%% \pstHyperbolaFocusNode[Options](O)(a,b){F1}{F2} +%% Create the two focus node F1 and F2 of the Hyperbola H. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the hyperbola center O +%% #3 -> [input] the radii of real and imaginary axis +%% #4 -> [output] the first focus node name. +%% #5 -> [output] the first focus node name. +\def\pstHyperbolaFocusNode{\@ifnextchar[\Pst@HyperbolaFocusNode{\Pst@HyperbolaFocusNode[]}} +\def\Pst@HyperbolaFocusNode[#1](#2)(#3)#4#5{% + \begingroup + \@InitListMng % + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pst@getcoor{#3}\pst@tempR% + \pnode(! + \pst@tempO \tx@UserCoor % x_o,y_o + \pst@tempR \tx@UserCoor % a,b + dup mul exch dup mul add sqrt % c + 2 index exch sub 1 index % x0-c,y0 + 4 2 roll pop pop + ){#4}% + \pnode(! + \pst@tempO \tx@UserCoor % x_o,y_o + \pst@tempR \tx@UserCoor % a,b + dup mul exch dup mul add sqrt % c + 2 index add 1 index % x0+c,y0 + 6 2 roll pop pop pop pop + ){#5}% + \Pst@ManageParamList{#4}% + \Pst@ManageParamList{#5}% + \endgroup% +}% +% +%% \pstHyperbolaDirectrixLine[Options](O)(a,b){Lx}{Ly}{Rx}{Ry} +%% Draw the two directrix lines L1 and L2 of the Hyperbola H. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the hyperbola center O +%% #3 -> [input] the radii of real and imaginary axis +%% #4 -> [output] the first node name on the first directrix line. +%% #5 -> [output] the second node name on the first directrix line. +%% #6 -> [output] the first node name on the second directrix line. +%% #7 -> [output] the second node name on the second directrix line. +\def\pstHyperbolaDirectrixLine{\@ifnextchar[\Pst@HyperbolaDirectrixLine{\Pst@HyperbolaDirectrixLine[]}} +\def\Pst@HyperbolaDirectrixLine[#1](#2)(#3)#4#5#6#7{% + \begingroup + \@InitListMng % + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pst@getcoor{#3}\pst@tempR% + \pnode(! + \pst@tempO \tx@UserCoor % x_o,y_o + \pst@tempR \tx@UserCoor % a,b + 1 index dup mul dup 2 index dup mul add sqrt div % a^2/c + 4 index exch sub 3 index % x0-a^2/c,y0 + 6 2 roll pop pop pop pop + ){#4}% + \pnode(! + \pst@tempO \tx@UserCoor % x_o,y_o + \pst@tempR \tx@UserCoor % a,b + 1 index dup mul dup 2 index dup mul add sqrt div % a^2/c + 4 index exch sub 3 index 1 add % x0-a^2/c,y0+1 + 6 2 roll pop pop pop pop + ){#5}% + \pnode(! + \pst@tempO \tx@UserCoor % x_o,y_o + \pst@tempR \tx@UserCoor % a,b + 1 index dup mul dup 2 index dup mul add sqrt div % a^2/c + 4 index add 3 index % x0+a^2/c,y0 + 6 2 roll pop pop pop pop + ){#6}% + \pnode(! + \pst@tempO \tx@UserCoor % x_o,y_o + \pst@tempR \tx@UserCoor % a,b + 1 index dup mul dup 2 index dup mul add sqrt div % a^2/c + 4 index add 3 index 1 add % x0+a^2/c,y0+1 + 6 2 roll pop pop pop pop + ){#7}% + \Pst@ManageParamList{#4}% + \Pst@ManageParamList{#5}% + \Pst@ManageParamList{#6}% + \Pst@ManageParamList{#7}% + \pstLineAB{#4}{#5}% + \pstLineAB{#6}{#7}% + \endgroup% +}% +% +%% \pstHyperbolaAsymptoteLine[Options](O)(a,b){L1}{L2} +%% Draw the two asymptote lines L1 and L2 of the Hyperbola H. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the hyperbola center O +%% #3 -> [input] the radii of real and imaginary axis +%% #4 -> [output] the second node name on the first asymptote line, the first node is the center O. +%% #5 -> [output] the second node name on the second asymptote line, the first node is the center O. +\def\pstHyperbolaAsymptoteLine{\@ifnextchar[\Pst@HyperbolaAsymptoteLine{\Pst@HyperbolaAsymptoteLine[]}} +\def\Pst@HyperbolaAsymptoteLine[#1](#2)(#3)#4#5{% + \begingroup + \@InitListMng % + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pst@getcoor{#3}\pst@tempR% + \pnode(! + \pst@tempO \tx@UserCoor % x_o,y_o + \pst@tempR \tx@UserCoor % a,b + 0 index 2 index div % b/a + 4 index 1 add % x=x0+1 + 4 index 2 index add % y=y0+b/a + 7 2 roll pop pop pop pop pop + ){#4}% + \pnode(! + \pst@tempO \tx@UserCoor % x_o,y_o + \pst@tempR \tx@UserCoor % a,b + 0 index 2 index div % b/a + 4 index 1 add % x=x0+1 + 4 index 2 index sub % y=y0-b/a + 7 2 roll pop pop pop pop pop + ){#5}% + \Pst@ManageParamList{#4}% + \Pst@ManageParamList{#5}% + \pstLineAB{#2}{#4}% + \pstLineAB{#2}{#5}% + \endgroup% +}% +% +%% \pstHyperbolaLineInter[Options](O)(a,b){A}{B}{C}{D} +%% Find the two intersection nodes C and D of the Hyperbola H and line AB. +%% +%% Case 1. When line AB is vertical, i.e, $x_1=x_2$, we have +%% $$y=y_0\pm\dfrac{b}{a}\sqrt{(x_1-x_0)^2-a^2}$$ +%% +%% Case 2. When line AB is not vertical, we can represent the line AB as the following function: +%% $$y=kx+d$$ where $$k=\dfrac{y_2-y_1}{x_2-x_1}, d=\dfrac{x_2y_1-x_1y_2}{x_2-x_1}$$ +%% refer to equation (\ref{FunctionOfStandardHyperbola}), we have +%% $$(b^2-k^2a^2)X^2-2a^2kmX-a^2(m^2+b^2)=0$$ +%% $$Y=kX+m$$ +%% where +%% $$m=kx_o-y_o+d,X=x-x_0,Y=y-y_0$$ +%% +%% Case 2.1 When $b^2-k^2a^2=0$, which gives $k=\pm\dfrac{b}{a}\neq0$, +%% at this time, when $m=0$, the line AB becomes the asymptote of the hyperbola, +%% so there is none intersection any more; else we have +%% $$x_{C}=x_o-\dfrac{m^2+b^2}{2km},y_{C}=kx_{C}+d$$ +%% but D is not defined. +%% +%% Case 2.2 When $b^2-k^2a^2\neq0$, we have +%% $$x_{C,D}=x_0+\dfrac{a^2km\pm{}ab\sqrt{m^2+b^2-k^2a^2}}{b^2-k^2a^2},y_{C,D}=kx_{C,D}+d$$ +%% +%% Parameters: +%% #1 -> options +%% #2 -> [input] the hyperbola center O +%% #3 -> [input] the radii of real and imaginary axis +%% #4 -> [input] the first node name on the given line AB. +%% #5 -> [input] the second node name on the given line AB. +%% #6 -> [output] the first intersection node. +%% #7 -> [output] the second intersection node. +\def\pstHyperbolaLineInter{\@ifnextchar[\Pst@HyperbolaLineInter{\Pst@HyperbolaLineInter[]}} +\def\Pst@HyperbolaLineInter[#1](#2)(#3)#4#5#6#7{% + \begingroup + \@InitListMng % + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pst@getcoor{#3}\pst@tempR% + \pst@getcoor{#4}\pst@tempA% + \pst@getcoor{#5}\pst@tempB% + \pnode(! + \pst@tempO \tx@UserCoor % x_o,y_o + \pst@tempR \tx@UserCoor % a,b + \pst@tempA \tx@UserCoor % x_1,y_1 + \pst@tempB \tx@UserCoor % x_2,y_2 + 3 index 2 index sub abs 1E-5 lt { % if the line AB is vertical + %% $$y=y_0\pm\dfrac{b}{a}\sqrt{(x_1-x_0)^2-a^2}$$ + 3 index 8 index sub dup mul 6 index dup mul sub + dup 0 lt { + pop pop pop pop pop pop pop pop pop + 0 0 + } { + sqrt 5 index mul 6 index div 7 index exch sub % y1 + 4 index exch % x1 + 10 2 roll pop pop pop pop pop pop pop pop + } ifelse + } { + 0 index 3 index sub 2 index 5 index sub div % k + 2 index 4 index mul 2 index 6 index mul sub 3 index 6 index sub div % d + 1 index 10 index mul 9 index sub 1 index add % m=kx_o-y_o+d + 7 index dup mul 9 index 4 index mul dup mul sub % b^2-k^2a^2 + 0 index abs 1E-5 lt { + 1 index abs 1E-5 lt { + pop pop pop pop pop pop + pop pop pop pop pop pop + 0 0 + } { + %% $$x_{C}=x_o-\dfrac{m^2+b^2}{2km},y_{C}=kx_{C}+d$$ + 1 index dup mul 9 index dup mul add 2 index 5 index mul 2 mul div % (m^2+b^2)/2km + 12 index exch sub % x1 + 4 index 1 index mul 4 index add % y1 + 14 2 roll pop pop pop pop pop pop + pop pop pop pop pop pop + } ifelse + } { + 1 index dup mul 1 index add % m^2+b^2-k^2a^2 + dup 0 lt { + pop pop pop pop pop pop pop + pop pop pop pop pop pop 0 0 + } { + sqrt 10 index mul 9 index mul 10 index dup mul 5 index mul 3 index mul exch sub 1 index div 12 index add % x1 + 4 index 1 index mul 4 index add % y1 + 14 2 roll pop pop pop pop pop pop + pop pop pop pop pop pop + } ifelse + } ifelse + } ifelse + ){#6}% + \pnode(! + \pst@tempO \tx@UserCoor % x_o,y_o + \pst@tempR \tx@UserCoor % a,b + \pst@tempA \tx@UserCoor % x_1,y_1 + \pst@tempB \tx@UserCoor % x_2,y_2 + 3 index 2 index sub abs 1E-5 lt { % if the line AB is vertical + %% $$y=y_0\pm\dfrac{b}{a}\sqrt{(x_1-x_0)^2-a^2}$$ + 3 index 8 index sub dup mul 6 index dup mul sub + dup 0 lt { + pop pop pop pop pop pop pop pop + 0 0 + } { + sqrt 5 index mul 6 index div 7 index add % y2 + 4 index exch % x2 + 10 2 roll pop pop pop pop pop pop pop pop + } ifelse + } { + 0 index 3 index sub 2 index 5 index sub div % k + 2 index 4 index mul 2 index 6 index mul sub 3 index 6 index sub div % d + 1 index 10 index mul 9 index sub 1 index add % m=kx_o-y_o+d + 7 index dup mul 9 index dup mul 4 index dup mul mul sub % b^2-k^2a^2 + dup abs 1E-5 lt { + pop pop pop pop pop pop + pop pop pop pop pop pop + 0 0 + } { + 1 index dup mul 1 index add % m^2+b^2-k^2a^2 + dup 0 lt { + pop pop pop pop pop pop pop + pop pop pop pop pop pop 0 0 + } { + sqrt 10 index mul 9 index mul 10 index dup mul 5 index mul 3 index mul add 1 index div 12 index add % x2 + 4 index 1 index mul 4 index add % y2 + 14 2 roll pop pop pop pop pop pop + pop pop pop pop pop pop + } ifelse + } ifelse + } ifelse + ){#7}% + \Pst@ManageParamList{#6}% + \Pst@ManageParamList{#7}% + \endgroup% +}% +% +%% \pstHyperbolaPolarNode[Options](O)(a,b){A}{B}{T} +%% Find the polar point of chord AB on hyperbola H. +%% We use the following proposition to find the polar point of chord AB: +%% Let $P$, $Q$ are vertex points of the hyperbola, for any chord $AB$ of hyperbola, $PA$ and $BQ$ intersect at $E$, $PB$ and $AQ$ intersect at $F$, then the middle point $M$ of $EF$ is the polar point of chord $AB$. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the hyperbola center O +%% #3 -> [input] the radii of real and imaginary axis +%% #4 -> [input] the node A on the hyperbola. +%% #5 -> [input] the node B on the hyperbola. +%% #6 -> [output] the polar node T of chord AB. +\def\pstHyperbolaPolarNode{\@ifnextchar[\Pst@HyperbolaPolarNode{\Pst@HyperbolaPolarNode[]}} +\def\Pst@HyperbolaPolarNode[#1](#2)(#3)#4#5#6{% + \begingroup + \psset{#1}% + \pstHyperbolaOrdNode[PointName=none,PointSymbol=none](#2)(#3){\pstOrdinate{#2}}{@PST@HYPERBOLA@VERTEXA}{@PST@HYPERBOLA@VERTEXB} + \pstInterLL[PointName=none,PointSymbol=none]{#4}{@PST@HYPERBOLA@VERTEXA}{#5}{@PST@HYPERBOLA@VERTEXB}{@PST@HYPERBOLA@INTER@X} + \pstInterLL[PointName=none,PointSymbol=none]{#5}{@PST@HYPERBOLA@VERTEXA}{#4}{@PST@HYPERBOLA@VERTEXB}{@PST@HYPERBOLA@INTER@Y} + \pstMiddleAB{@PST@HYPERBOLA@INTER@X}{@PST@HYPERBOLA@INTER@Y}{#6} + \Pst@geonodelabel{#6}% + \pstLineAB{#4}{#6} + \pstLineAB{#5}{#6} + \endgroup +}% +% +%% \pstHyperbolaTangentNode[Options](O)(a,b){T}{A}{B} +%% Draw the two tangent lines through the point $T$ to the Hyperbola H and get the node A and B on the Hyperbola. +%% We use the following proposition to find the tangent points $A$ and $B$ of $T$: +%% Let $T$ is a point out of the hyperbola, we give any two chords $TPQ$ and $TRS$ of the hyperbola, $PR$ and $QS$ intersect at $X$, $RQ$ and $PS$ intersect at $Y$, +%% then the intersection point $A$ and $B$ of $XY$ and the hyperbola are the tangent points from $T$. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the hyperbola center O +%% #3 -> [input] the radii of real and imaginary axis +%% #4 -> [input] the given node T outside the hyperbola +%% #5 -> [output] the tangent node name A on the hyperbola +%% #6 -> [output] the tangent node name B on the hyperbola +\def\pstHyperbolaTangentNode{\@ifnextchar[\Pst@HyperbolaTangentNode{\Pst@HyperbolaTangentNode[]}} +\def\Pst@HyperbolaTangentNode[#1](#2)(#3)#4#5#6{% + \begingroup + \@InitListMng % + \psset{#1}% + \pstHyperbolaOrdNode[PointName=none,PointSymbol=none](#2)(#3){\pstOrdinate{#4} 0.3 add}{@PST@HYPERBOLA@TANGENTAUX@P0}{@PST@HYPERBOLA@TANGENTAUX@P1} + \pstHyperbolaOrdNode[PointName=none,PointSymbol=none](#2)(#3){\pstOrdinate{#4} 0.3 sub}{@PST@HYPERBOLA@TANGENTAUX@R0}{@PST@HYPERBOLA@TANGENTAUX@R1} + \pstHyperbolaLineInter[PointName=none,PointSymbol=none](#2)(#3){#4}{@PST@HYPERBOLA@TANGENTAUX@P0}{@PST@HYPERBOLA@TANGENTAUX@P}{@PST@HYPERBOLA@TANGENTAUX@Q} + \pstHyperbolaLineInter[PointName=none,PointSymbol=none](#2)(#3){#4}{@PST@HYPERBOLA@TANGENTAUX@R0}{@PST@HYPERBOLA@TANGENTAUX@R}{@PST@HYPERBOLA@TANGENTAUX@S} + \pstInterLL[PointName=none,PointSymbol=none]{@PST@HYPERBOLA@TANGENTAUX@P}{@PST@HYPERBOLA@TANGENTAUX@S}{@PST@HYPERBOLA@TANGENTAUX@Q}{@PST@HYPERBOLA@TANGENTAUX@R}{@PST@HYPERBOLA@TANGENTAUX@I} + \pstInterLL[PointName=none,PointSymbol=none]{@PST@HYPERBOLA@TANGENTAUX@P}{@PST@HYPERBOLA@TANGENTAUX@R}{@PST@HYPERBOLA@TANGENTAUX@Q}{@PST@HYPERBOLA@TANGENTAUX@S}{@PST@HYPERBOLA@TANGENTAUX@X} + \pstHyperbolaLineInter(#2)(#3){@PST@HYPERBOLA@TANGENTAUX@X}{@PST@HYPERBOLA@TANGENTAUX@I}{#5}{#6} + \Pst@ManageParamList{#5}% + \Pst@ManageParamList{#6}% + \pstLineAB{#4}{#5} + \pstLineAB{#4}{#6} + \endgroup% +}% +% +% 8. Standard Inversion Hyperbola with coordinate translation +%% ---------------------------------------------------------- +%% The Standard Inversion Hyperbola H is defined by center O, the half of the real axis $a$, the half of the imaginary axis $b$. +%% The equation can be written as: +%% \begin{equation}\label{FunctionOfStandardInversionHyperbola} +%% \dfrac{(y-y0)^2}{a^2}-\dfrac{(x-x0)^2}{b^2}=1 +%% \end{equation} +%% and the parametric function can be written as: +%% \begin{equation}\label{ParametricFunctionOfStandardInversionHyperbola} +%% \left\{\begin{array}{l} +%% x=b\tan\alpha+x_o\\ +%% y=a\sec\alpha+y_o +%% \end{array}\right. +%% \end{equation} +% +%% \pstIHyperbola[Options](O)(a,b)[maxAngleY] +%% Draw a Inversion Hyperbola with center O, the half of the real axis $abs(a)$, and the half of the imaginary axis $abs(b)$. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the hyperbola center O +%% #3 -> [input] the radii of real and imaginary axis +%% #4 -> [input] the maximal angle to draw the branch. +\def\pstIHyperbola{\@ifnextchar[\Pst@IHyperbola{\Pst@IHyperbola[]}} +\def\Pst@IHyperbola[#1](#2)(#3){% + \begingroup + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pst@getcoor{#3}\pst@tempR% + \@ifnextchar[\Pst@IHyperbola@i{\Pst@IHyperbola@i[85]}}% +\def\Pst@IHyperbola@i[#1]{% + \pst@cnth=#1\pst@cntg=180\pst@cntm=180\pst@cntn=360 + \ifnum\pst@cnth<0 + \loop\advance\pst@cnth by 90 + \ifnum\pst@cnth<0 + \repeat + \fi + \ifnum\pst@cnth>90 + \loop\advance\pst@cnth by -90 + \ifnum\pst@cnth>90 + \repeat + \fi + \ifnum\pst@cnth>85 + \advance\pst@cnth by -5 + \fi + \advance\pst@cntg by -\pst@cnth + \advance\pst@cntm by \pst@cnth + \advance\pst@cntn by -\pst@cnth + \Pst@IHyperbola@ii[0][\number\pst@cnth]% + \Pst@IHyperbola@ii[\number\pst@cntg][180]% + \Pst@IHyperbola@ii[180][\number\pst@cntm]% + \Pst@IHyperbola@ii[\number\pst@cntn][360]% + \endgroup% +}% +\def\Pst@IHyperbola@ii[#1][#2]{% + \parametricplot{#1}{#2}{% + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + t dup cos exch sin % cos{t} sin{t} + 1 index abs 1E-5 lt { + pop pop pop pop + } { + 5 index 3 index 2 index mul 3 index div add % x0+b\tan{t} + 5 index 5 index 4 index div add % y0+a\sec{t} + 8 2 roll pop pop pop pop pop pop + } ifelse + }% +}% +% +%% \pstIHyperbolaNode[Options](O)(a,b){t}{P} +%% Create a new node P on the Inversion Hyperbola E whose parameter is the given value $t$. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the hyperbola center O +%% #3 -> [input] the radii of real and imaginary axis +%% #4 -> [input] the parametric argument t. +%% #5 -> [output] the target node name. +\def\pstIHyperbolaNode{\@ifnextchar[\Pst@IHyperbolaNode{\Pst@IHyperbolaNode[]}} +\def\Pst@IHyperbolaNode[#1](#2)(#3)#4#5{% + \begingroup + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pst@getcoor{#3}\pst@tempR% + \pnode(! + \pst@tempO \tx@UserCoor % x_o,y_o + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + #4 dup cos exch sin % cos{t} sin{t} + 1 index abs 1E-5 lt { + pop pop pop pop + }{ + 5 index 3 index 2 index mul 3 index div add % x0+b\tan{t} + 5 index 5 index 4 index div add % y0+a\sec{t} + 8 2 roll pop pop pop pop pop pop + } ifelse + ){#5}% + \Pst@geonodelabel{#5}% + \endgroup% +}% +% +%% \pstIHyperbolaAbsNode[Options](O)(a,b){x_1}{A}{B} +%% Create a new node P on the Inversion Hyperbola E whose abscissa is the given value $x_1$. +%% when $x=x_1$, we have +%% $$\dfrac{(y-y_0)^2}{a^2}-\dfrac{(x_1-x_0)^2}{b^2}=1$$ +%% $$(y-y_0)^2=\dfrac{a^2(x_1-x_0)^2+a^2b^2}{b^2}$$ +%% $$y=y_0\pm\dfrac{a}{b}\sqrt{(x_1-x_0)^2+b^2}$$ +%% Parameters: +%% #1 -> options +%% #2 -> [input] the hyperbola center O +%% #3 -> [input] the radii of real and imaginary axis +%% #4 -> [input] the abbscissa value $x_1$. +%% #5 -> [output] the first target node name. +%% #6 -> [output] the first second node name. +\def\pstIHyperbolaAbsNode{\@ifnextchar[\Pst@IHyperbolaAbsNode{\Pst@IHyperbolaAbsNode[]}} +\def\Pst@IHyperbolaAbsNode[#1](#2)(#3)#4#5#6{% + \begingroup + \@InitListMng % + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pst@getcoor{#3}\pst@tempR% + \pnode(! + \pst@tempO \tx@UserCoor % x_o,y_o + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + #4 4 index sub dup mul 1 index dup mul add % (x_1-x_0)^2+b^2 + sqrt 2 index mul 1 index div 3 index exch sub % y1 + #4 exch 6 2 roll pop pop pop pop + ){#5}% + \pnode(! + \pst@tempO \tx@UserCoor % x_o,y_o + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + #4 4 index sub dup mul 1 index dup mul add % (x_1-x_0)^2+b^2 + sqrt 2 index mul 1 index div 3 index add % y1 + #4 exch 6 2 roll pop pop pop pop + ){#6}% + \Pst@ManageParamList{#5}% + \Pst@ManageParamList{#6}% + \endgroup% +}% +% +%% \pstIHyperbolaOrdNode[Options](O)(a,b){y_1}{A}{B} +%% Create a new node P on the Inversion Hyperbola E whose ordinate is the given value $y_1$. +%% when $y=y_1$, we have +%% $$\dfrac{(y_1-y_0)^2}{a^2}-\dfrac{(x-x_0)^2}{b^2}=1$$ +%% $$(x-x_0)^2=\dfrac{b^2(y_1-y_0)^2-a^2b^2}{a^2}$$ +%% $$x=x_0\pm\dfrac{b}{a}\sqrt{(y_1-y_0)^2-a^2}$$ +%% Parameters: +%% #1 -> options +%% #2 -> [input] the hyperbola center O +%% #3 -> [input] the radii of real and imaginary axis +%% #4 -> [input] the abbscissa value $x_1$. +%% #5 -> [output] the first target node name. +%% #6 -> [output] the first second node name. +\def\pstIHyperbolaOrdNode{\@ifnextchar[\Pst@IHyperbolaOrdNode{\Pst@IHyperbolaOrdNode[]}} +\def\Pst@IHyperbolaOrdNode[#1](#2)(#3)#4#5#6{% + \begingroup + \@InitListMng % + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pst@getcoor{#3}\pst@tempR% + \pnode(! + \pst@tempO \tx@UserCoor % x_o,y_o + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + #4 3 index sub dup mul 2 index dup mul sub % (y_1-y_0)^2-a^2 + dup 0 lt { + pop pop pop pop pop 0 0 + } { + sqrt 1 index mul 2 index div 4 index exch sub % x1 + #4 6 2 roll pop pop pop pop + } ifelse + ){#5}% + \pnode(! + \pst@tempO \tx@UserCoor % x_o,y_o + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + #4 3 index sub dup mul 2 index dup mul sub % (y_1-y_0)^2-a^2 + dup 0 lt { + pop pop pop pop pop 0 0 + } { + sqrt 1 index mul 2 index div 4 index add % x2 + #4 6 2 roll pop pop pop pop + } ifelse + ){#6}% + \Pst@ManageParamList{#5}% + \Pst@ManageParamList{#6}% + \endgroup% +}% +% +%% \pstIHyperbolaFocusNode[Options](O)(a,b){F1}{F2} +%% Create the two focus node F1 and F2 of the Inversion Hyperbola H. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the hyperbola center O +%% #3 -> [input] the radii of real and imaginary axis +%% #4 -> [output] the first focus node name. +%% #5 -> [output] the first focus node name. +\def\pstIHyperbolaFocusNode{\@ifnextchar[\Pst@IHyperbolaFocusNode{\Pst@IHyperbolaFocusNode[]}} +\def\Pst@IHyperbolaFocusNode[#1](#2)(#3)#4#5{% + \begingroup + \@InitListMng % + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pst@getcoor{#3}\pst@tempR% + \pnode(! + \pst@tempO \tx@UserCoor % x_o,y_o + \pst@tempR \tx@UserCoor % a,b + dup mul exch dup mul add sqrt % c + 1 index exch sub 2 index exch % x0,y0-c + 4 2 roll pop pop + ){#4}% + \pnode(! + \pst@tempO \tx@UserCoor % x_o,y_o + \pst@tempR \tx@UserCoor % a,b + dup mul exch dup mul add sqrt % c + 1 index add 2 index exch % x0,y0+c + 4 2 roll pop pop + ){#5}% + \Pst@ManageParamList{#4}% + \Pst@ManageParamList{#5}% + \endgroup% +}% +% +%% \pstIHyperbolaDirectrixLine[Options](O)(a,b){Lx}{Ly}{Rx}{Ry} +%% Draw the two directrix lines L1 and L2 of the Inversion Hyperbola H. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the hyperbola center O +%% #3 -> [input] the radii of real and imaginary axis +%% #4 -> [output] the first node name on the first directrix line. +%% #5 -> [output] the second node name on the first directrix line. +%% #6 -> [output] the first node name on the second directrix line. +%% #7 -> [output] the second node name on the second directrix line. +\def\pstIHyperbolaDirectrixLine{\@ifnextchar[\Pst@IHyperbolaDirectrixLine{\Pst@IHyperbolaDirectrixLine[]}} +\def\Pst@IHyperbolaDirectrixLine[#1](#2)(#3)#4#5#6#7{% + \begingroup + \@InitListMng % + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pst@getcoor{#3}\pst@tempR% + \pnode(! + \pst@tempO \tx@UserCoor % x_o,y_o + \pst@tempR \tx@UserCoor % a,b + 1 index dup mul dup 2 index dup mul add sqrt div % a^2/c + 3 index exch sub 4 index exch % x0,y0-a^2/c + 6 2 roll pop pop pop pop + ){#4}% + \pnode(! + \pst@tempO \tx@UserCoor % x_o,y_o + \pst@tempR \tx@UserCoor % a,b + 1 index dup mul dup 2 index dup mul add sqrt div % a^2/c + 3 index exch sub 4 index 1 add exch % x0+1,y0-a^2/c + 6 2 roll pop pop pop pop + ){#5}% + \pnode(! + \pst@tempO \tx@UserCoor % x_o,y_o + \pst@tempR \tx@UserCoor % a,b + 1 index dup mul dup 2 index dup mul add sqrt div % a^2/c + 3 index add 4 index exch % x0,y0+a^2/c + 6 2 roll pop pop pop pop + ){#6}% + \pnode(! + \pst@tempO \tx@UserCoor % x_o,y_o + \pst@tempR \tx@UserCoor % a,b + 1 index dup mul dup 2 index dup mul add sqrt div % a^2/c + 3 index add 4 index 1 add exch % x0+1,y0+a^2/c + 6 2 roll pop pop pop pop + ){#7}% + \Pst@ManageParamList{#4}% + \Pst@ManageParamList{#5}% + \Pst@ManageParamList{#6}% + \Pst@ManageParamList{#7}% + \pstLineAB{#4}{#5}% + \pstLineAB{#6}{#7}% + \endgroup% +}% +% +%% \pstIHyperbolaAsymptoteLine[Options](O)(a,b){L1}{L2} +%% Draw the two asymptote lines L1 and L2 of the Inversion Hyperbola H. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the hyperbola center O +%% #3 -> [input] the radii of real and imaginary axis +%% #4 -> [output] the second node name on the first asymptote line, the first node is the center O. +%% #5 -> [output] the second node name on the second asymptote line, the first node is the center O. +\def\pstIHyperbolaAsymptoteLine{\@ifnextchar[\Pst@IHyperbolaAsymptoteLine{\Pst@IHyperbolaAsymptoteLine[]}} +\def\Pst@IHyperbolaAsymptoteLine[#1](#2)(#3)#4#5{% + \begingroup + \@InitListMng % + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pst@getcoor{#3}\pst@tempR% + \pnode(! + \pst@tempO \tx@UserCoor % x_o,y_o + \pst@tempR \tx@UserCoor % a,b + 0 index 2 index div % b/a + 4 index 1 index sub % x=x0-b/a + 4 index 1 add % y=y0+1 + 7 2 roll pop pop pop pop pop + ){#4}% + \pnode(! + \pst@tempO \tx@UserCoor % x_o,y_o + \pst@tempR \tx@UserCoor % a,b + 0 index 2 index div % b/a + 4 index 1 index add % x=x0+b/a + 4 index 1 add % y=y0+1 + 7 2 roll pop pop pop pop pop + ){#5}% + \Pst@ManageParamList{#4}% + \Pst@ManageParamList{#5}% + \pstLineAB{#2}{#4}% + \pstLineAB{#2}{#5}% + \endgroup% +}% +% +%% \pstIHyperbolaLineInter[Options](O)(a,b){A}{B}{C}{D} +%% Find the two intersection nodes C and D of the Inversion Hyperbola H and line AB. +%% +%% Case 1. When line AB is vertical, i.e, $x_1=x_2$, we have +%% $$y=y_0\pm\dfrac{a}{b}\sqrt{(x_1-x_0)^2+b^2}$$ +%% +%% Case 2. When line AB is not vertical, we can represent the line AB as the following function: +%% $$y=kx+d$$ where $$k=\dfrac{y_2-y_1}{x_2-x_1}, d=\dfrac{x_2y_1-x_1y_2}{x_2-x_1}$$ +%% refer to equation (\ref{FunctionOfStandardInversionHyperbola}), we have +%% $$(b^2k^2-a^2)X^2+2b^2kmX+b^2(m^2-a^2)=0$$ +%% $$Y=kX+m$$ +%% where +%% $$m=kx_o-y_o+d,X=x-x_0,Y=y-y_0$$ +%% +%% Case 2.1 When $b^2k^2-a^2=0$, which gives $k=\pm\dfrac{a}{b}\neq0$, +%% at this time, when $m=0$, the line AB becomes the asymptote of the hyperbola, +%% so there is none intersection any more; else we have +%% $$x_{C}=x_o-\dfrac{m^2-a^2}{2km},y_{C}=kx_{C}+d$$ +%% but D is not defined. +%% +%% Case 2.2 When $b^2k^2-a^2\neq0$, we have +%% $$x_{C,D}=x_0+\dfrac{-b^2km\pm{}ab\sqrt{m^2+b^2k^2-a^2}}{b^2k^2-a^2},y_{C,D}=kx_{C,D}+d$$ +%% +%% Parameters: +%% #1 -> options +%% #2 -> [input] the hyperbola center O +%% #3 -> [input] the radii of real and imaginary axis +%% #4 -> [input] the first node name on the given line AB. +%% #5 -> [input] the second node name on the given line AB. +%% #6 -> [output] the first intersection node. +%% #7 -> [output] the second intersection node. +\def\pstIHyperbolaLineInter{\@ifnextchar[\Pst@IHyperbolaLineInter{\Pst@IHyperbolaLineInter[]}} +\def\Pst@IHyperbolaLineInter[#1](#2)(#3)#4#5#6#7{% + \begingroup + \@InitListMng % + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pst@getcoor{#3}\pst@tempR% + \pst@getcoor{#4}\pst@tempA% + \pst@getcoor{#5}\pst@tempB% + \pnode(! + \pst@tempO \tx@UserCoor % x_o,y_o + \pst@tempR \tx@UserCoor % a,b + \pst@tempA \tx@UserCoor % x_1,y_1 + \pst@tempB \tx@UserCoor % x_2,y_2 + 3 index 2 index sub abs 1E-5 lt { % if the line AB is vertical + %% $$y=y_0\pm\dfrac{a}{b}\sqrt{(x_1-x_0)^2+b^2}$$ + 3 index 8 index sub dup mul 5 index dup mul add + sqrt 6 index mul 5 index div 7 index exch sub % y1 + 4 index exch % x1 + 10 2 roll pop pop pop pop pop pop pop pop + } { + 0 index 3 index sub 2 index 5 index sub div % k + 2 index 4 index mul 2 index 6 index mul sub 3 index 6 index sub div % d + 1 index 10 index mul 9 index sub 1 index add % m=kx_o-y_o+d + 7 index dup mul 3 index dup mul mul 9 index dup mul sub % b^2k^2-a^2 + 0 index abs 1E-5 lt { + 1 index abs 1E-5 lt { + pop pop pop pop pop pop + pop pop pop pop pop pop + 0 0 + } { + %% $$x_{C}=x_o-\dfrac{m^2-a^2}{2km},y_{C}=kx_{C}+d$$ + 1 index dup mul 10 index dup mul sub 2 index 5 index mul 2 mul div % (m^2-a^2)/2km + 12 index exch sub % x1 + 4 index 1 index mul 4 index add % y1 + 14 2 roll pop pop pop pop pop pop + pop pop pop pop pop pop + } ifelse + } { + 1 index dup mul 1 index add % m^2+b^2k^2-a^2 + dup 0 lt { + pop pop pop pop pop pop pop + pop pop pop pop pop pop 0 0 + } { + sqrt 10 index mul 9 index mul 9 index dup mul 5 index mul 3 index mul add neg 1 index div 12 index add % x1 + 4 index 1 index mul 4 index add % y1 + 14 2 roll pop pop pop pop pop pop + pop pop pop pop pop pop + } ifelse + } ifelse + } ifelse + ){#6}% + \pnode(! + \pst@tempO \tx@UserCoor % x_o,y_o + \pst@tempR \tx@UserCoor % a,b + \pst@tempA \tx@UserCoor % x_1,y_1 + \pst@tempB \tx@UserCoor % x_2,y_2 + 3 index 2 index sub abs 1E-5 lt { % if the line AB is vertical + %% $$y=y_0\pm\dfrac{a}{b}\sqrt{(x_1-x_0)^2+b^2}$$ + 3 index 8 index sub dup mul 5 index dup mul add + sqrt 6 index mul 5 index div 7 index add % y2 + 4 index exch % x2 + 10 2 roll pop pop pop pop pop pop pop pop + } { + 0 index 3 index sub 2 index 5 index sub div % k + 2 index 4 index mul 2 index 6 index mul sub 3 index 6 index sub div % d + 1 index 10 index mul 9 index sub 1 index add % m=kx_o-y_o+d + 7 index dup mul 3 index dup mul mul 9 index dup mul sub % b^2k^2-a^2 + dup abs 1E-5 lt { + pop pop pop pop pop pop + pop pop pop pop pop pop + 0 0 + } { + 1 index dup mul 1 index add % m^2+b^2k^2-a^2 + dup 0 lt { + pop pop pop pop pop pop pop + pop pop pop pop pop pop 0 0 + } { + sqrt 10 index mul 9 index mul 9 index dup mul 5 index mul 3 index mul sub 1 index div 12 index add % x2 + 4 index 1 index mul 4 index add % y2 + 14 2 roll pop pop pop pop pop pop + pop pop pop pop pop pop + } ifelse + } ifelse + } ifelse + ){#7}% + \Pst@ManageParamList{#6}% + \Pst@ManageParamList{#7}% + \endgroup% +}% +% +%% \pstIHyperbolaPolarNode[Options](O)(a,b){A}{B}{T} +%% Find the polar point of chord AB on Inversion Hyperbola H. +%% We use the following proposition to find the polar point of chord AB: +%% Let $P$, $Q$ are vertex points of the hyperbola, for any chord $AB$ of hyperbola, $PA$ and $BQ$ intersect at $E$, $PB$ and $AQ$ intersect at $F$, then the middle point $M$ of $EF$ is the polar point of chord $AB$. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the hyperbola center O +%% #3 -> [input] the radii of real and imaginary axis +%% #4 -> [input] the node A on the hyperbola. +%% #5 -> [input] the node B on the hyperbola. +%% #6 -> [output] the polar node T of chord AB. +\def\pstIHyperbolaPolarNode{\@ifnextchar[\Pst@IHyperbolaPolarNode{\Pst@IHyperbolaPolarNode[]}} +\def\Pst@IHyperbolaPolarNode[#1](#2)(#3)#4#5#6{% + \begingroup + \psset{#1}% + \pstIHyperbolaAbsNode[PointName=none,PointSymbol=none](#2)(#3){\pstAbscissa{#2}}{@PST@IHYPERBOLA@VERTEXA}{@PST@IHYPERBOLA@VERTEXB} + \pstInterLL[PointName=none,PointSymbol=none]{#4}{@PST@IHYPERBOLA@VERTEXA}{#5}{@PST@IHYPERBOLA@VERTEXB}{@PST@IHYPERBOLA@INTER@X} + \pstInterLL[PointName=none,PointSymbol=none]{#5}{@PST@IHYPERBOLA@VERTEXA}{#4}{@PST@IHYPERBOLA@VERTEXB}{@PST@IHYPERBOLA@INTER@Y} + \pstMiddleAB{@PST@IHYPERBOLA@INTER@X}{@PST@IHYPERBOLA@INTER@Y}{#6} + \Pst@geonodelabel{#6}% + \pstLineAB{#4}{#6} + \pstLineAB{#5}{#6} + \endgroup +}% +% +%% \pstIHyperbolaTangentNode[Options](O)(a,b){T}{A}{B} +%% Draw the two tangent lines through the point $T$ to the Inversion Hyperbola H and get the node A and B on the Inversion Hyperbola. +%% We use the following proposition to find the tangent points $A$ and $B$ of $T$: +%% Let $T$ is a point out of the hyperbola, we give any two chords $TPQ$ and $TRS$ of the hyperbola, $PR$ and $QS$ intersect at $X$, $RQ$ and $PS$ intersect at $Y$, +%% then the intersection point $A$ and $B$ of $XY$ and the hyperbola are the tangent points from $T$. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the hyperbola center O +%% #3 -> [input] the radii of real and imaginary axis +%% #4 -> [input] the given node T outside the hyperbola +%% #5 -> [output] the tangent node name A on the hyperbola +%% #6 -> [output] the tangent node name B on the hyperbola +\def\pstIHyperbolaTangentNode{\@ifnextchar[\Pst@IHyperbolaTangentNode{\Pst@IHyperbolaTangentNode[]}} +\def\Pst@IHyperbolaTangentNode[#1](#2)(#3)#4#5#6{% + \begingroup + \@InitListMng % + \psset{#1}% + \pstIHyperbolaAbsNode[PointName=none,PointSymbol=none](#2)(#3){\pstAbscissa{#4} 0.3 add}{@PST@IHYPERBOLA@TANGENTAUX@P0}{@PST@IHYPERBOLA@TANGENTAUX@P1} + \pstIHyperbolaAbsNode[PointName=none,PointSymbol=none](#2)(#3){\pstAbscissa{#4} 0.3 sub}{@PST@IHYPERBOLA@TANGENTAUX@R0}{@PST@IHYPERBOLA@TANGENTAUX@R1} + \pstIHyperbolaLineInter[PointName=none,PointSymbol=none](#2)(#3){#4}{@PST@IHYPERBOLA@TANGENTAUX@P0}{@PST@IHYPERBOLA@TANGENTAUX@P}{@PST@IHYPERBOLA@TANGENTAUX@Q} + \pstIHyperbolaLineInter[PointName=none,PointSymbol=none](#2)(#3){#4}{@PST@IHYPERBOLA@TANGENTAUX@R0}{@PST@IHYPERBOLA@TANGENTAUX@R}{@PST@IHYPERBOLA@TANGENTAUX@S} + \pstInterLL[PointName=none,PointSymbol=none]{@PST@IHYPERBOLA@TANGENTAUX@P}{@PST@IHYPERBOLA@TANGENTAUX@S}{@PST@IHYPERBOLA@TANGENTAUX@Q}{@PST@IHYPERBOLA@TANGENTAUX@R}{@PST@IHYPERBOLA@TANGENTAUX@I} + \pstInterLL[PointName=none,PointSymbol=none]{@PST@IHYPERBOLA@TANGENTAUX@P}{@PST@IHYPERBOLA@TANGENTAUX@R}{@PST@IHYPERBOLA@TANGENTAUX@Q}{@PST@IHYPERBOLA@TANGENTAUX@S}{@PST@IHYPERBOLA@TANGENTAUX@X} + \pstIHyperbolaLineInter(#2)(#3){@PST@IHYPERBOLA@TANGENTAUX@X}{@PST@IHYPERBOLA@TANGENTAUX@I}{#5}{#6} + \Pst@ManageParamList{#5}% + \Pst@ManageParamList{#6}% + \pstLineAB{#4}{#5} + \pstLineAB{#4}{#6} + \endgroup% +}% +% +% 9. General Hyperbola with coordinate translation and rotation +%% ---------------------------------------------------------- +%% The General Hyperbola H is defined by center O, the half of the real axis $a$, the half of the imaginary axis $b$, +%% and the rotation angle $\theta$ of the principal axis. +%% The equation can be got from the parametric function of the Standard Hyperbola \ref{ParametricFunctionOfStandardHyperbola}, +%% using the rotation transform formula \ref{RotationTransformFormula}, then we have +%% \begin{equation} +%% \left\{\begin{array}{l} +%% x'=(a\sec\alpha+x_o)\cos\theta-(b\tan\alpha+y_o)\sin\theta=x_o'+a\sec\alpha\cos\theta-b\tan\alpha\sin\theta\\ +%% y'=(a\sec\alpha+x_o)\sin\theta+(b\tan\alpha+y_o)\cos\theta=y_o'+a\sec\alpha\sin\theta+b\tan\alpha\cos\theta +%% \end{array}\right. +%% \end{equation} +%% where the $x_o'$ and $y_o'$ are the coordinate of the given center O after rotation. +%% So we get the parametric function of the General Hyperbola with coordinate translation and rotation as following: +%% \begin{equation}\label{ParametricFunctionOfGeneralHyperbola} +%% \left\{\begin{array}{l} +%% x=x_o+a\sec\alpha\cos\theta-b\tan\alpha\sin\theta\\ +%% y=y_o+a\sec\alpha\sin\theta+b\tan\alpha\cos\theta +%% \end{array}\right. +%% \end{equation} +% +%% \pstGeneralHyperbola[Options](O)(a,b)[rotation][maxAngleX] +%% Draw a General Hyperbola with center O, the half of the real axis $abs(a)$, the half of the imaginary axis $abs(b)$, +%% and the rotation angle $\theta$ of the symmetrical axis. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the hyperbola center O +%% #3 -> [input] the radii of real and imaginary axis +%% #4 -> [input] the rotation angle $\theta$ of the symmetrical axis. +%% #5 -> [input] the maximal angle to draw the branch. +\def\pstGeneralHyperbola{\@ifnextchar[\Pst@GeneralHyperbola{\Pst@GeneralHyperbola[]}} +\def\Pst@GeneralHyperbola[#1](#2)(#3){% + \begingroup + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pst@getcoor{#3}\pst@tempR% + \@ifnextchar[\Pst@GeneralHyperbola@i{\Pst@GeneralHyperbola@i[0]}}% +\def\Pst@GeneralHyperbola@i[#1]{% + \def\pst@hyperbola@rotation{#1}% + \@ifnextchar[\Pst@GeneralHyperbola@j{\Pst@GeneralHyperbola@j[85]}}% +\def\Pst@GeneralHyperbola@j[#1]{% + \pst@cnth=#1\pst@cntg=180\pst@cntm=180\pst@cntn=360 + \ifnum\pst@cnth<0 + \loop\advance\pst@cnth by 90 + \ifnum\pst@cnth<0 + \repeat + \fi + \ifnum\pst@cnth>90 + \loop\advance\pst@cnth by -90 + \ifnum\pst@cnth>90 + \repeat + \fi + \ifnum\pst@cnth>85 + \advance\pst@cnth by -5 + \fi + \advance\pst@cntg by -\pst@cnth + \advance\pst@cntm by \pst@cnth + \advance\pst@cntn by -\pst@cnth + \Pst@GeneralHyperbola@k[0][\number\pst@cnth]% + \Pst@GeneralHyperbola@k[\number\pst@cntg][180]% + \Pst@GeneralHyperbola@k[180][\number\pst@cntm]% + \Pst@GeneralHyperbola@k[\number\pst@cntn][360]% + \endgroup% +}% +\def\Pst@GeneralHyperbola@k[#1][#2]{% + \parametricplot{#1}{#2}{% + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + t dup cos exch sin % cos{t} sin{t} + 1 index abs 1E-5 lt { + pop pop pop pop + } { + \pst@hyperbola@rotation\space dup cos exch sin % cos\theta sin\theta + %% x=x_o+a\sec\alpha\cos\theta-b\tan\alpha\sin\theta + 7 index 6 index 5 index div 3 index mul add + 5 index 4 index mul 5 index div 2 index mul sub + %% y=y_o+a\sec\alpha\sin\theta+b\tan\alpha\cos\theta + 7 index 7 index 6 index div 3 index mul add + 6 index 5 index mul 6 index div 4 index mul add + 10 2 roll pop pop pop pop pop pop pop pop + } ifelse + }% +}% +% +%% \pstGeneralHyperbolaNode[Options](O)(a,b)[rotation]{t}{A} +%% Draw a node whose parameter value is the given value t on the General Hyperbola. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the hyperbola center O +%% #3 -> [input] the radii of real and imaginary axis +%% #4 -> [input] the rotation angle $\theta$ of the symmetrical axis. +%% #5 -> [input] the parameter value t. +%% #6 -> [output] the target node name. +\def\pstGeneralHyperbolaNode{\@ifnextchar[\Pst@GeneralHyperbolaNode{\Pst@GeneralHyperbolaNode[]}} +\def\Pst@GeneralHyperbolaNode[#1](#2)(#3){% + \begingroup + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pst@getcoor{#3}\pst@tempR% + \@ifnextchar[\Pst@GeneralHyperbolaNode@i{\Pst@GeneralHyperbolaNode@i[0]}}% +\def\Pst@GeneralHyperbolaNode@i[#1]#2#3{% + \pnode(!% + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + #2 dup cos exch sin % cos{t} sin{t} + 1 index abs 1E-5 lt { + pop pop pop pop + } { + #1 dup cos exch sin % cos\theta sin\theta + %% x=x_o+a\sec\alpha\cos\theta-b\tan\alpha\sin\theta + 7 index 6 index 5 index div 3 index mul add + 5 index 4 index mul 5 index div 2 index mul sub + %% y=y_o+a\sec\alpha\sin\theta+b\tan\alpha\cos\theta + 7 index 7 index 6 index div 3 index mul add + 6 index 5 index mul 6 index div 4 index mul add + 10 2 roll pop pop pop pop pop pop pop pop + } ifelse + ){#3}% + \Pst@geonodelabel{#3}% + \endgroup% +}% +% +%% \pstGeneralHyperbolaAbsNode[Options](O)(a,b)[rotation]{x_1}{A}{B} +%% Draw the nodes whose abscissa value are the given value x_1 on the General Hyperbola. +%% +%% set $e=a\cos\theta$, $f=b\sin\theta$, $g=a\sin\theta$, $h=b\cos\theta$, then we have +%% $$x=x_0+e\sec\alpha-f\tan\alpha, y=y_0+g\sec\alpha+h\tan\alpha$$ +%% when $x=x_1$, we get +%% $$e\sec\alpha-f\tan\alpha=x_1-x_0$$ +%% set $n=x_1-x_0$, we have +%% $$n\cos\alpha+f\sin\alpha=e$$ +%% then +%% $$(n^2+f^2)\sin^2\alpha-2ef\sin\alpha+e^2-n^2=0$$ +%% if $n^2+f^2=0$, we have $n=f=0$, i.e, $x_1=x_0$ and $\sin\theta=0$, but the last equation gives $e=0$, which is not possible. +%% so $n^2+f^2\neq0$, we get +%% $$\sin_{1,2}\alpha=\dfrac{ef\pm{}n\sqrt{n^2+f^2-e^2}}{n^2+f^2}$$ +%% and +%% $$\cos_{1,2}\alpha=\dfrac{en\mp{}f\sqrt{n^2+f^2-e^2}}{n^2+f^2}$$ +%% where $\cos\alpha$ can not be zero, but when $f=\pm{}e$, we have $\cos\alpha=0$, we should skip it. +%% +%% Parameters: +%% #1 -> options +%% #2 -> [input] the hyperbola center O +%% #3 -> [input] the radii of real and imaginary axis +%% #4 -> [input] the rotation angle $\theta$ of the symmetrical axis. +%% #5 -> [input] the abscissa value x_1. +%% #6 -> [output] the first target node name. +%% #7 -> [output] the second target node name. +\def\pstGeneralHyperbolaAbsNode{\@ifnextchar[\Pst@GeneralHyperbolaAbsNode{\Pst@GeneralHyperbolaAbsNode[]}} +\def\Pst@GeneralHyperbolaAbsNode[#1](#2)(#3){% + \begingroup + \@InitListMng % + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pst@getcoor{#3}\pst@tempR% + \@ifnextchar[\Pst@GeneralHyperbolaAbsNode@i{\Pst@GeneralHyperbolaAbsNode@i[0]}}% +\def\Pst@GeneralHyperbolaAbsNode@i[#1]#2#3#4{% + \pnode(!% + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + #1 dup cos exch sin % cos\theta sin\theta + 3 index 2 index mul % e=a\cos\theta + 3 index 2 index mul % f=b\sin\theta + 5 index 3 index mul % g=a\sin\theta + 5 index 5 index mul % h=b\cos\theta + #2 10 index sub % n=x1-x0 + 0 index dup mul 4 index dup mul add % n^2+f^2 + 0 index abs 1E-5 lt { + pop pop pop pop pop pop + pop pop pop pop pop pop 0 0 + } { + 0 index 6 index dup mul sub dup 0 lt { + pop pop pop pop pop pop pop + pop pop pop pop pop pop 0 0 + } { + sqrt % sqrt(n^2+f^2-e^2) + %% \sin_{1,2}\alpha=\dfrac{ef\pm{}n\sqrt{n^2+f^2-e^2}}{n^2+f^2} + 2 index 1 index mul 7 index 7 index mul exch sub 2 index div % sin + %% \cos_{1,2}\alpha=\dfrac{en\mp{}f\sqrt{n^2+f^2-e^2}}{n^2+f^2} + 6 index 2 index mul 8 index 5 index mul add 3 index div % cos + dup abs 1E-5 lt { + pop pop pop pop pop pop pop pop + pop pop pop pop pop pop pop 0 0 + } { + 14 index 9 index 2 index div add 8 index 3 index mul 2 index div sub % x_1=x_0+e\sec\alpha-f\tan\alpha + 14 index 8 index 3 index div add 7 index 4 index mul 3 index div add % y_1=y_0+g\sec\alpha+h\tan\alpha + 17 2 roll pop pop pop pop pop pop pop pop + pop pop pop pop pop pop pop + } ifelse + } ifelse + } ifelse + ){#3}% + \pnode(!% + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + #1 dup cos exch sin % cos\theta sin\theta + 3 index 2 index mul % e=a\cos\theta + 3 index 2 index mul % f=b\sin\theta + 5 index 3 index mul % g=a\sin\theta + 5 index 5 index mul % h=b\cos\theta + #2 10 index sub % n=x1-x0 + 0 index dup mul 4 index dup mul add % n^2+f^2 + 0 index abs 1E-5 lt { + pop pop pop pop pop pop + pop pop pop pop pop pop 0 0 + } { + 0 index 6 index dup mul sub dup 0 lt { + pop pop pop pop pop pop pop + pop pop pop pop pop pop 0 0 + } { + sqrt % sqrt(n^2+f^2-e^2) + %% \sin_{1,2}\alpha=\dfrac{ef\pm{}n\sqrt{n^2+f^2-e^2}}{n^2+f^2} + 2 index 1 index mul 7 index 7 index mul add 2 index div % sin + %% \cos_{1,2}\alpha=\dfrac{en\mp{}f\sqrt{n^2+f^2-e^2}}{n^2+f^2} + 6 index 2 index mul 8 index 5 index mul exch sub 3 index div % cos + dup abs 1E-5 lt { + pop pop pop pop pop pop pop pop + pop pop pop pop pop pop pop 0 0 + } { + 14 index 9 index 2 index div add 8 index 3 index mul 2 index div sub % x_2=x_0+e\sec\alpha-f\tan\alpha + 14 index 8 index 3 index div add 7 index 4 index mul 3 index div add % y_2=y_0+g\sec\alpha+h\tan\alpha + 17 2 roll pop pop pop pop pop pop pop pop + pop pop pop pop pop pop pop + } ifelse + } ifelse + } ifelse + ){#4}% + \Pst@ManageParamList{#3}% + \Pst@ManageParamList{#4}% + \endgroup% +}% +% +%% \pstGeneralHyperbolaOrdNode[Options](O)(a,b)[rotation]{y_1}{A}{B} +%% Draw the nodes whose ordinate value are the given value y_1 on the General Hyperbola. +%% +%% set $e=a\cos\theta$, $f=b\sin\theta$, $g=a\sin\theta$, $h=b\cos\theta$, then we have +%% $$x=x_0+e\sec\alpha-f\tan\alpha, y=y_0+g\sec\alpha+h\tan\alpha$$ +%% when $y=y_1$, we get +%% $$g\sec\alpha+h\tan\alpha=y_1-y_0$$ +%% set $m=y_1-y_0$, we have +%% $$m\cos\alpha-h\sin\alpha=g$$ +%% then +%% $$(m^2+h^2)\sin^2\alpha+2gh\sin\alpha+g^2-m^2=0$$ +%% if $m^2+h^2=0$, we have $m=h=0$, i.e, $y_1=y_0$ and $\cos\theta=0$, but the last equation gives $e=0$, which is not possible. +%% so $m^2+h^2\neq0$, we get +%% $$\sin_{1,2}\alpha=\dfrac{-gh\pm{}m\sqrt{m^2+h^2-g^2}}{m^2+h^2}$$ +%% and +%% $$\cos_{1,2}\alpha=\dfrac{gm\pm{}h\sqrt{m^2+h^2-g^2}}{m^2+h^2}$$ +%% where $\cos\alpha$ can not be zero, but when $h=\pm{}g$, we have $\cos\alpha=0$, we should skip it. +%% +%% Parameters: +%% #1 -> options +%% #2 -> [input] the hyperbola center O +%% #3 -> [input] the radii of real and imaginary axis +%% #4 -> [input] the rotation angle $\theta$ of the symmetrical axis. +%% #5 -> [input] the ordinate value y_1. +%% #6 -> [output] the first target node name. +%% #7 -> [output] the second target node name. +\def\pstGeneralHyperbolaOrdNode{\@ifnextchar[\Pst@GeneralHyperbolaOrdNode{\Pst@GeneralHyperbolaOrdNode[]}} +\def\Pst@GeneralHyperbolaOrdNode[#1](#2)(#3){% + \begingroup + \@InitListMng % + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pst@getcoor{#3}\pst@tempR% + \@ifnextchar[\Pst@GeneralHyperbolaOrdNode@i{\Pst@GeneralHyperbolaOrdNode@i[0]}}% +\def\Pst@GeneralHyperbolaOrdNode@i[#1]#2#3#4{% + \pnode(!% + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + #1 dup cos exch sin % cos\theta sin\theta + 3 index 2 index mul % e=a\cos\theta + 3 index 2 index mul % f=b\sin\theta + 5 index 3 index mul % g=a\sin\theta + 5 index 5 index mul % h=b\cos\theta + #2 9 index sub % m=y1-y0 + 0 index dup mul 2 index dup mul add % m^2+h^2 + 0 index abs 1E-5 lt { + pop pop pop pop pop pop + pop pop pop pop pop pop 0 0 + } { + 0 index 4 index dup mul sub dup 0 lt { + pop pop pop pop pop pop pop + pop pop pop pop pop pop 0 0 + } { + sqrt % sqrt(m^2+h^2-g^2) + %% \sin_{1,2}\alpha=\dfrac{-gh\pm{}m\sqrt{m^2+h^2-g^2}}{m^2+h^2} + 2 index 1 index mul 5 index 5 index mul add neg 2 index div % sin + %% \cos_{1,2}\alpha=\dfrac{gm\pm{}h\sqrt{m^2+h^2-g^2}}{m^2+h^2} + 4 index 2 index mul 6 index 5 index mul exch sub 3 index div % cos + dup abs 1E-5 lt { + pop pop pop pop pop pop pop pop + pop pop pop pop pop pop pop 0 0 + } { + 14 index 9 index 2 index div add 8 index 3 index mul 2 index div sub % x_1=x_0+e\sec\alpha-f\tan\alpha + 14 index 8 index 3 index div add 7 index 4 index mul 3 index div add % y_1=y_0+g\sec\alpha+h\tan\alpha + 17 2 roll pop pop pop pop pop pop pop pop + pop pop pop pop pop pop pop + } ifelse + } ifelse + } ifelse + ){#3}% + \pnode(!% + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + #1 dup cos exch sin % cos\theta sin\theta + 3 index 2 index mul % e=a\cos\theta + 3 index 2 index mul % f=b\sin\theta + 5 index 3 index mul % g=a\sin\theta + 5 index 5 index mul % h=b\cos\theta + #2 9 index sub % m=y1-y0 + 0 index dup mul 2 index dup mul add % m^2+h^2 + 0 index abs 1E-5 lt { + pop pop pop pop pop pop + pop pop pop pop pop pop 0 0 + } { + 0 index 4 index dup mul sub dup 0 lt { + pop pop pop pop pop pop pop + pop pop pop pop pop pop 0 0 + } { + sqrt % sqrt(m^2+h^2-g^2) + %% \sin_{1,2}\alpha=\dfrac{-gh\pm{}m\sqrt{m^2+h^2-g^2}}{m^2+h^2} + 2 index 1 index mul 5 index 5 index mul sub 2 index div % sin + %% \cos_{1,2}\alpha=\dfrac{gm\pm{}h\sqrt{m^2+h^2-g^2}}{m^2+h^2} + 4 index 2 index mul 6 index 5 index mul add 3 index div % cos + dup abs 1E-5 lt { + pop pop pop pop pop pop pop pop + pop pop pop pop pop pop pop 0 0 + } { + 14 index 9 index 2 index div add 8 index 3 index mul 2 index div sub % x_1=x_0+e\sec\alpha-f\tan\alpha + 14 index 8 index 3 index div add 7 index 4 index mul 3 index div add % y_1=y_0+g\sec\alpha+h\tan\alpha + 17 2 roll pop pop pop pop pop pop pop pop + pop pop pop pop pop pop pop + } ifelse + } ifelse + } ifelse + ){#4}% + \Pst@ManageParamList{#3}% + \Pst@ManageParamList{#4}% + \endgroup% +}% +% +%% \pstGeneralHyperbolaFocusNode[Options](O)(a,b)[rotation]{F1}{F2} +%% Draw the focus nodes of the General Hyperbola H. +%% If you not input the rotation angle, the default value is $0^\circ$. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the hyperbola center O +%% #3 -> [input] the radii of real and imaginary axis +%% #4 -> [input] the rotation angle $\theta$ of the symmetrical axis. +%% #5 -> [output] the focus node F1 of the Hyperbola. +%% #6 -> [output] the focus node F2 of the Hyperbola. +\def\pstGeneralHyperbolaFocusNode{\@ifnextchar[\Pst@GeneralHyperbolaFocusNode{\Pst@GeneralHyperbolaFocusNode[]}} +\def\Pst@GeneralHyperbolaFocusNode[#1](#2)(#3){% + \begingroup + \@InitListMng % + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pst@getcoor{#3}\pst@tempR% + \@ifnextchar[\Pst@GeneralHyperbolaFocusNode@i{\Pst@GeneralHyperbolaFocusNode@i[0]}}% +\def\Pst@GeneralHyperbolaFocusNode@i[#1]#2#3{% + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + #1 dup cos exch sin % cos\theta sin\theta + 3 index dup mul 3 index dup mul add sqrt % c=sqrt(a^2+b^2) + 6 index 1 index 4 index mul sub % x=x0-c\cos\theta + 6 index 2 index 4 index mul sub % y=y0-c\sin\theta + 9 2 roll pop pop pop pop pop pop pop + ){#2} + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + #1 dup cos exch sin % cos\theta sin\theta + 3 index dup mul 3 index dup mul add sqrt % c=sqrt(a^2+b^2) + 6 index 1 index 4 index mul add % x=x0+c\cos\theta + 6 index 2 index 4 index mul add % y=y0+c\sin\theta + 9 2 roll pop pop pop pop pop pop pop + ){#3} + \Pst@ManageParamList{#2}% + \Pst@ManageParamList{#3}% + \endgroup% +}% +% +%% \pstGeneralHyperbolaVertexNode[Options](O)(a,b)[rotation]{V1}{V2} +%% Draw the vertex nodes of the General Hyperbola H. +%% If you not input the rotation angle, the default value is $0^\circ$. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the hyperbola center O +%% #3 -> [input] the radii of real and imaginary axis +%% #4 -> [input] the rotation angle $\theta$ of the symmetrical axis. +%% #5 -> [output] the vertex node V1 of the Hyperbola. +%% #6 -> [output] the vertex node V2 of the Hyperbola. +\def\pstGeneralHyperbolaVertexNode{\@ifnextchar[\Pst@GeneralHyperbolaVertexNode{\Pst@GeneralHyperbolaVertexNode[]}} +\def\Pst@GeneralHyperbolaVertexNode[#1](#2)(#3){% + \begingroup + \@InitListMng % + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pst@getcoor{#3}\pst@tempR% + \@ifnextchar[\Pst@GeneralHyperbolaVertexNode@i{\Pst@GeneralHyperbolaVertexNode@i[0]}}% +\def\Pst@GeneralHyperbolaVertexNode@i[#1]#2#3{% + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + #1 dup cos exch sin % cos\theta sin\theta + 5 index 4 index 3 index mul sub % x=x0-a\cos\theta + 5 index 5 index 3 index mul sub % y=y0-a\sin\theta + 8 2 roll pop pop pop pop pop pop + ){#2} + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + #1 dup cos exch sin % cos\theta sin\theta + 5 index 4 index 3 index mul add % x=x0+a\cos\theta + 5 index 5 index 3 index mul add % y=y0+a\sin\theta + 8 2 roll pop pop pop pop pop pop + ){#3} + \Pst@ManageParamList{#2}% + \Pst@ManageParamList{#3}% + \endgroup% +}% +% +%% \pstGeneralHyperbolaDirectrixLine[Options](O)(a,b)[rotation]{Lx}{Ly}{Rx}{Ry} +%% Draw the two directrix lines of the General Hyperbola H. +%% If you not input the rotation angle, the default value is $0^\circ$. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the hyperbola center O +%% #3 -> [input] the radii of real and imaginary axis +%% #4 -> [input] the rotation angle $\theta$ of the symmetrical axis. +%% #5 -> [output] the first node Lx on the first directrix line. +%% #6 -> [output] the second node Lx on the first directrix line. +%% #7 -> [output] the first node Lx on the second directrix line. +%% #8 -> [output] the second node Lx on the second directrix line. +\def\pstGeneralHyperbolaDirectrixLine{\@ifnextchar[\Pst@GeneralHyperbolaDirectrixLine{\Pst@GeneralHyperbolaDirectrixLine[]}} +\def\Pst@GeneralHyperbolaDirectrixLine[#1](#2)(#3){% + \begingroup + \@InitListMng % + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pst@getcoor{#3}\pst@tempR% + \@ifnextchar[\Pst@GeneralHyperbolaDirectrixLine@i{\Pst@GeneralHyperbolaDirectrixLine@i[0]}}% +\def\Pst@GeneralHyperbolaDirectrixLine@i[#1]#2#3#4#5{% + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + 1 index dup mul 1 index dup mul add sqrt % c=sqrt(a^2+b^2) + 2 index dup mul 1 index div 5 index exch sub 4 index % x0-a^2/c,y0 + 7 2 roll pop pop pop % x,y,x0,y0 + #1 dup cos exch sin % cos\theta sin\theta + 3 index 6 index 5 index sub 3 index mul add 5 index 4 index sub 2 index mul sub % x0+(x-x0)\cos\theta-(y-y0)\sin\theta + 3 index 7 index 6 index sub 3 index mul add 6 index 5 index sub 4 index mul add % y0+(x-x0)\sin\theta+(y-y0)\cos\theta + 8 2 roll pop pop pop pop pop pop + ){#2} + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + 1 index dup mul 1 index dup mul add sqrt % c=sqrt(a^2+b^2) + 2 index dup mul 1 index div 5 index exch sub 4 index 1 add % x0-a^2/c,y0+1 + 7 2 roll pop pop pop % x,y,x0,y0 + #1 dup cos exch sin % cos\theta sin\theta + 3 index 6 index 5 index sub 3 index mul add 5 index 4 index sub 2 index mul sub % x0+(x-x0)\cos\theta-(y-y0)\sin\theta + 3 index 7 index 6 index sub 3 index mul add 6 index 5 index sub 4 index mul add % y0+(x-x0)\sin\theta+(y-y0)\cos\theta + 8 2 roll pop pop pop pop pop pop + ){#3} + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + 1 index dup mul 1 index dup mul add sqrt % c=sqrt(a^2+b^2) + 2 index dup mul 1 index div 5 index add 4 index % x0+a^2/c,y0 + 7 2 roll pop pop pop % x,y,x0,y0 + #1 dup cos exch sin % cos\theta sin\theta + 3 index 6 index 5 index sub 3 index mul add 5 index 4 index sub 2 index mul sub % x0+(x-x0)\cos\theta-(y-y0)\sin\theta + 3 index 7 index 6 index sub 3 index mul add 6 index 5 index sub 4 index mul add % y0+(x-x0)\sin\theta+(y-y0)\cos\theta + 8 2 roll pop pop pop pop pop pop + ){#4} + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + 1 index dup mul 1 index dup mul add sqrt % c=sqrt(a^2+b^2) + 2 index dup mul 1 index div 5 index add 4 index 1 add % x0+a^2/c,y0+1 + 7 2 roll pop pop pop % x,y,x0,y0 + #1 dup cos exch sin % cos\theta sin\theta + 3 index 6 index 5 index sub 3 index mul add 5 index 4 index sub 2 index mul sub % x0+(x-x0)\cos\theta-(y-y0)\sin\theta + 3 index 7 index 6 index sub 3 index mul add 6 index 5 index sub 4 index mul add % y0+(x-x0)\sin\theta+(y-y0)\cos\theta + 8 2 roll pop pop pop pop pop pop + ){#5} + \Pst@ManageParamList{#2}% + \Pst@ManageParamList{#3}% + \Pst@ManageParamList{#4}% + \Pst@ManageParamList{#5}% + \pstLineAB{#2}{#3}% + \pstLineAB{#4}{#5}% + \endgroup% +}% +% +%% \pstGeneralHyperbolaAsymptoteLine[Options](O)(a,b)[rotation]{L1}{L2} +%% Draw the two asymptote lines L1 and L2 of the General Hyperbola H. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the hyperbola center O +%% #3 -> [input] the radii of real and imaginary axis +%% #4 -> [input] the rotation angle $\theta$ of the symmetrical axis. +%% #5 -> [output] the second node name on the first asymptote line, the first node is the center O. +%% #6 -> [output] the second node name on the second asymptote line, the first node is the center O. +\def\pstGeneralHyperbolaAsymptoteLine{\@ifnextchar[\Pst@GeneralHyperbolaAsymptoteLine{\Pst@GeneralHyperbolaAsymptoteLine[]}} +\def\Pst@GeneralHyperbolaAsymptoteLine[#1](#2)(#3){% + \begingroup + \@InitListMng % + \psset{#1}% + \def\pst@hyperbola@center{#2} + \pst@getcoor{#2}\pst@tempO% + \pst@getcoor{#3}\pst@tempR% + \@ifnextchar[\Pst@GeneralHyperbolaAsymptoteLine@i{\Pst@GeneralHyperbolaAsymptoteLine@i[0]}}% +\def\Pst@GeneralHyperbolaAsymptoteLine@i[#1]#2#3{% + \pnode(! + \pst@tempO \tx@UserCoor % x_o,y_o + \pst@tempR \tx@UserCoor % a,b + 0 index 2 index div % b/a + 4 index 1 add % x=x0+1 + 4 index 2 index add % y=y0+b/a + 7 2 roll pop pop pop % x y x_0 y_0 + #1 dup cos exch sin % cos\theta sin\theta + 3 index 6 index 5 index sub 3 index mul add 5 index 4 index sub 2 index mul sub % x0+(x-x0)\cos\theta-(y-y0)\sin\theta + 3 index 7 index 6 index sub 3 index mul add 6 index 5 index sub 4 index mul add % y0+(x-x0)\sin\theta+(y-y0)\cos\theta + 8 2 roll pop pop pop pop pop pop + ){#2}% + \pnode(! + \pst@tempO \tx@UserCoor % x_o,y_o + \pst@tempR \tx@UserCoor % a,b + 0 index 2 index div % b/a + 4 index 1 add % x=x0+1 + 4 index 2 index sub % y=y0-b/a + 7 2 roll pop pop pop % x y x_0 y_0 + #1 dup cos exch sin % cos\theta sin\theta + 3 index 6 index 5 index sub 3 index mul add 5 index 4 index sub 2 index mul sub % x0+(x-x0)\cos\theta-(y-y0)\sin\theta + 3 index 7 index 6 index sub 3 index mul add 6 index 5 index sub 4 index mul add % y0+(x-x0)\sin\theta+(y-y0)\cos\theta + 8 2 roll pop pop pop pop pop pop + ){#3}% + \Pst@ManageParamList{#2}% + \Pst@ManageParamList{#3}% + \pstLineAB{\pst@hyperbola@center}{#2}% + \pstLineAB{\pst@hyperbola@center}{#3}% + \endgroup% +}% +% +%% \pstGeneralHyperbolaLineInter[Options](O)(a,b)[rotation]{A}{B}{C}{D} +%% Find the intersection nodes $C$ and $D$ of the given line AB with the General Hyperbola H. +%% +%% set $e=a\cos\theta$, $f=b\sin\theta$, $g=a\sin\theta$, $h=b\cos\theta$, then we have +%% $$x=x_0+e\sec\alpha-f\tan\alpha, y=y_0+g\sec\alpha+h\tan\alpha$$ +%% when line AB is vertical, the solve is like as pstGeneralHyperbolaLineInter, +%% else we can represent the line AB as the following function: +%% $$y=kx+d$$ where $$k=\dfrac{y_2-y_1}{x_2-x_1}, d=\dfrac{x_2y_1-x_1y_2}{x_2-x_1}$$ +%% Let $X=x-x_0$, $Y=y-y_0$, then we have $Y=kX+m$, where $m=kx_0-y_0+d$, then +%% $$g\sec\alpha+h\tan\alpha=k(e\sec\alpha-f\tan\alpha)+m$$ +%% $$(kf+h)\sin\alpha=m\cos\alpha+ke-g$$ +%% $$(kf+h)^2\sin^2\alpha=m^2\cos^2\alpha+2m(ke-g)\cos\alpha+(ke-g)^2$$ +%% $$(m^2+(kf+h)^2)\cos^2\alpha-2m(g-ke)\cos\alpha+(g-ke)^2-(kf+h)^2=0$$ +%% when $m^2+(kf+h)^2=0$, we have $m=kf+h=0$, at this time $ke-g=0$, we get +%% $$k=-\dfrac{\cos\theta}{\sin\theta}=\dfrac{\sin\theta}{\cos\theta}$$ +%% which is not possible. +%% let $p=kf+h$, $q=g-ke$, so we have +%% $$(m^2+p^2)\cos^2\alpha-2mq\cos\alpha+q^2-p^2=0$$ +%% then +%% $$\cos_{1,2}\alpha=\dfrac{mq\pm{}p\sqrt{m^2+p^2-q^2}}{m^2+p^2},\sin_{1,2}\alpha=\dfrac{-qp\pm{}m\sqrt{m^2+p^2-q^2}}{m^2+p^2}$$ +%% where $\cos\alpha$ can not be zero, we should skip it. +%% +%% Parameters: +%% #1 -> options +%% #2 -> [input] the hyperbola center O +%% #3 -> [input] the radii of real and imaginary axis +%% #4 -> [input] the rotation angle $\theta$ of the symmetrical axis. +%% #5 -> [input] the first node on the given line. +%% #6 -> [input] the second node on the given line. +%% #7 -> [output] the first intersection node name. +%% #8 -> [output] the second intersection node name. +\def\pstGeneralHyperbolaLineInter{\@ifnextchar[\Pst@GeneralHyperbolaLineInter{\Pst@GeneralHyperbolaLineInter[]}} +\def\Pst@GeneralHyperbolaLineInter[#1](#2)(#3){% + \begingroup + \@InitListMng % + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pst@getcoor{#3}\pst@tempR% + \@ifnextchar[\Pst@GeneralHyperbolaLineInter@i{\Pst@GeneralHyperbolaLineInter@i[0]}}% +\def\Pst@GeneralHyperbolaLineInter@i[#1]#2#3#4#5{% + \pst@getcoor{#2}\pst@tempA% + \pst@getcoor{#3}\pst@tempB% + \pnode(!% + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + \pst@tempA \tx@UserCoor % x1,y1 + \pst@tempB \tx@UserCoor % x2,y2 + 3 index 2 index sub abs 1E-5 lt { % if the line AB is vertical + #1 dup cos exch sin % cos\theta sin\theta + 7 index 2 index mul % e=a\cos\theta + 7 index 2 index mul % f=b\sin\theta + 9 index 3 index mul % g=a\sin\theta + 9 index 5 index mul % h=b\cos\theta + 7 index 14 index sub % n=x1-x0 + 0 index dup mul 4 index dup mul add % n^2+f^2 + 0 index abs 1E-5 lt { + pop pop pop pop pop pop + pop pop pop pop pop pop 0 0 + } { + 0 index 6 index dup mul sub dup 0 lt { + pop pop pop pop pop pop pop + pop pop pop pop pop pop 0 0 + } { + sqrt % sqrt(n^2+f^2-e^2) + %% \sin_{1,2}\alpha=\dfrac{ef\pm{}n\sqrt{n^2+f^2-e^2}}{n^2+f^2} + 2 index 1 index mul 7 index 7 index mul exch sub 2 index div % sin + %% \cos_{1,2}\alpha=\dfrac{en\mp{}f\sqrt{n^2+f^2-e^2}}{n^2+f^2} + 6 index 2 index mul 8 index 5 index mul add 3 index div % cos + dup abs 1E-5 lt { + pop pop pop pop pop pop pop pop + pop pop pop pop pop pop pop 0 0 + } { + 18 index 9 index 2 index div add 8 index 3 index mul 2 index div sub % x_1=x_0+e\sec\alpha-f\tan\alpha + 18 index 8 index 3 index div add 7 index 4 index mul 3 index div add % y_1=y_0+g\sec\alpha+h\tan\alpha + 21 2 roll pop pop pop pop pop pop pop pop + pop pop pop pop pop pop pop pop pop pop pop + } ifelse + } ifelse + } ifelse + } { + 0 index 3 index sub 2 index 5 index sub div % k + 2 index 4 index mul 2 index 6 index mul sub 3 index 6 index sub div % d + 1 index 10 index mul 9 index sub 1 index add % m=kx_o-y_o+d + #1 dup cos exch sin % cos\theta sin\theta + 10 index 2 index mul % e=a\cos\theta + 10 index 2 index mul % f=b\sin\theta + 12 index 3 index mul % g=a\sin\theta + 12 index 5 index mul % h=b\cos\theta + 0 index 9 index 4 index mul add % p=h+kf + 2 index 10 index 6 index mul sub % q=g-ke + 8 index dup mul 2 index dup mul add % m^2+p^2 + dup 1E-5 lt { + pop pop pop pop pop pop pop pop pop pop + pop pop pop pop pop pop pop pop pop pop + 0 0 + } { + 0 index 2 index dup mul sub dup 0 lt { + pop pop pop pop pop pop pop pop pop pop + pop pop pop pop pop pop pop pop pop pop + pop 0 0 + } { + sqrt % sqrt(m^2+p^2-q^2) + % \sin_{1,2}\alpha=\dfrac{-qp\pm{}m\sqrt{m^2+p^2-q^2}}{m^2+p^2} + 10 index 1 index mul 4 index 4 index mul sub 2 index div % \sin\alpha + % \cos_{1,2}\alpha=\dfrac{mq\pm{}p\sqrt{m^2+p^2-q^2}}{m^2+p^2} + 4 index 2 index mul 12 index 5 index mul add 3 index div % \cos\alpha + dup abs 1E-5 lt { + pop pop pop pop pop pop pop pop pop pop + pop pop pop pop pop pop pop pop pop pop + pop pop pop 0 0 + } { + % x=x_0+e\sec\alpha-f\tan\alpha, y=y_0+g\sec\alpha+h\tan\alpha + 22 index 10 index 2 index div add 9 index 3 index mul 2 index div sub % x_1 + 22 index 9 index 3 index div add 8 index 4 index mul 3 index div add % y_1 + 25 2 roll + pop pop pop pop pop pop pop pop pop pop + pop pop pop pop pop pop pop pop pop pop + pop pop pop + } ifelse + } ifelse + } ifelse + } ifelse + ){#4}% + \pnode(!% + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + \pst@tempA \tx@UserCoor % x1,y1 + \pst@tempB \tx@UserCoor % x2,y2 + 3 index 2 index sub abs 1E-5 lt { % if the line AB is vertical + #1 dup cos exch sin % cos\theta sin\theta + 7 index 2 index mul % e=a\cos\theta + 7 index 2 index mul % f=b\sin\theta + 9 index 3 index mul % g=a\sin\theta + 9 index 5 index mul % h=b\cos\theta + 7 index 14 index sub % n=x1-x0 + 0 index dup mul 4 index dup mul add % n^2+f^2 + 0 index abs 1E-5 lt { + pop pop pop pop pop pop + pop pop pop pop pop pop 0 0 + } { + 0 index 6 index dup mul sub dup 0 lt { + pop pop pop pop pop pop pop + pop pop pop pop pop pop 0 0 + } { + sqrt % sqrt(n^2+f^2-e^2) + %% \sin_{1,2}\alpha=\dfrac{ef\pm{}n\sqrt{n^2+f^2-e^2}}{n^2+f^2} + 2 index 1 index mul 7 index 7 index mul add 2 index div % sin + %% \cos_{1,2}\alpha=\dfrac{en\mp{}f\sqrt{n^2+f^2-e^2}}{n^2+f^2} + 6 index 2 index mul 8 index 5 index mul exch sub 3 index div % cos + dup abs 1E-5 lt { + pop pop pop pop pop pop pop pop + pop pop pop pop pop pop pop 0 0 + } { + 18 index 9 index 2 index div add 8 index 3 index mul 2 index div sub % x_2=x_0+e\sec\alpha-f\tan\alpha + 18 index 8 index 3 index div add 7 index 4 index mul 3 index div add % y_2=y_0+g\sec\alpha+h\tan\alpha + 21 2 roll pop pop pop pop pop pop pop pop + pop pop pop pop pop pop pop pop pop pop pop + } ifelse + } ifelse + } ifelse + } { + 0 index 3 index sub 2 index 5 index sub div % k + 2 index 4 index mul 2 index 6 index mul sub 3 index 6 index sub div % d + 1 index 10 index mul 9 index sub 1 index add % m=kx_o-y_o+d + #1 dup cos exch sin % cos\theta sin\theta + 10 index 2 index mul % e=a\cos\theta + 10 index 2 index mul % f=b\sin\theta + 12 index 3 index mul % g=a\sin\theta + 12 index 5 index mul % h=b\cos\theta + 0 index 9 index 4 index mul add % p=h+kf + 2 index 10 index 6 index mul sub % q=g-ke + 8 index dup mul 2 index dup mul add % m^2+p^2 + dup 1E-5 lt { + pop pop pop pop pop pop pop pop pop pop + pop pop pop pop pop pop pop pop pop pop + 0 0 + } { + 0 index 2 index dup mul sub dup 0 lt { + pop pop pop pop pop pop pop pop pop pop + pop pop pop pop pop pop pop pop pop pop + pop 0 0 + } { + sqrt % sqrt(m^2+p^2-q^2) + % \sin_{1,2}\alpha=\dfrac{-qp\pm{}m\sqrt{m^2+p^2-q^2}}{m^2+p^2} + 10 index 1 index mul 4 index 4 index mul add neg 2 index div % \sin\alpha + % \cos_{1,2}\alpha=\dfrac{mq\pm{}p\sqrt{m^2+p^2-q^2}}{m^2+p^2} + 4 index 2 index mul 12 index 5 index mul exch sub 3 index div % \cos\alpha + dup abs 1E-5 lt { + pop pop pop pop pop pop pop pop pop pop + pop pop pop pop pop pop pop pop pop pop + pop pop pop 0 0 + } { + % x=x_0+e\sec\alpha-f\tan\alpha, y=y_0+g\sec\alpha+h\tan\alpha + 22 index 10 index 2 index div add 9 index 3 index mul 2 index div sub % x_1 + 22 index 9 index 3 index div add 8 index 4 index mul 3 index div add % y_1 + 25 2 roll + pop pop pop pop pop pop pop pop pop pop + pop pop pop pop pop pop pop pop pop pop + pop pop pop + } ifelse + } ifelse + } ifelse + } ifelse + ){#5}% + \Pst@ManageParamList{#4}% + \Pst@ManageParamList{#5}% + \endgroup% +}% +% +%% \pstGeneralHyperbolaPolarNode[Options](O)(a,b)[rotation]{A}{B}{T} +%% Find the polar point of chord AB on General Hyperbola H. +%% We use the following proposition to find the polar point of chord AB: +%% Let $P$, $Q$ are vertex points of the hyperbola, for any chord $AB$ of hyperbola, $PA$ and $BQ$ intersect at $E$, $PB$ and $AQ$ intersect at $F$, then the middle point $M$ of $EF$ is the polar point of chord $AB$. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the hyperbola center O +%% #3 -> [input] the radii of real and imaginary axis +%% #4 -> [input] the rotation angle $\theta$ of the symmetrical axis. +%% #5 -> [input] the node A on the hyperbola. +%% #6 -> [input] the node B on the hyperbola. +%% #7 -> [output] the polar node T of chord AB. +\def\pstGeneralHyperbolaPolarNode{\@ifnextchar[\Pst@GeneralHyperbolaPolarNode{\Pst@GeneralHyperbolaPolarNode[]}} +\def\Pst@GeneralHyperbolaPolarNode[#1](#2)(#3){% + \begingroup + \psset{#1}% + \def\pst@hyperbola@center{#2} + \def\pst@hyperbola@radii{#3} + \@ifnextchar[\Pst@GeneralHyperbolaPolarNode@i{\Pst@GeneralHyperbolaPolarNode@i[0]}}% +\def\Pst@GeneralHyperbolaPolarNode@i[#1]#2#3#4{% + \pstGeneralHyperbolaVertexNode[PointName=none,PointSymbol=none](\pst@hyperbola@center)(\pst@hyperbola@radii)[#1]{@PST@GENERALHYPERBOLA@VERTEXA}{@PST@GENERALHYPERBOLA@VERTEXB} + \pstInterLL[PointName=none,PointSymbol=none]{#2}{@PST@GENERALHYPERBOLA@VERTEXA}{#3}{@PST@GENERALHYPERBOLA@VERTEXB}{@PST@GENERALHYPERBOLA@INTER@X} + \pstInterLL[PointName=none,PointSymbol=none]{#3}{@PST@GENERALHYPERBOLA@VERTEXA}{#2}{@PST@GENERALHYPERBOLA@VERTEXB}{@PST@GENERALHYPERBOLA@INTER@Y} + \pstMiddleAB{@PST@GENERALHYPERBOLA@INTER@X}{@PST@GENERALHYPERBOLA@INTER@Y}{#4} + \Pst@geonodelabel{#4}% + \pstLineAB{#2}{#4} + \pstLineAB{#3}{#4} + \endgroup +}% +% +%% \pstGeneralHyperbolaTangentNode[Options](O)(a,b)[rotation]{T}{A}{B} +%% Draw the two tangent lines through the point $T$ to the General Hyperbola H and get the node A and B on the General Hyperbola. +%% We use the following proposition to find the tangent points $A$ and $B$ of $T$: +%% Let $T$ is a point out of the hyperbola, we give any two chords $TPQ$ and $TRS$ of the hyperbola, $PR$ and $QS$ intersect at $X$, $RQ$ and $PS$ intersect at $Y$, +%% then the intersection point $A$ and $B$ of $XY$ and the hyperbola are the tangent points from $T$. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the hyperbola center O +%% #3 -> [input] the radii of real and imaginary axis +%% #4 -> [input] the rotation angle $\theta$ of the symmetrical axis. +%% #5 -> [input] the given node T outside the hyperbola +%% #6 -> [output] the tangent node name A on the hyperbola +%% #7 -> [output] the tangent node name B on the hyperbola +\def\pstGeneralHyperbolaTangentNode{\@ifnextchar[\Pst@GeneralHyperbolaTangentNode{\Pst@GeneralHyperbolaTangentNode[]}} +\def\Pst@GeneralHyperbolaTangentNode[#1](#2)(#3){% + \begingroup + \@InitListMng % + \psset{#1}% + \def\pst@hyperbola@center{#2} + \def\pst@hyperbola@radii{#3} + \@ifnextchar[\Pst@GeneralHyperbolaTangentNode@i{\Pst@GeneralHyperbolaTangentNode@i[0]}}% +\def\Pst@GeneralHyperbolaTangentNode@i[#1]#2#3#4{% + \pstGeneralHyperbolaNode[PointName=none,PointSymbol=none](\pst@hyperbola@center)(\pst@hyperbola@radii)[#1]{10}{@PST@GENERALHYPERBOLA@TANGENTAUX@P0} + \pstGeneralHyperbolaNode[PointName=none,PointSymbol=none](\pst@hyperbola@center)(\pst@hyperbola@radii)[#1]{-10}{@PST@GENERALHYPERBOLA@TANGENTAUX@R0} + \pstGeneralHyperbolaLineInter[PointName=none,PointSymbol=none](\pst@hyperbola@center)(\pst@hyperbola@radii)[#1]{#2}{@PST@GENERALHYPERBOLA@TANGENTAUX@P0}{@PST@GENERALHYPERBOLA@TANGENTAUX@P}{@PST@GENERALHYPERBOLA@TANGENTAUX@Q} + \pstGeneralHyperbolaLineInter[PointName=none,PointSymbol=none](\pst@hyperbola@center)(\pst@hyperbola@radii)[#1]{#2}{@PST@GENERALHYPERBOLA@TANGENTAUX@R0}{@PST@GENERALHYPERBOLA@TANGENTAUX@R}{@PST@GENERALHYPERBOLA@TANGENTAUX@S} + \pstInterLL[PointName=none,PointSymbol=none]{@PST@GENERALHYPERBOLA@TANGENTAUX@P}{@PST@GENERALHYPERBOLA@TANGENTAUX@S}{@PST@GENERALHYPERBOLA@TANGENTAUX@Q}{@PST@GENERALHYPERBOLA@TANGENTAUX@R}{@PST@GENERALHYPERBOLA@TANGENTAUX@I} + \pstInterLL[PointName=none,PointSymbol=none]{@PST@GENERALHYPERBOLA@TANGENTAUX@P}{@PST@GENERALHYPERBOLA@TANGENTAUX@R}{@PST@GENERALHYPERBOLA@TANGENTAUX@Q}{@PST@GENERALHYPERBOLA@TANGENTAUX@S}{@PST@GENERALHYPERBOLA@TANGENTAUX@X} + \pstGeneralHyperbolaLineInter(\pst@hyperbola@center)(\pst@hyperbola@radii)[#1]{@PST@GENERALHYPERBOLA@TANGENTAUX@X}{@PST@GENERALHYPERBOLA@TANGENTAUX@I}{#3}{#4} + \Pst@ManageParamList{#3}% + \Pst@ManageParamList{#4}% + \pstLineAB{#2}{#3} + \pstLineAB{#2}{#4} + \endgroup% +}% +% +% 10. General Inversion Hyperbola with coordinate translation and rotation +%% ---------------------------------------------------------- +%% The General Inversion Hyperbola H is defined by center O, the half of the real axis $a$, the half of the imaginary axis $b$, +%% and the rotation angle $\theta$ of the principal axis. +%% The equation can be got from the parametric function of the Standard Inversion Hyperbola \ref{ParametricFunctionOfStandardInversionHyperbola}, +%% using the rotation transform formula \ref{RotationTransformFormula}, then we have +%% \begin{equation} +%% \left\{\begin{array}{l} +%% x'=(b\tan\alpha+x_o)\cos\theta-(a\sec\alpha+y_o)\sin\theta=x_o'+b\tan\alpha\cos\theta-a\sec\alpha\sin\theta\\ +%% y'=(b\tan\alpha+x_o)\sin\theta+(a\sec\alpha+y_o)\cos\theta=y_o'+b\tan\alpha\sin\theta+a\sec\alpha\cos\theta +%% \end{array}\right. +%% \end{equation} +%% where the $x_o'$ and $y_o'$ are the coordinate of the given center O after rotation. +%% So we get the parametric function of the General Inversion Hyperbola with coordinate translation and rotation as following: +%% \begin{equation}\label{ParametricFunctionOfGeneralInversionHyperbola} +%% \left\{\begin{array}{l} +%% x=x_o+b\tan\alpha\cos\theta-a\sec\alpha\sin\theta\\ +%% y=y_o+b\tan\alpha\sin\theta+a\sec\alpha\cos\theta +%% \end{array}\right. +%% \end{equation} +% +%% \pstGeneralIHyperbola[Options](O)(a,b)[rotation][maxAngleX] +%% Draw a General Inversion Hyperbola with center O, the half of the real axis $abs(a)$, the half of the imaginary axis $abs(b)$, +%% and the rotation angle $\theta$ of the symmetrical axis. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the hyperbola center O +%% #3 -> [input] the radii of real and imaginary axis +%% #4 -> [input] the rotation angle $\theta$ of the symmetrical axis. +%% #5 -> [input] the maximal angle to draw the branch. +\def\pstGeneralIHyperbola{\@ifnextchar[\Pst@GeneralIHyperbola{\Pst@GeneralIHyperbola[]}} +\def\Pst@GeneralIHyperbola[#1](#2)(#3){% + \begingroup + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pst@getcoor{#3}\pst@tempR% + \@ifnextchar[\Pst@GeneralIHyperbola@i{\Pst@GeneralIHyperbola@i[0]}}% +\def\Pst@GeneralIHyperbola@i[#1]{% + \def\pst@hyperbola@rotation{#1}% + \@ifnextchar[\Pst@GeneralIHyperbola@j{\Pst@GeneralIHyperbola@j[85]}}% +\def\Pst@GeneralIHyperbola@j[#1]{% + \pst@cnth=#1\pst@cntg=180\pst@cntm=180\pst@cntn=360 + \ifnum\pst@cnth<0 + \loop\advance\pst@cnth by 90 + \ifnum\pst@cnth<0 + \repeat + \fi + \ifnum\pst@cnth>90 + \loop\advance\pst@cnth by -90 + \ifnum\pst@cnth>90 + \repeat + \fi + \ifnum\pst@cnth>85 + \advance\pst@cnth by -5 + \fi + \advance\pst@cntg by -\pst@cnth + \advance\pst@cntm by \pst@cnth + \advance\pst@cntn by -\pst@cnth + \Pst@GeneralIHyperbola@k[0][\number\pst@cnth]% + \Pst@GeneralIHyperbola@k[\number\pst@cntg][180]% + \Pst@GeneralIHyperbola@k[180][\number\pst@cntm]% + \Pst@GeneralIHyperbola@k[\number\pst@cntn][360]% + \endgroup% +}% +\def\Pst@GeneralIHyperbola@k[#1][#2]{% + \parametricplot{#1}{#2}{% + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + t dup cos exch sin % cos{t} sin{t} + 1 index abs 1E-5 lt { + pop pop pop pop + } { + \pst@hyperbola@rotation\space dup cos exch sin % cos\theta sin\theta + %% x=x_o+b\tan\alpha\cos\theta-a\sec\alpha\sin\theta + 7 index 5 index 5 index div 4 index mul 3 index mul add + 6 index 5 index div 2 index mul sub + %% y=y_o+b\tan\alpha\sin\theta+a\sec\alpha\cos\theta + 7 index 6 index 5 index mul 6 index div 3 index mul add + 7 index 6 index div 4 index mul add + 10 2 roll pop pop pop pop pop pop pop pop + } ifelse + }% +}% +% +%% \pstGeneralIHyperbolaNode[Options](O)(a,b)[rotation]{t}{A} +%% Draw a node whose parameter value is the given value t on the General Inversion Hyperbola. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the hyperbola center O +%% #3 -> [input] the radii of real and imaginary axis +%% #4 -> [input] the rotation angle $\theta$ of the symmetrical axis. +%% #5 -> [input] the parameter value t. +%% #6 -> [output] the target node name. +\def\pstGeneralIHyperbolaNode{\@ifnextchar[\Pst@GeneralIHyperbolaNode{\Pst@GeneralIHyperbolaNode[]}} +\def\Pst@GeneralIHyperbolaNode[#1](#2)(#3){% + \begingroup + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pst@getcoor{#3}\pst@tempR% + \@ifnextchar[\Pst@GeneralIHyperbolaNode@i{\Pst@GeneralIHyperbolaNode@i[0]}}% +\def\Pst@GeneralIHyperbolaNode@i[#1]#2#3{% + \pnode(!% + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + #2 dup cos exch sin % cos{t} sin{t} + 1 index abs 1E-5 lt { + pop pop pop pop + } { + #1 dup cos exch sin % cos\theta sin\theta + %% x=x_o+b\tan\alpha\cos\theta-a\sec\alpha\sin\theta + 7 index 5 index 5 index div 4 index mul 3 index mul add + 6 index 5 index div 2 index mul sub + %% y=y_o+b\tan\alpha\sin\theta+a\sec\alpha\cos\theta + 7 index 6 index 5 index mul 6 index div 3 index mul add + 7 index 6 index div 4 index mul add + 10 2 roll pop pop pop pop pop pop pop pop + } ifelse + ){#3}% + \Pst@geonodelabel{#3}% + \endgroup% +}% +% +%% \pstGeneralIHyperbolaAbsNode[Options](O)(a,b)[rotation]{x_1}{A}{B} +%% Draw the nodes whose abscissa value are the given value x_1 on the General Inversion Hyperbola. +%% +%% set $e=a\cos\theta$, $f=b\sin\theta$, $g=a\sin\theta$, $h=b\cos\theta$, then we have +%% $$x=x_0+h\tan\alpha-g\sec\alpha, y=y_0+f\tan\alpha+e\sec\alpha$$ +%% when $x=x_1$, we get +%% $$h\tan\alpha-g\sec\alpha=x_1-x_0$$ +%% set $n=x_1-x_0$, we have +%% $$h\sin\alpha-n\cos\alpha=g$$ +%% then +%% $$(n^2+h^2)\cos^2\alpha+2ng\cos\alpha+g^2-h^2=0$$ +%% if $n^2+h^2=0$, we have $n=h=0$, i.e, $x_1=x_0$ and $\cos\theta=0$, but the last equation gives $g=0$, which is not possible. +%% so $n^2+h^2\neq0$, we get +%% $$\cos_{1,2}\alpha=\dfrac{-ng\pm{}h\sqrt{n^2+h^2-g^2}}{n^2+h^2}$$ +%% and +%% $$\sin_{1,2}\alpha=\dfrac{gh\pm{}n\sqrt{n^2+h^2-g^2}}{n^2+h^2}$$ +%% where $\cos\alpha$ can not be zero, but when $h=\pm{}g$, we have $\cos\alpha=0$, we should skip it. +%% +%% Parameters: +%% #1 -> options +%% #2 -> [input] the hyperbola center O +%% #3 -> [input] the radii of real and imaginary axis +%% #4 -> [input] the rotation angle $\theta$ of the symmetrical axis. +%% #5 -> [input] the abscissa value x_1. +%% #6 -> [output] the first target node name. +%% #7 -> [output] the second target node name. +\def\pstGeneralIHyperbolaAbsNode{\@ifnextchar[\Pst@GeneralIHyperbolaAbsNode{\Pst@GeneralIHyperbolaAbsNode[]}} +\def\Pst@GeneralIHyperbolaAbsNode[#1](#2)(#3){% + \begingroup + \@InitListMng % + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pst@getcoor{#3}\pst@tempR% + \@ifnextchar[\Pst@GeneralIHyperbolaAbsNode@i{\Pst@GeneralIHyperbolaAbsNode@i[0]}}% +\def\Pst@GeneralIHyperbolaAbsNode@i[#1]#2#3#4{% + \pnode(!% + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + #1 dup cos exch sin % cos\theta sin\theta + 3 index 2 index mul % e=a\cos\theta + 3 index 2 index mul % f=b\sin\theta + 5 index 3 index mul % g=a\sin\theta + 5 index 5 index mul % h=b\cos\theta + #2 10 index sub % n=x1-x0 + 0 index dup mul 2 index dup mul add % n^2+h^2 + 0 index abs 1E-5 lt { + pop pop pop pop pop pop + pop pop pop pop pop pop 0 0 + } { + 0 index 4 index dup mul sub dup 0 lt { + pop pop pop pop pop pop pop + pop pop pop pop pop pop 0 0 + } { + sqrt % sqrt(n^2+h^2-g^2) + %% \sin_{1,2}\alpha=\dfrac{gh\pm{}n\sqrt{n^2+h^2-g^2}}{n^2+h^2} + 2 index 1 index mul 5 index 5 index mul exch sub 2 index div % sin + %% \cos_{1,2}\alpha=\dfrac{-ng\pm{}h\sqrt{n^2+h^2-g^2}}{n^2+h^2} + 4 index 2 index mul 4 index 7 index mul add neg 3 index div % cos + dup abs 1E-5 lt { + pop pop pop pop pop pop pop pop + pop pop pop pop pop pop pop 0 0 + } { + 14 index 6 index 3 index mul 2 index div add 7 index 2 index div sub % x_1=x_0+h\tan\alpha-g\sec\alpha + 14 index 9 index 4 index mul 3 index div add 10 index 3 index div add % y_1=y_0+f\tan\alpha+e\sec\alpha + 17 2 roll pop pop pop pop pop pop pop pop + pop pop pop pop pop pop pop + } ifelse + } ifelse + } ifelse + ){#3}% + \pnode(!% + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + #1 dup cos exch sin % cos\theta sin\theta + 3 index 2 index mul % e=a\cos\theta + 3 index 2 index mul % f=b\sin\theta + 5 index 3 index mul % g=a\sin\theta + 5 index 5 index mul % h=b\cos\theta + #2 10 index sub % n=x1-x0 + 0 index dup mul 2 index dup mul add % n^2+h^2 + 0 index abs 1E-5 lt { + pop pop pop pop pop pop + pop pop pop pop pop pop 0 0 + } { + 0 index 4 index dup mul sub dup 0 lt { + pop pop pop pop pop pop pop + pop pop pop pop pop pop 0 0 + } { + sqrt % sqrt(n^2+h^2-g^2) + %% \sin_{1,2}\alpha=\dfrac{gh\pm{}n\sqrt{n^2+h^2-g^2}}{n^2+h^2} + 2 index 1 index mul 5 index 5 index mul add 2 index div % sin + %% \cos_{1,2}\alpha=\dfrac{-ng\pm{}h\sqrt{n^2+h^2-g^2}}{n^2+h^2} + 4 index 2 index mul 4 index 7 index mul sub 3 index div % cos + dup abs 1E-5 lt { + pop pop pop pop pop pop pop pop + pop pop pop pop pop pop pop 0 0 + } { + 14 index 6 index 3 index mul 2 index div add 7 index 2 index div sub % x_2=x_0+h\tan\alpha-g\sec\alpha + 14 index 9 index 4 index mul 3 index div add 10 index 3 index div add % y_2=y_0+f\tan\alpha+e\sec\alpha + 17 2 roll pop pop pop pop pop pop pop pop + pop pop pop pop pop pop pop + } ifelse + } ifelse + } ifelse + ){#4}% + \Pst@ManageParamList{#3}% + \Pst@ManageParamList{#4}% + \endgroup% +}% +% +%% \pstGeneralIHyperbolaOrdNode[Options](O)(a,b)[rotation]{y_1}{A}{B} +%% Draw the nodes whose ordinate value are the given value y_1 on the General Inversion Hyperbola. +%% +%% set $e=a\cos\theta$, $f=b\sin\theta$, $g=a\sin\theta$, $h=b\cos\theta$, then we have +%% $$x=x_0+h\tan\alpha-g\sec\alpha, y=y_0+f\tan\alpha+e\sec\alpha$$ +%% when $y=y_1$, we get +%% $$f\tan\alpha+e\sec\alpha=y_1-y_0$$ +%% set $m=y_1-y_0$, we have +%% $$m\cos\alpha-f\sin\alpha=e$$ +%% then +%% $$(m^2+f^2)\sin^2\alpha+2fe\sin\alpha+e^2-m^2=0$$ +%% if $m^2+f^2=0$, we have $m=f=0$, i.e, $y_1=y_0$ and $\sin\theta=0$, but the last equation gives $e=0$, which is not possible. +%% so $m^2+f^2\neq0$, we get +%% $$\sin_{1,2}\alpha=\dfrac{-fe\pm{}m\sqrt{m^2+f^2-e^2}}{m^2+f^2}$$ +%% and +%% $$\cos_{1,2}\alpha=\dfrac{em\pm{}f\sqrt{m^2+f^2-e^2}}{m^2+f^2}$$ +%% where $\cos\alpha$ can not be zero, but when $f=\pm{}e$, we have $\cos\alpha=0$, we should skip it. +%% +%% Parameters: +%% #1 -> options +%% #2 -> [input] the hyperbola center O +%% #3 -> [input] the radii of real and imaginary axis +%% #4 -> [input] the rotation angle $\theta$ of the symmetrical axis. +%% #5 -> [input] the ordinate value y_1. +%% #6 -> [output] the first target node name. +%% #7 -> [output] the second target node name. +\def\pstGeneralIHyperbolaOrdNode{\@ifnextchar[\Pst@GeneralIHyperbolaOrdNode{\Pst@GeneralIHyperbolaOrdNode[]}} +\def\Pst@GeneralIHyperbolaOrdNode[#1](#2)(#3){% + \begingroup + \@InitListMng % + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pst@getcoor{#3}\pst@tempR% + \@ifnextchar[\Pst@GeneralIHyperbolaOrdNode@i{\Pst@GeneralIHyperbolaOrdNode@i[0]}}% +\def\Pst@GeneralIHyperbolaOrdNode@i[#1]#2#3#4{% + \pnode(!% + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + #1 dup cos exch sin % cos\theta sin\theta + 3 index 2 index mul % e=a\cos\theta + 3 index 2 index mul % f=b\sin\theta + 5 index 3 index mul % g=a\sin\theta + 5 index 5 index mul % h=b\cos\theta + #2 9 index sub % m=y1-y0 + 0 index dup mul 4 index dup mul add % m^2+f^2 + 0 index abs 1E-5 lt { + pop pop pop pop pop pop + pop pop pop pop pop pop 0 0 + } { + 0 index 6 index dup mul sub dup 0 lt { + pop pop pop pop pop pop pop + pop pop pop pop pop pop 0 0 + } { + sqrt % sqrt(m^2+f^2-e^2) + %% \sin_{1,2}\alpha=\dfrac{-fe\pm{}m\sqrt{m^2+f^2-e^2}}{m^2+f^2} + 2 index 1 index mul 7 index 7 index mul add neg 2 index div % sin + %% \cos_{1,2}\alpha=\dfrac{em\pm{}f\sqrt{m^2+f^2-e^2}}{m^2+f^2} + 6 index 2 index mul 8 index 5 index mul exch sub 3 index div % cos + dup abs 1E-5 lt { + pop pop pop pop pop pop pop pop + pop pop pop pop pop pop pop 0 0 + } { + 14 index 6 index 3 index mul 2 index div add 7 index 2 index div sub % x_1=x_0+h\tan\alpha-g\sec\alpha + 14 index 9 index 4 index mul 3 index div add 10 index 3 index div add % y_1=y_0+f\tan\alpha+e\sec\alpha + 17 2 roll pop pop pop pop pop pop pop pop + pop pop pop pop pop pop pop + } ifelse + } ifelse + } ifelse + ){#3}% + \pnode(!% + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + #1 dup cos exch sin % cos\theta sin\theta + 3 index 2 index mul % e=a\cos\theta + 3 index 2 index mul % f=b\sin\theta + 5 index 3 index mul % g=a\sin\theta + 5 index 5 index mul % h=b\cos\theta + #2 9 index sub % m=y1-y0 + 0 index dup mul 4 index dup mul add % m^2+f^2 + 0 index abs 1E-5 lt { + pop pop pop pop pop pop + pop pop pop pop pop pop 0 0 + } { + 0 index 6 index dup mul sub dup 0 lt { + pop pop pop pop pop pop pop + pop pop pop pop pop pop 0 0 + } { + sqrt % sqrt(m^2+f^2-e^2) + %% \sin_{1,2}\alpha=\dfrac{-fe\pm{}m\sqrt{m^2+f^2-e^2}}{m^2+f^2} + 2 index 1 index mul 7 index 7 index mul sub 2 index div % sin + %% \cos_{1,2}\alpha=\dfrac{em\pm{}f\sqrt{m^2+f^2-e^2}}{m^2+f^2} + 6 index 2 index mul 8 index 5 index mul add 3 index div % cos + dup abs 1E-5 lt { + pop pop pop pop pop pop pop pop + pop pop pop pop pop pop pop 0 0 + } { + 14 index 6 index 3 index mul 2 index div add 7 index 2 index div sub % x_2=x_0+h\tan\alpha-g\sec\alpha + 14 index 9 index 4 index mul 3 index div add 10 index 3 index div add % y_2=y_0+f\tan\alpha+e\sec\alpha + 17 2 roll pop pop pop pop pop pop pop pop + pop pop pop pop pop pop pop + } ifelse + } ifelse + } ifelse + ){#4}% + \Pst@ManageParamList{#3}% + \Pst@ManageParamList{#4}% + \endgroup% +}% +% +%% \pstGeneralIHyperbolaFocusNode[Options](O)(a,b)[rotation]{F1}{F2} +%% Draw the focus nodes of the General Inversion Hyperbola H. +%% If you not input the rotation angle, the default value is $0^\circ$. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the hyperbola center O +%% #3 -> [input] the radii of real and imaginary axis +%% #4 -> [input] the rotation angle $\theta$ of the symmetrical axis. +%% #5 -> [output] the focus node F1 of the Hyperbola. +%% #6 -> [output] the focus node F2 of the Hyperbola. +\def\pstGeneralIHyperbolaFocusNode{\@ifnextchar[\Pst@GeneralIHyperbolaFocusNode{\Pst@GeneralIHyperbolaFocusNode[]}} +\def\Pst@GeneralIHyperbolaFocusNode[#1](#2)(#3){% + \begingroup + \@InitListMng % + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pst@getcoor{#3}\pst@tempR% + \@ifnextchar[\Pst@GeneralIHyperbolaFocusNode@i{\Pst@GeneralIHyperbolaFocusNode@i[0]}}% +\def\Pst@GeneralIHyperbolaFocusNode@i[#1]#2#3{% + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + #1 dup cos exch sin % cos\theta sin\theta + 3 index dup mul 3 index dup mul add sqrt % c=sqrt(a^2+b^2) + 6 index 1 index 3 index mul sub % x=x0-c\sin\theta + 6 index 2 index 5 index mul add % y=y0+c\cos\theta + 9 2 roll pop pop pop pop pop pop pop + ){#2} + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + #1 dup cos exch sin % cos\theta sin\theta + 3 index dup mul 3 index dup mul add sqrt % c=sqrt(a^2+b^2) + 6 index 1 index 3 index mul add % x=x0+c\sin\theta + 6 index 2 index 5 index mul sub % y=y0-c\cos\theta + 9 2 roll pop pop pop pop pop pop pop + ){#3} + \Pst@ManageParamList{#2}% + \Pst@ManageParamList{#3}% + \endgroup% +}% +% +%% \pstGeneralIHyperbolaVertexNode[Options](O)(a,b)[rotation]{V1}{V2} +%% Draw the vertex nodes of the General Inversion Hyperbola H. +%% If you not input the rotation angle, the default value is $0^\circ$. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the hyperbola center O +%% #3 -> [input] the radii of real and imaginary axis +%% #4 -> [input] the rotation angle $\theta$ of the symmetrical axis. +%% #5 -> [output] the vertex node V1 of the Hyperbola. +%% #6 -> [output] the vertex node V2 of the Hyperbola. +\def\pstGeneralIHyperbolaVertexNode{\@ifnextchar[\Pst@GeneralIHyperbolaVertexNode{\Pst@GeneralIHyperbolaVertexNode[]}} +\def\Pst@GeneralIHyperbolaVertexNode[#1](#2)(#3){% + \begingroup + \@InitListMng % + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pst@getcoor{#3}\pst@tempR% + \@ifnextchar[\Pst@GeneralIHyperbolaVertexNode@i{\Pst@GeneralIHyperbolaVertexNode@i[0]}}% +\def\Pst@GeneralIHyperbolaVertexNode@i[#1]#2#3{% + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + #1 dup cos exch sin % cos\theta sin\theta + 5 index 4 index 2 index mul sub % x=x0-a\sin\theta + 5 index 5 index 4 index mul add % y=y0+a\cos\theta + 8 2 roll pop pop pop pop pop pop + ){#2} + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + #1 dup cos exch sin % cos\theta sin\theta + 5 index 4 index 2 index mul add % x=x0+a\sin\theta + 5 index 5 index 4 index mul sub % y=y0-a\cos\theta + 8 2 roll pop pop pop pop pop pop + ){#3} + \Pst@ManageParamList{#2}% + \Pst@ManageParamList{#3}% + \endgroup% +}% +% +%% \pstGeneralIHyperbolaDirectrixLine[Options](O)(a,b)[rotation]{Lx}{Ly}{Rx}{Ry} +%% Draw the two directrix lines of the General Inversion Hyperbola H. +%% If you not input the rotation angle, the default value is $0^\circ$. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the hyperbola center O +%% #3 -> [input] the radii of real and imaginary axis +%% #4 -> [input] the rotation angle $\theta$ of the symmetrical axis. +%% #5 -> [output] the first node Lx on the first directrix line. +%% #6 -> [output] the second node Lx on the first directrix line. +%% #7 -> [output] the first node Lx on the second directrix line. +%% #8 -> [output] the second node Lx on the second directrix line. +\def\pstGeneralIHyperbolaDirectrixLine{\@ifnextchar[\Pst@GeneralIHyperbolaDirectrixLine{\Pst@GeneralIHyperbolaDirectrixLine[]}} +\def\Pst@GeneralIHyperbolaDirectrixLine[#1](#2)(#3){% + \begingroup + \@InitListMng % + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pst@getcoor{#3}\pst@tempR% + \@ifnextchar[\Pst@GeneralIHyperbolaDirectrixLine@i{\Pst@GeneralIHyperbolaDirectrixLine@i[0]}}% +\def\Pst@GeneralIHyperbolaDirectrixLine@i[#1]#2#3#4#5{% + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + 1 index dup mul 1 index dup mul add sqrt % c=sqrt(a^2+b^2) + 2 index dup mul 1 index div 4 index exch sub 5 index exch % x0,y0-a^2/c + 7 2 roll pop pop pop % x,y,x0,y0 + #1 dup cos exch sin % cos\theta sin\theta + 3 index 6 index 5 index sub 3 index mul add 5 index 4 index sub 2 index mul sub % x0+(x-x0)\cos\theta-(y-y0)\sin\theta + 3 index 7 index 6 index sub 3 index mul add 6 index 5 index sub 4 index mul add % y0+(x-x0)\sin\theta+(y-y0)\cos\theta + 8 2 roll pop pop pop pop pop pop + ){#2} + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + 1 index dup mul 1 index dup mul add sqrt % c=sqrt(a^2+b^2) + 2 index dup mul 1 index div 4 index exch sub 5 index 1 add exch % x0+1,y0-a^2/c + 7 2 roll pop pop pop % x,y,x0,y0 + #1 dup cos exch sin % cos\theta sin\theta + 3 index 6 index 5 index sub 3 index mul add 5 index 4 index sub 2 index mul sub % x0+(x-x0)\cos\theta-(y-y0)\sin\theta + 3 index 7 index 6 index sub 3 index mul add 6 index 5 index sub 4 index mul add % y0+(x-x0)\sin\theta+(y-y0)\cos\theta + 8 2 roll pop pop pop pop pop pop + ){#3} + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + 1 index dup mul 1 index dup mul add sqrt % c=sqrt(a^2+b^2) + 2 index dup mul 1 index div 4 index add 5 index exch % x0,y0+a^2/c + 7 2 roll pop pop pop % x,y,x0,y0 + #1 dup cos exch sin % cos\theta sin\theta + 3 index 6 index 5 index sub 3 index mul add 5 index 4 index sub 2 index mul sub % x0+(x-x0)\cos\theta-(y-y0)\sin\theta + 3 index 7 index 6 index sub 3 index mul add 6 index 5 index sub 4 index mul add % y0+(x-x0)\sin\theta+(y-y0)\cos\theta + 8 2 roll pop pop pop pop pop pop + ){#4} + \pnode(! + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + 1 index dup mul 1 index dup mul add sqrt % c=sqrt(a^2+b^2) + 2 index dup mul 1 index div 4 index add 5 index 1 add exch % x0+1,y0+a^2/c + 7 2 roll pop pop pop % x,y,x0,y0 + #1 dup cos exch sin % cos\theta sin\theta + 3 index 6 index 5 index sub 3 index mul add 5 index 4 index sub 2 index mul sub % x0+(x-x0)\cos\theta-(y-y0)\sin\theta + 3 index 7 index 6 index sub 3 index mul add 6 index 5 index sub 4 index mul add % y0+(x-x0)\sin\theta+(y-y0)\cos\theta + 8 2 roll pop pop pop pop pop pop + ){#5} + \Pst@ManageParamList{#2}% + \Pst@ManageParamList{#3}% + \Pst@ManageParamList{#4}% + \Pst@ManageParamList{#5}% + \pstLineAB{#2}{#3}% + \pstLineAB{#4}{#5}% + \endgroup% +}% +% +%% \pstGeneralIHyperbolaAsymptoteLine[Options](O)(a,b)[rotation]{L1}{L2} +%% Draw the two asymptote lines L1 and L2 of the General Inversion Hyperbola H. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the hyperbola center O +%% #3 -> [input] the radii of real and imaginary axis +%% #4 -> [input] the rotation angle $\theta$ of the symmetrical axis. +%% #5 -> [output] the second node name on the first asymptote line, the first node is the center O. +%% #6 -> [output] the second node name on the second asymptote line, the first node is the center O. +\def\pstGeneralIHyperbolaAsymptoteLine{\@ifnextchar[\Pst@GeneralIHyperbolaAsymptoteLine{\Pst@GeneralIHyperbolaAsymptoteLine[]}} +\def\Pst@GeneralIHyperbolaAsymptoteLine[#1](#2)(#3){% + \begingroup + \@InitListMng % + \psset{#1}% + \def\pst@hyperbola@center{#2} + \pst@getcoor{#2}\pst@tempO% + \pst@getcoor{#3}\pst@tempR% + \@ifnextchar[\Pst@GeneralIHyperbolaAsymptoteLine@i{\Pst@GeneralIHyperbolaAsymptoteLine@i[0]}}% +\def\Pst@GeneralIHyperbolaAsymptoteLine@i[#1]#2#3{% + \pnode(! + \pst@tempO \tx@UserCoor % x_o,y_o + \pst@tempR \tx@UserCoor % a,b + 0 index 2 index div % b/a + 4 index 1 index sub % x=x0-b/a + 4 index 1 add % y=y0+1 + 7 2 roll pop pop pop % x y x_0 y_0 + #1 dup cos exch sin % cos\theta sin\theta + 3 index 6 index 5 index sub 3 index mul add 5 index 4 index sub 2 index mul sub % x0+(x-x0)\cos\theta-(y-y0)\sin\theta + 3 index 7 index 6 index sub 3 index mul add 6 index 5 index sub 4 index mul add % y0+(x-x0)\sin\theta+(y-y0)\cos\theta + 8 2 roll pop pop pop pop pop pop + ){#2}% + \pnode(! + \pst@tempO \tx@UserCoor % x_o,y_o + \pst@tempR \tx@UserCoor % a,b + 0 index 2 index div % b/a + 4 index 1 index add % x=x0+b/a + 4 index 1 add % y=y0+1 + 7 2 roll pop pop pop % x y x_0 y_0 + #1 dup cos exch sin % cos\theta sin\theta + 3 index 6 index 5 index sub 3 index mul add 5 index 4 index sub 2 index mul sub % x0+(x-x0)\cos\theta-(y-y0)\sin\theta + 3 index 7 index 6 index sub 3 index mul add 6 index 5 index sub 4 index mul add % y0+(x-x0)\sin\theta+(y-y0)\cos\theta + 8 2 roll pop pop pop pop pop pop + ){#3}% + \Pst@ManageParamList{#2}% + \Pst@ManageParamList{#3}% + \pstLineAB{\pst@hyperbola@center}{#2}% + \pstLineAB{\pst@hyperbola@center}{#3}% + \endgroup% +}% +% +% +%% \pstGeneralIHyperbolaLineInter[Options](O)(a,b)[rotation]{A}{B}{C}{D} +%% Find the intersection nodes $C$ and $D$ of the given line AB with the General Inversion Hyperbola H. +%% +%% set $e=a\cos\theta$, $f=b\sin\theta$, $g=a\sin\theta$, $h=b\cos\theta$, then we have +%% $$x=x_0+h\tan\alpha-g\sec\alpha, y=y_0+f\tan\alpha+e\sec\alpha$$ +%% when line AB is vertical, the solve is like as pstGeneralIHyperbolaAbsNode, +%% else we can represent the line AB as the following function: +%% $$y=kx+d$$ where $$k=\dfrac{y_2-y_1}{x_2-x_1}, d=\dfrac{x_2y_1-x_1y_2}{x_2-x_1}$$ +%% Let $X=x-x_0$, $Y=y-y_0$, then we have $Y=kX+m$, where $m=kx_0-y_0+d$, then +%% $$f\tan\alpha+e\sec\alpha=k(h\tan\alpha-g\sec\alpha)+m$$ +%% $$(kh-f)\sin\alpha+m\cos\alpha=kg+e$$ +%% $$(kh-f)^2\sin^2\alpha=m^2\cos^2\alpha-2m(kg+e)\cos\alpha+(kg+e)^2$$ +%% $$(m^2+(kh-f)^2)\cos^2\alpha-2m(kg+e)\cos\alpha+(kg+e)^2-(kh-f)^2=0$$ +%% when $m^2+(kh-f)^2=0$, we have $m=kh-f=0$, at this time $kg+e=0$, we get +%% $$k=\dfrac{\sin\theta}{\cos\theta}=-\dfrac{\cos\theta}{\sin\theta}$$ +%% which is not possible. +%% +%% let $p=kh-f$, $q=kg+e$, so we have +%% $$(m^2+p^2)\cos^2\alpha-2mq\cos\alpha+q^2-p^2=0$$ +%% then +%% $$\cos_{1,2}\alpha=\dfrac{mq\pm{}p\sqrt{m^2+p^2-q^2}}{m^2+p^2},\sin_{1,2}\alpha=\dfrac{qp\mp{}m\sqrt{m^2+p^2-q^2}}{m^2+p^2}$$ +%% where $\cos\alpha$ can not be zero, we should skip it. +%% +%% Parameters: +%% #1 -> options +%% #2 -> [input] the hyperbola center O +%% #3 -> [input] the radii of real and imaginary axis +%% #4 -> [input] the rotation angle $\theta$ of the symmetrical axis. +%% #5 -> [input] the first node on the given line. +%% #6 -> [input] the second node on the given line. +%% #7 -> [output] the first intersection node name. +%% #8 -> [output] the second intersection node name. +\def\pstGeneralIHyperbolaLineInter{\@ifnextchar[\Pst@GeneralIHyperbolaLineInter{\Pst@GeneralIHyperbolaLineInter[]}} +\def\Pst@GeneralIHyperbolaLineInter[#1](#2)(#3){% + \begingroup + \@InitListMng % + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pst@getcoor{#3}\pst@tempR% + \@ifnextchar[\Pst@GeneralIHyperbolaLineInter@i{\Pst@GeneralIHyperbolaLineInter@i[0]}}% +\def\Pst@GeneralIHyperbolaLineInter@i[#1]#2#3#4#5{% + \pst@getcoor{#2}\pst@tempA% + \pst@getcoor{#3}\pst@tempB% + \pnode(!% + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + \pst@tempA \tx@UserCoor % x1,y1 + \pst@tempB \tx@UserCoor % x2,y2 + 3 index 2 index sub abs 1E-5 lt { % if the line AB is vertical + #1 dup cos exch sin % cos\theta sin\theta + 7 index 2 index mul % e=a\cos\theta + 7 index 2 index mul % f=b\sin\theta + 9 index 3 index mul % g=a\sin\theta + 9 index 5 index mul % h=b\cos\theta + 7 index 14 index sub % n=x1-x0 + 0 index dup mul 2 index dup mul add % n^2+h^2 + 0 index abs 1E-5 lt { + pop pop pop pop pop pop + pop pop pop pop pop pop 0 0 + } { + 0 index 4 index dup mul sub dup 0 lt { + pop pop pop pop pop pop pop + pop pop pop pop pop pop 0 0 + } { + sqrt % sqrt(n^2+h^2-g^2) + %% \sin_{1,2}\alpha=\dfrac{gh\pm{}n\sqrt{n^2+h^2-g^2}}{n^2+h^2} + 2 index 1 index mul 5 index 5 index mul exch sub 2 index div % sin + %% \cos_{1,2}\alpha=\dfrac{-ng\pm{}h\sqrt{n^2+h^2-g^2}}{n^2+h^2} + 4 index 2 index mul 4 index 7 index mul add neg 3 index div % cos + dup abs 1E-5 lt { + pop pop pop pop pop pop pop pop + pop pop pop pop pop pop pop 0 0 + } { + 18 index 6 index 3 index mul 2 index div add 7 index 2 index div sub % x_1=x_0+h\tan\alpha-g\sec\alpha + 18 index 9 index 4 index mul 3 index div add 10 index 3 index div add % y_1=y_0+f\tan\alpha+e\sec\alpha + 21 2 roll pop pop pop pop pop pop pop pop + pop pop pop pop pop pop pop pop pop pop pop + } ifelse + } ifelse + } ifelse + } { + 0 index 3 index sub 2 index 5 index sub div % k + 2 index 4 index mul 2 index 6 index mul sub 3 index 6 index sub div % d + 1 index 10 index mul 9 index sub 1 index add % m=kx_o-y_o+d + #1 dup cos exch sin % cos\theta sin\theta + 10 index 2 index mul % e=a\cos\theta + 10 index 2 index mul % f=b\sin\theta + 12 index 3 index mul % g=a\sin\theta + 12 index 5 index mul % h=b\cos\theta + 8 index 1 index mul 3 index sub % p=kh-f + 9 index 3 index mul 5 index add % q=kg+e + 8 index dup mul 2 index dup mul add % m^2+p^2 + dup 1E-5 lt { + pop pop pop pop pop pop pop pop pop pop + pop pop pop pop pop pop pop pop pop pop + 0 0 + } { + 0 index 2 index dup mul sub dup 0 lt { + pop pop pop pop pop pop pop pop pop pop + pop pop pop pop pop pop pop pop pop pop + pop 0 0 + } { + sqrt % sqrt(m^2+p^2-q^2) + % \sin_{1,2}\alpha=\dfrac{qp\mp{}m\sqrt{m^2+p^2-q^2}}{m^2+p^2} + 10 index 1 index mul 4 index 4 index mul add 2 index div % \sin\alpha + % \cos_{1,2}\alpha=\dfrac{mq\pm{}p\sqrt{m^2+p^2-q^2}}{m^2+p^2} + 4 index 2 index mul 12 index 5 index mul exch sub 3 index div % \cos\alpha + dup abs 1E-5 lt { + pop pop pop pop pop pop pop pop pop pop + pop pop pop pop pop pop pop pop pop pop + pop pop pop 0 0 + } { + % x=x_0+h\tan\alpha-g\sec\alpha, y=y_0+f\tan\alpha+e\sec\alpha + 22 index 8 index 2 index div sub 7 index 3 index mul 2 index div add % x_1 + 22 index 11 index 3 index div add 10 index 4 index mul 3 index div add % y_1 + 25 2 roll + pop pop pop pop pop pop pop pop pop pop + pop pop pop pop pop pop pop pop pop pop + pop pop pop + } ifelse + } ifelse + } ifelse + } ifelse + ){#4}% + \pnode(!% + \pst@tempO \tx@UserCoor % x0,y0 + \pst@tempR \tx@UserCoor abs exch abs exch % |a|,|b| + \pst@tempA \tx@UserCoor % x1,y1 + \pst@tempB \tx@UserCoor % x2,y2 + 3 index 2 index sub abs 1E-5 lt { % if the line AB is vertical + #1 dup cos exch sin % cos\theta sin\theta + 7 index 2 index mul % e=a\cos\theta + 7 index 2 index mul % f=b\sin\theta + 9 index 3 index mul % g=a\sin\theta + 9 index 5 index mul % h=b\cos\theta + 7 index 14 index sub % n=x1-x0 + 0 index dup mul 2 index dup mul add % n^2+h^2 + 0 index abs 1E-5 lt { + pop pop pop pop pop pop + pop pop pop pop pop pop 0 0 + } { + 0 index 4 index dup mul sub dup 0 lt { + pop pop pop pop pop pop pop + pop pop pop pop pop pop 0 0 + } { + sqrt % sqrt(n^2+h^2-g^2) + %% \sin_{1,2}\alpha=\dfrac{gh\pm{}n\sqrt{n^2+h^2-g^2}}{n^2+h^2} + 2 index 1 index mul 5 index 5 index mul add 2 index div % sin + %% \cos_{1,2}\alpha=\dfrac{-ng\pm{}h\sqrt{n^2+h^2-g^2}}{n^2+h^2} + 4 index 2 index mul 4 index 7 index mul sub 3 index div % cos + dup abs 1E-5 lt { + pop pop pop pop pop pop pop pop + pop pop pop pop pop pop pop 0 0 + } { + 18 index 6 index 3 index mul 2 index div add 7 index 2 index div sub % x_2=x_0+h\tan\alpha-g\sec\alpha + 18 index 9 index 4 index mul 3 index div add 10 index 3 index div add % y_2=y_0+f\tan\alpha+e\sec\alpha + 21 2 roll pop pop pop pop pop pop pop pop + pop pop pop pop pop pop pop pop pop pop pop + } ifelse + } ifelse + } ifelse + } { + 0 index 3 index sub 2 index 5 index sub div % k + 2 index 4 index mul 2 index 6 index mul sub 3 index 6 index sub div % d + 1 index 10 index mul 9 index sub 1 index add % m=kx_o-y_o+d + #1 dup cos exch sin % cos\theta sin\theta + 10 index 2 index mul % e=a\cos\theta + 10 index 2 index mul % f=b\sin\theta + 12 index 3 index mul % g=a\sin\theta + 12 index 5 index mul % h=b\cos\theta + 8 index 1 index mul 3 index sub % p=kh-f + 9 index 3 index mul 5 index add % q=kg+e + 8 index dup mul 2 index dup mul add % m^2+p^2 + dup 1E-5 lt { + pop pop pop pop pop pop pop pop pop pop + pop pop pop pop pop pop pop pop pop pop + 0 0 + } { + 0 index 2 index dup mul sub dup 0 lt { + pop pop pop pop pop pop pop pop pop pop + pop pop pop pop pop pop pop pop pop pop + pop 0 0 + } { + sqrt % sqrt(m^2+p^2-q^2) + % \sin_{1,2}\alpha=\dfrac{qp\mp{}m\sqrt{m^2+p^2-q^2}}{m^2+p^2} + 10 index 1 index mul 4 index 4 index mul exch sub 2 index div % \sin\alpha + % \cos_{1,2}\alpha=\dfrac{mq\pm{}p\sqrt{m^2+p^2-q^2}}{m^2+p^2} + 4 index 2 index mul 12 index 5 index mul add 3 index div % \cos\alpha + dup abs 1E-5 lt { + pop pop pop pop pop pop pop pop pop pop + pop pop pop pop pop pop pop pop pop pop + pop pop pop 0 0 + } { + % x=x_0+h\tan\alpha-g\sec\alpha, y=y_0+f\tan\alpha+e\sec\alpha + 22 index 8 index 2 index div sub 7 index 3 index mul 2 index div add % x_2 + 22 index 11 index 3 index div add 10 index 4 index mul 3 index div add % y_2 + 25 2 roll + pop pop pop pop pop pop pop pop pop pop + pop pop pop pop pop pop pop pop pop pop + pop pop pop + } ifelse + } ifelse + } ifelse + } ifelse + ){#5}% + \Pst@ManageParamList{#4}% + \Pst@ManageParamList{#5}% + \endgroup% +}% +% +%% \pstGeneralIHyperbolaPolarNode[Options](O)(a,b)[rotation]{A}{B}{T} +%% Find the polar point of chord AB on General Inversion Hyperbola H. +%% We use the following proposition to find the polar point of chord AB: +%% Let $P$, $Q$ are vertex points of the hyperbola, for any chord $AB$ of hyperbola, $PA$ and $BQ$ intersect at $E$, $PB$ and $AQ$ intersect at $F$, then the middle point $M$ of $EF$ is the polar point of chord $AB$. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the hyperbola center O +%% #3 -> [input] the radii of real and imaginary axis +%% #4 -> [input] the rotation angle $\theta$ of the symmetrical axis. +%% #5 -> [input] the node A on the hyperbola. +%% #6 -> [input] the node B on the hyperbola. +%% #7 -> [output] the polar node T of chord AB. +\def\pstGeneralIHyperbolaPolarNode{\@ifnextchar[\Pst@GeneralIHyperbolaPolarNode{\Pst@GeneralIHyperbolaPolarNode[]}} +\def\Pst@GeneralIHyperbolaPolarNode[#1](#2)(#3){% + \begingroup + \psset{#1}% + \def\pst@hyperbola@center{#2} + \def\pst@hyperbola@radii{#3} + \@ifnextchar[\Pst@GeneralIHyperbolaPolarNode@i{\Pst@GeneralIHyperbolaPolarNode@i[0]}}% +\def\Pst@GeneralIHyperbolaPolarNode@i[#1]#2#3#4{% + \pstGeneralIHyperbolaVertexNode[PointName=none,PointSymbol=none](\pst@hyperbola@center)(\pst@hyperbola@radii)[#1]{@PST@GENERALIHYPERBOLA@VERTEXA}{@PST@GENERALIHYPERBOLA@VERTEXB} + \pstInterLL[PointName=none,PointSymbol=none]{#2}{@PST@GENERALIHYPERBOLA@VERTEXA}{#3}{@PST@GENERALIHYPERBOLA@VERTEXB}{@PST@GENERALIHYPERBOLA@INTER@X} + \pstInterLL[PointName=none,PointSymbol=none]{#3}{@PST@GENERALIHYPERBOLA@VERTEXA}{#2}{@PST@GENERALIHYPERBOLA@VERTEXB}{@PST@GENERALIHYPERBOLA@INTER@Y} + \pstMiddleAB{@PST@GENERALIHYPERBOLA@INTER@X}{@PST@GENERALIHYPERBOLA@INTER@Y}{#4} + \Pst@geonodelabel{#4}% + \pstLineAB{#2}{#4} + \pstLineAB{#3}{#4} + \endgroup +}% +% +%% \pstGeneralIHyperbolaTangentNode[Options](O)(a,b)[rotation]{T}{A}{B} +%% Draw the two tangent lines through the point $T$ to the General Inversion Hyperbola H and get the node A and B on the General Inversion Hyperbola. +%% We use the following proposition to find the tangent points $A$ and $B$ of $T$: +%% Let $T$ is a point out of the hyperbola, we give any two chords $TPQ$ and $TRS$ of the hyperbola, $PR$ and $QS$ intersect at $X$, $RQ$ and $PS$ intersect at $Y$, +%% then the intersection point $A$ and $B$ of $XY$ and the hyperbola are the tangent points from $T$. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the hyperbola center O +%% #3 -> [input] the radii of real and imaginary axis +%% #4 -> [input] the rotation angle $\theta$ of the symmetrical axis. +%% #5 -> [input] the given node T outside the hyperbola +%% #6 -> [output] the tangent node name A on the hyperbola +%% #7 -> [output] the tangent node name B on the hyperbola +\def\pstGeneralIHyperbolaTangentNode{\@ifnextchar[\Pst@GeneralIHyperbolaTangentNode{\Pst@GeneralIHyperbolaTangentNode[]}} +\def\Pst@GeneralIHyperbolaTangentNode[#1](#2)(#3){% + \begingroup + \@InitListMng % + \psset{#1}% + \def\pst@hyperbola@center{#2} + \def\pst@hyperbola@radii{#3} + \@ifnextchar[\Pst@GeneralIHyperbolaTangentNode@i{\Pst@GeneralIHyperbolaTangentNode@i[0]}}% +\def\Pst@GeneralIHyperbolaTangentNode@i[#1]#2#3#4{% + \pstGeneralIHyperbolaNode[PointName=none,PointSymbol=none](\pst@hyperbola@center)(\pst@hyperbola@radii)[#1]{10}{@PST@GENERALIHYPERBOLA@TANGENTAUX@P0} + \pstGeneralIHyperbolaNode[PointName=none,PointSymbol=none](\pst@hyperbola@center)(\pst@hyperbola@radii)[#1]{-10}{@PST@GENERALIHYPERBOLA@TANGENTAUX@R0} + \pstGeneralIHyperbolaLineInter[PointName=none,PointSymbol=none](\pst@hyperbola@center)(\pst@hyperbola@radii)[#1]{#2}{@PST@GENERALIHYPERBOLA@TANGENTAUX@P0}{@PST@GENERALIHYPERBOLA@TANGENTAUX@P}{@PST@GENERALIHYPERBOLA@TANGENTAUX@Q} + \pstGeneralIHyperbolaLineInter[PointName=none,PointSymbol=none](\pst@hyperbola@center)(\pst@hyperbola@radii)[#1]{#2}{@PST@GENERALIHYPERBOLA@TANGENTAUX@R0}{@PST@GENERALIHYPERBOLA@TANGENTAUX@R}{@PST@GENERALIHYPERBOLA@TANGENTAUX@S} + \pstInterLL[PointName=none,PointSymbol=none]{@PST@GENERALIHYPERBOLA@TANGENTAUX@P}{@PST@GENERALIHYPERBOLA@TANGENTAUX@S}{@PST@GENERALIHYPERBOLA@TANGENTAUX@Q}{@PST@GENERALIHYPERBOLA@TANGENTAUX@R}{@PST@GENERALIHYPERBOLA@TANGENTAUX@I} + \pstInterLL[PointName=none,PointSymbol=none]{@PST@GENERALIHYPERBOLA@TANGENTAUX@P}{@PST@GENERALIHYPERBOLA@TANGENTAUX@R}{@PST@GENERALIHYPERBOLA@TANGENTAUX@Q}{@PST@GENERALIHYPERBOLA@TANGENTAUX@S}{@PST@GENERALIHYPERBOLA@TANGENTAUX@X} + \pstGeneralIHyperbolaLineInter(\pst@hyperbola@center)(\pst@hyperbola@radii)[#1]{@PST@GENERALIHYPERBOLA@TANGENTAUX@X}{@PST@GENERALIHYPERBOLA@TANGENTAUX@I}{#3}{#4} + \Pst@ManageParamList{#3}% + \Pst@ManageParamList{#4}% + \pstLineAB{#2}{#3} + \pstLineAB{#2}{#4} + \endgroup% +}% +% \catcode`\@=\PstAtCode\relax % \endinput |