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 | |
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')
-rw-r--r-- | Master/texmf-dist/doc/generic/pst-eucl/Changes | 5 | ||||
-rw-r--r-- | Master/texmf-dist/doc/generic/pst-eucl/pst-eucl-doc.bib | 19 | ||||
-rw-r--r-- | Master/texmf-dist/doc/generic/pst-eucl/pst-eucl-doc.pdf | bin | 1733912 -> 1568670 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/generic/pst-eucl/pst-eucl-doc.tex | 95 | ||||
-rw-r--r-- | Master/texmf-dist/tex/generic/pst-eucl/pst-eucl.tex | 199 |
5 files changed, 284 insertions, 34 deletions
diff --git a/Master/texmf-dist/doc/generic/pst-eucl/Changes b/Master/texmf-dist/doc/generic/pst-eucl/Changes index 101f759b4bf..a80eb43537d 100644 --- a/Master/texmf-dist/doc/generic/pst-eucl/Changes +++ b/Master/texmf-dist/doc/generic/pst-eucl/Changes @@ -6,6 +6,11 @@ pst-eucl.pro -------- pst-eucl.tex -------- +1.74 2020/07/15 - add macro to draw the equilateral triangle on a given side AB, \pstETriangleAB. + - add macro to draw the square on a given side AB, \pstSquareAB. + - add macro to draw the regular polygon on a given side AB, \pstRegularPolygonAB. + - add macro to draw the regular polygon with center O and base point A, \pstRegularPolygonOA. + - add macro to draw the circle with radius length and two nodes A, B, \pstCircleABR. 1.73 2020/06/07 - Allow the star version for \pstLabelAB to use \cput* or \cput for the label 1.72a 2020/06/07 - fix a typo in the macro definition \pstMarkAngle 1.72 2020/04/18 - revert the change of \pstTriangle in v1.69, we should use \pst@object to clear \pst@par. diff --git a/Master/texmf-dist/doc/generic/pst-eucl/pst-eucl-doc.bib b/Master/texmf-dist/doc/generic/pst-eucl/pst-eucl-doc.bib index 7e9f03b0003..f1d5a1b2ed4 100644 --- a/Master/texmf-dist/doc/generic/pst-eucl/pst-eucl-doc.bib +++ b/Master/texmf-dist/doc/generic/pst-eucl/pst-eucl-doc.bib @@ -41,17 +41,17 @@ @ctan{multido, title = {The Multido package}, -subtitle = {A loop facility for Generic TeX}, +subtitle = {A loop facility for Generic \TeX}, author = {Van Zandt, Timothy and Voß, Herbert and Niepraschk, Rolf}, url = {macros/latex/multido}, urldate = {2018-09-01}, -version = {1.42} +version = {1.42}, } @Book{PSTricks2, author = {Herbert Voß}, - title = {\texttt{PSTricks} -- {G}rafik f\"ur \TeX{} und \LaTeX}, + title = {\texttt{PSTricks} -- {G}rafik für \TeX{} und \LaTeX}, edition = {7}, publisher = {DANTE {\eV} and Lehmanns Media}, date = {2016}, @@ -88,7 +88,7 @@ version = {1.42} @Book{tbt, author = {Victor Eijkhout}, - title = {\TeX\ by Topic -- {A} \TeX{}nician Reference}, + title = {\TeX\ by Topic -- A \TeX{}nician Reference}, edition = {1}, publisher = {DANTE {\eV} and Lehmanns Media}, year = {2014}, @@ -99,7 +99,7 @@ version = {1.42} @Article{dtk02.1:voss:mathematischen, author = {Herbert Voß}, - title = {Die mathematischen {F}unktionen von {P}ostscript}, + title = {Die mathematischen Funktionen von Postscript}, journal = dtk, year = 2002, volume = {1/02}, @@ -108,14 +108,5 @@ version = {1.42} month = mar, pages = {40-47}, annote = bretter, - abstract = { \PS, faktisch genauso alt wie {\TeX}, ist im - Verh{\"a}ltnis dazu allgemein noch weniger bekannt, wenn es - darum geht zu beurteilen, was es denn nun im eigentlichen - Sinne ist. Au{\ss}erdem wird h{\"a}ufig vergessen, dass - sich mit den \PS-Funktionen viele Dinge erledigen lassen, - bei denen sonst auf externe Programme zur{\"u}ckgegriffen - wird. Dies wird im Folgenden f{\"u}r die mathematischen - Funktionen im Zusammenhang mit dem Paket \texttt{pst-plot} - gezeigt. } } diff --git a/Master/texmf-dist/doc/generic/pst-eucl/pst-eucl-doc.pdf b/Master/texmf-dist/doc/generic/pst-eucl/pst-eucl-doc.pdf Binary files differindex 0f792fb8759..cbb859381ea 100644 --- a/Master/texmf-dist/doc/generic/pst-eucl/pst-eucl-doc.pdf +++ b/Master/texmf-dist/doc/generic/pst-eucl/pst-eucl-doc.pdf diff --git a/Master/texmf-dist/doc/generic/pst-eucl/pst-eucl-doc.tex b/Master/texmf-dist/doc/generic/pst-eucl/pst-eucl-doc.tex index cf38bc251e7..054dae2eb27 100644 --- a/Master/texmf-dist/doc/generic/pst-eucl/pst-eucl-doc.tex +++ b/Master/texmf-dist/doc/generic/pst-eucl/pst-eucl-doc.tex @@ -1,4 +1,5 @@ -\documentclass[11pt,english,BCOR10mm,DIV12,bibliography=totoc,parskip=false,smallheadings, +\PassOptionsToPackage{style=dtk}{biblatex} +\documentclass[11pt,english,BCOR10mm,DIV=12,bibliography=totoc,parskip=false,smallheadings, headexclude,footexclude,oneside,english]{pst-doc} \usepackage{pst-eucl} \let\pstEuclideFV\fileversion @@ -14,9 +15,10 @@ \def\Argsans#1{$\langle$#1$\rangle$} \def\DefaultVal#1{(by default #1)} -\usepackage{biblatex} \addbibresource{\jobname.bib} +\lstset{rframe={}} + \title{\texttt{pst-euclide}} \subtitle{A PSTricks package for drawing geometric pictures; v.\pstEuclideFV} @@ -352,8 +354,8 @@ the rule bar and the segment. It does not display the ruler bar as default, and you need to setup \Lkeyword{linestyle} to display it. The star version uses also the star version of the put macro (white background). -\begin{LTXexample}[width=6cm,pos=l] -\begin{pspicture}[showgrid=true](-1,-1)(4,4) +\begin{LTXexample}[pos=t] +\begin{pspicture}[showgrid=true](-2,-2)(5,5) \psset{dotscale=0.5}\psset{PointSymbol=*}\footnotesize \pstGeonode[PosAngle=-90](0.5,1.5){A} \pstGeonode[PosAngle=-90](2.5,1.5){B}\pstLineAB{A}{B} @@ -1267,6 +1269,26 @@ With this package, it becomes possible to draw: \vspace{10pt} +The macro \Lcs{pstCircleABR} draws the circle of given radius length $R$, through two given nodes $A$ and $B$, then outputs the circle center $O$. + +\begin{BDef} +\Lcs{pstCircleABR}\OptArgs\Largb{A}\Largb{B}\Largb{$R$}\Largb{O} +\end{BDef} + +Note that through from $A$ to $B$ and through from $B$ to $A$ will get the figure symmetric to $AB$. +For example, + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid](-3,-3)(3,3)\footnotesize +\psset{unit=0.50cm}\psset{dotscale=0.5}\psset{PointSymbol=*} +\pstGeonode[PosAngle={30,210}](1,0){A}(-2,-1){B} +\pstCircleABR[linecolor=red!80]{A}{B}{\pstDistConst{2.5}}{O_1} +\pstCircleABR[linecolor=blue!80]{B}{A}{\pstDistConst{2.5}}{O_2} +\end{pspicture} +\end{LTXexample} + +\vspace{10pt} + The following example show how to use the more complex distance macros, and the parameter to fill the circle. @@ -1594,6 +1616,71 @@ When they are separated, the radical axis is between of the circles. \end{pspicture} \end{LTXexample} +\subsection{Regular polygons} +For the 3-side and 4-side regular polygon, we provide the macro \Lcs{pstETriangleAB} and \Lcs{pstSquareAB} to draw them. +In general, you can use the macro \Lcs{pstRegularPolygonAB} and \Lcs{pstRegularPolygonOA} to get a n-side regular polygon. + +\begin{BDef} +\Lcs{pstETriangleAB}\OptArgs\Largb{A}\Largb{B}\Largb{C}\\ +\Lcs{pstSquareAB}\OptArgs\Largb{A}\Largb{B}\Largb{C}\Largb{D}\\ +\Lcs{pstRegularPolygonAB}\OptArgs\Largb{$A_0$}\Largb{$A_1$}\Largb{$n$}\Largb{$A_2,A_3,\cdots,A_{n-1}$}\\ +\Lcs{pstRegularPolygonOA}\OptArgs\Largb{$O$}\Largb{$A_0$}\Largb{$n$}\Largb{$A_1,A_2,\cdots,A_{n-1}$} +\end{BDef} + +The macro \Lcs{pstETriangleAB} draw a equilateral triangle on a given side $AB$, and output the third node $C$; +The macro \Lcs{pstSquareAB} draw a square on a given side $AB$, and output the other two nodes $C$, $D$; +The macro \Lcs{pstRegularPolygonAB} draw a n-side regular polygon on a given side $A_0A_1$, and output the other nodes $A_2,A_3,\cdots,A_{n-1}$; +The macro \Lcs{pstRegularPolygonOA} draw a n-side regular polygon with center $O$ and base point $A_0$, and output the other nodes $A_1,A_2,\cdots,A_{n-1}$. + +You can use the parameters \Lkeyword{linestyle}, \Lkeyword{linecolor}, \Lkeyword{linewidth} +to control the line style; and use the parameters \Lkeyword{PointName}, \Lkeyword{PosAngle}, +\Lkeyword{PointSymbol} to control the point nodes; and use the parameters \Lkeyword{CurveType}, +\Lkeyword{fillstyle}, \Lkeyword{fillcolor} to control the polygon style. + +For the last output point list in macro \Lcs{pstRegularPolygonAB} and \Lcs{pstRegularPolygonOA}, if you do not enter a complete point list, +the remaining points will be automatically named. + +Note that draw regular polygon with side from $A$ to $B$ and side from $B$ to $A$ will get the figure symmetric to $AB$. +Here are some examples. + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid](-1,-2)(3,2) +\psset{unit=0.40cm}\footnotesize\psset{PointSymbol=none,PointNameSep=0.22cm} +\pstGeonode[PosAngle={180,0},PointSymbol=*](0,0){A}(5,0){B} +\pstETriangleAB[linecolor=red!60,PosAngle=90,PointSymbol=*]{A}{B}{C} +\pstETriangleAB[linecolor=blue!60,PosAngle=-90,PointSymbol=*,fillstyle=solid,fillcolor=blue!20]{B}{A}{C'} +\pstSquareAB[linecolor=red!60,PosAngle={90,90},PointSymbol=*]{A}{B}{C}{D} +\pstSquareAB[linecolor=blue!60,PosAngle={-90,-90},PointSymbol=*,fillstyle=solid,fillcolor=blue!20,opacity=0.2]{B}{A}{C'}{D'} +\end{pspicture} +\end{LTXexample} + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid](-3,-3)(3,3) +\psset{unit=0.40cm}\footnotesize\psset{PointSymbol=none,PointNameSep=0.22cm} +\pstGeonode[PosAngle={180,0},PointSymbol=*](0,0){O}(5,0){A} +\pstRegularPolygonOA[CurveType=polygon,linecolor=red!60,PointSymbol=*,PosAngle={120,240}]{O}{A}{3}{C,D} +\pstRegularPolygonOA[CurveType=polygon,linecolor=green!60,PointSymbol=*,PosAngle={-90,0,90}]{O}{A}{4}{C,D,E} +\pstRegularPolygonOA[CurveType=polygon,linecolor=blue!60,PointSymbol=*,PosAngle={65,110,135,180,225,250,305},PointName={A_1,A_2,A_3,A_4,A_5,A_6,A_7}]{O}{A}{8}{A1,A2,A3,A4,A5,A6,A7} +\pstRegularPolygonOA[CurveType=polygon,linecolor=cyan!60,PointSymbol=*,PosAngle={20,15,60,75,110,130,150,180,200,220,240,260,290,310,330,350},PointName={A_1,A_2,A_3,A_4,A_5,A_6,A_7,A_8,A_9,A_{10},A_{11},A_{12},A_{13},A_{14},A_{15},A_{16}}]{O}{A}{17}{A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15,A16} +\end{pspicture} +\end{LTXexample} + +\begin{LTXexample}[width=6cm,pos=l] +\begin{pspicture}[showgrid](-3,-4)(3,4) +\psset{unit=0.40cm}\footnotesize\psset{PointSymbol=none,PointNameSep=0.22cm} +\pstGeonode[PosAngle={180,0},PointSymbol=*](0,0){A}(2,0){B} +\pstRegularPolygonAB[CurveType=polygon,linecolor=red!60,PointSymbol=*,PosAngle={90,90,90}]{A}{B}{3}{C,D,E} +\pstRegularPolygonAB[CurveType=polygon,linecolor=red!60,PointSymbol=*,PosAngle={90,90}]{A}{B}{4}{C,D,E} +\pstRegularPolygonAB[CurveType=polygon,linecolor=red!60,PointSymbol=*,PosAngle={-10,40,80,115,150,200}]{A}{B}{8}{C,D,E} +\pstRegularPolygonAB[CurveType=polygon,linecolor=red!60,PointSymbol=*,PosAngle={290,310,330,350,10,30,45,65,85,115,135,155,170,190,210},PointName={B_2,B_3,B_4,B_5,B_6,B_7,B_8,B_9,B_{10},B_{11},B_{12},B_{13},B_{14},B_{15},B_{16}}]{A}{B}{17}{B2} +\psset{CodeFig=true,CodeFigColor=gray,CodeFigStyle=solid} +\pstRegularPolygonAB[CurveType=polygon,linecolor=blue!60,PointSymbol=*,PosAngle={-90,-90}]{B}{A}{3}{C,D,E} +\pstRegularPolygonAB[CurveType=polygon,linecolor=blue!60,PointSymbol=*,PosAngle={-90,-90}]{B}{A}{4}{C,D,E} +\pstRegularPolygonAB[CurveType=polygon,linecolor=blue!60,PointSymbol=*,PosAngle={140,190,240,-60,-40,10},PointName={A_2,A_3,A_4,A_5,A_6,A_7}]{B}{A}{8}{A2,A3,A4,A5,A6,A7} +\pstRegularPolygonAB[CurveType=polygon,linecolor=blue!60,PointSymbol=*,PosAngle={140,160,180,200,220,240,260,280,300,320,340,360,20,40,60},PointName={A_2,A_3,A_4,A_5,A_6,A_7,A_8,A_9,A_{10},A_{11},A_{12},A_{13},A_{14},A_{15},A_{16}}]{B}{A}{17}{A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15,A16} +\end{pspicture} +\end{LTXexample} + \subsection{Generic curve} It is possible to generate a set of points using a loop, and to give 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. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |