summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2014-02-26 23:48:36 +0000
committerKarl Berry <karl@freefriends.org>2014-02-26 23:48:36 +0000
commit800cc56380d1edfe567a6a66bef13e8950eb2b0c (patch)
treea3e7e8a44aed5605d8c10a5c9e1f90e68e0dfa7f
parentb915e2e1843abfed0f5230f03991029d7b42dfd3 (diff)
pst-intersect (26feb14)
git-svn-id: svn://tug.org/texlive/trunk@33056 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/pst-intersect/Changes10
-rw-r--r--Master/texmf-dist/doc/latex/pst-intersect/pst-intersect-DE.pdfbin102356 -> 111294 bytes
-rw-r--r--Master/texmf-dist/doc/latex/pst-intersect/pst-intersect.pdfbin100306 -> 108644 bytes
-rw-r--r--Master/texmf-dist/dvips/pst-intersect/pst-intersect.pro195
-rw-r--r--Master/texmf-dist/source/latex/pst-intersect/Makefile14
-rw-r--r--Master/texmf-dist/source/latex/pst-intersect/pst-intersect.dtx474
-rw-r--r--Master/texmf-dist/tex/generic/pst-intersect/pst-intersect.tex80
-rw-r--r--Master/texmf-dist/tex/latex/pst-intersect/pst-intersect.sty8
8 files changed, 567 insertions, 214 deletions
diff --git a/Master/texmf-dist/doc/latex/pst-intersect/Changes b/Master/texmf-dist/doc/latex/pst-intersect/Changes
index a7c17260959..91ba24d91c2 100644
--- a/Master/texmf-dist/doc/latex/pst-intersect/Changes
+++ b/Master/texmf-dist/doc/latex/pst-intersect/Changes
@@ -1,3 +1,13 @@
+0.2 2014-02-26
+ * Added support for arrows parameter to \pstracecurve.
+ * Modified parameters tstart, tstop, istart and istop to respect
+ different directions.
+ * Added macro \psGetIsectCenter
+ * Fixed a bug in the termination of the iteration procedure.
+ * Fixed a bug in the point order of Bézier curves, which was
+ related to a now fixed bug in pst-func.
+ * Several other improvements.
+
0.1 2014-02-19
* First CTAN version
diff --git a/Master/texmf-dist/doc/latex/pst-intersect/pst-intersect-DE.pdf b/Master/texmf-dist/doc/latex/pst-intersect/pst-intersect-DE.pdf
index cf2c3cbb936..2a85a8cd00b 100644
--- a/Master/texmf-dist/doc/latex/pst-intersect/pst-intersect-DE.pdf
+++ b/Master/texmf-dist/doc/latex/pst-intersect/pst-intersect-DE.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/pst-intersect/pst-intersect.pdf b/Master/texmf-dist/doc/latex/pst-intersect/pst-intersect.pdf
index 9c62a7b3f33..b19c09b017d 100644
--- a/Master/texmf-dist/doc/latex/pst-intersect/pst-intersect.pdf
+++ b/Master/texmf-dist/doc/latex/pst-intersect/pst-intersect.pdf
Binary files differ
diff --git a/Master/texmf-dist/dvips/pst-intersect/pst-intersect.pro b/Master/texmf-dist/dvips/pst-intersect/pst-intersect.pro
index fc0492bb9f5..920774cc758 100644
--- a/Master/texmf-dist/dvips/pst-intersect/pst-intersect.pro
+++ b/Master/texmf-dist/dvips/pst-intersect/pst-intersect.pro
@@ -160,25 +160,55 @@ tx@IntersectDict begin
} if
DebugEnd %1 debug
} bind def
-/movetype { /moveto load } bind def
-/linetype { /lineto load } bind def
-/curvetype { /curveto load } bind def
+/InitTracing {
+ /movetype /moveto load def
+ /linetype /lineto load def
+ /curvetype /curveto load def
+} bind def
+InitTracing
+/GetFullPath {
+ { /movetype counttomark 3 roll }
+ { /linetype counttomark 3 roll }
+ { /curvetype counttomark 7 roll }{} pathforall
+} bind def
/PreparePath {
- [ exch aload pop
- {
-dup type /nametype eq not { exit } if
-dup /movetype eq {
- pop ToVec /@mycp exch def
-} {
- dup /linetype eq {
-pop [ @mycp 4 2 roll 2 copy ToVec /@mycp exch def ToVec ]
+ [ exch aload pop
+ {
+ dup type /nametype eq not { exit } if
+ dup /movetype eq {
+ pop ToVec /@mycp exch def
} {
-pop [ @mycp 8 2 roll 2 copy ToVec /@mycp exch def
-ToVec 5 1 roll ToVec 4 1 roll ToVec 3 1 roll ]
+ dup /linetype eq {
+ pop [ @mycp 4 2 roll 2 copy ToVec /@mycp exch def ToVec ]
+ } {
+ pop [ @mycp 8 2 roll 2 copy ToVec /@mycp exch def
+ ToVec 5 1 roll ToVec 4 1 roll ToVec 3 1 roll ]
+ } ifelse
+ counttomark 1 roll
} ifelse
- counttomark 1 roll
-} ifelse
- } loop ]
+ } loop ]
+} bind def
+/GetSegmentCount {
+ dup IsPath {
+ [ exch aload pop 0
+ {
+ counttomark 1 eq { exit } if
+ exch
+ dup /movetype eq {
+ pop 3 1 roll pop pop
+ }{
+ dup /linetype eq {
+ pop 1 add 3 1 roll pop pop
+ }{
+ pop 1 add 7 1 roll 6 { pop } repeat
+ } ifelse
+ } ifelse
+ } loop
+ exch pop
+ } {
+ % a Bezier curve is a single segment
+ pop 1
+ } ifelse
} bind def
/LoadLineIntersectionPoints {
(LoadLineIntersectionPoints) DebugBegin
@@ -248,8 +278,14 @@ ToVec 5 1 roll ToVec 4 1 roll ToVec 3 1 roll ]
} bind def
/IterateIntersection {
(IterateIntersection) DebugBegin
- 11 dict begin
+ 12 dict begin
/precision MaxPrecision def
+ 4 2 roll 2 copy 6 2 roll
+ dup IsPath not { PointArrayToArray } if
+ 0 exch { dup type /nametype eq { pop }{ abs max} ifelse } forall
+ exch dup IsPath not { PointArrayToArray } if
+ { dup type /nametype eq { pop }{ abs max} ifelse } forall
+ Epsilon mul /epsilon exch def
/counter 0 def
/depth 0 def
/domsA [] def
@@ -534,8 +570,7 @@ AreNear and exch
/AreNear {
(AreNear) DebugBegin
aload pop 3 -1 roll aload pop
- 4 copy abs 3 { exch abs max } repeat Epsilon mul
- dup 6 2 roll VecSub abs 4 -1 roll lt exch abs 3 -1 roll lt and
+ VecSub abs epsilon lt exch abs epsilon lt and
DebugEnd
} bind def
/Min {
@@ -714,69 +749,87 @@ pop
/IsPath {
dup length 1 sub get type /nametype eq { true } { false } ifelse
} bind def
-/ShowFullPath {
- 4 dict begin
- /movetype /moveto load def
- /linetype /lineto load def
- /curvetype /curveto load def
- mark exch aload pop
- {
- counttomark 0 eq { exit } if
- load exec
- } loop
- pop
- end
-} bind def
/ShowPathPortion {
6 dict begin
- exch dup 0 lt { pop 0 } if /tstart exch def
- % if tstart is < 0, use the array length
- dup 0 lt { pop dup length } if /tstop exch def
- tstop tstart gt {
- /movetype /moveto load def
- /linetype /lineto load def
- /curvetype /curveto load def
- /n 0 def
- mark exch aload pop
- {
- counttomark 0 eq { pop exit } if
- dup /movetype eq not { /n n 1 add def } if
- % current section is after tstart
- n tstop sub 1 ge { cleartomark exit } if
+ /tstop exch def
+ /tstart exch def
+ InitTracing
+ /n 0 def
+ mark exch aload pop
+ {
+ counttomark 0 eq n tstop ge or { pop exit } if
+ dup /movetype eq not { /n n 1 add def } if
- dup /movetype eq {
- load exec
+ dup /movetype eq {
+ load exec
+ } {
+ tstart n gt {
+ /curvetype eq { 6 2 roll 4 { pop } repeat } if
+ movetype
} {
- tstart n gt {
- % current path section is before tstart
- /curvetype eq { 6 2 roll 4 { pop } repeat } if
- movetype
- } {
- tstart n 1 sub gt tstop n lt or {
- % draw a truncated section
- tstart n sub 1 add tstop n sub 1 add
- ToUnitInterval exch
+ tstart n 1 sub gt tstop n lt or {
+ tstart n sub 1 add tstop n sub 1 add
+ ToUnitInterval exch
+ /linetype eq {
+ 3 1 roll ToVec currentpoint ToVec exch ToVec
+ dup 3 -1 roll Portion
+ aload pop exch
+ tstart n 1 sub gt {
+ exch aload pop 3 -1 roll aload pop ArrowA
+ tstop n le {
+ currentpoint 4 2 roll ArrowB lineto pop pop
+ } {
+ lineto
+ } ifelse
+ } {
+ pop aload pop currentpoint 4 2 roll ArrowB lineto pop pop
+ } ifelse
+ } {
+ 7 1 roll [ currentpoint 9 3 roll ] ArrayToPointArray
+ dup 3 -1 roll Portion
+ { aload pop } forall
+ 8 -2 roll
+ tstart n 1 sub gt { moveto } { pop pop } ifelse
+ 6 -2 roll currentpoint ArrowA 6 2 roll
+ tstop n le {
+ ArrowB
+ } if
+ curveto
+ } ifelse
+ }{
+ tstart n 1 sub eq {
/linetype eq {
- 3 1 roll ToVec currentpoint ToVec exch ToVec
- dup 3 -1 roll Portion
- aload pop exch
- tstart n 1 sub gt { aload pop moveto } { pop } ifelse
- aload pop lineto
+ currentpoint ArrowA
+ tstop n eq {
+ currentpoint 4 2 roll ArrowB lineto pop pop
+ } {
+ lineto
+ } ifelse
} {
- 7 1 roll [ currentpoint 9 3 roll ] ArrayToPointArray
- dup 3 -1 roll Portion
- { aload pop } forall
- 8 -2 roll
- tstart n 1 sub gt { moveto } { pop pop } ifelse
+ 6 -2 roll currentpoint ArrowA 6 2 roll
+ tstop n eq {
+ ArrowB
+ } if
+ curveto
+ } ifelse
+ } {
+ /linetype eq {
+ tstop n eq {
+ currentpoint 4 2 roll ArrowB lineto pop pop
+ }{
+ lineto
+ } ifelse
+ } {
+ tstop n eq {
+ ArrowB
+ } if
curveto
} ifelse
- }{
- load exec
} ifelse
} ifelse
} ifelse
- } loop
- } if
+ } ifelse
+ } loop
end
} bind def
% Graham Scal algorithm to compute the convex hull of a set of
diff --git a/Master/texmf-dist/source/latex/pst-intersect/Makefile b/Master/texmf-dist/source/latex/pst-intersect/Makefile
index 43463f8ada8..049aad3dd98 100644
--- a/Master/texmf-dist/source/latex/pst-intersect/Makefile
+++ b/Master/texmf-dist/source/latex/pst-intersect/Makefile
@@ -17,13 +17,9 @@ all : doc doc-DE
doc : $(PACKAGE).pdf
doc-DE : $(PACKAGE)-DE.pdf
-dist : doc Changes
+dist : doc doc-DE Changes
mkdir -p $(PACKAGE)
cp $(ARCHFILES) $(PACKAGE)
- tar chvzf $(ARCHNAME).tar.gz $(PACKAGE)
- rm -rf $(PACKAGE)
- @ echo
- @ echo $(ARCHNAME).tar.gz
$(PACKAGE).dvi: L = english
$(PACKAGE)-DE.dvi: L = ngerman
@@ -42,10 +38,7 @@ $(PACKAGE).sty $(PACKAGE).pro $(PACKAGE).tex: $(PACKAGE).ins $(PACKAGE).dtx
Changes: Changes.py $(PACKAGE).dtx
python $<
-arch : Changes
- zip $(ARCHNAME).zip $(ARCHFILES)
-
-arch-tds : Changes
+arch-tds : Changes doc doc-DE
$(RM) $(ARCHNAME_TDS).zip
mkdir -p tds/tex/latex/$(PACKAGE)
mkdir -p tds/tex/generic/$(PACKAGE)
@@ -63,7 +56,8 @@ arch-tds : Changes
rm -rf tds
ctan : dist arch-tds
- tar cf $(PACKAGE).tar $(ARCHNAME_TDS).zip $(ARCHNAME).tar.gz
+ zip -r $(PACKAGE).zip $(ARCHNAME_TDS).zip $(PACKAGE)
+ $(RM) -rf $(PACKAGE)/
clean :
$(RM) $(foreach prefix, $(PACKAGE) $(PACKAGE)-DE, \
diff --git a/Master/texmf-dist/source/latex/pst-intersect/pst-intersect.dtx b/Master/texmf-dist/source/latex/pst-intersect/pst-intersect.dtx
index 7bc9b753edb..a02dfd06933 100644
--- a/Master/texmf-dist/source/latex/pst-intersect/pst-intersect.dtx
+++ b/Master/texmf-dist/source/latex/pst-intersect/pst-intersect.dtx
@@ -18,7 +18,7 @@
%<stylefile>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<stylefile>\ProvidesPackage{pst-intersect}
%<*stylefile>
- [2014/02/19 v0.1 package wrapper for pst-intersect.tex]
+ [2014/02/26 v0.2 package wrapper for pst-intersect.tex]
%</stylefile>
%
%<*driver>
@@ -34,7 +34,6 @@
\usepackage[ngerman, english,\mainlang]{babel}
\usepackage{prettyref}
\usepackage[dvipsnames,x11names,svgnames]{xcolor}
-\usepackage{array,booktabs,paralist,tabularx}
\usepackage{ragged2e, calc}
\newlength{\PITcaptionmargin}
\newlength{\PITcaptionheight}
@@ -51,7 +50,7 @@
\hspace*{-\PITcaptionmargin}#1#2#3\par
}%
\captionsetup[lstlisting]{format=pitnocaption}
-\usepackage{nicefrac, multido}
+\usepackage{multido}
\usepackage{pst-intersect}
\usepackage{hypdoc}
\hypersetup{%
@@ -64,13 +63,11 @@
\definecolor{DOrange}{rgb}{1,.4,.2}%
\definecolor{DDOrange}{rgb}{0.7, 0.23, 0.07}%
\colorlet{pdflinkcolor}{DOrange}
-\colorlet{DGreen}{green!90!black}
\usepackage{showexpl}
\makeatletter\renewcommand*\SX@Info{}\makeatother
\usepackage{etoolbox}
\undef{\cs}\undef{\cmd}
\usepackage{ltxdockit}
-\newcommand{\poeTR}[1]{\TR{\ttfamily\color{DOrange}#1}}
\definecolor{colKeys}{rgb}{0,0,0}
\definecolor{colIdentifier}{rgb}{0,0,0}
\colorlet{colComments}{green!60!black}
@@ -550,7 +547,7 @@
% \hypersetup{pdftitle={Berechnen der Schnittpunkte beliebiger Kurven}}
% \fi
% \ifENGLISH
-% \title{\texttt{pst-optexp}\\ Intersecting arbitrary curves\\[0.5ex] \small \fileversion}
+% \title{\texttt{pst-intersect}\\ Intersecting arbitrary curves\\[0.5ex] \small \fileversion}
% \hypersetup{pdftitle={Intersecting arbitrary curves}}
% \fi
% \author{Christoph Bersch}
@@ -576,11 +573,18 @@
% \LPack{pst-intersect} ist ein PSTricks-Paket zur
% Berechnung der Schnittpunkte von Bézier-Kurven und beliebigen
% Postscript-Pfaden.
+%
+% Beachten Sie, dass die Paket-Versionen 0.x sich in einem
+% experimentellen Status befinden, und sich grundlegende Änderungen
+% ergeben können, die zur Vorgängerversion inkompatibel sind.
% \fi
% \ifENGLISH
% \section{About the package}
% \LPack{pst-intersect} is a PSTricks package to calculate
% the intersections of Bezier curves and arbitrary Postscript paths.
+%
+% Please note, that package versions 0.x are experimental, and may be
+% subject to fundamental changes, which aren't backward compatible.
% \fi
%
% \ifGERMAN
@@ -901,7 +905,7 @@
%\iffalse
%<*ignore>
%\fi
-\begin{LTXexample}
+\begin{LTXexample}[caption={caption}, label={ex:saveintersections}]
\begin{pspicture}(5,5)
\pssavebezier[linecolor=DOrange]{A}%
(0,0)(0,5)(5,5)(5,1)(1,1.5)
@@ -1013,18 +1017,36 @@
% \end{optionlist}
%
% \ifGERMAN
-% Beachten Sie, dass in der Version 0.1 die Reihenfolge von
-% \Lkeyword{tstart} und \Lkeyword{tstop} noch keine Rolle spielt. Für
-% kommende Versionen ist geplant, dass bei \Lkeyword{tstart}
-% \textgreater{} \Lkeyword{tstop} die Pfadrichtung umgekehrt wird. Zur
-% Zeit werden auch noch keine Pfeile für \Lcs{pstracecurve} unterstützt.
+% Beachten Sie, dass die Reihenfolge von \Lkeyword{tstart} und
+% \Lkeyword{tstop} eine Rolle spielt. Ist \Lkeyword{tstart}
+% \textgreater{} \Lkeyword{tstop} dann wird die Pfadrichtung umgekehrt.
% \fi
% \ifENGLISH
-% Please note, that as of version 0.1 the order of \Lkeyword{tstart} and
-% \Lkeyword{tstop} doesn't play a role. But for upcoming versions it is
-% planned that \Lkeyword{tstart} \textgreater{} \Lkeyword{tstop}
-% reverses the path direction. At the moment arrows aren't supported
-% either.
+% Please note, that the order of \Lkeyword{tstart} and \Lkeyword{tstop}
+% plays a role. For \Lkeyword{tstart} \textgreater{} \Lkeyword{tstop}
+% the path direction is reversed.
+% \fi
+%
+% \iffalse
+%<*ignore>
+% \fi
+\begin{LTXexample}
+\begin{pspicture}(2,2)
+ \psset{arrows=->, arrowscale=1.5}
+ \pssavepath[linestyle=dashed, linewidth=0.5\pslinewidth]{A}{\psline(0,0)(1,2)(2,0)}
+ \pstracecurve[tstart=0.1, tstop=0.9]{A}
+\end{pspicture}
+\end{LTXexample}
+
+\begin{LTXexample}
+\begin{pspicture}(2,2)
+ \psset{arrows=->, arrowscale=1.5}
+ \pssavepath[linestyle=dashed, linewidth=0.5\pslinewidth]{A}{\psline(0,0)(1,2)(2,0)}
+ \pstracecurve[tstart=0.9, tstop=0.1]{A}
+\end{pspicture}
+\end{LTXexample}
+% \iffalse
+%</ignore>
% \fi
%
% \ifGERMAN
@@ -1104,6 +1126,52 @@
%</ignore>
%\fi
%
+% \begin{ltxsyntax}
+% \cmditem{psGetIsectCenter}{intersection}{curvename}{n}
+%
+% \ifGERMAN
+% Lädt die Koordinaten des $n$-ten Schnittpunkts des Pfades
+% \prm{curvename} in der Schnittmenge \prm{intersection}. Dabei
+% startet die Nummer der Schnittpunkte bei \prm{n}$=1$ und wird in
+% Pfadrichtung durchnummeriert.
+%
+% Die Schnittpunkte können mit \Lkeyword{saveintersections}\opt{=true}
+% natürlich auch über \cs{psGetNodeCenter} geladen werden. Diese
+% werden dann nach aufsteigender $x$-Koordinate nummeriert, siehe
+% \prettyref{ex:saveintersections}.
+% \fi
+% \ifENGLISH
+% Loads the coordinates of the $n$-th intersection point of the path
+% \prm{curvename} in the intersection set \prm{intersection}. The
+% numbering of the intersections starts at \prm{n}$=1$ and the number
+% increases along the path in its original direction.
+%
+% The intersection points can also be loaded with \cs{psGetNodeCenter}
+% if \Lkeyword{saveintersections}\opt{=true} is set. In that case, the
+% numbering of the intersection increases according to their $x$
+% coordinate, see \prettyref{ex:saveintersections}.
+% \fi
+% \end{ltxsyntax}
+%
+% \iffalse
+%<*ignore>
+%\fi
+\begin{LTXexample}
+\begin{pspicture}(5,5)
+ \pssavebezier[linecolor=DOrange, arrows=->]{A}%
+ (0,0)(0,5)(5,5)(5,1)(1,1.5)
+ \pssavebezier[arrows=->]{B}(0,5)(0,0)(5,0)(5,5)(0,2)
+ \psintersect[name=C, showpoints]{A}{B}
+ \color{DOrange}
+ \uput[150](!\psGetIsectCenter{C}{A}{1} A1.x A1.y){1}
+ \uput[85](!\psGetIsectCenter{C}{A}{2} A2.x A2.y){2}
+ \uput[-20](!\psGetIsectCenter{C}{A}{3} A3.x A3.y){3}
+ \uput[90](!\psGetIsectCenter{C}{A}{4} A4.x A4.y){4}
+\end{pspicture}
+\end{LTXexample}
+%\iffalse
+%</ignore>
+%\fi
% \ifGERMAN
% \chapter{Beispiele}
% \fi
@@ -1147,7 +1215,8 @@
\pssavepath{A}{\psplot[plotpoints=200]{0}{10}{x 180 mul sin 1 add 2 mul}}
\pssavepath{B}{\psplot[plotpoints=50]{0}{10}{2 x neg 0.5 mul exp 4 mul}}
\psintersect[name=C, showpoints]{A}{B}
- \multido{\i=1+2,\ii=2+2}{5}{\uput[120](C\i){\i}\uput[60](C\ii){\ii}}
+ \multido{\i=1+1}{5}{\uput[210](C\i){\i}}
+ \multido{\i=6+2,\ii=7+2}{3}{\uput[225](C\i){\i}\uput[-45](C\ii){\ii}}
\end{pspicture}
\end{LTXexample}
\endgroup
@@ -1189,6 +1258,16 @@
%
% \begin{changelog}
%\patchcmd{\release}{\setlength{\itemsep}{0pt}}{\setlength{\itemsep}{0pt}\setlength{\parsep}{0pt}}{}{}
+% \begin{release}{0.2}{2014-02-26}
+% \item Added support for \opt{arrows} parameter to \cs{pstracecurve}.
+% \item Modified parameters \opt{tstart}, \opt{tstop}, \opt{istart}
+% and \opt{istop} to respect different directions.
+% \item Added macro \cs{psGetIsectCenter}
+% \item Fixed a bug in the termination of the iteration procedure.
+% \item Fixed a bug in the point order of Bézier curves, which was
+% related to a now fixed bug in \opt{pst-func}.
+% \item Several other improvements.
+% \end{release}
% \begin{release}{0.1}{2014-02-19}
% \item First CTAN version
% \end{release}
@@ -1203,18 +1282,14 @@
% \chapter{The \LaTeX\ wrapper}
%<*stylefile>
% \begin{macrocode}
-\NeedsTeXFormat{LaTeX2e}[1999/12/01]
-\ProvidesPackage{pst-intersect}%
- [2014/02/06 v0.1alpha package wrapper for pst-intersect.tex]
\RequirePackage{pstricks}
\RequirePackage{pst-xkey}
\RequirePackage{pst-node}
-\RequirePackage{multido}
\RequirePackage{pst-func}
\input{pst-intersect.tex}
\IfFileExists{pst-intersect.pro}{%
\ProvidesFile{pst-intersect.pro}
- [2014/02/06 PostScript prologue file]
+ [2014/02/26 PostScript prologue file]
\@addtofilelist{pst-intersect.pro}}{}%
% \end{macrocode}
%</stylefile>
@@ -1249,13 +1324,11 @@
}%
\def\pssavebezier@ii{%
\addto@pscode{%
- % only 10 points allowed, remove the rest
+% \end{macrocode}
+% only 10 points allowed, remove the rest
+% \begin{macrocode}
counttomark 20 gt { counttomark 20 sub { pop } repeat } if
- % reverse the point order
- counttomark -2 4 { 2 roll } for
- %\addto@pscode{%
- %counttomark 2 add -1 roll pop % remove the path name
- counttomark 2 idiv 1 sub dup 9 gt { pop 9 } if
+ counttomark 2 idiv 1 sub
\psk@plotpoints\space exch
\txFunc@BezierCurve
\ifshowpoints \txFunc@BezierShowPoints \else pop \fi
@@ -1267,6 +1340,20 @@
[ count 1 sub 1 roll ] ArrayToPointArray def
}%
\ignorespaces}%
+\def\psGetIsectCenter#1#2#3{%
+ \pst@intersectdict
+ \PIT@name{#1} /\PIT@name{#2@t} get #3 1 sub get
+ \PIT@name{#1} /\PIT@name{#2} get
+ dup IsPath {
+ PreparePath exch dup 3 1 roll cvi get
+ } if
+ PointArrayToArray
+ tx@FuncDict begin 2 dict begin
+ dup length 2 idiv 1 sub /BezierType exch def /Points exch def GetBezierCoor
+ end end
+ end
+ \tx@UserCoor /#2#3.y exch def /#2#3.x exch def
+}%
\define@key[psset]{intersect}{tstart}{%
\pst@checknum{#1}\PIT@key@tstart
}
@@ -1310,9 +1397,7 @@
\PIT@pst@stroke@orig
\addto@pscode{%
clear mark
- { /movetype counttomark 3 roll }
- { /linetype counttomark 3 roll }
- { /curvetype counttomark 7 roll }{} pathforall
+ \pst@intersectdict GetFullPath end
counttomark 1 add -1 roll pop count }%
}%
\def\PIT@name@default{@tmp}%
@@ -1346,15 +1431,41 @@
\PIT@checkname{#1}%
\addto@pscode{%
\pst@intersectdict
+ \PIT@key@tstop\space dup 0 lt { pop \PIT@name{#1} GetSegmentCount } if
+ \PIT@key@tstart\space dup 0 lt { pop 0 } if exch
+ \PIT@name{#1} GetSegmentCount
+ 2 copy exch dup 3 1 roll
+ lt exch 0 lt or { exch } if pop
\PIT@name{#1} dup IsPath {
- \PIT@key@tstart\space\PIT@key@tstop\space
+ 3 1 roll 2 copy gt {
+% \end{macrocode}
+% reverse the path, draw everything and resave the path
+% \begin{macrocode}
+ exch 3 -1 roll dup 4 1 roll GetSegmentCount
+ dup 4 1 roll exch sub 3 1 roll sub exch
+ gsave newpath
+ [ 4 -1 roll aload pop InitTracing
+ { counttomark 0 eq { exit } if
+ load exec
+ } loop
+ reversepath
+ GetFullPath ] 3 1 roll
+ grestore
+ } if
ShowPathPortion
}{
- [exch dup
- \PIT@key@tstart\space\PIT@key@tstop\space
- dup 0 lt { pop 1 } if
- ToUnitInterval Portion
+ [ exch dup 5 -2 roll
+ 2 copy gt {
+ exch
+ 2 copy gt { exch } if
+ [ 5 -2 roll pop PointArrayToArray aload pop
+ counttomark -2 4 { 2 roll } for ] ArrayToPointArray dup
+ 4 2 roll
+ } if
+ ToUnitInterval Portion
{ aload pop } forall
+ % reverse the point order
+ counttomark -2 4 { 2 roll } for
counttomark 2 sub 2 idiv
\psk@plotpoints
exch
@@ -1392,6 +1503,7 @@
} {
\PIT@key@tstart
} ifelse
+ dup 0 lt { pop 0 } if
exch % [curve] t_istart|tstart [ts]
%
dup length \PIT@key@istop\space ge 0 \PIT@key@istop\space lt and {
@@ -1399,14 +1511,38 @@
} {
pop \PIT@key@tstop
} ifelse
- 2 copy 2 copy gt 3 1 roll -1 gt exch -1 gt and and { exch } if
+ 3 -1 roll dup 4 1 roll GetSegmentCount
+ 2 copy exch dup 3 1 roll % [curve] tstart tstop cnt tstop cnt tstop
+ lt exch 0 lt or { exch } if pop % (tstop < 0 | cnt < tstop)
3 -1 roll dup
IsPath {
3 1 roll
+ 2 copy gt {
+ exch 3 -1 roll dup 4 1 roll GetSegmentCount
+ dup 4 1 roll exch sub 3 1 roll sub exch
+% \end{macrocode}
+% reverse the path, draw everything and resave the path
+% \begin{macrocode}
+ gsave newpath
+ [ 4 -1 roll aload pop InitTracing
+ { counttomark 0 eq { exit } if
+ load exec
+ } loop
+ reversepath
+ GetFullPath ] 3 1 roll
+ grestore
+ } if
ShowPathPortion
}{
[ exch dup 5 -2 roll
+ exch dup 0 lt { pop 0 } if exch
dup 0 lt { pop 1 } if
+ 2 copy gt {
+ exch
+ [ 5 -2 roll pop PointArrayToArray aload pop
+ counttomark -2 4 { 2 roll } for ] ArrayToPointArray dup
+ 4 2 roll
+ } if
ToUnitInterval Portion
{ aload pop } forall
counttomark 2 sub 2 idiv
@@ -1782,32 +1918,70 @@ tx@IntersectDict begin
% \PSname{curvetype}. By default, these are defined as the respective
% original procedures.
% \begin{macrocode}
-/movetype { /moveto load } bind def
-/linetype { /lineto load } bind def
-/curvetype { /curveto load } bind def
+/InitTracing {
+ /movetype /moveto load def
+ /linetype /lineto load def
+ /curvetype /curveto load def
+} bind def
+InitTracing
+/GetFullPath {
+ { /movetype counttomark 3 roll }
+ { /linetype counttomark 3 roll }
+ { /curvetype counttomark 7 roll }{} pathforall
+} bind def
% \end{macrocode}
%
+% \begin{macro}{PreparePath}
% [ ... /movetype ... /linetype .../curvetype ]
% \begin{macrocode}
/PreparePath {
- [ exch aload pop
- {
- dup type /nametype eq not { exit } if
- dup /movetype eq {
- pop ToVec /@mycp exch def
- } {
- dup /linetype eq {
- pop [ @mycp 4 2 roll 2 copy ToVec /@mycp exch def ToVec ]
- } {
- pop [ @mycp 8 2 roll 2 copy ToVec /@mycp exch def
- ToVec 5 1 roll ToVec 4 1 roll ToVec 3 1 roll ]
- } ifelse
- counttomark 1 roll
- } ifelse
- } loop ]
+ [ exch aload pop
+ {
+ dup type /nametype eq not { exit } if
+ dup /movetype eq {
+ pop ToVec /@mycp exch def
+ } {
+ dup /linetype eq {
+ pop [ @mycp 4 2 roll 2 copy ToVec /@mycp exch def ToVec ]
+ } {
+ pop [ @mycp 8 2 roll 2 copy ToVec /@mycp exch def
+ ToVec 5 1 roll ToVec 4 1 roll ToVec 3 1 roll ]
+ } ifelse
+ counttomark 1 roll
+ } ifelse
+ } loop ]
} bind def
% \end{macrocode}
+% \end{macro}
%
+% \begin{macro}{GetSegmentCount}
+% \PSarray{CurveOrPath} \PSop{GetSegmentCount} -> number of /linetype and /curvetypes
+% \begin{macrocode}
+/GetSegmentCount {
+ dup IsPath {
+ [ exch aload pop 0
+ {
+ counttomark 1 eq { exit } if
+ exch
+ dup /movetype eq {
+ pop 3 1 roll pop pop
+ }{
+ dup /linetype eq {
+ pop 1 add 3 1 roll pop pop
+ }{
+ pop 1 add 7 1 roll 6 { pop } repeat
+ } ifelse
+ } ifelse
+ } loop
+ exch pop
+ } {
+ % a Bezier curve is a single segment
+ pop 1
+ } ifelse
+} bind def
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}{LoadLineIntersectionPoints}
% Prepare \PSarray{Curve} for use with tx@Func
% \begin{pssyntax}
@@ -1912,8 +2086,14 @@ tx@IntersectDict begin
% \begin{macrocode}
/IterateIntersection {
(IterateIntersection) DebugBegin
- 11 dict begin
+ 12 dict begin
/precision MaxPrecision def
+ 4 2 roll 2 copy 6 2 roll
+ dup IsPath not { PointArrayToArray } if
+ 0 exch { dup type /nametype eq { pop }{ abs max} ifelse } forall
+ exch dup IsPath not { PointArrayToArray } if
+ { dup type /nametype eq { pop }{ abs max} ifelse } forall
+ Epsilon mul /epsilon exch def
% \end{macrocode}
% in order to limit recursion
% \begin{macrocode}
@@ -2361,8 +2541,7 @@ tx@IntersectDict begin
/AreNear {
(AreNear) DebugBegin
aload pop 3 -1 roll aload pop
- 4 copy abs 3 { exch abs max } repeat Epsilon mul
- dup 6 2 roll VecSub abs 4 -1 roll lt exch abs 3 -1 roll lt and
+ VecSub abs epsilon lt exch abs epsilon lt and
DebugEnd
} bind def
% \end{macrocode}
@@ -2725,71 +2904,140 @@ tx@IntersectDict begin
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{ShowFullPath}
+% \begin{macro}{ShowPathPortion}
+% \begin{pssyntax}
+% \PSarray{path} \PSvar{tstart tstop} \PSop{ShowPathPortion}
+% \end{pssyntax}
% \begin{macrocode}
-/ShowFullPath {
- 4 dict begin
- /movetype /moveto load def
- /linetype /lineto load def
- /curvetype /curveto load def
- mark exch aload pop
- {
- counttomark 0 eq { exit } if
- load exec
- } loop
- pop
- end
-} bind def
/ShowPathPortion {
6 dict begin
- exch dup 0 lt { pop 0 } if /tstart exch def
- % if tstart is < 0, use the array length
- dup 0 lt { pop dup length } if /tstop exch def
- tstop tstart gt {
- /movetype /moveto load def
- /linetype /lineto load def
- /curvetype /curveto load def
- /n 0 def
- mark exch aload pop
- {
- counttomark 0 eq { pop exit } if
- dup /movetype eq not { /n n 1 add def } if
- % current section is after tstart
- n tstop sub 1 ge { cleartomark exit } if
-
- dup /movetype eq {
- load exec
+ /tstop exch def
+ /tstart exch def
+ InitTracing
+ /n 0 def
+ mark exch aload pop
+ {
+ counttomark 0 eq n tstop ge or { pop exit } if
+ dup /movetype eq not { /n n 1 add def } if
+
+ dup /movetype eq {
+ load exec
+ } {
+ tstart n gt {
+% \end{macrocode}
+% current path section is before tstop
+% \begin{macrocode}
+ /curvetype eq { 6 2 roll 4 { pop } repeat } if
+ movetype
} {
- tstart n gt {
- % current path section is before tstart
- /curvetype eq { 6 2 roll 4 { pop } repeat } if
- movetype
- } {
- tstart n 1 sub gt tstop n lt or {
- % draw a truncated section
- tstart n sub 1 add tstop n sub 1 add
- ToUnitInterval exch
+ tstart n 1 sub gt tstop n lt or {
+% \end{macrocode}
+% draw a truncated segment
+% \begin{macrocode}
+ tstart n sub 1 add tstop n sub 1 add
+ ToUnitInterval exch
+ /linetype eq {
+ 3 1 roll ToVec currentpoint ToVec exch ToVec
+ dup 3 -1 roll Portion
+ aload pop exch
+ tstart n 1 sub gt {
+% \end{macrocode}
+% This is the start segment, move to the starting point, as it lies in the middle of the segment.
+% \begin{macrocode}
+ exch aload pop 3 -1 roll aload pop ArrowA
+ tstop n le {
+% \end{macrocode}
+% only a single segment, draw also the ending arrow
+% \begin{macrocode}
+ currentpoint 4 2 roll ArrowB lineto pop pop
+ } {
+% \end{macrocode}
+% other segments to follow
+% \begin{macrocode}
+ lineto
+ } ifelse
+ } {
+% \end{macrocode}
+% this is the last segment
+% \begin{macrocode}
+ pop aload pop currentpoint 4 2 roll ArrowB lineto pop pop
+ } ifelse
+ } {
+ 7 1 roll [ currentpoint 9 3 roll ] ArrayToPointArray
+ dup 3 -1 roll Portion
+ { aload pop } forall
+ 8 -2 roll
+ tstart n 1 sub gt { moveto } { pop pop } ifelse
+ 6 -2 roll currentpoint ArrowA 6 2 roll
+ tstop n le {
+% \end{macrocode}
+% only a single segment
+% \begin{macrocode}
+ ArrowB
+ } if
+ curveto
+ } ifelse
+ }{
+% \end{macrocode}
+% full segment
+% \begin{macrocode}
+ tstart n 1 sub eq {
+% \end{macrocode}
+% the first segment
+% \begin{macrocode}
+ /linetype eq {
+ currentpoint ArrowA
+ tstop n eq {
+% \end{macrocode}
+% a single, full segment
+% \begin{macrocode}
+ currentpoint 4 2 roll ArrowB lineto pop pop
+ } {
+% \end{macrocode}
+% not the last segment
+% \begin{macrocode}
+ lineto
+ } ifelse
+ } {
+ 6 -2 roll currentpoint ArrowA 6 2 roll
+ tstop n eq {
+% \end{macrocode}
+% single, full curve segment
+% \begin{macrocode}
+ ArrowB
+ } if
+ curveto
+ } ifelse
+ } {
+% \end{macrocode}
+% not the first segment
+% \begin{macrocode}
/linetype eq {
- 3 1 roll ToVec currentpoint ToVec exch ToVec
- dup 3 -1 roll Portion
- aload pop exch
- tstart n 1 sub gt { aload pop moveto } { pop } ifelse
- aload pop lineto
+ tstop n eq {
+% \end{macrocode}
+% last segment but not a single one
+% \begin{macrocode}
+ currentpoint 4 2 roll ArrowB lineto pop pop
+ }{
+% \end{macrocode}
+% full middle segment
+% \begin{macrocode}
+ lineto
+ } ifelse
} {
- 7 1 roll [ currentpoint 9 3 roll ] ArrayToPointArray
- dup 3 -1 roll Portion
- { aload pop } forall
- 8 -2 roll
- tstart n 1 sub gt { moveto } { pop pop } ifelse
+ tstop n eq {
+% \end{macrocode}
+% last curveto segment, not a single one
+% \begin{macrocode}
+ ArrowB
+ } if
curveto
} ifelse
- }{
- load exec
} ifelse
} ifelse
} ifelse
- } loop
- } if
+ } ifelse
+ } loop
end
} bind def
% \end{macrocode}
diff --git a/Master/texmf-dist/tex/generic/pst-intersect/pst-intersect.tex b/Master/texmf-dist/tex/generic/pst-intersect/pst-intersect.tex
index 74c6fafc7f3..25ef91c07fd 100644
--- a/Master/texmf-dist/tex/generic/pst-intersect/pst-intersect.tex
+++ b/Master/texmf-dist/tex/generic/pst-intersect/pst-intersect.tex
@@ -55,13 +55,8 @@
}%
\def\pssavebezier@ii{%
\addto@pscode{%
- % only 10 points allowed, remove the rest
counttomark 20 gt { counttomark 20 sub { pop } repeat } if
- % reverse the point order
- counttomark -2 4 { 2 roll } for
- %\addto@pscode{%
- %counttomark 2 add -1 roll pop % remove the path name
- counttomark 2 idiv 1 sub dup 9 gt { pop 9 } if
+ counttomark 2 idiv 1 sub
\psk@plotpoints\space exch
\txFunc@BezierCurve
\ifshowpoints \txFunc@BezierShowPoints \else pop \fi
@@ -73,6 +68,20 @@
[ count 1 sub 1 roll ] ArrayToPointArray def
}%
\ignorespaces}%
+\def\psGetIsectCenter#1#2#3{%
+ \pst@intersectdict
+ \PIT@name{#1} /\PIT@name{#2@t} get #3 1 sub get
+ \PIT@name{#1} /\PIT@name{#2} get
+ dup IsPath {
+ PreparePath exch dup 3 1 roll cvi get
+ } if
+ PointArrayToArray
+ tx@FuncDict begin 2 dict begin
+ dup length 2 idiv 1 sub /BezierType exch def /Points exch def GetBezierCoor
+ end end
+ end
+ \tx@UserCoor /#2#3.y exch def /#2#3.x exch def
+}%
\define@key[psset]{intersect}{tstart}{%
\pst@checknum{#1}\PIT@key@tstart
}
@@ -116,9 +125,7 @@
\PIT@pst@stroke@orig
\addto@pscode{%
clear mark
- { /movetype counttomark 3 roll }
- { /linetype counttomark 3 roll }
- { /curvetype counttomark 7 roll }{} pathforall
+ \pst@intersectdict GetFullPath end
counttomark 1 add -1 roll pop count }%
}%
\def\PIT@name@default{@tmp}%
@@ -152,15 +159,38 @@
\PIT@checkname{#1}%
\addto@pscode{%
\pst@intersectdict
+ \PIT@key@tstop\space dup 0 lt { pop \PIT@name{#1} GetSegmentCount } if
+ \PIT@key@tstart\space dup 0 lt { pop 0 } if exch
+ \PIT@name{#1} GetSegmentCount
+ 2 copy exch dup 3 1 roll
+ lt exch 0 lt or { exch } if pop
\PIT@name{#1} dup IsPath {
- \PIT@key@tstart\space\PIT@key@tstop\space
+ 3 1 roll 2 copy gt {
+ exch 3 -1 roll dup 4 1 roll GetSegmentCount
+ dup 4 1 roll exch sub 3 1 roll sub exch
+ gsave newpath
+ [ 4 -1 roll aload pop InitTracing
+ { counttomark 0 eq { exit } if
+ load exec
+ } loop
+ reversepath
+ GetFullPath ] 3 1 roll
+ grestore
+ } if
ShowPathPortion
}{
- [exch dup
- \PIT@key@tstart\space\PIT@key@tstop\space
- dup 0 lt { pop 1 } if
+ [ exch dup 5 -2 roll
+ 2 copy gt {
+ exch
+ 2 copy gt { exch } if
+ [ 5 -2 roll pop PointArrayToArray aload pop
+ counttomark -2 4 { 2 roll } for ] ArrayToPointArray dup
+ 4 2 roll
+ } if
ToUnitInterval Portion
{ aload pop } forall
+ % reverse the point order
+ counttomark -2 4 { 2 roll } for
counttomark 2 sub 2 idiv
\psk@plotpoints
exch
@@ -198,6 +228,7 @@
} {
\PIT@key@tstart
} ifelse
+ dup 0 lt { pop 0 } if
exch % [curve] t_istart|tstart [ts]
%
dup length \PIT@key@istop\space ge 0 \PIT@key@istop\space lt and {
@@ -205,14 +236,35 @@
} {
pop \PIT@key@tstop
} ifelse
- 2 copy 2 copy gt 3 1 roll -1 gt exch -1 gt and and { exch } if
+ 3 -1 roll dup 4 1 roll GetSegmentCount
+ 2 copy exch dup 3 1 roll % [curve] tstart tstop cnt tstop cnt tstop
+ lt exch 0 lt or { exch } if pop % (tstop < 0 | cnt < tstop)
3 -1 roll dup
IsPath {
3 1 roll
+ 2 copy gt {
+ exch 3 -1 roll dup 4 1 roll GetSegmentCount
+ dup 4 1 roll exch sub 3 1 roll sub exch
+ gsave newpath
+ [ 4 -1 roll aload pop InitTracing
+ { counttomark 0 eq { exit } if
+ load exec
+ } loop
+ reversepath
+ GetFullPath ] 3 1 roll
+ grestore
+ } if
ShowPathPortion
}{
[ exch dup 5 -2 roll
+ exch dup 0 lt { pop 0 } if exch
dup 0 lt { pop 1 } if
+ 2 copy gt {
+ exch
+ [ 5 -2 roll pop PointArrayToArray aload pop
+ counttomark -2 4 { 2 roll } for ] ArrayToPointArray dup
+ 4 2 roll
+ } if
ToUnitInterval Portion
{ aload pop } forall
counttomark 2 sub 2 idiv
diff --git a/Master/texmf-dist/tex/latex/pst-intersect/pst-intersect.sty b/Master/texmf-dist/tex/latex/pst-intersect/pst-intersect.sty
index b44496fb076..bb37a46755c 100644
--- a/Master/texmf-dist/tex/latex/pst-intersect/pst-intersect.sty
+++ b/Master/texmf-dist/tex/latex/pst-intersect/pst-intersect.sty
@@ -31,19 +31,15 @@
%%
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{pst-intersect}
- [2014/02/19 v0.1 package wrapper for pst-intersect.tex]
-\NeedsTeXFormat{LaTeX2e}[1999/12/01]
-\ProvidesPackage{pst-intersect}%
- [2014/02/06 v0.1alpha package wrapper for pst-intersect.tex]
+ [2014/02/26 v0.2 package wrapper for pst-intersect.tex]
\RequirePackage{pstricks}
\RequirePackage{pst-xkey}
\RequirePackage{pst-node}
-\RequirePackage{multido}
\RequirePackage{pst-func}
\input{pst-intersect.tex}
\IfFileExists{pst-intersect.pro}{%
\ProvidesFile{pst-intersect.pro}
- [2014/02/06 PostScript prologue file]
+ [2014/02/26 PostScript prologue file]
\@addtofilelist{pst-intersect.pro}}{}%
\endinput
%%