summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pst-intersect
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 /Master/texmf-dist/tex/generic/pst-intersect
parentb915e2e1843abfed0f5230f03991029d7b42dfd3 (diff)
pst-intersect (26feb14)
git-svn-id: svn://tug.org/texlive/trunk@33056 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/pst-intersect')
-rw-r--r--Master/texmf-dist/tex/generic/pst-intersect/pst-intersect.tex80
1 files changed, 66 insertions, 14 deletions
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