diff options
Diffstat (limited to 'Master/texmf-dist/tex/generic/pst-eucl/pst-eucl.tex')
-rw-r--r-- | Master/texmf-dist/tex/generic/pst-eucl/pst-eucl.tex | 1845 |
1 files changed, 1473 insertions, 372 deletions
diff --git a/Master/texmf-dist/tex/generic/pst-eucl/pst-eucl.tex b/Master/texmf-dist/tex/generic/pst-eucl/pst-eucl.tex index cfc56a70d88..12f75bb8c81 100644 --- a/Master/texmf-dist/tex/generic/pst-eucl/pst-eucl.tex +++ b/Master/texmf-dist/tex/generic/pst-eucl/pst-eucl.tex @@ -9,6 +9,7 @@ %% %% Authors : Dominique RODRIGUEZ (EN) <dominique.rodriguez@waika9.com> %% : hv hvoss@tug.org +%% : lx Liao Xiongfei %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Require PSTricks and pst-node packages \ifx\PSTnodesLoaded\endinput\else\input pst-node.tex\fi @@ -20,8 +21,8 @@ \csname PSTEuclideLoaded\endcsname \let\PSTEuclideLoaded\endinput % -\def\fileversion{1.74} -\def\filedate{2020/07/15} +\def\fileversion{1.75} +\def\filedate{2020/09/29} %% \message{`PST-Euclide v\fileversion, \filedate\space (dr,hv)}% %% prologue for postcript @@ -632,7 +633,7 @@ %% \pstTriangleSSS[Options](pos){A}(a,b,c){B}{C} %% Create a triangle ABC whose three sides are a,b,c. %% Given $A(x_1,y_1)$, and the three sides $a,b,c$, -%% when pos=L, we output $B(x_2,y_2)$ and $C(x_3,y_3)$ as following +%% when pos=:L, we output $B(x_2,y_2)$ and $C(x_3,y_3)$ as following %% $$x_2=x_1+c,y_2=y_1$$ %% since %% $$\cos{A}=\dfrac{c^2+b^2-a^2}{2bc}$$ @@ -645,7 +646,7 @@ %% %% Parameters: %% #1 -> options -%% #2 -> optional, the pos of given input node A, L/R/U/D +%% #2 -> optional, the pos of given input node A, :L/:R/:U/:D or the other node to specify the base line of the triangle %% #3 -> the given input node A %% #4 -> the given side BC=a %% #5 -> the given side CA=b @@ -657,12 +658,12 @@ \begingroup \@InitListMng% \psset{#1}% - \@ifnextchar(\Pst@TriangleSSS@i{\Pst@TriangleSSS@i(L)}} + \@ifnextchar(\Pst@TriangleSSS@i{\Pst@TriangleSSS@i(:L)}} \def\Pst@TriangleSSS@i(#1)#2(#3,#4,#5)#6#7{% - \def\Pst@TriangleSSS@left{L} - \def\Pst@TriangleSSS@right{R} - \def\Pst@TriangleSSS@up{U} - \def\Pst@TriangleSSS@down{D} + \def\Pst@TriangleSSS@left{:L} + \def\Pst@TriangleSSS@right{:R} + \def\Pst@TriangleSSS@up{:U} + \def\Pst@TriangleSSS@down{:D} \def\Pst@TriangleSSS@pos{#1} \pst@getcoor{#2}\pst@tempA% \ifx\Pst@TriangleSSS@pos\Pst@TriangleSSS@right% @@ -719,7 +720,7 @@ 2 index dup mul 1 index 7 index sub dup mul sub sqrt 5 index add 7 2 roll pop pop pop pop pop ){#7}%C - \else% default position is at left vertex + \else\ifx\Pst@TriangleSSS@pos\Pst@TriangleSSS@left \pnode(! \pst@tempA \tx@UserCoor % x1,y1 #3 abs #4 abs #5 abs % a,b,c @@ -735,7 +736,10 @@ 2 index dup mul 1 index 7 index sub dup mul sub sqrt 5 index add 7 2 roll pop pop pop pop pop ){#7}%C - \fi\fi\fi% + \else% try to locate the triangle on the specific line + \pstLocateAB[PointName=none,PointSymbol=none]{#2}{#1}{\pstDistConst{#5}}{#6} + \pstInterCC[PointName=none,PointSymbol=none,RadiusA=\pstDistConst{#4},RadiusB=\pstDistConst{#3}]{#2}{}{#6}{}{#7}{#7Unused} + \fi\fi\fi\fi% \Pst@ManageParamList{#6}% \Pst@ManageParamList{#7}% \pstPolygon(#2)(#6)(#7)% @@ -745,14 +749,14 @@ %% \pstTriangleSAS[Options](pos){A}(b,A,c){B}{C} %% Create a triangle ABC whth sides b,c and angle A. %% Given $A(x_1,y_1)$, and the angle of A, the other two sides $b,c$, -%% when pos=L, we output $B(x_2,y_2)$ and $C(x_3,y_3)$ as following +%% when pos=:L, we output $B(x_2,y_2)$ and $C(x_3,y_3)$ as following %% $$x_2=x_1+c,y_2=y_1$$ %% and %% $$x_3=x_1+b\cos{A},y_3=y_1+b\sin{A}$$ %% %% Parameters: %% #1 -> options -%% #2 -> optional, the pos of given input node A, L/R/U/D +%% #2 -> optional, the pos of given input node A, :L/:R/:U/:D or the other node to specify the base line of the triangle %% #3 -> the given input node A %% #4 -> the given side AC=b %% #5 -> the given angle A @@ -764,12 +768,12 @@ \begingroup \@InitListMng% \psset{#1}% - \@ifnextchar(\Pst@TriangleSAS@i{\Pst@TriangleSAS@i(L)}} + \@ifnextchar(\Pst@TriangleSAS@i{\Pst@TriangleSAS@i(:L)}} \def\Pst@TriangleSAS@i(#1)#2(#3,#4,#5)#6#7{% - \def\Pst@TriangleSAS@left{L} - \def\Pst@TriangleSAS@right{R} - \def\Pst@TriangleSAS@up{U} - \def\Pst@TriangleSAS@down{D} + \def\Pst@TriangleSAS@left{:L} + \def\Pst@TriangleSAS@right{:R} + \def\Pst@TriangleSAS@up{:U} + \def\Pst@TriangleSAS@down{:D} \def\Pst@TriangleSAS@pos{#1} \pst@getcoor{#2}\pst@tempA% \ifx\Pst@TriangleSAS@pos\Pst@TriangleSAS@right% @@ -834,7 +838,7 @@ 6 index 5 index dup mul 3 index dup mul add 4 index dup mul sub 3 index 2 mul div sub exch % x3 8 2 roll pop pop pop pop pop pop ){#7}% - \else% default position is at left vertex + \else\ifx\Pst@TriangleSAS@pos\Pst@TriangleSAS@left \pnode(! \pst@tempA \tx@UserCoor % x1,y1 #3 abs #4 abs #5 abs % b,A,c @@ -849,7 +853,11 @@ 4 index 4 index 4 index sin mul add 7 2 roll pop pop pop pop pop ){#7}% - \fi\fi\fi% + \else% try to locate the triangle on the specific line + \pstLocateAB[PointName=none,PointSymbol=none]{#2}{#1}{\pstDistConst{#5}}{#6} + \pstRotation[PointName=none,PointSymbol=none,RotAngle=#4]{#2}{#6}[#6Internal] + \pstLocateAB[PointName=none,PointSymbol=none]{#2}{#6Internal}{\pstDistConst{#3}}{#7} + \fi\fi\fi\fi% \Pst@ManageParamList{#6}% \Pst@ManageParamList{#7}% \pstPolygon(#2)(#6)(#7)% @@ -860,7 +868,7 @@ %% Create a triangle ABC with angle A,C and side AB=c. %% %% Given $A(x_1,y_1)$, and the angle of A, the angle of C, the side of AB $c$, -%% when pos=L, we output $B(x_2,y_2)$ and $C(x_3,y_3)$ as following +%% when pos=:L, we output $B(x_2,y_2)$ and $C(x_3,y_3)$ as following %% $$x_2=x_1+c,y_2=y_1$$ %% and %% $$x_3=x_1+b\cos{A}=x_1+\dfrac{c\sin{B}}{\sin{C}}\cos{A},y_3=y_1+b\sin{A}=y_1+\dfrac{c\sin{B}}{\sin{C}}\sin{A}$$ @@ -868,7 +876,7 @@ %% %% Parameters: %% #1 -> options -%% #2 -> optional, the pos of given input node A, L/R/U/D +%% #2 -> optional, the pos of given input node A, :L/:R/:U/:D or the other node to specify the base line of the triangle %% #3 -> the given input node A %% #4 -> the given angle C %% #5 -> the given angle A @@ -880,12 +888,12 @@ \begingroup \@InitListMng% \psset{#1}% - \@ifnextchar(\Pst@TriangleAAS@i{\Pst@TriangleAAS@i(L)}} + \@ifnextchar(\Pst@TriangleAAS@i{\Pst@TriangleAAS@i(:L)}} \def\Pst@TriangleAAS@i(#1)#2(#3,#4,#5)#6#7{% - \def\Pst@TriangleAAS@left{L} - \def\Pst@TriangleAAS@right{R} - \def\Pst@TriangleAAS@up{U} - \def\Pst@TriangleAAS@down{D} + \def\Pst@TriangleAAS@left{:L} + \def\Pst@TriangleAAS@right{:R} + \def\Pst@TriangleAAS@up{:U} + \def\Pst@TriangleAAS@down{:D} \def\Pst@TriangleAAS@pos{#1} \pst@getcoor{#2}\pst@tempA% \ifx\Pst@TriangleAAS@pos\Pst@TriangleAAS@right% @@ -941,7 +949,7 @@ 4 index 2 index 5 index 5 index add sin mul add % y3 7 2 roll pop pop pop pop pop ){#7}% - \else% default position is at left vertex + \else\ifx\Pst@TriangleAAS@pos\Pst@TriangleAAS@left \pnode(! \pst@tempA \tx@UserCoor % x1,y1 #3 abs #4 abs #5 abs % C,A,c @@ -958,7 +966,11 @@ 3 index sin 2 index mul 6 index add 8 2 roll pop pop pop pop pop pop ){#7}% - \fi\fi\fi% + \else% try to locate the triangle on the specific line + \pstLocateAB[PointName=none,PointSymbol=none]{#2}{#1}{\pstDistConst{#5}}{#6} + \pstRotation[PointName=none,PointSymbol=none,RotAngle=#4]{#2}{#6}[#6Internal] + \pstLocateAB[PointName=none,PointSymbol=none]{#2}{#6Internal}{\pstDistConst{#5} #3 #4 add sin #3 sin div mul}{#7} + \fi\fi\fi\fi% \Pst@ManageParamList{#6}% \Pst@ManageParamList{#7}% \pstPolygon(#2)(#6)(#7)% @@ -977,7 +989,7 @@ %% %% Parameters: %% #1 -> options -%% #2 -> optional, the pos of given input node A, L/R/U/D +%% #2 -> optional, the pos of given input node A, :L/:R/:U/:D or the other node to specify the base line of the triangle %% #3 -> the given input node A %% #4 -> the given angle A %% #5 -> the given side AB=c @@ -989,12 +1001,12 @@ \begingroup \@InitListMng% \psset{#1}% - \@ifnextchar(\Pst@TriangleASA@i{\Pst@TriangleASA@i(L)}} + \@ifnextchar(\Pst@TriangleASA@i{\Pst@TriangleASA@i(:L)}} \def\Pst@TriangleASA@i(#1)#2(#3,#4,#5)#6#7{% - \def\Pst@TriangleASA@left{L} - \def\Pst@TriangleASA@right{R} - \def\Pst@TriangleASA@up{U} - \def\Pst@TriangleASA@down{D} + \def\Pst@TriangleASA@left{:L} + \def\Pst@TriangleASA@right{:R} + \def\Pst@TriangleASA@up{:U} + \def\Pst@TriangleASA@down{:D} \def\Pst@TriangleASA@pos{#1} \pst@getcoor{#2}\pst@tempA% \ifx\Pst@TriangleASA@pos\Pst@TriangleASA@right% @@ -1048,7 +1060,7 @@ 4 index 3 index 3 index sin mul add % y3 7 2 roll pop pop pop pop pop ){#7}% - \else% default position is at left vertex + \else\ifx\Pst@TriangleASA@pos\Pst@TriangleASA@left \pnode(! \pst@tempA \tx@UserCoor % x1,y1 #3 abs #4 abs #5 abs % A,c,B @@ -1065,7 +1077,11 @@ 4 index sin 2 index mul 6 index add 8 2 roll pop pop pop pop pop pop ){#7}% - \fi\fi\fi% + \else% try to locate the triangle on the specific line + \pstLocateAB[PointName=none,PointSymbol=none]{#2}{#1}{\pstDistConst{#4}}{#6} + \pstRotation[PointName=none,PointSymbol=none,RotAngle=#3]{#2}{#6}[#6Internal] + \pstLocateAB[PointName=none,PointSymbol=none]{#2}{#6Internal}{\pstDistConst{#4} #5 sin #3 #5 add sin div mul}{#7} + \fi\fi\fi\fi% \Pst@ManageParamList{#6}% \Pst@ManageParamList{#7}% \pstPolygon(#2)(#6)(#7)% @@ -1776,7 +1792,7 @@ \pst@number\psxunit div 3 1 roll div x mul add } { \ifPst@algebraic (#2) AlgParser cvx exec \else #2 \fi } NewtonSolving pop 2 copy end - /#5.Y exch def /#5.X exch def % save the coors for futher use + /#6.Y exch def /#6.X exch def % save the coors for futher use ){#6}% \Pst@geonodelabel{#6}% \egroup% @@ -1803,7 +1819,7 @@ pop dup /x exch def \@function 2 copy end - /#4.Y exch def /#4.X exch def % save the coors for futher use + /#5.Y exch def /#5.X exch def % save the coors for futher use ){#5}% \Pst@geonodelabel{#5}% \endgroup @@ -2357,7 +2373,7 @@ %% #2 -> [input] the node A %% #3 -> [input] the node B %% #4 -> [input] the node C -%% #5 -> [output] the output Lemoine Point L +%% #5 -> [output] the output Lemoine Point L %% #6 -> [output] the optional output point on BC %% #7 -> [output] the optional output point on CA %% #8 -> [output] the optional output point on AB @@ -3864,7 +3880,7 @@ %% #1 -> options %% #2 -> the input node A %% #3 -> the input node B -%% #4 -> the input radius length in screen coordinate +%% #4 -> the input radius length in screen coordinate %% #5 -> the output center O \def\pstCircleABR{\@ifnextchar[\Pst@CircleABR{\Pst@CircleABR[]}}% \def\Pst@CircleABR[#1]#2#3#4#5{% @@ -3915,7 +3931,7 @@ %% Draw an equilateral triangle ABC on given side AB in anti-clockwise. %% Parameters: %% #1 -> options -%% #2 -> [input] the node A +%% #2 -> [input] the node A %% #3 -> [input] the node B %% #4 -> [output] the node C \def\pstETriangleAB{\@ifnextchar[\Pst@ETriangleAB{\Pst@ETriangleAB[]}} @@ -3932,7 +3948,7 @@ %% Draw a square ABCD on given side AB in anti-clockwise. %% Parameters: %% #1 -> options -%% #2 -> [input] the node A +%% #2 -> [input] the node A %% #3 -> [input] the node B %% #4 -> [output] the node C %% #5 -> [output] the node D @@ -3966,7 +3982,7 @@ \edef\@@GenCourbe{(#2)(#3)}%%for accumulating points \ifPst@CodeFig \pstCircleABR[PointName=O,PosAngle=-90,PointSymbol=*,linecolor=\psk@CodeFigColor,linestyle=\psk@CodeFigStyle]{#2}{#3}{\pstDist{#2}{#3} 2 div 180 #4 div sin div}{PolyCenter} - \else + \else \pstCircleABR[PointName=none,PointSymbol=none,linestyle=none]{#2}{#3}{\pstDist{#2}{#3} 2 div 180 #4 div sin div}{PolyCenter} \fi \psset{#1} % use parameters after calling \pstCircleABR. @@ -3984,7 +4000,7 @@ %\typeout{\@@GenCourbe} \Pst@ManageParamList{\@point}\xdef\@PointLast{\@point}% \edef\@PointOutLst{\expandafter\PstParamListLasts\@PointOutLst,undef/}% - \advance\pst@cntg by 1 + \advance\pst@cntg by 1 \edef\@point{\expandafter\PstParamListFirst\@PointOutLst,undef/} \ifnum\pst@cntg<\pst@cnth% \def\@End{\Pst@RegularPolygonAB@iii} @@ -4023,7 +4039,7 @@ %\typeout{\@@GenCourbe} \Pst@ManageParamList{\@point}\xdef\@PointLast{\@point}% \edef\@PointOutLst{\expandafter\PstParamListLasts\@PointOutLst,undef/}% - \advance\pst@cntg by 1 + \advance\pst@cntg by 1 \edef\@point{\expandafter\PstParamListFirst\@PointOutLst,undef/} \ifnum\pst@cntg<\pst@cnth% \def\@End{\Pst@RegularPolygonOA@iii} @@ -4635,9 +4651,9 @@ Fax Fay Fbx Fby tx@EcldDict begin ABDist end 2 div /EllipseC ED - Nx Ny Fax Fay + Nx Ny Fax Fay tx@EcldDict begin ABDist end - Nx Ny Fbx Fby + Nx Ny Fbx Fby tx@EcldDict begin ABDist end add 2 div /EllipseA ED EllipseA dup mul EllipseC dup mul sub sqrt /EllipseB ED @@ -4762,54 +4778,66 @@ \CurveCoefd\space 2 div /CurveCoefd ED \CurveCoefe\space 2 div /CurveCoefe ED \CurveCoeff /CurveCoeff ED + % CurveCoefa = CurveCoefb = CurveCoefc = CurveCoefd = CurveCoefe = CurveCoeff = % I1=a+c CurveCoefa CurveCoefc add /DiscriminantI ED % I2=ac-b^2 CurveCoefa CurveCoefc mul CurveCoefb dup mul sub /DiscriminantII ED - DiscriminantII 0 le { % if I2\le0 - 0 0 - 0 /MyEllipseA ED - 0 /MyEllipseB ED - 0 /#5 ED - }{ - CurveCoefa CurveCoefc sub dup mul 4 CurveCoefb dup mul mul add sqrt /CurveCoefTempA ED - CurveCoefa CurveCoefe dup mul mul CurveCoefc CurveCoefd dup mul mul add - CurveCoeff CurveCoefb dup mul mul add 2 CurveCoefb mul CurveCoefd mul - CurveCoefe mul sub CurveCoefa CurveCoefc mul CurveCoeff mul sub 2 mul /CurveCoefTempB ED - % Ra = sqrt((2(ae^2+cd^2+fb^2-2bde-acf))/((ac-b^2)[(a+c)-sqrt((a-c)^2+4b^2)])) - CurveCoefTempB DiscriminantII DiscriminantI CurveCoefTempA sub mul div /MyEllipseSquareA ED - % Rb = sqrt((2(ae^2+cd^2+fb^2-2bde-acf))/((ac-b^2)[(a+c)+sqrt((a-c)^2+4b^2)])) - CurveCoefTempB DiscriminantII DiscriminantI CurveCoefTempA add mul div /MyEllipseSquareB ED - MyEllipseSquareA 0 lt MyEllipseSquareB 0 lt or { + % I3=|a b d,b c e,d e f| + CurveCoefa CurveCoefb CurveCoefd + CurveCoefb CurveCoefc CurveCoefe + CurveCoefd CurveCoefe CurveCoeff + tx@EcldDict begin DeterminantThree end /DiscriminantIII ED + % DiscriminantI = DiscriminantII = DiscriminantIII = + DiscriminantII 0 gt { % if I2>0 + % Solve the Characteristic Equation: \lambda^2-I_1\lambda+I_2=0 + DiscriminantI dup mul 4 DiscriminantII mul sub dup 0 lt { 0 0 0 /MyEllipseA ED 0 /MyEllipseB ED 0 /#5 ED } { - MyEllipseSquareA sqrt /MyEllipseA ED - MyEllipseSquareB sqrt /MyEllipseB ED - CurveCoefb abs 1E-5 lt { % b == 0 - CurveCoefa CurveCoefc lt { % a < c - 0 /#5 ED + sqrt dup DiscriminantI exch sub 2 div /CharacteristicLambdaI ED + DiscriminantI add 2 div /CharacteristicLambdaII ED + % CharacteristicLambdaI = CharacteristicLambdaII = + % 20200726 Liaoxiongfei + % fix how to get the rotation of the ellipse major axis. + % since we can reduce the ellipse to + % \lambda_1x^2+\lambda_2y^2+I_3/I_2=0 + % so the major axis is determined by the characteristic root with the small absolute value, + % and the slope of major axis is $(\lambda_1-a)/b$, or $(c-\lambda_2)/b$, where |\lambda_1|\leq|\lambda_2| + CharacteristicLambdaI abs CharacteristicLambdaII abs lt { + DiscriminantIII CharacteristicLambdaI DiscriminantII mul div neg sqrt /MyEllipseA ED + DiscriminantIII CharacteristicLambdaII DiscriminantII mul div neg sqrt /MyEllipseB ED + CharacteristicLambdaI CurveCoefa lt { + CharacteristicLambdaI CurveCoefa sub neg CurveCoefb neg atan /#5 ED } { - 90 /#5 ED + CharacteristicLambdaI CurveCoefa sub abs 1E-5 lt CurveCoefb abs 1E-5 lt and { + /#5 0 def + }{ + CharacteristicLambdaI CurveCoefa sub CurveCoefb atan /#5 ED + } ifelse } ifelse } { - CurveCoefa CurveCoefc sub abs 1E-5 lt { % a = c - 45 /#5 ED + DiscriminantIII CharacteristicLambdaII DiscriminantII mul div neg sqrt /MyEllipseA ED + DiscriminantIII CharacteristicLambdaI DiscriminantII mul div neg sqrt /MyEllipseB ED + CharacteristicLambdaII CurveCoefa lt { + CharacteristicLambdaII CurveCoefa sub neg CurveCoefb neg atan /#5 ED } { - CurveCoefb 0 lt { - 2 CurveCoefb mul neg CurveCoefc CurveCoefa sub atan /MyEllipseAngDbl ED - MyEllipseAngDbl 2 div /#5 ED - } { - 2 CurveCoefb mul CurveCoefa CurveCoefc sub atan /MyEllipseAngDbl ED - MyEllipseAngDbl 180 add 2 div /#5 ED - } ifelse + CharacteristicLambdaII CurveCoefa sub CurveCoefb atan /#5 ED } ifelse } ifelse - CurveCoefb CurveCoefe mul CurveCoefd CurveCoefc mul sub DiscriminantII div % x0 + % MyEllipseA = MyEllipseB = #5 = (--------------) = + % F_1(x,y)=ax+by+d=0 + % F_2(x,y)=bx+cy+e=0 + CurveCoefb CurveCoefe mul CurveCoefc CurveCoefd mul sub DiscriminantII div % x0 CurveCoefb CurveCoefd mul CurveCoefa CurveCoefe mul sub DiscriminantII div % y0 } ifelse + } { + 0 0 + 0 /MyEllipseA ED + 0 /MyEllipseB ED + 0 /#5 ED } ifelse ){#3} \Pst@geonodelabel{#3}% @@ -4852,7 +4880,8 @@ \pst@CurveNodeD \tx@UserCoor /CurveNodeDY ED /CurveNodeDX ED \pst@CurveNodeE \tx@UserCoor /CurveNodeEY ED /CurveNodeEX ED %% - % ax^2+bxy+cy^2+dx+ey+f=0, let a=1, we can use A,B,C,D,E to solve b,c,d,e,f, we have + % ax^2+bxy+cy^2+dx+ey+f=0, since $I_2=ac-b^2/4>0$, so $a\neq0$. + % let a=1, we can use A,B,C,D,E to solve b,c,d,e,f, we have % AxAy b + Ay^2 c + Ax d + Ay e + 1 f = -Ax^2 % BxBy b + By^2 c + Bx d + By e + 1 f = -Bx^2 % CxCy b + Cy^2 c + Cx d + Cy e + 1 f = -Cx^2 @@ -4872,10 +4901,11 @@ CurveNodeEX CurveNodeEY mul CurveNodeEY dup mul CurveNodeEX CurveNodeEY 1 tx@EcldDict begin DeterminantFive end /LinearDiscriminant ED LinearDiscriminant abs 1E-5 lt { % D=0 - 0 0 - 0 /MyEllipseA ED - 0 /MyEllipseB ED - 0 /#9 ED + 0 /CurveCoefb ED + 0 /CurveCoefc ED + 0 /CurveCoefd ED + 0 /CurveCoefe ED + 0 /CurveCoeff ED } { 1 /CurveCoefa ED CurveNodeAX dup mul CurveNodeAY dup mul CurveNodeAX CurveNodeAY 1 @@ -4908,56 +4938,94 @@ CurveNodeDX CurveNodeDY mul CurveNodeDY dup mul CurveNodeDX CurveNodeDY CurveNodeDX dup mul CurveNodeEX CurveNodeEY mul CurveNodeEY dup mul CurveNodeEX CurveNodeEY CurveNodeEX dup mul tx@EcldDict begin DeterminantFive end LinearDiscriminant div neg /CurveCoeff ED - % the following is same with pstGeneralEllipseCoef. - % I1=a+c - CurveCoefa CurveCoefc add /DiscriminantI ED - % I2=ac-b^2 - CurveCoefa CurveCoefc mul CurveCoefb dup mul sub /DiscriminantII ED - DiscriminantII 0 le { % if I2\le0 + } ifelse + % CurveCoefa = CurveCoefb = CurveCoefc = CurveCoefd = CurveCoefe = CurveCoeff = + 0 /CurveCoefMax ED 1E8 /CurveCoefMin ED + CurveCoefa abs CurveCoefMax gt {CurveCoefa abs /CurveCoefMax ED} if + CurveCoefb abs CurveCoefMax gt {CurveCoefb abs /CurveCoefMax ED} if + CurveCoefc abs CurveCoefMax gt {CurveCoefc abs /CurveCoefMax ED} if + CurveCoefd abs CurveCoefMax gt {CurveCoefd abs /CurveCoefMax ED} if + CurveCoefe abs CurveCoefMax gt {CurveCoefe abs /CurveCoefMax ED} if + CurveCoeff abs CurveCoefMax gt {CurveCoeff abs /CurveCoefMax ED} if + CurveCoefa abs CurveCoefMin lt {CurveCoefa abs /CurveCoefMin ED} if + CurveCoefb abs CurveCoefMin lt {CurveCoefb abs /CurveCoefMin ED} if + CurveCoefc abs CurveCoefMin lt {CurveCoefc abs /CurveCoefMin ED} if + CurveCoefd abs CurveCoefMin lt {CurveCoefd abs /CurveCoefMin ED} if + CurveCoefe abs CurveCoefMin lt {CurveCoefe abs /CurveCoefMin ED} if + CurveCoeff abs CurveCoefMin lt {CurveCoeff abs /CurveCoefMin ED} if + % CurveCoefMin = CurveCoefMax = + CurveCoefMin CurveCoefMax div 1E-5 lt { + CurveCoefa CurveCoefMax div /CurveCoefa ED + CurveCoefb CurveCoefMax div /CurveCoefb ED + CurveCoefc CurveCoefMax div /CurveCoefc ED + CurveCoefd CurveCoefMax div /CurveCoefd ED + CurveCoefe CurveCoefMax div /CurveCoefe ED + CurveCoeff CurveCoefMax div /CurveCoeff ED + } if + % CurveCoefa = CurveCoefb = CurveCoefc = CurveCoefd = CurveCoefe = CurveCoeff = + CurveCoefa abs 1E-5 lt {0 /CurveCoefa ED} if + CurveCoefb abs 1E-5 lt {0 /CurveCoefb ED} if + CurveCoefc abs 1E-5 lt {0 /CurveCoefc ED} if + CurveCoefd abs 1E-5 lt {0 /CurveCoefd ED} if + CurveCoefe abs 1E-5 lt {0 /CurveCoefe ED} if + CurveCoeff abs 1E-5 lt {0 /CurveCoeff ED} if + % the following is same with pstGeneralEllipseCoef. + % CurveCoefa = CurveCoefb = CurveCoefc = CurveCoefd = CurveCoefe = CurveCoeff = + % I1=a+c + CurveCoefa CurveCoefc add /DiscriminantI ED + % I2=ac-b^2 + CurveCoefa CurveCoefc mul CurveCoefb dup mul sub /DiscriminantII ED + % I3=|a b d,b c e,d e f| + CurveCoefa CurveCoefb CurveCoefd + CurveCoefb CurveCoefc CurveCoefe + CurveCoefd CurveCoefe CurveCoeff + tx@EcldDict begin DeterminantThree end /DiscriminantIII ED + % DiscriminantI = DiscriminantII = DiscriminantIII = + DiscriminantII 0 gt { % if I2>0 + % Solve the Characteristic Equation: \lambda^2-I_1\lambda+I_2=0 + DiscriminantI dup mul 4 DiscriminantII mul sub dup 0 lt { 0 0 0 /MyEllipseA ED 0 /MyEllipseB ED 0 /#9 ED - }{ - CurveCoefa CurveCoefc sub dup mul 4 CurveCoefb dup mul mul add sqrt /CurveCoefTempA ED - CurveCoefa CurveCoefe dup mul mul CurveCoefc CurveCoefd dup mul mul add - CurveCoeff CurveCoefb dup mul mul add 2 CurveCoefb mul CurveCoefd mul - CurveCoefe mul sub CurveCoefa CurveCoefc mul CurveCoeff mul sub 2 mul /CurveCoefTempB ED - % Ra = sqrt((2(ae^2+cd^2+fb^2-2bde-acf))/((ac-b^2)[(a+c)-sqrt((a-c)^2+4b^2)])) - CurveCoefTempB DiscriminantII DiscriminantI CurveCoefTempA sub mul div /MyEllipseSquareA ED - % Rb = sqrt((2(ae^2+cd^2+fb^2-2bde-acf))/((ac-b^2)[(a+c)+sqrt((a-c)^2+4b^2)])) - CurveCoefTempB DiscriminantII DiscriminantI CurveCoefTempA add mul div /MyEllipseSquareB ED - MyEllipseSquareA 0 lt MyEllipseSquareB 0 lt or { - 0 0 - 0 /MyEllipseA ED - 0 /MyEllipseB ED - 0 /#9 ED + } { + sqrt dup DiscriminantI exch sub 2 div /CharacteristicLambdaI ED + DiscriminantI add 2 div /CharacteristicLambdaII ED + % CharacteristicLambdaI = CharacteristicLambdaII = + % 20200726 Liaoxiongfei + % fix how to get the rotation of the ellipse major axis. + % since we can reduce the ellipse to + % \lambda_1x^2+\lambda_2y^2+I_3/I_2=0 + % so the major axis is determined by the characteristic root with the small absolute value, + % and the slope of major axis is $(\lambda_1-a)/b$, or $(c-\lambda_2)/b$, where |\lambda_1|\leq|\lambda_2| + CharacteristicLambdaI abs CharacteristicLambdaII abs lt { + DiscriminantIII CharacteristicLambdaI DiscriminantII mul div neg sqrt /MyEllipseA ED + DiscriminantIII CharacteristicLambdaII DiscriminantII mul div neg sqrt /MyEllipseB ED + CharacteristicLambdaI CurveCoefa lt { + CharacteristicLambdaI CurveCoefa sub neg CurveCoefb neg atan /#9 ED + } { + CharacteristicLambdaI CurveCoefa sub CurveCoefb atan /#9 ED + } ifelse } { - MyEllipseSquareA sqrt /MyEllipseA ED - MyEllipseSquareB sqrt /MyEllipseB ED - CurveCoefb abs 1E-5 lt { % b == 0 - CurveCoefa CurveCoefc lt { % a < c - 0 /#9 ED - } { - 90 /#9 ED - } ifelse + DiscriminantIII CharacteristicLambdaII DiscriminantII mul div neg sqrt /MyEllipseA ED + DiscriminantIII CharacteristicLambdaI DiscriminantII mul div neg sqrt /MyEllipseB ED + CharacteristicLambdaII CurveCoefa lt { + CharacteristicLambdaII CurveCoefa sub neg CurveCoefb neg atan /#9 ED } { - CurveCoefa CurveCoefc sub abs 1E-5 lt { % a = c - 45 /#9 ED - } { - CurveCoefb 0 lt { - 2 CurveCoefb mul neg CurveCoefc CurveCoefa sub atan /MyEllipseAngDbl ED - MyEllipseAngDbl 2 div /#9 ED - } { - 2 CurveCoefb mul CurveCoefa CurveCoefc sub atan /MyEllipseAngDbl ED - MyEllipseAngDbl 180 add 2 div /#9 ED - } ifelse - } ifelse + CharacteristicLambdaII CurveCoefa sub CurveCoefb atan /#9 ED } ifelse - CurveCoefb CurveCoefe mul CurveCoefd CurveCoefc mul sub DiscriminantII div % x0 - CurveCoefb CurveCoefd mul CurveCoefa CurveCoefe mul sub DiscriminantII div % y0 } ifelse + % MyEllipseA = MyEllipseB = #9 = (--------------) = + % F_1(x,y)=ax+by+d=0 + % F_2(x,y)=bx+cy+e=0 + CurveCoefb CurveCoefe mul CurveCoefc CurveCoefd mul sub DiscriminantII div % x0 + CurveCoefb CurveCoefd mul CurveCoefa CurveCoefe mul sub DiscriminantII div % y0 } ifelse + } { + 0 0 + 0 /MyEllipseA ED + 0 /MyEllipseB ED + 0 /#9 ED } ifelse ){#7} \Pst@geonodelabel{#7}% @@ -5960,15 +6028,15 @@ \endgroup% }% % -% 4. Standard Inversion Parabola with coordinate translation +% 4. Standard Conjugate 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 Conjugate 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} +%% \begin{equation}\label{StandardConjugateParabola} %% (y-y0)^2=2p(x-x0) %% \end{equation} %% and the parametric function can be written as: -%% \begin{equation}\label{ParametricFunctionOfStandardInversionParabola} +%% \begin{equation}\label{ParametricFunctionOfStandardConjugateParabola} %% \left\{\begin{array}{l} %% x=\dfrac{t^2}{2p}+x_o\\ %% y=t+y_o @@ -5976,7 +6044,7 @@ %% \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. +%% Draw a Conjugate 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 @@ -6000,7 +6068,7 @@ }% % %% \pstIParabolaNode[Options](O){p}{t}{A} -%% Draw the node whose paramater is the given value $t$ on the Inversion Parabola P. +%% Draw the node whose paramater is the given value $t$ on the Conjugate Parabola P. %% Parameters: %% #1 -> options %% #2 -> [input] the parabola vertex O @@ -6025,7 +6093,7 @@ }% % %% \pstIParabolaOrdNode[Options](O){p}{$y_1$}{A} -%% Draw the node whose ordinate is the given value $y_1$ on the Inversion Parabola P. +%% Draw the node whose ordinate is the given value $y_1$ on the Conjugate Parabola P. %% Parameters: %% #1 -> options %% #2 -> [input] the parabola vertex O @@ -6048,7 +6116,7 @@ }% % %% \pstIParabolaAbsNode[Options](O){p}{$x_1$}{A}{B} -%% Draw the nodes whose abscissa is the given value $x_1$ on the Inversion Parabola P. +%% Draw the nodes whose abscissa is the given value $x_1$ on the Conjugate Parabola P. %% Parameters: %% #1 -> options %% #2 -> [input] the parabola vertex O @@ -6088,7 +6156,7 @@ }% % %% \pstIParabolaFocusNode[Options](O){p}{F} -%% Draw the focus node of a Inversion Parabola P. +%% Draw the focus node of a Conjugate Parabola P. %% Parameters: %% #1 -> options %% #2 -> [input] the parabola vertex O @@ -6111,7 +6179,7 @@ }% % %% \pstIParabolaDirectrixLine[Options](O){p}{LA}{LB} -%% Draw the directrix line of a Inversion Parabola P. +%% Draw the directrix line of a Conjugate 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 @@ -6146,7 +6214,7 @@ }% % %% \pstIParabolaLineInter[Options](O){p}{A}{B}{C}{D} -%% Find the intersections C and D of line AB and the Inversion Parabola P. +%% Find the intersections C and D of line AB and the Conjugate 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: @@ -6250,7 +6318,7 @@ }% % %% \pstIParabolaPolarNode[Options](O){p}(F)[L1][L2]{A}{B}{T} -%% Find the polar point of chord AB on Inversion Parabola P. +%% Find the polar point of chord AB on Conjugate 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. @@ -6295,7 +6363,7 @@ }% % %% \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. +%% Draw the two tangent lines through the point $T$ to the Conjugate Parabola P and get the node A and B on the Conjugate 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: @@ -6467,21 +6535,22 @@ \pstParseArg{CurveCoef}{a,b,c,d,e,f}{#2} \pnode(! \CurveCoefa /CurveCoefa ED - \CurveCoefb /CurveCoefb ED + \CurveCoefb\space 2 div /CurveCoefb ED \CurveCoefc /CurveCoefc ED - \CurveCoefd /CurveCoefd ED - \CurveCoefe /CurveCoefe ED + \CurveCoefd\space 2 div /CurveCoefd ED + \CurveCoefe\space 2 div /CurveCoefe ED \CurveCoeff /CurveCoeff ED + % CurveCoefa = CurveCoefb = CurveCoefc = CurveCoefd = CurveCoefe = CurveCoeff = % I1=a+c CurveCoefa CurveCoefc add /DiscriminantI ED - % I2=b^2-4ac - CurveCoefb dup mul 4 CurveCoefa CurveCoefc mul mul sub /DiscriminantII ED - % I3=1/2|2a b d,b 2c e,d e 2f| - CurveCoefa 2 mul CurveCoefb CurveCoefd - CurveCoefb CurveCoefc 2 mul CurveCoefe - CurveCoefd CurveCoefe CurveCoeff 2 mul - tx@EcldDict begin DeterminantThree end 2 div /DiscriminantIII ED - %DiscriminantI = DiscriminantII = DiscriminantIII = + % I2=ac-b^2 + CurveCoefa CurveCoefc mul CurveCoefb dup mul sub /DiscriminantII ED + % I3=|a b d,b c e,d e f| + CurveCoefa CurveCoefb CurveCoefd + CurveCoefb CurveCoefc CurveCoefe + CurveCoefd CurveCoefe CurveCoeff + tx@EcldDict begin DeterminantThree end /DiscriminantIII ED + % DiscriminantI = DiscriminantII = DiscriminantIII = DiscriminantII abs 1E-5 lt DiscriminantIII 0 ne and { % if I2=0 and I3!=0 CurveCoefb abs 1E-5 lt { % b=0 -> sin2x=0 x=0 0 /#5 ED @@ -6490,21 +6559,21 @@ 45 /#5 ED } { CurveCoefb 0 lt { - CurveCoefb neg CurveCoefc CurveCoefa sub atan /MyParabolaAngDbl ED + 2 CurveCoefb mul neg CurveCoefc CurveCoefa sub atan /MyParabolaAngDbl ED MyParabolaAngDbl 2 div /#5 ED } { - CurveCoefb CurveCoefa CurveCoefc sub atan /MyParabolaAngDbl ED + 2 CurveCoefb mul CurveCoefa CurveCoefc sub atan /MyParabolaAngDbl ED MyParabolaAngDbl 2 div /#5 ED } ifelse } ifelse } ifelse #5 sin /MySin ED #5 cos /MyCos ED - CurveCoefa MyCos dup mul mul CurveCoefb MySin MyCos mul mul add + CurveCoefa MyCos dup mul mul 2 CurveCoefb mul MySin MyCos mul mul add CurveCoefc MySin dup mul mul add /MyCoefa ED - CurveCoefa MySin dup mul mul CurveCoefb MySin MyCos mul mul sub + CurveCoefa MySin dup mul mul 2 CurveCoefb mul MySin MyCos mul mul sub CurveCoefc MyCos dup mul mul add /MyCoefc ED - CurveCoefd MyCos mul CurveCoefe MySin mul add /MyCoefd ED - CurveCoefe MyCos mul CurveCoefd MySin mul sub /MyCoefe ED + 2 CurveCoefd mul MyCos mul 2 CurveCoefe mul MySin mul add /MyCoefd ED + 2 CurveCoefe mul MyCos mul 2 CurveCoefd mul MySin mul sub /MyCoefe ED MyCoefa abs 1E-5 lt { % a'=0 % c'y^2+d'x+e'y+f'=0 MyCoefd abs 1E-5 lt { % d'=0 two lines, not support @@ -6517,7 +6586,7 @@ MyCoefe dup mul MyCoefc div MyCoefd div 4 div CurveCoeff MyCoefd div sub /MyVertexX ED MyVertexX MyCos mul MyVertexY MySin mul sub MyVertexY MyCos mul MyVertexX MySin mul add - #5 90 sub /#5 ED % inverse general hyperbola + #5 90 sub /#5 ED % general conjugate hyperbola } ifelse } if MyCoefc abs 1E-5 lt { % c'=0 @@ -6538,6 +6607,16 @@ %MyCoefa = MyCoefc = MyCoefd = MyCoefe = %(--------------) = } { + (These five points can not construct a parabola!) = + DiscriminantII abs 1E-5 lt DiscriminantIII abs 1E-5 lt and { % if I2=0 and I3=0 + (May be they are two lines!) = + } { + DiscriminantII 0 gt { + (May be they can construct an ellipse!) = + } { + (May be they can construct a hyperbola!) = + } ifelse + } ifelse 0 /#4 ED 0 /#5 ED 0 0 @@ -6603,7 +6682,7 @@ CurveLineACCoefA CurveNodeEX mul CurveLineACCoefB CurveNodeEY mul add CurveLineACCoefC add /CurveValueACE ED % AC-E CurveLineBDCoefA CurveNodeEX mul CurveLineBDCoefB CurveNodeEY mul add CurveLineBDCoefC add /CurveValueBDE ED % BD-E % CurveValueABE = CurveValueCDE = CurveValueACE = CurveValueBDE = - CurveValueACE CurveValueBDE mul dup abs 1E-5 lt { % lambda can be any number, the cuver is not unique defined. + CurveValueACE CurveValueBDE mul dup abs 1E-5 lt { % lambda can be any number, the curve is not unique defined. 0 /#8 ED 0 /#9 ED 0 0 @@ -6613,13 +6692,37 @@ % =(a1a2+ka3a4)x^2+(a2b1+a1b2+ka4b3+ka3b4)xy+(b1b2+kb3b4)y^2+(a2c1+a1c2+ka4c3+ka3c4)x+(b2c1+b1c2+kb4c3+kb3c4)y+c1c2+kc3c4 CurveLineABCoefA CurveLineCDCoefA mul CurveLineACCoefA CurveLineBDCoefA mul CurveLambda mul add /CurveCoefa ED CurveLineCDCoefA CurveLineABCoefB mul CurveLineABCoefA CurveLineCDCoefB mul add - CurveLineBDCoefA CurveLineACCoefB mul CurveLineACCoefA CurveLineBDCoefB mul add CurveLambda mul add /CurveCoefb ED + CurveLineBDCoefA CurveLineACCoefB mul CurveLineACCoefA CurveLineBDCoefB mul add CurveLambda mul add 2 div /CurveCoefb ED CurveLineABCoefB CurveLineCDCoefB mul CurveLineACCoefB CurveLineBDCoefB mul CurveLambda mul add /CurveCoefc ED CurveLineCDCoefA CurveLineABCoefC mul CurveLineABCoefA CurveLineCDCoefC mul add - CurveLineBDCoefA CurveLineACCoefC mul CurveLineACCoefA CurveLineBDCoefC mul add CurveLambda mul add /CurveCoefd ED + CurveLineBDCoefA CurveLineACCoefC mul CurveLineACCoefA CurveLineBDCoefC mul add CurveLambda mul add 2 div /CurveCoefd ED CurveLineCDCoefB CurveLineABCoefC mul CurveLineABCoefB CurveLineCDCoefC mul add - CurveLineBDCoefB CurveLineACCoefC mul CurveLineACCoefB CurveLineBDCoefC mul add CurveLambda mul add /CurveCoefe ED + CurveLineBDCoefB CurveLineACCoefC mul CurveLineACCoefB CurveLineBDCoefC mul add CurveLambda mul add 2 div /CurveCoefe ED CurveLineABCoefC CurveLineCDCoefC mul CurveLineACCoefC CurveLineBDCoefC mul CurveLambda mul add /CurveCoeff ED + % CurveCoefa = CurveCoefb = CurveCoefc = CurveCoefd = CurveCoefe = CurveCoeff = + 0 /CurveCoefMax ED 1E8 /CurveCoefMin ED + CurveCoefa abs CurveCoefMax gt {CurveCoefa abs /CurveCoefMax ED} if + CurveCoefb abs CurveCoefMax gt {CurveCoefb abs /CurveCoefMax ED} if + CurveCoefc abs CurveCoefMax gt {CurveCoefc abs /CurveCoefMax ED} if + CurveCoefd abs CurveCoefMax gt {CurveCoefd abs /CurveCoefMax ED} if + CurveCoefe abs CurveCoefMax gt {CurveCoefe abs /CurveCoefMax ED} if + CurveCoeff abs CurveCoefMax gt {CurveCoeff abs /CurveCoefMax ED} if + CurveCoefa abs CurveCoefMin lt {CurveCoefa abs /CurveCoefMin ED} if + CurveCoefb abs CurveCoefMin lt {CurveCoefb abs /CurveCoefMin ED} if + CurveCoefc abs CurveCoefMin lt {CurveCoefc abs /CurveCoefMin ED} if + CurveCoefd abs CurveCoefMin lt {CurveCoefd abs /CurveCoefMin ED} if + CurveCoefe abs CurveCoefMin lt {CurveCoefe abs /CurveCoefMin ED} if + CurveCoeff abs CurveCoefMin lt {CurveCoeff abs /CurveCoefMin ED} if + % CurveCoefMin = CurveCoefMax = + CurveCoefMin CurveCoefMax div 1E-5 lt { + CurveCoefa CurveCoefMax div /CurveCoefa ED + CurveCoefb CurveCoefMax div /CurveCoefb ED + CurveCoefc CurveCoefMax div /CurveCoefc ED + CurveCoefd CurveCoefMax div /CurveCoefd ED + CurveCoefe CurveCoefMax div /CurveCoefe ED + CurveCoeff CurveCoefMax div /CurveCoeff ED + } if + % CurveCoefa = CurveCoefb = CurveCoefc = CurveCoefd = CurveCoefe = CurveCoeff = CurveCoefa abs 1E-5 lt {0 /CurveCoefa ED} if CurveCoefb abs 1E-5 lt {0 /CurveCoefb ED} if CurveCoefc abs 1E-5 lt {0 /CurveCoefc ED} if @@ -6630,13 +6733,13 @@ % the following is same with pstGeneralParabolaCoef. % I1=a+c CurveCoefa CurveCoefc add /DiscriminantI ED - % I2=b^2-4ac - CurveCoefb dup mul 4 CurveCoefa CurveCoefc mul mul sub /DiscriminantII ED - % I3=1/2|2a b d,b 2c e,d e 2f| - CurveCoefa 2 mul CurveCoefb CurveCoefd - CurveCoefb CurveCoefc 2 mul CurveCoefe - CurveCoefd CurveCoefe CurveCoeff 2 mul - tx@EcldDict begin DeterminantThree end 2 div /DiscriminantIII ED + % I2=ac-b^2 + CurveCoefa CurveCoefc mul CurveCoefb dup mul sub /DiscriminantII ED + % I3=|a b d,b c e,d e f| + CurveCoefa CurveCoefb CurveCoefd + CurveCoefb CurveCoefc CurveCoefe + CurveCoefd CurveCoefe CurveCoeff + tx@EcldDict begin DeterminantThree end /DiscriminantIII ED % DiscriminantI = DiscriminantII = DiscriminantIII = DiscriminantII abs 1E-5 lt DiscriminantIII 0 ne and { % if I2=0 and I3!=0 CurveCoefb abs 1E-5 lt { % b=0 -> sin2x=0 x=0 @@ -6646,21 +6749,21 @@ 45 /#9 ED } { CurveCoefb 0 lt { - CurveCoefb neg CurveCoefc CurveCoefa sub atan /MyParabolaAngDbl ED + 2 CurveCoefb mul neg CurveCoefc CurveCoefa sub atan /MyParabolaAngDbl ED MyParabolaAngDbl 2 div /#9 ED } { - CurveCoefb CurveCoefa CurveCoefc sub atan /MyParabolaAngDbl ED + 2 CurveCoefb mul CurveCoefa CurveCoefc sub atan /MyParabolaAngDbl ED MyParabolaAngDbl 2 div /#9 ED } ifelse } ifelse } ifelse #9 sin /MySin ED #9 cos /MyCos ED - CurveCoefa MyCos dup mul mul CurveCoefb MySin MyCos mul mul add + CurveCoefa MyCos dup mul mul 2 CurveCoefb mul MySin MyCos mul mul add CurveCoefc MySin dup mul mul add /MyCoefa ED - CurveCoefa MySin dup mul mul CurveCoefb MySin MyCos mul mul sub + CurveCoefa MySin dup mul mul 2 CurveCoefb mul MySin MyCos mul mul sub CurveCoefc MyCos dup mul mul add /MyCoefc ED - CurveCoefd MyCos mul CurveCoefe MySin mul add /MyCoefd ED - CurveCoefe MyCos mul CurveCoefd MySin mul sub /MyCoefe ED + 2 CurveCoefd mul MyCos mul 2 CurveCoefe mul MySin mul add /MyCoefd ED + 2 CurveCoefe mul MyCos mul 2 CurveCoefd mul MySin mul sub /MyCoefe ED MyCoefa abs 1E-5 lt { % a'=0 % c'y^2+d'x+e'y+f'=0 MyCoefd abs 1E-5 lt { % d'=0 two lines, not support @@ -6673,7 +6776,7 @@ MyCoefe dup mul MyCoefc div MyCoefd div 4 div CurveCoeff MyCoefd div sub /MyVertexX ED MyVertexX MyCos mul MyVertexY MySin mul sub MyVertexY MyCos mul MyVertexX MySin mul add - #9 90 sub /#9 ED % inverse general hyperbola + #9 90 sub /#9 ED % general conjugate hyperbola } ifelse } if MyCoefc abs 1E-5 lt { % c'=0 @@ -6693,10 +6796,14 @@ % #8 = #9 = MySin = MyCos = MyCoefa = MyCoefc = MyCoefd = MyCoefe = (--------------) = } { (These five points can not construct a parabola!) = - DiscriminantII 0 lt { - (May be they can construct an ellipse!) = + DiscriminantII abs 1E-5 lt DiscriminantIII abs 1E-5 lt and { % if I2=0 and I3=0 + (May be they are two lines!) = } { - (May be they can construct a hyperbola!) = + DiscriminantII 0 gt { + (May be they can construct an ellipse!) = + } { + (May be they can construct a hyperbola!) = + } ifelse } ifelse 0 /#8 ED 0 /#9 ED @@ -7198,12 +7305,12 @@ \endgroup% }% % -% 6. General Inversion Parabola with coordinate translation and rotation +% 6. General Conjugate 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, +%% The General Conjugate 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}, +%% The equation can be got from the parametric function of the conjugate parabola \ref{ParametricFunctionOfStandardConjugateParabola}, %% using the rotation transform formula \ref{RotationTransformFormula}, then we have %% \begin{equation} %% \left\{\begin{array}{l} @@ -7212,8 +7319,8 @@ %% \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} +%% So we get the parametric function of the General Conjugate Parabola with coordinate translation and rotation as following: +%% \begin{equation}\label{ParametricFunctionOfGeneralConjugateParabola} %% \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} @@ -7221,7 +7328,7 @@ %% \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$, +%% Draw a General Conjugate 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: @@ -7255,7 +7362,7 @@ }% % %% \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. +%% Create a new node $A$ whose parameter is the the given value $t$ on the given General Conjugate Parabola P. %% If you not input the rotation angle, the default value is $0^\circ$. %% Parameters: %% #1 -> options @@ -7289,7 +7396,7 @@ }% % %% \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. +%% Find the nodes $A$ and $B$ whose abscissa are the the given value $x_1$ on the given General Conjugate 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$$ @@ -7358,7 +7465,7 @@ }% % %% \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. +%% Find the nodes $A$ and $B$ whose ordinate are the the given value $y_1$ on the given General Conjugate 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$$ @@ -7429,7 +7536,7 @@ }% % %% \pstGeneralIParabolaFocusNode[Options](O){p}[rotation]{F} -%% Find the focus node $F$ of the given General Inversion Parabola P. +%% Find the focus node $F$ of the given General Conjugate Parabola P. %% If you not input the rotation angle, the default value is $0^\circ$. %% Parameters: %% #1 -> options @@ -7458,7 +7565,7 @@ }% % %% \pstGeneralIParabolaDirectrixLine[Options](O){p}[rotation]{LA}{LB} -%% Draw the directrix line of the General Inversion Parabola P. +%% Draw the directrix line of the General Conjugate 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$, @@ -7520,7 +7627,7 @@ %% %% 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 +%% refer to equation (\ref{ParametricFunctionOfGeneralConjugateParabola}), 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$$ @@ -7668,7 +7775,7 @@ }% % %% \pstGeneralIParabolaPolarNode[Options](O){p}[rotation](F)[L1][L2]{A}{B}{T} -%% Find the polar point of chord AB on General Inversion Parabola P. +%% Find the polar point of chord AB on General Conjugate 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. @@ -7718,7 +7825,7 @@ }% % %% \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. +%% Draw the two tangent lines through the point $T$ to the General Conjugate Parabola P and get the node A and B on the General Conjugate 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: @@ -8251,15 +8358,15 @@ \endgroup% }% % -% 8. Standard Inversion Hyperbola with coordinate translation +% 8. Standard Conjugate 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 Standard Conjugate 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} +%% \begin{equation}\label{FunctionOfStandardConjugateHyperbola} %% \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} +%% \begin{equation}\label{ParametricFunctionOfStandardConjugateHyperbola} %% \left\{\begin{array}{l} %% x=b\tan\alpha+x_o\\ %% y=a\sec\alpha+y_o @@ -8267,7 +8374,7 @@ %% \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)$. +%% Draw a Conjugate 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 @@ -8320,7 +8427,7 @@ }% % %% \pstIHyperbolaNode[Options](O)(a,b){t}{P} -%% Create a new node P on the Inversion Hyperbola E whose parameter is the given value $t$. +%% Create a new node P on the Conjugate Hyperbola E whose parameter is the given value $t$. %% Parameters: %% #1 -> options %% #2 -> [input] the hyperbola center O @@ -8350,7 +8457,7 @@ }% % %% \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$. +%% Create a new node P on the Conjugate 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}$$ @@ -8389,7 +8496,7 @@ }% % %% \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$. +%% Create a new node P on the Conjugate 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}$$ @@ -8436,7 +8543,7 @@ }% % %% \pstIHyperbolaFocusNode[Options](O)(a,b){F1}{F2} -%% Create the two focus node F1 and F2 of the Inversion Hyperbola H. +%% Create the two focus node F1 and F2 of the Conjugate Hyperbola H. %% Parameters: %% #1 -> options %% #2 -> [input] the hyperbola center O @@ -8470,7 +8577,7 @@ }% % %% \pstIHyperbolaDirectrixLine[Options](O)(a,b){Lx}{Ly}{Rx}{Ry} -%% Draw the two directrix lines L1 and L2 of the Inversion Hyperbola H. +%% Draw the two directrix lines L1 and L2 of the Conjugate Hyperbola H. %% Parameters: %% #1 -> options %% #2 -> [input] the hyperbola center O @@ -8524,7 +8631,7 @@ }% % %% \pstIHyperbolaAsymptoteLine[Options](O)(a,b){L1}{L2} -%% Draw the two asymptote lines L1 and L2 of the Inversion Hyperbola H. +%% Draw the two asymptote lines L1 and L2 of the Conjugate Hyperbola H. %% Parameters: %% #1 -> options %% #2 -> [input] the hyperbola center O @@ -8562,14 +8669,14 @@ }% % %% \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. +%% Find the two intersection nodes C and D of the Conjugate 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 +%% refer to equation (\ref{FunctionOfStandardConjugateHyperbola}), we have %% $$(b^2k^2-a^2)X^2+2b^2kmX+b^2(m^2-a^2)=0$$ %% $$Y=kX+m$$ %% where @@ -8684,7 +8791,7 @@ }% % %% \pstIHyperbolaPolarNode[Options](O)(a,b){A}{B}{T} -%% Find the polar point of chord AB on Inversion Hyperbola H. +%% Find the polar point of chord AB on Conjugate 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: @@ -8709,7 +8816,7 @@ }% % %% \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. +%% Draw the two tangent lines through the point $T$ to the Conjugate Hyperbola H and get the node A and B on the Conjugate 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$. @@ -8830,7 +8937,7 @@ %% #1 -> options %% #2 -> [input] the given focus F_1 %% #3 -> [input] the given focus F_2 -%% #4 -> [input] the given node N on the hyperbola +%% #4 -> [input] the given node N on the hyperbola %% #5 -> [output] the center of the hyperbola. %% #6 -> [output] the pair of major and minor radius of the hyperbola. %% #7 -> [output] the rotation of the hyperbola major axis. @@ -8850,9 +8957,9 @@ Fax Fay Fbx Fby tx@EcldDict begin ABDist end 2 div /HyperbolaC ED - Nx Ny Fax Fay + Nx Ny Fax Fay tx@EcldDict begin ABDist end - Nx Ny Fbx Fby + Nx Ny Fbx Fby tx@EcldDict begin ABDist end sub 2 div abs /HyperbolaA ED HyperbolaC dup mul HyperbolaA dup mul sub sqrt /HyperbolaB ED @@ -8965,7 +9072,7 @@ %% #2 -> [input] the coefficents of the quadratic curve equation, with six numbers $a,b,c,d,e,f$ joined with comma. %% #3 -> [output] the center of the hyperbola. %% #4 -> [output] the pair of real and imaginary radius of the hyperbola. -%% #5 -> [output] the rotation of the hyperbola symmetrical axis. +%% #5 -> [output] the rotation of the hyperbola real symmetrical axis. \def\pstGeneralHyperbolaCoef{\@ifnextchar[\Pst@GeneralHyperbolaCoef{\Pst@GeneralHyperbolaCoef[]}} \def\Pst@GeneralHyperbolaCoef[#1]#2#3#4#5{ \begingroup @@ -8973,24 +9080,25 @@ \pstParseArg{CurveCoef}{a,b,c,d,e,f}{#2} \pnode(! \CurveCoefa /CurveCoefa ED - \CurveCoefb /CurveCoefb ED + \CurveCoefb\space 2 div /CurveCoefb ED \CurveCoefc /CurveCoefc ED - \CurveCoefd /CurveCoefd ED - \CurveCoefe /CurveCoefe ED + \CurveCoefd\space 2 div /CurveCoefd ED + \CurveCoefe\space 2 div /CurveCoefe ED \CurveCoeff /CurveCoeff ED + % CurveCoefa = CurveCoefb = CurveCoefc = CurveCoefd = CurveCoefe = CurveCoeff = % I1=a+c CurveCoefa CurveCoefc add /DiscriminantI ED - % I2=b^2-4ac - CurveCoefb dup mul 4 CurveCoefa CurveCoefc mul mul sub /DiscriminantII ED - % I3=1/2|2a b d,b 2c e,d e 2f| - CurveCoefa 2 mul CurveCoefb CurveCoefd - CurveCoefb CurveCoefc 2 mul CurveCoefe - CurveCoefd CurveCoefe CurveCoeff 2 mul - tx@EcldDict begin DeterminantThree end 2 div /DiscriminantIII ED + % I2=ac-b^2 + CurveCoefa CurveCoefc mul CurveCoefb dup mul sub /DiscriminantII ED + % I3=|a b d,b c e,d e f| + CurveCoefa CurveCoefb CurveCoefd + CurveCoefb CurveCoefc CurveCoefe + CurveCoefd CurveCoefe CurveCoeff + tx@EcldDict begin DeterminantThree end /DiscriminantIII ED % DiscriminantI = DiscriminantII = DiscriminantIII = - DiscriminantII 0 gt DiscriminantIII 0 ne and { % if I2>0 and I3!=0 - % Solve the Characteristic Equation: \lambda^2-I_1\lambda-I_2/4=0 - DiscriminantI dup mul DiscriminantII add dup 0 lt { + DiscriminantII 0 lt DiscriminantIII 0 ne and { % if I2<0 and I3!=0 + % Solve the Characteristic Equation: \lambda^2-I_1\lambda+I_2=0 + DiscriminantI dup mul 4 DiscriminantII mul sub dup 0 lt { 0 0 0 /MyHyperbolaA ED 0 /MyHyperbolaB ED @@ -8999,55 +9107,34 @@ sqrt dup DiscriminantI exch sub 2 div /CharacteristicLambdaI ED DiscriminantI add 2 div /CharacteristicLambdaII ED % CharacteristicLambdaI = CharacteristicLambdaII = - CurveCoefb 0 lt { - DiscriminantIII 0 lt { - DiscriminantIII CharacteristicLambdaI DiscriminantII mul div sqrt /MyHyperbolaA ED - DiscriminantIII CharacteristicLambdaII DiscriminantII mul div neg sqrt /MyHyperbolaB ED - } { - DiscriminantIII CharacteristicLambdaI DiscriminantII mul div neg sqrt /MyHyperbolaB ED - DiscriminantIII CharacteristicLambdaII DiscriminantII mul div sqrt /MyHyperbolaA ED - } ifelse - } { - DiscriminantIII 0 lt { - DiscriminantIII CharacteristicLambdaII DiscriminantII mul div neg sqrt /MyHyperbolaB ED - DiscriminantIII CharacteristicLambdaI DiscriminantII mul div sqrt /MyHyperbolaA ED - } { - DiscriminantIII CharacteristicLambdaII DiscriminantII mul div sqrt /MyHyperbolaA ED - DiscriminantIII CharacteristicLambdaI DiscriminantII mul div neg sqrt /MyHyperbolaB ED - } ifelse - } ifelse - CurveCoefb abs 1E-5 lt { % b == 0 - CurveCoefa CurveCoefc lt { % a < c - 0 /#5 ED + % 20200726 Liaoxiongfei + % fix how to get the rotation of the hyperbola real symmetrical axis. + % since we can reduce the hyperbola to + % \lambda_1x^2+\lambda_2y^2+I_3/I_2=0 + % and $I_2\leq0$, so the real symmetrical axis is determined by the characteristic root with the same sign as I3. + % and the slope of real symmetrical axis is $(\lambda_1-a)/b$, or $(c-\lambda_2)/b$, where $\lambda_1*I_3>0$, or they have same sign. + DiscriminantIII CharacteristicLambdaI mul 0 gt { + DiscriminantIII CharacteristicLambdaI DiscriminantII mul div neg sqrt /MyHyperbolaA ED + DiscriminantIII CharacteristicLambdaII DiscriminantII mul div sqrt /MyHyperbolaB ED + CharacteristicLambdaI CurveCoefa lt { + CharacteristicLambdaI CurveCoefa sub neg CurveCoefb neg atan /#5 ED } { - 90 /#5 ED + CharacteristicLambdaI CurveCoefa sub CurveCoefb atan /#5 ED } ifelse } { - CurveCoefa CurveCoefc sub abs 1E-5 lt { % a = c - 45 /#5 ED + DiscriminantIII CharacteristicLambdaII DiscriminantII mul div neg sqrt /MyHyperbolaA ED + DiscriminantIII CharacteristicLambdaI DiscriminantII mul div sqrt /MyHyperbolaB ED + CharacteristicLambdaII CurveCoefa lt { + CharacteristicLambdaII CurveCoefa sub neg CurveCoefb neg atan /#5 ED } { - DiscriminantIII 0 lt { - CurveCoefb 0 lt { - CurveCoefb neg CurveCoefc CurveCoefa sub atan /MyHyperbolaAngDbl ED - MyHyperbolaAngDbl 2 div /#5 ED - } { - CurveCoefb CurveCoefa CurveCoefc sub atan /MyHyperbolaAngDbl ED - MyHyperbolaAngDbl 180 add 2 div /#5 ED - } ifelse - } { - CurveCoefb 0 lt { - CurveCoefb neg CurveCoefc CurveCoefa sub atan /MyHyperbolaAngDbl ED - MyHyperbolaAngDbl 180 add 2 div /#5 ED - } { - CurveCoefb CurveCoefa CurveCoefc sub atan /MyHyperbolaAngDbl ED - MyHyperbolaAngDbl 2 div /#5 ED - } ifelse - } ifelse + CharacteristicLambdaII CurveCoefa sub CurveCoefb atan /#5 ED } ifelse } ifelse % MyHyperbolaA = MyHyperbolaB = #5 = (--------------) = - CurveCoefd CurveCoefc mul 2 mul CurveCoefb CurveCoefe mul sub DiscriminantII div % x0 - CurveCoefa CurveCoefe mul 2 mul CurveCoefb CurveCoefd mul sub DiscriminantII div % y0 + % F_1(x,y)=ax+by+d=0 + % F_2(x,y)=bx+cy+e=0 + CurveCoefb CurveCoefe mul CurveCoefc CurveCoefd mul sub DiscriminantII div % x0 + CurveCoefb CurveCoefd mul CurveCoefa CurveCoefe mul sub DiscriminantII div % y0 } ifelse } { 0 0 @@ -9096,19 +9183,19 @@ \pst@CurveNodeD \tx@UserCoor /CurveNodeDY ED /CurveNodeDX ED \pst@CurveNodeE \tx@UserCoor /CurveNodeEY ED /CurveNodeEX ED %% - % ax^2+bxy+cy^2+dx+ey+f=0, let a=1, we can use A,B,C,D,E to solve b,c,d,e,f, we have - % AxAy b + Ay^2 c + Ax d + Ay e + 1 f = -Ax^2 - % BxBy b + By^2 c + Bx d + By e + 1 f = -Bx^2 - % CxCy b + Cy^2 c + Cx d + Cy e + 1 f = -Cx^2 - % DxDy b + Dy^2 c + Dx d + Dy e + 1 f = -Dx^2 - % ExEy b + Ey^2 c + Ex d + Ey e + 1 f = -Ex^2 + % ax^2+bxy+cy^2+dx+ey+f=0, we can use A,B,C,D,E to solve b,c,d,e,f, we have + % AxAy b + Ay^2 c + Ax d + Ay e + 1 f = -Ax^2a + % BxBy b + By^2 c + Bx d + By e + 1 f = -Bx^2a + % CxCy b + Cy^2 c + Cx d + Cy e + 1 f = -Cx^2a + % DxDy b + Dy^2 c + Dx d + Dy e + 1 f = -Dx^2a + % ExEy b + Ey^2 c + Ex d + Ey e + 1 f = -Ex^2a % by Cramer's Rule, we have - % |Ax^2 Ay^2 Ax Ay 1| |AxAy Ay^2 Ax Ay 1| - % |Bx^2 By^2 Bx By 1| |BxBy By^2 Bx By 1| - % b=-|Cx^2 Cy^2 Cx Cy 1|/|CxCy Cy^2 Cx Cy 1| etc. - % |Dx^2 Dy^2 Dx Dy 1| |DxDy Dy^2 Dx Dy 1| - % |Ex^2 Ey^2 Ex Ey 1| |ExEy Ey^2 Ex Ey 1| - %% + % |Ax^2a Ay^2 Ax Ay 1| |AxAy Ay^2 Ax Ay 1| + % |Bx^2a By^2 Bx By 1| |BxBy By^2 Bx By 1| + % b=-|Cx^2a Cy^2 Cx Cy 1|/|CxCy Cy^2 Cx Cy 1| etc. + % |Dx^2a Dy^2 Dx Dy 1| |DxDy Dy^2 Dx Dy 1| + % |Ex^2a Ey^2 Ex Ey 1| |ExEy Ey^2 Ex Ey 1| + % if the denominator is zero, we can choose a = 0, else a = 1. CurveNodeAX CurveNodeAY mul CurveNodeAY dup mul CurveNodeAX CurveNodeAY 1 CurveNodeBX CurveNodeBY mul CurveNodeBY dup mul CurveNodeBX CurveNodeBY 1 CurveNodeCX CurveNodeCY mul CurveNodeCY dup mul CurveNodeCX CurveNodeCY 1 @@ -9116,10 +9203,52 @@ CurveNodeEX CurveNodeEY mul CurveNodeEY dup mul CurveNodeEX CurveNodeEY 1 tx@EcldDict begin DeterminantFive end /LinearDiscriminant ED LinearDiscriminant abs 1E-5 lt { % D=0 - 0 0 - 0 /MyHyperbolaA ED - 0 /MyHyperbolaB ED - 0 /#9 ED + 0 /CurveCoefa ED + % Ay^2 c + Ax d + Ay e + 1 f = -AxAyb + % By^2 c + Bx d + By e + 1 f = -BxByb + % Cy^2 c + Cx d + Cy e + 1 f = -CxCyb + % Dy^2 c + Dx d + Dy e + 1 f = -DxDyb + % by Cramer's Rule, we have + % |AxAyb Ax Ay 1| |Ay^2 Ax Ay 1| + % |BxByb Bx By 1| |By^2 Bx By 1| + % c=-|CxCyb Cx Cy 1|/|Cy^2 Cx Cy 1| etc. + % |DxDyb Dx Dy 1| |Dy^2 Dx Dy 1| + % if the denominator is zero, then b = 0, but I_2 is zero at this time, + % and the equation is not a hyperbola. so we can choose b = 1. + CurveNodeAY dup mul CurveNodeAX CurveNodeAY 1 + CurveNodeBY dup mul CurveNodeBX CurveNodeBY 1 + CurveNodeCY dup mul CurveNodeCX CurveNodeCY 1 + CurveNodeDY dup mul CurveNodeDX CurveNodeDY 1 + tx@EcldDict begin DeterminantFour end /LinearDiscriminant2nd ED + LinearDiscriminant2nd abs 1E-5 lt { % D2=0 + 0 /CurveCoefb ED + 0 /CurveCoefc ED + 0 /CurveCoefd ED + 0 /CurveCoefe ED + 0 /CurveCoeff ED + } { + 1 2 div /CurveCoefb ED + CurveNodeAX CurveNodeAY mul CurveNodeAX CurveNodeAY 1 + CurveNodeBX CurveNodeBY mul CurveNodeBX CurveNodeBY 1 + CurveNodeCX CurveNodeCY mul CurveNodeCX CurveNodeCY 1 + CurveNodeDX CurveNodeDY mul CurveNodeDX CurveNodeDY 1 + tx@EcldDict begin DeterminantFour end LinearDiscriminant2nd div neg /CurveCoefc ED + CurveNodeAY dup mul CurveNodeAX CurveNodeAY mul CurveNodeAY 1 + CurveNodeBY dup mul CurveNodeBX CurveNodeBY mul CurveNodeBY 1 + CurveNodeCY dup mul CurveNodeCX CurveNodeCY mul CurveNodeCY 1 + CurveNodeDY dup mul CurveNodeDX CurveNodeDY mul CurveNodeDY 1 + tx@EcldDict begin DeterminantFour end LinearDiscriminant2nd div neg 2 div /CurveCoefd ED + CurveNodeAY dup mul CurveNodeAX CurveNodeAX CurveNodeAY mul 1 + CurveNodeBY dup mul CurveNodeBX CurveNodeBX CurveNodeBY mul 1 + CurveNodeCY dup mul CurveNodeCX CurveNodeCX CurveNodeCY mul 1 + CurveNodeDY dup mul CurveNodeDX CurveNodeDX CurveNodeDY mul 1 + tx@EcldDict begin DeterminantFour end LinearDiscriminant2nd div neg 2 div /CurveCoefe ED + CurveNodeAY dup mul CurveNodeAX CurveNodeAY CurveNodeAX CurveNodeAY mul + CurveNodeBY dup mul CurveNodeBX CurveNodeBY CurveNodeBX CurveNodeBY mul + CurveNodeCY dup mul CurveNodeCX CurveNodeCY CurveNodeCX CurveNodeCY mul + CurveNodeDY dup mul CurveNodeDX CurveNodeDY CurveNodeDX CurveNodeDY mul + tx@EcldDict begin DeterminantFour end LinearDiscriminant2nd div neg /CurveCoeff ED + } ifelse } { 1 /CurveCoefa ED CurveNodeAX dup mul CurveNodeAY dup mul CurveNodeAX CurveNodeAY 1 @@ -9127,7 +9256,7 @@ CurveNodeCX dup mul CurveNodeCY dup mul CurveNodeCX CurveNodeCY 1 CurveNodeDX dup mul CurveNodeDY dup mul CurveNodeDX CurveNodeDY 1 CurveNodeEX dup mul CurveNodeEY dup mul CurveNodeEX CurveNodeEY 1 - tx@EcldDict begin DeterminantFive end LinearDiscriminant div neg /CurveCoefb ED + tx@EcldDict begin DeterminantFive end LinearDiscriminant div neg 2 div /CurveCoefb ED CurveNodeAX CurveNodeAY mul CurveNodeAX dup mul CurveNodeAX CurveNodeAY 1 CurveNodeBX CurveNodeBY mul CurveNodeBX dup mul CurveNodeBX CurveNodeBY 1 CurveNodeCX CurveNodeCY mul CurveNodeCX dup mul CurveNodeCX CurveNodeCY 1 @@ -9139,97 +9268,107 @@ CurveNodeCX CurveNodeCY mul CurveNodeCY dup mul CurveNodeCX dup mul CurveNodeCY 1 CurveNodeDX CurveNodeDY mul CurveNodeDY dup mul CurveNodeDX dup mul CurveNodeDY 1 CurveNodeEX CurveNodeEY mul CurveNodeEY dup mul CurveNodeEX dup mul CurveNodeEY 1 - tx@EcldDict begin DeterminantFive end LinearDiscriminant div neg /CurveCoefd ED + tx@EcldDict begin DeterminantFive end LinearDiscriminant div neg 2 div /CurveCoefd ED CurveNodeAX CurveNodeAY mul CurveNodeAY dup mul CurveNodeAX CurveNodeAX dup mul 1 CurveNodeBX CurveNodeBY mul CurveNodeBY dup mul CurveNodeBX CurveNodeBX dup mul 1 CurveNodeCX CurveNodeCY mul CurveNodeCY dup mul CurveNodeCX CurveNodeCX dup mul 1 CurveNodeDX CurveNodeDY mul CurveNodeDY dup mul CurveNodeDX CurveNodeDX dup mul 1 CurveNodeEX CurveNodeEY mul CurveNodeEY dup mul CurveNodeEX CurveNodeEX dup mul 1 - tx@EcldDict begin DeterminantFive end LinearDiscriminant div neg /CurveCoefe ED + tx@EcldDict begin DeterminantFive end LinearDiscriminant div neg 2 div /CurveCoefe ED CurveNodeAX CurveNodeAY mul CurveNodeAY dup mul CurveNodeAX CurveNodeAY CurveNodeAX dup mul CurveNodeBX CurveNodeBY mul CurveNodeBY dup mul CurveNodeBX CurveNodeBY CurveNodeBX dup mul CurveNodeCX CurveNodeCY mul CurveNodeCY dup mul CurveNodeCX CurveNodeCY CurveNodeCX dup mul CurveNodeDX CurveNodeDY mul CurveNodeDY dup mul CurveNodeDX CurveNodeDY CurveNodeDX dup mul CurveNodeEX CurveNodeEY mul CurveNodeEY dup mul CurveNodeEX CurveNodeEY CurveNodeEX dup mul tx@EcldDict begin DeterminantFive end LinearDiscriminant div neg /CurveCoeff ED - % the following is same with pstGeneralHyperbolaCoef. - % I1=a+c - CurveCoefa CurveCoefc add /DiscriminantI ED - % I2=b^2-4ac - CurveCoefb dup mul 4 CurveCoefa CurveCoefc mul mul sub /DiscriminantII ED - % I3=1/2|2a b d,b 2c e,d e 2f| - CurveCoefa 2 mul CurveCoefb CurveCoefd - CurveCoefb CurveCoefc 2 mul CurveCoefe - CurveCoefd CurveCoefe CurveCoeff 2 mul - tx@EcldDict begin DeterminantThree end 2 div /DiscriminantIII ED - % DiscriminantI = DiscriminantII = DiscriminantIII = - DiscriminantII 0 gt DiscriminantIII 0 ne and { % if I2>0 and I3!=0 - % Solve the Characteristic Equation: \lambda^2-I_1\lambda-I_2/4=0 - DiscriminantI dup mul DiscriminantII add dup 0 lt { - 0 0 - 0 /MyHyperbolaA ED - 0 /MyHyperbolaB ED - 0 /#9 ED - } { - sqrt dup DiscriminantI exch sub 2 div /CharacteristicLambdaI ED - DiscriminantI add 2 div /CharacteristicLambdaII ED - % CharacteristicLambdaI = CharacteristicLambdaII = - CurveCoefb 0 lt { - DiscriminantIII 0 lt { - DiscriminantIII CharacteristicLambdaI DiscriminantII mul div sqrt /MyHyperbolaA ED - DiscriminantIII CharacteristicLambdaII DiscriminantII mul div neg sqrt /MyHyperbolaB ED - } { - DiscriminantIII CharacteristicLambdaI DiscriminantII mul div neg sqrt /MyHyperbolaB ED - DiscriminantIII CharacteristicLambdaII DiscriminantII mul div sqrt /MyHyperbolaA ED - } ifelse + } ifelse + % CurveCoefa = CurveCoefb = CurveCoefc = CurveCoefd = CurveCoefe = CurveCoeff = + 0 /CurveCoefMax ED 1E8 /CurveCoefMin ED + CurveCoefa abs CurveCoefMax gt {CurveCoefa abs /CurveCoefMax ED} if + CurveCoefb abs CurveCoefMax gt {CurveCoefb abs /CurveCoefMax ED} if + CurveCoefc abs CurveCoefMax gt {CurveCoefc abs /CurveCoefMax ED} if + CurveCoefd abs CurveCoefMax gt {CurveCoefd abs /CurveCoefMax ED} if + CurveCoefe abs CurveCoefMax gt {CurveCoefe abs /CurveCoefMax ED} if + CurveCoeff abs CurveCoefMax gt {CurveCoeff abs /CurveCoefMax ED} if + CurveCoefa abs CurveCoefMin lt {CurveCoefa abs /CurveCoefMin ED} if + CurveCoefb abs CurveCoefMin lt {CurveCoefb abs /CurveCoefMin ED} if + CurveCoefc abs CurveCoefMin lt {CurveCoefc abs /CurveCoefMin ED} if + CurveCoefd abs CurveCoefMin lt {CurveCoefd abs /CurveCoefMin ED} if + CurveCoefe abs CurveCoefMin lt {CurveCoefe abs /CurveCoefMin ED} if + CurveCoeff abs CurveCoefMin lt {CurveCoeff abs /CurveCoefMin ED} if + % CurveCoefMin = CurveCoefMax = + CurveCoefMin CurveCoefMax div 1E-5 lt { + CurveCoefa CurveCoefMax div /CurveCoefa ED + CurveCoefb CurveCoefMax div /CurveCoefb ED + CurveCoefc CurveCoefMax div /CurveCoefc ED + CurveCoefd CurveCoefMax div /CurveCoefd ED + CurveCoefe CurveCoefMax div /CurveCoefe ED + CurveCoeff CurveCoefMax div /CurveCoeff ED + } if + % CurveCoefa = CurveCoefb = CurveCoefc = CurveCoefd = CurveCoefe = CurveCoeff = + CurveCoefa abs 1E-5 lt {0 /CurveCoefa ED} if + CurveCoefb abs 1E-5 lt {0 /CurveCoefb ED} if + CurveCoefc abs 1E-5 lt {0 /CurveCoefc ED} if + CurveCoefd abs 1E-5 lt {0 /CurveCoefd ED} if + CurveCoefe abs 1E-5 lt {0 /CurveCoefe ED} if + CurveCoeff abs 1E-5 lt {0 /CurveCoeff ED} if + % the following is same with pstGeneralHyperbolaCoef. + % CurveCoefa = CurveCoefb = CurveCoefc = CurveCoefd = CurveCoefe = CurveCoeff = + % I1=a+c + CurveCoefa CurveCoefc add /DiscriminantI ED + % I2=ac-b^2 + CurveCoefa CurveCoefc mul CurveCoefb dup mul sub /DiscriminantII ED + % I3=|a b d,b c e,d e f| + CurveCoefa CurveCoefb CurveCoefd + CurveCoefb CurveCoefc CurveCoefe + CurveCoefd CurveCoefe CurveCoeff + tx@EcldDict begin DeterminantThree end /DiscriminantIII ED + % DiscriminantI = DiscriminantII = DiscriminantIII = + DiscriminantII 0 lt DiscriminantIII 0 ne and { % if I2<0 and I3!=0 + % Solve the Characteristic Equation: \lambda^2-I_1\lambda+I_2=0 + DiscriminantI dup mul 4 DiscriminantII mul sub dup 0 lt { + 0 0 + 0 /MyHyperbolaA ED + 0 /MyHyperbolaB ED + 0 /#9 ED + } { + sqrt dup DiscriminantI exch sub 2 div /CharacteristicLambdaI ED + DiscriminantI add 2 div /CharacteristicLambdaII ED + % CharacteristicLambdaI = CharacteristicLambdaII = + % 20200726 Liaoxiongfei + % fix how to get the rotation of the hyperbola real symmetrical axis. + % since we can reduce the hyperbola to + % \lambda_1x^2+\lambda_2y^2+I_3/I_2=0 + % and $I_2\leq0$, so the real symmetrical axis is determined by the characteristic root with the same sign as I3. + % and the slope of real symmetrical axis is $(\lambda_1-a)/b$, or $(c-\lambda_2)/b$, where $\lambda_1*I_3>0$, or they have same sign. + DiscriminantIII CharacteristicLambdaI mul 0 gt { + DiscriminantIII CharacteristicLambdaI DiscriminantII mul div neg sqrt /MyHyperbolaA ED + DiscriminantIII CharacteristicLambdaII DiscriminantII mul div sqrt /MyHyperbolaB ED + CharacteristicLambdaI CurveCoefa lt { + CharacteristicLambdaI CurveCoefa sub neg CurveCoefb neg atan /#9 ED } { - DiscriminantIII 0 lt { - DiscriminantIII CharacteristicLambdaII DiscriminantII mul div neg sqrt /MyHyperbolaB ED - DiscriminantIII CharacteristicLambdaI DiscriminantII mul div sqrt /MyHyperbolaA ED - } { - DiscriminantIII CharacteristicLambdaII DiscriminantII mul div sqrt /MyHyperbolaA ED - DiscriminantIII CharacteristicLambdaI DiscriminantII mul div neg sqrt /MyHyperbolaB ED - } ifelse + CharacteristicLambdaI CurveCoefa sub CurveCoefb atan /#9 ED } ifelse - CurveCoefb abs 1E-5 lt { % b == 0 - CurveCoefa CurveCoefc lt { % a < c - 0 /#9 ED - } { - 90 /#9 ED - } ifelse + } { + DiscriminantIII CharacteristicLambdaII DiscriminantII mul div neg sqrt /MyHyperbolaA ED + DiscriminantIII CharacteristicLambdaI DiscriminantII mul div sqrt /MyHyperbolaB ED + CharacteristicLambdaII CurveCoefa lt { + CharacteristicLambdaII CurveCoefa sub neg CurveCoefb neg atan /#9 ED } { - CurveCoefa CurveCoefc sub abs 1E-5 lt { % a = c - 45 /#9 ED - } { - DiscriminantIII 0 lt { - CurveCoefb 0 lt { - CurveCoefb neg CurveCoefc CurveCoefa sub atan /MyHyperbolaAngDbl ED - MyHyperbolaAngDbl 2 div /#9 ED - } { - CurveCoefb CurveCoefa CurveCoefc sub atan /MyHyperbolaAngDbl ED - MyHyperbolaAngDbl 180 add 2 div /#9 ED - } ifelse - } { - CurveCoefb 0 lt { - CurveCoefb neg CurveCoefc CurveCoefa sub atan /MyHyperbolaAngDbl ED - MyHyperbolaAngDbl 180 add 2 div /#9 ED - } { - CurveCoefb CurveCoefa CurveCoefc sub atan /MyHyperbolaAngDbl ED - MyHyperbolaAngDbl 2 div /#9 ED - } ifelse - } ifelse - } ifelse + CharacteristicLambdaII CurveCoefa sub CurveCoefb atan /#9 ED } ifelse - % MyHyperbolaA = MyHyperbolaB = #9 = (--------------) = - CurveCoefd CurveCoefc mul 2 mul CurveCoefb CurveCoefe mul sub DiscriminantII div % x0 - CurveCoefa CurveCoefe mul 2 mul CurveCoefb CurveCoefd mul sub DiscriminantII div % y0 } ifelse - } { - 0 0 - 0 /MyHyperbolaA ED - 0 /MyHyperbolaB ED - 0 /#9 ED + % MyHyperbolaA = MyHyperbolaB = #9 = (--------------) = + % F_1(x,y)=ax+by+d=0 + % F_2(x,y)=bx+cy+e=0 + CurveCoefb CurveCoefe mul CurveCoefc CurveCoefd mul sub DiscriminantII div % x0 + CurveCoefb CurveCoefd mul CurveCoefa CurveCoefe mul sub DiscriminantII div % y0 } ifelse + } { + 0 0 + 0 /MyHyperbolaA ED + 0 /MyHyperbolaB ED + 0 /#9 ED } ifelse ){#7} \Pst@geonodelabel{#7}% @@ -9982,11 +10121,11 @@ \endgroup% }% % -% 10. General Inversion Hyperbola with coordinate translation and rotation +% 10. General Conjugate 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$, +%% The General Conjugate 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}, +%% The equation can be got from the parametric function of the Standard Conjugate Hyperbola \ref{ParametricFunctionOfStandardConjugateHyperbola}, %% using the rotation transform formula \ref{RotationTransformFormula}, then we have %% \begin{equation} %% \left\{\begin{array}{l} @@ -9995,8 +10134,8 @@ %% \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} +%% So we get the parametric function of the General Conjugate Hyperbola with coordinate translation and rotation as following: +%% \begin{equation}\label{ParametricFunctionOfGeneralConjugateHyperbola} %% \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 @@ -10004,7 +10143,7 @@ %% \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)$, +%% Draw a General Conjugate 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 @@ -10067,7 +10206,7 @@ }% % %% \pstGeneralIHyperbolaNode[Options](O)(a,b)[rotation]{t}{A} -%% Draw a node whose parameter value is the given value t on the General Inversion Hyperbola. +%% Draw a node whose parameter value is the given value t on the General Conjugate Hyperbola. %% Parameters: %% #1 -> options %% #2 -> [input] the hyperbola center O @@ -10105,7 +10244,7 @@ }% % %% \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. +%% Draw the nodes whose abscissa value are the given value x_1 on the General Conjugate 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$$ @@ -10215,7 +10354,7 @@ }% % %% \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. +%% Draw the nodes whose ordinate value are the given value y_1 on the General Conjugate 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$$ @@ -10325,7 +10464,7 @@ }% % %% \pstGeneralIHyperbolaFocusNode[Options](O)(a,b)[rotation]{F1}{F2} -%% Draw the focus nodes of the General Inversion Hyperbola H. +%% Draw the focus nodes of the General Conjugate Hyperbola H. %% If you not input the rotation angle, the default value is $0^\circ$. %% Parameters: %% #1 -> options @@ -10367,7 +10506,7 @@ }% % %% \pstGeneralIHyperbolaVertexNode[Options](O)(a,b)[rotation]{V1}{V2} -%% Draw the vertex nodes of the General Inversion Hyperbola H. +%% Draw the vertex nodes of the General Conjugate Hyperbola H. %% If you not input the rotation angle, the default value is $0^\circ$. %% Parameters: %% #1 -> options @@ -10407,7 +10546,7 @@ }% % %% \pstGeneralIHyperbolaDirectrixLine[Options](O)(a,b)[rotation]{Lx}{Ly}{Rx}{Ry} -%% Draw the two directrix lines of the General Inversion Hyperbola H. +%% Draw the two directrix lines of the General Conjugate Hyperbola H. %% If you not input the rotation angle, the default value is $0^\circ$. %% Parameters: %% #1 -> options @@ -10481,7 +10620,7 @@ }% % %% \pstGeneralIHyperbolaAsymptoteLine[Options](O)(a,b)[rotation]{L1}{L2} -%% Draw the two asymptote lines L1 and L2 of the General Inversion Hyperbola H. +%% Draw the two asymptote lines L1 and L2 of the General Conjugate Hyperbola H. %% Parameters: %% #1 -> options %% #2 -> [input] the hyperbola center O @@ -10532,7 +10671,7 @@ % % %% \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. +%% Find the intersection nodes $C$ and $D$ of the given line AB with the General Conjugate 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$$ @@ -10742,7 +10881,7 @@ }% % %% \pstGeneralIHyperbolaPolarNode[Options](O)(a,b)[rotation]{A}{B}{T} -%% Find the polar point of chord AB on General Inversion Hyperbola H. +%% Find the polar point of chord AB on General Conjugate 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: @@ -10772,7 +10911,7 @@ }% % %% \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. +%% Draw the two tangent lines through the point $T$ to the General Conjugate Hyperbola H and get the node A and B on the General Conjugate 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$. @@ -10807,6 +10946,968 @@ \endgroup% }% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% 11. General Conic Equation ax^2+bxy+cy^2+dx+ey+f=0 +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +%% \pstGeneralConicEquation[Options]{A}{B}{C}{D}{E}{a,b,c,d,e,f} +%% Calculate the quadratic curve equation $ax^2+bxy+cy^2+dx+ey+f=0$ which through five different points A,B,C,D,E. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the given point A. +%% #3 -> [input] the given point B. +%% #4 -> [input] the given point C. +%% #5 -> [input] the given point D. +%% #6 -> [input] the given point E. +%% #7 -> [output] the output coefficents name a,b,c,d,e,f of quadratic equation. +\def\pstGeneralConicEquation{\@ifnextchar[\Pst@GeneralConicEquation{\Pst@GeneralConicEquation[]}} +\def\Pst@GeneralConicEquation[#1]#2#3#4#5#6#7{ + \begingroup + \psset{#1}% + \pst@getcoor{#2}\pst@CurveNodeA% + \pst@getcoor{#3}\pst@CurveNodeB% + \pst@getcoor{#4}\pst@CurveNodeC% + \pst@getcoor{#5}\pst@CurveNodeD% + \pst@getcoor{#6}\pst@CurveNodeE% + \pstParseArg{OutCurveCoef}{a,b,c,d,e,f}{#7} + \pnode(! + \pst@CurveNodeA \tx@UserCoor /CurveNodeAY ED /CurveNodeAX ED + \pst@CurveNodeB \tx@UserCoor /CurveNodeBY ED /CurveNodeBX ED + \pst@CurveNodeC \tx@UserCoor /CurveNodeCY ED /CurveNodeCX ED + \pst@CurveNodeD \tx@UserCoor /CurveNodeDY ED /CurveNodeDX ED + \pst@CurveNodeE \tx@UserCoor /CurveNodeEY ED /CurveNodeEX ED + %% + % ax^2+bxy+cy^2+dx+ey+f=0, we can use A,B,C,D,E to solve b,c,d,e,f, we have + % AxAy b + Ay^2 c + Ax d + Ay e + 1 f = -Ax^2a + % BxBy b + By^2 c + Bx d + By e + 1 f = -Bx^2a + % CxCy b + Cy^2 c + Cx d + Cy e + 1 f = -Cx^2a + % DxDy b + Dy^2 c + Dx d + Dy e + 1 f = -Dx^2a + % ExEy b + Ey^2 c + Ex d + Ey e + 1 f = -Ex^2a + % by Cramer's Rule, we have + % |Ax^2a Ay^2 Ax Ay 1| |AxAy Ay^2 Ax Ay 1| + % |Bx^2a By^2 Bx By 1| |BxBy By^2 Bx By 1| + % b=-|Cx^2a Cy^2 Cx Cy 1|/|CxCy Cy^2 Cx Cy 1| etc. + % |Dx^2a Dy^2 Dx Dy 1| |DxDy Dy^2 Dx Dy 1| + % |Ex^2a Ey^2 Ex Ey 1| |ExEy Ey^2 Ex Ey 1| + % if the denominator is zero, we can choose a = 0, else a = 1. + CurveNodeAX CurveNodeAY mul CurveNodeAY dup mul CurveNodeAX CurveNodeAY 1 + CurveNodeBX CurveNodeBY mul CurveNodeBY dup mul CurveNodeBX CurveNodeBY 1 + CurveNodeCX CurveNodeCY mul CurveNodeCY dup mul CurveNodeCX CurveNodeCY 1 + CurveNodeDX CurveNodeDY mul CurveNodeDY dup mul CurveNodeDX CurveNodeDY 1 + CurveNodeEX CurveNodeEY mul CurveNodeEY dup mul CurveNodeEX CurveNodeEY 1 + tx@EcldDict begin DeterminantFive end /LinearDiscriminant ED + LinearDiscriminant abs 1E-5 lt { % D=0 + 0 /CurveCoefa ED + % Ay^2 c + Ax d + Ay e + 1 f = -AxAyb + % By^2 c + Bx d + By e + 1 f = -BxByb + % Cy^2 c + Cx d + Cy e + 1 f = -CxCyb + % Dy^2 c + Dx d + Dy e + 1 f = -DxDyb + % by Cramer's Rule, we have + % |AxAyb Ax Ay 1| |Ay^2 Ax Ay 1| + % |BxByb Bx By 1| |By^2 Bx By 1| + % c=-|CxCyb Cx Cy 1|/|Cy^2 Cx Cy 1| etc. + % |DxDyb Dx Dy 1| |Dy^2 Dx Dy 1| + CurveNodeAY dup mul CurveNodeAX CurveNodeAY 1 + CurveNodeBY dup mul CurveNodeBX CurveNodeBY 1 + CurveNodeCY dup mul CurveNodeCX CurveNodeCY 1 + CurveNodeDY dup mul CurveNodeDX CurveNodeDY 1 + tx@EcldDict begin DeterminantFour end /LinearDiscriminant2nd ED + LinearDiscriminant2nd abs 1E-5 lt { % D2=0 + 0 /CurveCoefb ED + % Ax d + Ay e + 1 f = -Ay^2c + % Bx d + By e + 1 f = -By^2c + % Cx d + Cy e + 1 f = -Cy^2c + % by Cramer's Rule, we have + % d=-|Ay^2c Ay 1| |Ax Ay 1| + % |By^2c By 1| |Bx By 1| + % |Cy^2c Cy 1|/|Cx Cy 1| etc. + CurveNodeAX CurveNodeAY 1 + CurveNodeBX CurveNodeBY 1 + CurveNodeCX CurveNodeCY 1 + tx@EcldDict begin DeterminantThree end /LinearDiscriminant3rd ED + LinearDiscriminant3rd abs 1E-5 lt { % D3=0 + 0 /CurveCoefc ED + % Ay e + 1 f = -Axd + % By e + 1 f = -Bxd + CurveNodeAY 1 + CurveNodeBY 1 + tx@EcldDict begin DeterminantTwo end /LinearDiscriminant4th ED + LinearDiscriminant4th abs 1E-5 lt { % D4=0 + 0 /CurveCoefd ED + 1 /CurveCoefe ED + CurveNodeAY neg /CurveCoeff ED + } { + 1 /CurveCoefd ED + CurveNodeAX 1 + CurveNodeBX 1 + tx@EcldDict begin DeterminantTwo end LinearDiscriminant4th div neg /CurveCoefe ED + CurveNodeAY CurveNodeAX + CurveNodeBY CurveNodeBX + tx@EcldDict begin DeterminantTwo end LinearDiscriminant4th div neg /CurveCoeff ED + } ifelse + } { + 1 /CurveCoefc ED + CurveNodeAY dup mul CurveNodeAY 1 + CurveNodeBY dup mul CurveNodeBY 1 + CurveNodeCY dup mul CurveNodeCY 1 + tx@EcldDict begin DeterminantThree end LinearDiscriminant3rd div neg /CurveCoefd ED + CurveNodeAX CurveNodeAY dup mul 1 + CurveNodeBX CurveNodeBY dup mul 1 + CurveNodeCX CurveNodeCY dup mul 1 + tx@EcldDict begin DeterminantThree end LinearDiscriminant3rd div neg /CurveCoefe ED + CurveNodeAX CurveNodeAY CurveNodeAY dup mul + CurveNodeBX CurveNodeBY CurveNodeBY dup mul + CurveNodeCX CurveNodeCY CurveNodeCY dup mul + tx@EcldDict begin DeterminantThree end LinearDiscriminant3rd div neg /CurveCoeff ED + } ifelse + } { + 1 /CurveCoefb ED + CurveNodeAX CurveNodeAY mul CurveNodeAX CurveNodeAY 1 + CurveNodeBX CurveNodeBY mul CurveNodeBX CurveNodeBY 1 + CurveNodeCX CurveNodeCY mul CurveNodeCX CurveNodeCY 1 + CurveNodeDX CurveNodeDY mul CurveNodeDX CurveNodeDY 1 + tx@EcldDict begin DeterminantFour end LinearDiscriminant2nd div neg /CurveCoefc ED + CurveNodeAY dup mul CurveNodeAX CurveNodeAY mul CurveNodeAY 1 + CurveNodeBY dup mul CurveNodeBX CurveNodeBY mul CurveNodeBY 1 + CurveNodeCY dup mul CurveNodeCX CurveNodeCY mul CurveNodeCY 1 + CurveNodeDY dup mul CurveNodeDX CurveNodeDY mul CurveNodeDY 1 + tx@EcldDict begin DeterminantFour end LinearDiscriminant2nd div neg /CurveCoefd ED + CurveNodeAY dup mul CurveNodeAX CurveNodeAX CurveNodeAY mul 1 + CurveNodeBY dup mul CurveNodeBX CurveNodeBX CurveNodeBY mul 1 + CurveNodeCY dup mul CurveNodeCX CurveNodeCX CurveNodeCY mul 1 + CurveNodeDY dup mul CurveNodeDX CurveNodeDX CurveNodeDY mul 1 + tx@EcldDict begin DeterminantFour end LinearDiscriminant2nd div neg /CurveCoefe ED + CurveNodeAY dup mul CurveNodeAX CurveNodeAY CurveNodeAX CurveNodeAY mul + CurveNodeBY dup mul CurveNodeBX CurveNodeBY CurveNodeBX CurveNodeBY mul + CurveNodeCY dup mul CurveNodeCX CurveNodeCY CurveNodeCX CurveNodeCY mul + CurveNodeDY dup mul CurveNodeDX CurveNodeDY CurveNodeDX CurveNodeDY mul + tx@EcldDict begin DeterminantFour end LinearDiscriminant2nd div neg /CurveCoeff ED + } ifelse + } { + 1 /CurveCoefa ED + CurveNodeAX dup mul CurveNodeAY dup mul CurveNodeAX CurveNodeAY 1 + CurveNodeBX dup mul CurveNodeBY dup mul CurveNodeBX CurveNodeBY 1 + CurveNodeCX dup mul CurveNodeCY dup mul CurveNodeCX CurveNodeCY 1 + CurveNodeDX dup mul CurveNodeDY dup mul CurveNodeDX CurveNodeDY 1 + CurveNodeEX dup mul CurveNodeEY dup mul CurveNodeEX CurveNodeEY 1 + tx@EcldDict begin DeterminantFive end LinearDiscriminant div neg /CurveCoefb ED + CurveNodeAX CurveNodeAY mul CurveNodeAX dup mul CurveNodeAX CurveNodeAY 1 + CurveNodeBX CurveNodeBY mul CurveNodeBX dup mul CurveNodeBX CurveNodeBY 1 + CurveNodeCX CurveNodeCY mul CurveNodeCX dup mul CurveNodeCX CurveNodeCY 1 + CurveNodeDX CurveNodeDY mul CurveNodeDX dup mul CurveNodeDX CurveNodeDY 1 + CurveNodeEX CurveNodeEY mul CurveNodeEX dup mul CurveNodeEX CurveNodeEY 1 + tx@EcldDict begin DeterminantFive end LinearDiscriminant div neg /CurveCoefc ED + CurveNodeAX CurveNodeAY mul CurveNodeAY dup mul CurveNodeAX dup mul CurveNodeAY 1 + CurveNodeBX CurveNodeBY mul CurveNodeBY dup mul CurveNodeBX dup mul CurveNodeBY 1 + CurveNodeCX CurveNodeCY mul CurveNodeCY dup mul CurveNodeCX dup mul CurveNodeCY 1 + CurveNodeDX CurveNodeDY mul CurveNodeDY dup mul CurveNodeDX dup mul CurveNodeDY 1 + CurveNodeEX CurveNodeEY mul CurveNodeEY dup mul CurveNodeEX dup mul CurveNodeEY 1 + tx@EcldDict begin DeterminantFive end LinearDiscriminant div neg /CurveCoefd ED + CurveNodeAX CurveNodeAY mul CurveNodeAY dup mul CurveNodeAX CurveNodeAX dup mul 1 + CurveNodeBX CurveNodeBY mul CurveNodeBY dup mul CurveNodeBX CurveNodeBX dup mul 1 + CurveNodeCX CurveNodeCY mul CurveNodeCY dup mul CurveNodeCX CurveNodeCX dup mul 1 + CurveNodeDX CurveNodeDY mul CurveNodeDY dup mul CurveNodeDX CurveNodeDX dup mul 1 + CurveNodeEX CurveNodeEY mul CurveNodeEY dup mul CurveNodeEX CurveNodeEX dup mul 1 + tx@EcldDict begin DeterminantFive end LinearDiscriminant div neg /CurveCoefe ED + CurveNodeAX CurveNodeAY mul CurveNodeAY dup mul CurveNodeAX CurveNodeAY CurveNodeAX dup mul + CurveNodeBX CurveNodeBY mul CurveNodeBY dup mul CurveNodeBX CurveNodeBY CurveNodeBX dup mul + CurveNodeCX CurveNodeCY mul CurveNodeCY dup mul CurveNodeCX CurveNodeCY CurveNodeCX dup mul + CurveNodeDX CurveNodeDY mul CurveNodeDY dup mul CurveNodeDX CurveNodeDY CurveNodeDX dup mul + CurveNodeEX CurveNodeEY mul CurveNodeEY dup mul CurveNodeEX CurveNodeEY CurveNodeEX dup mul + tx@EcldDict begin DeterminantFive end LinearDiscriminant div neg /CurveCoeff ED + } ifelse + % CurveCoefa = CurveCoefb = CurveCoefc = CurveCoefd = CurveCoefe = CurveCoeff = + 0 /CurveCoefMax ED 1E8 /CurveCoefMin ED + CurveCoefa abs CurveCoefMax gt {CurveCoefa abs /CurveCoefMax ED} if + CurveCoefb abs CurveCoefMax gt {CurveCoefb abs /CurveCoefMax ED} if + CurveCoefc abs CurveCoefMax gt {CurveCoefc abs /CurveCoefMax ED} if + CurveCoefd abs CurveCoefMax gt {CurveCoefd abs /CurveCoefMax ED} if + CurveCoefe abs CurveCoefMax gt {CurveCoefe abs /CurveCoefMax ED} if + CurveCoeff abs CurveCoefMax gt {CurveCoeff abs /CurveCoefMax ED} if + CurveCoefa abs CurveCoefMin lt {CurveCoefa abs /CurveCoefMin ED} if + CurveCoefb abs CurveCoefMin lt {CurveCoefb abs /CurveCoefMin ED} if + CurveCoefc abs CurveCoefMin lt {CurveCoefc abs /CurveCoefMin ED} if + CurveCoefd abs CurveCoefMin lt {CurveCoefd abs /CurveCoefMin ED} if + CurveCoefe abs CurveCoefMin lt {CurveCoefe abs /CurveCoefMin ED} if + CurveCoeff abs CurveCoefMin lt {CurveCoeff abs /CurveCoefMin ED} if + % CurveCoefMin = CurveCoefMax = + CurveCoefMin CurveCoefMax div 1E-5 lt { + CurveCoefa CurveCoefMax div /CurveCoefa ED + CurveCoefb CurveCoefMax div /CurveCoefb ED + CurveCoefc CurveCoefMax div /CurveCoefc ED + CurveCoefd CurveCoefMax div /CurveCoefd ED + CurveCoefe CurveCoefMax div /CurveCoefe ED + CurveCoeff CurveCoefMax div /CurveCoeff ED + } if + % CurveCoefa = CurveCoefb = CurveCoefc = CurveCoefd = CurveCoefe = CurveCoeff = + CurveCoefa abs 1E-5 lt {0 /CurveCoefa ED} if + CurveCoefb abs 1E-5 lt {0 /CurveCoefb ED} if + CurveCoefc abs 1E-5 lt {0 /CurveCoefc ED} if + CurveCoefd abs 1E-5 lt {0 /CurveCoefd ED} if + CurveCoefe abs 1E-5 lt {0 /CurveCoefe ED} if + CurveCoeff abs 1E-5 lt {0 /CurveCoeff ED} if + % CurveCoefa = CurveCoefb = CurveCoefc = CurveCoefd = CurveCoefe = CurveCoeff = + CurveCoefa /\OutCurveCoefa\space ED + CurveCoefb /\OutCurveCoefb\space ED + CurveCoefc /\OutCurveCoefc\space ED + CurveCoefd /\OutCurveCoefd\space ED + CurveCoefe /\OutCurveCoefe\space ED + CurveCoeff /\OutCurveCoeff\space ED + \ifPst@CodeFig + [\OutCurveCoefa\space \OutCurveCoefb\space \OutCurveCoefc\space \OutCurveCoefd\space \OutCurveCoefe\space \OutCurveCoeff\space] == + \fi + 0 0 + ){@Pst@GeneralConicEquationDummyNode} + \endgroup% +}% +% +%% \pstGeneralEllipseEquation[Options](O)(a,b)[rotation]{a,b,c,d,e,f} +%% Calculate the quadratic curve equation $ax^2+bxy+cy^2+dx+ey+f=0$ for the given general ellipse. +%% 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 output coefficents name a,b,c,d,e,f of quadratic equation. +\def\pstGeneralEllipseEquation{\@ifnextchar[\Pst@GeneralEllipseEquation{\Pst@GeneralEllipseEquation[]}} +\def\Pst@GeneralEllipseEquation[#1](#2)(#3){% + \begingroup + \psset{#1}% + \def\PST@EllipseCenter{#2}% + \def\PST@EllipseRadii{#3}% + \@ifnextchar[\Pst@GeneralEllipseEquation@i{\Pst@GeneralEllipseEquation@i[0]}}% +\def\Pst@GeneralEllipseEquation@i[#1]#2{% + \pstGeneralEllipseNode[PointName=none,PointSymbol=none](\PST@EllipseCenter)(\PST@EllipseRadii)[#1]{0}{@PST@EllipseTmpNodeA} + \pstGeneralEllipseNode[PointName=none,PointSymbol=none](\PST@EllipseCenter)(\PST@EllipseRadii)[#1]{90}{@PST@EllipseTmpNodeB} + \pstGeneralEllipseNode[PointName=none,PointSymbol=none](\PST@EllipseCenter)(\PST@EllipseRadii)[#1]{180}{@PST@EllipseTmpNodeC} + \pstGeneralEllipseNode[PointName=none,PointSymbol=none](\PST@EllipseCenter)(\PST@EllipseRadii)[#1]{270}{@PST@EllipseTmpNodeD} + \pstGeneralEllipseNode[PointName=none,PointSymbol=none](\PST@EllipseCenter)(\PST@EllipseRadii)[#1]{45}{@PST@EllipseTmpNodeE} + \pstGeneralConicEquation{@PST@EllipseTmpNodeA}{@PST@EllipseTmpNodeB}{@PST@EllipseTmpNodeC}{@PST@EllipseTmpNodeD}{@PST@EllipseTmpNodeE}{#2} + \endgroup% +}% +% +%% \pstGeneralHyperbolaEquation[Options](O)(a,b)[rotation]{a,b,c,d,e,f} +%% Calculate the quadratic curve equation $ax^2+bxy+cy^2+dx+ey+f=0$ for the given general hyperbola. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the hyperbola vertex O +%% #3 -> [input] the radii of real and imaginary axis +%% #4 -> [input] the rotation angle $\theta$ of the symmetrical axis. +%% #5 -> [output] the output coefficents name a,b,c,d,e,f of quadratic equation. +\def\pstGeneralHyperbolaEquation{\@ifnextchar[\Pst@GeneralHyperbolaEquation{\Pst@GeneralHyperbolaEquation[]}} +\def\Pst@GeneralHyperbolaEquation[#1](#2)(#3){% + \begingroup + \psset{#1}% + \def\PST@HyperbolaCenter{#2}% + \def\PST@HyperbolaRadii{#3}% + \@ifnextchar[\Pst@GeneralHyperbolaEquation@i{\Pst@GeneralHyperbolaEquation@i[0]}}% +\def\Pst@GeneralHyperbolaEquation@i[#1]#2{% + \pstGeneralHyperbolaVertexNode[PointName=none,PointSymbol=none](\PST@HyperbolaCenter)(\PST@HyperbolaRadii)[#1]{@PST@HyperbolaTmpNodeA}{@PST@HyperbolaTmpNodeB} + \pstGeneralHyperbolaNode[PointName=none,PointSymbol=none](\PST@HyperbolaCenter)(\PST@HyperbolaRadii)[#1]{10}{@PST@HyperbolaTmpNodeC} + \pstGeneralHyperbolaNode[PointName=none,PointSymbol=none](\PST@HyperbolaCenter)(\PST@HyperbolaRadii)[#1]{-10}{@PST@HyperbolaTmpNodeD} + \pstGeneralHyperbolaNode[PointName=none,PointSymbol=none](\PST@HyperbolaCenter)(\PST@HyperbolaRadii)[#1]{100}{@PST@HyperbolaTmpNodeE} + \pstGeneralConicEquation{@PST@HyperbolaTmpNodeA}{@PST@HyperbolaTmpNodeB}{@PST@HyperbolaTmpNodeC}{@PST@HyperbolaTmpNodeD}{@PST@HyperbolaTmpNodeE}{#2} + \endgroup% +}% +% +%% \pstGeneralParabolaEquation[Options](O){p}[rotation]{a,b,c,d,e,f} +%% Calculate the quadratic curve equation $ax^2+bxy+cy^2+dx+ey+f=0$ for the given general Parabola. +%% 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 output coefficents name a,b,c,d,e,f of quadratic equation. +\def\pstGeneralParabolaEquation{\@ifnextchar[\Pst@GeneralParabolaEquation{\Pst@GeneralParabolaEquation[]}} +\def\Pst@GeneralParabolaEquation[#1](#2)#3{% + \begingroup + \psset{#1}% + \def\PST@ParabolaVertex{#2}% + \def\PST@ParabolaSemiFocalChord{#3}% + \@ifnextchar[\Pst@GeneralParabolaEquation@i{\Pst@GeneralParabolaEquation@i[0]}}% +\def\Pst@GeneralParabolaEquation@i[#1]#2{% + \pstGeneralParabolaNode[PointName=none,PointSymbol=none](\PST@ParabolaVertex){\PST@ParabolaSemiFocalChord}[#1]{0}{@PST@ParabolaTmpNodeA} + \pstGeneralParabolaNode[PointName=none,PointSymbol=none](\PST@ParabolaVertex){\PST@ParabolaSemiFocalChord}[#1]{90}{@PST@ParabolaTmpNodeB} + \pstGeneralParabolaNode[PointName=none,PointSymbol=none](\PST@ParabolaVertex){\PST@ParabolaSemiFocalChord}[#1]{180}{@PST@ParabolaTmpNodeC} + \pstGeneralParabolaNode[PointName=none,PointSymbol=none](\PST@ParabolaVertex){\PST@ParabolaSemiFocalChord}[#1]{270}{@PST@ParabolaTmpNodeD} + \pstGeneralParabolaNode[PointName=none,PointSymbol=none](\PST@ParabolaVertex){\PST@ParabolaSemiFocalChord}[#1]{45}{@PST@ParabolaTmpNodeE} + \pstGeneralConicEquation{@PST@ParabolaTmpNodeA}{@PST@ParabolaTmpNodeB}{@PST@ParabolaTmpNodeC}{@PST@ParabolaTmpNodeD}{@PST@ParabolaTmpNodeE}{#2} + \endgroup% +}% +% +%% \pstGeneralConicLineInter[Options]{A}{B}{a,b,c,d,e,f}{C}{D} +%% Get the two intersections $C$ and $D$ of the General Conic $ax^2+bxy+cy^2+dx+ey+f=0$ with the given line $AB$. +% +%% Parameters: +%% #1 -> options +%% #2 -> [input] the node name A on the given line +%% #3 -> [input] the node name B on the given line +%% #4 -> [input] the coefficents of the quadratic curve equation, with six numbers $a,b,c,d,e,f$ joined with comma. +%% #5 -> [output] the first intersection node name +%% #6 -> [output] the second intersection node name +\def\pstGeneralConicLineInter{\@ifnextchar[\Pst@GeneralConicLineInter{\Pst@GeneralConicLineInter[]}} +\def\Pst@GeneralConicLineInter[#1]#2#3#4#5#6{% + \begingroup + \@InitListMng % + \psset{#1}% + \pst@getcoor{#2}\pst@tempA% + \pst@getcoor{#3}\pst@tempB% + \pstParseArg{CurveCoef}{a,b,c,d,e,f}{#4} + \pnode(! + % Conic ax^2+bxy+cy^2+dx+ey+f=0 + \CurveCoefa /Ca ED + \CurveCoefb /Cb ED + \CurveCoefc /Cc ED + \CurveCoefd /Cd ED + \CurveCoefe /Ce ED + \CurveCoeff /Cf ED + % Line ax+by+c=0 + \pst@tempA \tx@UserCoor /Ay ED /Ax ED + \pst@tempB \tx@UserCoor /By ED /Bx ED + By Ay sub /La ED + Ax Bx sub /Lb ED + Ay Bx mul Ax By mul sub /Lc ED + La abs 1E-5 lt { % La==0 + Lb abs 1E-5 lt { % Lb==0 + 0 0 + 0 /Dx ED 0 /Dy ED + } { + % Quadratic equation ax^2+bx+c=0 + Ca Lb mul /Qa ED % Qa = Ca.Lb + Cd Lb mul Cb Lc mul sub /Qb ED % Qb = Cd.Lb-Cb.Lc + Cf Lb mul Ce Lc mul sub Cc Lc mul Lc mul Lb div add /Qc ED % Qc = Cf.Lb-Ce.Lc+Cc.Lc.Lc/Lb + Qa abs 1E-5 lt { % Qa==0 + Qb abs 1E-5 lt { % Qb==0 + 0 0 + 0 /Dx ED 0 /Dy ED + } { + Qc Qb div neg % Cx + Lc Lb div neg % Cy + 0 /Dx ED 0 /Dy ED + } ifelse + } { + Qb dup mul Qa Qc mul 4 mul sub dup 0 lt { % Delta < 0 + 0 0 + 0 /Dx ED 0 /Dy ED + } { + sqrt dup Qb neg add Qa 2 mul div /Dx ED + Lc Lb div neg /Dy ED + Qb neg exch sub Qa 2 mul div % Cx + Lc Lb div neg % Cy + } ifelse + } ifelse + } ifelse + } { + % Quadratic equation ay^2+by+c=0 + Ca Lb mul Lb mul La div Cc La mul add Cb Lb mul sub /Qa ED % Qa = Ca.Lb.Lb/La+Cc.La-Cb.Lb + Ca Lb mul Lc mul 2 mul La div Ce La mul add Cb Lc mul sub Cd Lb mul sub /Qb ED % Qb = 2.Ca.Lb.Lc/La+Ce.La-Cb.Lc-Cd.Lb + Ca Lc mul Lc mul La div Cf La mul add Cd Lc mul sub /Qc ED % Qc = Ca.Lc.Lc/La+Cf.La-Cd.LC + % Ca = Cb = Cc = Cd = Ce = Cf = + % La = Lb = Lc = Qa = Qb = Qc = + Qa abs 1E-5 lt { % Qa==0 + Qb abs 1E-5 lt { % Qb==0 + 0 0 + 0 /Dx ED 0 /Dy ED + } { + Qc Qb div neg % Cy + dup Lb mul Lc add La div neg % Cx + exch % Cx Cy + 0 /Dx ED 0 /Dy ED + } ifelse + } { + Qb dup mul Qa Qc mul 4 mul sub dup 0 lt { % Delta < 0 + 0 0 + 0 /Dx ED 0 /Dy ED + } { + sqrt dup Qb neg add Qa 2 mul div /Dy ED + Dy Lb mul Lc add La div neg /Dx ED + Qb neg exch sub Qa 2 mul div % Cy + dup Lb mul Lc add La div neg % Cx + exch % Cx Cy + } ifelse + } ifelse + } ifelse + ){#5} + \pnode(! Dx Dy){#6} + \Pst@ManageParamList{#5}% + \Pst@ManageParamList{#6}% + \endgroup% +}% +% +%% \pstGeneralConicCircleInter[Options]{O}{A}{a,b,c,d,e,f}{C}{D}{E}{F} +%% Get the most four intersections $C$, $D$, $E$ and $F$ of the General Conic $ax^2+bxy+cy^2+dx+ey+f=0$ and the given circle $O$ with radius $OA$. +% +%% Parameters: +%% #1 -> options +%% #2 -> [input] the center O of the given circle +%% #3 -> [input] the node A on the given circle +%% #4 -> [input] the coefficents of the quadratic curve equation, with six numbers $a,b,c,d,e,f$ joined with comma. +%% #5 -> [output] the first intersection node name +%% #6 -> [output] the second intersection node name +%% #7 -> [output] the third intersection node name +%% #8 -> [output] the fourth intersection node name +\def\pstGeneralConicCircleInter{\@ifnextchar[\Pst@GeneralConicCircleInter{\Pst@GeneralConicCircleInter[]}} +\def\Pst@GeneralConicCircleInter[#1]#2#3#4#5#6#7#8{% + \begingroup + \@InitListMng % + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pst@getcoor{#3}\pst@tempA% + \pstParseArg{CurveCoef}{a,b,c,d,e,f}{#4} + \pnode(! + % Conic ax^2+bxy+cy^2+dx+ey+f=0 + \CurveCoefa /Ca ED + \CurveCoefb /Cb ED + \CurveCoefc /Cc ED + \CurveCoefd /Cd ED + \CurveCoefe /Ce ED + \CurveCoeff /Cf ED + % Circle + \pst@tempO \tx@UserCoor /Oy ED /Ox ED + \pst@tempA \tx@UserCoor /Ay ED /Ax ED + /Rc Ax Ox sub dup mul Ay Oy sub dup mul add sqrt def + tx@EcldDict begin Ca Cb Cc Cd Ce Cf Ox Oy Rc ConicCircleInter end + /nInters ED /Inters ED + nInters 0 gt { + /XYPair Inters 0 get def + XYPair 0 get XYPair 1 get + } { + 0 0 + } ifelse + /Dx 0 def /Dy 0 def + /Ex 0 def /Ey 0 def + /Fx 0 def /Fy 0 def + nInters 1 gt { + /XYPair Inters 1 get def + /Dx XYPair 0 get def + /Dy XYPair 1 get def + } if + nInters 2 gt { + /XYPair Inters 2 get def + /Ex XYPair 0 get def + /Ey XYPair 1 get def + } if + nInters 3 gt { + /XYPair Inters 3 get def + /Fx XYPair 0 get def + /Fy XYPair 1 get def + } if + ){#5} + \pnode(! Dx Dy){#6} + \pnode(! Ex Ey){#7} + \pnode(! Fx Fy){#8} + \Pst@ManageParamList{#5}% + \Pst@ManageParamList{#6}% + \Pst@ManageParamList{#7}% + \Pst@ManageParamList{#8}% + \endgroup% +}% +% +%% \pstGeneralConicEllipseInter[Options](O)(m,n){a,b,c,d,e,f}{C}{D}{E}{F} +%% Get the most four intersections $C$, $D$, $E$ and $F$ of the General Conic $ax^2+bxy+cy^2+dx+ey+f=0$ and the given ellipse $(x-O_x)^2/m^2+(y-O_y)^2/n^2=1$. +% +%% Parameters: +%% #1 -> options +%% #2 -> [input] the center O of the given ellipse +%% #3 -> [input] the radius (m,n) of the given ellipse +%% #4 -> [input] the coefficents of the quadratic curve equation, with six numbers $a,b,c,d,e,f$ joined with comma. +%% #5 -> [output] the first intersection node name +%% #6 -> [output] the second intersection node name +%% #7 -> [output] the third intersection node name +%% #8 -> [output] the fourth intersection node name +\def\pstGeneralConicEllipseInter{\@ifnextchar[\Pst@GeneralConicEllipseInter{\Pst@GeneralConicEllipseInter[]}} +\def\Pst@GeneralConicEllipseInter[#1](#2)(#3)#4#5#6#7#8{% + \begingroup + \@InitListMng % + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pst@getcoor{#3}\pst@tempR% + \pstParseArg{CurveCoef}{a,b,c,d,e,f}{#4} + \pnode(! + % Conic ax^2+bxy+cy^2+dx+ey+f=0 + \CurveCoefa /Ca ED + \CurveCoefb /Cb ED + \CurveCoefc /Cc ED + \CurveCoefd /Cd ED + \CurveCoefe /Ce ED + \CurveCoeff /Cf ED + % Ellipse + \pst@tempO \tx@UserCoor /Oy ED /Ox ED + \pst@tempR \tx@UserCoor /Ry ED /Rx ED + tx@EcldDict begin Ca Cb Cc Cd Ce Cf Ox Oy Rx Ry ConicEllipseInter end + /nInters ED /Inters ED + nInters 0 gt { + /XYPair Inters 0 get def + XYPair 0 get XYPair 1 get + } { + 0 0 + } ifelse + /Dx 0 def /Dy 0 def + /Ex 0 def /Ey 0 def + /Fx 0 def /Fy 0 def + nInters 1 gt { + /XYPair Inters 1 get def + /Dx XYPair 0 get def + /Dy XYPair 1 get def + } if + nInters 2 gt { + /XYPair Inters 2 get def + /Ex XYPair 0 get def + /Ey XYPair 1 get def + } if + nInters 3 gt { + /XYPair Inters 3 get def + /Fx XYPair 0 get def + /Fy XYPair 1 get def + } if + ){#5} + \pnode(! Dx Dy){#6} + \pnode(! Ex Ey){#7} + \pnode(! Fx Fy){#8} + \Pst@ManageParamList{#5}% + \Pst@ManageParamList{#6}% + \Pst@ManageParamList{#7}% + \Pst@ManageParamList{#8}% + \endgroup% +}% +% +%% \pstGeneralConicHyperbolaInter[Options](O)(m,n){a,b,c,d,e,f}{C}{D}{E}{F} +%% Get the most four intersections $C$, $D$, $E$ and $F$ of the General Conic $ax^2+bxy+cy^2+dx+ey+f=0$ and the given hyperbola $(x-O_x)^2/m^2-(y-O_y)^2/n^2=1$. +% +%% Parameters: +%% #1 -> options +%% #2 -> [input] the center O of the given hyperbola +%% #3 -> [input] the radius (m,n) of the given hyperbola +%% #4 -> [input] the coefficents of the quadratic curve equation, with six numbers $a,b,c,d,e,f$ joined with comma. +%% #5 -> [output] the first intersection node name +%% #6 -> [output] the second intersection node name +%% #7 -> [output] the third intersection node name +%% #8 -> [output] the fourth intersection node name +\def\pstGeneralConicHyperbolaInter{\@ifnextchar[\Pst@GeneralConicHyperbolaInter{\Pst@GeneralConicHyperbolaInter[]}} +\def\Pst@GeneralConicHyperbolaInter[#1](#2)(#3)#4#5#6#7#8{% + \begingroup + \@InitListMng % + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pst@getcoor{#3}\pst@tempR% + \pstParseArg{CurveCoef}{a,b,c,d,e,f}{#4} + \pnode(! + % Conic ax^2+bxy+cy^2+dx+ey+f=0 + \CurveCoefa /Ca ED + \CurveCoefb /Cb ED + \CurveCoefc /Cc ED + \CurveCoefd /Cd ED + \CurveCoefe /Ce ED + \CurveCoeff /Cf ED + % Hyperbola + \pst@tempO \tx@UserCoor /Oy ED /Ox ED + \pst@tempR \tx@UserCoor /Ry ED /Rx ED + tx@EcldDict begin Ca Cb Cc Cd Ce Cf Ox Oy Rx Ry ConicHyperbolaInter end + /nInters ED /Inters ED + nInters 0 gt { + /XYPair Inters 0 get def + XYPair 0 get XYPair 1 get + } { + 0 0 + } ifelse + /Dx 0 def /Dy 0 def + /Ex 0 def /Ey 0 def + /Fx 0 def /Fy 0 def + nInters 1 gt { + /XYPair Inters 1 get def + /Dx XYPair 0 get def + /Dy XYPair 1 get def + } if + nInters 2 gt { + /XYPair Inters 2 get def + /Ex XYPair 0 get def + /Ey XYPair 1 get def + } if + nInters 3 gt { + /XYPair Inters 3 get def + /Fx XYPair 0 get def + /Fy XYPair 1 get def + } if + ){#5} + \pnode(! Dx Dy){#6} + \pnode(! Ex Ey){#7} + \pnode(! Fx Fy){#8} + \Pst@ManageParamList{#5}% + \Pst@ManageParamList{#6}% + \Pst@ManageParamList{#7}% + \Pst@ManageParamList{#8}% + \endgroup% +}% +% +%% \pstGeneralConicIHyperbolaInter[Options](O)(m,n){a,b,c,d,e,f}{C}{D}{E}{F} +%% Get the most four intersections $C$, $D$, $E$ and $F$ of the General Conic $ax^2+bxy+cy^2+dx+ey+f=0$ and the given conjugate hyperbola $(y-O_y)^2/m^2-(x-O_x)^2/n^2=1$. +% +%% Parameters: +%% #1 -> options +%% #2 -> [input] the center O of the given conjugate hyperbola +%% #3 -> [input] the radius (m,n) of the given conjugate hyperbola +%% #4 -> [input] the coefficents of the quadratic curve equation, with six numbers $a,b,c,d,e,f$ joined with comma. +%% #5 -> [output] the first intersection node name +%% #6 -> [output] the second intersection node name +%% #7 -> [output] the third intersection node name +%% #8 -> [output] the fourth intersection node name +\def\pstGeneralConicIHyperbolaInter{\@ifnextchar[\Pst@GeneralConicIHyperbolaInter{\Pst@GeneralConicIHyperbolaInter[]}} +\def\Pst@GeneralConicIHyperbolaInter[#1](#2)(#3)#4#5#6#7#8{% + \begingroup + \@InitListMng % + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pst@getcoor{#3}\pst@tempR% + \pstParseArg{CurveCoef}{a,b,c,d,e,f}{#4} + \pnode(! + % Conic ax^2+bxy+cy^2+dx+ey+f=0 + \CurveCoefa /Ca ED + \CurveCoefb /Cb ED + \CurveCoefc /Cc ED + \CurveCoefd /Cd ED + \CurveCoefe /Ce ED + \CurveCoeff /Cf ED + % Hyperbola + \pst@tempO \tx@UserCoor /Oy ED /Ox ED + \pst@tempR \tx@UserCoor /Ry ED /Rx ED + tx@EcldDict begin Ca Cb Cc Cd Ce Cf Ox Oy Rx Ry ConicIHyperbolaInter end + /nInters ED /Inters ED + nInters 0 gt { + /XYPair Inters 0 get def + XYPair 0 get XYPair 1 get + } { + 0 0 + } ifelse + /Dx 0 def /Dy 0 def + /Ex 0 def /Ey 0 def + /Fx 0 def /Fy 0 def + nInters 1 gt { + /XYPair Inters 1 get def + /Dx XYPair 0 get def + /Dy XYPair 1 get def + } if + nInters 2 gt { + /XYPair Inters 2 get def + /Ex XYPair 0 get def + /Ey XYPair 1 get def + } if + nInters 3 gt { + /XYPair Inters 3 get def + /Fx XYPair 0 get def + /Fy XYPair 1 get def + } if + ){#5} + \pnode(! Dx Dy){#6} + \pnode(! Ex Ey){#7} + \pnode(! Fx Fy){#8} + \Pst@ManageParamList{#5}% + \Pst@ManageParamList{#6}% + \Pst@ManageParamList{#7}% + \Pst@ManageParamList{#8}% + \endgroup% +}% +% +%% \pstGeneralConicParabolaInter[Options](O){p}{a,b,c,d,e,f}{C}{D}{E}{F} +%% Get the most four intersections $C$, $D$, $E$ and $F$ of the General Conic $ax^2+bxy+cy^2+dx+ey+f=0$ and the given parabola $(x-x0)^2=2p(y-y0)$. +% +%% Parameters: +%% #1 -> options +%% #2 -> [input] the vertex O of the given parabola +%% #3 -> [input] the half of focal chord $p$ +%% #4 -> [input] the coefficents of the quadratic curve equation, with six numbers $a,b,c,d,e,f$ joined with comma. +%% #5 -> [output] the first intersection node name +%% #6 -> [output] the second intersection node name +%% #7 -> [output] the third intersection node name +%% #8 -> [output] the fourth intersection node name +\def\pstGeneralConicParabolaInter{\@ifnextchar[\Pst@GeneralConicParabolaInter{\Pst@GeneralConicParabolaInter[]}} +\def\Pst@GeneralConicParabolaInter[#1](#2)#3#4#5#6#7#8{% + \begingroup + \@InitListMng % + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pstParseArg{CurveCoef}{a,b,c,d,e,f}{#4} + \pnode(! + % Conic ax^2+bxy+cy^2+dx+ey+f=0 + \CurveCoefa /Ca ED + \CurveCoefb /Cb ED + \CurveCoefc /Cc ED + \CurveCoefd /Cd ED + \CurveCoefe /Ce ED + \CurveCoeff /Cf ED + % Parabola + \pst@tempO \tx@UserCoor /Oy ED /Ox ED + tx@EcldDict begin Ca Cb Cc Cd Ce Cf Ox Oy #3 ConicParabolaInter end + /nInters ED /Inters ED + nInters 0 gt { + /XYPair Inters 0 get def + XYPair 0 get XYPair 1 get + } { + 0 0 + } ifelse + /Dx 0 def /Dy 0 def + /Ex 0 def /Ey 0 def + /Fx 0 def /Fy 0 def + nInters 1 gt { + /XYPair Inters 1 get def + /Dx XYPair 0 get def + /Dy XYPair 1 get def + } if + nInters 2 gt { + /XYPair Inters 2 get def + /Ex XYPair 0 get def + /Ey XYPair 1 get def + } if + nInters 3 gt { + /XYPair Inters 3 get def + /Fx XYPair 0 get def + /Fy XYPair 1 get def + } if + ){#5} + \pnode(! Dx Dy){#6} + \pnode(! Ex Ey){#7} + \pnode(! Fx Fy){#8} + \Pst@ManageParamList{#5}% + \Pst@ManageParamList{#6}% + \Pst@ManageParamList{#7}% + \Pst@ManageParamList{#8}% + \endgroup% +}% +% +%% \pstGeneralConicIParabolaInter[Options](O){p}{a,b,c,d,e,f}{C}{D}{E}{F} +%% Get the most four intersections $C$, $D$, $E$ and $F$ of the General Conic $ax^2+bxy+cy^2+dx+ey+f=0$ and the given conjugate parabola $(y-y0)^2=2p(x-x0)$. +% +%% Parameters: +%% #1 -> options +%% #2 -> [input] the vertex O of the given conjugate parabola +%% #3 -> [input] the half of focal chord $p$ +%% #4 -> [input] the coefficents of the quadratic curve equation, with six numbers $a,b,c,d,e,f$ joined with comma. +%% #5 -> [output] the first intersection node name +%% #6 -> [output] the second intersection node name +%% #7 -> [output] the third intersection node name +%% #8 -> [output] the fourth intersection node name +\def\pstGeneralConicIParabolaInter{\@ifnextchar[\Pst@GeneralConicIParabolaInter{\Pst@GeneralConicIParabolaInter[]}} +\def\Pst@GeneralConicIParabolaInter[#1](#2)#3#4#5#6#7#8{% + \begingroup + \@InitListMng % + \psset{#1}% + \pst@getcoor{#2}\pst@tempO% + \pstParseArg{CurveCoef}{a,b,c,d,e,f}{#4} + \pnode(! + % Conic ax^2+bxy+cy^2+dx+ey+f=0 + \CurveCoefa /Ca ED + \CurveCoefb /Cb ED + \CurveCoefc /Cc ED + \CurveCoefd /Cd ED + \CurveCoefe /Ce ED + \CurveCoeff /Cf ED + % Parabola + \pst@tempO \tx@UserCoor /Oy ED /Ox ED + tx@EcldDict begin Ca Cb Cc Cd Ce Cf Ox Oy #3 ConicIParabolaInter end + /nInters ED /Inters ED + nInters 0 gt { + /XYPair Inters 0 get def + XYPair 0 get XYPair 1 get + } { + 0 0 + } ifelse + /Dx 0 def /Dy 0 def + /Ex 0 def /Ey 0 def + /Fx 0 def /Fy 0 def + nInters 1 gt { + /XYPair Inters 1 get def + /Dx XYPair 0 get def + /Dy XYPair 1 get def + } if + nInters 2 gt { + /XYPair Inters 2 get def + /Ex XYPair 0 get def + /Ey XYPair 1 get def + } if + nInters 3 gt { + /XYPair Inters 3 get def + /Fx XYPair 0 get def + /Fy XYPair 1 get def + } if + ){#5} + \pnode(! Dx Dy){#6} + \pnode(! Ex Ey){#7} + \pnode(! Fx Fy){#8} + \Pst@ManageParamList{#5}% + \Pst@ManageParamList{#6}% + \Pst@ManageParamList{#7}% + \Pst@ManageParamList{#8}% + \endgroup% +}% +% +%% \pstGeneralConicInter[Options]{a,b,c,d,e,f}{a',b',c',d',e',f'}{C}{D}{E}{F} +%% Get the most four intersections $C$, $D$, $E$ and $F$ of the General Conic $ax^2+bxy+cy^2+dx+ey+f=0$ and $a'x^2+b'xy+c'y^2+d'x+e'y+f'=0$. +% +%% Parameters: +%% #1 -> options +%% #2 -> [input] the coefficents of the quadratic curve equation, with six numbers $a,b,c,d,e,f$ joined with comma. +%% #3 -> [input] the coefficents of the quadratic curve equation, with six numbers $a',b',c',d',e',f'$ joined with comma. +%% #4 -> [output] the first intersection node name +%% #5 -> [output] the second intersection node name +%% #6 -> [output] the third intersection node name +%% #7 -> [output] the fourth intersection node name +\def\pstGeneralConicInter{\@ifnextchar[\Pst@GeneralConicInter{\Pst@GeneralConicInter[]}} +\def\Pst@GeneralConicInter[#1]#2#3#4#5#6#7{% + \begingroup + \@InitListMng % + \psset{#1}% + \pstParseArg{CurveCoef}{a,b,c,d,e,f}{#2} + \pstParseArg{CurveCoef}{A,B,C,D,E,F}{#3} + \pnode(! + % Conic ax^2+bxy+cy^2+dx+ey+f=0 + \CurveCoefa /Ca ED + \CurveCoefb /Cb ED + \CurveCoefc /Cc ED + \CurveCoefd /Cd ED + \CurveCoefe /Ce ED + \CurveCoeff /Cf ED + % Conic a'x^2+b'xy+c'y^2+d'x+e'y+f'=0 + \CurveCoefA /CA ED + \CurveCoefB /CB ED + \CurveCoefC /CC ED + \CurveCoefD /CD ED + \CurveCoefE /CE ED + \CurveCoefF /CF ED + tx@EcldDict begin Ca Cb Cc Cd Ce Cf CA CB CC CD CE CF ConicInter end + /nInters ED /Inters ED + nInters 0 gt { + /XYPair Inters 0 get def + XYPair 0 get XYPair 1 get + } { + 0 0 + } ifelse + /Dx 0 def /Dy 0 def + /Ex 0 def /Ey 0 def + /Fx 0 def /Fy 0 def + nInters 1 gt { + /XYPair Inters 1 get def + /Dx XYPair 0 get def + /Dy XYPair 1 get def + } if + nInters 2 gt { + /XYPair Inters 2 get def + /Ex XYPair 0 get def + /Ey XYPair 1 get def + } if + nInters 3 gt { + /XYPair Inters 3 get def + /Fx XYPair 0 get def + /Fy XYPair 1 get def + } if + ){#4} + \pnode(! Dx Dy){#5} + \pnode(! Ex Ey){#6} + \pnode(! Fx Fy){#7} + \Pst@ManageParamList{#4}% + \Pst@ManageParamList{#5}% + \Pst@ManageParamList{#6}% + \Pst@ManageParamList{#7}% + \endgroup% +}% +% +%% \pstGeneralConicTangentLine[Options]{A}{a,b,c,d,e,f}{B} +%% Get the tangent line through point $A% on the General Conic $ax^2+bxy+cy^2+dx+ey+f=0$. +% +%% Parameters: +%% #1 -> options +%% #2 -> [input] the point $A$ on the conic. +%% #3 -> [input] the coefficents of the quadratic curve equation, with six numbers $a,b,c,d,e,f$ joined with comma. +%% #4 -> [output] the node name $B$ on the tangent line. +\def\pstGeneralConicTangentLine{\@ifnextchar[\Pst@GeneralConicTangentLine{\Pst@GeneralConicTangentLine[]}} +\def\Pst@GeneralConicTangentLine[#1]#2#3#4{% + \begingroup + \@InitListMng % + \psset{#1}% + \pst@getcoor{#2}\pst@tempA% + \pstParseArg{CurveCoef}{a,b,c,d,e,f}{#3} + \pnode(! + % Conic ax^2+bxy+cy^2+dx+ey+f=0 + \CurveCoefa /Ca ED + \CurveCoefb /Cb ED + \CurveCoefc /Cc ED + \CurveCoefd /Cd ED + \CurveCoefe /Ce ED + \CurveCoeff /Cf ED + \pst@tempA \tx@UserCoor /Ay ED /Ax ED + Ca Ax mul Ax mul + Cb Ax mul Ay mul add + Cc Ay mul Ay mul add + Cd Ax mul add + Ce Ay mul add + Cf add abs 1E-5 lt { + % axx_A+b(x_Ay+xy_A)/2+cy_Ay+d(x_A+x)/2+e(y_A+y)/2+f=0 + /LA Ca Ax mul Cb Ay mul 2 div add Cd 2 div add def + /LB Cc Ay mul Cb Ax mul 2 div add Ce 2 div add def + /LC Cd Ax mul 2 div Ce Ay mul 2 div add Cf add def + LB abs 1E-5 lt { + Ax Ay 1 add + } { + Ax 1 add + LA Ax 1 add mul LC add LB div neg + } ifelse + } { + 0 0 + } ifelse + ){#4} + \Pst@ManageParamList{#4}% + \endgroup% +}% +% +%% \pstGeneralConicTangentChord[Options]{T}{a,b,c,d,e,f}{A}{B} +%% Get the tangent line through point $T% out of the General Conic $ax^2+bxy+cy^2+dx+ey+f=0$, +%% and output the tangent nodes A and B. +% +%% Parameters: +%% #1 -> options +%% #2 -> [input] the point $A$ on the conic. +%% #3 -> [input] the coefficents of the quadratic curve equation, with six numbers $a,b,c,d,e,f$ joined with comma. +%% #4 -> [output] the node name $A$ on the tangent chord. +%% #5 -> [output] the node name $B$ on the tangent chord. +\def\pstGeneralConicTangentChord{\@ifnextchar[\Pst@GeneralConicTangentChord{\Pst@GeneralConicTangentChord[]}} +\def\Pst@GeneralConicTangentChord[#1]#2#3#4#5{% + \begingroup + \psset{#1}% + \pst@getcoor{#2}\pst@tempT% + \pstParseArg{CurveCoef}{a,b,c,d,e,f}{#3} + \pnode(! + % Conic ax^2+bxy+cy^2+dx+ey+f=0 + \CurveCoefa /Ca ED + \CurveCoefb /Cb ED + \CurveCoefc /Cc ED + \CurveCoefd /Cd ED + \CurveCoefe /Ce ED + \CurveCoeff /Cf ED + \pst@tempT \tx@UserCoor /Ty ED /Tx ED + Ca Tx mul Tx mul + Cb Tx mul Ty mul add + Cc Ty mul Ty mul add + Cd Tx mul add + Ce Ty mul add + Cf add abs 1E-5 gt { + % axx_T+b(x_Ty+xy_T)/2+cy_Ty+d(x_T+x)/2+e(y_T+y)/2+f=0 + /LA Ca Tx mul Cb Ty mul 2 div add Cd 2 div add def + /LB Cc Ty mul Cb Tx mul 2 div add Ce 2 div add def + /LC Cd Tx mul 2 div Ce Ty mul 2 div add Cf add def + LB abs 1E-5 lt { + LC LA div neg Ty 1 add + LC LA div neg Ty 1 sub /By ED /Bx ED + } { + Tx 1 add LA Tx 1 add mul LC add LB div neg + Tx 1 sub LA Tx 1 sub mul LC add LB div neg /By ED /Bx ED + } ifelse + } { + 0 0 0 0 /By ED /Bx ED + } ifelse + ){Pst@GeneralConicTCA} + \pnode(! Bx By){Pst@GeneralConicTCB} + \pstGeneralConicLineInter{Pst@GeneralConicTCA}{Pst@GeneralConicTCB}{#3}{#4}{#5} + \endgroup% +}% +% \catcode`\@=\PstAtCode\relax % \endinput |