From eddf3073a8f4953603e7a5d21fcbba7d1104d502 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 22 Feb 2021 21:52:11 +0000 Subject: spath3 (22feb21) git-svn-id: svn://tug.org/texlive/trunk@57842 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/spath3/spath3.sty | 127 ++- .../tex/latex/spath3/tikzlibraryspath3.code.tex | 1051 +++++++++++++++----- 2 files changed, 925 insertions(+), 253 deletions(-) (limited to 'Master/texmf-dist/tex/latex') diff --git a/Master/texmf-dist/tex/latex/spath3/spath3.sty b/Master/texmf-dist/tex/latex/spath3/spath3.sty index 868e648f570..6a136789262 100644 --- a/Master/texmf-dist/tex/latex/spath3/spath3.sty +++ b/Master/texmf-dist/tex/latex/spath3/spath3.sty @@ -15,7 +15,7 @@ \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} \RequirePackage{pgf} -\ProvidesExplPackage {spath3} {2021/02/05} {2.2} {Functions for +\ProvidesExplPackage {spath3} {2021/02/21} {2.4} {Functions for manipulating PGF soft paths} \RequirePackage{xparse} \cs_new_protected:Nn \__spath_tl_put_right_braced:Nn @@ -1226,7 +1226,7 @@ manipulating PGF soft paths} { \spath_splice_between:NVnn #1#1{#2}{#3} } -\cs_generate_variant:Nn \spath_splice_between:Nnn {NVV, cnn, cvv, Nvn} +\cs_generate_variant:Nn \spath_splice_between:Nnn {NVV, cnn, cvv, Nvn, NVn} \cs_new_protected_nopar:Npn \spath_gsplice_between:Nnnn #1#2#3#4 { \__spath_splice_between:nnn {#2}{#3}{#4} @@ -1238,7 +1238,7 @@ manipulating PGF soft paths} { \spath_gsplice_between:NVnn #1#1{#2}{#3} } -\cs_generate_variant:Nn \spath_gsplice_between:Nnn {NVV, cnn, cvv} +\cs_generate_variant:Nn \spath_gsplice_between:Nnn {NVV, cnn, cvv, Nvn, NVn} \cs_new_protected_nopar:Npn \__spath_close_with:nn #1#2 { \group_begin: @@ -1355,7 +1355,7 @@ manipulating PGF soft paths} { \spath_append_no_move:NVn #1#1{#2} } -\cs_generate_variant:Nn \spath_append_no_move:Nn {NV, cv, Nv} +\cs_generate_variant:Nn \spath_append_no_move:Nn {NV, cv, Nv, cV} \cs_new_protected_nopar:Npn \spath_gappend_no_move:Nnn #1#2#3 { \__spath_append_no_move:nn {#2}{#3} @@ -1367,7 +1367,7 @@ manipulating PGF soft paths} { \spath_gappend_no_move:NVn #1#1{#2} } -\cs_generate_variant:Nn \spath_gappend_no_move:Nn {NV, cv, Nv} +\cs_generate_variant:Nn \spath_gappend_no_move:Nn {NV, cv, Nv, cV} \cs_new_protected_nopar:Npn \spath_append:Nnn #1#2#3 { \tl_set:Nn #1 {#2} @@ -1378,7 +1378,7 @@ manipulating PGF soft paths} { \spath_append:NVn #1#1{#2} } -\cs_generate_variant:Nn \spath_append:Nn {NV, Nv, cv} +\cs_generate_variant:Nn \spath_append:Nn {NV, Nv, cv, cV} \cs_new_protected_nopar:Npn \spath_gappend:Nnn #1#2#3 { \tl_gset:Nn #1 {#2} @@ -1389,7 +1389,7 @@ manipulating PGF soft paths} { \spath_gappend:NVn #1#1{#2} } -\cs_generate_variant:Nn \spath_gappend:Nn {NV, Nv, cv} +\cs_generate_variant:Nn \spath_gappend:Nn {NV, Nv, cv, cV} \cs_new_protected_nopar:Npn \spath_prepend_no_move:Nnn #1#2#3 { \spath_append_no_move:Nnn #1{#3}{#2} @@ -1596,6 +1596,117 @@ manipulating PGF soft paths} { \spath_gopen:NV #1#1 } +\cs_new_protected_nopar:Npn \__spath_replace_lines:n #1 +{ + \group_begin: + \tl_set:Nn \l__spath_tmpa_tl {#1} + \tl_clear:N \l__spath_tmpb_tl + \dim_set:Nn \l__spath_tmpa_dim {0pt} + \dim_set:Nn \l__spath_tmpb_dim {0pt} + + \bool_do_until:nn + { + \tl_if_empty_p:N \l__spath_tmpa_tl + } + { + \tl_set:Nx \l__spath_tmpc_tl {\tl_item:Nn \l__spath_tmpa_tl {1}} + \tl_set:Nx \l__spath_tmpd_tl {\tl_item:Nn \l__spath_tmpa_tl {2}} + \tl_set:Nx \l__spath_tmpe_tl {\tl_item:Nn \l__spath_tmpa_tl {3}} + + \tl_if_eq:NNTF \l__spath_tmpc_tl \c_spath_lineto_tl + { + \tl_put_right:NV \l__spath_tmpb_tl \c_spath_curvetoa_tl + \tl_put_right:Nx \l__spath_tmpb_tl + { + { + \fp_to_dim:n + { + 2/3 * (\l__spath_tmpa_dim) + + + 1/3 * (\l__spath_tmpd_tl) + } + } + } + \tl_put_right:Nx \l__spath_tmpb_tl + { + { + \fp_to_dim:n + { + 2/3 * (\l__spath_tmpb_dim) + + + 1/3 * (\l__spath_tmpe_tl) + } + } + } + \tl_put_right:NV \l__spath_tmpb_tl \c_spath_curvetob_tl + \tl_put_right:Nx \l__spath_tmpb_tl + { + { + \fp_to_dim:n + { + 1/3 * (\l__spath_tmpa_dim) + + + 2/3 * (\l__spath_tmpd_tl) + } + } + } + \tl_put_right:Nx \l__spath_tmpb_tl + { + { + \fp_to_dim:n + { + 1/3 * (\l__spath_tmpb_dim) + + + 2/3 * (\l__spath_tmpe_tl) + } + } + } + \tl_put_right:NV \l__spath_tmpb_tl \c_spath_curveto_tl + \__spath_tl_put_right_braced:NV \l__spath_tmpb_tl \l__spath_tmpd_tl + \__spath_tl_put_right_braced:NV \l__spath_tmpb_tl \l__spath_tmpe_tl + } + { + \tl_put_right:NV \l__spath_tmpb_tl \l__spath_tmpc_tl + \__spath_tl_put_right_braced:NV \l__spath_tmpb_tl \l__spath_tmpd_tl + \__spath_tl_put_right_braced:NV \l__spath_tmpb_tl \l__spath_tmpe_tl + } + + \dim_set:Nn \l__spath_tmpa_dim {\l__spath_tmpd_tl} + \dim_set:Nn \l__spath_tmpb_dim {\l__spath_tmpe_tl} + + \prg_replicate:nn {3} + { + \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl} + } + } + \tl_gset_eq:NN \g__spath_output_tl \l__spath_tmpb_tl + \group_end: +} +\cs_generate_variant:Nn \__spath_replace_lines:n {V} +\cs_new_protected_nopar:Npn \spath_replace_lines:Nn #1#2 +{ + \__spath_replace_lines:n {#2} + \tl_set_eq:NN #1 \g__spath_output_tl + \tl_gclear:N \g__spath_output_tl +} +\cs_generate_variant:Nn \spath_replace_lines:Nn {NV, cV, cv, Nv} +\cs_new_protected_nopar:Npn \spath_replace_lines:N #1 +{ + \spath_replace_lines:NV #1#1 +} +\cs_generate_variant:Nn \spath_replace_lines:N {c} +\cs_new_protected_nopar:Npn \spath_greplace_lines:Nn #1#2 +{ + \__spath_replace_lines:n {#2} + \tl_gset_eq:NN #1 \g__spath_output_tl + \tl_gclear:N \g__spath_output_tl +} +\cs_generate_variant:Nn \spath_greplace_lines:Nn {NV, cV, cv, Nv} +\cs_new_protected_nopar:Npn \spath_greplace_lines:N #1 +{ + \spath_greplace_lines:NV #1#1 +} +\cs_generate_variant:Nn \spath_greplace_lines:N {c} \cs_new_protected_nopar:Npn \__spath_remove_empty_components:n #1 { \group_begin: @@ -3810,7 +3921,6 @@ manipulating PGF soft paths} } } \cs_generate_variant:Nn \spath_show:n {V, v} - \cs_new_protected_nopar:Npn \spath_get_current_path:N #1 { \pgfsyssoftpath@getcurrentpath #1 @@ -3898,6 +4008,7 @@ manipulating PGF soft paths} \tl_clear_new:c {tikz@timer} \tl_set:cn {tikz@timer} { + \pgftransformreset \spath_reallength:Nn \l__spath_tmpa_int {#1} \tl_set_eq:Nc \l__spath_tmpb_tl {tikz@time} \tl_set:Nx \l__spath_tmpb_tl diff --git a/Master/texmf-dist/tex/latex/spath3/tikzlibraryspath3.code.tex b/Master/texmf-dist/tex/latex/spath3/tikzlibraryspath3.code.tex index 9c1c158e52a..bd81706e3b9 100644 --- a/Master/texmf-dist/tex/latex/spath3/tikzlibraryspath3.code.tex +++ b/Master/texmf-dist/tex/latex/spath3/tikzlibraryspath3.code.tex @@ -25,7 +25,10 @@ \seq_new:N \g__spath_tmpb_seq \bool_new:N \l__spath_draft_bool \msg_new:nnn { spath3 } { missing soft path } { Soft~ path~ #1~ doesn't~ exist } -\msg_new:nnn { spath3 } { empty soft path } { Soft~ path~ #1~ is~ empty } +\msg_new:nnnn { spath3 } { empty soft path } { Soft~ path~ #1~ is~ empty} +{If~ it~ was~ defined~ inside~ a~ group,~ try~ using~ "save~ global". } +\msg_new:nnn { spath3 } { load intersections } +{ You~ need~ to~ load~ the~ "intersections"~ library~ to~ work~ with~ intersections } \tl_set:Nn \l__spath_prefix_tl {tikz@intersect@path@name@} \tl_set:Nn \l__spath_suffix_tl {} \tl_new:N \g__spath_tikzfinish_tl @@ -68,6 +71,59 @@ \tl_set_eq:NN #1 \g__spath_output_tl \tl_gclear:N \g__spath_output_tl } +\cs_set_eq:NN \__spath_tikzset:n \tikzset +\cs_generate_variant:Nn \__spath_tikzset:n {V, v} +\bool_new:N \l__spath_reverse_bool +\bool_new:N \l__spath_weld_bool +\bool_new:N \l__spath_move_bool +\bool_new:N \l__spath_global_bool +\tl_new:N \l__spath_joinpath_tl +\tl_new:N \l__spath_transformation_tl + +\cs_new_protected_nopar:Npn \__spath_set_bool:Nn #1#2 +{ + \tl_if_eq:nnTF {#2}{false} + { + \bool_set_false:N #1 + } + { + \bool_set_true:N #1 + } +} +\tikzset { + spath/join/.is~ family, + spath/join/.cd, + reverse/.code = { + \__spath_set_bool:Nn \l__spath_reverse_bool {#1} + }, + reverse/.default = true, + weld/.code = { + \__spath_set_bool:Nn \l__spath_weld_bool {#1} + }, + weld/.default = true, + no~ weld/.code = { + \__spath_set_bool:Nn \l__spath_weld_bool {#1} + \bool_set:Nn \l__spath_weld_bool {! \l__spath_weld_bool} + }, + no~ weld/.default = true, + move/.code = { + \__spath_set_bool:Nn \l__spath_move_bool {#1} + }, + move/.default = true, + no~ move/.code = { + \__spath_set_bool:Nn \l__spath_move_bool {#1} + \bool_set:Nn \l__spath_move_bool {! \l__spath_move_bool} + }, + no~ move/.default = true, + global/.code = { + \__spath_set_bool:Nn \l__spath_global_bool {#1} + }, + global/.default = true, + transform/.store~in=\l__spath_transformation_tl, + .unknown/.code = { + \tl_set_eq:NN \l__spath_joinpath_tl \pgfkeyscurrentname + } +} \cs_set_eq:NN \getComponentOf \clist_item:Nn \tikzset{ spath/.is~family, @@ -95,6 +151,15 @@ \l__spath_tmpa_tl } }, + save~ global/.code={ + \tikz@addmode{ + \spath_get_current_path:N \l__spath_tmpa_tl + \spath_bake_round:NV \l__spath_tmpa_tl \l__spath_tmpa_tl + \spath_gsave_path:cV + {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} + \l__spath_tmpa_tl + } + }, clone/.code~ 2~ args={ \tl_if_exist:cTF {\tl_use:N \l__spath_prefix_tl #2 \tl_use:N \l__spath_suffix_tl} @@ -123,15 +188,6 @@ \msg_warning:nnn { spath3 } { missing soft path } { #2 } } }, - save~ global/.code={ - \tikz@addmode{ - \spath_get_current_path:N \l__spath_tmpa_tl - \spath_bake_round:NV \l__spath_tmpa_tl \l__spath_tmpa_tl - \spath_gsave_path:cV - {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} - \l__spath_tmpa_tl - } - }, save~ to~ aux/.code={ \tl_if_exist:cTF {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} @@ -143,67 +199,134 @@ \msg_warning:nnn { spath3 } { missing soft path } { #1 } } }, - restore/.code={ + export~ to~ svg/.code={ \tl_if_exist:cTF {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} { - \tl_if_empty:cTF + \spath_export_to_svg:nv {#1} {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} - { - \tl_clear:N \l__spath_tmpa_tl - \tl_put_right:NV \l__spath_tmpa_tl \c_spath_moveto_tl - \tl_put_right:Nn \l__spath_tmpa_tl {{0pt}{0pt}} - \spath_set_current_path:V \l__spath_tmpa_tl - \spath_set_tikz_data:V \l__spath_tmpa_tl - \msg_warning:nnn { spath3 } { empty soft path } { #1 } - } - { - \spath_set_current_path:c - {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} - \spath_set_tikz_data:v - {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} - } } { - \tl_clear:N \l__spath_tmpa_tl - \tl_put_right:NV \l__spath_tmpa_tl \c_spath_moveto_tl - \tl_put_right:Nn \l__spath_tmpa_tl {{0pt}{0pt}} - \spath_set_current_path:V \l__spath_tmpa_tl - \spath_set_tikz_data:V \l__spath_tmpa_tl \msg_warning:nnn { spath3 } { missing soft path } { #1 } } }, - restore~ reverse/.code={ + use/.code={ + \bool_set_false:N \l__spath_reverse_bool + \bool_set_false:N \l__spath_weld_bool + \bool_set_false:N \l__spath_move_bool + \tl_clear:N \l__spath_joinpath_tl + \tl_clear:N \l__spath_transformation_tl + \tikzset{ + spath/join/.cd, + #1 + } + \tl_if_exist:cTF - {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} { - \tl_if_empty:cTF - {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} + \tl_use:N \l__spath_prefix_tl + \tl_use:N \l__spath_joinpath_tl + \tl_use:N \l__spath_suffix_tl + } + { + \tl_if_empty:cT + { + \tl_use:N \l__spath_prefix_tl + \tl_use:N \l__spath_joinpath_tl + \tl_use:N \l__spath_suffix_tl + } { - \tl_clear:N \l__spath_tmpa_tl - \tl_put_right:NV \l__spath_tmpa_tl \c_spath_moveto_tl - \tl_put_right:Nn \l__spath_tmpa_tl {{0pt}{0pt}} - \spath_set_current_path:V \l__spath_tmpa_tl - \spath_set_tikz_data:V \l__spath_tmpa_tl \msg_warning:nnn { spath3 } { empty soft path } { #1 } } + \tl_set_eq:Nc \l__spath_joinpath_tl { - \spath_reverse:Nv - \l__spath_reverse_tl - {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} - \spath_set_current_path:N \l__spath_reverse_tl - \spath_set_tikz_data:V \l__spath_reverse_tl + \tl_use:N \l__spath_prefix_tl + \tl_use:N \l__spath_joinpath_tl + \tl_use:N \l__spath_suffix_tl } + \spath_get_current_path:N \l__spath_current_tl + + \bool_if:NT \l__spath_reverse_bool + { + \spath_reverse:N \l__spath_joinpath_tl + } + + \tl_if_empty:NF \l__spath_transformation_tl + { + \group_begin: + \pgftransformreset + \__spath_tikzset:V \l__spath_transformation_tl + \pgfgettransform \l__spath_tmpa_tl + \tl_gset:Nn \g__spath_smuggle_tl + { + \spath_transform:Nnnnnnn + \l__spath_joinpath_tl + } + \tl_gput_right:NV \g__spath_smuggle_tl \l__spath_tmpa_tl + \group_end: + \tl_use:N \g__spath_smuggle_tl + } + + \bool_if:NT \l__spath_move_bool + { + \tl_if_empty:NTF \l__spath_current_tl + { + \tl_set:Nn \l__spath_tmpc_tl { {0pt} {0pt} } + } + { + \spath_finalpoint:NV + \l__spath_tmpc_tl + \l__spath_current_tl + } + \spath_translate_to:NV \l__spath_joinpath_tl \l__spath_tmpc_tl + } + + \tl_if_empty:NTF \l__spath_current_tl + { + \tl_if_empty:NTF \l__spath_joinpath_tl + { + \tl_set_eq:NN \l__spath_current_tl \c_spath_moveto_tl + \tl_put_right:Nn \l__spath_current_tl {{0pt}{0pt}} + } + { + \tl_set_eq:NN \l__spath_current_tl \l__spath_joinpath_tl + } + } + { + + \tl_clear:N \l__spath_tmpa_tl + \tl_set:Nn \l__spath_tmpa_tl {spath_} + + \tl_put_right:Nn \l__spath_tmpa_tl {append} + + \bool_if:NT \l__spath_weld_bool + { + \tl_put_right:Nn \l__spath_tmpa_tl {_no_move} + } + \tl_put_right:Nn \l__spath_tmpa_tl {:NV} + + \use:c {\tl_use:N \l__spath_tmpa_tl } + \l__spath_current_tl + \l__spath_joinpath_tl + } + + \spath_set_current_path:N \l__spath_current_tl + \spath_set_tikz_data:V \l__spath_joinpath_tl } { - \tl_clear:N \l__spath_tmpa_tl - \tl_put_right:NV \l__spath_tmpa_tl \c_spath_moveto_tl - \tl_put_right:Nn \l__spath_tmpa_tl {{0pt}{0pt}} - \spath_set_current_path:V \l__spath_tmpa_tl - \spath_set_tikz_data:V \l__spath_tmpa_tl - \msg_warning:nnn { spath3 } { missing soft path } { #1 } + \msg_warning:nnx + { spath3 } + { missing soft path } + {\tl_use:N \l__spath_joinpath_tl } } }, + restore/.style={/tikz/spath/use={#1}}, + restore~ reverse/.style={/tikz/spath/use={reverse, #1}}, + append/.style={/tikz/spath/use={move, weld, #1}}, + append~ no~ move/.style={/tikz/spath/use={weld, #1}}, + append~ reverse/.style={/tikz/spath/use={move, weld, reverse, #1}}, + append~ reverse~ no~ move/.style={/tikz/spath/use={weld, reverse, #1}}, + insert/.style={/tikz/spath/use={#1}}, + insert~ reverse/.style={/tikz/spath/use={reverse, #1}}, show~current~path/.code={ \tikz@addmode{ \pgfsyssoftpath@getcurrentpath\l__spath_tmpa_tl @@ -230,37 +353,94 @@ \msg_warning:nnn { spath3 } { missing soft path } { #1 } } }, - append/.code={ - \tl_if_exist:cTF - {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} - { - \spath_get_current_path:N \l__spath_current_tl - \spath_finalpoint:NV \l__spath_tmpa_tl \l__spath_current_tl - \tl_set_eq:Nc - \l__spath_tmpb_tl - {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} - \spath_translate_to:NV \l__spath_tmpb_tl \l__spath_tmpa_tl - \spath_append_no_move:NV \l__spath_current_tl \l__spath_tmpb_tl - \spath_set_current_path:N \l__spath_current_tl - \spath_set_tikz_data:V \l__spath_tmpb_tl - } - { - \msg_warning:nnn { spath3 } { missing soft path } { #1 } - } - }, join~ with/.code~ 2~ args={ \tl_if_exist:cTF {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} { + \bool_set_false:N \l__spath_reverse_bool + \bool_set_false:N \l__spath_weld_bool + \bool_set_false:N \l__spath_move_bool + \bool_set_false:N \l__spath_global_bool + \tl_clear:N \l__spath_joinpath_tl + \tl_clear:N \l__spath_transformation_tl + \tikzset{ + spath/join/.cd, + #2 + } + \tl_if_exist:cTF - {\tl_use:N \l__spath_prefix_tl #2 \tl_use:N \l__spath_suffix_tl} { - \spath_append:cv + \tl_use:N \l__spath_prefix_tl + \tl_use:N \l__spath_joinpath_tl + \tl_use:N \l__spath_suffix_tl + } + { + \tl_set_eq:Nc \l__spath_joinpath_tl + { + \tl_use:N \l__spath_prefix_tl + \tl_use:N \l__spath_joinpath_tl + \tl_use:N \l__spath_suffix_tl + } + + \bool_if:NT \l__spath_reverse_bool + { + \spath_reverse:N \l__spath_joinpath_tl + } + + \tl_if_empty:NF \l__spath_transformation_tl + { + \group_begin: + \pgftransformreset + \__spath_tikzset:V \l__spath_transformation_tl + \pgfgettransform \l__spath_tmpa_tl + \tl_gset:Nn \g__spath_smuggle_tl + { + \spath_transform:Nnnnnnn + \l__spath_joinpath_tl + } + \tl_gput_right:NV \g__spath_smuggle_tl \l__spath_tmpa_tl + \group_end: + \tl_use:N \g__spath_smuggle_tl + } + + \bool_if:NT \l__spath_move_bool + { + \spath_finalpoint:Nv + \l__spath_tmpc_tl + {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} + \spath_translate_to:NV \l__spath_joinpath_tl \l__spath_tmpc_tl + } + + \tl_clear:N \l__spath_tmpa_tl + \tl_set:Nn \l__spath_tmpa_tl {spath_} + + \bool_if:NT \l__spath_global_bool + { + \tl_put_right:Nn \l__spath_tmpa_tl {g} + } + + \tl_put_right:Nn \l__spath_tmpa_tl {append} + + \bool_if:NT \l__spath_weld_bool + { + \tl_put_right:Nn \l__spath_tmpa_tl {_no_move} + } + \tl_put_right:Nn \l__spath_tmpa_tl {:cV} + + \cs_if_exist:cF {\tl_use:N \l__spath_tmpa_tl} + { + \tl_show:N \l__spath_tmpa_tl + } + + \use:c {\tl_use:N \l__spath_tmpa_tl } {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} - {\tl_use:N \l__spath_prefix_tl #2 \tl_use:N \l__spath_suffix_tl} + \l__spath_joinpath_tl } { - \msg_warning:nnn { spath3 } { missing soft path } { #2 } + \msg_warning:nnx + { spath3 } + { missing soft path } + {\tl_use:N \l__spath_joinpath_tl } } } { @@ -311,88 +491,6 @@ \msg_warning:nnn { spath3 } { missing soft path } { #1 } } }, - append~ reverse/.code={ - \tl_if_exist:cTF - {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} - { - \spath_reverse:Nv - \l__spath_reverse_tl - {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} - \spath_get_current_path:N \l__spath_current_tl - \spath_finalpoint:NV \l__spath_tmpa_tl \l__spath_current_tl - \spath_translate_to:NV \l__spath_reverse_tl \l__spath_tmpa_tl - \spath_append_no_move:NV \l__spath_current_tl \l__spath_reverse_tl - \spath_set_current_path:N \l__spath_current_tl - \spath_set_tikz_data:V \l__spath_reverse_tl - } - { - \msg_warning:nnn { spath3 } { missing soft path } { #1 } - } - }, - insert/.code={ - \tl_if_exist:cTF - {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} - { - \spath_get_current_path:N \l__spath_current_tl - \spath_append:Nv - \l__spath_current_tl - {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} - \spath_set_current_path:N \l__spath_current_tl - \spath_set_tikz_data:v - {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} - } - { - \msg_warning:nnn { spath3 } { missing soft path } { #1 } - } - }, - insert~ reverse/.code={ - \tl_if_exist:cTF - {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} - { - \spath_reverse:Nv - \l__spath_reverse_tl - {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} - \spath_get_current_path:N \l__spath_current_tl - \spath_append:NV \l__spath_current_tl \l__spath_reverse_tl - \spath_set_current_path:N \l__spath_current_tl - \spath_set_tikz_data:V \l__spath_reverse_tl - } - { - \msg_warning:nnn { spath3 } { missing soft path } { #1 } - } - }, - append~ no~ move/.code={ - \tl_if_exist:cTF - {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} - { - \spath_get_current_path:N \l__spath_current_tl - \spath_append_no_move:Nv - \l__spath_current_tl - {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} - \spath_set_current_path:N \l__spath_current_tl - \spath_set_tikz_data:v - {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} - } - { - \msg_warning:nnn { spath3 } { missing soft path } { #1 } - } - }, - append~ reverse~ no~ move/.code={ - \tl_if_exist:cTF - {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} - { - \spath_reverse:Nv - \l__spath_reverse_tl - {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} - \spath_get_current_path:N \l__spath_current_tl - \spath_append_no_move:NV \l__spath_current_tl \l__spath_reverse_tl - \spath_set_current_path:N \l__spath_current_tl - \spath_set_tikz_data:V \l__spath_reverse_tl - } - { - \msg_warning:nnn { spath3 } { missing soft path } { #1 } - } - }, span/.code ~n~ args={3}{ \tl_if_exist:cTF {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} @@ -473,79 +571,427 @@ {\tl_use:N \l__spath_prefix_tl #3 \tl_use:N \l__spath_suffix_tl} } { - \msg_warning:nnn { spath3 } { missing soft path } { #3 } + \msg_warning:nnn { spath3 } { missing soft path } { #3 } + } + } + { + \msg_warning:nnn { spath3 } { missing soft path } { #2 } + } + } + { + \msg_warning:nnn { spath3 } { missing soft path } { #1 } + } + }, + join~ components~ with/.code~2~args={ + \tl_if_exist:cTF + {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} + { + \tl_if_head_is_group:nTF {#2} + { + \tl_set:Nx \l__spath_tmpc_tl { \tl_item:nn {#2} {1} } + \tl_set:Nx \l__spath_tmpd_tl { \tl_item:nn {#2} {2} } + } + { + \tl_set:Nn \l__spath_tmpc_tl {#2} + \tl_clear:N \l__spath_tmpd_tl + } + \tl_if_exist:cTF + { + \tl_use:N \l__spath_prefix_tl + \tl_use:N \l__spath_tmpc_tl + \tl_use:N \l__spath_suffix_tl + } + { + \tl_if_empty:NT \l__spath_tmpd_tl + { + \spath_spot_weld_components:c + {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} + } + + \spath_components_to_seq:Nv + \l__spath_tmpa_seq + {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} + + \seq_gclear:N \g__spath_tmpa_seq + + \tl_if_empty:NTF \l__spath_tmpd_tl + { + \int_step_inline:nnnn {1}{1} {\seq_count:N \l__spath_tmpa_seq} + { + \seq_gput_right:Nn \g__spath_tmpa_seq {##1} + } + } + { + \foreach \l__spath_tmpa_tl in \l__spath_tmpd_tl + { + \seq_gput_right:NV \g__spath_tmpa_seq \l__spath_tmpa_tl + } + \seq_gsort:Nn \g__spath_tmpa_seq + { + \int_compare:nNnTF {##1} < {##2} + { \sort_return_same: } + { \sort_return_swapped: } + } + } + + \seq_pop_left:NN \l__spath_tmpa_seq \l__spath_tmpa_tl + \seq_gpop_left:NN \g__spath_tmpa_seq \l__spath_tmpb_tl + + \seq_map_indexed_inline:Nn \l__spath_tmpa_seq + { + \int_compare:nTF + { + ##1 == \l__spath_tmpb_tl + } + { + \seq_gpop_left:NNF \g__spath_tmpa_seq \l__spath_tmpb_tl + { + \tl_set:Nn \l__spath_tmpb_tl {-1} + } + \spath_splice_between:Nvn \l__spath_tmpa_tl + { + \tl_use:N \l__spath_prefix_tl + \tl_use:N \l__spath_tmpc_tl + \tl_use:N \l__spath_suffix_tl + } + {##2} + } + { + \tl_put_right:Nn \l__spath_tmpa_tl {##2} + } + } + \tl_set_eq:cN + {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} + \l__spath_tmpa_tl + } + { + \msg_warning:nnx + { spath3 } + { missing soft path } + { \tl_use:N \l__spath_tmpc_tl } + } + } + { + \msg_warning:nnn { spath3 } { missing soft path } { #1 } + } + }, + join~ components~ globally~ with/.code~2~args={ + \tl_if_exist:cTF + {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} + { + \tl_if_head_is_group:nTF {#2} + { + \tl_set:Nx \l__spath_tmpc_tl { \tl_item:nn {#2} {1} } + \tl_set:Nx \l__spath_tmpd_tl { \tl_item:nn {#2} {2} } + } + { + \tl_set:Nn \l__spath_tmpc_tl {#2} + \tl_clear:N \l__spath_tmpd_tl + } + \tl_if_exist:cTF + { + \tl_use:N \l__spath_prefix_tl + \tl_use:N \l__spath_tmpc_tl + \tl_use:N \l__spath_suffix_tl + } + { + \tl_if_empty:NT \l__spath_tmpd_tl + { + \spath_spot_weld_components:c + {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} + } + + \spath_components_to_seq:Nv + \l__spath_tmpa_seq + {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} + + \seq_gclear:N \g__spath_tmpa_seq + + \tl_if_empty:NTF \l__spath_tmpd_tl + { + \int_step_inline:nnnn {1}{1} {\seq_count:N \l__spath_tmpa_seq} + { + \seq_gput_right:Nn \g__spath_tmpa_seq {##1} + } + } + { + \foreach \l__spath_tmpa_tl in \l__spath_tmpd_tl + { + \seq_gput_right:NV \g__spath_tmpa_seq \l__spath_tmpa_tl + } + \seq_gsort:Nn \g__spath_tmpa_seq + { + \int_compare:nNnTF {##1} < {##2} + { \sort_return_same: } + { \sort_return_swapped: } + } + } + + \seq_pop_left:NN \l__spath_tmpa_seq \l__spath_tmpa_tl + \seq_gpop_left:NN \g__spath_tmpa_seq \l__spath_tmpb_tl + + \seq_map_indexed_inline:Nn \l__spath_tmpa_seq + { + \int_compare:nTF + { + ##1 == \l__spath_tmpb_tl + } + { + \seq_gpop_left:NNF \g__spath_tmpa_seq \l__spath_tmpb_tl + { + \tl_set:Nn \l__spath_tmpb_tl {-1} + } + \spath_splice_between:Nvn \l__spath_tmpa_tl + { + \tl_use:N \l__spath_prefix_tl + \tl_use:N \l__spath_tmpc_tl + \tl_use:N \l__spath_suffix_tl + } + {##2} + } + { + \tl_put_right:Nn \l__spath_tmpa_tl {##2} + } } + \tl_gset_eq:cN + {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} + \l__spath_tmpa_tl } { - \msg_warning:nnn { spath3 } { missing soft path } { #2 } + \msg_warning:nnx + { spath3 } + { missing soft path } + { \tl_use:N \l__spath_tmpc_tl } } } { \msg_warning:nnn { spath3 } { missing soft path } { #1 } } }, - join~ components~ with/.code~2~args={ + join~ components~ upright~ with/.code~2~args={ \tl_if_exist:cTF {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} { + \tl_if_head_is_group:nTF {#2} + { + \tl_set:Nx \l__spath_tmpc_tl { \tl_item:nn {#2} {1} } + \tl_set:Nx \l__spath_tmpd_tl { \tl_item:nn {#2} {2} } + } + { + \tl_set:Nn \l__spath_tmpc_tl {#2} + \tl_clear:N \l__spath_tmpd_tl + } \tl_if_exist:cTF - {\tl_use:N \l__spath_prefix_tl #2 \tl_use:N \l__spath_suffix_tl} { - \spath_spot_weld_components:c - {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} + \tl_use:N \l__spath_prefix_tl + \tl_use:N \l__spath_tmpc_tl + \tl_use:N \l__spath_suffix_tl + } + { + \tl_if_empty:NT \l__spath_tmpd_tl + { + \spath_spot_weld_components:c + {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} + } \spath_components_to_seq:Nv \l__spath_tmpa_seq {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} + \seq_gclear:N \g__spath_tmpa_seq + + \tl_if_empty:NTF \l__spath_tmpd_tl + { + \int_step_inline:nnnn {1}{1} {\seq_count:N \l__spath_tmpa_seq} + { + \seq_gput_right:Nn \g__spath_tmpa_seq {##1} + } + } + { + \foreach \l__spath_tmpa_tl in \l__spath_tmpd_tl + { + \seq_gput_right:NV \g__spath_tmpa_seq \l__spath_tmpa_tl + } + \seq_gsort:Nn \g__spath_tmpa_seq + { + \int_compare:nNnTF {##1} < {##2} + { \sort_return_same: } + { \sort_return_swapped: } + } + } + \seq_pop_left:NN \l__spath_tmpa_seq \l__spath_tmpa_tl + \seq_gpop_left:NN \g__spath_tmpa_seq \l__spath_tmpb_tl - \seq_map_inline:Nn \l__spath_tmpa_seq + \tl_set_eq:Nc \l__spath_tmpc_tl { - \spath_splice_between:Nvn \l__spath_tmpa_tl - {\tl_use:N \l__spath_prefix_tl #2 \tl_use:N \l__spath_suffix_tl} - {##1} + \tl_use:N \l__spath_prefix_tl + \tl_use:N \l__spath_tmpc_tl + \tl_use:N \l__spath_suffix_tl + } + \spath_transform:NVnnnnnn \l__spath_tmpd_tl \l__spath_tmpc_tl {1}{0}{0}{-1}{0pt}{0pt} + + \seq_map_indexed_inline:Nn \l__spath_tmpa_seq + { + \int_compare:nTF + { + ##1 == \l__spath_tmpb_tl + } + { + \seq_gpop_left:NNF \g__spath_tmpa_seq \l__spath_tmpb_tl + { + \tl_set:Nn \l__spath_tmpb_tl {-1} + } + \spath_finalpoint:NV \l__spath_tmpe_tl \l__spath_tmpa_tl + \spath_initialpoint:Nn \l__spath_tmpf_tl {##2} + + \dim_compare:nTF + { + \tl_item:Nn \l__spath_tmpe_tl {1} + > + \tl_item:Nn \l__spath_tmpf_tl {1} + } + { + \spath_splice_between:NVn + \l__spath_tmpa_tl + \l__spath_tmpd_tl + {##2} + } + { + \spath_splice_between:NVn + \l__spath_tmpa_tl + \l__spath_tmpc_tl + {##2} + } + } + { + \tl_put_right:Nn \l__spath_tmpa_tl {##2} + } } \tl_set_eq:cN {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} \l__spath_tmpa_tl } { - \msg_warning:nnn { spath3 } { missing soft path } { #2 } + \msg_warning:nnx + { spath3 } + { missing soft path } + { \tl_use:N \l__spath_tmpc_tl } } } { \msg_warning:nnn { spath3 } { missing soft path } { #1 } } }, - join~ components~ globally~ with/.code~2~args={ + join~ components~ globally~ upright~ with/.code~2~args={ \tl_if_exist:cTF {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} { + \tl_if_head_is_group:nTF {#2} + { + \tl_set:Nx \l__spath_tmpc_tl { \tl_item:nn {#2} {1} } + \tl_set:Nx \l__spath_tmpd_tl { \tl_item:nn {#2} {2} } + } + { + \tl_set:Nn \l__spath_tmpc_tl {#2} + \tl_clear:N \l__spath_tmpd_tl + } \tl_if_exist:cTF - {\tl_use:N \l__spath_prefix_tl #2 \tl_use:N \l__spath_suffix_tl} { - \spath_spot_gweld_components:c - {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} + \tl_use:N \l__spath_prefix_tl + \tl_use:N \l__spath_tmpc_tl + \tl_use:N \l__spath_suffix_tl + } + { + \tl_if_empty:NT \l__spath_tmpd_tl + { + \spath_spot_weld_components:c + {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} + } \spath_components_to_seq:Nv \l__spath_tmpa_seq {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} + \seq_gclear:N \g__spath_tmpa_seq + + \tl_if_empty:NTF \l__spath_tmpd_tl + { + \int_step_inline:nnnn {1}{1} {\seq_count:N \l__spath_tmpa_seq} + { + \seq_gput_right:Nn \g__spath_tmpa_seq {##1} + } + } + { + \foreach \l__spath_tmpa_tl in \l__spath_tmpd_tl + { + \seq_gput_right:NV \g__spath_tmpa_seq \l__spath_tmpa_tl + } + \seq_gsort:Nn \g__spath_tmpa_seq + { + \int_compare:nNnTF {##1} < {##2} + { \sort_return_same: } + { \sort_return_swapped: } + } + } + \seq_pop_left:NN \l__spath_tmpa_seq \l__spath_tmpa_tl + \seq_gpop_left:NN \g__spath_tmpa_seq \l__spath_tmpb_tl - \seq_map_inline:Nn \l__spath_tmpa_seq + \tl_set_eq:Nc \l__spath_tmpc_tl { - \spath_gsplice_between:Nvn \l__spath_tmpa_tl - {\tl_use:N \l__spath_prefix_tl #2 \tl_use:N \l__spath_suffix_tl} - {##1} + \tl_use:N \l__spath_prefix_tl + \tl_use:N \l__spath_tmpc_tl + \tl_use:N \l__spath_suffix_tl } - \tl_set_eq:cN + \spath_transform:NVnnnnnn \l__spath_tmpd_tl \l__spath_tmpc_tl {1}{0}{0}{-1}{0pt}{0pt} + + \seq_map_indexed_inline:Nn \l__spath_tmpa_seq + { + \int_compare:nTF + { + ##1 == \l__spath_tmpb_tl + } + { + \seq_gpop_left:NNF \g__spath_tmpa_seq \l__spath_tmpb_tl + { + \tl_set:Nn \l__spath_tmpb_tl {-1} + } + \spath_finalpoint:NV \l__spath_tmpe_tl \l__spath_tmpa_tl + \spath_initialpoint:Nn \l__spath_tmpf_tl {##2} + + \dim_compare:nTF + { + \tl_item:Nn \l__spath_tmpe_tl {1} + > + \tl_item:Nn \l__spath_tmpf_tl {1} + } + { + \spath_splice_between:NVn + \l__spath_tmpa_tl + \l__spath_tmpd_tl + {##2} + } + { + \spath_splice_between:NVn + \l__spath_tmpa_tl + \l__spath_tmpc_tl + {##2} + } + } + { + \tl_put_right:Nn \l__spath_tmpa_tl {##2} + } + } + \tl_gset_eq:cN {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} \l__spath_tmpa_tl } { - \msg_warning:nnn { spath3 } { missing soft path } { #2 } + \msg_warning:nnx + { spath3 } + { missing soft path } + { \tl_use:N \l__spath_tmpc_tl } } } { @@ -726,17 +1172,6 @@ \msg_warning:nnn { spath3 } { missing soft path } { #1 } } }, - export~ to~ svg/.code={ - \tl_if_exist:cTF - {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} - { - \spath_export_to_svg:nv {#1} - {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} - } - { - \msg_warning:nnn { spath3 } { missing soft path } { #1 } - } - }, transform/.code~ 2~ args={ \tl_if_exist:cTF {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} @@ -781,100 +1216,154 @@ }, split~ at~ intersections~ with/.code~ n~ args={2}{ \tl_if_exist:cTF - {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} + { + tikz@library@intersections@loaded + } { \tl_if_exist:cTF - {\tl_use:N \l__spath_prefix_tl #2 \tl_use:N \l__spath_suffix_tl} + {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} { - \spath_split_path_at_intersections:cv - {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} + \tl_if_exist:cTF {\tl_use:N \l__spath_prefix_tl #2 \tl_use:N \l__spath_suffix_tl} + { + \spath_split_path_at_intersections:cv + {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} + {\tl_use:N \l__spath_prefix_tl #2 \tl_use:N \l__spath_suffix_tl} + } + { + \msg_warning:nnn { spath3 } { missing soft path } { #2 } + } } { - \msg_warning:nnn { spath3 } { missing soft path } { #2 } + \msg_warning:nnn { spath3 } { missing soft path } { #1 } } } { - \msg_warning:nnn { spath3 } { missing soft path } { #1 } + \msg_warning:nn { spath3 } { load intersections } } }, split~ globally~ at~ intersections~ with/.code~ n~ args={2}{ \tl_if_exist:cTF - {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} { - \tl_if_exist:cTF - {\tl_use:N \l__spath_prefix_tl #2 \tl_use:N \l__spath_suffix_tl} + tikz@library@intersections@loaded + } + { + \tl_if_exist:cTF + {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} { - \spath_gsplit_path_at_intersections:cv - {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} + \tl_if_exist:cTF {\tl_use:N \l__spath_prefix_tl #2 \tl_use:N \l__spath_suffix_tl} + { + \spath_gsplit_path_at_intersections:cv + {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} + {\tl_use:N \l__spath_prefix_tl #2 \tl_use:N \l__spath_suffix_tl} + } + { + \msg_warning:nnn { spath3 } { missing soft path } { #2 } + } } { - \msg_warning:nnn { spath3 } { missing soft path } { #2 } + \msg_warning:nnn { spath3 } { missing soft path } { #1 } } } { - \msg_warning:nnn { spath3 } { missing soft path } { #1 } + \msg_warning:nn { spath3 } { load intersections } } }, split~ at~ intersections/.code~ n~ args={2}{ \tl_if_exist:cTF - {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} + { + tikz@library@intersections@loaded + } { \tl_if_exist:cTF - {\tl_use:N \l__spath_prefix_tl #2 \tl_use:N \l__spath_suffix_tl} + {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} { - \spath_split_at_intersections:cc - {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} + \tl_if_exist:cTF {\tl_use:N \l__spath_prefix_tl #2 \tl_use:N \l__spath_suffix_tl} + { + \spath_split_at_intersections:cc + {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} + {\tl_use:N \l__spath_prefix_tl #2 \tl_use:N \l__spath_suffix_tl} + } + { + \msg_warning:nnn { spath3 } { missing soft path } { #2 } + } } { - \msg_warning:nnn { spath3 } { missing soft path } { #2 } + \msg_warning:nnn { spath3 } { missing soft path } { #1 } } } { - \msg_warning:nnn { spath3 } { missing soft path } { #1 } + \msg_warning:nn { spath3 } { load intersections } } }, split~ globally~ at~ intersections/.code~ n~ args={2}{ \tl_if_exist:cTF - {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} + { + tikz@library@intersections@loaded + } { \tl_if_exist:cTF - {\tl_use:N \l__spath_prefix_tl #2 \tl_use:N \l__spath_suffix_tl} + {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} { - \spath_gsplit_at_intersections:cc - {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} + \tl_if_exist:cTF {\tl_use:N \l__spath_prefix_tl #2 \tl_use:N \l__spath_suffix_tl} + { + \spath_gsplit_at_intersections:cc + {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} + {\tl_use:N \l__spath_prefix_tl #2 \tl_use:N \l__spath_suffix_tl} + } + { + \msg_warning:nnn { spath3 } { missing soft path } { #2 } + } } { - \msg_warning:nnn { spath3 } { missing soft path } { #2 } + \msg_warning:nnn { spath3 } { missing soft path } { #1 } } } { - \msg_warning:nnn { spath3 } { missing soft path } { #1 } + \msg_warning:nn { spath3 } { load intersections } } }, split~ at~ self~ intersections/.code={ \tl_if_exist:cTF - {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} { - \spath_split_at_self_intersections:c + tikz@library@intersections@loaded + } + { + \tl_if_exist:cTF {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} + { + \spath_split_at_self_intersections:c + {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} + } + { + \msg_warning:nnn { spath3 } { missing soft path } { #1 } + } } { - \msg_warning:nnn { spath3 } { missing soft path } { #1 } + \msg_warning:nn { spath3 } { load intersections } } }, split~ globally~ at~ self~ intersections/.code={ \tl_if_exist:cTF - {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} { - \spath_gsplit_at_self_intersections:c + tikz@library@intersections@loaded + } + { + \tl_if_exist:cTF {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} + { + \spath_gsplit_at_self_intersections:c + {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} + } + { + \msg_warning:nnn { spath3 } { missing soft path } { #1 } + } } { - \msg_warning:nnn { spath3 } { missing soft path } { #1 } + \msg_warning:nn { spath3 } { load intersections } } }, get~ components~ of/.code~ 2~ args={ @@ -966,40 +1455,64 @@ \msg_warning:nnn { spath3 } { missing soft path } { #1 } } }, - insert~ gaps~ after~ components/.code~ n~ args={3}{ + insert~ gaps~ after~ components/.code~ 2~ args={ \tl_if_exist:cTF {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} { \group_begin: + \tl_if_head_is_group:nTF {#2} + { + \tl_set:Nx \l__spath_tmpc_tl { \tl_item:nn {#2} {1} } + \tl_set:Nx \l__spath_tmpd_tl { \tl_item:nn {#2} {2} } + } + { + \tl_set:Nn \l__spath_tmpc_tl {#2} + \tl_clear:N \l__spath_tmpd_tl + } \seq_gclear:N \g__spath_tmpa_seq \seq_gclear:N \g__spath_tmpb_seq \spath_numberofcomponents:Nv \l__spath_tmpa_int {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} - \foreach \l__spath_tmpa_tl in {#3} + + \spath_components_to_seq:Nv + \l__spath_tmpa_seq + {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} + + \tl_if_empty:NTF \l__spath_tmpd_tl { - \seq_gput_right:NV \g__spath_tmpa_seq \l__spath_tmpa_tl - \seq_gput_right:Nx - \g__spath_tmpb_seq - {\int_eval:n - { - \int_mod:nn { \l__spath_tmpa_tl }{ \l__spath_tmpa_int } + 1 + \int_step_inline:nnnn {1}{1} { \l__spath_tmpa_int - 1 } + { + \seq_gput_right:Nn \g__spath_tmpa_seq {##1} + \seq_gput_right:Nx + \g__spath_tmpb_seq + {\int_eval:n {##1 + 1}} + } + } + { + \foreach \l__spath_tmpa_tl in \l__spath_tmpd_tl + { + \seq_gput_right:NV \g__spath_tmpa_seq \l__spath_tmpa_tl + \seq_gput_right:Nx + \g__spath_tmpb_seq + {\int_eval:n + { + \int_mod:nn { \l__spath_tmpa_tl }{ \l__spath_tmpa_int } + 1 + } } } } - \spath_components_to_seq:Nv - \l__spath_tmpa_seq - {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} + \seq_clear:N \l__spath_tmpb_seq \seq_map_indexed_inline:Nn \l__spath_tmpa_seq { \tl_set:Nn \l__spath_tmpa_tl {##2} \seq_if_in:NnT \g__spath_tmpa_seq {##1} { - \spath_shorten_at_end:Nn \l__spath_tmpa_tl {#2/2} + \spath_shorten_at_end:Nn \l__spath_tmpa_tl {\l__spath_tmpc_tl/2} } \seq_if_in:NnT \g__spath_tmpb_seq {##1} { - \spath_shorten_at_start:Nn \l__spath_tmpa_tl {#2/2} + \spath_shorten_at_start:Nn \l__spath_tmpa_tl {\l__spath_tmpc_tl/2} } \seq_put_right:NV \l__spath_tmpb_seq \l__spath_tmpa_tl } @@ -1014,41 +1527,64 @@ \msg_warning:nnn { spath3 } { missing soft path } { #1 } } }, - insert~ gaps~ globally~ after~ components/.code~ n~ args={3}{ + insert~ gaps~ globally~ after~ components/.code~ 2~ args={ \tl_if_exist:cTF {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} { \group_begin: + \tl_if_head_is_group:nTF {#2} + { + \tl_set:Nx \l__spath_tmpc_tl { \tl_item:nn {#2} {1} } + \tl_set:Nx \l__spath_tmpd_tl { \tl_item:nn {#2} {2} } + } + { + \tl_set:Nn \l__spath_tmpc_tl {#2} + \tl_clear:N \l__spath_tmpd_tl + } \seq_gclear:N \g__spath_tmpa_seq \seq_gclear:N \g__spath_tmpb_seq \spath_numberofcomponents:Nv \l__spath_tmpa_int {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} - \foreach \l__spath_tmpa_tl in {#3} + + \spath_components_to_seq:Nv + \l__spath_tmpa_seq + {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} + + \tl_if_empty:NTF \l__spath_tmpd_tl { - \seq_gput_right:NV \g__spath_tmpa_seq \l__spath_tmpa_tl - \seq_gput_right:Nx - \g__spath_tmpb_seq + \int_step_inline:nnnn {1}{1} { \l__spath_tmpa_int - 1 } { - \int_eval:n - { - \int_mod:nn { \l__spath_tmpa_tl }{ \l__spath_tmpa_int } + 1 + \seq_gput_right:Nn \g__spath_tmpa_seq {##1} + \seq_gput_right:Nx + \g__spath_tmpb_seq + {\int_eval:n {##1 + 1}} + } + } + { + \foreach \l__spath_tmpa_tl in \l__spath_tmpd_tl + { + \seq_gput_right:NV \g__spath_tmpa_seq \l__spath_tmpa_tl + \seq_gput_right:Nx + \g__spath_tmpb_seq + {\int_eval:n + { + \int_mod:nn { \l__spath_tmpa_tl }{ \l__spath_tmpa_int } + 1 + } } } } - \spath_components_to_seq:Nv - \l__spath_tmpa_seq - {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} + \seq_clear:N \l__spath_tmpb_seq \seq_map_indexed_inline:Nn \l__spath_tmpa_seq { \tl_set:Nn \l__spath_tmpa_tl {##2} \seq_if_in:NnT \g__spath_tmpa_seq {##1} { - \spath_shorten_at_end:Nn \l__spath_tmpa_tl {#2/2} + \spath_shorten_at_end:Nn \l__spath_tmpa_tl {\l__spath_tmpc_tl/2} } \seq_if_in:NnT \g__spath_tmpb_seq {##1} { - \spath_shorten_at_start:Nn \l__spath_tmpa_tl {#2/2} + \spath_shorten_at_start:Nn \l__spath_tmpa_tl {\l__spath_tmpc_tl/2} } \seq_put_right:NV \l__spath_tmpb_seq \l__spath_tmpa_tl } @@ -1135,6 +1671,28 @@ \msg_warning:nnn { spath3 } { missing soft path } { #1 } } }, + replace~ lines/.code={ + \tl_if_exist:cTF + {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} + { + \spath_replace_lines:c + {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} + } + { + \msg_warning:nnn { spath3 } { missing soft path } { #1 } + } + }, + replace~ lines~ globally/.code={ + \tl_if_exist:cTF + {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} + { + \spath_greplace_lines:c + {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} + } + { + \msg_warning:nnn { spath3 } { missing soft path } { #1 } + } + }, remove~ components/.code~ 2~ args={ \tl_if_exist:cTF {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} @@ -1403,7 +1961,10 @@ } } { - \msg_warning:nnx { spath3 } { missing soft path } { \tl_use:N \l__spath_tmpa_tl } + \msg_warning:nnx + { spath3 } + { missing soft path } + { \tl_use:N \l__spath_tmpa_tl } \tl_gset_eq:NN \g__spath_smuggle_tl \pgfpointorigin } \group_end: -- cgit v1.2.3