Debian Codegraph @

texmf-dist/tex/generic/pst-intersect/pst-intersect.tex

raw
1 %%
2 %% This is file `pst-intersect.tex',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% pst-intersect.dtx (with options: `texfile')
8 %%
9 %% This is a generated file.
10 %%
11 %% Project: pst-intersect
12 %% Version: 0.4 (2014/03/16)
13 %%
14 %% Copyright (C) 2007-2014 by Christoph Bersch <[email protected]>
15 %%
16 %% This work may be distributed and/or modified under the
17 %% conditions of the LaTeX Project Public License, either version 1.3c
18 %% of this license or (at your option) any later version.
19 %% The latest version of this license is in
20 %% http://www.latex-project.org/lppl.txt
21 %% and version 1.3c or later is part of all distributions of LaTeX
22 %% version 2008/05/04 or later.
23 %%
24 %% This work has the LPPL maintenance status "maintained".
25 %%
26 %% The current maintainer of this work is Christoph Bersch.
27 %%
28 %% This work consists of the files pst-intersect.dtx and pst-intersect.ins
29 %% and the derived files
30 %% pst-intersect.sty, pst-intersect.tex, pst-intersect.pro.
31 %%
32 \csname PSTintersectLoaded\endcsname
33 \let\PSTintersectLoaded\endinput
34
35 \ifx\PSTricksLoaded\endinput\else\input pstricks.tex \fi
36 \ifx\PSTXKeyLoaded\endinput\else \input pst-xkey.tex \fi
37 \ifx\PSTnodesLoaded\endinput\else\input pst-node.tex \fi
38 \ifx\PSTfuncLoaded\endinput\else \input pst-func.tex \fi
39
40 \edef\PstAtCode{\the\catcode`\@} \catcode`\@=11\relax
41
42 \pst@addfams{intersect}
43 \pstheader{pst-intersect.pro}
44
45 \def\pst@intersectdict{tx@IntersectDict begin }
46 \def\PIT@dict#1{\pst@intersectdict #1 end}
47 \def\PIT@Verb#1{\pst@Verb{\PIT@dict{#1} }}%
48 \define@key[psset]{intersect}{tstart}{%
49 \pst@checknum{#1}\PIT@key@tstart
50 }
51 \define@key[psset]{intersect}{tstop}{%
52 \pst@checknum{#1}\PIT@key@tstop
53 }
54 \define@key[psset]{intersect}{istart}{%
55 \pst@checknum{#1}\PIT@key@istart
56 }
57 \define@key[psset]{intersect}{istop}{%
58 \pst@checknum{#1}\PIT@key@istop
59 }
60 \define@key[psset]{intersect}{name}{%
61 \def\PIT@key@name{#1}%
62 }%
63 \newif\PIT@saveintersections
64 \define@boolkey[psset]{intersect}[PIT@]{saveintersections}[true]{}
65 \newif\PIT@addintersections
66 \define@boolkey[psset]{intersect}[PIT@]{addintersections}[true]{}
67
68 \psset[intersect]{%
69 tstart=-1,
70 tstop=-1,
71 istart=-1,
72 istop=-1,
73 name={},
74 saveintersections,
75 addintersections=false
76 }%
77 \def\PIT@use@pscode{%
78 \pstverb{%
79 \pst@dict
80 \tx@STP
81 \pst@newpath
82 \psk@origin
83 \psk@swapaxes
84 \pst@code
85 end
86 count /ocount exch def
87 }%
88 \gdef\pst@code{}%
89 }%
90 \let\PIT@pst@stroke@orig\pst@stroke
91 \def\PIT@save@path{%
92 \PIT@pst@stroke@orig
93 \addto@pscode{%
94 clear mark
95 \pst@intersectdict GetFullPath end
96 counttomark 1 add -1 roll pop count }%
97 }%
98 \def\PIT@name@default{@tmp}%
99 \def\PIT@name#1{PIT@#1}%
100 \def\PIT@checkname#1{%
101 \ifx\@empty#1\@empty
102 \@pstrickserr{Unexpected empty argument!}\@ehpb
103 \fi
104 }%
105 \def\pssavebezier{\pst@object{pssavebezier}}
106 \def\pssavebezier@i#1{%
107 \begin@OpenObj
108 \PIT@checkname{#1}%
109 \addto@pscode{ /\PIT@name{#1} }%
110 \pst@getcoors[\pssavebezier@ii%]
111 }%
112 \def\pssavebezier@ii{%
113 \addto@pscode{%
114 counttomark 20 gt { counttomark 20 sub { pop } repeat } if
115 counttomark 2 idiv 1 sub
116 \psk@plotpoints\space exch
117 \txFunc@BezierCurve
118 \ifshowpoints \txFunc@BezierShowPoints \else pop \fi
119 tx@FuncDict begin Points aload pop end
120 }%
121 \let\use@pscode\PIT@use@pscode
122 \end@OpenObj
123 \PIT@Verb{%
124 [ count 1 sub 1 roll ] ArrayToPointArray def
125 }%
126 \ignorespaces}%
127 \def\pssavepath{\pst@object{pssavepath}}%
128 \long\def\pssavepath@i#1#2{%
129 \begin@SpecialObj
130 \PIT@checkname{#1}%
131 \let\pst@stroke\PIT@save@path
132 \let\use@pscode\PIT@use@pscode
133 \pscustom{#2}%
134 \PIT@Verb{%
135 /\PIT@name{#1}
136 [ 3 -1 roll 2 add 2 roll ] def }%
137 \end@SpecialObj
138 }%
139 \def\pstracecurve{\pst@object{pstracecurve}}%
140 \def\pstracecurve@i#1{%
141 \addbefore@par{plotpoints=200}%
142 \begin@OpenObj
143 \@ifnextchar\bgroup
144 {\PIT@traceintersection{#1}}%
145 {\PIT@tracecurve{#1}}%
146 }%
147 \def\PIT@tracecurve#1{%
148 \PIT@checkname{#1}%
149 \addto@pscode{%
150 \pst@intersectdict
151 /\PIT@name{#1} currentdict exch known not {
152 (You haven't defined the curve '#1') ==
153 } if
154 \PIT@name{#1} \PIT@key@tstart\space\PIT@key@tstop\space % [curve] tstart tstop
155 {\psk@plotpoints exch
156 \txFunc@BezierCurve
157 \ifshowpoints \txFunc@BezierShowPoints \else pop \fi
158 }
159 TraceCurveOrPath
160 end
161 }%
162 %\showpointsfalse
163 \end@OpenObj
164 }%
165 \def\PIT@traceintersection#1#2{%
166 \PIT@checkname{#2}%
167 \addto@pscode{%
168 \pst@intersectdict
169 \ifx\\#1\\%
170 /\PIT@name{\PIT@name@default}
171 \else
172 /\PIT@name{#1}
173 \fi
174 dup currentdict exch known not {
175 \ifx\\#1\\%
176 (You haven't defined an intersection!) ==
177 \else
178 (You haven't defined the intersection '#1') ==
179 \fi
180 } if
181 load
182 dup dup type /dicttype eq exch /\PIT@name{#2} known and not {
183 (You haven't defined the intersection '#2') ==
184 } if
185 dup /\PIT@name{#2} get
186 exch /\PIT@name{#2}@t get
187 dup length \PIT@key@istart\space ge 0 \PIT@key@istart\space lt and {
188 dup \PIT@key@istart\space cvi 1 sub get
189 } {
190 \PIT@key@tstart
191 } ifelse
192 exch % [curve] t_istart|tstart [ts]
193 dup length \PIT@key@istop\space ge 0 \PIT@key@istop\space lt and {
194 \PIT@key@istop\space cvi 1 sub get
195 } {
196 pop \PIT@key@tstop
197 } ifelse % [curve] tstart tstop
198 {\psk@plotpoints exch
199 \txFunc@BezierCurve
200 \ifshowpoints \txFunc@BezierShowPoints \else pop \fi
201 }
202 TraceCurveOrPath
203 end
204 }%
205 %\showpointsfalse
206 \end@OpenObj
207 }%
208 \def\psintersect{\pst@object{psintersect}}
209 \def\psintersect@i#1#2{%
210 \PIT@checkname{#1}%
211 \PIT@checkname{#2}%
212 \begin@SpecialObj
213 \def\PIT@@name{%
214 \ifx\PIT@key@name\@empty
215 \PIT@name{\PIT@name@default}
216 \else
217 \PIT@name{\PIT@key@name}
218 \fi}%
219 \PIT@Verb{%
220 currentdict /\PIT@name{#1} known not {
221 (You haven't defined the curve or path '#1') ==
222 } if
223 currentdict /\PIT@name{#2} known not {
224 (You haven't defined the curve or path '#2') ==
225 } if
226 \PIT@name{#1} \PIT@name{#2}
227 \PIT@name{#1} IsPath {
228 \PIT@name{#2} IsPath {
229 IntersectPaths
230 }{
231 IntersectPathCurve
232 } ifelse
233 }{
234 \PIT@name{#2} IsPath {
235 IntersectCurvePath
236 }{
237 IntersectBeziers
238 4 copy LoadIntersectionPoints 5 1 roll
239 } ifelse
240 } ifelse
241 /\PIT@name{#1} /\PIT@name{#2} /\PIT@@name
242 \ifPIT@addintersections true \else false \fi
243 SaveIntersection
244 }%
245 \ifPIT@saveintersections
246 \pst@Verb{%
247 \pst@intersectdict
248 \PIT@@name\space /Points get
249 ArrayToPointArray
250 end
251 dup length 1 1 3 -1 roll {
252 2 copy 1 sub get
253 \ifPst@saveNodeCoors
254 \pst@intersectdict
255 2 copy aload pop \tx@UserCoor 3 -1 roll
256 20 string cvs (N-\PIT@key@name) exch strcat dup
257 (.y) strcat cvn exch (.x) strcat cvn
258 end
259 4 -1 roll def exch def
260 \fi
261 cvx
262 false 3 -1 roll (N@\PIT@key@name) exch 20 string cvs
263 \pst@intersectdict strcat end cvn
264 tx@NodeDict begin
265 10 {InitPnode} /NodeScale {} def NewNode
266 end
267 } for
268 pop
269 }%
270 \fi
271 \ifshowpoints
272 \addto@pscode{%
273 \pst@intersectdict
274 [ \PIT@@name\space /Points get aload pop
275 end
276 }%
277 \psdots@ii
278 \else
279 \end@SpecialObj
280 \fi
281 }%
282 \def\psGetIsectCenter#1#2#3{%
283 \pst@intersectdict
284 \ifx\\#2\\%
285 \PIT@name{#1} /Points get dup #3 1 sub 2 mul get exch #3 2 mul 1 sub get
286 \else
287 \PIT@name{#1} /\PIT@name{#2@t} get #3 1 sub get
288 \PIT@name{#1} /\PIT@name{#2} get
289 dup IsPath {
290 PreparePath dup length 1 sub
291 3 -1 roll dup dup
292 cvi sub 4 1 roll
293 cvi sub get
294 } if
295 PointArrayToArray
296 tx@FuncDict begin 2 dict begin
297 dup length 2 idiv 1 sub /BezierType exch def /Points exch def GetBezierCoor
298 end end
299 \fi
300 end
301 \tx@UserCoor /I-#1#3.y exch def /I-#1#3.x exch def
302 }%
303 \def\psGetCurvePoint#1#2{%
304 \pst@intersectdict
305 currentdict /\PIT@name{#1} known not {
306 (You haven't defined the curve or path '#1') ==
307 } if
308 #2 \PIT@name{#1} GetCurvePoint \tx@UserCoor
309 end
310 /I-#1.y exch def /I-#1.x exch def
311 }%
312 \catcode`\@=\PstAtCode\relax
313 \endinput
314 %%
315 %% End of file `pst-intersect.tex'.