%% %% This is file `tikzlibraryspath3.code.tex', %% generated with the docstrip utility. %% %% The original source files were: %% %% spath3_code.dtx (with options: `tikzspath3') %% ---------------------------------------------------------------- %% spath3 --- Functions for manipulating PGF soft paths %% E-mail: loopspace@mathforge.org %% Released under the LaTeX Project Public License v1.3c or later %% See http://www.latex-project.org/lppl.txt %% ---------------------------------------------------------------- %% \RequirePackage{spath3} \RequirePackage{expl3} \ExplSyntaxOn \tl_new:N \l__tikzspath_tmpa_tl \tl_new:N \l__tikzspath_tmpb_tl \tl_new:N \l__tikzspath_tmpc_tl \tl_new:N \l__tikzspath_tmpd_tl \tl_new:N \l__tikzspath_tmpe_tl \tl_new:N \l__tikzspath_tmpf_tl \int_new:N \l__tikzspath_tmpa_int \seq_new:N \l__tikzspath_tmpa_seq \seq_new:N \l__tikzspath_tmpb_seq \seq_new:N \l__tikzspath_tmpc_seq \seq_new:N \l__tikzspath_tmpd_seq \tl_new:N \l__tikzspath_current_tl \tl_new:N \l__tikzspath_reverse_tl \tl_new:N \l__tikzspath_prefix_tl \tl_new:N \l__tikzspath_suffix_tl \tl_new:N \g__tikzspath_smuggle_tl \tl_new:N \g__tikzspath_output_tl \tl_new:N \l__tikzspath_check_tl \clist_new:N \g__tikzspath_output_clist \seq_new:N \g__tikzspath_tmpa_seq \seq_new:N \g__tikzspath_tmpb_seq \seq_new:N \g__tikzspath_output_seq \bool_new:N \l__tikzspath_draft_bool \msg_new:nnn { spath3 } { missing soft path } { Soft~ path~ #1~ doesn't~ exist~ \msg_line_context:} \msg_new:nnnn { spath3 } { empty soft path } { Soft~ path~ #1~ is~ empty~ \msg_line_context:} {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__tikzspath_prefix_tl {tikz@intersect@path@name@} \tl_set:Nn \l__tikzspath_suffix_tl {} \tl_new:N \g__tikzspath_tikzfinish_tl \tl_new:N \l__tikzspath_tikzfinish_outside_tl \cs_new_protected_nopar:Npn \spath_at_end_of_path: { \tl_use:N \g__tikzspath_tikzfinish_tl \tl_gclear:N \g__tikzspath_tikzfinish_tl } \tl_put_right:Nn \tikz@finish {\spath_at_end_of_path:} \tikzset{ every~ scope/.append~ style={ execute~ at~ begin~ scope={ \tl_set_eq:NN \l__tikzspath_tikzfinish_outside_tl \g__tikzspath_tikzfinish_tl }, execute~ at~ end~ scope={ \tl_use:N \g__tikzspath_tikzfinish_tl \tl_gclear:N \g__tikzspath_tikzfinish_tl \tl_gset_eq:NN \g__tikzspath_tikzfinish_tl \l__tikzspath_tikzfinish_outside_tl }, }, } \tl_new:N \l__tikzspath_tikzpath_finish_tl \cs_new_protected_nopar:Npn \__tikzspath_at_end_of_path_construction: { \tl_use:N \l__tikzspath_tikzpath_finish_tl \tl_clear:N \l__tikzspath_tikzpath_finish_tl } \tl_put_left:Nn \tikz@finish {\__tikzspath_at_end_of_path_construction:} \cs_new_protected_nopar:Npn \spath_save_path:Nn #1#2 { \tl_if_empty:NF \g__tikzspath_tikzfinish_tl { \tl_use:N \g__tikzspath_tikzfinish_tl } \tl_gput_right:Nn \g__tikzspath_tikzfinish_tl { \tl_clear_new:N #1 \tl_set:Nn #1 {#2} } } \cs_generate_variant:Nn \spath_save_path:Nn {cn, NV, cV} \cs_new_protected_nopar:Npn \spath_gsave_path:Nn #1#2 { \tl_gput_right:Nn \g__tikzspath_tikzfinish_tl { \tl_gclear_new:N #1 \tl_gset:Nn #1 {#2} } } \cs_generate_variant:Nn \spath_gsave_path:Nn {cn, NV, cV} \cs_new_protected_nopar:Npn \__tikzspath_process_tikz_point:Nn #1#2 { \group_begin: \use:c {tikz@scan@one@point} \use:n #2 \scan_stop: \tl_gset:Nx \g__tikzspath_output_tl { { \dim_use:c {pgf@x} } { \dim_use:c {pgf@y} } } \group_end: \tl_set_eq:NN #1 \g__tikzspath_output_tl \tl_gclear:N \g__tikzspath_output_tl } \cs_set_eq:NN \__tikzspath_tikzset:n \tikzset \cs_generate_variant:Nn \__tikzspath_tikzset:n {V, v} \cs_new_protected_nopar:Npn \__tikzspath_check_path:nnn #1#2#3 { \tl_set:Nn \l__tikzspath_check_tl {#3} \tl_if_exist:cTF {\__tikzspath_path_name:n {#2}} { \tl_if_empty:cTF {\__tikzspath_path_name:n {#2}} { \msg_warning:nnn { spath3 } { empty soft path } { #2 } } { \tl_set:Nn \l__tikzspath_check_tl { #1 {\__tikzspath_path_name:n {#2}} } } } { \msg_warning:nnn { spath3 } { missing soft path } { #2 } } \tl_use:N \l__tikzspath_check_tl } \cs_new_protected_nopar:Npn \__tikzspath_check_two_paths:nnnn #1#2#3#4 { \__tikzspath_check_path:nnn { \__tikzspath_check_path:nnn {#1}{#2}{#4} }{#3}{#4} } \cs_new_protected_nopar:Npn \__tikzspath_check_three_paths:nnnnn #1#2#3#4#5 { \__tikzspath_check_path:nnn { \__tikzspath_check_path:nnn { \__tikzspath_check_path:nnn {#1}{#2}{#5} }{#3}{#5} }{#4}{#5} } \cs_generate_variant:Nn \__tikzspath_check_path:nnn {nVn} \cs_generate_variant:Nn \__tikzspath_check_two_paths:nnnn {nnVn} \cs_new_protected_nopar:Npn \__tikzspath_maybe_current_path:nn #1#2 { \tl_if_eq:nnT {#2} {current} { \spath_get_current_path:c {\__tikzspath_path_name:n {#2}} } #1 {#2} } \cs_new_protected_nopar:Npn \__tikzspath_maybe_current_path_reuse:nnn #1#2#3 { \bool_set_true:N \l_spath_movetorelevant_bool \tl_if_eq:nnT {#2} {current} { \spath_get_current_path:c {\__tikzspath_path_name:n {#2}} } #1 {#2} #3 \tl_if_eq:nnT {#2} {current} { \tl_if_empty:cF {\__tikzspath_path_name:n {#2}} { \spath_set_current_path:c {\__tikzspath_path_name:n {#2}} \spath_set_tikz_data:v {\__tikzspath_path_name:n {#2}} } } } \cs_new_protected_nopar:Npn \__tikzspath_maybe_current_two_paths_reuse_both:nnnn #1#2#3#4 { \bool_set_true:N \l_spath_movetorelevant_bool \tl_if_eq:nnT {#2} {current} { \spath_get_current_path:c {\__tikzspath_path_name:n {#2}} } \tl_if_eq:nnT {#3} {current} { \spath_get_current_path:c {\__tikzspath_path_name:n {#3}} } #1 {#2} {#3} #4 \tl_if_eq:nnT {#2} {current} { \tl_if_empty:cF {\__tikzspath_path_name:n {#2}} { \spath_set_current_path:c {\__tikzspath_path_name:n {#2}} \spath_set_tikz_data:v {\__tikzspath_path_name:n {#2}} } } \tl_if_eq:nnT {#3} {current} { \tl_if_empty:cF {\__tikzspath_path_name:n {#3}} { \spath_set_current_path:c {\__tikzspath_path_name:n {#3}} \spath_set_tikz_data:v {\__tikzspath_path_name:n {#3}} } } } \cs_new_protected_nopar:Npn \__tikzspath_maybe_current_two_paths_reuse_first:nnnn #1#2#3#4 { \bool_set_true:N \l_spath_movetorelevant_bool \tl_if_eq:nnT {#2} {current} { \spath_get_current_path:c {\__tikzspath_path_name:n {#2}} } \tl_if_eq:nnT {#3} {current} { \spath_get_current_path:c {\__tikzspath_path_name:n {#3}} } #1 {#2} {#3} #4 \tl_if_eq:nnT {#2} {current} { \tl_if_empty:cF {\__tikzspath_path_name:n {#2}} { \spath_set_current_path:c {\__tikzspath_path_name:n {#2}} \spath_set_tikz_data:v {\__tikzspath_path_name:n {#2}} } } } \cs_new_protected_nopar:Npn \__tikzspath_maybe_current_two_paths_reuse_second:nnnn #1#2#3#4 { \bool_set_true:N \l_spath_movetorelevant_bool \tl_if_eq:nnT {#2} {current} { \spath_get_current_path:c {\__tikzspath_path_name:n {#2}} } \tl_if_eq:nnT {#3} {current} { \spath_get_current_path:c {\__tikzspath_path_name:n {#3}} } #1 {#2} {#3} #4 \tl_if_eq:nnT {#3} {current} { \tl_if_empty:cF {\__tikzspath_path_name:n {#3}} { \spath_set_current_path:c {\__tikzspath_path_name:n {#3}} \spath_set_tikz_data:v {\__tikzspath_path_name:n {#3}} } } } \cs_generate_variant:Nn \__tikzspath_maybe_current_path:nn {nV} \cs_generate_variant:Nn \__tikzspath_maybe_current_path_reuse:nnn {nVn} \cs_new_protected_nopar:Npn \__tikzspath_seq_from_foreach:Nnn #1#2#3 { \group_begin: \seq_gclear:N \g__tikzspath_output_seq \tl_if_empty:nTF {#3} { \int_step_inline:nnnn {1}{1} {#2} { \seq_gput_right:Nn \g__tikzspath_output_seq {##1} } } { \foreach \l__tikzspath_tmpa_tl in {#3} { \int_compare:nTF { \l__tikzspath_tmpa_tl > 0 } { \seq_gput_right:NV \g__tikzspath_output_seq \l__tikzspath_tmpa_tl } { \seq_gput_right:Nx \g__tikzspath_output_seq {\int_eval:n {#2 - \l__tikzspath_tmpa_tl}} } } \seq_gsort:Nn \g__tikzspath_output_seq { \int_compare:nNnTF {##1} < {##2} { \sort_return_same: } { \sort_return_swapped: } } } \group_end: \seq_set_eq:NN #1 \g__tikzspath_output_seq \seq_gclear:N \g__tikzspath_output_seq } \cs_generate_variant:Nn \__tikzspath_seq_from_foreach:Nnn {NVV, NVn} \cs_new:Npn \__tikzspath_path_name:n #1 { \tl_use:N \l__tikzspath_prefix_tl #1 \tl_use:N \l__tikzspath_suffix_tl } \cs_generate_variant:Nn \__tikzspath_path_name:n {V} \bool_new:N \l__tikzspath_reverse_bool \bool_new:N \l__tikzspath_weld_bool \bool_new:N \l__tikzspath_move_bool \bool_new:N \l__tikzspath_global_bool \bool_new:N \l__tikzspath_current_transformation_bool \tl_new:N \l__tikzspath_joinpath_tl \tl_new:N \l__tikzspath_transformation_tl \cs_new_protected_nopar:Npn \__tikzspath_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 = { \__tikzspath_set_bool:Nn \l__tikzspath_reverse_bool {#1} }, reverse/.default = true, weld/.code = { \__tikzspath_set_bool:Nn \l__tikzspath_weld_bool {#1} }, weld/.default = true, no~ weld/.code = { \__tikzspath_set_bool:Nn \l__tikzspath_weld_bool {#1} \bool_set:Nn \l__tikzspath_weld_bool {! \l__tikzspath_weld_bool} }, no~ weld/.default = true, move/.code = { \__tikzspath_set_bool:Nn \l__tikzspath_move_bool {#1} }, move/.default = true, no~ move/.code = { \__tikzspath_set_bool:Nn \l__tikzspath_move_bool {#1} \bool_set:Nn \l__tikzspath_move_bool {! \l__tikzspath_move_bool} }, no~ move/.default = true, global/.code = { \__tikzspath_set_bool:Nn \l__tikzspath_global_bool {#1} }, global/.default = true, use~ current~ transformation/.code={ \__tikzspath_set_bool:Nn \l__tikzspath_current_transformation_bool {#1} }, use~ current~ transformation/.default = true, transform/.store~in=\l__tikzspath_transformation_tl, .unknown/.code = { \tl_set_eq:NN \l__tikzspath_joinpath_tl \pgfkeyscurrentname } } \cs_set_eq:NN \getComponentOf \clist_item:Nn \cs_new_protected_nopar:Npn \__tikzspath_use_path:n #1 { \tl_set:Nn \l__tikzspath_joinpath_tl {#1} \spath_get_current_path:N \l__tikzspath_current_tl \bool_if:NT \l__tikzspath_reverse_bool { \spath_reverse:N \l__tikzspath_joinpath_tl } \bool_if:NT \l__tikzspath_current_transformation_bool { \pgfgettransform \l__tikzspath_tmpa_tl \spath_transform:NV \l__tikzspath_joinpath_tl \l__tikzspath_tmpa_tl } \tl_if_empty:NF \l__tikzspath_transformation_tl { \group_begin: \pgftransformreset \__tikzspath_tikzset:V \l__tikzspath_transformation_tl \pgfgettransform \l__tikzspath_tmpa_tl \tl_gset:Nn \g__tikzspath_smuggle_tl { \spath_transform:Nnnnnnn \l__tikzspath_joinpath_tl } \tl_gput_right:NV \g__tikzspath_smuggle_tl \l__tikzspath_tmpa_tl \group_end: \tl_use:N \g__tikzspath_smuggle_tl } \bool_if:NT \l__tikzspath_move_bool { \tl_if_empty:NTF \l__tikzspath_current_tl { \tl_set:Nn \l__tikzspath_tmpc_tl { {0pt} {0pt} } } { \spath_finalpoint:NV \l__tikzspath_tmpc_tl \l__tikzspath_current_tl } \spath_translate_to:NV \l__tikzspath_joinpath_tl \l__tikzspath_tmpc_tl } \tl_if_empty:NTF \l__tikzspath_current_tl { \tl_if_empty:NTF \l__tikzspath_joinpath_tl { \tl_set_eq:NN \l__tikzspath_current_tl \c_spath_moveto_tl \tl_put_right:Nn \l__tikzspath_current_tl {{0pt}{0pt}} } { \tl_set_eq:NN \l__tikzspath_current_tl \l__tikzspath_joinpath_tl } } { \tl_clear:N \l__tikzspath_tmpa_tl \tl_set:Nn \l__tikzspath_tmpa_tl {spath_} \tl_put_right:Nn \l__tikzspath_tmpa_tl {append} \bool_if:NT \l__tikzspath_weld_bool { \tl_put_right:Nn \l__tikzspath_tmpa_tl {_no_move} \spath_numberofcomponents:NV \l__tikzspath_tmpa_int \l__tikzspath_joinpath_tl \int_compare:nT {\l__tikzspath_tmpa_int == 1} { \bool_set_false:N \l_spath_movetorelevant_bool } } \tl_put_right:Nn \l__tikzspath_tmpa_tl {:NV} \use:c {\tl_use:N \l__tikzspath_tmpa_tl } \l__tikzspath_current_tl \l__tikzspath_joinpath_tl } \spath_set_current_path:N \l__tikzspath_current_tl \spath_set_tikz_data:V \l__tikzspath_joinpath_tl } \cs_generate_variant:Nn \__tikzspath_use_path:n {V, v} \cs_new_protected_nopar:Npn \__tikzspath_join_with:Nn #1#2 { \tl_set:Nn \l__tikzspath_joinpath_tl {#2} \bool_if:NT \l__tikzspath_reverse_bool { \spath_reverse:N \l__tikzspath_joinpath_tl } \tl_if_empty:NF \l__tikzspath_transformation_tl { \group_begin: \pgftransformreset \__tikzspath_tikzset:V \l__tikzspath_transformation_tl \pgfgettransform \l__tikzspath_tmpa_tl \tl_gset:Nn \g__tikzspath_smuggle_tl { \spath_transform:Nnnnnnn \l__tikzspath_joinpath_tl } \tl_gput_right:NV \g__tikzspath_smuggle_tl \l__tikzspath_tmpa_tl \group_end: \tl_use:N \g__tikzspath_smuggle_tl } \bool_if:NT \l__tikzspath_move_bool { \spath_finalpoint:NV \l__tikzspath_tmpc_tl #1 \spath_translate_to:NV \l__tikzspath_joinpath_tl \l__tikzspath_tmpc_tl } \tl_clear:N \l__tikzspath_tmpa_tl \tl_set:Nn \l__tikzspath_tmpa_tl {spath_} \bool_if:NT \l__tikzspath_global_bool { \tl_put_right:Nn \l__tikzspath_tmpa_tl {g} } \tl_put_right:Nn \l__tikzspath_tmpa_tl {append} \bool_if:NT \l__tikzspath_weld_bool { \tl_put_right:Nn \l__tikzspath_tmpa_tl {_no_move} } \tl_put_right:Nn \l__tikzspath_tmpa_tl {:NV} \cs_if_exist:cF {\tl_use:N \l__tikzspath_tmpa_tl} { \tl_show:N \l__tikzspath_tmpa_tl } \use:c {\tl_use:N \l__tikzspath_tmpa_tl } #1 \l__tikzspath_joinpath_tl } \cs_generate_variant:Nn \__tikzspath_join_with:Nn {cv, cn} \cs_new_protected_nopar:Npn \__tikzspath_join_components_with_aux:nnn #1#2#3 { \group_begin: \tl_set:Nn \l__tikzspath_tmpc_tl {#1} \tl_if_empty:nT {#3} { \spath_spot_weld_components:N \l__tikzspath_tmpc_tl } \spath_numberofcomponents:NV \l__tikzspath_tmpa_int \l__tikzspath_tmpc_tl \__tikzspath_seq_from_foreach:NVn \l__tikzspath_tmpb_seq \l__tikzspath_tmpa_int {#3} \spath_components_to_seq:NV \l__tikzspath_tmpa_seq \l__tikzspath_tmpc_tl \seq_pop_left:NN \l__tikzspath_tmpa_seq \l__tikzspath_tmpa_tl \seq_pop_left:NN \l__tikzspath_tmpb_seq \l__tikzspath_tmpb_tl \seq_map_indexed_inline:Nn \l__tikzspath_tmpa_seq { \int_compare:nTF { ##1 == \l__tikzspath_tmpb_tl } { \seq_pop_left:NNF \l__tikzspath_tmpb_seq \l__tikzspath_tmpb_tl { \tl_set:Nn \l__tikzspath_tmpb_tl {-1} } \spath_splice_between:Nnn \l__tikzspath_tmpa_tl {#2} {##2} } { \tl_put_right:Nn \l__tikzspath_tmpa_tl {##2} } } \tl_gset_eq:NN \g__tikzspath_output_tl \l__tikzspath_tmpa_tl \group_end: } \cs_new_protected_nopar:Npn \__tikzspath_join_components_with:Nnnn #1#2#3#4 { \__tikzspath_join_components_with_aux:nnn {#2}{#3}{#4} \tl_set_eq:NN #1 \g__tikzspath_output_tl \tl_gclear:N \g__tikzspath_output_tl } \cs_generate_variant:Nn \__tikzspath_join_components_with:Nnnn {NVnn} \cs_new_protected_nopar:Npn \__tikzspath_join_components_with:Nnn #1#2#3 { \__tikzspath_join_components_with:NVnn #1#1{#2}{#3} } \cs_generate_variant:Nn \__tikzspath_join_components_with:Nnn {cvV} \cs_new_protected_nopar:Npn \__tikzspath_gjoin_components_with:Nnnn #1#2#3#4 { \__tikzspath_join_components_with_aux:nnn {#2}{#3}{#4} \tl_gset_eq:NN #1 \g__tikzspath_output_tl \tl_gclear:N \g__tikzspath_output_tl } \cs_generate_variant:Nn \__tikzspath_gjoin_components_with:Nnnn {NVnn} \cs_new_protected_nopar:Npn \__tikzspath_gjoin_components_with:Nnn #1#2#3 { \__tikzspath_gjoin_components_with:NVnn #1#1{#2}{#3} } \cs_generate_variant:Nn \__tikzspath_gjoin_components_with:Nnn {cvV} \cs_new_protected_nopar:Npn \__tikzspath_join_components_upright_with_aux:nnn #1#2#3 { \group_begin: \tl_set:Nn \l__tikzspath_tmpc_tl {#1} \tl_if_empty:nT {#3} { \spath_spot_weld_components:N \l__tikzspath_tmpc_tl } \spath_numberofcomponents:NV \l__tikzspath_tmpa_int \l__tikzspath_tmpc_tl \__tikzspath_seq_from_foreach:NVn \l__tikzspath_tmpb_seq \l__tikzspath_tmpa_int {#3} \spath_components_to_seq:NV \l__tikzspath_tmpa_seq \l__tikzspath_tmpc_tl \seq_pop_left:NN \l__tikzspath_tmpa_seq \l__tikzspath_tmpa_tl \seq_pop_left:NN \l__tikzspath_tmpb_seq \l__tikzspath_tmpb_tl \tl_set:Nn \l__tikzspath_tmpc_tl {#2} \spath_transform:NVnnnnnn \l__tikzspath_tmpd_tl \l__tikzspath_tmpc_tl {1}{0}{0}{-1}{0pt}{0pt} \seq_map_indexed_inline:Nn \l__tikzspath_tmpa_seq { \int_compare:nTF { ##1 == \l__tikzspath_tmpb_tl } { \seq_pop_left:NNF \l__tikzspath_tmpb_seq \l__tikzspath_tmpb_tl { \tl_set:Nn \l__tikzspath_tmpb_tl {-1} } \spath_finalpoint:NV \l__tikzspath_tmpe_tl \l__tikzspath_tmpa_tl \spath_initialpoint:Nn \l__tikzspath_tmpf_tl {##2} \dim_compare:nTF { \tl_item:Nn \l__tikzspath_tmpe_tl {1} > \tl_item:Nn \l__tikzspath_tmpf_tl {1} } { \spath_splice_between:NVn \l__tikzspath_tmpa_tl \l__tikzspath_tmpd_tl {##2} } { \spath_splice_between:NVn \l__tikzspath_tmpa_tl \l__tikzspath_tmpc_tl {##2} } } { \tl_put_right:Nn \l__tikzspath_tmpa_tl {##2} } } \tl_gset_eq:NN \g__tikzspath_output_tl \l__tikzspath_tmpa_tl \group_end: } \cs_new_protected_nopar:Npn \__tikzspath_join_components_upright_with:Nnnn #1#2#3#4 { \__tikzspath_join_components_upright_with_aux:nnn {#2}{#3}{#4} \tl_set_eq:NN #1 \g__tikzspath_output_tl \tl_gclear:N \g__tikzspath_output_tl } \cs_generate_variant:Nn \__tikzspath_join_components_upright_with:Nnnn {NVnn} \cs_new_protected_nopar:Npn \__tikzspath_join_components_upright_with:Nnn #1#2#3 { \__tikzspath_join_components_upright_with:NVnn #1#1{#2}{#3} } \cs_generate_variant:Nn \__tikzspath_join_components_upright_with:Nnn {cvV} \cs_new_protected_nopar:Npn \__tikzspath_gjoin_components_upright_with:Nnnn #1#2#3#4 { \__tikzspath_join_components_upright_with_aux:nnn {#2}{#3}{#4} \tl_gset_eq:NN #1 \g__tikzspath_output_tl \tl_gclear:N \g__tikzspath_output_tl } \cs_generate_variant:Nn \__tikzspath_gjoin_components_upright_with:Nnnn {NVnn} \cs_new_protected_nopar:Npn \__tikzspath_gjoin_components_upright_with:Nnn #1#2#3 { \__tikzspath_gjoin_components_upright_with:NVnn #1#1{#2}{#3} } \cs_generate_variant:Nn \__tikzspath_gjoin_components_upright_with:Nnn {cvV} \cs_new_protected_nopar:Npn \__tikzspath_get_components_aux:n #1 { \clist_gclear_new:N \g__tikzspath_output_clist \spath_components_to_seq:Nn \l__tikzspath_tmpa_seq {#1} \seq_map_inline:Nn \l__tikzspath_tmpa_seq { \spath_anonymous:N \l__tikzspath_tmpa_tl \tl_new:c {\__tikzspath_path_name:V \l__tikzspath_tmpa_tl} \tl_set:cn {\__tikzspath_path_name:V \l__tikzspath_tmpa_tl} {##1} \clist_gput_right:NV \g__tikzspath_output_clist \l__tikzspath_tmpa_tl } } \cs_new_protected_nopar:Npn \__tikzspath_get_components:Nn #1#2 { \clist_clear_new:N #1 \__tikzspath_get_components_aux:n {#2} \clist_set_eq:NN #1 \g__tikzspath_output_clist \clist_gclear:N \g__tikzspath_output_clist } \cs_generate_variant:Nn \__tikzspath_get_components:Nn {NV, Nv} \cs_new_protected_nopar:Npn \__tikzspath_gget_components:Nn #1#2 { \clist_gclear_new:N #1 \__tikzspath_get_components_aux:n {#2} \clist_gset_eq:NN #1 \g__tikzspath_output_clist \clist_gclear:N \g__tikzspath_output_clist } \cs_generate_variant:Nn \__tikzspath_gget_components:Nn {NV, Nv} \cs_new_protected_nopar:Npn \__tikzspath_render_components:nn #1#2 { \group_begin: \spath_components_to_seq:Nn \l__tikzspath_tmpa_seq {#2} \seq_map_indexed_inline:Nn \l__tikzspath_tmpa_seq { \spath_tikz_path:nn { every~ spath~ component/.try, spath ~component~ ##1/.try, spath ~component/.try={##1}, every~ #1~ component/.try, #1 ~component~ ##1/.try, #1 ~component/.try={##1}, } { ##2 } } \group_end: } \cs_generate_variant:Nn \__tikzspath_render_components:nn {nv} \cs_new_protected_nopar:Npn \__tikzspath_insert_gaps_after_components_aux:nnn #1#2#3 { \group_begin: \spath_numberofcomponents:Nn \l__tikzspath_tmpa_int {#1} \__tikzspath_seq_from_foreach:NVn \l__tikzspath_tmpa_seq \l__tikzspath_tmpa_int {#3} \tl_if_empty:nT {#3} { \seq_pop_right:NN \l__tikzspath_tmpa_seq \l__tikzspath_tmpa_tl } \seq_clear:N \l__tikzspath_tmpb_seq \seq_map_inline:Nn \l__tikzspath_tmpa_seq { \seq_put_right:Nx \l__tikzspath_tmpb_seq {\int_eval:n { \int_mod:nn { ##1 }{ \l__tikzspath_tmpa_int } + 1 } } } \spath_components_to_seq:Nn \l__tikzspath_tmpc_seq {#1} \seq_clear:N \l__tikzspath_tmpd_seq \seq_map_indexed_inline:Nn \l__tikzspath_tmpc_seq { \tl_set:Nn \l__tikzspath_tmpa_tl {##2} \seq_if_in:NnT \l__tikzspath_tmpa_seq {##1} { \spath_shorten_at_end:Nn \l__tikzspath_tmpa_tl {(#2)/2} } \seq_if_in:NnT \l__tikzspath_tmpb_seq {##1} { \spath_shorten_at_start:Nn \l__tikzspath_tmpa_tl {(#2)/2} } \seq_put_right:NV \l__tikzspath_tmpd_seq \l__tikzspath_tmpa_tl } \tl_gset:Nx \g__tikzspath_output_tl {\seq_use:Nn \l__tikzspath_tmpd_seq {} } \group_end: } \cs_new_protected_nopar:Npn \__tikzspath_insert_gaps_after_components:Nnnn #1#2#3#4 { \__tikzspath_insert_gaps_after_components_aux:nnn {#2}{#3}{#4} \tl_set_eq:NN #1 \g__tikzspath_output_tl \tl_gclear:N \g__tikzspath_output_tl } \cs_generate_variant:Nn \__tikzspath_insert_gaps_after_components:Nnnn {NVnn} \cs_new_protected_nopar:Npn \__tikzspath_insert_gaps_after_components:Nnn #1#2#3 { \__tikzspath_insert_gaps_after_components:NVnn #1#1{#2}{#3} } \cs_generate_variant:Nn \__tikzspath_insert_gaps_after_components:Nnn {cnn, cVV} \cs_new_protected_nopar:Npn \__tikzspath_ginsert_gaps_after_components:Nnnn #1#2#3#4 { \__tikzspath_insert_gaps_after_components_aux:nnn {#2}{#3}{#4} \tl_gset_eq:NN #1 \g__tikzspath_output_tl \tl_gclear:N \g__tikzspath_output_tl } \cs_generate_variant:Nn \__tikzspath_ginsert_gaps_after_components:Nnnn {NVnn} \cs_new_protected_nopar:Npn \__tikzspath_ginsert_gaps_after_components:Nnn #1#2#3 { \__tikzspath_ginsert_gaps_after_components:NVnn #1#1{#2}{#3} } \cs_generate_variant:Nn \__tikzspath_ginsert_gaps_after_components:Nnn {cnn, cVV} \cs_new_protected_nopar:Npn \__tikzspath_insert_gaps_after_segments_aux:nnn #1#2#3 { \group_begin: \spath_reallength:Nn \l__tikzspath_tmpa_int {#1} \__tikzspath_seq_from_foreach:NVn \l__tikzspath_tmpa_seq \l__tikzspath_tmpa_int {#3} \tl_if_empty:nT {#3} { \seq_pop_right:NN \l__tikzspath_tmpb_seq \l__tikzspath_tmpa_tl } \seq_clear:N \l__tikzspath_tmpb_seq \seq_map_inline:Nn \l__tikzspath_tmpa_seq { \seq_put_right:Nx \l__tikzspath_tmpb_seq {\int_eval:n { \int_mod:nn { ##1 }{ \l__tikzspath_tmpa_int } + 1 } } } \spath_segments_to_seq:Nn \l__tikzspath_tmpc_seq {#1} \seq_clear:N \l__tikzspath_tmpd_seq \seq_map_indexed_inline:Nn \l__tikzspath_tmpc_seq { \tl_set:Nn \l__tikzspath_tmpa_tl {##2} \seq_if_in:NnT \l__tikzspath_tmpa_seq {##1} { \spath_shorten_at_end:Nn \l__tikzspath_tmpa_tl {(#2)/2} } \seq_if_in:NnT \l__tikzspath_tmpb_seq {##1} { \spath_shorten_at_start:Nn \l__tikzspath_tmpa_tl {(#2)/2} } \seq_put_right:NV \l__tikzspath_tmpd_seq \l__tikzspath_tmpa_tl } \tl_gset:Nx \g__tikzspath_output_tl {\seq_use:Nn \l__tikzspath_tmpd_seq {} } \group_end: } \cs_new_protected_nopar:Npn \__tikzspath_insert_gaps_after_segments:Nnnn #1#2#3#4 { \__tikzspath_insert_gaps_after_segments_aux:nnn {#2}{#3}{#4} \tl_set_eq:NN #1 \g__tikzspath_output_tl \tl_gclear:N \g__tikzspath_output_tl } \cs_generate_variant:Nn \__tikzspath_insert_gaps_after_segments:Nnnn {NVnn} \cs_new_protected_nopar:Npn \__tikzspath_insert_gaps_after_segments:Nnn #1#2#3 { \__tikzspath_insert_gaps_after_segments:NVnn #1#1{#2}{#3} } \cs_generate_variant:Nn \__tikzspath_insert_gaps_after_segments:Nnn {cnn, cVV} \cs_new_protected_nopar:Npn \__tikzspath_ginsert_gaps_after_segments:Nnnn #1#2#3#4 { \__tikzspath_insert_gaps_after_segments_aux:nnn {#2}{#3}{#4} \tl_gset_eq:NN #1 \g__tikzspath_output_tl \tl_gclear:N \g__tikzspath_output_tl } \cs_generate_variant:Nn \__tikzspath_ginsert_gaps_after_segments:Nnnn {NVnn} \cs_new_protected_nopar:Npn \__tikzspath_ginsert_gaps_after_segments:Nnn #1#2#3 { \__tikzspath_ginsert_gaps_after_segments:NVnn #1#1{#2}{#3} } \cs_generate_variant:Nn \__tikzspath_ginsert_gaps_after_segments:Nnn {cnn, cVV} \cs_new_protected_nopar:Npn \__tikzspath_join_components_aux:nn #1#2 { \group_begin: \tl_set:Nn \l__tikzspath_tmpa_tl {#1} \spath_numberofcomponents:NV \l__tikzspath_tmpa_int \l__tikzspath_tmpa_tl \__tikzspath_seq_from_foreach:NVn \l__tikzspath_tmpa_seq \l__tikzspath_tmpa_int {#2} \seq_reverse:N \l__tikzspath_tmpa_seq \seq_map_inline:Nn \l__tikzspath_tmpa_seq { \spath_join_component:Nn \l__tikzspath_tmpa_tl {##1} } \tl_gset_eq:NN \g__tikzspath_output_tl \l__tikzspath_tmpa_tl \group_end: } \cs_new_protected_nopar:Npn \__tikzspath_join_components:Nnn #1#2#3 { \__tikzspath_join_components_aux:nn {#2}{#3} \tl_set_eq:NN #1 \g__tikzspath_output_tl \tl_gclear:N \g__tikzspath_output_tl } \cs_generate_variant:Nn \__tikzspath_join_components:Nnn {NVn} \cs_new_protected_nopar:Npn \__tikzspath_join_components:Nn #1#2 { \__tikzspath_join_components:NVn #1#1{#2} } \cs_generate_variant:Nn \__tikzspath_join_components:Nn {cn} \cs_new_protected_nopar:Npn \__tikzspath_gjoin_components:Nnn #1#2#3 { \__tikzspath_join_components_aux:nn {#2}{#3} \tl_gset_eq:NN #1 \g__tikzspath_output_tl \tl_gclear:N \g__tikzspath_output_tl } \cs_generate_variant:Nn \__tikzspath_gjoin_components:Nnn {NVn} \cs_new_protected_nopar:Npn \__tikzspath_gjoin_components:Nn #1#2 { \__tikzspath_gjoin_components:NVn #1#1{#2} } \cs_generate_variant:Nn \__tikzspath_gjoin_components:Nn {cn} \cs_new_protected_nopar:Npn \__tikzspath_join_components_with_bezier_aux:nn #1#2 { \group_begin: \tl_set:Nn \l__tikzspath_tmpc_tl {#1} \tl_if_empty:nT {#2} { \spath_spot_weld_components:N \l__tikzspath_tmpc_tl } \spath_numberofcomponents:NV \l__tikzspath_tmpa_int \l__tikzspath_tmpc_tl \__tikzspath_seq_from_foreach:NVn \l__tikzspath_tmpb_seq \l__tikzspath_tmpa_int {#2} \spath_components_to_seq:NV \l__tikzspath_tmpa_seq \l__tikzspath_tmpc_tl \seq_pop_left:NN \l__tikzspath_tmpa_seq \l__tikzspath_tmpa_tl \seq_pop_left:NN \l__tikzspath_tmpb_seq \l__tikzspath_tmpb_tl \seq_map_indexed_inline:Nn \l__tikzspath_tmpa_seq { \int_compare:nTF { ##1 == \l__tikzspath_tmpb_tl } { \seq_pop_left:NNF \l__tikzspath_tmpb_seq \l__tikzspath_tmpb_tl { \tl_set:Nn \l__tikzspath_tmpb_tl {-1} } \spath_curve_between:Nn \l__tikzspath_tmpa_tl {##2} } { \tl_put_right:Nn \l__tikzspath_tmpa_tl {##2} } } \tl_gset_eq:NN \g__tikzspath_output_tl \l__tikzspath_tmpa_tl \group_end: } \cs_new_protected_nopar:Npn \__tikzspath_join_components_with_bezier:Nnn #1#2#3 { \__tikzspath_join_components_with_bezier_aux:nn {#2}{#3} \tl_set_eq:NN #1 \g__tikzspath_output_tl \tl_gclear:N \g__tikzspath_output_tl } \cs_generate_variant:Nn \__tikzspath_join_components_with_bezier:Nnn {NVn} \cs_new_protected_nopar:Npn \__tikzspath_join_components_with_bezier:Nn #1#2 { \__tikzspath_join_components_with_bezier:NVn #1#1{#2} } \cs_generate_variant:Nn \__tikzspath_join_components_with_bezier:Nn {cV} \cs_new_protected_nopar:Npn \__tikzspath_gjoin_components_with_bezier:Nnn #1#2#3 { \__tikzspath_join_components_with_bezier_aux:nn {#2}{#3} \tl_gset_eq:NN #1 \g__tikzspath_output_tl \tl_gclear:N \g__tikzspath_output_tl } \cs_generate_variant:Nn \__tikzspath_gjoin_components_with_bezier:Nnn {NVn} \cs_new_protected_nopar:Npn \__tikzspath_gjoin_components_with_bezier:Nn #1#2 { \__tikzspath_gjoin_components_with_bezier:NVn #1#1{#2} } \cs_generate_variant:Nn \__tikzspath_gjoin_components_with_bezier:Nn {cV} \cs_new_protected_nopar:Npn \__tikzspath_remove_components_aux:nn #1#2 { \group_begin: \spath_numberofcomponents:Nn \l__tikzspath_tmpa_int {#1} \__tikzspath_seq_from_foreach:NVn \l__tikzspath_tmpa_seq \l__tikzspath_tmpa_int {#2} \spath_components_to_seq:Nn \l__tikzspath_tmpb_seq {#1} \seq_pop_left:NNF \l__tikzspath_tmpa_seq \l__tikzspath_tmpa_tl { \tl_clear:N \l__tikzspath_tmpa_tl } \seq_clear:N \l__tikzspath_tmpc_seq \seq_map_indexed_inline:Nn \l__tikzspath_tmpb_seq { \tl_set:Nn \l__tikzspath_tmpb_tl {##1} \tl_if_eq:NNTF \l__tikzspath_tmpb_tl \l__tikzspath_tmpa_tl { \seq_pop_left:NNF \l__tikzspath_tmpa_seq \l__tikzspath_tmpa_tl { \tl_clear:N \l__tikzspath_tmpa_tl } } { \seq_put_right:Nn \l__tikzspath_tmpc_seq {##2} } } \tl_gset:Nx \g__tikzspath_output_tl {\seq_use:Nn \l__tikzspath_tmpc_seq {} } \group_end: } \cs_new_protected_nopar:Npn \__tikzspath_remove_components:Nnn #1#2#3 { \__tikzspath_remove_components_aux:nn {#2}{#3} \tl_set_eq:NN #1 \g__tikzspath_output_tl \tl_gclear:N \g__tikzspath_output_tl } \cs_generate_variant:Nn \__tikzspath_remove_components:Nnn {NVn} \cs_new_protected_nopar:Npn \__tikzspath_remove_components:Nn #1#2 { \__tikzspath_remove_components:NVn #1#1{#2} } \cs_generate_variant:Nn \__tikzspath_remove_components:Nn {cn} \cs_new_protected_nopar:Npn \__tikzspath_gremove_components:Nnn #1#2#3 { \__tikzspath_remove_components_aux:nn {#2}{#3} \tl_gset_eq:NN #1 \g__tikzspath_output_tl \tl_gclear:N \g__tikzspath_output_tl } \cs_generate_variant:Nn \__tikzspath_gremove_components:Nnn {NVn} \cs_new_protected_nopar:Npn \__tikzspath_gremove_components:Nn #1#2 { \__tikzspath_gremove_components:NVn #1#1{#2} } \cs_generate_variant:Nn \__tikzspath_gremove_components:Nn {cn} \cs_new_protected_nopar:Npn \__tikzspath_transform_to_aux:nn #1#2 { \group_begin: \spath_reallength:Nn \l__tikzspath_tmpa_int {#2} \tl_set:Nx \l__tikzspath_tmpb_tl {\fp_to_decimal:n {(#1) * (\l__tikzspath_tmpa_int)}} \spath_transformation_at:NnV \l__tikzspath_tmpc_tl {#2} \l__tikzspath_tmpb_tl \tl_gset_eq:NN \g__tikzspath_output_tl \l__tikzspath_tmpc_tl \group_end: } \cs_new_protected_nopar:Npn \__tikzspath_transform_to:nn #1#2 { \__tikzspath_transform_to_aux:nn {#1}{#2} \exp_last_unbraced:NV \pgfsettransformentries \g__tikzspath_output_tl \tl_gclear:N \g__tikzspath_output_tl } \cs_generate_variant:Nn \__tikzspath_transform_to:nn {nv} \cs_new_protected_nopar:Npn \__tikzspath_transform_upright_to:nn #1#2 { \__tikzspath_transform_to_aux:nn {#1}{#2} \fp_compare:nT { \tl_item:Nn \g__tikzspath_output_tl {4} < 0} { \tl_gset:Nx \g__tikzspath_output_tl { { \fp_eval:n { - (\tl_item:Nn \g__tikzspath_output_tl {1})} } { \fp_eval:n { - (\tl_item:Nn \g__tikzspath_output_tl {2})} } { \fp_eval:n { - (\tl_item:Nn \g__tikzspath_output_tl {3})} } { \fp_eval:n { - (\tl_item:Nn \g__tikzspath_output_tl {4})} } { \tl_item:Nn \g__tikzspath_output_tl {5} } { \tl_item:Nn \g__tikzspath_output_tl {6} } } } \exp_last_unbraced:NV \pgfsettransformentries \g__tikzspath_output_tl \tl_gclear:N \g__tikzspath_output_tl } \cs_generate_variant:Nn \__tikzspath_transform_upright_to:nn {nv} \tikzset{ spath/.is~family, spath/.cd, set~ prefix/.store~ in=\l__tikzspath_prefix_tl, prefix/.is~choice, prefix/default/.style={ /tikz/spath/set~ prefix=tikz@intersect@path@name@ }, set~ suffix/.store~ in=\l__tikzspath_suffix_tl, suffix/.is~choice, suffix/default/.style={ /tikz/spath/set~ suffix={} }, set~ name/.style={ /tikz/spath/prefix=#1, /tikz/spath/suffix=#1 }, at~ end~ path~ construction/.code={ \tl_put_right:Nn \l__tikzspath_tikzpath_finish_tl {#1} }, save/.code={ \tikz@addmode{ \spath_get_current_path:N \l__tikzspath_tmpa_tl \spath_bake_round:NV \l__tikzspath_tmpa_tl \l__tikzspath_tmpa_tl \spath_bake_shorten:NV \l__tikzspath_tmpa_tl \l__tikzspath_tmpa_tl \spath_save_path:cV {\__tikzspath_path_name:n {#1}} \l__tikzspath_tmpa_tl } }, save~ global/.code={ \tikz@addmode{ \spath_get_current_path:N \l__tikzspath_tmpa_tl \spath_bake_round:NV \l__tikzspath_tmpa_tl \l__tikzspath_tmpa_tl \spath_bake_shorten:NV \l__tikzspath_tmpa_tl \l__tikzspath_tmpa_tl \spath_gsave_path:cV {\__tikzspath_path_name:n {#1}} \l__tikzspath_tmpa_tl } }, clone/.code~ 2~ args={ \__tikzspath_maybe_current_path:nn { \__tikzspath_check_path:nnn { \tl_clear_new:c {\__tikzspath_path_name:n {#1}} \tl_set_eq:cc {\__tikzspath_path_name:n {#1}} } } {#2}{} }, clone~ global/.code~ 2~ args={ \__tikzspath_maybe_current_path:nn { \__tikzspath_check_path:nnn { \tl_gclear_new:c {\__tikzspath_path_name:n {#1}} \tl_gset_eq:cc {\__tikzspath_path_name:n {#1}} } } {#2}{} }, save~ to~ aux/.code={ \__tikzspath_maybe_current_path:nn { \__tikzspath_check_path:nnn { \spath_save_to_aux:c } } {#1} {} }, export~ to~ svg/.code={ \__tikzspath_maybe_current_path:nn { \__tikzspath_check_path:nnn { \spath_export_to_svg:nv {#1} } } {#1} {} }, use/.code={ \bool_set_false:N \l__tikzspath_reverse_bool \bool_set_false:N \l__tikzspath_weld_bool \bool_set_false:N \l__tikzspath_move_bool \bool_set_false:N \l__tikzspath_current_transformation_bool \bool_set_true:N \l_spath_movetorelevant_bool \tl_clear:N \l__tikzspath_joinpath_tl \tl_clear:N \l__tikzspath_transformation_tl \tikzset{ spath/join/.cd, #1 } \__tikzspath_check_path:nVn { \__tikzspath_use_path:v } \l__tikzspath_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__tikzspath_tmpa_tl \iow_term:n {---~ current~ soft~ path~ ---} \spath_show:V \l__tikzspath_tmpa_tl } }, show/.code={ \__tikzspath_check_path:nnn { \iow_term:n {---~ soft~ path~ #1~ ---} \spath_show:v } {#1} {} }, join~ with/.code~ 2~ args={ \bool_set_false:N \l__tikzspath_reverse_bool \bool_set_false:N \l__tikzspath_weld_bool \bool_set_false:N \l__tikzspath_move_bool \bool_set_false:N \l__tikzspath_global_bool \bool_set_false:N \l__tikzspath_current_transformation_bool \tl_clear:N \l__tikzspath_joinpath_tl \tl_clear:N \l__tikzspath_transformation_tl \tikzset{ spath/join/.cd, #2 } \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_two_paths:nnVn { \__tikzspath_join_with:cv } } {#1} { \l__tikzspath_joinpath_tl {} } }, spot~ weld/.code={ \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_path:nnn { \spath_spot_weld_components:c } } {#1} { {} } }, spot~ weld~ globally/.code={ \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_path:nnn { \spath_spot_gweld_components:c } } {#1} { {} } }, reverse/.code={ \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_path:nnn { \spath_reverse:c } } {#1} { {} } }, reverse~ globally/.code={ \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_path:nnn { \spath_greverse:c } } {#1} { {} } }, span/.code ~n~ args={3}{ \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_path:nnn { \__tikzspath_process_tikz_point:Nn \l__tikzspath_tmpa_tl {#2} \__tikzspath_process_tikz_point:Nn \l__tikzspath_tmpb_tl {#3} \spath_span:cVV } } {#1} { {} \l__tikzspath_tmpa_tl \l__tikzspath_tmpb_tl } }, span~ global/.code ~n~ args={3}{ \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_path:nnn { \__tikzspath_process_tikz_point:Nn \l__tikzspath_tmpa_tl {#2} \__tikzspath_process_tikz_point:Nn \l__tikzspath_tmpb_tl {#3} \spath_span:cVV } } {#1} { {} \l__tikzspath_tmpa_tl \l__tikzspath_tmpb_tl } }, to/.style={ to~path={ [ spath/span={#1}{(\tikztostart)}{(\tikztotarget)}, spath/use={#1,weld}, ] \tikztonodes } }, splice/.code ~n~ args={3}{ \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_three_paths:nnnnn { \spath_splice_between:cvv } } {#1} { {#2} {#3} {} } }, splice~ global/.code ~n~ args={3}{ \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_three_paths:nnnnn { \spath_gsplice_between:cvv } } {#1} { {#2} {#3} {} } }, join~ components~ with/.code~2~args={ \tl_if_head_is_group:nTF {#2} { \tl_set:Nx \l__tikzspath_tmpc_tl { \tl_item:nn {#2} {1} } \tl_set:Nx \l__tikzspath_tmpd_tl { \tl_item:nn {#2} {2} } } { \tl_set:Nn \l__tikzspath_tmpc_tl {#2} \tl_clear:N \l__tikzspath_tmpd_tl } \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_two_paths:nnVn { \__tikzspath_join_components_with:cvV } } {#1} { \l__tikzspath_tmpc_tl {} \l__tikzspath_tmpd_tl } }, join~ components~ globally~ with/.code~2~args={ \tl_if_head_is_group:nTF {#2} { \tl_set:Nx \l__tikzspath_tmpc_tl { \tl_item:nn {#2} {1} } \tl_set:Nx \l__tikzspath_tmpd_tl { \tl_item:nn {#2} {2} } } { \tl_set:Nn \l__tikzspath_tmpc_tl {#2} \tl_clear:N \l__tikzspath_tmpd_tl } \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_two_paths:nnVn { \__tikzspath_gjoin_components_with:cvV } } {#1} { \l__tikzspath_tmpc_tl {} \l__tikzspath_tmpd_tl } }, join~ components~ upright~ with/.code~2~args={ \tl_if_head_is_group:nTF {#2} { \tl_set:Nx \l__tikzspath_tmpc_tl { \tl_item:nn {#2} {1} } \tl_set:Nx \l__tikzspath_tmpd_tl { \tl_item:nn {#2} {2} } } { \tl_set:Nn \l__tikzspath_tmpc_tl {#2} \tl_clear:N \l__tikzspath_tmpd_tl } \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_two_paths:nnVn { \__tikzspath_join_components_upright_with:cvV } } {#1} { \l__tikzspath_tmpc_tl {} \l__tikzspath_tmpd_tl } }, join~ components~ globally~ upright~ with/.code~2~args={ \tl_if_head_is_group:nTF {#2} { \tl_set:Nx \l__tikzspath_tmpc_tl { \tl_item:nn {#2} {1} } \tl_set:Nx \l__tikzspath_tmpd_tl { \tl_item:nn {#2} {2} } } { \tl_set:Nn \l__tikzspath_tmpc_tl {#2} \tl_clear:N \l__tikzspath_tmpd_tl } \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_two_paths:nnVn { \__tikzspath_gjoin_components_upright_with:cvV } } {#1} { \l__tikzspath_tmpc_tl {} \l__tikzspath_tmpd_tl } }, join~ components~ with~ bezier/.code={ \tl_if_head_is_group:nTF {#1} { \tl_set:Nx \l__tikzspath_tmpc_tl { \tl_item:nn {#1} {1} } \tl_set:Nx \l__tikzspath_tmpd_tl { \tl_item:nn {#1} {2} } } { \tl_set:Nn \l__tikzspath_tmpc_tl {#1} \tl_clear:N \l__tikzspath_tmpd_tl } \__tikzspath_maybe_current_path_reuse:nVn { \__tikzspath_check_path:nnn { \__tikzspath_join_components_with_bezier:cV } } \l__tikzspath_tmpc_tl { {} \l__tikzspath_tmpd_tl } }, join~ components~ globally~ with~ bezier/.code~2~args={ \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_path:nnn { \__tikzspath_gjoin_components_with_bezier:cn } } {#1} { {} {#2} } }, close/.code={ \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_path:nnn { \spath_close:c } } {#1} { {} } }, close~ globally/.code={ \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_path:nnn { \spath_gclose:c } } {#1} { {} } }, open/.code={ \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_path:nnn { \spath_open:c } } {#1} { {} } }, open~ globally/.code={ \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_path:nnn { \spath_gopen:c } } {#1} { {} } }, adjust~ and~ close/.code={ \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_path:nnn { \spath_adjust_close:c } } {#1} { {} } }, adjust~ and~ close~ globally/.code={ \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_path:nnn { \spath_adjust_gclose:c } } {#1} { {} } }, close~ with/.code~ 2~ args={ \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_two_paths:nnnn { \spath_close_with:cv } } {#1} { {#2} {} } }, close~ globally~ with/.code~ 2~ args={ \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_two_paths:nnnn { \spath_gclose_with:cv } } {#1} { {#2} {} } }, close~ with~ curve/.code={ \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_path:nnn { \spath_close_with_curve:c } } {#1} { {} } }, close~ globally~ with~ curve/.code={ \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_path:nnn { \spath_gclose_with_curve:c } } {#1} { {} } }, shorten~ at~ end/.code~ 2~ args={ \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_path:nnn { \spath_shorten_at_end:cn } } {#1} { {} {#2} } }, shorten~ at~ start/.code~ 2~ args ={ \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_path:nnn { \spath_shorten_at_start:cn } } {#1} { {} {#2} } }, shorten~ at~ both~ ends/.code~ 2~ args={ \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_path:nnn { \spath_shorten_at_both_ends:cn } } {#1} { {} {#2} } }, shorten~ globally~ at~ end/.code~ 2~ args={ \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_path:nnn { \spath_gshorten_at_end:cn } } {#1} { {} {#2} } }, shorten~ globally~ at~ start/.code~ 2~ args ={ \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_path:nnn { \spath_gshorten_at_start:cn } } {#1} { {} {#2} } }, shorten~ globally~ at~ both~ ends/.code~ 2~ args={ \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_path:nnn { \spath_gshorten_at_both_ends:cn } } {#1} { {} {#2} } }, split~ at/.code~ 2~ args={ \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_path:nnn { \spath_split_at_normalised:cn } } {#1} { {} {#2} } }, split~ globally~ at/.code~ 2~ args={ \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_path:nnn { \spath_gsplit_at_normalised:cn } } {#1} { {} {#2} } }, split~ at~ into/.code~ n~ args={4}{ \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_path:nnn { \spath_split_at_normalised:ccvn {\__tikzspath_path_name:n {#1}} {\__tikzspath_path_name:n {#2}} } } {#3} { {} {#4} } }, split~ globally~ at~ into/.code~ n~ args={4}{ \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_path:nnn { \spath_gsplit_at_normalised:ccvn {\__tikzspath_path_name:n {#1}} {\__tikzspath_path_name:n {#2}} } } {#3} { {} {#4} } }, split~ at~ keep~ start/.code~ 2~ args={ \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_path:nnn { \spath_split_at_normalised_keep_start:cn } } {#1} { {} {#2} } }, split~ globally~ at~ keep~ start/.code~ 2~ args={ \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_path:nnn { \spath_gsplit_at_normalised_keep_start:cn } } {#1} { {} {#2} } }, split~ at~ keep~ end/.code~ 2~ args={ \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_path:nnn { \spath_split_at_normalised_keep_end:cn } } {#1} { {} {#2} } }, split~ globally~ at~ keep~ end/.code~ 2~ args={ \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_path:nnn { \spath_gsplit_at_normalised_keep_end:cn } } {#1} { {} {#2} } }, split~ at~ keep~ middle/.style~ n~ args={3}{ /tikz/spath/split~ at~ keep~ start={#1}{#3}, /tikz/spath/split~ at~ keep~ end={#1}{(#2)/(#3)}, }, split~ globally~ at~ keep~ middle/.style~ n~ args={3}{ /tikz/spath/split~ globally~ at~ keep~ start={#1}{#3}, /tikz/spath/split~ globally~ at~ keep~ end={#1}{(#2)/(#3)}, }, translate/.code~ n~ args={3}{ \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_path:nnn { \spath_translate:cnn } } {#1} { {} {#2}{#3} } }, translate~ globally/.code~ n~ args={3}{ \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_path:nnn { \spath_gtranslate:cnn } } {#1} { {} {#2}{#3} } }, normalise/.code={ \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_path:nnn { \spath_normalise:c } } {#1} { {} } }, normalise~ globally/.code={ \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_path:nnn { \spath_gnormalise:c } } {#1} { {} } }, transform/.code~ 2~ args={ \group_begin: \pgftransformreset \tikzset{#2} \pgfgettransform \l__tikzspath_tmpa_tl \tl_gset_eq:NN \g__tikzspath_smuggle_tl \l__tikzspath_tmpa_tl \group_end: \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_path:nnn { \spath_transform:cV } } {#1} { {} \g__tikzspath_smuggle_tl } }, transform~globally/.code~ 2~ args={ \group_begin: \pgftransformreset \tikzset{#2} \pgfgettransform \l__tikzspath_tmpa_tl \tl_gset_eq:NN \g__tikzspath_smuggle_tl \l__tikzspath_tmpa_tl \group_end: \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_path:nnn { \spath_gtransform:cV } } {#1} { {} \g__tikzspath_smuggle_tl } }, split~ at~ intersections~ with/.code~ 2~ args={ \tl_if_exist:cTF { tikz@library@intersections@loaded } { \__tikzspath_maybe_current_two_paths_reuse_first:nnnn { \__tikzspath_check_two_paths:nnnn { \spath_split_path_at_intersections:cv } } {#1} {#2} { {} } } { \msg_warning:nn { spath3 } { load intersections } } }, split~ globally~ at~ intersections~ with/.code~ n~ args={2}{ \tl_if_exist:cTF { tikz@library@intersections@loaded } { \__tikzspath_maybe_current_two_paths_reuse_first:nnnn { \__tikzspath_check_two_paths:nnnn { \spath_gsplit_path_at_intersections:cv } } {#1} {#2} { {} } } { \msg_warning:nn { spath3 } { load intersections } } }, split~ at~ intersections/.code~ n~ args={2}{ \tl_if_exist:cTF { tikz@library@intersections@loaded } { \__tikzspath_maybe_current_two_paths_reuse_both:nnnn { \__tikzspath_check_two_paths:nnnn { \spath_split_at_intersections:cc } } {#1} {#2} { {} } } { \msg_warning:nn { spath3 } { load intersections } } }, split~ globally~ at~ intersections/.code~ n~ args={2}{ \tl_if_exist:cTF { tikz@library@intersections@loaded } { \__tikzspath_maybe_current_two_paths_reuse_both:nnnn { \__tikzspath_check_two_paths:nnnn { \spath_gsplit_at_intersections:cc } } {#1} {#2} { {} } } { \msg_warning:nn { spath3 } { load intersections } } }, split~ at~ self~ intersections/.code={ \tl_if_exist:cTF { tikz@library@intersections@loaded } { \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_path:nnn { \spath_split_at_self_intersections:c } } {#1} { {} } } { \msg_warning:nn { spath3 } { load intersections } } }, split~ globally~ at~ self~ intersections/.code={ \tl_if_exist:cTF { tikz@library@intersections@loaded } { \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_path:nnn { \spath_gsplit_at_self_intersections:c } } {#1} { {} } } { \msg_warning:nn { spath3 } { load intersections } } }, get~ components~ of/.code~ 2~ args={ \__tikzspath_maybe_current_path:nn { \__tikzspath_check_path:nnn { \__tikzspath_get_components:Nv #2 } } {#1} {} }, get~ components~ of~ globally/.code~ 2~ args={ \__tikzspath_maybe_current_path:nn { \__tikzspath_check_path:nnn { \__tikzspath_gget_components:Nv #2 } } {#1} {} }, render~ components/.code={ \__tikzspath_maybe_current_path:nn { \__tikzspath_check_path:nnn { \__tikzspath_render_components:nv {#1} } } {#1} {} }, insert~ gaps~ after~ components/.code~ 2~ args={ \tl_if_head_is_group:nTF {#2} { \tl_set:Nx \l__tikzspath_tmpc_tl { \tl_item:nn {#2} {1} } \tl_set:Nx \l__tikzspath_tmpd_tl { \tl_item:nn {#2} {2} } } { \tl_set:Nn \l__tikzspath_tmpc_tl {#2} \tl_clear:N \l__tikzspath_tmpd_tl } \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_path:nnn { \__tikzspath_insert_gaps_after_components:cVV } } {#1} { {} \l__tikzspath_tmpc_tl \l__tikzspath_tmpd_tl } }, insert~ gaps~ globally~ after~ components/.code~ 2~ args={ \tl_if_head_is_group:nTF {#2} { \tl_set:Nx \l__tikzspath_tmpc_tl { \tl_item:nn {#2} {1} } \tl_set:Nx \l__tikzspath_tmpd_tl { \tl_item:nn {#2} {2} } } { \tl_set:Nn \l__tikzspath_tmpc_tl {#2} \tl_clear:N \l__tikzspath_tmpd_tl } \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_path:nnn { \__tikzspath_ginsert_gaps_after_components:cVV } } {#1} { {} \l__tikzspath_tmpc_tl \l__tikzspath_tmpd_tl } }, insert~ gaps~ after~ segments/.code~ 2~ args={ \tl_if_head_is_group:nTF {#2} { \tl_set:Nx \l__tikzspath_tmpc_tl { \tl_item:nn {#2} {1} } \tl_set:Nx \l__tikzspath_tmpd_tl { \tl_item:nn {#2} {2} } } { \tl_set:Nn \l__tikzspath_tmpc_tl {#2} \tl_clear:N \l__tikzspath_tmpd_tl } \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_path:nnn { \__tikzspath_insert_gaps_after_segments:cVV } } {#1} { {} \l__tikzspath_tmpc_tl \l__tikzspath_tmpd_tl } }, insert~ gaps~ globally~ after~ segments/.code~ 2~ args={ \tl_if_head_is_group:nTF {#2} { \tl_set:Nx \l__tikzspath_tmpc_tl { \tl_item:nn {#2} {1} } \tl_set:Nx \l__tikzspath_tmpd_tl { \tl_item:nn {#2} {2} } } { \tl_set:Nn \l__tikzspath_tmpc_tl {#2} \tl_clear:N \l__tikzspath_tmpd_tl } \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_path:nnn { \__tikzspath_ginsert_gaps_after_segments:cVV } } {#1} { {} \l__tikzspath_tmpc_tl \l__tikzspath_tmpd_tl } }, join~ components/.code~ 2~ args={ \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_path:nnn { \__tikzspath_join_components:cn } } {#1} { {} {#2} } }, join~ components~ globally/.code~ 2~ args={ \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_path:nnn { \__tikzspath_gjoin_components:cn } } {#1} { {} {#2} } }, remove~ empty~ components/.code={ \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_path:nnn { \spath_remove_empty_components:c } } {#1} { {} } }, remove~ empty~ components~ globally/.code={ \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_path:nnn { \spath_gremove_empty_components:c } } {#1} { {} } }, replace~ lines/.code={ \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_path:nnn { \spath_replace_lines:c } } {#1} { {} } }, replace~ lines~ globally/.code={ \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_path:nnn { \spath_greplace_lines:c } } {#1} { {} } }, remove~ components/.code~ 2~ args={ \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_path:nnn { \__tikzspath_remove_components:cn } } {#1} { {} {#2} } }, remove~ components~ globally/.code~ 2~ args={ \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_path:nnn { \__tikzspath_gremove_components:cn } } {#1} { {} {#2} } }, draft~ mode/.is~ choice, draft~ mode/true/.code={ \bool_set_true:N \l__tikzspath_draft_bool }, draft~ mode/false/.code={ \bool_set_false:N \l__tikzspath_draft_bool }, maybe~ spot~ weld/.code={ \bool_if:NF \l__tikzspath_draft_bool { \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_path:nnn { \spath_spot_weld_components:c } } {#1} { {} } } }, maybe~ spot~ weld~ globally/.code={ \bool_if:NF \l__tikzspath_draft_bool { \__tikzspath_maybe_current_path_reuse:nnn { \__tikzspath_check_path:nnn { \spath_spot_gweld_components:c } } {#1} { {} } } }, transform~ to/.code~ 2~ args={ \__tikzspath_maybe_current_path:nn { \__tikzspath_check_path:nnn { \__tikzspath_transform_to:nv {#2} } } {#1} { \pgfsettransformentries {1}{0}{0}{1}{0pt}{0pt} } }, upright~ transform~ to/.code~ 2~ args={ \__tikzspath_maybe_current_path:nn { \__tikzspath_check_path:nnn { \__tikzspath_transform_upright_to:nv {#2} } } {#1} { \pgfsettransformentries {1}{0}{0}{1}{0pt}{0pt} } }, knot/.style~ n~ args={3}{ /tikz/spath/split~ at~ self~ intersections=#1, /tikz/spath/remove~ empty~ components=#1, /tikz/spath/insert~ gaps~ after~ components={#1}{#2}{#3}, /tikz/spath/maybe~ spot~ weld=#1, /tikz/spath/render~ components=#1 }, global~ knot/.style~ n~ args={3}{ /tikz/spath/split~ globally~ at~ self~ intersections=#1, /tikz/spath/remove~ empty~ components~ globally=#1, /tikz/spath/insert~ gaps~ globally ~after~ components={#1}{#2}{#3}, /tikz/spath/maybe~ spot~ weld~ globally=#1, /tikz/spath/render~ components=#1 }, show/.default=current, spot~ weld/.default=current, spot~ weld~ globally/.default=current, reverse/.default=current, reverse~ globally/.default=current, close/.default=current, close~ globally/.default=current, open/.default=current, open~ globally/.default=current, adjust~ and~ close/.default=current, adjust~ and~ close~ globally/.default=current, close~ with~ curve/.default=current, close~ globally~ with~ curve/.default=current, remove~ empty~ components/.default=current, remove~ empty~ components~ globally/.default=current, replace~ lines/.default=current, replace~ lines~ globally/.default=current, maybe~ spot~ weld/.default=current, maybe~ spot~ weld~ globally/.default=current, } \cs_new_protected_nopar:Npn \__tikzspath_get_point_at:nn #1#2 { \group_begin: \spath_reallength:Nn \l__tikzspath_tmpa_int {#2} \tl_set:Nx \l__tikzspath_tmpb_tl {\fp_to_decimal:n {(#1) * (\l__tikzspath_tmpa_int)}} \spath_point_at:NnV \l__tikzspath_tmpc_tl {#2} \l__tikzspath_tmpb_tl \tl_clear:N \l__tikzspath_tmpd_tl \tl_put_right:Nn \l__tikzspath_tmpd_tl {\pgf@x=} \tl_put_right:Nx \l__tikzspath_tmpd_tl {\tl_item:Nn \l__tikzspath_tmpc_tl {1}} \tl_put_right:Nn \l__tikzspath_tmpd_tl {\relax} \tl_put_right:Nn \l__tikzspath_tmpd_tl {\pgf@y=} \tl_put_right:Nx \l__tikzspath_tmpd_tl {\tl_item:Nn \l__tikzspath_tmpc_tl {2}} \tl_put_right:Nn \l__tikzspath_tmpd_tl {\relax} \tl_gset_eq:NN \g__tikzspath_output_tl \l__tikzspath_tmpd_tl \group_end: } \cs_generate_variant:Nn \__tikzspath_get_point_at:nn {VV, Vn, Vv} \tikzdeclarecoordinatesystem{spath}{% \group_begin: \tl_set:Nn \l__tikzspath_tmpa_tl {#1} \tl_trim_spaces:N \l__tikzspath_tmpa_tl \seq_set_split:NnV \l__tikzspath_tmpa_seq {~} \l__tikzspath_tmpa_tl \seq_pop_right:NN \l__tikzspath_tmpa_seq \l__tikzspath_tmpb_tl \tl_set:Nx \l__tikzspath_tmpa_tl { \seq_use:Nn \l__tikzspath_tmpa_seq {~} } \__tikzspath_maybe_current_path:nV { \__tikzspath_check_path:nnn { \__tikzspath_get_point_at:Vv \l__tikzspath_tmpb_tl } } \l__tikzspath_tmpa_tl { \tl_gset_eq:NN \g__tikzspath_output_tl \pgfpointorigin } \group_end: \use:c {pgf@process}{% \tl_use:N \g__tikzspath_output_tl \pgftransforminvert \use:c {pgf@pos@transform@glob} } \tl_gclear:N \g__tikzspath_output_tl } \ExplSyntaxOff %% %% Copyright (C) 2011-2021 by Andrew Stacey %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License (LPPL), either %% version 1.3c of this license or (at your option) any later %% version. The latest version of this license is in the file: %% %% http://www.latex-project.org/lppl.txt %% %% This work is "maintained" (as per LPPL maintenance status) by %% Andrew Stacey. %% %% This work consists of the files spath3_code.dtx %% calligraphy_doc.tex %% knots_doc.tex %% spath3.tex %% and the derived files spath3.ins, %% spath3_code.pdf, %% spath3.sty, %% tikzlibrarycalligraphy.code.tex %% tikzlibraryknots.code.tex %% tikzlibraryspath3.code.tex %% calligraphy.pdf %% knots.pdf %% spath3.pdf %% README %% %% %% End of file `tikzlibraryspath3.code.tex'.