summaryrefslogtreecommitdiff
path: root/graphics/pstricks/contrib/pst-eucl/tex/pst-eucl.tex
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/pstricks/contrib/pst-eucl/tex/pst-eucl.tex')
-rw-r--r--graphics/pstricks/contrib/pst-eucl/tex/pst-eucl.tex6363
1 files changed, 6313 insertions, 50 deletions
diff --git a/graphics/pstricks/contrib/pst-eucl/tex/pst-eucl.tex b/graphics/pstricks/contrib/pst-eucl/tex/pst-eucl.tex
index df8d75a009..8979b313be 100644
--- a/graphics/pstricks/contrib/pst-eucl/tex/pst-eucl.tex
+++ b/graphics/pstricks/contrib/pst-eucl/tex/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