diff options
author | Karl Berry <karl@freefriends.org> | 2020-07-15 22:14:31 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-07-15 22:14:31 +0000 |
commit | 6b476aa08668d22361b83d249a17428b3a5681bc (patch) | |
tree | cfa37a83a559518e032884ec23ef646a3996fa84 /Master/texmf-dist/tex | |
parent | 6808b6833019f9dc3de553093fa82720494e386f (diff) |
pst-eucl (15jul20)
git-svn-id: svn://tug.org/texlive/trunk@55844 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/generic/pst-eucl/pst-eucl.tex | 199 |
1 files changed, 183 insertions, 16 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 8abea6715b0..cfc56a70d88 100644 --- a/Master/texmf-dist/tex/generic/pst-eucl/pst-eucl.tex +++ b/Master/texmf-dist/tex/generic/pst-eucl/pst-eucl.tex @@ -20,8 +20,8 @@ \csname PSTEuclideLoaded\endcsname \let\PSTEuclideLoaded\endinput % -\def\fileversion{1.73} -\def\filedate{2020/06/17} +\def\fileversion{1.74} +\def\filedate{2020/07/15} %% \message{`PST-Euclide v\fileversion, \filedate\space (dr,hv)}% %% prologue for postcript @@ -738,9 +738,7 @@ \fi\fi\fi% \Pst@ManageParamList{#6}% \Pst@ManageParamList{#7}% - \pstLineAB{#2}{#6}% - \pstLineAB{#2}{#7}% - \pstLineAB{#6}{#7}% + \pstPolygon(#2)(#6)(#7)% \endgroup% }% % @@ -854,9 +852,7 @@ \fi\fi\fi% \Pst@ManageParamList{#6}% \Pst@ManageParamList{#7}% - \pstLineAB{#2}{#6}% - \pstLineAB{#2}{#7}% - \pstLineAB{#6}{#7}% + \pstPolygon(#2)(#6)(#7)% \endgroup% }% % @@ -965,9 +961,7 @@ \fi\fi\fi% \Pst@ManageParamList{#6}% \Pst@ManageParamList{#7}% - \pstLineAB{#2}{#6}% - \pstLineAB{#2}{#7}% - \pstLineAB{#6}{#7}% + \pstPolygon(#2)(#6)(#7)% \endgroup% }% % @@ -1074,9 +1068,7 @@ \fi\fi\fi% \Pst@ManageParamList{#6}% \Pst@ManageParamList{#7}% - \pstLineAB{#2}{#6}% - \pstLineAB{#2}{#7}% - \pstLineAB{#6}{#7}% + \pstPolygon(#2)(#6)(#7)% \endgroup% }% % @@ -2304,7 +2296,7 @@ \pstBissectBAC[PointName=none,PointSymbol=none,linestyle=none]{\pst@triangle@node@B}{\pst@triangle@node@A}{\pst@triangle@node@C}{@PST@TRIANGLE@EC_BC} \pstOutBissectBAC[PointName=none,PointSymbol=none,linestyle=none]{\pst@triangle@node@C}{\pst@triangle@node@B}{\pst@triangle@node@A}{@PST@TRIANGLE@EC_CA} \pstInterLL[PointName=none,PointSymbol=none]{\pst@triangle@node@A}{@PST@TRIANGLE@EC_BC}{\pst@triangle@node@B}{@PST@TRIANGLE@EC_CA}{\pst@triangle@node@E} - \pstProjection[PointName=none,PointSymbol=none]{B}{C}{\pst@triangle@node@E}[#1] + \pstProjection[PointName=none,PointSymbol=none]{\pst@triangle@node@B}{\pst@triangle@node@C}{\pst@triangle@node@E}[#1] \Pst@ManageParamList{\pst@triangle@node@E}% \Pst@ManageParamList{#1}% \endgroup @@ -2313,7 +2305,7 @@ \pstBissectBAC[PointName=none,PointSymbol=none,linestyle=none]{\pst@triangle@node@B}{\pst@triangle@node@A}{\pst@triangle@node@C}{@PST@TRIANGLE@EC_BC} \pstOutBissectBAC[PointName=none,PointSymbol=none,linestyle=none]{\pst@triangle@node@C}{\pst@triangle@node@B}{\pst@triangle@node@A}{@PST@TRIANGLE@EC_CA} \pstInterLL[PointName=none,PointSymbol=none]{\pst@triangle@node@A}{@PST@TRIANGLE@EC_BC}{\pst@triangle@node@B}{@PST@TRIANGLE@EC_CA}{\pst@triangle@node@E} - \pstProjection[PointName=none,PointSymbol=none]{B}{C}{\pst@triangle@node@E}[#1] + \pstProjection[PointName=none,PointSymbol=none]{\pst@triangle@node@B}{\pst@triangle@node@C}{\pst@triangle@node@E}[#1] \Pst@ManageParamList{\pst@triangle@node@E}% \endgroup }% @@ -3866,6 +3858,181 @@ \endgroup% }% % +%% \pstCircleABR[Options]{A}{B}{R}{O} +%% Draw a circle with node A and node B on it, and Radius R, output the center O. +%% Parameters: +%% #1 -> options +%% #2 -> the input node A +%% #3 -> the input node B +%% #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{% + \begingroup% + \psset{#1} + \pst@getcoor{#2}\pst@tempA% + \pst@getcoor{#3}\pst@tempB% + \pnode(! + \pst@tempA \tx@UserCoor /y1 ED /x1 ED + \pst@tempB \tx@UserCoor /y2 ED /x2 ED + \pstUserDist{#4}\space /R ED + x2 x1 sub abs 1E-5 lt { % if x1=x2 + y2 y1 sub abs 1E-5 lt { % if y1=y2 + 0 0 + } { + y2 y1 add 2 div /y0 ED + y2 y1 lt { + R dup mul y1 y0 sub dup mul sub sqrt x1 add /x0 ED + } { + R dup mul y1 y0 sub dup mul sub sqrt neg x1 add /x0 ED + } ifelse + x0 y0 + } ifelse + } { + x2 dup mul x1 dup mul sub y2 dup mul y1 dup mul sub add x2 x1 sub div 2 div /Consta ED + y2 y1 sub x2 x1 sub div /Constb ED + Constb dup mul 1 add /CoefA ED + x1 Consta sub 2 mul Constb mul y1 2 mul sub /CoefB ED + x1 Consta sub dup mul y1 dup mul add R dup mul sub /CoefC ED + x1 x2 lt { + CoefB dup mul CoefA CoefC mul 4 mul sub sqrt CoefB sub CoefA 2 mul div /y0 ED + } { + CoefB dup mul CoefA CoefC mul 4 mul sub sqrt neg CoefB sub CoefA 2 mul div /y0 ED + } ifelse + Consta Constb y0 mul sub /x0 ED + x0 y0 + } ifelse + ){#5} + \Pst@geonodelabel{#5} + \pstCircleOA{#5}{#2} + \endgroup% +}% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Regular Polygons +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% \pstETriangleAB[Options]{A}{B}{C} +%% Draw an equilateral triangle ABC on given side AB in anti-clockwise. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the node A +%% #3 -> [input] the node B +%% #4 -> [output] the node C +\def\pstETriangleAB{\@ifnextchar[\Pst@ETriangleAB{\Pst@ETriangleAB[]}} +\def\Pst@ETriangleAB[#1]#2#3#4{% + \begingroup + \psset{#1}% + \pstRotation[RotAngle=60,PointName=none,PointSymbol=none]{#2}{#3}[#4] + \Pst@geonodelabel{#4} + \pstPolygon(#2)(#3)(#4)% + \endgroup +} +% +%% \pstSquareAB[Options]{A}{B}{C}{D} +%% Draw a square ABCD on given side AB in anti-clockwise. +%% Parameters: +%% #1 -> options +%% #2 -> [input] the node A +%% #3 -> [input] the node B +%% #4 -> [output] the node C +%% #5 -> [output] the node D +\def\pstSquareAB{\@ifnextchar[\Pst@SquareAB{\Pst@SquareAB[]}} +\def\Pst@SquareAB[#1]#2#3#4#5{% + \begingroup + \@InitListMng% + \psset{#1}% + \pstRotation[RotAngle=90,PointName=none,PointSymbol=none]{#2}{#3}[#5] + \pstRotation[RotAngle=-90,PointName=none,PointSymbol=none]{#3}{#2}[#4] + \Pst@ManageParamList{#4}% + \Pst@ManageParamList{#5}% + \pstPolygon(#2)(#3)(#4)(#5)% + \endgroup +} +% +%% \pstRegularPolygonAB[Options]{A_0}{A_1}{n}{A_2,A_3,A_4,...,A_{n-1}} +%% Draw a $n$ side regular polygon with given side $A_0A_1$, output the other points. +%% Parameters: +%% #1 -> options +%% #2 -> the input node A_0 +%% #3 -> the input node A_1 +%% #4 -> the input side number n +%% #5 -> the output points A_2,A_3,A_4,...,A_{n-1} +\def\pstRegularPolygonAB{\@ifnextchar[\Pst@RegularPolygonAB{\Pst@RegularPolygonAB[]}}% +\def\Pst@RegularPolygonAB[#1]#2#3#4{% + \bgroup% + \@InitListMng% + \def\@PolyPointA{#2}\def\@PolyPointB{#3}\def\@PointLast{#3}% + \pst@cnth=#4\pst@cntg=2 % next point idx (start from 0) + \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 + \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. + \Pst@RegularPolygonAB@i% +}% +\def\Pst@RegularPolygonAB@i#1{% + \@List{#1}\edef\@PointOutLst{\@NewList} + \edef\@point{\expandafter\PstParamListFirst\@PointOutLst,undef/} + \Pst@RegularPolygonAB@iii% +}% +\def\Pst@RegularPolygonAB@iii{% + \ifx\@point\@undef\def\@point{\@PolyPointB\the\pst@cntg}\fi + \pstCircleChordNode[PointName=none,PointSymbol=none]{PolyCenter}{\@PointLast}{\pstDist{\@PolyPointA}{\@PolyPointB}}{\@point} + \xdef\@@GenCourbe{\@@GenCourbe(\@point)}%%for accumulating points + %\typeout{\@@GenCourbe} + \Pst@ManageParamList{\@point}\xdef\@PointLast{\@point}% + \edef\@PointOutLst{\expandafter\PstParamListLasts\@PointOutLst,undef/}% + \advance\pst@cntg by 1 + \edef\@point{\expandafter\PstParamListFirst\@PointOutLst,undef/} + \ifnum\pst@cntg<\pst@cnth% + \def\@End{\Pst@RegularPolygonAB@iii} + \else + \def\@End{\pst@MngTransformCurve\egroup} + \fi% + \@End% +}% +% +%% \pstRegularPolygonOA[Options]{O}{A_0}{n}{A_1,A_2,A_3,...,A_{n-1}} +%% Draw a $n$ side regular polygon with given center O and the first node $A_1$, output the other points. +%% Parameters: +%% #1 -> options +%% #2 -> the input center node O +%% #3 -> the input first node A_0 +%% #4 -> the input side number n +%% #5 -> the output points A_1,A_2,A_3,...,A_{n-1} +\def\pstRegularPolygonOA{\@ifnextchar[\Pst@RegularPolygonOA{\Pst@RegularPolygonOA[]}}% +\def\Pst@RegularPolygonOA[#1]#2#3#4{% + \bgroup% + \@InitListMng% + \psset{#1}\def\@PolyCenter{#2}\def\@PolyPointA{#3}\def\@PointLast{#3}\def\@PolySideNum{#4}% + \pst@cnth=#4\pst@cntg=1 % next point idx (start from 0) + \edef\@@GenCourbe{(#3)}%%for accumulating points + \Pst@RegularPolygonOA@i% +}% +\def\Pst@RegularPolygonOA@i#1{% + \@List{#1}\edef\@PointOutLst{\@NewList} + \edef\@point{\expandafter\PstParamListFirst\@PointOutLst,undef/} + \Pst@RegularPolygonOA@iii% +}% +\def\Pst@RegularPolygonOA@iii{% + \ifx\@point\@undef\def\@point{\@PolyPointA\the\pst@cntg}\fi + \pstCircleChordNode[PointName=none,PointSymbol=none]{\@PolyCenter}{\@PointLast}{\pstDist{\@PolyCenter}{\@PolyPointA} 180 \@PolySideNum\space div sin mul 2 mul}{\@point} + \xdef\@@GenCourbe{\@@GenCourbe(\@point)}%%for accumulating points + %\typeout{\@@GenCourbe} + \Pst@ManageParamList{\@point}\xdef\@PointLast{\@point}% + \edef\@PointOutLst{\expandafter\PstParamListLasts\@PointOutLst,undef/}% + \advance\pst@cntg by 1 + \edef\@point{\expandafter\PstParamListFirst\@PointOutLst,undef/} + \ifnum\pst@cntg<\pst@cnth% + \def\@End{\Pst@RegularPolygonOA@iii} + \else + \def\@End{\pst@MngTransformCurve\egroup} + \fi% + \@End% +}% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Here are some functions to operate the conic curves. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |