Debian Codegraph @

texmf-dist/tex/latex/spath3/tikzlibraryspath3.code.tex

raw
1 %%
2 %% This is file `tikzlibraryspath3.code.tex',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% spath3_code.dtx (with options: `tikzspath3')
8 %% ----------------------------------------------------------------
9 %% spath3 --- Functions for manipulating PGF soft paths
10 %% E-mail: Andrew Stacey <[email protected]>
11 %% Released under the LaTeX Project Public License v1.3c or later
12 %% See http://www.latex-project.org/lppl.txt
13 %% ----------------------------------------------------------------
14 %%
15 \RequirePackage{spath3}
16 \RequirePackage{expl3}
17 \ExplSyntaxOn
18
19 \tl_new:N \l__tikzspath_tmpa_tl
20 \tl_new:N \l__tikzspath_tmpb_tl
21 \tl_new:N \l__tikzspath_tmpc_tl
22 \tl_new:N \l__tikzspath_tmpd_tl
23 \tl_new:N \l__tikzspath_tmpe_tl
24 \tl_new:N \l__tikzspath_tmpf_tl
25
26 \int_new:N \l__tikzspath_tmpa_int
27 \seq_new:N \l__tikzspath_tmpa_seq
28 \seq_new:N \l__tikzspath_tmpb_seq
29 \seq_new:N \l__tikzspath_tmpc_seq
30 \seq_new:N \l__tikzspath_tmpd_seq
31
32 \tl_new:N \l__tikzspath_current_tl
33 \tl_new:N \l__tikzspath_reverse_tl
34 \tl_new:N \l__tikzspath_prefix_tl
35 \tl_new:N \l__tikzspath_suffix_tl
36 \tl_new:N \g__tikzspath_smuggle_tl
37 \tl_new:N \g__tikzspath_output_tl
38 \tl_new:N \l__tikzspath_check_tl
39 \clist_new:N \g__tikzspath_output_clist
40 \seq_new:N \g__tikzspath_tmpa_seq
41 \seq_new:N \g__tikzspath_tmpb_seq
42 \seq_new:N \g__tikzspath_output_seq
43 \bool_new:N \l__tikzspath_draft_bool
44 \msg_new:nnn { spath3 } { missing soft path }
45 { Soft~ path~ #1~ doesn't~ exist~ \msg_line_context:}
46 \msg_new:nnnn { spath3 } { empty soft path }
47 { Soft~ path~ #1~ is~ empty~ \msg_line_context:}
48 {If~ it~ was~ defined~ inside~ a~ group,~ try~ using~ "save~ global". }
49 \msg_new:nnn { spath3 } { load intersections }
50 { You~ need~ to~ load~ the~ "intersections"~ library~
51 to~ work~ with~ intersections }
52 \tl_set:Nn \l__tikzspath_prefix_tl {tikz@intersect@path@name@}
53 \tl_set:Nn \l__tikzspath_suffix_tl {}
54 \tl_new:N \g__tikzspath_tikzfinish_tl
55 \tl_new:N \l__tikzspath_tikzfinish_outside_tl
56 \cs_new_protected_nopar:Npn \spath_at_end_of_path:
57 {
58 \tl_use:N \g__tikzspath_tikzfinish_tl
59 \tl_gclear:N \g__tikzspath_tikzfinish_tl
60 }
61 \tl_put_right:Nn \tikz@finish {\spath_at_end_of_path:}
62
63 \tikzset{
64 every~ scope/.append~ style={
65 execute~ at~ begin~ scope={
66 \tl_set_eq:NN \l__tikzspath_tikzfinish_outside_tl \g__tikzspath_tikzfinish_tl
67 },
68 execute~ at~ end~ scope={
69 \tl_use:N \g__tikzspath_tikzfinish_tl
70 \tl_gclear:N \g__tikzspath_tikzfinish_tl
71 \tl_gset_eq:NN \g__tikzspath_tikzfinish_tl \l__tikzspath_tikzfinish_outside_tl
72 },
73 },
74 }
75 \tl_new:N \l__tikzspath_tikzpath_finish_tl
76
77 \cs_new_protected_nopar:Npn \__tikzspath_at_end_of_path_construction:
78 {
79 \tl_use:N \l__tikzspath_tikzpath_finish_tl
80 \tl_clear:N \l__tikzspath_tikzpath_finish_tl
81 }
82
83 \tl_put_left:Nn \tikz@finish {\__tikzspath_at_end_of_path_construction:}
84 \cs_new_protected_nopar:Npn \spath_save_path:Nn #1#2
85 {
86 \tl_if_empty:NF \g__tikzspath_tikzfinish_tl
87 {
88 \tl_use:N \g__tikzspath_tikzfinish_tl
89 }
90 \tl_gput_right:Nn \g__tikzspath_tikzfinish_tl
91 {
92 \tl_clear_new:N #1
93 \tl_set:Nn #1 {#2}
94 }
95 }
96 \cs_generate_variant:Nn \spath_save_path:Nn {cn, NV, cV}
97
98 \cs_new_protected_nopar:Npn \spath_gsave_path:Nn #1#2
99 {
100 \tl_gput_right:Nn \g__tikzspath_tikzfinish_tl
101 {
102 \tl_gclear_new:N #1
103 \tl_gset:Nn #1 {#2}
104 }
105 }
106 \cs_generate_variant:Nn \spath_gsave_path:Nn {cn, NV, cV}
107 \cs_new_protected_nopar:Npn \__tikzspath_process_tikz_point:Nn #1#2
108 {
109 \group_begin:
110 \use:c {tikz@scan@one@point} \use:n #2 \scan_stop:
111 \tl_gset:Nx \g__tikzspath_output_tl
112 {
113 { \dim_use:c {pgf@x} }
114 { \dim_use:c {pgf@y} }
115 }
116 \group_end:
117 \tl_set_eq:NN #1 \g__tikzspath_output_tl
118 \tl_gclear:N \g__tikzspath_output_tl
119 }
120 \cs_set_eq:NN \__tikzspath_tikzset:n \tikzset
121 \cs_generate_variant:Nn \__tikzspath_tikzset:n {V, v}
122 \cs_new_protected_nopar:Npn \__tikzspath_check_path:nnn #1#2#3
123 {
124 \tl_set:Nn \l__tikzspath_check_tl {#3}
125 \tl_if_exist:cTF {\__tikzspath_path_name:n {#2}}
126 {
127 \tl_if_empty:cTF {\__tikzspath_path_name:n {#2}}
128 {
129 \msg_warning:nnn { spath3 } { empty soft path } { #2 }
130 }
131 {
132 \tl_set:Nn \l__tikzspath_check_tl {
133 #1 {\__tikzspath_path_name:n {#2}}
134 }
135 }
136 }
137 {
138 \msg_warning:nnx { spath3 } { missing soft path } { #2 }
139 }
140 \tl_use:N \l__tikzspath_check_tl
141 }
142 \cs_new_protected_nopar:Npn \__tikzspath_check_two_paths:nnnn #1#2#3#4
143 {
144 \__tikzspath_check_path:nnn {
145 \__tikzspath_check_path:nnn {#1}{#2}{#4}
146 }{#3}{#4}
147 }
148 \cs_new_protected_nopar:Npn \__tikzspath_check_three_paths:nnnnn #1#2#3#4#5
149 {
150 \__tikzspath_check_path:nnn {
151 \__tikzspath_check_path:nnn {
152 \__tikzspath_check_path:nnn {#1}{#2}{#5}
153 }{#3}{#5}
154 }{#4}{#5}
155 }
156 \cs_generate_variant:Nn \__tikzspath_check_path:nnn {nVn}
157 \cs_generate_variant:Nn \__tikzspath_check_two_paths:nnnn {nnVn}
158 \cs_new_protected_nopar:Npn \__tikzspath_maybe_current_path:nn #1#2
159 {
160 \tl_if_eq:nnT {#2} {current}
161 {
162 \spath_get_current_path:c {\__tikzspath_path_name:n {#2}}
163 }
164 #1 {#2}
165 }
166 \cs_new_protected_nopar:Npn \__tikzspath_maybe_current_path_reuse:nnn #1#2#3
167 {
168 \bool_set_true:N \l_spath_movetorelevant_bool
169 \tl_if_eq:nnT {#2} {current}
170 {
171 \spath_get_current_path:c {\__tikzspath_path_name:n {#2}}
172 }
173 #1 {#2} #3
174 \tl_if_eq:nnT {#2} {current}
175 {
176 \tl_if_empty:cF {\__tikzspath_path_name:n {#2}}
177 {
178 \spath_set_current_path:c {\__tikzspath_path_name:n {#2}}
179 \spath_set_tikz_data:v {\__tikzspath_path_name:n {#2}}
180 }
181 }
182 }
183 \cs_new_protected_nopar:Npn \__tikzspath_maybe_current_two_paths_reuse_both:nnnn #1#2#3#4
184 {
185 \bool_set_true:N \l_spath_movetorelevant_bool
186 \tl_if_eq:nnT {#2} {current}
187 {
188 \spath_get_current_path:c {\__tikzspath_path_name:n {#2}}
189 }
190 \tl_if_eq:nnT {#3} {current}
191 {
192 \spath_get_current_path:c {\__tikzspath_path_name:n {#3}}
193 }
194 #1 {#2} {#3} #4
195 \tl_if_eq:nnT {#2} {current}
196 {
197 \tl_if_empty:cF {\__tikzspath_path_name:n {#2}}
198 {
199 \spath_set_current_path:c {\__tikzspath_path_name:n {#2}}
200 \spath_set_tikz_data:v {\__tikzspath_path_name:n {#2}}
201 }
202 }
203 \tl_if_eq:nnT {#3} {current}
204 {
205 \tl_if_empty:cF {\__tikzspath_path_name:n {#3}}
206 {
207 \spath_set_current_path:c {\__tikzspath_path_name:n {#3}}
208 \spath_set_tikz_data:v {\__tikzspath_path_name:n {#3}}
209 }
210 }
211 }
212 \cs_new_protected_nopar:Npn \__tikzspath_maybe_current_two_paths_reuse_first:nnnn #1#2#3#4
213 {
214 \bool_set_true:N \l_spath_movetorelevant_bool
215 \tl_if_eq:nnT {#2} {current}
216 {
217 \spath_get_current_path:c {\__tikzspath_path_name:n {#2}}
218 }
219 \tl_if_eq:nnT {#3} {current}
220 {
221 \spath_get_current_path:c {\__tikzspath_path_name:n {#3}}
222 }
223 #1 {#2} {#3} #4
224 \tl_if_eq:nnT {#2} {current}
225 {
226 \tl_if_empty:cF {\__tikzspath_path_name:n {#2}}
227 {
228 \spath_set_current_path:c {\__tikzspath_path_name:n {#2}}
229 \spath_set_tikz_data:v {\__tikzspath_path_name:n {#2}}
230 }
231 }
232 }
233 \cs_new_protected_nopar:Npn \__tikzspath_maybe_current_two_paths_reuse_second:nnnn #1#2#3#4
234 {
235 \bool_set_true:N \l_spath_movetorelevant_bool
236 \tl_if_eq:nnT {#2} {current}
237 {
238 \spath_get_current_path:c {\__tikzspath_path_name:n {#2}}
239 }
240 \tl_if_eq:nnT {#3} {current}
241 {
242 \spath_get_current_path:c {\__tikzspath_path_name:n {#3}}
243 }
244 #1 {#2} {#3} #4
245 \tl_if_eq:nnT {#3} {current}
246 {
247 \tl_if_empty:cF {\__tikzspath_path_name:n {#3}}
248 {
249 \spath_set_current_path:c {\__tikzspath_path_name:n {#3}}
250 \spath_set_tikz_data:v {\__tikzspath_path_name:n {#3}}
251 }
252 }
253 }
254 \cs_generate_variant:Nn \__tikzspath_maybe_current_path:nn {nV}
255 \cs_generate_variant:Nn \__tikzspath_maybe_current_path_reuse:nnn {nVn}
256 \cs_new_protected_nopar:Npn \__tikzspath_seq_from_foreach:Nnn #1#2#3
257 {
258 \group_begin:
259 \seq_gclear:N \g__tikzspath_output_seq
260
261 \tl_if_empty:nTF {#3}
262 {
263 \int_step_inline:nnnn {1}{1} {#2}
264 {
265 \seq_gput_right:Nn \g__tikzspath_output_seq {##1}
266 }
267 }
268 {
269 \foreach \l__tikzspath_tmpa_tl in {#3}
270 {
271 \int_compare:nTF { \l__tikzspath_tmpa_tl > 0 }
272 {
273 \seq_gput_right:NV \g__tikzspath_output_seq \l__tikzspath_tmpa_tl
274 }
275 {
276 \seq_gput_right:Nx \g__tikzspath_output_seq
277 {\int_eval:n {#2 - \l__tikzspath_tmpa_tl}}
278 }
279 }
280 \seq_gsort:Nn \g__tikzspath_output_seq
281 {
282 \int_compare:nNnTF {##1} < {##2}
283 { \sort_return_same: }
284 { \sort_return_swapped: }
285 }
286 }
287 \group_end:
288 \seq_set_eq:NN #1 \g__tikzspath_output_seq
289 \seq_gclear:N \g__tikzspath_output_seq
290 }
291 \cs_generate_variant:Nn \__tikzspath_seq_from_foreach:Nnn {NVV, NVn}
292 \cs_new:Npn \__tikzspath_path_name:n #1
293 {
294 \tl_use:N \l__tikzspath_prefix_tl
295 #1
296 \tl_use:N \l__tikzspath_suffix_tl
297 }
298 \cs_generate_variant:Nn \__tikzspath_path_name:n {V}
299 \bool_new:N \l__tikzspath_reverse_bool
300 \bool_new:N \l__tikzspath_weld_bool
301 \bool_new:N \l__tikzspath_move_bool
302 \bool_new:N \l__tikzspath_global_bool
303 \bool_new:N \l__tikzspath_current_transformation_bool
304 \tl_new:N \l__tikzspath_joinpath_tl
305 \tl_new:N \l__tikzspath_transformation_tl
306
307 \cs_new_protected_nopar:Npn \__tikzspath_set_bool:Nn #1#2
308 {
309 \tl_if_eq:nnTF {#2}{false}
310 {
311 \bool_set_false:N #1
312 }
313 {
314 \bool_set_true:N #1
315 }
316 }
317 \tikzset {
318 spath/join/.is~ family,
319 spath/join/.cd,
320 reverse/.code = {
321 \__tikzspath_set_bool:Nn \l__tikzspath_reverse_bool {#1}
322 },
323 reverse/.default = true,
324 weld/.code = {
325 \__tikzspath_set_bool:Nn \l__tikzspath_weld_bool {#1}
326 },
327 weld/.default = true,
328 no~ weld/.code = {
329 \__tikzspath_set_bool:Nn \l__tikzspath_weld_bool {#1}
330 \bool_set:Nn \l__tikzspath_weld_bool {! \l__tikzspath_weld_bool}
331 },
332 no~ weld/.default = true,
333 move/.code = {
334 \__tikzspath_set_bool:Nn \l__tikzspath_move_bool {#1}
335 },
336 move/.default = true,
337 no~ move/.code = {
338 \__tikzspath_set_bool:Nn \l__tikzspath_move_bool {#1}
339 \bool_set:Nn \l__tikzspath_move_bool {! \l__tikzspath_move_bool}
340 },
341 no~ move/.default = true,
342 global/.code = {
343 \__tikzspath_set_bool:Nn \l__tikzspath_global_bool {#1}
344 },
345 global/.default = true,
346 use~ current~ transformation/.code={
347 \__tikzspath_set_bool:Nn \l__tikzspath_current_transformation_bool {#1}
348 },
349 use~ current~ transformation/.default = true,
350 transform/.store~in=\l__tikzspath_transformation_tl,
351 .unknown/.code = {
352 \tl_set_eq:NN \l__tikzspath_joinpath_tl \pgfkeyscurrentname
353 }
354 }
355 \cs_set_eq:NN \getComponentOf \clist_item:Nn
356 \cs_new_protected_nopar:Npn \__tikzspath_use_path:n #1
357 {
358 \tl_set:Nn \l__tikzspath_joinpath_tl {#1}
359 \spath_get_current_path:N \l__tikzspath_current_tl
360
361 \bool_if:NT \l__tikzspath_reverse_bool
362 {
363 \spath_reverse:N \l__tikzspath_joinpath_tl
364 }
365
366 \bool_if:NT \l__tikzspath_current_transformation_bool
367 {
368 \pgfgettransform \l__tikzspath_tmpa_tl
369 \spath_transform:NV
370 \l__tikzspath_joinpath_tl
371 \l__tikzspath_tmpa_tl
372 }
373
374 \tl_if_empty:NF \l__tikzspath_transformation_tl
375 {
376 \group_begin:
377 \pgftransformreset
378 \__tikzspath_tikzset:V \l__tikzspath_transformation_tl
379 \pgfgettransform \l__tikzspath_tmpa_tl
380 \tl_gset:Nn \g__tikzspath_smuggle_tl
381 {
382 \spath_transform:Nnnnnnn
383 \l__tikzspath_joinpath_tl
384 }
385 \tl_gput_right:NV \g__tikzspath_smuggle_tl \l__tikzspath_tmpa_tl
386 \group_end:
387 \tl_use:N \g__tikzspath_smuggle_tl
388 }
389
390 \bool_if:NT \l__tikzspath_move_bool
391 {
392 \tl_if_empty:NTF \l__tikzspath_current_tl
393 {
394 \tl_set:Nn \l__tikzspath_tmpc_tl { {0pt} {0pt} }
395 }
396 {
397 \spath_finalpoint:NV
398 \l__tikzspath_tmpc_tl
399 \l__tikzspath_current_tl
400 }
401 \spath_translate_to:NV \l__tikzspath_joinpath_tl \l__tikzspath_tmpc_tl
402 }
403
404 \tl_if_empty:NTF \l__tikzspath_current_tl
405 {
406 \tl_if_empty:NTF \l__tikzspath_joinpath_tl
407 {
408 \tl_set_eq:NN \l__tikzspath_current_tl \c_spath_moveto_tl
409 \tl_put_right:Nn \l__tikzspath_current_tl {{0pt}{0pt}}
410 }
411 {
412 \tl_set_eq:NN \l__tikzspath_current_tl \l__tikzspath_joinpath_tl
413 }
414 }
415 {
416
417 \tl_clear:N \l__tikzspath_tmpa_tl
418 \tl_set:Nn \l__tikzspath_tmpa_tl {spath_}
419
420 \tl_put_right:Nn \l__tikzspath_tmpa_tl {append}
421
422 \bool_if:NT \l__tikzspath_weld_bool
423 {
424 \tl_put_right:Nn \l__tikzspath_tmpa_tl {_no_move}
425 \spath_numberofcomponents:NV \l__tikzspath_tmpa_int \l__tikzspath_joinpath_tl
426 \int_compare:nT {\l__tikzspath_tmpa_int == 1}
427 {
428 \bool_set_false:N \l_spath_movetorelevant_bool
429 }
430 }
431 \tl_put_right:Nn \l__tikzspath_tmpa_tl {:NV}
432
433 \use:c {\tl_use:N \l__tikzspath_tmpa_tl }
434 \l__tikzspath_current_tl
435 \l__tikzspath_joinpath_tl
436 }
437
438 \spath_set_current_path:N \l__tikzspath_current_tl
439 \spath_set_tikz_data:V \l__tikzspath_joinpath_tl
440 }
441 \cs_generate_variant:Nn \__tikzspath_use_path:n {V, v}
442 \cs_new_protected_nopar:Npn \__tikzspath_join_with:Nn #1#2
443 {
444 \tl_set:Nn \l__tikzspath_joinpath_tl {#2}
445
446 \bool_if:NT \l__tikzspath_reverse_bool
447 {
448 \spath_reverse:N \l__tikzspath_joinpath_tl
449 }
450
451 \tl_if_empty:NF \l__tikzspath_transformation_tl
452 {
453 \group_begin:
454 \pgftransformreset
455 \__tikzspath_tikzset:V \l__tikzspath_transformation_tl
456 \pgfgettransform \l__tikzspath_tmpa_tl
457 \tl_gset:Nn \g__tikzspath_smuggle_tl
458 {
459 \spath_transform:Nnnnnnn
460 \l__tikzspath_joinpath_tl
461 }
462 \tl_gput_right:NV \g__tikzspath_smuggle_tl \l__tikzspath_tmpa_tl
463 \group_end:
464 \tl_use:N \g__tikzspath_smuggle_tl
465 }
466
467 \bool_if:NT \l__tikzspath_move_bool
468 {
469 \spath_finalpoint:NV
470 \l__tikzspath_tmpc_tl
471 #1
472 \spath_translate_to:NV \l__tikzspath_joinpath_tl \l__tikzspath_tmpc_tl
473 }
474
475 \tl_clear:N \l__tikzspath_tmpa_tl
476 \tl_set:Nn \l__tikzspath_tmpa_tl {spath_}
477
478 \bool_if:NT \l__tikzspath_global_bool
479 {
480 \tl_put_right:Nn \l__tikzspath_tmpa_tl {g}
481 }
482
483 \tl_put_right:Nn \l__tikzspath_tmpa_tl {append}
484
485 \bool_if:NT \l__tikzspath_weld_bool
486 {
487 \tl_put_right:Nn \l__tikzspath_tmpa_tl {_no_move}
488 }
489 \tl_put_right:Nn \l__tikzspath_tmpa_tl {:NV}
490
491 \cs_if_exist:cF {\tl_use:N \l__tikzspath_tmpa_tl}
492 {
493 \tl_show:N \l__tikzspath_tmpa_tl
494 }
495
496 \use:c {\tl_use:N \l__tikzspath_tmpa_tl } #1
497 \l__tikzspath_joinpath_tl
498 }
499 \cs_generate_variant:Nn \__tikzspath_join_with:Nn {cv, cn}
500 \cs_new_protected_nopar:Npn \__tikzspath_join_components_with_aux:nnn #1#2#3
501 {
502 \group_begin:
503 \tl_set:Nn \l__tikzspath_tmpc_tl {#1}
504 \tl_if_empty:nT {#3}
505 {
506 \spath_spot_weld_components:N \l__tikzspath_tmpc_tl
507 }
508
509 \spath_numberofcomponents:NV \l__tikzspath_tmpa_int \l__tikzspath_tmpc_tl
510 \__tikzspath_seq_from_foreach:NVn \l__tikzspath_tmpb_seq \l__tikzspath_tmpa_int {#3}
511
512 \spath_components_to_seq:NV \l__tikzspath_tmpa_seq \l__tikzspath_tmpc_tl
513
514 \seq_pop_left:NN \l__tikzspath_tmpa_seq \l__tikzspath_tmpa_tl
515 \seq_pop_left:NN \l__tikzspath_tmpb_seq \l__tikzspath_tmpb_tl
516
517 \seq_map_indexed_inline:Nn \l__tikzspath_tmpa_seq
518 {
519 \int_compare:nTF
520 {
521 ##1 == \l__tikzspath_tmpb_tl
522 }
523 {
524 \seq_pop_left:NNF \l__tikzspath_tmpb_seq \l__tikzspath_tmpb_tl
525 {
526 \tl_set:Nn \l__tikzspath_tmpb_tl {-1}
527 }
528 \spath_splice_between:Nnn \l__tikzspath_tmpa_tl {#2} {##2}
529 }
530 {
531 \tl_put_right:Nn \l__tikzspath_tmpa_tl {##2}
532 }
533 }
534 \tl_gset_eq:NN \g__tikzspath_output_tl \l__tikzspath_tmpa_tl
535 \group_end:
536 }
537 \cs_new_protected_nopar:Npn \__tikzspath_join_components_with:Nnnn #1#2#3#4
538 {
539 \__tikzspath_join_components_with_aux:nnn {#2}{#3}{#4}
540 \tl_set_eq:NN #1 \g__tikzspath_output_tl
541 \tl_gclear:N \g__tikzspath_output_tl
542 }
543 \cs_generate_variant:Nn \__tikzspath_join_components_with:Nnnn {NVnn}
544 \cs_new_protected_nopar:Npn \__tikzspath_join_components_with:Nnn #1#2#3
545 {
546 \__tikzspath_join_components_with:NVnn #1#1{#2}{#3}
547 }
548 \cs_generate_variant:Nn \__tikzspath_join_components_with:Nnn {cvV}
549 \cs_new_protected_nopar:Npn \__tikzspath_gjoin_components_with:Nnnn #1#2#3#4
550 {
551 \__tikzspath_join_components_with_aux:nnn {#2}{#3}{#4}
552 \tl_gset_eq:NN #1 \g__tikzspath_output_tl
553 \tl_gclear:N \g__tikzspath_output_tl
554 }
555 \cs_generate_variant:Nn \__tikzspath_gjoin_components_with:Nnnn {NVnn}
556 \cs_new_protected_nopar:Npn \__tikzspath_gjoin_components_with:Nnn #1#2#3
557 {
558 \__tikzspath_gjoin_components_with:NVnn #1#1{#2}{#3}
559 }
560 \cs_generate_variant:Nn \__tikzspath_gjoin_components_with:Nnn {cvV}
561 \cs_new_protected_nopar:Npn \__tikzspath_join_components_upright_with_aux:nnn #1#2#3
562 {
563 \group_begin:
564 \tl_set:Nn \l__tikzspath_tmpc_tl {#1}
565 \tl_if_empty:nT {#3}
566 {
567 \spath_spot_weld_components:N \l__tikzspath_tmpc_tl
568 }
569
570 \spath_numberofcomponents:NV \l__tikzspath_tmpa_int \l__tikzspath_tmpc_tl
571 \__tikzspath_seq_from_foreach:NVn \l__tikzspath_tmpb_seq \l__tikzspath_tmpa_int {#3}
572
573 \spath_components_to_seq:NV \l__tikzspath_tmpa_seq \l__tikzspath_tmpc_tl
574
575 \seq_pop_left:NN \l__tikzspath_tmpa_seq \l__tikzspath_tmpa_tl
576 \seq_pop_left:NN \l__tikzspath_tmpb_seq \l__tikzspath_tmpb_tl
577
578 \tl_set:Nn \l__tikzspath_tmpc_tl {#2}
579 \spath_transform:NVnnnnnn \l__tikzspath_tmpd_tl \l__tikzspath_tmpc_tl {1}{0}{0}{-1}{0pt}{0pt}
580
581 \seq_map_indexed_inline:Nn \l__tikzspath_tmpa_seq
582 {
583 \int_compare:nTF
584 {
585 ##1 == \l__tikzspath_tmpb_tl
586 }
587 {
588 \seq_pop_left:NNF \l__tikzspath_tmpb_seq \l__tikzspath_tmpb_tl
589 {
590 \tl_set:Nn \l__tikzspath_tmpb_tl {-1}
591 }
592
593 \spath_finalpoint:NV \l__tikzspath_tmpe_tl \l__tikzspath_tmpa_tl
594 \spath_initialpoint:Nn \l__tikzspath_tmpf_tl {##2}
595
596 \dim_compare:nTF
597 {
598 \tl_item:Nn \l__tikzspath_tmpe_tl {1}
599 >
600 \tl_item:Nn \l__tikzspath_tmpf_tl {1}
601 }
602 {
603 \spath_splice_between:NVn
604 \l__tikzspath_tmpa_tl
605 \l__tikzspath_tmpd_tl
606 {##2}
607 }
608 {
609 \spath_splice_between:NVn
610 \l__tikzspath_tmpa_tl
611 \l__tikzspath_tmpc_tl
612 {##2}
613 }
614 }
615 {
616 \tl_put_right:Nn \l__tikzspath_tmpa_tl {##2}
617 }
618 }
619 \tl_gset_eq:NN \g__tikzspath_output_tl \l__tikzspath_tmpa_tl
620 \group_end:
621 }
622 \cs_new_protected_nopar:Npn \__tikzspath_join_components_upright_with:Nnnn #1#2#3#4
623 {
624 \__tikzspath_join_components_upright_with_aux:nnn {#2}{#3}{#4}
625 \tl_set_eq:NN #1 \g__tikzspath_output_tl
626 \tl_gclear:N \g__tikzspath_output_tl
627 }
628 \cs_generate_variant:Nn \__tikzspath_join_components_upright_with:Nnnn {NVnn}
629 \cs_new_protected_nopar:Npn \__tikzspath_join_components_upright_with:Nnn #1#2#3
630 {
631 \__tikzspath_join_components_upright_with:NVnn #1#1{#2}{#3}
632 }
633 \cs_generate_variant:Nn \__tikzspath_join_components_upright_with:Nnn {cvV}
634 \cs_new_protected_nopar:Npn \__tikzspath_gjoin_components_upright_with:Nnnn #1#2#3#4
635 {
636 \__tikzspath_join_components_upright_with_aux:nnn {#2}{#3}{#4}
637 \tl_gset_eq:NN #1 \g__tikzspath_output_tl
638 \tl_gclear:N \g__tikzspath_output_tl
639 }
640 \cs_generate_variant:Nn \__tikzspath_gjoin_components_upright_with:Nnnn {NVnn}
641 \cs_new_protected_nopar:Npn \__tikzspath_gjoin_components_upright_with:Nnn #1#2#3
642 {
643 \__tikzspath_gjoin_components_upright_with:NVnn #1#1{#2}{#3}
644 }
645 \cs_generate_variant:Nn \__tikzspath_gjoin_components_upright_with:Nnn {cvV}
646 \cs_new_protected_nopar:Npn \__tikzspath_get_components_aux:n #1
647 {
648 \clist_gclear_new:N \g__tikzspath_output_clist
649 \spath_components_to_seq:Nn \l__tikzspath_tmpa_seq {#1}
650
651 \seq_map_inline:Nn \l__tikzspath_tmpa_seq
652 {
653 \spath_anonymous:N \l__tikzspath_tmpa_tl
654 \tl_new:c {\__tikzspath_path_name:V \l__tikzspath_tmpa_tl}
655 \tl_set:cn {\__tikzspath_path_name:V \l__tikzspath_tmpa_tl} {##1}
656 \clist_gput_right:NV \g__tikzspath_output_clist \l__tikzspath_tmpa_tl
657 }
658 }
659 \cs_new_protected_nopar:Npn \__tikzspath_get_components:Nn #1#2
660 {
661 \clist_clear_new:N #1
662 \__tikzspath_get_components_aux:n {#2}
663 \clist_set_eq:NN #1 \g__tikzspath_output_clist
664 \clist_gclear:N \g__tikzspath_output_clist
665 }
666 \cs_generate_variant:Nn \__tikzspath_get_components:Nn {NV, Nv}
667 \cs_new_protected_nopar:Npn \__tikzspath_gget_components:Nn #1#2
668 {
669 \clist_gclear_new:N #1
670 \__tikzspath_get_components_aux:n {#2}
671 \clist_gset_eq:NN #1 \g__tikzspath_output_clist
672 \clist_gclear:N \g__tikzspath_output_clist
673 }
674 \cs_generate_variant:Nn \__tikzspath_gget_components:Nn {NV, Nv}
675 \cs_new_protected_nopar:Npn \__tikzspath_render_components:nn #1#2
676 {
677 \group_begin:
678 \spath_components_to_seq:Nn \l__tikzspath_tmpa_seq {#2}
679 \seq_map_indexed_inline:Nn \l__tikzspath_tmpa_seq
680 {
681 \spath_tikz_path:nn
682 {
683 every~ spath~ component/.try,
684 spath ~component~ ##1/.try,
685 spath ~component/.try={##1},
686 every~ #1~ component/.try,
687 #1 ~component~ ##1/.try,
688 #1 ~component/.try={##1},
689 }
690 {
691 ##2
692 }
693 }
694 \group_end:
695 }
696 \cs_generate_variant:Nn \__tikzspath_render_components:nn {nv}
697 \cs_new_protected_nopar:Npn \__tikzspath_insert_gaps_after_components_aux:nnn #1#2#3
698 {
699 \group_begin:
700 \spath_numberofcomponents:Nn \l__tikzspath_tmpa_int {#1}
701 \__tikzspath_seq_from_foreach:NVn \l__tikzspath_tmpa_seq \l__tikzspath_tmpa_int {#3}
702
703 \tl_if_empty:nT {#3}
704 {
705 \seq_pop_right:NN \l__tikzspath_tmpa_seq \l__tikzspath_tmpa_tl
706 }
707
708 \seq_clear:N \l__tikzspath_tmpb_seq
709 \seq_map_inline:Nn \l__tikzspath_tmpa_seq {
710 \seq_put_right:Nx
711 \l__tikzspath_tmpb_seq
712 {\int_eval:n
713 {
714 \int_mod:nn { ##1 }{ \l__tikzspath_tmpa_int } + 1
715 }
716 }
717 }
718
719 \spath_components_to_seq:Nn \l__tikzspath_tmpc_seq {#1}
720
721 \seq_clear:N \l__tikzspath_tmpd_seq
722 \seq_map_indexed_inline:Nn \l__tikzspath_tmpc_seq
723 {
724 \tl_set:Nn \l__tikzspath_tmpa_tl {##2}
725 \seq_if_in:NnT \l__tikzspath_tmpa_seq {##1}
726 {
727 \spath_shorten_at_end:Nn \l__tikzspath_tmpa_tl {(#2)/2}
728 }
729 \seq_if_in:NnT \l__tikzspath_tmpb_seq {##1}
730 {
731 \spath_shorten_at_start:Nn \l__tikzspath_tmpa_tl {(#2)/2}
732 }
733 \seq_put_right:NV \l__tikzspath_tmpd_seq \l__tikzspath_tmpa_tl
734 }
735 \tl_gset:Nx \g__tikzspath_output_tl {\seq_use:Nn \l__tikzspath_tmpd_seq {} }
736 \group_end:
737 }
738 \cs_new_protected_nopar:Npn \__tikzspath_insert_gaps_after_components:Nnnn #1#2#3#4
739 {
740 \__tikzspath_insert_gaps_after_components_aux:nnn {#2}{#3}{#4}
741 \tl_set_eq:NN #1 \g__tikzspath_output_tl
742 \tl_gclear:N \g__tikzspath_output_tl
743 }
744 \cs_generate_variant:Nn \__tikzspath_insert_gaps_after_components:Nnnn {NVnn}
745 \cs_new_protected_nopar:Npn \__tikzspath_insert_gaps_after_components:Nnn #1#2#3
746 {
747 \__tikzspath_insert_gaps_after_components:NVnn #1#1{#2}{#3}
748 }
749 \cs_generate_variant:Nn \__tikzspath_insert_gaps_after_components:Nnn {cnn, cVV}
750 \cs_new_protected_nopar:Npn \__tikzspath_ginsert_gaps_after_components:Nnnn #1#2#3#4
751 {
752 \__tikzspath_insert_gaps_after_components_aux:nnn {#2}{#3}{#4}
753 \tl_gset_eq:NN #1 \g__tikzspath_output_tl
754 \tl_gclear:N \g__tikzspath_output_tl
755 }
756 \cs_generate_variant:Nn \__tikzspath_ginsert_gaps_after_components:Nnnn {NVnn}
757 \cs_new_protected_nopar:Npn \__tikzspath_ginsert_gaps_after_components:Nnn #1#2#3
758 {
759 \__tikzspath_ginsert_gaps_after_components:NVnn #1#1{#2}{#3}
760 }
761 \cs_generate_variant:Nn \__tikzspath_ginsert_gaps_after_components:Nnn {cnn, cVV}
762 \cs_new_protected_nopar:Npn \__tikzspath_insert_gaps_after_segments_aux:nnn #1#2#3
763 {
764 \group_begin:
765 \spath_reallength:Nn \l__tikzspath_tmpa_int {#1}
766 \__tikzspath_seq_from_foreach:NVn \l__tikzspath_tmpa_seq \l__tikzspath_tmpa_int {#3}
767
768 \tl_if_empty:nT {#3}
769 {
770 \seq_pop_right:NN \l__tikzspath_tmpb_seq \l__tikzspath_tmpa_tl
771 }
772
773 \seq_clear:N \l__tikzspath_tmpb_seq
774 \seq_map_inline:Nn \l__tikzspath_tmpa_seq {
775 \seq_put_right:Nx
776 \l__tikzspath_tmpb_seq
777 {\int_eval:n
778 {
779 \int_mod:nn { ##1 }{ \l__tikzspath_tmpa_int } + 1
780 }
781 }
782 }
783
784 \spath_segments_to_seq:Nn \l__tikzspath_tmpc_seq {#1}
785
786 \seq_clear:N \l__tikzspath_tmpd_seq
787 \seq_map_indexed_inline:Nn \l__tikzspath_tmpc_seq
788 {
789 \tl_set:Nn \l__tikzspath_tmpa_tl {##2}
790 \seq_if_in:NnT \l__tikzspath_tmpa_seq {##1}
791 {
792 \spath_shorten_at_end:Nn \l__tikzspath_tmpa_tl {(#2)/2}
793 }
794 \seq_if_in:NnT \l__tikzspath_tmpb_seq {##1}
795 {
796 \spath_shorten_at_start:Nn \l__tikzspath_tmpa_tl {(#2)/2}
797 }
798 \seq_put_right:NV \l__tikzspath_tmpd_seq \l__tikzspath_tmpa_tl
799 }
800 \tl_gset:Nx \g__tikzspath_output_tl {\seq_use:Nn \l__tikzspath_tmpd_seq {} }
801 \group_end:
802 }
803 \cs_new_protected_nopar:Npn \__tikzspath_insert_gaps_after_segments:Nnnn #1#2#3#4
804 {
805 \__tikzspath_insert_gaps_after_segments_aux:nnn {#2}{#3}{#4}
806 \tl_set_eq:NN #1 \g__tikzspath_output_tl
807 \tl_gclear:N \g__tikzspath_output_tl
808 }
809 \cs_generate_variant:Nn \__tikzspath_insert_gaps_after_segments:Nnnn {NVnn}
810 \cs_new_protected_nopar:Npn \__tikzspath_insert_gaps_after_segments:Nnn #1#2#3
811 {
812 \__tikzspath_insert_gaps_after_segments:NVnn #1#1{#2}{#3}
813 }
814 \cs_generate_variant:Nn \__tikzspath_insert_gaps_after_segments:Nnn {cnn, cVV}
815 \cs_new_protected_nopar:Npn \__tikzspath_ginsert_gaps_after_segments:Nnnn #1#2#3#4
816 {
817 \__tikzspath_insert_gaps_after_segments_aux:nnn {#2}{#3}{#4}
818 \tl_gset_eq:NN #1 \g__tikzspath_output_tl
819 \tl_gclear:N \g__tikzspath_output_tl
820 }
821 \cs_generate_variant:Nn \__tikzspath_ginsert_gaps_after_segments:Nnnn {NVnn}
822 \cs_new_protected_nopar:Npn \__tikzspath_ginsert_gaps_after_segments:Nnn #1#2#3
823 {
824 \__tikzspath_ginsert_gaps_after_segments:NVnn #1#1{#2}{#3}
825 }
826 \cs_generate_variant:Nn \__tikzspath_ginsert_gaps_after_segments:Nnn {cnn, cVV}
827 \cs_new_protected_nopar:Npn \__tikzspath_join_components_aux:nn #1#2
828 {
829 \group_begin:
830
831 \tl_set:Nn \l__tikzspath_tmpa_tl {#1}
832 \spath_numberofcomponents:NV \l__tikzspath_tmpa_int \l__tikzspath_tmpa_tl
833 \__tikzspath_seq_from_foreach:NVn \l__tikzspath_tmpa_seq \l__tikzspath_tmpa_int {#2}
834
835 \seq_reverse:N \l__tikzspath_tmpa_seq
836
837 \seq_map_inline:Nn \l__tikzspath_tmpa_seq
838 {
839 \spath_join_component:Nn \l__tikzspath_tmpa_tl {##1}
840 }
841 \tl_gset_eq:NN \g__tikzspath_output_tl \l__tikzspath_tmpa_tl
842 \group_end:
843 }
844 \cs_new_protected_nopar:Npn \__tikzspath_join_components:Nnn #1#2#3
845 {
846 \__tikzspath_join_components_aux:nn {#2}{#3}
847 \tl_set_eq:NN #1 \g__tikzspath_output_tl
848 \tl_gclear:N \g__tikzspath_output_tl
849 }
850 \cs_generate_variant:Nn \__tikzspath_join_components:Nnn {NVn}
851 \cs_new_protected_nopar:Npn \__tikzspath_join_components:Nn #1#2
852 {
853 \__tikzspath_join_components:NVn #1#1{#2}
854 }
855 \cs_generate_variant:Nn \__tikzspath_join_components:Nn {cn}
856 \cs_new_protected_nopar:Npn \__tikzspath_gjoin_components:Nnn #1#2#3
857 {
858 \__tikzspath_join_components_aux:nn {#2}{#3}
859 \tl_gset_eq:NN #1 \g__tikzspath_output_tl
860 \tl_gclear:N \g__tikzspath_output_tl
861 }
862 \cs_generate_variant:Nn \__tikzspath_gjoin_components:Nnn {NVn}
863 \cs_new_protected_nopar:Npn \__tikzspath_gjoin_components:Nn #1#2
864 {
865 \__tikzspath_gjoin_components:NVn #1#1{#2}
866 }
867 \cs_generate_variant:Nn \__tikzspath_gjoin_components:Nn {cn}
868 \cs_new_protected_nopar:Npn \__tikzspath_join_components_with_bezier_aux:nn #1#2
869 {
870 \group_begin:
871 \tl_set:Nn \l__tikzspath_tmpc_tl {#1}
872 \tl_if_empty:nT {#2}
873 {
874 \spath_spot_weld_components:N \l__tikzspath_tmpc_tl
875 }
876
877 \spath_numberofcomponents:NV \l__tikzspath_tmpa_int \l__tikzspath_tmpc_tl
878 \__tikzspath_seq_from_foreach:NVn \l__tikzspath_tmpb_seq \l__tikzspath_tmpa_int {#2}
879
880 \spath_components_to_seq:NV \l__tikzspath_tmpa_seq \l__tikzspath_tmpc_tl
881
882 \seq_pop_left:NN \l__tikzspath_tmpa_seq \l__tikzspath_tmpa_tl
883 \seq_pop_left:NN \l__tikzspath_tmpb_seq \l__tikzspath_tmpb_tl
884
885 \seq_map_indexed_inline:Nn \l__tikzspath_tmpa_seq
886 {
887 \int_compare:nTF
888 {
889 ##1 == \l__tikzspath_tmpb_tl
890 }
891 {
892 \seq_pop_left:NNF \l__tikzspath_tmpb_seq \l__tikzspath_tmpb_tl
893 {
894 \tl_set:Nn \l__tikzspath_tmpb_tl {-1}
895 }
896 \spath_curve_between:Nn \l__tikzspath_tmpa_tl {##2}
897 }
898 {
899 \tl_put_right:Nn \l__tikzspath_tmpa_tl {##2}
900 }
901 }
902 \tl_gset_eq:NN \g__tikzspath_output_tl \l__tikzspath_tmpa_tl
903 \group_end:
904 }
905 \cs_new_protected_nopar:Npn \__tikzspath_join_components_with_bezier:Nnn #1#2#3
906 {
907 \__tikzspath_join_components_with_bezier_aux:nn {#2}{#3}
908 \tl_set_eq:NN #1 \g__tikzspath_output_tl
909 \tl_gclear:N \g__tikzspath_output_tl
910 }
911 \cs_generate_variant:Nn \__tikzspath_join_components_with_bezier:Nnn {NVn}
912 \cs_new_protected_nopar:Npn \__tikzspath_join_components_with_bezier:Nn #1#2
913 {
914 \__tikzspath_join_components_with_bezier:NVn #1#1{#2}
915 }
916 \cs_generate_variant:Nn \__tikzspath_join_components_with_bezier:Nn {cV}
917 \cs_new_protected_nopar:Npn \__tikzspath_gjoin_components_with_bezier:Nnn #1#2#3
918 {
919 \__tikzspath_join_components_with_bezier_aux:nn {#2}{#3}
920 \tl_gset_eq:NN #1 \g__tikzspath_output_tl
921 \tl_gclear:N \g__tikzspath_output_tl
922 }
923 \cs_generate_variant:Nn \__tikzspath_gjoin_components_with_bezier:Nnn {NVn}
924 \cs_new_protected_nopar:Npn \__tikzspath_gjoin_components_with_bezier:Nn #1#2
925 {
926 \__tikzspath_gjoin_components_with_bezier:NVn #1#1{#2}
927 }
928 \cs_generate_variant:Nn \__tikzspath_gjoin_components_with_bezier:Nn {cV}
929 \cs_new_protected_nopar:Npn \__tikzspath_remove_components_aux:nn #1#2
930 {
931 \group_begin:
932
933 \spath_numberofcomponents:Nn \l__tikzspath_tmpa_int {#1}
934 \__tikzspath_seq_from_foreach:NVn \l__tikzspath_tmpa_seq \l__tikzspath_tmpa_int {#2}
935
936 \spath_components_to_seq:Nn \l__tikzspath_tmpb_seq {#1}
937
938 \seq_pop_left:NNF \l__tikzspath_tmpa_seq \l__tikzspath_tmpa_tl
939 {
940 \tl_clear:N \l__tikzspath_tmpa_tl
941 }
942
943 \seq_clear:N \l__tikzspath_tmpc_seq
944 \seq_map_indexed_inline:Nn \l__tikzspath_tmpb_seq
945 {
946 \tl_set:Nn \l__tikzspath_tmpb_tl {##1}
947 \tl_if_eq:NNTF \l__tikzspath_tmpb_tl \l__tikzspath_tmpa_tl
948 {
949 \seq_pop_left:NNF \l__tikzspath_tmpa_seq \l__tikzspath_tmpa_tl
950 {
951 \tl_clear:N \l__tikzspath_tmpa_tl
952 }
953 }
954 {
955 \seq_put_right:Nn \l__tikzspath_tmpc_seq {##2}
956 }
957 }
958
959 \tl_gset:Nx \g__tikzspath_output_tl {\seq_use:Nn \l__tikzspath_tmpc_seq {} }
960 \group_end:
961 }
962 \cs_new_protected_nopar:Npn \__tikzspath_remove_components:Nnn #1#2#3
963 {
964 \__tikzspath_remove_components_aux:nn {#2}{#3}
965 \tl_set_eq:NN #1 \g__tikzspath_output_tl
966 \tl_gclear:N \g__tikzspath_output_tl
967 }
968 \cs_generate_variant:Nn \__tikzspath_remove_components:Nnn {NVn}
969 \cs_new_protected_nopar:Npn \__tikzspath_remove_components:Nn #1#2
970 {
971 \__tikzspath_remove_components:NVn #1#1{#2}
972 }
973 \cs_generate_variant:Nn \__tikzspath_remove_components:Nn {cn}
974 \cs_new_protected_nopar:Npn \__tikzspath_gremove_components:Nnn #1#2#3
975 {
976 \__tikzspath_remove_components_aux:nn {#2}{#3}
977 \tl_gset_eq:NN #1 \g__tikzspath_output_tl
978 \tl_gclear:N \g__tikzspath_output_tl
979 }
980 \cs_generate_variant:Nn \__tikzspath_gremove_components:Nnn {NVn}
981 \cs_new_protected_nopar:Npn \__tikzspath_gremove_components:Nn #1#2
982 {
983 \__tikzspath_gremove_components:NVn #1#1{#2}
984 }
985 \cs_generate_variant:Nn \__tikzspath_gremove_components:Nn {cn}
986 \cs_new_protected_nopar:Npn \__tikzspath_transform_to_aux:nn #1#2
987 {
988 \group_begin:
989 \spath_reallength:Nn \l__tikzspath_tmpa_int {#2}
990
991 \tl_set:Nx \l__tikzspath_tmpb_tl
992 {\fp_to_decimal:n {(#1) * (\l__tikzspath_tmpa_int)}}
993 \spath_transformation_at:NnV \l__tikzspath_tmpc_tl {#2} \l__tikzspath_tmpb_tl
994 \tl_gset_eq:NN \g__tikzspath_output_tl \l__tikzspath_tmpc_tl
995 \group_end:
996 }
997 \cs_new_protected_nopar:Npn \__tikzspath_transform_to:nn #1#2
998 {
999 \__tikzspath_transform_to_aux:nn {#1}{#2}
1000 \exp_last_unbraced:NV \pgfsettransformentries \g__tikzspath_output_tl
1001 \tl_gclear:N \g__tikzspath_output_tl
1002 }
1003 \cs_generate_variant:Nn \__tikzspath_transform_to:nn {nv}
1004 \cs_new_protected_nopar:Npn \__tikzspath_transform_upright_to:nn #1#2
1005 {
1006 \__tikzspath_transform_to_aux:nn {#1}{#2}
1007 \fp_compare:nT { \tl_item:Nn \g__tikzspath_output_tl {4} < 0}
1008 {
1009 \tl_gset:Nx \g__tikzspath_output_tl
1010 {
1011 { \fp_eval:n { - (\tl_item:Nn \g__tikzspath_output_tl {1})} }
1012 { \fp_eval:n { - (\tl_item:Nn \g__tikzspath_output_tl {2})} }
1013 { \fp_eval:n { - (\tl_item:Nn \g__tikzspath_output_tl {3})} }
1014 { \fp_eval:n { - (\tl_item:Nn \g__tikzspath_output_tl {4})} }
1015 { \tl_item:Nn \g__tikzspath_output_tl {5} }
1016 { \tl_item:Nn \g__tikzspath_output_tl {6} }
1017 }
1018 }
1019 \exp_last_unbraced:NV \pgfsettransformentries \g__tikzspath_output_tl
1020 \tl_gclear:N \g__tikzspath_output_tl
1021 }
1022 \cs_generate_variant:Nn \__tikzspath_transform_upright_to:nn {nv}
1023 \tikzset{
1024 spath/.is~family,
1025 spath/.cd,
1026 set~ prefix/.store~ in=\l__tikzspath_prefix_tl,
1027 prefix/.is~choice,
1028 prefix/default/.style={
1029 /tikz/spath/set~ prefix=tikz@intersect@path@name@
1030 },
1031 set~ suffix/.store~ in=\l__tikzspath_suffix_tl,
1032 suffix/.is~choice,
1033 suffix/default/.style={
1034 /tikz/spath/set~ suffix={}
1035 },
1036 set~ name/.style={
1037 /tikz/spath/prefix=#1,
1038 /tikz/spath/suffix=#1
1039 },
1040 at~ end~ path~ construction/.code={
1041 \tl_put_right:Nn \l__tikzspath_tikzpath_finish_tl {#1}
1042 },
1043 save/.code={
1044 \tikz@addmode{
1045 \spath_get_current_path:N \l__tikzspath_tmpa_tl
1046 \spath_bake_round:NV \l__tikzspath_tmpa_tl \l__tikzspath_tmpa_tl
1047 \spath_bake_shorten:NV \l__tikzspath_tmpa_tl \l__tikzspath_tmpa_tl
1048 \spath_save_path:cV {\__tikzspath_path_name:n {#1}}
1049 \l__tikzspath_tmpa_tl
1050 }
1051 },
1052 save~ global/.code={
1053 \tikz@addmode{
1054 \spath_get_current_path:N \l__tikzspath_tmpa_tl
1055 \spath_bake_round:NV \l__tikzspath_tmpa_tl \l__tikzspath_tmpa_tl
1056 \spath_bake_shorten:NV \l__tikzspath_tmpa_tl \l__tikzspath_tmpa_tl
1057 \spath_gsave_path:cV {\__tikzspath_path_name:n {#1}}
1058 \l__tikzspath_tmpa_tl
1059 }
1060 },
1061 clone/.code~ 2~ args={
1062 \__tikzspath_maybe_current_path:nn
1063 {
1064 \__tikzspath_check_path:nnn {
1065 \tl_clear_new:c {\__tikzspath_path_name:n {#1}}
1066 \tl_set_eq:cc {\__tikzspath_path_name:n {#1}}
1067 }
1068 }
1069 {#2}{}
1070 },
1071 clone~ global/.code~ 2~ args={
1072 \__tikzspath_maybe_current_path:nn
1073 {
1074 \__tikzspath_check_path:nnn {
1075 \tl_gclear_new:c {\__tikzspath_path_name:n {#1}}
1076 \tl_gset_eq:cc {\__tikzspath_path_name:n {#1}}
1077 }
1078 }
1079 {#2}{}
1080 },
1081 save~ to~ aux/.code={
1082 \__tikzspath_maybe_current_path:nn
1083 {
1084 \__tikzspath_check_path:nnn {
1085 \spath_save_to_aux:c
1086 }
1087 }
1088 {#1}
1089 {}
1090 },
1091 export~ to~ svg/.code={
1092 \__tikzspath_maybe_current_path:nn
1093 {
1094 \__tikzspath_check_path:nnn {
1095 \spath_export_to_svg:nv {#1}
1096 }
1097 }
1098 {#1}
1099 {}
1100 },
1101 use/.code={
1102 \bool_set_false:N \l__tikzspath_reverse_bool
1103 \bool_set_false:N \l__tikzspath_weld_bool
1104 \bool_set_false:N \l__tikzspath_move_bool
1105 \bool_set_false:N \l__tikzspath_current_transformation_bool
1106 \bool_set_true:N \l_spath_movetorelevant_bool
1107 \tl_clear:N \l__tikzspath_joinpath_tl
1108 \tl_clear:N \l__tikzspath_transformation_tl
1109 \tikzset{
1110 spath/join/.cd,
1111 #1
1112 }
1113
1114 \__tikzspath_check_path:nVn
1115 {
1116 \__tikzspath_use_path:v
1117 } \l__tikzspath_joinpath_tl {}
1118
1119 },
1120 restore/.style={/tikz/spath/use={#1}},
1121 restore~ reverse/.style={/tikz/spath/use={reverse, #1}},
1122 append/.style={/tikz/spath/use={move, weld, #1}},
1123 append~ no~ move/.style={/tikz/spath/use={weld, #1}},
1124 append~ reverse/.style={/tikz/spath/use={move, weld, reverse, #1}},
1125 append~ reverse~ no~ move/.style={/tikz/spath/use={weld, reverse, #1}},
1126 insert/.style={/tikz/spath/use={#1}},
1127 insert~ reverse/.style={/tikz/spath/use={reverse, #1}},
1128 show~current~path/.code={
1129 \tikz@addmode{
1130 \pgfsyssoftpath@getcurrentpath\l__tikzspath_tmpa_tl
1131 \iow_term:n {---~ current~ soft~ path~ ---}
1132 \spath_show:V \l__tikzspath_tmpa_tl
1133 }
1134 },
1135 show/.code={
1136 \__tikzspath_check_path:nnn {
1137 \iow_term:n {---~ soft~ path~ #1~ ---}
1138 \spath_show:v
1139 } {#1} {}
1140 },
1141 join~ with/.code~ 2~ args={
1142 \bool_set_false:N \l__tikzspath_reverse_bool
1143 \bool_set_false:N \l__tikzspath_weld_bool
1144 \bool_set_false:N \l__tikzspath_move_bool
1145 \bool_set_false:N \l__tikzspath_global_bool
1146 \bool_set_false:N \l__tikzspath_current_transformation_bool
1147 \tl_clear:N \l__tikzspath_joinpath_tl
1148 \tl_clear:N \l__tikzspath_transformation_tl
1149 \tikzset{
1150 spath/join/.cd,
1151 #2
1152 }
1153
1154 \__tikzspath_maybe_current_path_reuse:nnn
1155 {
1156 \__tikzspath_check_two_paths:nnVn
1157 {
1158 \__tikzspath_join_with:cv
1159 }
1160 } {#1} { \l__tikzspath_joinpath_tl {} }
1161 },
1162 spot~ weld/.code={
1163 \__tikzspath_maybe_current_path_reuse:nnn
1164 {
1165 \__tikzspath_check_path:nnn
1166 {
1167 \spath_spot_weld_components:c
1168 }
1169 } {#1} { {} }
1170 },
1171 spot~ weld~ globally/.code={
1172 \__tikzspath_maybe_current_path_reuse:nnn
1173 {
1174 \__tikzspath_check_path:nnn
1175 {
1176 \spath_spot_gweld_components:c
1177 }
1178 } {#1} { {} }
1179 },
1180 reverse/.code={
1181 \__tikzspath_maybe_current_path_reuse:nnn
1182 {
1183 \__tikzspath_check_path:nnn
1184 {
1185 \spath_reverse:c
1186 }
1187 } {#1} { {} }
1188 },
1189 reverse~ globally/.code={
1190 \__tikzspath_maybe_current_path_reuse:nnn
1191 {
1192 \__tikzspath_check_path:nnn
1193 {
1194 \spath_greverse:c
1195 }
1196 } {#1} { {} }
1197 },
1198 span/.code ~n~ args={3}{
1199 \__tikzspath_maybe_current_path_reuse:nnn
1200 {
1201 \__tikzspath_check_path:nnn
1202 {
1203 \__tikzspath_process_tikz_point:Nn \l__tikzspath_tmpa_tl {#2}
1204 \__tikzspath_process_tikz_point:Nn \l__tikzspath_tmpb_tl {#3}
1205 \spath_span:cVV
1206 }
1207 } {#1} { {} \l__tikzspath_tmpa_tl \l__tikzspath_tmpb_tl }
1208 },
1209 span~ global/.code ~n~ args={3}{
1210 \__tikzspath_maybe_current_path_reuse:nnn
1211 {
1212 \__tikzspath_check_path:nnn
1213 {
1214 \__tikzspath_process_tikz_point:Nn \l__tikzspath_tmpa_tl {#2}
1215 \__tikzspath_process_tikz_point:Nn \l__tikzspath_tmpb_tl {#3}
1216 \spath_span:cVV
1217 }
1218 } {#1} { {} \l__tikzspath_tmpa_tl \l__tikzspath_tmpb_tl }
1219 },
1220 to/.style={
1221 to~path={
1222 [
1223 spath/span={#1}{(\tikztostart)}{(\tikztotarget)},
1224 spath/use={#1,weld},
1225 ]
1226 \tikztonodes
1227 }
1228 },
1229 splice/.code ~n~ args={3}{
1230 \__tikzspath_maybe_current_path_reuse:nnn
1231 {
1232 \__tikzspath_check_three_paths:nnnnn
1233 {
1234 \spath_splice_between:cvv
1235 }
1236 } {#1} { {#2} {#3} {} }
1237 },
1238 splice~ global/.code ~n~ args={3}{
1239 \__tikzspath_maybe_current_path_reuse:nnn
1240 {
1241 \__tikzspath_check_three_paths:nnnnn
1242 {
1243 \spath_gsplice_between:cvv
1244 }
1245 } {#1} { {#2} {#3} {} }
1246 },
1247 join~ components~ with/.code~2~args={
1248 \tl_if_head_is_group:nTF {#2}
1249 {
1250 \tl_set:Nx \l__tikzspath_tmpc_tl { \tl_item:nn {#2} {1} }
1251 \tl_set:Nx \l__tikzspath_tmpd_tl { \tl_item:nn {#2} {2} }
1252 }
1253 {
1254 \tl_set:Nn \l__tikzspath_tmpc_tl {#2}
1255 \tl_clear:N \l__tikzspath_tmpd_tl
1256 }
1257
1258 \__tikzspath_maybe_current_path_reuse:nnn
1259 {
1260 \__tikzspath_check_two_paths:nnVn
1261 {
1262 \__tikzspath_join_components_with:cvV
1263 }
1264 } {#1} { \l__tikzspath_tmpc_tl {} \l__tikzspath_tmpd_tl }
1265 },
1266 join~ components~ globally~ with/.code~2~args={
1267 \tl_if_head_is_group:nTF {#2}
1268 {
1269 \tl_set:Nx \l__tikzspath_tmpc_tl { \tl_item:nn {#2} {1} }
1270 \tl_set:Nx \l__tikzspath_tmpd_tl { \tl_item:nn {#2} {2} }
1271 }
1272 {
1273 \tl_set:Nn \l__tikzspath_tmpc_tl {#2}
1274 \tl_clear:N \l__tikzspath_tmpd_tl
1275 }
1276
1277 \__tikzspath_maybe_current_path_reuse:nnn
1278 {
1279 \__tikzspath_check_two_paths:nnVn
1280 {
1281 \__tikzspath_gjoin_components_with:cvV
1282 }
1283 } {#1} { \l__tikzspath_tmpc_tl {} \l__tikzspath_tmpd_tl }
1284 },
1285 join~ components~ upright~ with/.code~2~args={
1286 \tl_if_head_is_group:nTF {#2}
1287 {
1288 \tl_set:Nx \l__tikzspath_tmpc_tl { \tl_item:nn {#2} {1} }
1289 \tl_set:Nx \l__tikzspath_tmpd_tl { \tl_item:nn {#2} {2} }
1290 }
1291 {
1292 \tl_set:Nn \l__tikzspath_tmpc_tl {#2}
1293 \tl_clear:N \l__tikzspath_tmpd_tl
1294 }
1295
1296 \__tikzspath_maybe_current_path_reuse:nnn
1297 {
1298 \__tikzspath_check_two_paths:nnVn
1299 {
1300 \__tikzspath_join_components_upright_with:cvV
1301 }
1302 } {#1} { \l__tikzspath_tmpc_tl {} \l__tikzspath_tmpd_tl }
1303 },
1304 join~ components~ globally~ upright~ with/.code~2~args={
1305 \tl_if_head_is_group:nTF {#2}
1306 {
1307 \tl_set:Nx \l__tikzspath_tmpc_tl { \tl_item:nn {#2} {1} }
1308 \tl_set:Nx \l__tikzspath_tmpd_tl { \tl_item:nn {#2} {2} }
1309 }
1310 {
1311 \tl_set:Nn \l__tikzspath_tmpc_tl {#2}
1312 \tl_clear:N \l__tikzspath_tmpd_tl
1313 }
1314
1315 \__tikzspath_maybe_current_path_reuse:nnn
1316 {
1317 \__tikzspath_check_two_paths:nnVn
1318 {
1319 \__tikzspath_gjoin_components_upright_with:cvV
1320 }
1321 } {#1} { \l__tikzspath_tmpc_tl {} \l__tikzspath_tmpd_tl }
1322 },
1323 join~ components~ with~ bezier/.code={
1324 \tl_if_head_is_group:nTF {#1}
1325 {
1326 \tl_set:Nx \l__tikzspath_tmpc_tl { \tl_item:nn {#1} {1} }
1327 \tl_set:Nx \l__tikzspath_tmpd_tl { \tl_item:nn {#1} {2} }
1328 }
1329 {
1330 \tl_set:Nn \l__tikzspath_tmpc_tl {#1}
1331 \tl_clear:N \l__tikzspath_tmpd_tl
1332 }
1333
1334 \__tikzspath_maybe_current_path_reuse:nVn
1335 {
1336 \__tikzspath_check_path:nnn
1337 {
1338 \__tikzspath_join_components_with_bezier:cV
1339 }
1340 } \l__tikzspath_tmpc_tl { {} \l__tikzspath_tmpd_tl }
1341 },
1342 join~ components~ globally~ with~ bezier/.code~2~args={
1343 \__tikzspath_maybe_current_path_reuse:nnn
1344 {
1345 \__tikzspath_check_path:nnn
1346 {
1347 \__tikzspath_gjoin_components_with_bezier:cn
1348 }
1349 } {#1} { {} {#2} }
1350 },
1351 close/.code={
1352 \__tikzspath_maybe_current_path_reuse:nnn
1353 {
1354 \__tikzspath_check_path:nnn
1355 {
1356 \spath_close:c
1357 }
1358 } {#1} { {} }
1359 },
1360 close~ globally/.code={
1361 \__tikzspath_maybe_current_path_reuse:nnn
1362 {
1363 \__tikzspath_check_path:nnn
1364 {
1365 \spath_gclose:c
1366 }
1367 } {#1} { {} }
1368 },
1369 open/.code={
1370 \__tikzspath_maybe_current_path_reuse:nnn
1371 {
1372 \__tikzspath_check_path:nnn
1373 {
1374 \spath_open:c
1375 }
1376 } {#1} { {} }
1377 },
1378 open~ globally/.code={
1379 \__tikzspath_maybe_current_path_reuse:nnn
1380 {
1381 \__tikzspath_check_path:nnn
1382 {
1383 \spath_gopen:c
1384 }
1385 } {#1} { {} }
1386 },
1387 adjust~ and~ close/.code={
1388 \__tikzspath_maybe_current_path_reuse:nnn
1389 {
1390 \__tikzspath_check_path:nnn
1391 {
1392 \spath_adjust_close:c
1393 }
1394 } {#1} { {} }
1395 },
1396 adjust~ and~ close~ globally/.code={
1397 \__tikzspath_maybe_current_path_reuse:nnn
1398 {
1399 \__tikzspath_check_path:nnn
1400 {
1401 \spath_adjust_gclose:c
1402 }
1403 } {#1} { {} }
1404 },
1405 close~ with/.code~ 2~ args={
1406 \__tikzspath_maybe_current_path_reuse:nnn
1407 {
1408 \__tikzspath_check_two_paths:nnnn
1409 {
1410 \spath_close_with:cv
1411 }
1412 } {#1} { {#2} {} }
1413 },
1414 close~ globally~ with/.code~ 2~ args={
1415 \__tikzspath_maybe_current_path_reuse:nnn
1416 {
1417 \__tikzspath_check_two_paths:nnnn
1418 {
1419 \spath_gclose_with:cv
1420 }
1421 } {#1} { {#2} {} }
1422 },
1423 close~ with~ curve/.code={
1424 \__tikzspath_maybe_current_path_reuse:nnn
1425 {
1426 \__tikzspath_check_path:nnn
1427 {
1428 \spath_close_with_curve:c
1429 }
1430 } {#1} { {} }
1431 },
1432 close~ globally~ with~ curve/.code={
1433 \__tikzspath_maybe_current_path_reuse:nnn
1434 {
1435 \__tikzspath_check_path:nnn
1436 {
1437 \spath_gclose_with_curve:c
1438 }
1439 } {#1} { {} }
1440 },
1441 shorten~ at~ end/.code~ 2~ args={
1442 \__tikzspath_maybe_current_path_reuse:nnn
1443 {
1444 \__tikzspath_check_path:nnn
1445 {
1446 \spath_shorten_at_end:cn
1447 }
1448 } {#1} { {} {#2} }
1449 },
1450 shorten~ at~ start/.code~ 2~ args ={
1451 \__tikzspath_maybe_current_path_reuse:nnn
1452 {
1453 \__tikzspath_check_path:nnn
1454 {
1455 \spath_shorten_at_start:cn
1456 }
1457 } {#1} { {} {#2} }
1458 },
1459 shorten~ at~ both~ ends/.code~ 2~ args={
1460 \__tikzspath_maybe_current_path_reuse:nnn
1461 {
1462 \__tikzspath_check_path:nnn
1463 {
1464 \spath_shorten_at_both_ends:cn
1465 }
1466 } {#1} { {} {#2} }
1467 },
1468 shorten~ globally~ at~ end/.code~ 2~ args={
1469 \__tikzspath_maybe_current_path_reuse:nnn
1470 {
1471 \__tikzspath_check_path:nnn
1472 {
1473 \spath_gshorten_at_end:cn
1474 }
1475 } {#1} { {} {#2} }
1476 },
1477 shorten~ globally~ at~ start/.code~ 2~ args ={
1478 \__tikzspath_maybe_current_path_reuse:nnn
1479 {
1480 \__tikzspath_check_path:nnn
1481 {
1482 \spath_gshorten_at_start:cn
1483 }
1484 } {#1} { {} {#2} }
1485 },
1486 shorten~ globally~ at~ both~ ends/.code~ 2~ args={
1487 \__tikzspath_maybe_current_path_reuse:nnn
1488 {
1489 \__tikzspath_check_path:nnn
1490 {
1491 \spath_gshorten_at_both_ends:cn
1492 }
1493 } {#1} { {} {#2} }
1494 },
1495 split~ at/.code~ 2~ args={
1496 \__tikzspath_maybe_current_path_reuse:nnn
1497 {
1498 \__tikzspath_check_path:nnn
1499 {
1500 \spath_split_at_normalised:cn
1501 }
1502 } {#1} { {} {#2} }
1503 },
1504 split~ globally~ at/.code~ 2~ args={
1505 \__tikzspath_maybe_current_path_reuse:nnn
1506 {
1507 \__tikzspath_check_path:nnn
1508 {
1509 \spath_gsplit_at_normalised:cn
1510 }
1511 } {#1} { {} {#2} }
1512 },
1513 split~ at~ into/.code~ n~ args={4}{
1514 \__tikzspath_maybe_current_path_reuse:nnn
1515 {
1516 \__tikzspath_check_path:nnn
1517 {
1518 \spath_split_at_normalised:ccvn {\__tikzspath_path_name:n {#1}}
1519 {\__tikzspath_path_name:n {#2}}
1520 }
1521 } {#3} { {} {#4} }
1522 },
1523 split~ globally~ at~ into/.code~ n~ args={4}{
1524 \__tikzspath_maybe_current_path_reuse:nnn
1525 {
1526 \__tikzspath_check_path:nnn
1527 {
1528 \spath_gsplit_at_normalised:ccvn {\__tikzspath_path_name:n {#1}}
1529 {\__tikzspath_path_name:n {#2}}
1530 }
1531 } {#3} { {} {#4} }
1532 },
1533 split~ at~ keep~ start/.code~ 2~ args={
1534 \__tikzspath_maybe_current_path_reuse:nnn
1535 {
1536 \__tikzspath_check_path:nnn
1537 {
1538 \spath_split_at_normalised_keep_start:cn
1539 }
1540 } {#1} { {} {#2} }
1541 },
1542 split~ globally~ at~ keep~ start/.code~ 2~ args={
1543 \__tikzspath_maybe_current_path_reuse:nnn
1544 {
1545 \__tikzspath_check_path:nnn
1546 {
1547 \spath_gsplit_at_normalised_keep_start:cn
1548 }
1549 } {#1} { {} {#2} }
1550 },
1551 split~ at~ keep~ end/.code~ 2~ args={
1552 \__tikzspath_maybe_current_path_reuse:nnn
1553 {
1554 \__tikzspath_check_path:nnn
1555 {
1556 \spath_split_at_normalised_keep_end:cn
1557 }
1558 } {#1} { {} {#2} }
1559 },
1560 split~ globally~ at~ keep~ end/.code~ 2~ args={
1561 \__tikzspath_maybe_current_path_reuse:nnn
1562 {
1563 \__tikzspath_check_path:nnn
1564 {
1565 \spath_gsplit_at_normalised_keep_end:cn
1566 }
1567 } {#1} { {} {#2} }
1568 },
1569 split~ at~ keep~ middle/.style~ n~ args={3}{
1570 /tikz/spath/split~ at~ keep~ start={#1}{#3},
1571 /tikz/spath/split~ at~ keep~ end={#1}{(#2)/(#3)},
1572 },
1573 split~ globally~ at~ keep~ middle/.style~ n~ args={3}{
1574 /tikz/spath/split~ globally~ at~ keep~ start={#1}{#3},
1575 /tikz/spath/split~ globally~ at~ keep~ end={#1}{(#2)/(#3)},
1576 },
1577 translate/.code~ n~ args={3}{
1578 \__tikzspath_maybe_current_path_reuse:nnn
1579 {
1580 \__tikzspath_check_path:nnn
1581 {
1582 \spath_translate:cnn
1583 }
1584 } {#1} { {} {#2}{#3} }
1585 },
1586 translate~ globally/.code~ n~ args={3}{
1587 \__tikzspath_maybe_current_path_reuse:nnn
1588 {
1589 \__tikzspath_check_path:nnn
1590 {
1591 \spath_gtranslate:cnn
1592 }
1593 } {#1} { {} {#2}{#3} }
1594 },
1595 normalise/.code={
1596 \__tikzspath_maybe_current_path_reuse:nnn
1597 {
1598 \__tikzspath_check_path:nnn
1599 {
1600 \spath_normalise:c
1601 }
1602 } {#1} { {} }
1603 },
1604 normalise~ globally/.code={
1605 \__tikzspath_maybe_current_path_reuse:nnn
1606 {
1607 \__tikzspath_check_path:nnn
1608 {
1609 \spath_gnormalise:c
1610 }
1611 } {#1} { {} }
1612 },
1613 transform/.code~ 2~ args={
1614 \group_begin:
1615 \pgftransformreset
1616 \tikzset{#2}
1617 \pgfgettransform \l__tikzspath_tmpa_tl
1618 \tl_gset_eq:NN \g__tikzspath_smuggle_tl \l__tikzspath_tmpa_tl
1619 \group_end:
1620
1621 \__tikzspath_maybe_current_path_reuse:nnn
1622 {
1623 \__tikzspath_check_path:nnn
1624 {
1625 \spath_transform:cV
1626 }
1627 } {#1} { {} \g__tikzspath_smuggle_tl }
1628 },
1629 transform~globally/.code~ 2~ args={
1630 \group_begin:
1631 \pgftransformreset
1632 \tikzset{#2}
1633 \pgfgettransform \l__tikzspath_tmpa_tl
1634 \tl_gset_eq:NN \g__tikzspath_smuggle_tl \l__tikzspath_tmpa_tl
1635 \group_end:
1636
1637 \__tikzspath_maybe_current_path_reuse:nnn
1638 {
1639 \__tikzspath_check_path:nnn
1640 {
1641 \spath_gtransform:cV
1642 }
1643 } {#1} { {} \g__tikzspath_smuggle_tl }
1644 },
1645 split~ at~ intersections~ with/.code~ 2~ args={
1646 \tl_if_exist:cTF
1647 {
1648 tikz@library@intersections@loaded
1649 }
1650 {
1651 \__tikzspath_maybe_current_two_paths_reuse_first:nnnn
1652 {
1653 \__tikzspath_check_two_paths:nnnn
1654 {
1655 \spath_split_path_at_intersections:cv
1656 }
1657 } {#1} {#2} { {} }
1658 }
1659 {
1660 \msg_warning:nn { spath3 } { load intersections }
1661 }
1662 },
1663 split~ globally~ at~ intersections~ with/.code~ n~ args={2}{
1664 \tl_if_exist:cTF
1665 {
1666 tikz@library@intersections@loaded
1667 }
1668 {
1669 \__tikzspath_maybe_current_two_paths_reuse_first:nnnn
1670 {
1671 \__tikzspath_check_two_paths:nnnn
1672 {
1673 \spath_gsplit_path_at_intersections:cv
1674 }
1675 } {#1} {#2} { {} }
1676 }
1677 {
1678 \msg_warning:nn { spath3 } { load intersections }
1679 }
1680 },
1681 split~ at~ intersections/.code~ n~ args={2}{
1682 \tl_if_exist:cTF
1683 {
1684 tikz@library@intersections@loaded
1685 }
1686 {
1687 \__tikzspath_maybe_current_two_paths_reuse_both:nnnn
1688 {
1689 \__tikzspath_check_two_paths:nnnn
1690 {
1691 \spath_split_at_intersections:cc
1692 }
1693 } {#1} {#2} { {} }
1694 }
1695 {
1696 \msg_warning:nn { spath3 } { load intersections }
1697 }
1698 },
1699 split~ globally~ at~ intersections/.code~ n~ args={2}{
1700 \tl_if_exist:cTF
1701 {
1702 tikz@library@intersections@loaded
1703 }
1704 {
1705 \__tikzspath_maybe_current_two_paths_reuse_both:nnnn
1706 {
1707 \__tikzspath_check_two_paths:nnnn
1708 {
1709 \spath_gsplit_at_intersections:cc
1710 }
1711 } {#1} {#2} { {} }
1712 }
1713 {
1714 \msg_warning:nn { spath3 } { load intersections }
1715 }
1716 },
1717 split~ at~ self~ intersections/.code={
1718 \tl_if_exist:cTF
1719 {
1720 tikz@library@intersections@loaded
1721 }
1722 {
1723 \__tikzspath_maybe_current_path_reuse:nnn
1724 {
1725 \__tikzspath_check_path:nnn
1726 {
1727 \spath_split_at_self_intersections:c
1728 }
1729 } {#1} { {} }
1730 }
1731 {
1732 \msg_warning:nn { spath3 } { load intersections }
1733 }
1734 },
1735 split~ globally~ at~ self~ intersections/.code={
1736 \tl_if_exist:cTF
1737 {
1738 tikz@library@intersections@loaded
1739 }
1740 {
1741 \__tikzspath_maybe_current_path_reuse:nnn
1742 {
1743 \__tikzspath_check_path:nnn
1744 {
1745 \spath_gsplit_at_self_intersections:c
1746 }
1747 } {#1} { {} }
1748 }
1749 {
1750 \msg_warning:nn { spath3 } { load intersections }
1751 }
1752 },
1753 get~ components~ of/.code~ 2~ args={
1754 \__tikzspath_maybe_current_path:nn
1755 {
1756 \__tikzspath_check_path:nnn {
1757 \__tikzspath_get_components:Nv #2
1758 }
1759 }
1760 {#1}
1761 {}
1762 },
1763 get~ components~ of~ globally/.code~ 2~ args={
1764 \__tikzspath_maybe_current_path:nn
1765 {
1766 \__tikzspath_check_path:nnn {
1767 \__tikzspath_gget_components:Nv #2
1768 }
1769 }
1770 {#1}
1771 {}
1772 },
1773 render~ components/.code={
1774 \__tikzspath_maybe_current_path:nn
1775 {
1776 \__tikzspath_check_path:nnn {
1777 \__tikzspath_render_components:nv {#1}
1778 }
1779 }
1780 {#1}
1781 {}
1782 },
1783 insert~ gaps~ after~ components/.code~ 2~ args={
1784 \tl_if_head_is_group:nTF {#2}
1785 {
1786 \tl_set:Nx \l__tikzspath_tmpc_tl { \tl_item:nn {#2} {1} }
1787 \tl_set:Nx \l__tikzspath_tmpd_tl { \tl_item:nn {#2} {2} }
1788 }
1789 {
1790 \tl_set:Nn \l__tikzspath_tmpc_tl {#2}
1791 \tl_clear:N \l__tikzspath_tmpd_tl
1792 }
1793
1794 \__tikzspath_maybe_current_path_reuse:nnn
1795 {
1796 \__tikzspath_check_path:nnn
1797 {
1798 \__tikzspath_insert_gaps_after_components:cVV
1799 }
1800 } {#1} { {} \l__tikzspath_tmpc_tl \l__tikzspath_tmpd_tl }
1801 },
1802 insert~ gaps~ globally~ after~ components/.code~ 2~ args={
1803 \tl_if_head_is_group:nTF {#2}
1804 {
1805 \tl_set:Nx \l__tikzspath_tmpc_tl { \tl_item:nn {#2} {1} }
1806 \tl_set:Nx \l__tikzspath_tmpd_tl { \tl_item:nn {#2} {2} }
1807 }
1808 {
1809 \tl_set:Nn \l__tikzspath_tmpc_tl {#2}
1810 \tl_clear:N \l__tikzspath_tmpd_tl
1811 }
1812
1813 \__tikzspath_maybe_current_path_reuse:nnn
1814 {
1815 \__tikzspath_check_path:nnn
1816 {
1817 \__tikzspath_ginsert_gaps_after_components:cVV
1818 }
1819 } {#1} { {} \l__tikzspath_tmpc_tl \l__tikzspath_tmpd_tl }
1820 },
1821 insert~ gaps~ after~ segments/.code~ 2~ args={
1822 \tl_if_head_is_group:nTF {#2}
1823 {
1824 \tl_set:Nx \l__tikzspath_tmpc_tl { \tl_item:nn {#2} {1} }
1825 \tl_set:Nx \l__tikzspath_tmpd_tl { \tl_item:nn {#2} {2} }
1826 }
1827 {
1828 \tl_set:Nn \l__tikzspath_tmpc_tl {#2}
1829 \tl_clear:N \l__tikzspath_tmpd_tl
1830 }
1831
1832 \__tikzspath_maybe_current_path_reuse:nnn
1833 {
1834 \__tikzspath_check_path:nnn
1835 {
1836 \__tikzspath_insert_gaps_after_segments:cVV
1837 }
1838 } {#1} { {} \l__tikzspath_tmpc_tl \l__tikzspath_tmpd_tl }
1839 },
1840 insert~ gaps~ globally~ after~ segments/.code~ 2~ args={
1841 \tl_if_head_is_group:nTF {#2}
1842 {
1843 \tl_set:Nx \l__tikzspath_tmpc_tl { \tl_item:nn {#2} {1} }
1844 \tl_set:Nx \l__tikzspath_tmpd_tl { \tl_item:nn {#2} {2} }
1845 }
1846 {
1847 \tl_set:Nn \l__tikzspath_tmpc_tl {#2}
1848 \tl_clear:N \l__tikzspath_tmpd_tl
1849 }
1850
1851 \__tikzspath_maybe_current_path_reuse:nnn
1852 {
1853 \__tikzspath_check_path:nnn
1854 {
1855 \__tikzspath_ginsert_gaps_after_segments:cVV
1856 }
1857 } {#1} { {} \l__tikzspath_tmpc_tl \l__tikzspath_tmpd_tl }
1858 },
1859 join~ components/.code~ 2~ args={
1860 \__tikzspath_maybe_current_path_reuse:nnn
1861 {
1862 \__tikzspath_check_path:nnn
1863 {
1864 \__tikzspath_join_components:cn
1865 }
1866 } {#1} { {} {#2} }
1867 },
1868 join~ components~ globally/.code~ 2~ args={
1869 \__tikzspath_maybe_current_path_reuse:nnn
1870 {
1871 \__tikzspath_check_path:nnn
1872 {
1873 \__tikzspath_gjoin_components:cn
1874 }
1875 } {#1} { {} {#2} }
1876 },
1877 remove~ empty~ components/.code={
1878 \__tikzspath_maybe_current_path_reuse:nnn
1879 {
1880 \__tikzspath_check_path:nnn
1881 {
1882 \spath_remove_empty_components:c
1883 }
1884 } {#1} { {} }
1885 },
1886 remove~ empty~ components~ globally/.code={
1887 \__tikzspath_maybe_current_path_reuse:nnn
1888 {
1889 \__tikzspath_check_path:nnn
1890 {
1891 \spath_gremove_empty_components:c
1892 }
1893 } {#1} { {} }
1894 },
1895 replace~ lines/.code={
1896 \__tikzspath_maybe_current_path_reuse:nnn
1897 {
1898 \__tikzspath_check_path:nnn
1899 {
1900 \spath_replace_lines:c
1901 }
1902 } {#1} { {} }
1903 },
1904 replace~ lines~ globally/.code={
1905 \__tikzspath_maybe_current_path_reuse:nnn
1906 {
1907 \__tikzspath_check_path:nnn
1908 {
1909 \spath_greplace_lines:c
1910 }
1911 } {#1} { {} }
1912 },
1913 remove~ components/.code~ 2~ args={
1914 \__tikzspath_maybe_current_path_reuse:nnn
1915 {
1916 \__tikzspath_check_path:nnn
1917 {
1918 \__tikzspath_remove_components:cn
1919 }
1920 } {#1} { {} {#2} }
1921 },
1922 remove~ components~ globally/.code~ 2~ args={
1923 \__tikzspath_maybe_current_path_reuse:nnn
1924 {
1925 \__tikzspath_check_path:nnn
1926 {
1927 \__tikzspath_gremove_components:cn
1928 }
1929 } {#1} { {} {#2} }
1930 },
1931 draft~ mode/.code={
1932 \__tikzspath_set_bool:Nn \l__tikzspath_draft_bool {#1}
1933 },
1934 maybe~ spot~ weld/.code={
1935 \bool_if:NF \l__tikzspath_draft_bool
1936 {
1937 \__tikzspath_maybe_current_path_reuse:nnn
1938 {
1939 \__tikzspath_check_path:nnn
1940 {
1941 \spath_spot_weld_components:c
1942 }
1943 } {#1} { {} }
1944 }
1945 },
1946 maybe~ spot~ weld~ globally/.code={
1947 \bool_if:NF \l__tikzspath_draft_bool
1948 {
1949 \__tikzspath_maybe_current_path_reuse:nnn
1950 {
1951 \__tikzspath_check_path:nnn
1952 {
1953 \spath_spot_gweld_components:c
1954 }
1955 } {#1} { {} }
1956 }
1957 },
1958 transform~ to/.code~ 2~ args={
1959 \__tikzspath_maybe_current_path:nn
1960 {
1961 \__tikzspath_check_path:nnn {
1962 \__tikzspath_transform_to:nv {#2}
1963 }
1964 }
1965 {#1}
1966 {
1967 \pgfsettransformentries {1}{0}{0}{1}{0pt}{0pt}
1968 }
1969 },
1970 upright~ transform~ to/.code~ 2~ args={
1971 \__tikzspath_maybe_current_path:nn
1972 {
1973 \__tikzspath_check_path:nnn {
1974 \__tikzspath_transform_upright_to:nv {#2}
1975 }
1976 }
1977 {#1}
1978 {
1979 \pgfsettransformentries {1}{0}{0}{1}{0pt}{0pt}
1980 }
1981 },
1982 knot/.style~ n~ args={3}{
1983 /tikz/spath/split~ at~ self~ intersections=#1,
1984 /tikz/spath/remove~ empty~ components=#1,
1985 /tikz/spath/insert~ gaps~ after~ components={#1}{#2}{#3},
1986 /tikz/spath/maybe~ spot~ weld=#1,
1987 /tikz/spath/render~ components=#1
1988 },
1989 global~ knot/.style~ n~ args={3}{
1990 /tikz/spath/split~ globally~ at~ self~ intersections=#1,
1991 /tikz/spath/remove~ empty~ components~ globally=#1,
1992 /tikz/spath/insert~ gaps~ globally ~after~ components={#1}{#2}{#3},
1993 /tikz/spath/maybe~ spot~ weld~ globally=#1,
1994 /tikz/spath/render~ components=#1
1995 },
1996 arrow~ shortening/.code={
1997 \__tikzspath_set_bool:Nn \l_spath_arrow_shortening_bool {#1}
1998 },
1999 show/.default=current,
2000 spot~ weld/.default=current,
2001 spot~ weld~ globally/.default=current,
2002 reverse/.default=current,
2003 reverse~ globally/.default=current,
2004 close/.default=current,
2005 close~ globally/.default=current,
2006 open/.default=current,
2007 open~ globally/.default=current,
2008 adjust~ and~ close/.default=current,
2009 adjust~ and~ close~ globally/.default=current,
2010 close~ with~ curve/.default=current,
2011 close~ globally~ with~ curve/.default=current,
2012 remove~ empty~ components/.default=current,
2013 remove~ empty~ components~ globally/.default=current,
2014 replace~ lines/.default=current,
2015 replace~ lines~ globally/.default=current,
2016 maybe~ spot~ weld/.default=current,
2017 maybe~ spot~ weld~ globally/.default=current,
2018 }
2019 \cs_new_protected_nopar:Npn \__tikzspath_get_point_at:nn #1#2
2020 {
2021 \group_begin:
2022 \spath_reallength:Nn \l__tikzspath_tmpa_int {#2}
2023 \tl_set:Nx \l__tikzspath_tmpb_tl
2024 {\fp_to_decimal:n {(#1) * (\l__tikzspath_tmpa_int)}}
2025 \spath_point_at:NnV \l__tikzspath_tmpc_tl {#2} \l__tikzspath_tmpb_tl
2026
2027 \tl_clear:N \l__tikzspath_tmpd_tl
2028 \tl_put_right:Nn \l__tikzspath_tmpd_tl {\pgf@x=}
2029 \tl_put_right:Nx \l__tikzspath_tmpd_tl {\tl_item:Nn \l__tikzspath_tmpc_tl {1}}
2030 \tl_put_right:Nn \l__tikzspath_tmpd_tl {\relax}
2031 \tl_put_right:Nn \l__tikzspath_tmpd_tl {\pgf@y=}
2032 \tl_put_right:Nx \l__tikzspath_tmpd_tl {\tl_item:Nn \l__tikzspath_tmpc_tl {2}}
2033 \tl_put_right:Nn \l__tikzspath_tmpd_tl {\relax}
2034
2035 \tl_gset_eq:NN \g__tikzspath_output_tl \l__tikzspath_tmpd_tl
2036 \group_end:
2037 }
2038 \cs_generate_variant:Nn \__tikzspath_get_point_at:nn {VV, Vn, Vv}
2039
2040 \tikzdeclarecoordinatesystem{spath}{%
2041 \group_begin:
2042 \tl_set:Nn \l__tikzspath_tmpa_tl {#1}
2043 \tl_trim_spaces:N \l__tikzspath_tmpa_tl
2044
2045 \seq_set_split:NnV \l__tikzspath_tmpa_seq {~} \l__tikzspath_tmpa_tl
2046 \seq_pop_right:NN \l__tikzspath_tmpa_seq \l__tikzspath_tmpb_tl
2047
2048 \tl_set:Nx \l__tikzspath_tmpa_tl { \seq_use:Nn \l__tikzspath_tmpa_seq {~} }
2049
2050 \__tikzspath_maybe_current_path:nV
2051 {
2052 \__tikzspath_check_path:nnn {
2053 \__tikzspath_get_point_at:Vv \l__tikzspath_tmpb_tl
2054 }
2055 }
2056 \l__tikzspath_tmpa_tl
2057 {
2058 \tl_gset_eq:NN \g__tikzspath_output_tl \pgfpointorigin
2059 }
2060
2061 \group_end:
2062 \use:c {pgf@process}{%
2063 \tl_use:N \g__tikzspath_output_tl
2064 \pgftransforminvert
2065 \use:c {pgf@pos@transform@glob}
2066 }
2067 \tl_gclear:N \g__tikzspath_output_tl
2068 }
2069
2070 \ExplSyntaxOff
2071 %%
2072 %% Copyright (C) 2011-2024 by Andrew Stacey <[email protected]>
2073 %%
2074 %% This work may be distributed and/or modified under the
2075 %% conditions of the LaTeX Project Public License (LPPL), either
2076 %% version 1.3c of this license or (at your option) any later
2077 %% version. The latest version of this license is in the file:
2078 %%
2079 %% http://www.latex-project.org/lppl.txt
2080 %%
2081 %% This work is "maintained" (as per LPPL maintenance status) by
2082 %% Andrew Stacey.
2083 %%
2084 %% This work consists of the files spath3_code.dtx
2085 %% calligraphy_doc.tex
2086 %% knots_doc.tex
2087 %% spath3.tex
2088 %% and the derived files spath3.ins,
2089 %% spath3_code.pdf,
2090 %% spath3.sty,
2091 %% tikzlibrarycalligraphy.code.tex
2092 %% tikzlibraryknots.code.tex
2093 %% tikzlibraryspath3.code.tex
2094 %% calligraphy.pdf
2095 %% knots.pdf
2096 %% spath3.pdf
2097 %% README.txt
2098 %%
2099 %%
2100 %% End of file `tikzlibraryspath3.code.tex'.