diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /graphics/pstricks/contrib/pst-bezier |
Initial commit
Diffstat (limited to 'graphics/pstricks/contrib/pst-bezier')
-rw-r--r-- | graphics/pstricks/contrib/pst-bezier/Changes | 17 | ||||
-rw-r--r-- | graphics/pstricks/contrib/pst-bezier/README.md | 39 | ||||
-rw-r--r-- | graphics/pstricks/contrib/pst-bezier/doc/pst-bezier-doc.bib | 148 | ||||
-rw-r--r-- | graphics/pstricks/contrib/pst-bezier/doc/pst-bezier-doc.pdf | bin | 0 -> 1164401 bytes | |||
-rw-r--r-- | graphics/pstricks/contrib/pst-bezier/doc/pst-bezier-doc.tex | 746 | ||||
-rw-r--r-- | graphics/pstricks/contrib/pst-bezier/dvips/pst-bezier.pro | 236 | ||||
-rw-r--r-- | graphics/pstricks/contrib/pst-bezier/latex/pst-bezier.sty | 18 | ||||
-rw-r--r-- | graphics/pstricks/contrib/pst-bezier/tex/pst-bezier.tex | 412 |
8 files changed, 1616 insertions, 0 deletions
diff --git a/graphics/pstricks/contrib/pst-bezier/Changes b/graphics/pstricks/contrib/pst-bezier/Changes new file mode 100644 index 0000000000..8e1376b781 --- /dev/null +++ b/graphics/pstricks/contrib/pst-bezier/Changes @@ -0,0 +1,17 @@ +-- pst-bezier.tex --- +0.03 2016-09-03 small changes to the code, correct url in + the documentation +0.02 2016-08-19 added macro \psRQBCmasse for a Bezier curve, + definied by three weighted points +0.01 2009-01-29 first CTAN version + + +-- pst-bezier.sty --- +0.02 2016-08-19 - load expl3 for floating point operations + - define \pscalculation +0.01 2009-01-29 first CTAN version + + +-- pst-bezier.pro --- +0.02 2016-08-19 added function tx@RQBCmasse for a Bezier curve +0.01 2009-01-29 first CTAN version diff --git a/graphics/pstricks/contrib/pst-bezier/README.md b/graphics/pstricks/contrib/pst-bezier/README.md new file mode 100644 index 0000000000..23a4246c09 --- /dev/null +++ b/graphics/pstricks/contrib/pst-bezier/README.md @@ -0,0 +1,39 @@ +Save the files pst-bezier.sty|tex in a directory, which is part of your +local TeX tree. pst-bezier.pro should be saved in ../texmf/dvips/pstricks/ +Then do not forget to run texhash to update this tree. +pst-bezier needs pst-plot and pstricks, which should be part of your +local TeX installation, otherwise get it from a CTAN server +http://mirror.CTAN.org + + +Save the files + +pst-bezier.sty +pst-bezier.tex +pst-bezier.pro + +in any place, where latex or any other TeX program will find it. +Do not forget to update your database, when installing this +package the first time. + +pst-bezier uses the extended version of the keyval package. So +be sure that you +- have installed xkeyval with the special pst-xkey + (CTAN: tex-archive/macros/latex/contrib/xkeyval/) +- do not load another package after pst-bezier, which loads + the old keyval.sty or pst-key.tex + + +If you like to get the documentation file in another format run + +latex pst-bezier-doc.tex +bibtex pst-bezier.doc +latex pst-bezier-doc.tex +dvips pst-bezier-doc.dvi + +to get a PostScript file. But pay attention, that the pst-bezier +files are saved in the above mentioned way, before you run +latex on the documentation file. + +The intermediate DVI file works only with viewers which can +interprete the embedded PostScript code. diff --git a/graphics/pstricks/contrib/pst-bezier/doc/pst-bezier-doc.bib b/graphics/pstricks/contrib/pst-bezier/doc/pst-bezier-doc.bib new file mode 100644 index 0000000000..dace44666b --- /dev/null +++ b/graphics/pstricks/contrib/pst-bezier/doc/pst-bezier-doc.bib @@ -0,0 +1,148 @@ +@STRING{tugboat = {TUGboat} } +@STRING{beiprogramm = {{\TeX}-Beiprogramm} } +@STRING{bretter = {Bretter, die die Welt bedeuten} } +@STRING{dtk = {{D}ie {\TeX}nische {K}om{\"o}die} } +@STRING{editorial = {Editorial} } +@STRING{fremdebuehne = {Von fremden B{\"u}hnen} } +@STRING{fundus = {Aus dem Fundus} } +@STRING{hinterbuehne = {Hinter der B{\"u}hne} } +@STRING{leserbrief = {Leserbrief(e)} } +@STRING{magazin = {Magazin} } +@STRING{rezension = {Rezensionen} } +@STRING{schonimmer = {Was Sie schon immer {\"u}ber {\TeX} wissen wollten \dots} } +@STRING{theaterkasse = {Von der Theaterkasse} } +@STRING{theatertage = {{\TeX}-Theatertage} } + +@Book{PSTricks2, + author = {Herbert Vo\ss}, + title = {{\PST} {G}rafik für \TeX{} und \LaTeX}, + edition = {7}, + publisher = {DANTE -- Lehmanns}, + year = {2016}, + address = {Heidelberg/Berlin} +} + +@Book{PSTricks-E, + author = {Herbert Vo\ss}, + title = {{\PST} {G}raphics for \LaTeX}, + edition = {1}, + publisher = {UIT}, + year = {2011}, + address = {Cambridge} +} + +@Book{companion04, + author = {Frank Mittelbach and Michel Goosens et al}, + title = {The {\LaTeX} {C}ompanion}, + edition = {second}, + publisher = {Addison-Wesley Publishing Company}, + year = {2004}, + address = {Boston} +} + +@Book{unbound, + author = {Alan Hoenig}, + title = {\TeX{} {U}nbound: \LaTeX{} \& \TeX{} {S}trategies, {F}onts, {G}raphics, and {M}ore}, + publisher = {Oxford University Press}, + year = {1998}, + address = {London} +} + +@Book{tlgc2, + author = {Michel Goosens and Frank Mittelbach and Sebastian Rahtz and Denis Roegel and Herbert Vo{\ss}}, + title = {The {\LaTeX} {G}raphics {C}ompanion}, + publisher = {{Addison-Wesley Publishing Company}}, + edition = 2, + year = {2007}, + address = {Reading, Mass.} +} + +@Article{girou:01:, + author = {Denis Girou}, + title = {Pr\'esentation de {PST}ricks}, + journal = {Cahier {GUT}enberg}, + year = 1994, + volume = {16}, + month = apr, + pages = {21--70} +} + +@Article{girou:02:, + author = {{Timothy Van} Zandt and Denis Girou}, + title = {Inside {PST}ricks}, + journal = TUGboat, + year = 1994, + volume = {15}, + month = sep, + pages = {239--246} +} + +@Book{PostScript, + Author = {Kollock, Nikolai G.}, + Title = {PostScript richtig eingesetzt: vom {K}onzept zum + praktischen {E}insatz}, + Publisher = {IWT}, + Address = {Vaterstetten}, + year = 1989, +} + +@online{pstricks, + Title = {PSTricks - {\PS} macros for generic {\TeX}}, + Author = {{Timothy Van} Zandt}, + Organization = {\TeX\ Users Group}, + url = {http://www.tug.org/application/PSTricks}, + urldate={2016-08-21}, + year = 1993 +} + +@ctan{pst-plot, + Title = {\texttt{pst-plot}: Plotting two dimensional functions and data}, + Author = {{Timothy Van} Zandt and Herbert Voß}, + Organization = {CTAN}, + url = {graphics/pstricks/generic/pst-plot.tex}, + year = 2016 +} + +@ctan{multido, + Title = {\texttt{multido.tex} - a loop macro, that supports fixed-point addition}, + Author = {{Timothy Van} Zandt}, + Organization = {CTAN}, + url = {/graphics/pstricks/generic/multido.tex}, + year = 1997 +} + +@inproceedings{GB16, + TITLE = {Mass points, {B}\'ezier curves and conics: a survey}, + AUTHOR = {Lionel Garnier and Jean-Paul Bécar}, + url = {http://ufrsciencestech.u-bourgogne.fr/~garnier/publications/adg2016/}, + BOOKTITLE = {Eleventh International Workshop on Automated Deduction in Geometry}, + ADDRESS = {Strasbourg, France}, + SERIES = {Proceedings of ADG 2016}, + PAGES = {97--116}, + date = {2016-06}, + urldate={2016-08-20}, +} + +@online{gb16a, + author={Lionel Garnier}, + title={Courbes de Bézier et coniques}, + url={http://ufrsciencestech.u-bourgogne.fr/~garnier/Migs/03_CourbesBezierPointsMassiquesEleve.pdf}, + urldate={2016-08-20}, +} +@online{gb16b, + author={Lionel Garnier and Jean-Paul Bécar and Lucie Drouton}, + title={Surfaces canal et courbes de Bézier rationnelles quadratiques}, + journal={Journées du Groupe de Travail en Modélisation Géométrique 2016}, + address={Dijon}, + url={http://ufrsciencestech.u-bourgogne.fr/~garnier/publications/hippocampe/64_GTMG2016_courbesBezierSurfacesCanal.pdf}, + urldate={2016-08-20}, +} + +@PhdThesis{Bec97, +author = {Jean-Paul Bécar}, +title = {Forme ({B}{R}) des coniques et de leurs faisceaux}, +school = {Université de Valenciennes et de Hainaut-Cambrésis, LIMAV}, +date = {1997-12-12}, +address= {Valenciennes, France}, +} + diff --git a/graphics/pstricks/contrib/pst-bezier/doc/pst-bezier-doc.pdf b/graphics/pstricks/contrib/pst-bezier/doc/pst-bezier-doc.pdf Binary files differnew file mode 100644 index 0000000000..26687f355f --- /dev/null +++ b/graphics/pstricks/contrib/pst-bezier/doc/pst-bezier-doc.pdf diff --git a/graphics/pstricks/contrib/pst-bezier/doc/pst-bezier-doc.tex b/graphics/pstricks/contrib/pst-bezier/doc/pst-bezier-doc.tex new file mode 100644 index 0000000000..e6c99022d9 --- /dev/null +++ b/graphics/pstricks/contrib/pst-bezier/doc/pst-bezier-doc.tex @@ -0,0 +1,746 @@ +%% $Id: pst-bezier-doc.tex 134 2009-09-27 12:28:50Z herbert $ +\documentclass[11pt,english,bibliography=totoc,parskip=false,smallheadings, + oneside]{pst-doc} +\usepackage[utf8]{inputenc} +\usepackage{esvect} +\let\vec\vv +\usepackage{animate} +\usepackage{pst-bezier} +\usepackage{bbold} +\addbibresource{pst-bezier-doc.bib} + +\let\pstBezierFV\fileversion +\lstset{pos=l,wide=false,language=PSTricks, + morekeywords={multidipole,parallel},basicstyle=\footnotesize\ttfamily} +\definecolor{navy}{rgb}{0 0 0.5} +% +\def\bgImage{\pspicture[showgrid](0,1)(5,6) +\psset{showpoints} +\psbcurve[linecolor=blue,linewidth=0.01](1,1)% + (2,2)(3,1)(4,2)(4,4)(3,5)% + (2,4)(1,5) +\psbcurve(1,1)(2,2)(3,1)(4,2)% + T{0.5}(4,4)(3,5)(2,4)(1,5) +\endpspicture} +\newtheorem{definition}{Definition} +\def\dy{\displaystyle} +\begin{document} + +\title{\texttt{pst-bezier}} +\subtitle{A PSTricks package for drawing Bezier curves; v.\pstBezierFV} +\author{Jean-Paul Bécar\\Lionel Garnier\\Manuel Luque\\Tobias Nähring \\Herbert Voß} +\docauthor{Lionel Garnier\\Herbert Voß} +\date{\today} +\maketitle + +\tableofcontents + +\clearpage + +\begin{abstract} +\noindent +The \LPack{pstricks} package provides (essentially) two main macros for +drawing curves: \Lcs{pscurve} and \Lcs{psbezier}. Both macros +employ Bezier \Index{spline}s. + +The \Lcs{pscurve} macro takes multiple interpolated points as +arguments. Thus, it is easy to draw long multiply bent curves. The +problem with \Lcs{pscurve} is that there is no easy +way to change the automatically computed +control points without simultaneously changing the interpolated +points. Note that some control is possible via the +\Lkeyword{curvature} option. + +The \Lcs{psbcurve} macro gives full control over the +interpolation points and the control points of one Bezier polynominal +of degree three (two interpolated points and two control +points). + +\vfill\noindent +Thanks to: \\ + Jean-C\^ome Charpentier. +\end{abstract} + +\clearpage + +\section{Introduction} + +If one demands for the access to certain control points of one +multiply bent curve one has to use multiple instances of the +\Lcs{psbezier} macro. With this approache each inner interpolation +point of the curve has to be input twice. Furthermore, if one needs +smooth joints one has to compute control points symmetrically to the +corresponding interpolation points for every joint even if one does +not care so much about the exact tangential direction at some of those +joints. That can be rather tedious. + +The \Lcs{psbcurve} macro of the package \LPack{pst-bezier} is intented to +demonstrate a way to combine the nice properties of the macros +\Lcs{pscurve} and \Lcs{psbezier}. It provides an easy input +format to describe `arbitrarily' many interpolation points of a curve +and to fix the control points at some freely selected interpolation +points. + +Note, that \LPack{pst-bezier} is \emph{no final package} (e.g. +the automatical computation of the control points is not as refined as +that one for the macro \Lcs{pscurve}). + +\section{Installation and usage of \texttt{pst-bezier.tex}} +\paragraph{Installation:} +As prerequisites for \LPack{pst-bezier} you need resent working +versions of \LaTeX{} and \LPack{pstricks}. The files +\LFile{pst-bezier.tex} and \LFile{pst-bezier.sty} must be somewhere +in your \TeX-input path. Further more, the file +\LFile{pst-bezier.pro} must be in some path, where \Lprog{dvips} can +find it. + +\paragraph{Usage:} +As usual, load the packages \LPack{pstricks} and \LPack{pst-bezier} +in that order via the \Lcs{usepackage} macro. + +Now you are ready to use the \Lcs{psbcurve} macro within your document +body. This macro is described in the next section with all its options. + +Whith the following simple \LaTeX-source code you can test whether you have +correctly installed the package: + +\begin{LTXexample} +\documentclass{minimal} +\usepackage{pstricks} +\usepackage{pst-bezier} +\begin{document} + \begin{pspicture}(0,-0.4)(6,2) + \psbcurve(1,2)(5,2) % Draw just one straight line. + \end{pspicture} +\end{document} +\end{LTXexample} + + +\section{The \nxLcs{psbcurve} macro} +In the most simple form you can specify any number of interpolation +points as the argument of \Lcs{psbcurve}. + +\begin{LTXexample} +\begin{pspicture}[showgrid](0,-0.4)(5,3) + \psbcurve[showpoints](1,1)(2,2)(3,1)(4,2) +\end{pspicture} +\end{LTXexample} + +As usual, options can be specified within brackets. + + +\begin{LTXexample} +\begin{pspicture}[showgrid](0,-0.4)(5,3) + \psbcurve[showpoints](1,1)(2,2)(3,1)(4,2) +\end{pspicture} +\end{LTXexample} + +As you can see in the above example, the \Lkeyword{showpoints} feature works +(partially) with \Lcs{psbcurve}. + +The next figure shows again the curve from the first example. This +time labels are added to the points (this is just for the following +description, it is not a feature of \Lcs{psbcurve}). + +\begin{LTXexample} +\begin{pspicture}[showgrid](0,-0.4)(5,3) + \psbcurve[showpoints](1,1)(2,2)(3,1)(4,2) + \uput[-90](1,1){$\vec{p}_{0}=\vec{l}_{1}$} + \uput[90](1.5,2){$\vec{r}_{1}$} + \uput[90](2,2){$\vec{p}_{1}$} + \uput[90](2.5,2){$\vec{l}_{2}$} + \uput[-90](2.5,1){$\vec{r}_{2}$} + \uput[-90](3,1){$\vec{p}_{2}$} + \uput[-90](3.5,1){$\vec{l}_{3}$} + \uput[90](4,2){$\vec{r}_{3}=\vec{p}_{3}$} +\end{pspicture} +\end{LTXexample} + +The points labeled with $\vec{p}_{k}$ $(k=0,\dots,3)$ are the +interpolation points, these ones labelled with $\vec{l}_{1},\hdots,\vec{l}_{3}$, +and these ones labelled with $\vec{r}_{1},\hdots,\vec{r}_{3}$ are the left and +right control points, respectively. + +Between each consecutive pair $\vec{p}_{k-1},\vec{p}_{k}$ of interpolation +points the \Lcs{psbcurve} macro draws a cubic Bezier spline. +The control points $\vec{l}_{k}$ and $\vec{r}_{k}$ determine the tangential +direction of the bezier spline at the interpolation points. More +exactly, the bezier spline from $\vec{p}_{k-1}$ to $\vec{p}_{k}$ is tangent to +the vector $\vec{l}_{k}-\vec{p}_{k-1}$ at the point $\vec{p}_{k-1}$ and tantengial +to the vektor $\vec{r}_{k}-\vec{p}_{k}$ at the point $\vec{p}_{k}$. + +Without any optional modifier arguments (described later in this text) +the control points are computed automatically +from the interpolation points by the formulas\footnote{Note that this + method is very crude. To compute the curve such that the curvature + is continuous would require solving a nonlinear system of + equations. That is not implemented yet.} +% +\begin{align*} + \vec{l}_{1}&= \vec{p}_{0}\\ + \vec{l}_{k}&= t_{k}(\vec{p}_{k}-\vec{p}_{k-2})&&\text{for }k=2,\hdots,n\\ + \vec{r}_{k}&= t_{k}(\vec{p}_{k-1}-\vec{p}_{k+1})&&\text{for }k=1,\hdots,n-1\\ + \vec{r}_{n}&= \vec{p}_{n} +\end{align*} +% +where $t_{k}$ $(k=1,\hdots,n)$ are real coefficients which are called +tension and which default to the value \Lkeyword{bcurveTension}=0.25. + +You can change the appearance of the curve by several modifiers. +First of all you can directly set the left and right control points +via the modifiers \Lnotation{l}\Largr{\CAny} and \Lnotation{r}\Largr{\CAny}, resp., as +shown in the next two examples. The unmodified curve is drawn in the +background in {\color{blue}blue} color. + + + +\begin{LTXexample} +\pspicture[showgrid](0,-0.4)(5,3) +\psset{showpoints} +\psbcurve[linecolor=blue,linewidth=0.01](1,1)% + (2,2)(3,1)(4,2) +\psbcurve(1,1)l(2,1)(2,2)(3,1)r(4,1)(4,2) +\uput[-90](2,1){$\vec{l}_{1}$} +\uput[-90](4,1){$\vec{r}_{3}$} +\endpspicture +\end{LTXexample} + +\begin{LTXexample} +\pspicture[showgrid](0,-0.4)(5,3) +\psset{showpoints} +\psbcurve[linecolor=blue,linewidth=0.01](1,1)% + (2,2)(3,1)(4,2) +\psbcurve(1,1)(2,2)l(2,1)(3,1)(4,2) +\uput[-90](2,1){$\vec{l}_{2}$} +\endpspicture +\end{LTXexample} + + +On the right hand side the last example is shown once more without grid and +with \Lkeyset{showpoints=false}. There, you see that there is a corner at the second +interpolation point. + + +\begin{LTXexample} +\pspicture(0,-0.4)(5,3) +\psbcurve(1,1)(2,2)l(2,1)(3,1)(4,2) +\endpspicture +\end{LTXexample} + +If you change some left control point $\vec{l}_{k}$ with the help of the +\Lnotation{L}\Largr{\CAny} modifier then the control point +$\vec{r}_{k-1}$ is set symmetrically to $\vec{l}_{k}$ with respect to the +interpolation point $\vec{p}_{k-1}$. In that way you get a smooth joint as +demonstrated in the next example. + +\begin{LTXexample} +\pspicture[showgrid](0,-0.4)(5,3) +\psbcurve[linecolor=blue,linewidth=0.01](1,1)% + (2,2)(3,1)(4,2) +\psset{showpoints} +\psbcurve(1,1)(2,2)L(2,1)(3,1)(4,2) +\uput[-90](2,1){$\vec{l}_{2}$} +\uput[0](2,2){$\vec{p}_{1}$} +\uput[0](2,3){$\vec{r}_{1}$} +\endpspicture +\end{LTXexample} + +With the \Lnotation{t}\Largb{t} modifier you can change the tension of the +automatically computed control points of the current Bezier spline. + + +\begin{LTXexample} +\pspicture[showgrid](0,-0.4)(5,3) +\psset{showpoints} +\psbcurve[linecolor=blue,linewidth=0.01](1,1)% + (2,2)(3,1)(4,2) +\psbcurve(1,1)(2,2)t{0.5}(3,1)(4,2) +\endpspicture +\end{LTXexample} + + +As you can see from the example both control points of the current +spline are affected by the \Lnotation{t}\Largb{t} modifier. +If you want to change the tension of just the left or right control +point you can use the \Lnotation{tl}\Largb{t} or \Lnotation{tr}\Largb{t} modifier, +respectively, as demonstrated in the following two examples. + +\begin{LTXexample} +\pspicture[showgrid](0,-0.4)(5,3) +\psset{showpoints} +\psbcurve[linecolor=blue,linewidth=0.01](1,1)% + (2,2)(3,1)(4,2) +\psbcurve(1,1)% + (2,2)tl{0.5}(3,1)(4,2) +\endpspicture +\end{LTXexample} + + +\begin{LTXexample} +\pspicture[showgrid](0,-0.4)(5,3) +\psset{showpoints} +\psbcurve[linecolor=blue,linewidth=0.01](1,1)% + (2,2)(3,1)(4,2) +\psbcurve(1,1)(2,2)tr{0.5}(3,1)(4,2) +\endpspicture +\end{LTXexample} + + +The \Lnotation{ts}\Largb{t} modifier changes the tension of the left and right +control points next to the interpolation point which stands in front +of the modifier. In the next example a negative tension value leads to +a rather surprising effect. + +\begin{LTXexample} +\pspicture[showgrid](0,-0.4)(5,3) +\psset{showpoints} +\psbcurve[linecolor=blue,linewidth=0.01](1,1)% + (2,2)(3,1)(4,2) +\psbcurve(1,1)(2,2)ts{-0.5}(3,1)(4,2) +\endpspicture +\end{LTXexample} + +The default value of the tension can be set with the option +\Lkeyword{bcurveTension} as in the following example. + + +\begin{LTXexample} +\pspicture[showgrid](0,-0.4)(5,3) +\psset{showpoints} +\psbcurve[linecolor=blue,linewidth=0.01](1,1)% + (2,2)(3,1)(4,2) +\psbcurve[bcurveTension=0.5](1,1)% + (2,2)(3,1)(4,2) +\endpspicture +\end{LTXexample} + +You can set this option also with the help of the \Lcs{psset} macro. +% +It is even possible to change the value of \Lkeyword{bcurveTension} in the +middle of a \Lcs{psbcurve}. Just use the modifier \Lnotation{T}\Largb{t} for +that purpose as shown in the following example. + +\begin{LTXexample} +\pspicture[showgrid](0,0.6)(5,6) +\psset{showpoints} +\psbcurve[linecolor=blue,linewidth=0.01](1,1)% + (2,2)(3,1)(4,2)(4,4)(3,5)% + (2,4)(1,5) +\psbcurve(1,1)(2,2)(3,1)(4,2)% + T{0.5}(4,4)(3,5)(2,4)(1,5) +\endpspicture +\end{LTXexample} + +Certainly, you can use the \Lnotation{T}\Largb{t} modifier several times in one +curve. (Try it for yourself.) +% +The \texttt{linestyle} and \texttt{fillstyle} options (and several +more) are respected by \Lcs{psbcurve} as the following example shows. + +\begin{LTXexample} +\pspicture[showgrid](0,-0.4)(5,3) +\psbcurve[linestyle=dashed, + linewidth=3pt, + dash=0.5 0.2, + fillstyle=solid, + fillcolor=blue](1,1)(2,2)(3,1)(4,2) +\endpspicture +\end{LTXexample} + +\subsection{Things that do not work (`known bugs')} +As already mentioned this project is something like an experiment. So, +there are many things that do not work. + +\begin{itemize} +\item new lines inside the argument list are not ignored. +\item The control points are computed in a rather crude way (see + above). The \Lkeyword{curvature} option is not recognised. +\item If \Lkeyword{fillstyle} is set to \Lkeyword{solid} and + \Lkeyword{showpoints} then the fill color covers the interpolation and control points. +\item arrow heads do not work. +\end{itemize} + +\clearpage + +\section{Bezier curve with weighted points} + +\subsection{Mathemathical background} + +A mass point is a weighted point $\left(P;\omega\right)$ with $\omega \neq 0$ or a vector $\left(\overrightarrow{P};0\right)$ with a weight equal to $0$. A generic mass point is noted $\left(P;\omega\right)$. + +Using the quadratic Bernstein polynomials, a rational quadratic B\'ezier curve having three control +mass points $\left(P_{0};\omega_{0}\right)$, $\left(P_{1};\omega_{1}\right)$ +and $\left(P_{2};\omega_{2}\right)$, is defined as follow: + +\begin{definition}\label{fdef::DefRQBC_Fiorot}: Rational quadratic B\'ezier curve (BR curve) + +Let $\omega_{0}$, $\omega_{1}$ and $\omega_{2}$ be three real numbers. +Let $\left(P_{0};\omega_{0}\right)$, $\left(P_{1};\omega_{1}\right)$ +and $\left(P_{2};\omega_{2}\right)$ be three mass points, these points are not collinear. + +Define two sets $I = \left \{ i | \omega_i \neq 0 \right \}$ and +$J = \left \{ i | \omega_i = 0 \right \}$ + + +Define the function $\omega_{f}$ from $\left[0;1\right] $ to $\mathbb{R} $ as follows + +\begin{equation} +%\begin{array}{cccc} +%\omega_{f}: & \left[0;1\right] & \longrightarrow & \mathbb{R} \\ +%& t & \longmapsto &\omega_{f}\left(t\right)=\dy\sum_{i\in I}\omega_{i}\times B_{i}\left(t\right) +%\end{array} +\omega_{f}\left(t\right)=\dy\sum_{i\in I}\omega_{i}\times B_{i}\left(t\right) +\label{eq:DenominateurCbreBezier} +\end{equation} + +A mass point $\left(M;\omega\right)$ or $\left(\overrightarrow{u};0\right)$ +belongs to the quadratic B\'ezier curve defined by the three control +mass points $\left(P_{0};\omega_{0}\right)$, $\left(P_{1};\omega_{1}\right)$ +and $\left(P_{2};\omega_{2}\right)$, +if there is a real $t_{0}$ in $\left[0;1\right]$ such that: + +\begin{itemize} +\item [$\bullet$] if $\omega_{f}\left(t_{0}\right)\neq0$ then we have + +\hspace*{-0.75cm}\begin{minipage}{1.0\textwidth} +\begin{equation} +\overrightarrow{OM} = \dy \frac{1}{\omega_{f}\left(t_{0}\right)}\left(\dy \sum_{i\in I} \dy \omega_{i} B_{i}\left(t_{0}\right) + \overrightarrow{OP_{i}} \right) ++\vspace{0.2cm}\dy \frac{1}{\omega_{f}\left(t_{0}\right)}\left( \sum_{i\in J} B_{i}\left(t_{0}\right) \overrightarrow{P_{i}}\right) +\label{eq:DefRQBC_FiorotPoint} +\end{equation} +\end{minipage} + +\item [$\bullet$] if $\omega_{f}\left(t_{0}\right)=0$ then we have +\begin{equation} +\overrightarrow{u}=\sum_{i\in I}\omega_{i}B_{i}\left(t_{0}\right)\overrightarrow{OP_{i}}+\sum_{i\in J}B_{i}\left(t_{0}\right)\overrightarrow{P_{i}}\label{eq:DefRQBC_FiorotVecteur} +\end{equation} + +\end{itemize} +\hrulefill{}\end{definition} + +The reduced discriminant of the denominator $\omega_{f}\left(t_{0}\right)$ is +\begin{equation} +\Delta'=\omega_{1}^{2}-\omega_{2} \omega_{0}\label{eq:DiscrimantReduitCBRQnonStandard} +\end{equation} +and we can state the following fundamental result: +\begin{itemize} +\item[$\star$] +if $\omega_{1}^{2}-\omega_{2} \omega_{0}=0$ then the + denominator has one and only one root, the curve is a parabolic arc; +\item[$\star$] + if $\omega_{1}^{2}-\omega_{2} \omega_{0}>0$ then the + denominator has two distinct roots, the curve is a hyperbolic arc; +\item[$\star$] + if $\omega_{1}^{2}-\omega_{2} \omega_{0}<0$ then the + denominator does not vanish, the curve is an elliptical arc. +\end{itemize} + +We can note w.l.o.g.\footnote{We can permute the role of $P_0$ and $P_2$} that one of the weights can be equal to~$1$. If $\omega_0$ is not equal to $0$, we choose $\omega_0=1$, else, we choose $\omega_1=1$, and we can characterise the type of the conic from the mass points of the BR curve, see Table~\ref{tab::TypeConicEtcbeBr}. + +\begin{table}[!h] +\begin{center} +\begin{tabular}{|c||c|c|c|}\hline +Conic & Three weighted points & Points and vectors \\ \hline \hline +Parabola & $\left(P_{0};1\right)$, $\left(P_{1};\omega\right)$ + $\left(P_{2};\omega^{2}\right)$ & $\left(P_{0};1\right)$, $\left(\overrightarrow{P_{1}};0\right)^{\mathstrut^{\mathstrut}}_{\mathstrut_{\mathstrut}}$ $\left(\overrightarrow{P_{2}};0\right)$\\ \hline \hline + Ellipse & $\left(P_{0};1\right)$, $\left(P_{1};\omega_{1}\right)$, $\left(P_{2};\omega_{2}\right)$, $ \omega_{2}>\omega_{1}^{2} $ & $\left(P_{0};1\right)$, $\left(\overrightarrow{P_{1}};0\right)^{\mathstrut^{\mathstrut}}_{\mathstrut_{\mathstrut}}$ $\left(P_{2};1\right)$ \\ \hline \hline + Hyperbola & $\left(P_{0};1\right)$, $\left(P_{1};\omega_{1}\right)$ $\left(P_{2};\omega_{2}\right)$, $\omega_{2}<\omega_{1}^{2}$ & $\left(P_{0};1\right)$, $\left(\overrightarrow{P_{1}};0\right)^{\mathstrut^{\mathstrut}}_{\mathstrut_{\mathstrut}}$ $\left(P_{2};-1\right)$ \\ \cline{3-3} +& & $\left(\overrightarrow{P_{0}};0\right)$, $\left(P_{1};1\right)$ and $\left(\overrightarrow{P_{2}};0\right)^{\mathstrut^{\mathstrut}}_{\mathstrut_{\mathstrut}}$ \\ \hline \hline +\end{tabular} +\end{center} +\caption{Types of conics defined by B\'ezier curves with control mass points. +\hrulefill{} +\label{tab::TypeConicEtcbeBr}} +\end{table} + +From the access rights used by Unix and Linux, we define a bijection $f$ between $\mathbb{F_2}^3-\left\lbrace\left(0,0,0\right)\right\rbrace$ and the set $\left\lbrace 1 ,2 , 3, 4, 5, 6, 7\right\rbrace$. From $\left(\omega_2,\omega_1,\omega_0\right)$, we define a triplet $\left(b_2,b_1,b_0\right)$ as follow: if $w_i\neq0$ then $b_i=1$ else $b_i=0$. Then +$$f\left(\omega_2,\omega_1,\omega_0\right)= b_2 \times 4+ b_1 \times 2+b_0$$ + +If $f\left(\omega_2,\omega_1,\omega_0\right)=7$, the control points are weighted points: the curve is an elliptical arc, a parabolic arc or a hyperbolic arc. If $\left(\omega_2,\omega_1,\omega_0\right)=\left(1,-1,1\right)$, the parabolic arc is not bounded and for $t=\frac{1}{2}$, the mass point is a direction vector of the parabola axis. If $\left(\omega_2,\omega_1,\omega_0\right)=\left(1,-2,1\right)$, the hyperbolic arc is not bounded and there exists $t$ in $\left]0,1\right[$ such as the mass point is a direction vector of one of the asymptotes of the hyperbola. \\ +If $f\left(\omega_2,\omega_1,\omega_0\right)=1$, the first control point is a weighted point, the others are vectors: the curve is a parabolic arc. The B\'ezier curve is defined by + \begin{equation} +\begin{cases} + \dy \frac{1}{\omega_0\, B_0\left(t_{0}\right)}\left( \omega_{0}\, B_{0}\left(t_{0}\right) + \overrightarrow{OP_{0}} + B_{1}\left(t_{0}\right) \overrightarrow{P_{1}}+ B_{2}\left(t_{0}\right) + \overrightarrow{P_{2}}\right) & \text{ if }t_0\in\left[0,1\right[ \\[1ex] +\overrightarrow{P_2} & \text{ if }t_0=1\\ + \end{cases} +\label{eq:parabola} +\end{equation} +If $f\left(\omega_2,\omega_1,\omega_0\right)=4$, the B\'ezier curve can be defined in the same way.\\ +If $f\left(\omega_2,\omega_1,\omega_0\right)=2$, the intermediate control point is a weighted point, the others are vectors: the curve is a branch of a hyperbola. The B\'ezier curve is defined by + \begin{equation} +\begin{cases} + \dy \frac{1}{\omega_1\, B_1\left(t_{0}\right)}\left( \omega_{1}\, B_{1}\left(t_{0}\right) \overrightarrow{OP_{1}}+ B_{0}\left(t_{0}\right) \overrightarrow{P_{0}}+ B_{2}\left(t_{0}\right) \overrightarrow{P_{2}}\right) & \text{ if }t_0\in\left]0,1\right[ +\\[1ex] +\overrightarrow{P_0} & \text{ if }t_0=0\\[1ex] +\overrightarrow{P_2} & \text{ if }t_0=1 + \end{cases} +\label{eq:branchHyperbola} +\end{equation} +and the centre of the hyperbola is $P_1$. The vector $\overrightarrow{P_0}$ is a direction vector of an asymptote of the hyperbola whereas the vector $\overrightarrow{P_2}$ is a direction vector of the other asymptote.\\ +If $f\left(\omega_2,\omega_1,\omega_0\right)=5$, the intermediate control point is a vector, the others are weighted points: the curve is an elliptical arc. The B\'ezier curve is defined by + \begin{equation} + \dy \frac{1}{\omega_0\, B_0\left(t_{0}\right)+\omega_2\, B_2\left(t_{0}\right)}\left( \omega_{0}\, B_{0}\left(t_{0}\right) \overrightarrow{OP_{0}} + B_{1}\left(t_{0}\right) \overrightarrow{P_{1}}+ \omega_2\, B_{2}\left(t_{0}\right) \overrightarrow{OP_{2}}\right),\;\; t_0\in\left[0,1\right] +\label{eq:ellipse} +\end{equation} +and the tangent vector to the curve at $P_0$ or $P_2$ is parallel to $\overrightarrow{P_1}$. + +\subsection{Syntax} + +\begin{BDef} +\Lcs{psRQBCmasse}\OptArgs\Largr{$x_0,y_0$}\Largr{$x_1,y_1$}\Largr{$x_2,y_2$}\Largb{$w_0,w_1,w_2$} +\end{BDef} + +For the coordinates of the points all possible kinds of coordinates are possible, like polar, PostScript, nodes, \ldots + +\subsection{Three weighted orthogonal points} +\begin{LTXexample}[pos=t] +\begin{pspicture}[showgrid](-6,-6.4)(3,3) +\psclip{\psframe(-6,-6)(3,3)} + \psRQBCmasse[linecolor=blue](2,0)(2,2)(0,2){1,-1,1} + \psRQBCmasse[linecolor=navy,autoTrace](2,0)(2,2)(0,2){1,1,1} + \rput(P0){$P_0$}\uput[r](P1){$P_1$}\uput[r](P2){$P_2$} +\endpsclip% +\end{pspicture} +\end{LTXexample} + + + +\subsection{Half-ellipse} +\begin{LTXexample}[pos=t] +\begin{pspicture}[showgrid](-3,-2.4)(3,2) +\psframe(-3,-2)(3,2) +\psRQBCmasse[linecolor=red,autoTrace](2,0)(0,1)(-2,0){1,0,1} +\uput[r](P0P1){$\overrightarrow{P_1}$} \uput[r](P2){$P_2$} +\rput(P1P2){$\overrightarrow{P_{1}}$} \uput[r](P0){$P_0$} +\psRQBCmasse[linecolor=orange,autoTrace=false](2,0)(0,-1)(-2,0){1,0,1} +\end{pspicture} +\end{LTXexample} + + +\clearpage + +\subsection{Half-parabola} +\subsubsection{Point $P_2$ and two vectors} + +\begin{LTXexample}[pos=t] +\begin{pspicture}[showgrid](-3,-3.4)(3,3) +\psclip{\psframe(-3,-3)(3,3)} + \psRQBCmasse[linecolor=red,autoTrace](2,0)(0,1)(-1,0){0,0,1} + \uput[r](P1P2){$\overrightarrow{P_1}$} \uput[r](P2){$P_2$} + \uput[r](P0P2){$\overrightarrow{P_0}$} + \psRQBCmasse[linecolor=orange,autoTrace=false](2,0)(0,-1)(-1,0){0,0,1} + \uput[r](P1P2){$\overrightarrow{P_1}$} \uput[r](P2){$P_2$} + \uput[r](P0P2){$\overrightarrow{P_0}$} +\endpsclip +\end{pspicture} +\end{LTXexample} + +\subsubsection{Point $P_0$ and two vectors} + +\begin{LTXexample}[pos=t] +\begin{pspicture}[showgrid](-3,-3.4)(3,3) +\psclip{\psframe(-3,-3)(3,3)} + \psRQBCmasse[linecolor=red,autoTrace](2,0)(0,1)(-1,0){1,0,0} + \uput[r](P0P1){$\overrightarrow{P_1}$} \uput[r](P0){$P_0$} + \uput[r](P0P2){$\overrightarrow{P_2}$} + \psRQBCmasse[linecolor=orange,autoTrace=false](2,0)(0,-1)(-1,0){1,0,0} +\endpsclip% +\end{pspicture} +\end{LTXexample} + +\clearpage + +\subsection{Branch of a hyperbola} +\begin{LTXexample}[pos=t] +\begin{pspicture}[showgrid](-3,-3.4)(3,3) +\psclip{\psframe(-3,-3)(3,3)} + \psRQBCmasse[linecolor=red,autoTrace](1,1)(0,0)(-1,1){0,1,0} + \uput[r](P0){$\overrightarrow{P_0}$} \uput[r](0,-0.5){$P_1$} + \uput[r](P2){$\overrightarrow{P_2}$} + \psRQBCmasse[linecolor=orange,autoTrace=false](1,1)(0,0)(-1,1){0,-1,0} +\endpsclip% +\end{pspicture} +\end{LTXexample} + +\subsection{Parabola} +\begin{LTXexample}[pos=t] +\psset{unit=0.5} +\begin{pspicture}(-14,-3.4)(15,10) +\psclip{\psframe(-14,-3)(15,10)} + \psRQBCmasse[linecolor=red,autoTrace](0,6)(-13,0)(-1,-1){1,1,1} + \psRQBCmasse[linecolor=orange](0,6)(-13,0)(-1,-1){1,-1,1} + \uput[u](P0){$P_0$}\uput[l](P1){$P_1$}\uput[d](P2){$P_2$} +\endpsclip +\end{pspicture} +\end{LTXexample} + + +\clearpage + +\subsection{Ellipse} +\begin{LTXexample}[pos=t] +\psset{unit=0.5} +\begin{pspicture}(-14,-3.4)(15,10) +\psgrid[subgriddiv=0,gridcolor=lightgray,griddots=5,gridlabels=0pt] +%\psplotImp[linewidth=0.5pt,linecolor=blue,algebraic](-6,-3)(15,10)% + %{ -0.044*x^2-0.161*y^2 + 0.075*x*y + 0.074*x + 0.797*y + 1} +\psRQBCmasse[nPoints=20,autoTrace,showpoints](0,6)(-13,0)(-1,-1){1,0.5,1} +\psRQBCmasse[nPoints=40,linecolor=red,showpoints](0,6)(-13,0)(-1,-1){1,-0.5,1} +\psaxes[labelFontSize=\scriptscriptstyle]{->}(0,0)(-14,-3)(15,10) +\end{pspicture} +\end{LTXexample} + + +\subsection{Complete circle} +\begin{LTXexample}[pos=t] +\psset{unit=1} +\begin{pspicture}(-4,-4.4)(4,4) +\psgrid[subgriddiv=0,gridcolor=lightgray,griddots=5,gridlabels=0pt] +\psRQBCmasse[autoTrace](0,3)(3,3)(3,0){1,1,2} +\psRQBCmasse[linecolor=red](0,3)(3,3)(3,0){1,-1,2} +\psaxes[labelFontSize=\scriptscriptstyle]{->}(0,0)(-4,-4)(4,4) +\end{pspicture} +\end{LTXexample} + + +\begin{LTXexample}[pos=t] +\psset{unit=1.5} +\begin{pspicture}(-4,-4.4)(4,4) +\psgrid[subgriddiv=0,gridcolor=lightgray,griddots=5,gridlabels=0pt] +\psRQBCmasse[autoTrace](0,3)(3,0)(0,-3){1,0,1} +\uput[u](-0.25,3){$P_0$} +\uput[u](-0.25,-3.5){$P_2$} +\uput[u](3,3){$\overrightarrow{P_1}$} +\uput[u](3,-3.5){$\overrightarrow{P_1}$} +\uput[u](2.5,0){$\overrightarrow{P_1}$} +\psRQBCmasse[linecolor=red](0,3)(-3,0)(0,-3){1,0,1} +\psaxes[labelFontSize=\scriptscriptstyle,linewidth=0.01]{->}(0,0)(-4,-4)(4,4) +\end{pspicture} +\end{LTXexample} +We get a circle because we have + +\begin{equation} +\left\lbrace +\begin{array}{rcl} +\omega_0\times\omega_2\times P_0 P_2^2 &= &4\times\overrightarrow{P_1}^2 \\[0.2cm] +\overrightarrow{P_0 P_2} &\perp & \overrightarrow{P_1} +\end{array} +\right. +\end{equation} + +\clearpage + + +\subsection{Animations} + +\subsubsection{$w_0=1$, $w_2=1$ and a variable $w_1$} + +With the beginning of $w_1=0$ +the curves are swapped. In the case of Bezier curves $w_1 = 0$ gives only +the $[P_0 P_2]$ segment. Using the mass points, the point $P_1$ no longer exists but we get the vector $\overrightarrow{P_1}$. + + +\bigskip +\begin{center} +\begin{animateinline}[controls,loop,palindrome, + begin={\begin{pspicture}(-4,-4)(10,4)}, + end={\end{pspicture}}]{3}% 3 images/s +\multiframe{40}{rA=2.0+-0.1,rB=-2.0+0.1}{% + \psgrid[subgriddiv=0,gridcolor=lightgray,griddots=5,gridlabels=0pt] + \psclip{\psframe(-4,-4)(10,4)} + \psRQBCmasse[autoTrace,linewidth=1.5pt](0,-1)(1,0)(0,1){1,\rA,1} + \uput[u](P2){$P_2$}\uput[l](P1){$P_1$}\uput[d](P0){$P_0$} + \psRQBCmasse[linecolor=red,linewidth=1.5pt](0,-1)(1,0)(0,1){1,\rB,1} + \psaxes[labelFontSize=\scriptscriptstyle,linewidth=0.01]{->}(0,0)(-4,-4)(10,4) + \rput(8,3){$w_1=\rA$}% + \endpsclip +} +\end{animateinline} +\end{center} + +\begin{lstlisting} +\begin{animateinline}[controls,loop,palindrome, + begin={\begin{pspicture}(-4,-4)(10,4)}, + end={\end{pspicture}}]{3}% 3 images/s +\multiframe{40}{rA=2.0+-0.1,rB=-2.0+0.1}{% + \psgrid[subgriddiv=0,gridcolor=lightgray,griddots=5,gridlabels=0pt] + \psclip{\psframe(-4,-4)(10,4)} + \psRQBCmasse[autoTrace,linewidth=1.5pt](0,-1)(1,0)(0,1){1,\rA,1} + \uput[u](P2){$P_2$}\uput[l](P1){$P_1$}\uput[d](P0){$P_0$} + \psRQBCmasse[linecolor=red,linewidth=1.5pt](0,-1)(1,0)(0,1){1,\rB,1} + \psaxes[labelFontSize=\scriptscriptstyle,linewidth=0.01]{->}(0,0)(-4,-4)(10,4) + \rput(8,3){$w_1=\rA$}% + \endpsclip +} +\end{animateinline} +\end{lstlisting} + + + +\clearpage + +\subsubsection{$w_0=1$, $\left |w_1\right|=1$ and a variable $w_2$} + +%L'utilisation de $\left |w_1\right|$ permet d'obtenir les deux arcs et donc toute la conique. +The use of $\left |w_1\right|$ provides both arcs and the whole cone. + +\bigskip +\begin{center} +\begin{animateinline}[controls,loop,palindrome, + begin={\begin{pspicture}(-8,-4)(4,4)}, + end={\end{pspicture}}]{3}% 3 images/s +\multiframe{80}{rA=4.0+-0.1}{% + \psgrid[subgriddiv=0,gridcolor=lightgray,griddots=5,gridlabels=0pt] + \psclip{\psframe(-8,-4)(4,4)} + \psRQBCmasse[autoTrace,linewidth=1.5pt](0,-1)(1,0)(0,1){1,1,\rA} + \uput[u](P2){$P_2$}\uput[l](P1){$P_1$}\uput[d](P0){$P_0$} + \psRQBCmasse[linecolor=red,linewidth=1.5pt](0,-1)(1,0)(0,1){1,-1,\rA} + \psaxes[labelFontSize=\scriptscriptstyle,linewidth=0.01]{->}(0,0)(-8,-4)(4,4) + \rput[rb](3.5,3){$w_2=\rA$}% + \endpsclip +} +\end{animateinline} +\end{center} + +\begin{lstlisting} +\begin{animateinline}[controls,loop,palindrome, + begin={\begin{pspicture}(-8,-4)(4,4)}, + end={\end{pspicture}}]{3}% 3 images/s +\multiframe{80}{rA=4.0+-0.1}{% + \psgrid[subgriddiv=0,gridcolor=lightgray,griddots=5,gridlabels=0pt] + \psclip{\psframe(-8,-4)(4,4)} + \psRQBCmasse[autoTrace,linewidth=1.5pt](0,-1)(1,0)(0,1){1,1,\rA} + \uput[u](P2){$P_2$}\uput[l](P1){$P_1$}\uput[d](P0){$P_0$} + \psRQBCmasse[linecolor=red,linewidth=1.5pt](0,-1)(1,0)(0,1){1,-1,\rA} + \psaxes[labelFontSize=\scriptscriptstyle,linewidth=0.01]{->}(0,0)(-8,-4)(4,4) + \rput[rb](3.5,3){$w_2=\rA$}% + \endpsclip +} +\end{animateinline} +\end{lstlisting} + + +\clearpage + + +\section{List of all optional arguments for \texttt{pst-bezier}} + +\xkvview{family=pst-bezier,columns={key,type,default}} + + +\bgroup +\raggedright +\nocite{*} +\printbibliography +\egroup + +\printindex +\end{document} + + + + +Moreover, we can choose a non Euclidean metric. The use of mass points, Bézier curves, conics and the space of spheres in the Minkowski-Lorentz space permits to realise G1-continous blend between Dupin cyclides : to blend surfaces in R3, we blend Bézier curves in R5. For example, we can build a seahorse (see 09_LorentzHippocampeComplet.png), the article (in French) is here: diff --git a/graphics/pstricks/contrib/pst-bezier/dvips/pst-bezier.pro b/graphics/pstricks/contrib/pst-bezier/dvips/pst-bezier.pro new file mode 100644 index 0000000000..72980006e2 --- /dev/null +++ b/graphics/pstricks/contrib/pst-bezier/dvips/pst-bezier.pro @@ -0,0 +1,236 @@ +%% $Id: pst-bezier.pro 323 2016-08-20 17:57:28Z herbert $ +%% PostScript prologue for pst-bezier.tex. +%% +%% Version 0.02, 2016/08/19 +%% +%% For distribution, see pst-bezier.tex. +%% +%% +tx@Dict begin +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Auxiliary routines: +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +%% [x1 y1] [x2 y2] -> [ x1+y1 x2+y2 ] +/AddArrays2d { + [ 3 1 roll %% Get the operands + 2 copy + 0 get exch + 0 get add %% first component finished + %% second component: + 3 1 roll + 1 get exch + 1 get add ]} bind def + +%% [x1 y1] [x2 y2] -> [ x1-x2 y1-y2 ] +/SubArrays2d { + [ 3 1 roll exch + 2 copy + 0 get exch 0 get sub + 3 1 roll + 1 get exch + 1 get sub ] } bind def + +%% [x y] s -> [s*x s*y] +/ScaleArray2d { + [ 3 1 roll exch + 2 copy + 0 get mul + 3 1 roll + 1 get mul + ] } bind def +% +%% << [Array of Bezier splines] /K 1 >> -> empty stack +%% Thereby, a Bezier spline is described by an array: +%% [x0 y0 x1 y1 x2 y2 x3 y3 sl sr] +%% (x0,y0) is the right control point +/pstBCurve { +begin %% LaTeX provides the dictionary (see above comments) + 1 1 Splines length 1 sub { + /K exch def % K is the index of the spline. +%% + %% First control point: + Splines K get 0 get dup %% switch the cases /n and /s... + /n eq { %% `not specified' -> automatically computed + Splines K get 0 %% l(k) is going to be set... + %% | -> p(k-1)+(p(k)-p(k-2))*sl(k) + Splines K get 4 2 getinterval + Splines K 2 sub get 4 2 getinterval + SubArrays2d + Splines K get 6 get ScaleArray2d + Splines K 1 sub get 4 2 getinterval + AddArrays2d + putinterval %% ...setting l(k) + } if + /s eq { %% `symmetric' -> compute from r(k-1) + Splines K get 0 %% l(k):= + %% | -> 2*p(k-1)-r(k-1) + Splines K 1 sub get 4 2 getinterval 2 ScaleArray2d + Splines K 1 sub get 2 2 getinterval SubArrays2d + putinterval %% + } if + %% Second control point: + Splines K get 2 get dup %% (cases /n and /s) + /n eq { %% `not specified' -> automatically computed + Splines K get 2 + %% | -> p(k)+(p(k+1)-p(k-1))*sr(k) + Splines K 1 sub get 4 2 getinterval + Splines K 1 add get 4 2 getinterval + SubArrays2d + Splines K get 7 get ScaleArray2d + Splines K get 4 2 getinterval + AddArrays2d + putinterval + } if + /s eq { %% `symmetric' -> compute from l(k+1) + Splines K get 2 + %% | -> 2*p(k)-l(k+1) + Splines K get 4 2 getinterval 2 ScaleArray2d + Splines K 1 add get 0 2 getinterval SubArrays2d + putinterval + } if + } for %% all splines. + %% + %% The current point is already correctly set by the LaTeX macro. + %% So get ride of the 0th dummy spline. + Splines 1 Splines length 1 sub getinterval {% + aload pop pop pop %% get ride of the array itself and the scaling factor. + curveto% now the actual spline is on the stack... + } forall %% splines. + /Points [ %% now save the points for the showpoints-feature. + Splines 0 get 4 2 getinterval aload pop + Splines 1 Splines length 1 sub getinterval { aload pop pop pop } forall + ] + end def %% Put points in the top dictionary + } bind def +% +/tx@RQBCmasse { + /P0P1{ + xP0 xP1 add + yP0 yP1 add + } def + /P0P2{ + xP0 xP2 add + yP0 yP2 add + } def + /P1P2{ + xP2 xP1 add + yP2 yP1 add + } def + /B0 { 1 t sub dup mul } def + /B1 {2 t mul 1 t sub mul }def + /B2 { t dup mul }def +% +% w0 abs 1e-6 gt {1}{0} ifelse /choixw0 exch def +% w1 abs 1e-6 gt {1}{0} ifelse /choixw1 exch def +% w2 abs 1e-6 gt {1}{0} ifelse /choixw2 exch def +% /choix choixw2 4 mul choixw1 2 mul add choixw0 add def + choix 1 eq { + /den { w0 B0 mul }def % + /RQBCmasse1 { + 0 1 nB {/t exch nB div def + den 0 ne { + w0 B0 mul xP0 mul B1 xP1 mul add B2 xP2 mul add den div + w0 B0 mul yP0 mul B1 yP1 mul add B2 yP2 mul add den div + } if + } for + } def + /RQBCmasse2 {} def + } if % fin choix 1 + choix 2 eq { + /den {w1 B1 mul } def % + /RQBCmasse1 { + 1 1 nB {/t exch nB div def + den 0 ne {% B0*P0+w1*B1*P1+B2*P2 + B0 xP0 mul w1 B1 mul xP1 mul add B2 xP2 mul add den div + B0 yP0 mul w1 B1 mul yP1 mul add B2 yP2 mul add den div + } if + } for + } def + /RQBCmasse2 {} def + } if % fin choix 2 + choix 3 eq { + /den { w0 B0 mul w1 B1 mul add } def % w0*B0+w1*B1 + /RQBCmasse1 { + 0 1 nB {/t exch nB div def + den 1e-6 gt { % w0*B0*P0+w1*B1*P1+B2*P2 + w0 B0 mul xP0 mul w1 B1 mul xP1 mul add B2 xP2 mul add den div + w0 B0 mul yP0 mul w1 B1 mul yP1 mul add B2 yP2 mul add den div + } if + } for + } def + /RQBCmasse2 { + 0 1 nB {/t exch nB div def + den -1e-6 lt { % w0*B0*P0+w1*B1*P1+B2*P2 + w0 B0 mul xP0 mul w1 B1 mul xP1 mul add B2 xP2 mul add den div + w0 B0 mul yP0 mul w1 B1 mul yP1 mul add B2 yP2 mul add den div + } if + } for + } def + } if % fin choix 3 + choix 4 eq { + /den { w2 B2 mul } def % w2*B2 + /RQBCmasse1 { + 0 1 nB {/t exch nB div def + den 0 ne { % B0*P0+B1*P1+w2*B2*P2 + B0 xP0 mul B1 xP1 mul add w2 B2 mul xP2 mul add den div + B0 yP0 mul B1 yP1 mul add w2 B2 mul yP2 mul add den div + } if + } for + } def + /RQBCmasse2 {} def + } if % fin choix 4 + choix 5 eq { + /den {w0 B0 mul w2 B2 mul add} def % w0*B0+w2*B2 + /RQBCmasse1 { + 1 1 nB {/t exch nB div def + den 0 ne { % w0*B0*P0+B1*P1+w2*B2*P2 + w0 B0 mul xP0 mul B1 xP1 mul add w2 B2 mul xP2 mul add den div + w0 B0 mul yP0 mul B1 yP1 mul add w2 B2 mul yP2 mul add den div + } if + } for + } def + /RQBCmasse2 {} def + } if % fin choix 5 + choix 6 eq { + /den { w1 B1 mul w2 B2 mul add } def % w1*B1+w2*B2 + /RQBCmasse1 { + 0 1 nB {/t exch nB div def + den 1e-6 gt { % B0*P0+w1*B1*P1+w2*B2*P2 + B0 xP0 mul w1 B1 mul xP1 mul add w2 B2 mul xP2 mul add den div + B0 yP0 mul w1 B1 mul yP1 mul add w2 B2 mul yP2 mul add den div + } if + } for + } def + /RQBCmasse2 { + 0 1 nB {/t exch nB div def + den -1e-6 lt { % B0*P0+w1*B1*P1+w2*B2*P2 + B0 xP0 mul w1 B1 mul xP1 mul add w2 B2 mul xP2 mul add den div + B0 yP0 mul w1 B1 mul yP1 mul add w2 B2 mul yP2 mul add den div + } if + } for + } def + } if % fin choix 6 + choix 7 eq { + /den { w0 B0 mul w1 B1 mul add w2 B2 mul add } def +% tableau de pointslist[(w0-w1+sqrt(-w0*w2+w1^2))/(w0-2*w1+w2),(w0-w1-sqrt(-w0*w2+w1^2))/(w0-2*w1+w2)] + /RQBCmasse1 { + 0 1 nB {/t exch nB div def + den 1e-6 gt { % w0*B0*P0+w1*B1*P1+w2*B2*P2 + w0 B0 mul xP0 mul B1 w1 mul xP1 mul add w2 B2 mul xP2 mul add den div % xP + w0 B0 mul yP0 mul B1 w1 mul yP1 mul add w2 B2 mul yP2 mul add den div % yP + } if + } for + } def + /RQBCmasse2 { + 0 1 nB {/t exch nB div def + den -1e-6 lt { + w0 B0 mul xP0 mul B1 w1 mul xP1 mul add w2 B2 mul xP2 mul add den div % xP + w0 B0 mul yP0 mul B1 w1 mul yP1 mul add w2 B2 mul yP2 mul add den div % yP + } if + } for + } def + } if % fin du choix 7 +} def +% +end %% tx@Dict diff --git a/graphics/pstricks/contrib/pst-bezier/latex/pst-bezier.sty b/graphics/pstricks/contrib/pst-bezier/latex/pst-bezier.sty new file mode 100644 index 0000000000..7eac6b24ae --- /dev/null +++ b/graphics/pstricks/contrib/pst-bezier/latex/pst-bezier.sty @@ -0,0 +1,18 @@ +%% $Id: pst-bezier.sty 321 2016-08-20 07:45:01Z herbert $ +% +\RequirePackage{pstricks} +\RequirePackage{expl3} +\ExplSyntaxOn + \cs_new_eq:NN \pscalculate \fp_eval:n +\ExplSyntaxOff +% +\ProvidesPackage{pst-bezier}[2016/08/19 v. 0.02 package wrapper for + pst-bezier.tex (hv)] +\input{pst-bezier.tex} +\ProvidesFile{pst-bezier.tex} + [\filedate\space v\fileversion\space `PST-bezier' (tn,hv)] +\IfFileExists{pst-bezier.pro}{% + \ProvidesFile{pst-bezier.pro} + [2016/08/19 v. 0.02, PostScript prologue file (tn,hv)] + \@addtofilelist{pst-bezier.pro}}{}% +\endinput diff --git a/graphics/pstricks/contrib/pst-bezier/tex/pst-bezier.tex b/graphics/pstricks/contrib/pst-bezier/tex/pst-bezier.tex new file mode 100644 index 0000000000..5a3a236b8c --- /dev/null +++ b/graphics/pstricks/contrib/pst-bezier/tex/pst-bezier.tex @@ -0,0 +1,412 @@ +%% $Id: pst-bezier.tex 87 2009-01-29 10:37:06Z herbert $ +%% +%% This is file `pst-bezier.tex', +%% +%% IMPORTANT NOTICE: +%% +%% Package `pst-bezier.tex' +%% +%% Tobias Nähring (www.tn-home.de) (inactive) +%% Herbert Voss <hvoss@tug.org> +%% +%% This program can be redistributed and/or modified under the terms +%% of the LaTeX Project Public License Distributed from CTAN archives +%% in directory CTAN:/macros/latex/base/lppl.txt. +%% +%% DESCRIPTION: +%% `pst-bezier' is a PSTricks package to draw spline curves +%% +%% +\csname PSTbezierLoaded\endcsname +\let\PSTbezierLoaded\endinput + +\ifx\PSTricksLoaded\endinput\else\input pstricks.tex\fi +\ifx\PSTXKeyLoaded\endinput\else \input pst-xkey \fi +\ifx\PSTplotLoaded\endinput\else \input pst-plot \fi +\ifx\PSTnodesLoaded\endinput\else\input pst-node \fi + +\def\fileversion{0.03} +\def\filedate{2016/09/03} +\message{ v\fileversion, \filedate} + +\edef\TheAtCode{\the\catcode`\@}\catcode`\@=11 + +\pst@addfams{pst-bezier} + +%% We need this if we do not have LaTeX: +\expandafter\if\csname gobble\endcsname\relax\def\gobble#1{}\fi +%% +%% \newcommand is not native TeX. Therefore the following definition. +%%%%%%%%%%%% +%% \defopt defines a macro with one optional argument. +%% Syntax: +%% \defopt\MyNewMacro{DefaultValue}[#1]#2{StuffToBeAssignedToMyNewMacro} +%% where \myNewMacro, DefaultValue, and StuffToBeAssignedToMyNewMacro +%% have the obvious meaning. Instead of #2 up to #9 arguments can be +%% specified. +\def\defopt#1#2{% + \def\defopt@tmp##1{% + \expandafter\def\csname##1\endcsname{% + \def\defopt@tmp{\futurelet\defopt@arg}% + \expandafter\defopt@tmp\csname##1@opt\endcsname% + }% + \expandafter\def\csname##1@opt\endcsname{% + \if\defopt@arg[%] + \def\next{\csname##1@@opt\endcsname}% + \else% + \def\next{\csname##1@@opt\endcsname[#2]}% + \fi\next}% + }% + \edef\defopt@arg{\expandafter\gobble\string#1} + \expandafter\defopt@tmp\expandafter{\defopt@arg}% + \expandafter\def\csname\expandafter\gobble\string#1@@opt\endcsname% +} +%% The postscript part of pst-bezier: +\pstheader{pst-bezier.pro} + +%% A list of TeX-code fragments is generated when parsing \psbcurve. +%% The list is managed with the help of these two counters: +\newcount\psbcurve@codeCntrEnd +\newcount\psbcurve@codeCntr +%% These counters should never be set globally. +%% Also the code fragments should never be set globally. +%% The list entries are numberated (therefore the entries can be +%% accessed via \csname only). +%% E. g. for the third entry you have the following items: +%% \csname psbcurve@code3l\endcsname (the left control point) +%% \csname psbcurve@code3r\endcsname (the right control point) +%% \csname psbcurve@code3\endcsname (the interpolated point) +%% \csname psbcurve@code3sl\endcsname (the left scaling factor) +%% \csname psbcurve@code3sr\endcsname (the right scaling factor) +%% \csname psbcurve@code3addon\endcsname (additional code that is run at +%% first) +%% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Auxiliary macros for dealing +%% with the list TeX-code fragments +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Syntax: +%% \psbcurve@def[offset]{item}{TeXcode} +%% Where offset is some number (default:0), +%% and item is one of {l,r,sl,sr,addon}. +%% TeXcode will be assigned to the item of the list entry at +%% \psbcurve@codeCntrEnd + offset. +\defopt\psbcurve@def{0}[#1]#2{ + \psbcurve@codeCntr\psbcurve@codeCntrEnd + \advance\psbcurve@codeCntr by #1 + \expandafter\def\csname psbcurve@code\the\psbcurve@codeCntr#2\endcsname} + +%% Essentially the same as \psbcurve@def, but +%% the list item will only be set if it is undefined. +\defopt\psbcurve@defIfVoid{0}[#1]#2{ + \psbcurve@codeCntr\psbcurve@codeCntrEnd + \let\next\relax + \advance\psbcurve@codeCntr by #1 + \expandafter\ifx\csname % + psbcurve@code\the\psbcurve@codeCntr#2\endcsname\relax% + \def\next{\expandafter\def\csname % + psbcurve@code\the\psbcurve@codeCntr#2\endcsname}% + \fi\next} + +%% Essentially the same as \psbcurve@def (just \def replaced by \let): +\defopt\psbcurve@let{0}[#1]#2{ + \psbcurve@codeCntr\psbcurve@codeCntrEnd + \advance\psbcurve@codeCntr by #1 + \expandafter\let\csname psbcurve@code\the\psbcurve@codeCntr#2\endcsname} + +%% Syntax: +%% \psbcurve@letvar[offset]{item}\MyVarToBeSet +%% sets \MyVarToBeSet to the value of the list entry. +%% See the definition of \psbcurve@def for a description +%% of the list entry. +\defopt\psbcurve@letvar{0}[#1]#2#3{ + \psbcurve@codeCntr\psbcurve@codeCntrEnd + \advance\psbcurve@codeCntr by #1 + \def#3{\noexpand#3}% + \expandafter\let\expandafter#3\csname psbcurve@code\the\psbcurve@codeCntr#2\endcsname} + +%% Syntax: +%% \psbcurve@ifx[offset]{item}\MyVarToBeCompared +%% That is essentially an \ifx with the list item compared to +%% \MyVarToBeCompared. +\defopt\psbcurve@ifx{0}[#1]#2{ + \psbcurve@codeCntr\psbcurve@codeCntrEnd + \advance\psbcurve@codeCntr by #1 + \expandafter\ifx\csname psbcurve@code\the\psbcurve@codeCntr#2\endcsname} + +%% Syntax: +%% \psbcurve@get{item} +%% This expands to the macro corresponding to `item' from the +%% list entry at \psbcurve@codeCntr. +\def\psbcurve@get#1{\csname psbcurve@code\the\psbcurve@codeCntr#1\endcsname} + + +%% Auxiliary macros: +%%%%%%%%%%%%%%%%%%%%% +%% Multiple branching +%% Syntax: +%% \psbcurve@switch\ExpandingToKey{KeyI,\MacroI,KeyII,\MacroII,...and so on...} +%% If \ExpandingToKey expands to one of the keys KeyI, \KeyII, ... +%% the corresponding \MacroI, \MacroII, ..., resp. is called. +%% The key value \relax is special. Its corresponding \Macro is the +%% default action which is taken if none of the Keys matches. +\def\psbcurve@switch#1#2{% +\def\next##1,##2,##3|{% +\ifx#1##1\relax\def\next####1|{\let\next##2}\fi% +\ifx##1\relax\def\next####1|{\let\next##2}\fi% +\next##3|% +}% +\next#2,\relax,\relax,|\next} + +%% The user interface to psbcurve: +%% Usage: See description in pst-bezier-doc.tex. +%% The default value \relax for the optional argument indicates that +%% there are no optional arguments. +\defopt\psbcurve\relax[#1](#2){% + \bgroup% Makes optional pstricks-settings local to this \psbcurve call. + \ifx#1\relax\else% + \psset{#1}% + \fi% + \def\psbcurve@code{% + \moveto(#2)% + \code{ + << + /Splines [%] begin of the array of splines + [%] begin of the first dummy spline (just the start point) + /n /n /n /n } \coor(#2) \code{% + /n /n %[ + ] % end of the first dummy spline + }% end of \code + }% + %% Initialise the list of postscript code fragments: + \psbcurve@codeCntrEnd0% + \psbcurve@pointSetDefaults%% Init first spline. + \psbcurve@def{l}{\coor(#2)}%% Default left control point of the first spline. + \psbcurve@next%% Now, get the next arguments... +} + +%% The following macro declare the pstricks option psbcurveTension +%% and set it to its default value. +\define@key[psset]{pst-bezier}{bcurveTension}[0.25]{\def\psk@bcurveTension{#1}} +\psset[pst-bezier]{bcurveTension=0.25} + +%% Points of a spline that are not set yet +%% to a certain value or action +%% get the following value: +\def\psbcurve@ptNotDef{\code{ /n /n }} + +%% A newly allocated spline gets the following defaults: +\def\psbcurve@pointSetDefaults{% + \psbcurve@defIfVoid{l}{\psbcurve@ptNotDef}% + \psbcurve@defIfVoid{r}{\psbcurve@ptNotDef}% + \psbcurve@defIfVoid{sl}{\code{ \psk@bcurveTension\space }}% + \psbcurve@defIfVoid{sr}{\code{ \psk@bcurveTension\space }}% + \psbcurve@defIfVoid{addon}{}% +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Now, there comes a series of commands. Depending on the next optional modifier +%% in the argument list of \psbcurve one of these is called. If there follows a +%% point (x,y) without modifier \psbcurve@nextPoint is called. If there follows a token that +%% does not make sense to \psbcurve \psbcurve@end is called. + +%% the modifier l +\def\psbcurve@lPoint#1(#2){% + \psbcurve@def{l}{\coor(#2)}% + \psbcurve@next} + +%% the modifier r +\def\psbcurve@rPoint#1(#2){% + \psbcurve@def{r}{\coor(#2)}% + \psbcurve@next} + +%% the modifier L +\def\psbcurve@LPoint#1(#2){% + \psbcurve@def{l}{\coor(#2)}% + \psbcurve@def[-1]{r}{\code{ /s /s }}% + \psbcurve@next} + +%% the modifier T +\def\psbcurve@Tension#1#2{% + \psbcurve@def{addon}{\psset{bcurveTension=#2}}% + \psbcurve@next} + +%% The t modifier has some sub-modifiers +%% These are recognised by this macro and the +%% corresponding action is taken. +\def\psbcurve@tension#1{\futurelet\psbcurve@tmp\psbcurve@@tension} +%% +\def\psbcurve@@tension{% + \psbcurve@switch\psbcurve@tmp{% + l,\psbcurve@ltension,% + r,\psbcurve@rtension,% + s,\psbcurve@stension,% + \relax,\psbcurve@@@tension +}} + +%% the modifier t without further sub-modifiers +\def\psbcurve@@@tension#1{% + \psbcurve@def{sr}{\code{ #1 }}% + \psbcurve@def{sl}{\code{ #1 }}% + \psbcurve@next} + +%% the modifier ts +\def\psbcurve@stension#1#2{% symmetric + \psbcurve@def[-1]{sr}{\code{ #2 }}% + \psbcurve@def{sl}{\code{ #2 }}% + \psbcurve@next} + +%% the modifier tl +\def\psbcurve@ltension#1#2{% left control point + \psbcurve@def{sl}{\code{ #2 }}% + \psbcurve@next} + +%% the modifier tr +\def\psbcurve@rtension#1#2{% right control point + \psbcurve@def{sr}{\code{ #2 }}% + \psbcurve@next} + +%% This macro is called if the next token is +%% no modifier but a point (x,y) +\def\psbcurve@nextPoint(#1){% + \psbcurve@def{}{\coor(#1)}% + \advance\psbcurve@codeCntrEnd by 1 + \psbcurve@pointSetDefaults% + \psbcurve@next} + +%% If the next token does not make sense to \psbcurve +%% the curve is finished. +\def\psbcurve@end{ + %% Do we need to set the last control point to its default? + \def\tmp{\psbcurve@ptNotDef}% + \psbcurve@ifx[-1]{r}\tmp% + \psbcurve@letvar[-1]{}\tmp% \tmp is set to the end point + \psbcurve@let[-1]{r}\tmp% last control point is set to \tmp + \fi% + %% pscustom deactivates showpoints: reverse this: + \let\if@psbcurve@showpoints\ifshowpoints% + \pscustom{% + %% Following, the TeX-code fragments in \psbcurve@code... + %% are executed. These compose the postscript spline array. + \psbcurve@code% + \psbcurve@codeCntr0 + \loop% + \code{[ %] + }% + \psbcurve@get{addon}% additional code + \psbcurve@get{l}% left control point + \psbcurve@get{r}% right control point + \psbcurve@get{}% interpolation point + \psbcurve@get{sl}% left scaling factor + \psbcurve@get{sr}% right scaling factor + \code{ %[ + ] }% end of the spline. + \advance\psbcurve@codeCntr by 1 + \ifnum\psbcurve@codeCntr<\psbcurve@codeCntrEnd% + \repeat% + \code{%[ + ] % end of the spline array + /K 1 + >> pstBCurve + }% + \if@psbcurve@showpoints% + \pst@OpenShowPoints %% works fine, only the dashed lines are missing: + \code{ \tx@BezierShowPoints }% + \fi% + }% + \egroup% +} + +%% The following macro reads the next argument from the \psbcurve argument list +%% recognises optional modifiers and branches to the corresponding macro. +\def\psbcurve@next{\futurelet\psbcurve@tmp\psbcurve@@next} +\def\psbcurve@@next{% + \psbcurve@switch\psbcurve@tmp{% + (,\psbcurve@nextPoint,%) + l,\psbcurve@lPoint,% + r,\psbcurve@rPoint,% + L,\psbcurve@LPoint,% + t,\psbcurve@tension,% + T,\psbcurve@Tension,% + \relax,\psbcurve@end}% +} +% +\define@key[psset]{pst-bezier}{nPoints}{\def\psk@nPoints{#1 }} +\define@boolkey[psset]{pst-bezier}[Pst@]{showPolygon}[true]{} +\define@boolkey[psset]{pst-bezier}[Pst@]{autoTrace}[true]{} +% valeurs par défaut +% les coordonnées des points de contrôle P0= x0 y0, etc. +%\psset[pst-RQBC]{P0=2 0,P1=2 2,P2=0 2,w=1 0.707 1,n=400,showPoints=true,showPolygon=false} +\psset[pst-bezier]{nPoints=400,showPolygon=false,autoTrace=false} +% +\def\pst@get@w#1,#2,#3\@nil{% + \def\pst@@w{#1 #2 #3 }% + \def\psk@wZero{#1 }% + \def\psk@wUn{#2 }% + \def\psk@wDeux{#3 }} +% +\def\psRQBCmasse{\def\pst@par{}\pst@object{psRQBCmasse}} +\def\psRQBCmasse@i(#1)(#2)(#3)#4{{% +% \addbefore@par{showpoints=false}% + \begin@SpecialObj + \pst@get@w#4\@nil + \pst@getcoor{#1}\pst@tempA + \pst@getcoor{#2}\pst@tempB + \pst@getcoor{#3}\pst@tempC + \pst@cntm=\pscalculate{abs(\psk@wZero)<1e-6 ? 0 : 1}% + \pst@cntn=\pscalculate{abs(\psk@wUn)<1e-6 ? 0 : 2}% + \pst@cnto=\pscalculate{abs(\psk@wDeux)<1e-6 ? 0 : 4}% + \edef\ps@choix{\the\numexpr\pst@cntm+\pst@cntn+\pst@cnto}% +% \typeout{>>pst-bezier: ps@choix=\ps@choix}% + \pstVerb{ +% \addto@pscode{ + tx@Dict begin + /nB \psk@nPoints def + \pst@tempA \tx@UserCoor /yP0 exch def /xP0 exch def + \pst@tempB \tx@UserCoor /yP1 exch def /xP1 exch def + \pst@tempC \tx@UserCoor /yP2 exch def /xP2 exch def + \pst@@w /w2 exch def /w1 exch def /w0 exch def + /choix \ps@choix\space def + tx@RQBCmasse + end + } % fin pstVerb + \pnodes(#1){P0}(#2){P1}(#3){P2} + \pnode(!P0P1){P0P1} + %\pnode(!P1P0){P1P0} + \pnode(!P1P2){P1P2} + \pnode(!P0P2){P0P2} + \pslistplot{RQBCmasse1}\pslistplot[showpoints=false]{RQBCmasse2}% + \ifPst@autoTrace + \ifcase\ps@choix + \or %1 + \psline[linestyle=dashed,linecolor=black,arrowinset=0.1,arrowsize=0.2]{->}(#1)(P0P1) + \psline[linestyle=dashed,linecolor=green,arrowinset=0.1,arrowsize=0.2]{->}(#1)(P0P2) + %\psline[linestyle=dashed,linecolor=magenta,arrowinset=0.1,arrowsize=0.2]{->}(P1) + \psdots(#1)%(P1)(P2) + \or %2 + \psline[linestyle=dashed,linecolor=black,arrowinset=0.1,arrowsize=0.2]{->}(#2)(P0P1) + \psline[linestyle=dashed,linecolor=green,arrowinset=0.1,arrowsize=0.2]{->}(#2)(P1P2) + %\psline[linestyle=dashed,linecolor=magenta,arrowinset=0.1,arrowsize=0.2]{->}(P1) + \psdots(#2)%(P1)(P2) + \or %3 + \or %4 + \psline[linestyle=dashed,linecolor=black,arrowinset=0.1,arrowsize=0.2]{->}(#3)(P1P2) + \psline[linestyle=dashed,linecolor=green,arrowinset=0.1,arrowsize=0.2]{->}(#3)(P0P2) + %\psline[linestyle=dashed,linecolor=magenta,arrowinset=0.1,arrowsize=0.2]{->}(P1) + \psdots(#3)%(P1)(P2) + \or % 5 + \psline[linestyle=dashed,linecolor=black,arrowinset=0.1,arrowsize=0.2]{->}(#1)(P0P1) + \psline[linestyle=dashed,linecolor=green,arrowinset=0.1,arrowsize=0.2]{->}(#3)(P1P2) + \psline[linestyle=dashed,linecolor=magenta,arrowinset=0.1,arrowsize=0.2]{->}(#2) + \psdots(#1)(#2)(#3) + \or %6 + \or %7 + \psline(#1)(#2)(#3)\psdots(#1)(#2)(#3) + \fi + \fi + \end@SpecialObj}\ignorespaces} +% +\catcode`\@=\TheAtCode\relax +\endinput + |