summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/spath3
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2022-10-26 19:59:14 +0000
committerKarl Berry <karl@freefriends.org>2022-10-26 19:59:14 +0000
commitf5ff19180266238e2ed7754f8818ed8c149f950c (patch)
treec9a1c7d5d25172d9f1474038a8ad021a255ea550 /Master/texmf-dist/tex/latex/spath3
parent1727757c182b7cd2377643274a192119053353ff (diff)
spath3 (26oct22)
git-svn-id: svn://tug.org/texlive/trunk@64818 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/spath3')
-rw-r--r--Master/texmf-dist/tex/latex/spath3/spath3.sty1753
-rw-r--r--Master/texmf-dist/tex/latex/spath3/tikzlibraryknots.code.tex86
-rw-r--r--Master/texmf-dist/tex/latex/spath3/tikzlibraryspath3.code.tex3071
3 files changed, 3280 insertions, 1630 deletions
diff --git a/Master/texmf-dist/tex/latex/spath3/spath3.sty b/Master/texmf-dist/tex/latex/spath3/spath3.sty
index 6a136789262..65273f15fc6 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/21} {2.4} {Functions for
+\ProvidesExplPackage {spath3} {2022/08/24} {2.7} {Functions for
manipulating PGF soft paths}
\RequirePackage{xparse}
\cs_new_protected:Nn \__spath_tl_put_right_braced:Nn
@@ -64,6 +64,9 @@ manipulating PGF soft paths}
\fp_new:N \l__spath_tmpa_fp
\fp_new:N \l__spath_tmpb_fp
\fp_new:N \l__spath_tmpc_fp
+\fp_new:N \l__spath_tmpd_fp
+\fp_new:N \l__spath_tmpe_fp
+\fp_new:N \l__spath_tmpf_fp
\int_new:N \l__spath_tmpa_int
\int_new:N \l__spath_tmpb_int
@@ -72,6 +75,11 @@ manipulating PGF soft paths}
\dim_new:N \l__spath_move_x_dim
\dim_new:N \l__spath_move_y_dim
\bool_new:N \l__spath_closed_bool
+\dim_new:N \l__spath_rectx_dim
+\dim_new:N \l__spath_recty_dim
+
+\bool_new:N \l__spath_rect_bool
+\bool_new:N \l_spath_movetorelevant_bool
\tl_new:N \l__spath_intersecta_tl
\tl_new:N \l__spath_intersectb_tl
\tl_const:Nn \c_spath_moveto_tl {\pgfsyssoftpath@movetotoken}
@@ -80,8 +88,22 @@ manipulating PGF soft paths}
\tl_const:Nn \c_spath_curvetoa_tl {\pgfsyssoftpath@curvetosupportatoken}
\tl_const:Nn \c_spath_curvetob_tl {\pgfsyssoftpath@curvetosupportbtoken}
\tl_const:Nn \c_spath_closepath_tl {\pgfsyssoftpath@closepathtoken}
+\tl_const:Nn \c_spath_rectcorner_tl {\pgfsyssoftpath@rectcornertoken}
+\tl_const:Nn \c_spath_rectsize_tl {\pgfsyssoftpath@rectsizetoken}
\int_new:N \g__spath_anon_int
\int_gzero:N \g__spath_anon_int
+\cs_new_protected_nopar:Npn \spath_anonymous:N #1
+{
+ \tl_set:Nx #1 {anonymous_\int_use:N \g__spath_anon_int}
+ \int_gincr:N \g__spath_anon_int
+}
+\cs_new_protected_nopar:Npn \spath_ganonymous:N #1
+{
+ \tl_gset:Nx #1 {anonymous_\int_use:N \g__spath_anon_int}
+ \int_gincr:N \g__spath_anon_int
+}
+\cs_generate_variant:Nn \spath_anonymous:N {c}
+\cs_generate_variant:Nn \spath_ganonymous:N {c}
\msg_new:nnn { spath3 } { unknown path construction }
{ The~ path~ construction~ element~ #1~ is~ not~ currently~ supported.}
\cs_new_protected_nopar:Npn \__spath_segments_to_seq:n #1
@@ -169,6 +191,27 @@ manipulating PGF soft paths}
}
+ \c_spath_rectcorner_tl
+ {
+ \tl_set_eq:NN \l__spath_tmpb_tl \c_spath_rectcorner_tl
+
+ \tl_put_right:Nx \l__spath_tmpb_tl {{\tl_head:N \l__spath_tmpa_tl}}
+ \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
+ \tl_put_right:Nx \l__spath_tmpb_tl {{\tl_head:N \l__spath_tmpa_tl}}
+ \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
+ \tl_put_right:Nx \l__spath_tmpb_tl {\tl_head:N \l__spath_tmpa_tl}
+ \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
+
+ \tl_put_right:Nx \l__spath_tmpb_tl {{\tl_head:N \l__spath_tmpa_tl}}
+ \dim_set:Nn \l__spath_tmpa_dim {\tl_head:N \l__spath_tmpa_tl}
+ \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
+
+ \tl_put_right:Nx \l__spath_tmpb_tl {{\tl_head:N \l__spath_tmpa_tl}}
+ \dim_set:Nn \l__spath_tmpb_dim {\tl_head:N \l__spath_tmpa_tl}
+ \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
+
+ }
+
\c_spath_closepath_tl
{
\tl_set_eq:NN \l__spath_tmpb_tl \c_spath_moveto_tl
@@ -235,9 +278,11 @@ manipulating PGF soft paths}
\group_begin:
\tl_set:Nn \l__spath_tmpa_tl {#1}
\seq_clear:N \l__spath_tmpa_seq
+ \tl_set:Nx \l__spath_tmpb_tl {\tl_head:N \l__spath_tmpa_tl}
\tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
+
\tl_put_right:NV \l__spath_tmpa_tl \c_spath_moveto_tl
- \tl_set_eq:NN \l__spath_tmpb_tl \c_spath_moveto_tl
+
\bool_do_until:nn {
\tl_if_empty_p:N \l__spath_tmpa_tl
}
@@ -248,6 +293,11 @@ manipulating PGF soft paths}
\seq_put_right:NV \l__spath_tmpa_seq \l__spath_tmpb_tl
\tl_clear:N \l__spath_tmpb_tl
}
+ \tl_if_eq:NNT \l__spath_tmpc_tl \c_spath_rectcorner_tl
+ {
+ \seq_put_right:NV \l__spath_tmpa_seq \l__spath_tmpb_tl
+ \tl_clear:N \l__spath_tmpb_tl
+ }
\tl_if_single:NTF \l__spath_tmpc_tl
{
\tl_put_right:NV \l__spath_tmpb_tl \l__spath_tmpc_tl
@@ -310,6 +360,7 @@ manipulating PGF soft paths}
\c_spath_lineto_tl {}
\c_spath_curveto_tl {}
\c_spath_closepath_tl {}
+ \c_spath_rectsize_tl {}
}
{
\int_incr:N \l__spath_tmpa_int
@@ -345,6 +396,10 @@ manipulating PGF soft paths}
{
\int_incr:N \l__spath_tmpa_int
}
+ \c_spath_rectcorner_tl
+ {
+ \int_incr:N \l__spath_tmpa_int
+ }
}
}
\int_gzero:N \g__spath_output_int
@@ -397,10 +452,35 @@ manipulating PGF soft paths}
\tl_set:Nn \l__spath_tmpa_tl {#1}
\tl_reverse:N \l__spath_tmpa_tl
\tl_clear:N \l__spath_tmpb_tl
- \tl_set:Nx \l__spath_tmpb_tl
+ \tl_set:Nx \l__spath_tmpc_tl {\tl_item:Nn \l__spath_tmpa_tl {3}}
+ \tl_if_eq:NNTF \l__spath_tmpc_tl \c_spath_rectsize_tl
+ {
+ \tl_set:Nx \l__spath_tmpb_tl
+ {
+ {
+ \dim_eval:n
+ {
+ \tl_item:Nn \l__spath_tmpa_tl {2}
+ +
+ \tl_item:Nn \l__spath_tmpa_tl {5}
+ }
+ }
+ {
+ \dim_eval:n
+ {
+ \tl_item:Nn \l__spath_tmpa_tl {1}
+ +
+ \tl_item:Nn \l__spath_tmpa_tl {4}
+ }
+ }
+ }
+ }
{
- { \tl_item:Nn \l__spath_tmpa_tl {2} }
- { \tl_item:Nn \l__spath_tmpa_tl {1} }
+ \tl_set:Nx \l__spath_tmpb_tl
+ {
+ { \tl_item:Nn \l__spath_tmpa_tl {2} }
+ { \tl_item:Nn \l__spath_tmpa_tl {1} }
+ }
}
\tl_gset_eq:NN \g__spath_output_tl \l__spath_tmpb_tl
\group_end:
@@ -440,6 +520,16 @@ manipulating PGF soft paths}
{ \tl_item:Nn \l__spath_tmpa_tl {3} }
}
}
+
+ \c_spath_rectcorner_tl
+ {
+ \tl_set:Nx \l__spath_tmpc_tl
+ {
+ { \tl_item:Nn \l__spath_tmpa_tl {2} }
+ { \tl_item:Nn \l__spath_tmpa_tl {3} }
+ }
+ }
+
}
\prg_replicate:nn {3}
{
@@ -463,114 +553,371 @@ manipulating PGF soft paths}
\tl_gclear:N \g__spath_output_tl
}
\cs_generate_variant:Nn \spath_gfinalmovepoint:Nn {NV, cn, cV}
-\cs_new_protected_nopar:Npn \__spath_reverse:n #1
+\cs_new_protected_nopar:Npn \__spath_initialtangent:n #1
+{
+ \group_begin:
+ \tl_set:Nx \l__spath_tmpb_tl {\tl_item:nn {#1} {4}}
+ \tl_if_eq:NNTF \l__spath_tmpb_tl \c_spath_curvetoa_tl
+ {
+ \fp_set:Nn \l__spath_tmpa_fp {3}
+ }
+ {
+ \fp_set:Nn \l__spath_tmpa_fp {1}
+ }
+ \tl_clear:N \l__spath_tmpa_tl
+ \tl_set:Nx \l__spath_tmpa_tl
+ {
+ {
+ \fp_to_dim:n {
+ \l__spath_tmpa_fp
+ *
+ (
+ \tl_item:nn {#1} {5}
+ -
+ \tl_item:nn {#1} {2}
+ )
+ }
+ }
+ {
+ \fp_to_dim:n {
+ \l__spath_tmpa_fp
+ *
+ (
+ \tl_item:nn {#1} {6}
+ -
+ \tl_item:nn {#1} {3}
+ )
+ }
+ }
+ }
+ \tl_gset_eq:NN \g__spath_output_tl \l__spath_tmpa_tl
+ \group_end:
+}
+\cs_new_protected_nopar:Npn \spath_initialtangent:Nn #1#2
+{
+ \__spath_initialtangent:n {#2}
+ \tl_set_eq:NN #1 \g__spath_output_tl
+ \tl_gclear:N \g__spath_output_tl
+}
+\cs_generate_variant:Nn \spath_initialtangent:Nn {NV, cn, cV, Nv}
+\cs_new_protected_nopar:Npn \spath_ginitialtangent:Nn #1#2
+{
+ \__spath_initialtangent:n {#2}
+ \tl_gset_eq:NN #1 \g__spath_output_tl
+ \tl_gclear:N \g__spath_output_tl
+}
+\cs_generate_variant:Nn \spath_ginitialtangent:Nn {NV, cn, cV, Nv}
+\cs_new_protected_nopar:Npn \__spath_finaltangent:n #1
{
\group_begin:
\tl_set:Nn \l__spath_tmpa_tl {#1}
-
+ \tl_reverse:N \l__spath_tmpa_tl
+ \tl_set:Nx \l__spath_tmpb_tl {\tl_item:nn {#1} {6}}
+ \tl_if_eq:NNTF \l__spath_tmpb_tl \c_spath_curveto_tl
+ {
+ \fp_set:Nn \l__spath_tmpa_fp {3}
+ }
+ {
+ \fp_set:Nn \l__spath_tmpa_fp {1}
+ }
\tl_clear:N \l__spath_tmpb_tl
- \tl_clear:N \l__spath_tmpd_tl
- \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
- \dim_set:Nn \l__spath_tmpa_dim {\tl_head:N \l__spath_tmpa_tl}
- \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
- \dim_set:Nn \l__spath_tmpb_dim {\tl_head:N \l__spath_tmpa_tl}
- \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
-
- \tl_put_left:Nx \l__spath_tmpd_tl
+ \tl_set:Nx \l__spath_tmpb_tl
{
- {\dim_use:N \l__spath_tmpa_dim}
- {\dim_use:N \l__spath_tmpb_dim}
+ {
+ \fp_to_dim:n {
+ \l__spath_tmpa_fp
+ *
+ (
+ \tl_item:Nn \l__spath_tmpa_tl {2}
+ -
+ \tl_item:Nn \l__spath_tmpa_tl {5}
+ )
+ }
+ }
+ {
+ \fp_to_dim:n {
+ \l__spath_tmpa_fp
+ *
+ (
+ \tl_item:Nn \l__spath_tmpa_tl {1}
+ -
+ \tl_item:Nn \l__spath_tmpa_tl {4}
+ )
+ }
+ }
}
-
- \bool_set_false:N \l__spath_closed_bool
-
- \bool_until_do:nn {
+ \tl_gset_eq:NN \g__spath_output_tl \l__spath_tmpb_tl
+ \group_end:
+}
+\cs_new_protected_nopar:Npn \spath_finaltangent:Nn #1#2
+{
+ \__spath_finaltangent:n {#2}
+ \tl_set_eq:NN #1 \g__spath_output_tl
+ \tl_gclear:N \g__spath_output_tl
+}
+\cs_generate_variant:Nn \spath_finaltangent:Nn {NV, cn, cV, Nv}
+\cs_new_protected_nopar:Npn \spath_gfinaltangent:Nn #1#2
+{
+ \__spath_finaltangent:n {#2}
+ \tl_gset_eq:NN #1 \g__spath_output_tl
+ \tl_gclear:N \g__spath_output_tl
+}
+\cs_generate_variant:Nn \spath_gfinaltangent:Nn {NV, cn, cV, Nv}
+\cs_new_protected_nopar:Npn \__spath_finalmovetangent:n #1
+{
+ \group_begin:
+ \tl_set:Nn \l__spath_tmpc_tl { {0pt} {0pt} }
+ \tl_set:Nn \l__spath_tmpa_tl {#1}
+ \bool_do_until:nn
+ {
\tl_if_empty_p:N \l__spath_tmpa_tl
}
{
- \tl_set:Nx \l__spath_tmpc_tl {\tl_head:N \l__spath_tmpa_tl}
-
- \tl_case:NnTF \l__spath_tmpc_tl
+ \tl_set:Nx \l__spath_tmpb_tl {\tl_head:N \l__spath_tmpa_tl}
+ \tl_case:Nn \l__spath_tmpb_tl
{
- \c_spath_moveto_tl {
-
- \bool_if:NT \l__spath_closed_bool
+ \c_spath_moveto_tl
+ {
+ \tl_set:Nx \l__spath_tmpd_tl { \tl_item:Nn \l__spath_tmpa_tl {4} }
+ \tl_if_eq:NNTF \l__spath_tmpd_tl \c_spath_curveto_tl
+ {
+ \fp_set:Nn \l__spath_tmpa_fp {3}
+ }
+ {
+ \fp_set:Nn \l__spath_tmpa_fp {1}
+ }
+ \tl_set:Nx \l__spath_tmpc_tl
{
- \tl_put_right:NV \l__spath_tmpd_tl \c_spath_closepath_tl
- \tl_set:Nx \l__spath_tmpe_tl {\tl_tail:N \l__spath_tmpd_tl}
- \tl_put_right:Nx \l__spath_tmpd_tl
{
- { \tl_head:N \l__spath_tmpd_tl }
- { \tl_head:N \l__spath_tmpe_tl }
+ \fp_to_dim:n
+ {
+ \l__spath_tmpa_fp
+ *
+ (
+ \tl_item:Nn \l__spath_tmpa_tl {5}
+ -
+ \tl_item:Nn \l__spath_tmpa_tl {2}
+ )
+ }
+ }
+ {
+ \fp_to_dim:n
+ {
+ \l__spath_tmpa_fp
+ *
+ (
+ \tl_item:Nn \l__spath_tmpa_tl {6}
+ -
+ \tl_item:Nn \l__spath_tmpa_tl {3}
+ )
+ }
}
}
- \bool_set_false:N \l__spath_closed_bool
- \tl_put_left:NV \l__spath_tmpd_tl \c_spath_moveto_tl
- \tl_put_left:NV \l__spath_tmpb_tl \l__spath_tmpd_tl
- \tl_clear:N \l__spath_tmpd_tl
- }
- \c_spath_lineto_tl {
- \tl_put_left:NV \l__spath_tmpd_tl \c_spath_lineto_tl
- }
- \c_spath_curveto_tl {
- \tl_put_left:NV \l__spath_tmpd_tl \c_spath_curvetoa_tl
- }
- \c_spath_curvetoa_tl {
- \tl_put_left:NV \l__spath_tmpd_tl \c_spath_curveto_tl
- }
- \c_spath_curvetob_tl {
- \tl_put_left:NV \l__spath_tmpd_tl \c_spath_curvetob_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_tmpc_tl
+ \group_end:
+}
+\cs_new_protected_nopar:Npn \spath_finalmovetangent:Nn #1#2
+{
+ \__spath_finalmovetangent:n {#2}
+ \tl_set_eq:NN #1 \g__spath_output_tl
+ \tl_gclear:N \g__spath_output_tl
+}
+\cs_generate_variant:Nn \spath_finalmovetangent:Nn {NV, cn, cV}
+\cs_new_protected_nopar:Npn \spath_gfinalmovetangent:Nn #1#2
+{
+ \__spath_finalmovetangent:n {#2}
+ \tl_gset_eq:NN #1 \g__spath_output_tl
+ \tl_gclear:N \g__spath_output_tl
+}
+\cs_generate_variant:Nn \spath_gfinalmovetangent:Nn {NV, cn, cV}
+\cs_new_protected_nopar:Npn \__spath_reverse:n #1
+{
+ \group_begin:
+ \tl_set:Nn \l__spath_tmpa_tl {#1}
- \dim_set:Nn \l__spath_tmpa_dim {\tl_head:N \l__spath_tmpa_tl}
- \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
- \dim_set:Nn \l__spath_tmpb_dim {\tl_head:N \l__spath_tmpa_tl}
+ \tl_clear:N \l__spath_tmpb_tl
+ \tl_clear:N \l__spath_tmpd_tl
+
+ \bool_set_false:N \l__spath_rect_bool
+
+ \tl_set:Nx \l__spath_tmpc_tl {\tl_head:N \l__spath_tmpa_tl}
+ \bool_while_do:nn {
+ \tl_if_eq_p:NN \l__spath_tmpc_tl \c_spath_rectcorner_tl
+ }
+ {
+ \tl_put_left:Nx \l__spath_tmpd_tl
+ {
+ \tl_item:Nn \l__spath_tmpa_tl {1}
+ {\tl_item:Nn \l__spath_tmpa_tl {2}}
+ {\tl_item:Nn \l__spath_tmpa_tl {3}}
+ \tl_item:Nn \l__spath_tmpa_tl {4}
+ {\tl_item:Nn \l__spath_tmpa_tl {5}}
+ {\tl_item:Nn \l__spath_tmpa_tl {6}}
+ }
+ \prg_replicate:nn {6}
+ {
\tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
+ }
+ \tl_set:Nx \l__spath_tmpc_tl {\tl_head:N \l__spath_tmpa_tl}
+ \bool_set_true:N \l__spath_rect_bool
+ }
- \tl_put_left:Nx \l__spath_tmpd_tl
- {
- {\dim_use:N \l__spath_tmpa_dim}
- {\dim_use:N \l__spath_tmpb_dim}
- }
+ \tl_if_empty:NF \l__spath_tmpa_tl
+ {
+ \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
+ \dim_set:Nn \l__spath_tmpa_dim {\tl_head:N \l__spath_tmpa_tl}
+ \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
+ \dim_set:Nn \l__spath_tmpb_dim {\tl_head:N \l__spath_tmpa_tl}
+ \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
+
+ \tl_put_left:Nx \l__spath_tmpd_tl
+ {
+ {\dim_use:N \l__spath_tmpa_dim}
+ {\dim_use:N \l__spath_tmpb_dim}
+ }
+
+ \bool_set_false:N \l__spath_closed_bool
+ \bool_until_do:nn {
+ \tl_if_empty_p:N \l__spath_tmpa_tl
}
{
- \tl_if_eq:NNTF \l__spath_tmpc_tl \c_spath_closepath_tl
+ \tl_set:Nx \l__spath_tmpc_tl {\tl_head:N \l__spath_tmpa_tl}
+ \bool_set_false:N \l__spath_rect_bool
+
+ \tl_case:NnTF \l__spath_tmpc_tl
{
- \bool_set_true:N \l__spath_closed_bool
+ \c_spath_moveto_tl {
+
+ \bool_if:NT \l__spath_closed_bool
+ {
+ \tl_put_right:NV \l__spath_tmpd_tl \c_spath_closepath_tl
+ \tl_set:Nx \l__spath_tmpe_tl {\tl_tail:N \l__spath_tmpd_tl}
+ \tl_put_right:Nx \l__spath_tmpd_tl
+ {
+ { \tl_head:N \l__spath_tmpd_tl }
+ { \tl_head:N \l__spath_tmpe_tl }
+ }
+ }
+ \bool_set_false:N \l__spath_closed_bool
+ \tl_put_left:NV \l__spath_tmpd_tl \c_spath_moveto_tl
+ \tl_put_left:NV \l__spath_tmpb_tl \l__spath_tmpd_tl
+ \tl_clear:N \l__spath_tmpd_tl
+ }
+ \c_spath_rectcorner_tl {
+
+ \bool_if:NT \l__spath_closed_bool
+ {
+ \tl_put_right:NV \l__spath_tmpd_tl \c_spath_closepath_tl
+ \tl_set:Nx \l__spath_tmpe_tl {\tl_tail:N \l__spath_tmpd_tl}
+ \tl_put_right:Nx \l__spath_tmpd_tl
+ {
+ { \tl_head:N \l__spath_tmpd_tl }
+ { \tl_head:N \l__spath_tmpe_tl }
+ }
+ }
+ \bool_set_false:N \l__spath_closed_bool
+ \tl_put_left:NV \l__spath_tmpd_tl \c_spath_moveto_tl
+ \tl_put_left:NV \l__spath_tmpb_tl \l__spath_tmpd_tl
+ \tl_clear:N \l__spath_tmpd_tl
+
+ \bool_while_do:nn {
+ \tl_if_eq_p:NN \l__spath_tmpc_tl \c_spath_rectcorner_tl
+ }
+ {
+ \tl_put_left:Nx \l__spath_tmpb_tl
+ {
+ \tl_item:Nn \l__spath_tmpa_tl {1}
+ {\tl_item:Nn \l__spath_tmpa_tl {2}}
+ {\tl_item:Nn \l__spath_tmpa_tl {3}}
+ \tl_item:Nn \l__spath_tmpa_tl {4}
+ {\tl_item:Nn \l__spath_tmpa_tl {5}}
+ {\tl_item:Nn \l__spath_tmpa_tl {6}}
+ }
+ \prg_replicate:nn {6}
+ {
+ \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
+ }
+ \tl_set:Nx \l__spath_tmpc_tl {\tl_head:N \l__spath_tmpa_tl}
+ }
+ \bool_set_true:N \l__spath_rect_bool
+
+ }
+ \c_spath_lineto_tl {
+ \tl_put_left:NV \l__spath_tmpd_tl \c_spath_lineto_tl
+ }
+ \c_spath_curveto_tl {
+ \tl_put_left:NV \l__spath_tmpd_tl \c_spath_curvetoa_tl
+ }
+ \c_spath_curvetoa_tl {
+ \tl_put_left:NV \l__spath_tmpd_tl \c_spath_curveto_tl
+ }
+ \c_spath_curvetob_tl {
+ \tl_put_left:NV \l__spath_tmpd_tl \c_spath_curvetob_tl
+ }
}
{
- \msg_warning:nnx
- { spath3 }
- { unknown path construction }
- {\l__spath_tmpc_tl }
+ \tl_if_empty:NF \l__spath_tmpa_tl
+ {
+ \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
+
+ \dim_set:Nn \l__spath_tmpa_dim {\tl_head:N \l__spath_tmpa_tl}
+ \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
+ \dim_set:Nn \l__spath_tmpb_dim {\tl_head:N \l__spath_tmpa_tl}
+ \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
+
+ \tl_put_left:Nx \l__spath_tmpd_tl
+ {
+ {\dim_use:N \l__spath_tmpa_dim}
+ {\dim_use:N \l__spath_tmpb_dim}
+ }
+ }
}
+ {
+ \tl_if_eq:NNTF \l__spath_tmpc_tl \c_spath_closepath_tl
+ {
+ \bool_set_true:N \l__spath_closed_bool
+ }
+ {
+ \msg_warning:nnx
+ { spath3 }
+ { unknown path construction }
+ { \l__spath_tmpc_tl }
+ }
- \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
- \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
- \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
+ \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
+ \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
+ \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
+ }
}
- }
- \bool_if:NT \l__spath_closed_bool
- {
- \tl_put_right:NV \l__spath_tmpd_tl \c_spath_closepath_tl
- \tl_set:Nx \l__spath_tmpe_tl {\tl_tail:N \l__spath_tmpd_tl}
- \tl_put_right:Nx \l__spath_tmpd_tl
+ \bool_if:NT \l__spath_closed_bool
+ {
+ \tl_put_right:NV \l__spath_tmpd_tl \c_spath_closepath_tl
+ \tl_set:Nx \l__spath_tmpe_tl {\tl_tail:N \l__spath_tmpd_tl}
+ \tl_put_right:Nx \l__spath_tmpd_tl
+ {
+ { \tl_head:N \l__spath_tmpd_tl }
+ { \tl_head:N \l__spath_tmpe_tl }
+ }
+ }
+
+ \bool_set_false:N \l__spath_closed_bool
+ \bool_if:NF \l__spath_rect_bool
{
- { \tl_head:N \l__spath_tmpd_tl }
- { \tl_head:N \l__spath_tmpe_tl }
+ \tl_put_left:NV \l__spath_tmpd_tl \c_spath_moveto_tl
}
}
- \bool_set_false:N \l__spath_closed_bool
- \tl_put_left:NV \l__spath_tmpd_tl \c_spath_moveto_tl
\tl_put_left:NV \l__spath_tmpb_tl \l__spath_tmpd_tl
-
\tl_gset_eq:NN \g__spath_output_tl \l__spath_tmpb_tl
\group_end:
}
@@ -602,14 +949,21 @@ manipulating PGF soft paths}
{
\group_begin:
\tl_clear:N \l__spath_tmpa_tl
- \int_compare:nT
+ \tl_set:Nx \l__spath_tmpb_tl {\tl_head:n {#1}}
+ \tl_if_eq:NNTF \l__spath_tmpb_tl \c_spath_rectcorner_tl
{
- \tl_count:n {#1} > 3
+ \tl_set_eq:NN \l__spath_tmpa_tl \c_spath_rectcorner_tl
}
{
- \tl_set:Nx \l__spath_tmpa_tl
+ \int_compare:nT
+ {
+ \tl_count:n {#1} > 3
+ }
{
- \tl_item:Nn {#1} {4}
+ \tl_set:Nx \l__spath_tmpa_tl
+ {
+ \tl_item:Nn {#1} {4}
+ }
}
}
\tl_gset_eq:NN \g__spath_output_tl \l__spath_tmpa_tl
@@ -648,6 +1002,10 @@ manipulating PGF soft paths}
{
\tl_set_eq:NN \l__spath_tmpb_tl \c_spath_curveto_tl
}
+ \tl_if_eq:NNT \l__spath_tmpb_tl \c_spath_rectsize_tl
+ {
+ \tl_set_eq:NN \l__spath_tmpb_tl \c_spath_rectcorner_tl
+ }
}
\tl_gset_eq:NN \g__spath_output_tl \l__spath_tmpb_tl
\group_end:
@@ -670,22 +1028,60 @@ manipulating PGF soft paths}
{
\group_begin:
\tl_set:Nn \l__spath_tmpa_tl {#1}
+
+ \tl_set:Nx \l__spath_tmpc_tl {\tl_head:N \l__spath_tmpa_tl}
\tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
+
\dim_set:Nn \l__spath_tmpa_dim {\tl_head:N \l__spath_tmpa_tl}
\tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
+
\dim_set:Nn \l__spath_tmpb_dim {\tl_head:N \l__spath_tmpa_tl}
\tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
+
+ \tl_if_eq:NNT \l__spath_tmpc_tl \c_spath_rectcorner_tl
+ {
+ \dim_set_eq:NN \l__spath_rectx_dim \l__spath_tmpa_dim
+ \dim_set_eq:NN \l__spath_recty_dim \l__spath_tmpb_dim
+ }
\bool_until_do:nn {
\tl_if_empty_p:N \l__spath_tmpa_tl
}
{
+ \tl_set:Nx \l__spath_tmpc_tl {\tl_head:N \l__spath_tmpa_tl}
\tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
- \dim_set:Nn \l__spath_tmpa_dim
- {\dim_min:nn {\tl_head:N \l__spath_tmpa_tl} {\l__spath_tmpa_dim}}
- \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
- \dim_set:Nn \l__spath_tmpb_dim
- {\dim_min:nn {\tl_head:N \l__spath_tmpa_tl} {\l__spath_tmpb_dim}}
- \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
+
+ \tl_if_eq:NNTF \l__spath_tmpc_tl \c_spath_rectsize_tl
+ {
+ \dim_set:Nn \l__spath_tmpa_dim
+ {\dim_min:nn
+ {\tl_head:N \l__spath_tmpa_tl + \l__spath_rectx_dim} {\l__spath_tmpa_dim}
+ }
+ \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
+
+ \dim_set:Nn \l__spath_tmpb_dim
+ {\dim_min:nn
+ {\tl_head:N \l__spath_tmpa_tl + \l__spath_recty_dim} {\l__spath_tmpb_dim}
+ }
+ \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
+ }
+ {
+ \dim_set:Nn \l__spath_tmpa_dim
+ {\dim_min:nn {\tl_head:N \l__spath_tmpa_tl} {\l__spath_tmpa_dim}}
+ \tl_if_eq:NNT \l__spath_tmpc_tl \c_spath_rectcorner_tl
+ {
+ \dim_set:Nn \l__spath_rectx_dim {\tl_head:N \l__spath_tmpa_tl}
+ }
+ \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
+
+ \dim_set:Nn \l__spath_tmpb_dim
+ {\dim_min:nn {\tl_head:N \l__spath_tmpa_tl} {\l__spath_tmpb_dim}}
+ \tl_if_eq:NNT \l__spath_tmpc_tl \c_spath_rectcorner_tl
+ {
+ \dim_set:Nn \l__spath_recty_dim {\tl_head:N \l__spath_tmpa_tl}
+ }
+ \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
+ }
+
}
\tl_clear:N \l__spath_tmpb_tl
\tl_put_right:Nx \l__spath_tmpb_tl
@@ -714,25 +1110,63 @@ manipulating PGF soft paths}
{
\group_begin:
\tl_set:Nn \l__spath_tmpa_tl {#1}
+
+ \tl_set:Nx \l__spath_tmpc_tl {\tl_head:N \l__spath_tmpa_tl}
\tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
+
\dim_set:Nn \l__spath_tmpa_dim {\tl_head:N \l__spath_tmpa_tl}
\tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
+
\dim_set:Nn \l__spath_tmpb_dim {\tl_head:N \l__spath_tmpa_tl}
\tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
+
+ \tl_if_eq:NNT \l__spath_tmpc_tl \c_spath_rectcorner_tl
+ {
+ \dim_set_eq:NN \l__spath_rectx_dim \l__spath_tmpa_dim
+ \dim_set_eq:NN \l__spath_recty_dim \l__spath_tmpb_dim
+ }
\bool_until_do:nn {
\tl_if_empty_p:N \l__spath_tmpa_tl
}
{
+ \tl_set:Nx \l__spath_tmpc_tl {\tl_head:N \l__spath_tmpa_tl}
\tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
- \dim_set:Nn \l__spath_tmpa_dim
- {\dim_max:nn {\tl_head:N \l__spath_tmpa_tl} {\l__spath_tmpa_dim}}
- \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
- \dim_set:Nn \l__spath_tmpb_dim
- {\dim_max:nn {\tl_head:N \l__spath_tmpa_tl} {\l__spath_tmpb_dim}}
- \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
+
+ \tl_if_eq:NNTF \l__spath_tmpc_tl \c_spath_rectsize_tl
+ {
+ \dim_set:Nn \l__spath_tmpa_dim
+ {\dim_max:nn
+ {\tl_head:N \l__spath_tmpa_tl + \l__spath_rectx_dim} {\l__spath_tmpa_dim}
+ }
+ \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
+
+ \dim_set:Nn \l__spath_tmpb_dim
+ {\dim_max:nn
+ {\tl_head:N \l__spath_tmpa_tl + \l__spath_recty_dim} {\l__spath_tmpb_dim}
+ }
+ \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
+ }
+ {
+ \dim_set:Nn \l__spath_tmpa_dim
+ {\dim_max:nn {\tl_head:N \l__spath_tmpa_tl} {\l__spath_tmpa_dim}}
+ \tl_if_eq:NNT \l__spath_tmpc_tl \c_spath_rectcorner_tl
+ {
+ \dim_set:Nn \l__spath_rectx_dim {\tl_head:N \l__spath_tmpa_tl}
+ }
+ \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
+
+ \dim_set:Nn \l__spath_tmpb_dim
+ {\dim_max:nn {\tl_head:N \l__spath_tmpa_tl} {\l__spath_tmpb_dim}}
+ \tl_if_eq:NNT \l__spath_tmpc_tl \c_spath_rectcorner_tl
+ {
+ \dim_set:Nn \l__spath_recty_dim {\tl_head:N \l__spath_tmpa_tl}
+ }
+ \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
+ }
+
}
\tl_clear:N \l__spath_tmpb_tl
- \tl_put_right:Nx \l__spath_tmpb_tl
+ \tl_set:Nx \l__spath_tmpb_tl
{
{\dim_use:N \l__spath_tmpa_dim}
{\dim_use:N \l__spath_tmpb_dim}
@@ -762,7 +1196,7 @@ manipulating PGF soft paths}
\tl_clear:N \l__spath_tmpa_tl
\tl_put_right:Nn \l__spath_tmpa_tl {
\ExplSyntaxOn
- \tl_clear:N #1
+ \tl_clear_new:N #1
\tl_set:Nn #1 {#2}
\ExplSyntaxOff
}
@@ -780,6 +1214,7 @@ manipulating PGF soft paths}
\spath_save_to_aux:NV #1#1
}
}
+\cs_generate_variant:Nn \spath_save_to_aux:N {c}
\cs_new_protected_nopar:Npn \__spath_translate:nnn #1#2#3
{
\group_begin:
@@ -789,13 +1224,27 @@ manipulating PGF soft paths}
\tl_if_empty_p:N \l__spath_tmpa_tl
}
{
+ \tl_set:Nx \l__spath_tmpc_tl {\tl_head:N \l__spath_tmpa_tl}
+
\tl_put_right:Nx \l__spath_tmpb_tl {\tl_head:N \l__spath_tmpa_tl}
\tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
- \dim_set:Nn \l__spath_tmpa_dim {\tl_head:N \l__spath_tmpa_tl + #2}
+ \tl_if_eq:NNTF \l__spath_tmpc_tl \c_spath_rectsize_tl
+ {
+ \dim_set:Nn \l__spath_tmpa_dim {\tl_head:N \l__spath_tmpa_tl}
+ }
+ {
+ \dim_set:Nn \l__spath_tmpa_dim {\tl_head:N \l__spath_tmpa_tl + #2}
+ }
\tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
- \dim_set:Nn \l__spath_tmpb_dim {\tl_head:N \l__spath_tmpa_tl + #3}
+ \tl_if_eq:NNTF \l__spath_tmpc_tl \c_spath_rectsize_tl
+ {
+ \dim_set:Nn \l__spath_tmpb_dim {\tl_head:N \l__spath_tmpa_tl}
+ }
+ {
+ \dim_set:Nn \l__spath_tmpb_dim {\tl_head:N \l__spath_tmpa_tl + #3}
+ }
\tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
\tl_put_right:Nx \l__spath_tmpb_tl
@@ -969,6 +1418,8 @@ manipulating PGF soft paths}
\tl_if_empty_p:N \l__spath_tmpa_tl
}
{
+ \tl_set:Nx \l__spath_tmpe_tl {\tl_head:N \l__spath_tmpa_tl}
+
\tl_put_right:Nx \l__spath_tmpb_tl {\tl_head:N \l__spath_tmpa_tl}
\tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
\tl_set:Nx \l__spath_tmpc_tl {\tl_head:N \l__spath_tmpa_tl}
@@ -976,10 +1427,20 @@ manipulating PGF soft paths}
\tl_set:Nx \l__spath_tmpd_tl {\tl_head:N \l__spath_tmpa_tl}
\tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
- \fp_set:Nn \l__spath_tmpa_fp
- {\l__spath_tmpc_tl * #2 + \l__spath_tmpd_tl * #4 + #6}
- \fp_set:Nn \l__spath_tmpb_fp
- {\l__spath_tmpc_tl * #3 + \l__spath_tmpd_tl * #5 + #7}
+ \tl_if_eq:NNTF \l__spath_tmpe_tl \c_spath_rectsize_tl
+ {
+ \fp_set:Nn \l__spath_tmpa_fp
+ {\l__spath_tmpc_tl * #2 + \l__spath_tmpd_tl * #4}
+ \fp_set:Nn \l__spath_tmpb_fp
+ {\l__spath_tmpc_tl * #3 + \l__spath_tmpd_tl * #5}
+ }
+ {
+ \fp_set:Nn \l__spath_tmpa_fp
+ {\l__spath_tmpc_tl * #2 + \l__spath_tmpd_tl * #4 + #6}
+ \fp_set:Nn \l__spath_tmpb_fp
+ {\l__spath_tmpc_tl * #3 + \l__spath_tmpd_tl * #5 + #7}
+ }
+
\tl_put_right:Nx \l__spath_tmpb_tl
{
{\fp_to_dim:N \l__spath_tmpa_fp}
@@ -1207,8 +1668,8 @@ manipulating PGF soft paths}
\cs_new_protected_nopar:Npn \__spath_splice_between:nnn #1#2#3
{
\group_begin:
- \spath_finalpoint:NV \l__spath_tmpd_tl {#1}
- \spath_initialpoint:NV \l__spath_tmpe_tl {#3}
+ \spath_finalpoint:Nn \l__spath_tmpd_tl {#1}
+ \spath_initialpoint:Nn \l__spath_tmpe_tl {#3}
\spath_span:NnVV \l__spath_tmpb_tl {#2} \l__spath_tmpd_tl \l__spath_tmpe_tl
\spath_append_no_move:NnV \l__spath_tmpa_tl {#1} \l__spath_tmpb_tl
\spath_append_no_move:Nn \l__spath_tmpa_tl {#3}
@@ -1239,6 +1700,312 @@ manipulating PGF soft paths}
\spath_gsplice_between:NVnn #1#1{#2}{#3}
}
\cs_generate_variant:Nn \spath_gsplice_between:Nnn {NVV, cnn, cvv, Nvn, NVn}
+\cs_new_protected_nopar:Npn \__spath_hobby_curve:nnnn #1#2#3#4
+{
+ \group_begin:
+ \fp_set:Nn \l__spath_tmpa_fp
+ {
+ (
+ (\tl_item:nn {#2} {1})
+ *
+ (\tl_item:nn {#4} {1} - \tl_item:nn {#1} {1})
+ +
+ (\tl_item:nn {#2} {2})
+ *
+ (\tl_item:nn {#4} {2} - \tl_item:nn {#1} {2})
+ )
+ /
+ sqrt
+ (
+ (
+ (\tl_item:nn {#2} {1})^2
+ +
+ (\tl_item:nn {#2} {2})^2
+ )
+ *
+ (
+ (\tl_item:nn {#4} {1} - \tl_item:nn {#1} {1})^2
+ +
+ (\tl_item:nn {#4} {2} - \tl_item:nn {#1} {2})^2
+ )
+ )
+ }
+ \fp_set:Nn \l__spath_tmpb_fp
+ {
+ (
+ -
+ (\tl_item:nn {#2} {1})
+ *
+ (\tl_item:nn {#4} {2} - \tl_item:nn {#1} {2})
+ +
+ (\tl_item:nn {#2} {2})
+ *
+ (\tl_item:nn {#4} {1} - \tl_item:nn {#1} {1})
+ )
+ /
+ sqrt
+ (
+ (
+ (\tl_item:nn {#2} {1})^2
+ +
+ (\tl_item:nn {#2} {2})^2
+ )
+ *
+ (
+ (\tl_item:nn {#4} {1} - \tl_item:nn {#1} {1})^2
+ +
+ (\tl_item:nn {#4} {2} - \tl_item:nn {#1} {2})^2
+ )
+ )
+ }
+ \fp_set:Nn \l__spath_tmpc_fp
+ {
+ (
+ (\tl_item:nn {#3} {1})
+ *
+ (\tl_item:nn {#4} {1} - \tl_item:nn {#1} {1})
+ +
+ (\tl_item:nn {#3} {2})
+ *
+ (\tl_item:nn {#4} {2} - \tl_item:nn {#1} {2})
+ )
+ /
+ sqrt
+ (
+ (
+ (\tl_item:nn {#3} {1})^2
+ +
+ (\tl_item:nn {#3} {2})^2
+ )
+ *
+ (
+ (\tl_item:nn {#4} {1} - \tl_item:nn {#1} {1})^2
+ +
+ (\tl_item:nn {#4} {2} - \tl_item:nn {#1} {2})^2
+ )
+ )
+ }
+ \fp_set:Nn \l__spath_tmpd_fp
+ {
+ (
+ (\tl_item:nn {#3} {1})
+ *
+ (\tl_item:nn {#4} {2} - \tl_item:nn {#1} {2})
+ -
+ (\tl_item:nn {#3} {2})
+ *
+ (\tl_item:nn {#4} {1} - \tl_item:nn {#1} {1})
+ )
+ /
+ sqrt
+ (
+ (
+ (\tl_item:nn {#3} {1})^2
+ +
+ (\tl_item:nn {#3} {2})^2
+ )
+ *
+ (
+ (\tl_item:nn {#4} {1} - \tl_item:nn {#1} {1})^2
+ +
+ (\tl_item:nn {#4} {2} - \tl_item:nn {#1} {2})^2
+ )
+ )
+ }
+
+ \fp_set:Nn \l__spath_tmpe_fp
+ {
+ (
+ 2 + sqrt(2) *
+ (\l__spath_tmpb_fp - 1/16 * \l__spath_tmpd_fp)
+ *
+ (\l__spath_tmpd_fp - 1/16 * \l__spath_tmpb_fp)
+ *
+ (\l__spath_tmpa_fp - \l__spath_tmpc_fp)
+ )
+ /
+ (
+ 1
+ +
+ (1 - (3 - sqrt(5))/2)
+ *
+ \l__spath_tmpa_fp
+ +
+ (3 - sqrt(5))/2
+ *
+ \l__spath_tmpc_fp
+ )
+ *
+ sqrt
+ (
+ (
+ (\tl_item:nn {#4} {1} - \tl_item:nn {#1} {1})^2
+ +
+ (\tl_item:nn {#4} {2} - \tl_item:nn {#1} {2})^2
+ )
+ /
+ (
+ (\tl_item:nn {#2} {1})^2
+ +
+ (\tl_item:nn {#2} {2})^2
+ )
+ )
+ /3
+ }
+ \fp_set:Nn \l__spath_tmpf_fp
+ {
+ (
+ 2 - sqrt(2) *
+ (\l__spath_tmpb_fp - 1/16 * \l__spath_tmpd_fp)
+ *
+ (\l__spath_tmpd_fp - 1/16 * \l__spath_tmpb_fp)
+ *
+ (\l__spath_tmpa_fp - \l__spath_tmpc_fp)
+ )
+ /
+ (
+ 1
+ +
+ (1 - (3 - sqrt(5))/2)
+ *
+ \l__spath_tmpc_fp
+ +
+ (3 - sqrt(5))/2
+ *
+ \l__spath_tmpa_fp
+ )
+ *
+ sqrt
+ (
+ (
+ (\tl_item:nn {#4} {1} - \tl_item:nn {#1} {1})^2
+ +
+ (\tl_item:nn {#4} {2} - \tl_item:nn {#1} {2})^2
+ )
+ /
+ (
+ (\tl_item:nn {#3} {1})^2
+ +
+ (\tl_item:nn {#3} {2})^2
+ )
+ )
+ /3
+ }
+
+ \tl_set:Nx \l__spath_tmpa_tl
+ {
+ {
+ \fp_to_dim:n
+ {
+ \tl_item:nn {#1} {1}
+ +
+ \l__spath_tmpe_fp
+ *
+ (\tl_item:nn {#2} {1})
+ }
+ }
+ {
+ \fp_to_dim:n
+ {
+ \tl_item:nn {#1} {2}
+ +
+ \l__spath_tmpe_fp
+ *
+ (\tl_item:nn {#2} {2})
+ }
+ }
+ }
+ \tl_set:Nx \l__spath_tmpb_tl
+ {
+ {
+ \fp_to_dim:n
+ {
+ \tl_item:nn {#4} {1}
+ -
+ \l__spath_tmpf_fp
+ *
+ (\tl_item:nn {#3} {1})
+ }
+ }
+ {
+ \fp_to_dim:n
+ {
+ \tl_item:nn {#4} {2}
+ -
+ \l__spath_tmpf_fp
+ *
+ (\tl_item:nn {#3} {2})
+ }
+ }
+ }
+
+ \tl_clear:N \l__spath_tmpc_tl
+ \tl_set:NV \l__spath_tmpc_tl \c_spath_moveto_tl
+ \tl_put_right:Nn \l__spath_tmpc_tl {#1}
+ \tl_put_right:NV \l__spath_tmpc_tl \c_spath_curvetoa_tl
+ \tl_put_right:NV \l__spath_tmpc_tl \l__spath_tmpa_tl
+ \tl_put_right:NV \l__spath_tmpc_tl \c_spath_curvetob_tl
+ \tl_put_right:NV \l__spath_tmpc_tl \l__spath_tmpb_tl
+ \tl_put_right:NV \l__spath_tmpc_tl \c_spath_curveto_tl
+ \tl_put_right:Nn \l__spath_tmpc_tl {#4}
+ \tl_gset_eq:NN \g__spath_output_tl \l__spath_tmpc_tl
+ \group_end:
+}
+\cs_new_protected_nopar:Npn \spath_hobby_curve:Nnnnn #1#2#3#4#5
+{
+ \__spath_hobby_curve:nnnn {#2}{#3}{#4}{#5}
+ \tl_set_eq:NN #1 \g__spath_output_tl
+ \tl_gclear:N \g__spath_output_tl
+}
+\cs_generate_variant:Nn \spath_hobby_curve:Nnnnn {NVVVV}
+\cs_new_protected_nopar:Npn \spath_ghobby_curve:Nnnnn #1#2#3#4#5
+{
+ \__spath_hobby_curve:nnnn {#2}{#3}{#4}{#5}
+ \tl_gset_eq:NN #1 \g__spath_output_tl
+ \tl_gclear:N \g__spath_output_tl
+}
+\cs_generate_variant:Nn \spath_ghobby_curve:Nnnnn {NVVVV}
+\cs_new_protected_nopar:Npn \__spath_curve_between:nn #1#2
+{
+ \group_begin:
+ \spath_finalpoint:Nn \l__spath_tmpa_tl {#1}
+ \spath_finaltangent:Nn \l__spath_tmpb_tl {#1}
+ \spath_initialpoint:Nn \l__spath_tmpc_tl {#2}
+ \spath_initialtangent:Nn \l__spath_tmpd_tl {#2}
+
+ \spath_hobby_curve:NVVVV \l__spath_tmpe_tl
+ \l__spath_tmpa_tl \l__spath_tmpb_tl \l__spath_tmpd_tl \l__spath_tmpc_tl
+
+ \tl_set:Nn \l__spath_tmpa_tl {#1}
+ \spath_append_no_move:NV \l__spath_tmpa_tl \l__spath_tmpe_tl
+ \spath_append_no_move:Nn \l__spath_tmpa_tl {#2}
+ \tl_gset_eq:NN \g__spath_output_tl \l__spath_tmpa_tl
+ \group_end:
+}
+\cs_new_protected_nopar:Npn \spath_curve_between:Nnn #1#2#3
+{
+ \__spath_curve_between:nn {#2}{#3}
+ \tl_set_eq:NN #1 \g__spath_output_tl
+ \tl_gclear:N \g__spath_output_tl
+}
+\cs_generate_variant:Nn \spath_curve_between:Nnn {NVn, NVV}
+\cs_new_protected_nopar:Npn \spath_curve_between:Nn #1#2
+{
+ \spath_curve_between:NVn #1#1{#2}
+}
+\cs_generate_variant:Nn \spath_curve_between:Nn {NV, cn, cv}
+\cs_new_protected_nopar:Npn \spath_gcurve_between:Nnn #1#2#3
+{
+ \__spath_curve_between:nn {#2}
+ \tl_gset_eq:NN #1 \g__spath_output_tl
+ \tl_gclear:N \g__spath_output_tl
+}
+\cs_generate_variant:Nn \spath_gcurve_between:Nnn {NVn, NVV}
+\cs_new_protected_nopar:Npn \spath_gcurve_between:Nn #1#2
+{
+ \spath_gcurve_between:NVnn #1#1{#2}
+}
+\cs_generate_variant:Nn \spath_gcurve_between:Nn {NV, cn, cv}
\cs_new_protected_nopar:Npn \__spath_close_with:nn #1#2
{
\group_begin:
@@ -1295,6 +2062,68 @@ manipulating PGF soft paths}
\spath_gclose_with:NVn #1#1{#2}
}
\cs_generate_variant:Nn \spath_gclose_with:Nn {cn, cV, cv, NV}
+\cs_new_protected_nopar:Npn \__spath_close_with_curve:n #1
+{
+ \group_begin:
+ \spath_finalpoint:Nn \l__spath_tmpa_tl {#1}
+ \spath_finaltangent:Nn \l__spath_tmpb_tl {#1}
+ \spath_finalmovepoint:Nn \l__spath_tmpc_tl {#1}
+ \spath_finalmovetangent:Nn \l__spath_tmpd_tl {#1}
+ \dim_compare:nTF
+ {
+ \dim_abs:n
+ {
+ \tl_item:Nn \l__spath_tmpa_tl {1}
+ -
+ \tl_item:Nn \l__spath_tmpc_tl {1}
+ }
+ +
+ \dim_abs:n
+ {
+ \tl_item:Nn \l__spath_tmpa_tl {2}
+ -
+ \tl_item:Nn \l__spath_tmpc_tl {2}
+ }
+ < 0.01pt
+ }
+ {
+ \__spath_close:n {#1}
+ }
+ {
+
+ \spath_hobby_curve:NVVVV \l__spath_tmpe_tl
+ \l__spath_tmpa_tl \l__spath_tmpb_tl \l__spath_tmpd_tl \l__spath_tmpc_tl
+
+ \tl_set:Nn \l__spath_tmpa_tl {#1}
+ \spath_append_no_move:NV \l__spath_tmpa_tl \l__spath_tmpe_tl
+ \__spath_close:V \l__spath_tmpa_tl
+ }
+ \group_end:
+}
+\cs_new_protected_nopar:Npn \spath_close_with_curve:Nn #1#2
+{
+ \__spath_close_with_curve:n {#2}
+ \tl_set_eq:NN #1 \g__spath_output_tl
+ \tl_gclear:N \g__spath_output_tl
+}
+\cs_generate_variant:Nn \spath_close_with_curve:Nn {cn, cV, cv, NV}
+\cs_new_protected_nopar:Npn \spath_close_with_curve:N #1
+{
+ \spath_close_with_curve:NV #1#1
+}
+\cs_generate_variant:Nn \spath_close_with_curve:N {c}
+\cs_new_protected_nopar:Npn \spath_gclose_with_curve:Nn #1#2
+{
+ \__spath_close_with_curve:n {#2}
+ \tl_gset_eq:NN #1 \g__spath_output_tl
+ \tl_gclear:N \g__spath_output_tl
+}
+\cs_generate_variant:Nn \spath_gclose_with_curve:Nn {cn, cV, cv, NV}
+\cs_new_protected_nopar:Npn \spath_gclose_with_curve:N #1
+{
+ \spath_gclose_with_curve:NV #1#1
+}
+\cs_generate_variant:Nn \spath_gclose_with_curve:N {c}
\cs_new_protected_nopar:Npn \__spath_weld:nn #1#2
{
\group_begin:
@@ -1335,9 +2164,20 @@ manipulating PGF soft paths}
\group_begin:
\tl_set:Nn \l__spath_tmpa_tl {#1}
\tl_set:Nn \l__spath_tmpb_tl {#2}
- \tl_set:Nx \l__spath_tmpb_tl {\tl_tail:N \l__spath_tmpb_tl}
- \tl_set:Nx \l__spath_tmpb_tl {\tl_tail:N \l__spath_tmpb_tl}
- \tl_set:Nx \l__spath_tmpb_tl {\tl_tail:N \l__spath_tmpb_tl}
+ \tl_set:Nx \l__spath_tmpc_tl {\tl_head:N \l__spath_tmpb_tl}
+ \spath_finalaction:Nn \l__spath_tmpd_tl {#1}
+ \bool_if:nT {
+ ! \tl_if_eq_p:NN \l__spath_tmpd_tl \c_spath_closepath_tl
+ &&
+ ! \tl_if_eq_p:NN \l__spath_tmpd_tl \c_spath_rectcorner_tl
+ &&
+ \tl_if_eq_p:NN \l__spath_tmpc_tl \c_spath_moveto_tl
+ }
+ {
+ \tl_set:Nx \l__spath_tmpb_tl {\tl_tail:N \l__spath_tmpb_tl}
+ \tl_set:Nx \l__spath_tmpb_tl {\tl_tail:N \l__spath_tmpb_tl}
+ \tl_set:Nx \l__spath_tmpb_tl {\tl_tail:N \l__spath_tmpb_tl}
+ }
\tl_put_right:NV \l__spath_tmpa_tl \l__spath_tmpb_tl
\tl_gset_eq:NN \g__spath_output_tl \l__spath_tmpa_tl
@@ -1462,6 +2302,43 @@ manipulating PGF soft paths}
\spath_gbake_round:NV #1#1
}
\cs_generate_variant:Nn \spath_gbake_round:N {c}
+\cs_new_protected_nopar:Npn \__spath_bake_shorten:n #1
+{
+ \group_begin:
+ \tl_set:Nn \l__spath_tmpa_tl {#1}
+ \pgfsyssoftpath@getcurrentpath\l__spath_tmpb_tl
+ \pgfsyssoftpath@setcurrentpath\l__spath_tmpa_tl
+ \pgf@prepare@end@of@path
+ \pgf@prepare@start@of@path
+ \pgfsyssoftpath@getcurrentpath\l__spath_tmpa_tl
+ \pgfsyssoftpath@setcurrentpath\l__spath_tmpb_tl
+ \tl_gset_eq:NN \g__spath_output_tl \l__spath_tmpa_tl
+ \group_end:
+}
+\cs_new_protected_nopar:Npn \spath_bake_shorten:Nn #1#2
+{
+ \__spath_bake_shorten:n {#2}
+ \tl_set_eq:NN #1 \g__spath_output_tl
+ \tl_gclear:N \g__spath_output_tl
+}
+\cs_generate_variant:Nn \spath_bake_shorten:Nn {NV}
+\cs_new_protected_nopar:Npn \spath_bake_shorten:N #1
+{
+ \spath_bake_shorten:NV #1#1
+}
+\cs_generate_variant:Nn \spath_bake_shorten:N {c}
+\cs_new_protected_nopar:Npn \spath_gbake_shorten:Nn #1#2
+{
+ \__spath_bake_shorten:n {#2}
+ \tl_gset_eq:NN #1 \g__spath_output_tl
+ \tl_gclear:N \g__spath_output_tl
+}
+\cs_generate_variant:Nn \spath_gbake_shorten:Nn {NV}
+\cs_new_protected_nopar:Npn \spath_gbake_shorten:N #1
+{
+ \spath_gbake_shorten:NV #1#1
+}
+\cs_generate_variant:Nn \spath_gbake_shorten:N {c}
\cs_new_protected_nopar:Npn \__spath_close:n #1
{
\group_begin:
@@ -1497,10 +2374,83 @@ manipulating PGF soft paths}
\spath_gclose:NV #1#1
}
\cs_generate_variant:Nn \spath_gclose:N {c}
-\cs_new_protected_nopar:Npn \__spath_open:n #1
+\cs_new_protected_nopar:Npn \__spath_adjust_close:n #1
{
\group_begin:
\tl_set:Nn \l__spath_tmpa_tl {#1}
+ \spath_finalmovepoint:NV \l__spath_tmpb_tl \l__spath_tmpa_tl
+ \spath_finalpoint:NV \l__spath_tmpc_tl \l__spath_tmpa_tl
+ \tl_reverse:N \l__spath_tmpa_tl
+ \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
+ \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
+ \tl_set:Nx \l__spath_tmpd_tl {\tl_head:N \l__spath_tmpa_tl}
+ \tl_if_eq:NNT \l__spath_tmpd_tl \c_spath_curveto_tl
+ {
+ \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
+ \tl_clear:N \l__spath_tmpe_tl
+ \tl_set:Nx \l__spath_tmpe_tl {
+ {
+ \dim_eval:n
+ {
+ \tl_item:Nn \l__spath_tmpa_tl {1}
+ -
+ \tl_item:Nn \l__spath_tmpc_tl {2}
+ +
+ \tl_item:Nn \l__spath_tmpb_tl {2}
+ }
+ }
+ {
+ \dim_eval:n
+ {
+ \tl_item:Nn \l__spath_tmpa_tl {2}
+ -
+ \tl_item:Nn \l__spath_tmpc_tl {1}
+ +
+ \tl_item:Nn \l__spath_tmpb_tl {1}
+ }
+ }
+ }
+ \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
+ \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
+ \tl_put_left:NV \l__spath_tmpa_tl \l__spath_tmpe_tl
+ \tl_put_left:NV \l__spath_tmpa_tl \l__spath_tmpd_tl
+ }
+ \tl_reverse:N \l__spath_tmpa_tl
+ \tl_put_right:NV \l__spath_tmpa_tl \l__spath_tmpb_tl
+ \tl_put_right:NV \l__spath_tmpa_tl \c_spath_closepath_tl
+ \tl_put_right:NV \l__spath_tmpa_tl \l__spath_tmpb_tl
+ \tl_gset_eq:NN \g__spath_output_tl \l__spath_tmpa_tl
+ \group_end:
+}
+\cs_generate_variant:Nn \__spath_adjust_close:n {V}
+\cs_new_protected_nopar:Npn \spath_adjust_close:Nn #1#2
+{
+ \__spath_adjust_close:n {#2}
+ \tl_set_eq:NN #1 \g__spath_output_tl
+ \tl_gclear:N \g__spath_output_tl
+}
+\cs_generate_variant:Nn \spath_adjust_close:Nn {NV}
+\cs_new_protected_nopar:Npn \spath_adjust_close:N #1
+{
+ \spath_adjust_close:NV #1#1
+}
+\cs_generate_variant:Nn \spath_adjust_close:N {c}
+\cs_new_protected_nopar:Npn \spath_adjust_gclose:Nn #1#2
+{
+ \__spath_adjust_close:n {#2}
+ \tl_gset_eq:NN #1 \g__spath_output_tl
+ \tl_gclear:N \g__spath_output_tl
+}
+\cs_generate_variant:Nn \spath_adjust_gclose:Nn {NV}
+\cs_new_protected_nopar:Npn \spath_adjust_gclose:N #1
+{
+ \spath_adjust_gclose:NV #1#1
+}
+\cs_generate_variant:Nn \spath_adjust_gclose:N {c}
+\cs_new_protected_nopar:Npn \__spath_open:n #1
+{
+ \group_begin:
+ \spath_replace_rectangles:Nn \l__spath_tmpa_tl {#1}
\tl_clear:N \l__spath_tmpb_tl
\bool_until_do:nn {
\tl_if_empty_p:N \l__spath_tmpa_tl
@@ -1574,6 +2524,7 @@ manipulating PGF soft paths}
\tl_gset_eq:NN \g__spath_output_tl \l__spath_tmpb_tl
\group_end:
}
+\cs_generate_variant:Nn \__spath_open:n {V}
\cs_new_protected_nopar:Npn \spath_open:Nn #1#2
{
\__spath_open:n {#2}
@@ -1596,6 +2547,8 @@ manipulating PGF soft paths}
{
\spath_gopen:NV #1#1
}
+\cs_generate_variant:Nn \spath_open:N {c}
+\cs_generate_variant:Nn \spath_gopen:N {c}
\cs_new_protected_nopar:Npn \__spath_replace_lines:n #1
{
\group_begin:
@@ -1707,6 +2660,115 @@ manipulating PGF soft paths}
\spath_greplace_lines:NV #1#1
}
\cs_generate_variant:Nn \spath_greplace_lines:N {c}
+\cs_new_protected_nopar:Npn \__spath_replace_rectangles:n #1
+{
+ \group_begin:
+ \tl_set:Nn \l__spath_tmpa_tl {#1}
+ \tl_clear:N \l__spath_tmpb_tl
+
+ \bool_do_until:nn
+ {
+ \tl_if_empty_p:N \l__spath_tmpa_tl
+ }
+ {
+ \tl_set:Nx \l__spath_tmpc_tl {\tl_head:N \l__spath_tmpa_tl }
+ \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl }
+ \tl_set:Nx \l__spath_tmpd_tl {\tl_head:N \l__spath_tmpa_tl }
+ \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl }
+ \tl_set:Nx \l__spath_tmpe_tl {\tl_head:N \l__spath_tmpa_tl }
+ \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl }
+
+ \tl_if_eq:NNTF \l__spath_tmpc_tl \c_spath_rectcorner_tl
+ {
+
+ \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl }
+ \dim_set:Nn \l__spath_tmpa_dim
+ {
+ \tl_item:Nn \l__spath_tmpa_tl {1}
+ }
+ \dim_set:Nn \l__spath_tmpb_dim
+ {
+ \tl_item:Nn \l__spath_tmpa_tl {2}
+ }
+
+ \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl }
+ \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl }
+
+ \tl_put_right:NV \l__spath_tmpb_tl \c_spath_moveto_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 \c_spath_lineto_tl
+ \tl_put_right:Nx \l__spath_tmpb_tl
+ {
+ {
+ \fp_to_dim:n { \l__spath_tmpd_tl + \l__spath_tmpa_dim }
+ }
+ }
+ \__spath_tl_put_right_braced:NV \l__spath_tmpb_tl \l__spath_tmpe_tl
+
+ \tl_put_right:NV \l__spath_tmpb_tl \c_spath_lineto_tl
+ \tl_put_right:Nx \l__spath_tmpb_tl
+ {
+ {
+ \fp_to_dim:n { \l__spath_tmpd_tl + \l__spath_tmpa_dim }
+ }
+ }
+ \tl_put_right:Nx \l__spath_tmpb_tl
+ {
+ {
+ \fp_to_dim:n { \l__spath_tmpe_tl + \l__spath_tmpb_dim }
+ }
+ }
+
+ \tl_put_right:NV \l__spath_tmpb_tl \c_spath_lineto_tl
+ \__spath_tl_put_right_braced:NV \l__spath_tmpb_tl \l__spath_tmpd_tl
+ \tl_put_right:Nx \l__spath_tmpb_tl
+ {
+ {
+ \fp_to_dim:n { \l__spath_tmpe_tl + \l__spath_tmpb_dim }
+ }
+ }
+
+ \tl_put_right:NV \l__spath_tmpb_tl \c_spath_closepath_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
+ }
+ }
+ \tl_gset_eq:NN \g__spath_output_tl \l__spath_tmpb_tl
+ \group_end:
+}
+\cs_generate_variant:Nn \__spath_replace_rectangles:n {V}
+\cs_new_protected_nopar:Npn \spath_replace_rectangles:Nn #1#2
+{
+ \__spath_replace_rectangles:n {#2}
+ \tl_set_eq:NN #1 \g__spath_output_tl
+ \tl_gclear:N \g__spath_output_tl
+}
+\cs_generate_variant:Nn \spath_replace_rectangles:Nn {NV, cV, cv, Nv}
+\cs_new_protected_nopar:Npn \spath_replace_rectangles:N #1
+{
+ \spath_replace_rectangles:NV #1#1
+}
+\cs_generate_variant:Nn \spath_replace_rectangles:N {c}
+\cs_new_protected_nopar:Npn \spath_greplace_rectangles:Nn #1#2
+{
+ \__spath_replace_rectangles:n {#2}
+ \tl_gset_eq:NN #1 \g__spath_output_tl
+ \tl_gclear:N \g__spath_output_tl
+}
+\cs_generate_variant:Nn \spath_greplace_rectangles:Nn {NV, cV, cv, Nv}
+\cs_new_protected_nopar:Npn \spath_greplace_rectangles:N #1
+{
+ \spath_greplace_rectangles:NV #1#1
+}
+\cs_generate_variant:Nn \spath_greplace_rectangles:N {c}
\cs_new_protected_nopar:Npn \__spath_remove_empty_components:n #1
{
\group_begin:
@@ -2000,9 +3062,11 @@ manipulating PGF soft paths}
}
{
\fp_set:Nn \l__spath_tmpa_fp {.5 * \l__spath_tmpa_fp / \l__spath_tmpb_fp}
- \fp_compare:nTF
+ \bool_if:nTF
{
- 0 < \l__spath_tmpa_fp && \l__spath_tmpa_fp < 1
+ \fp_compare_p:n {0 < \l__spath_tmpa_fp}
+ &&
+ \fp_compare_p:n {\l__spath_tmpa_fp < 1}
}
{
\__spath_split_curve:nV {#1} \l__spath_tmpa_fp
@@ -2199,6 +3263,30 @@ manipulating PGF soft paths}
\tl_gclear:N \g__spath_output_tl
}
\cs_generate_variant:Nn \spath_gsplit_line:NNnn {NNnV, NNVn, NNVV}
+\cs_new_protected_nopar:Npn \__spath_split_rectangle:nn #1#2
+{
+ \group_begin:
+ \spath_open:Nn \l__spath_tmpa_tl {#1}
+ \fp_set:Nn \l__spath_tmpa_fp {4*(#2)}
+ \spath_split_at:NNVV
+ \l__spath_tmpa_tl \l__spath_tmpb_tl \l__spath_tmpa_tl \l__spath_tmpa_fp
+ \__spath_append_no_move:VV \l__spath_tmpb_tl \l__spath_tmpa_tl
+ \group_end:
+}
+\cs_new_protected_nopar:Npn \spath_split_rectangle:Nnn #1#2#3
+{
+ \__spath_split_rectangle:nn {#2}{#3}
+ \tl_set_eq:NN #1 \g__spath_output_tl
+ \tl_gclear:N \g__spath_output_tl
+}
+\cs_generate_variant:Nn \spath_split_rectangle:Nnn {NnV, NVn, NVV}
+\cs_new_protected_nopar:Npn \spath_gsplit_rectangle:Nnn #1#2#3
+{
+ \__spath_split_rectangle:nn {#2}{#3}
+ \tl_gset_eq:NN #1 \g__spath_output_tl
+ \tl_gclear:N \g__spath_output_tl
+}
+\cs_generate_variant:Nn \spath_gsplit_rectangle:Nnn {NnV, NVn, NVV}
\cs_new_protected_nopar:Npn \__spath_split_at:nn #1#2
{
\group_begin:
@@ -2228,11 +3316,28 @@ manipulating PGF soft paths}
\bool_set_true:N \l__spath_tmpa_bool
\tl_set:Nn \l__spath_tmpe_tl {#1}
- \tl_clear:N \l__spath_tmpc_tl
\dim_zero:N \l__spath_tmpa_dim
\dim_zero:N \l__spath_tmpb_dim
+ % Remember if the component is closed
+ \spath_finalaction:NV \l__spath_tmpa_tl \l__spath_tmpe_tl
+
+ \bool_set:Nn \l__spath_closed_bool
+ {
+ \tl_if_eq_p:NN \l__spath_tmpa_tl \c_spath_closepath_tl
+ ||
+ \tl_if_eq_p:NN \l__spath_tmpa_tl \c_spath_rectcorner_tl
+ }
+
+ % Open it
+ \spath_open:N \l__spath_tmpe_tl
+
+ \tl_clear:N \l__spath_tmpa_tl
+ \tl_clear:N \l__spath_tmpb_tl
+ \tl_clear:N \l__spath_tmpc_tl
+ \tl_clear:N \l__spath_tmpd_tl
+
\bool_until_do:nn {
\tl_if_empty_p:N \l__spath_tmpe_tl
||
@@ -2251,6 +3356,10 @@ manipulating PGF soft paths}
{
\int_incr:N \l__spath_tmpb_int
}
+ \c_spath_rectcorner_tl
+ {
+ \int_incr:N \l__spath_tmpb_int
+ }
}
\int_compare:nT { \l__spath_tmpb_int < \l__spath_tmpa_int }
{
@@ -2355,14 +3464,65 @@ manipulating PGF soft paths}
\tl_put_right:NV \l__spath_tmpc_tl \l__spath_tmpa_tl
\tl_put_right:NV \l__spath_tmpb_tl \l__spath_tmpe_tl
}
+
+ \c_spath_rectcorner_tl
+ {
+ \tl_clear:N \l__spath_tmpd_tl
+ \tl_put_right:NV \l__spath_tmpd_tl \l__spath_tmpf_tl
+
+ \tl_put_right:Nx \l__spath_tmpd_tl {{\tl_head:N \l__spath_tmpe_tl}}
+ \tl_set:Nx \l__spath_tmpe_tl {\tl_tail:N \l__spath_tmpe_tl}
+ \tl_put_right:Nx \l__spath_tmpd_tl {{\tl_head:N \l__spath_tmpe_tl}}
+ \tl_set:Nx \l__spath_tmpe_tl {\tl_tail:N \l__spath_tmpe_tl}
+
+ \tl_put_right:Nx \l__spath_tmpd_tl {\tl_head:N \l__spath_tmpe_tl}
+ \tl_set:Nx \l__spath_tmpe_tl {\tl_tail:N \l__spath_tmpe_tl}
+
+ \tl_put_right:Nx \l__spath_tmpd_tl {{\tl_head:N \l__spath_tmpe_tl}}
+ \tl_set:Nx \l__spath_tmpe_tl {\tl_tail:N \l__spath_tmpe_tl}
+ \tl_put_right:Nx \l__spath_tmpd_tl {{\tl_head:N \l__spath_tmpe_tl}}
+ \tl_set:Nx \l__spath_tmpe_tl {\tl_tail:N \l__spath_tmpe_tl}
+
+ \spath_split_rectangle:NVV
+ \l__spath_tmpa_tl
+ \l__spath_tmpd_tl
+ \l__spath_tmpa_fp
+
+ \tl_put_right:NV \l__spath_tmpc_tl \l__spath_tmpa_tl
+ \tl_put_right:NV \l__spath_tmpb_tl \l__spath_tmpe_tl
+ }
+
}
}
+ \bool_if:NT \l__spath_closed_bool
+ {
+ \prg_replicate:nn {3}
+ {
+ \tl_set:Nx \l__spath_tmpc_tl {\tl_tail:N \l__spath_tmpc_tl}
+ }
+ \tl_put_right:NV \l__spath_tmpb_tl \l__spath_tmpc_tl
+ \tl_set_eq:NN \l__spath_tmpc_tl \l__spath_tmpb_tl
+ \tl_clear:N \l__spath_tmpb_tl
+ }
+
\tl_gclear:N \g__spath_output_tl
\__spath_tl_gput_right_braced:NV \g__spath_output_tl \l__spath_tmpc_tl
\__spath_tl_gput_right_braced:NV \g__spath_output_tl \l__spath_tmpb_tl
\group_end:
}
+\cs_generate_variant:Nn \__spath_split_at:nn {nV, VV}
+\cs_new_protected_nopar:Npn \__spath_split_at_normalised:nn #1#2
+{
+ \group_begin:
+ \spath_reallength:Nn \l__spath_tmpa_int {#1}
+
+ \tl_set:Nx \l__spath_tmpa_tl
+ {\fp_to_decimal:n {(#2) * (\l__spath_tmpa_int)}}
+ \__spath_split_at:nV {#1} \l__spath_tmpa_tl
+ \group_end:
+}
+\cs_generate_variant:Nn \__spath_split_at_normalised:nn {nV}
\cs_new_protected_nopar:Npn \spath_split_at:NNnn #1#2#3#4
{
\__spath_split_at:nn {#3}{#4}
@@ -2379,6 +3539,114 @@ manipulating PGF soft paths}
\tl_gclear:N \g__spath_output_tl
}
\cs_generate_variant:Nn \spath_gsplit_at:NNnn {NNVn, NNVV, NNnV}
+\cs_new_protected_nopar:Npn \spath_split_at_keep_start:Nnn #1#2#3
+{
+ \__spath_split_at:nn {#2}{#3}
+ \tl_set:Nx #1 {\tl_item:Nn \g__spath_output_tl {1}}
+ \tl_gclear:N \g__spath_output_tl
+}
+\cs_generate_variant:Nn \spath_split_at_keep_start:Nnn {NVn}
+\cs_new_protected_nopar:Npn \spath_split_at_keep_start:Nn #1#2
+{
+ \spath_split_at_keep_start:NVn #1#1{#2}
+}
+\cs_new_protected_nopar:Npn \spath_gsplit_at_keep_start:Nnn #1#2#3
+{
+ \__spath_split_at:nn {#2}{#3}
+ \tl_gset:Nx #1 {\tl_item:Nn \g__spath_output_tl {1}}
+ \tl_gclear:N \g__spath_output_tl
+}
+\cs_generate_variant:Nn \spath_gsplit_at_keep_start:Nnn {NVn}
+\cs_new_protected_nopar:Npn \spath_gsplit_at_keep_start:Nn #1#2
+{
+ \spath_gsplit_at_keep_start:NVn #1#1{#2}
+}
+\cs_new_protected_nopar:Npn \spath_split_at_keep_end:Nnn #1#2#3
+{
+ \__spath_split_at:nn {#2}{#3}
+ \tl_set:Nx #1 {\tl_item:Nn \g__spath_output_tl {2}}
+ \tl_gclear:N \g__spath_output_tl
+}
+\cs_generate_variant:Nn \spath_split_at_keep_end:Nnn {NVn}
+\cs_new_protected_nopar:Npn \spath_split_at_keep_end:Nn #1#2
+{
+ \spath_split_at_keep_end:NVn #1#1{#2}
+}
+\cs_new_protected_nopar:Npn \spath_gsplit_at_keep_end:Nnn #1#2#3
+{
+ \__spath_split_at:nn {#2}{#3}
+ \tl_gset:Nx #1 {\tl_item:Nn \g__spath_output_tl {2}}
+ \tl_gclear:N \g__spath_output_tl
+}
+\cs_generate_variant:Nn \spath_gsplit_at_keep_end:Nnn {NVn}
+\cs_new_protected_nopar:Npn \spath_gsplit_at_keep_end:Nn #1#2
+{
+ \spath_gsplit_at_keep_end:NVn #1#1{#2}
+}
+\cs_new_protected_nopar:Npn \spath_split_at_normalised:NNnn #1#2#3#4
+{
+ \__spath_split_at_normalised:nn {#3}{#4}
+ \tl_set:Nx #1 {\tl_item:Nn \g__spath_output_tl {1}}
+ \tl_set:Nx #2 {\tl_item:Nn \g__spath_output_tl {2}}
+ \tl_gclear:N \g__spath_output_tl
+}
+\cs_generate_variant:Nn \spath_split_at_normalised:NNnn {NNVn, NNVV, NNnV, ccvn}
+\cs_new_protected_nopar:Npn \spath_gsplit_at_normalised:NNnn #1#2#3#4
+{
+ \__spath_split_at_normalised:nn {#3}{#4}
+ \tl_gset:Nx #1 {\tl_item:Nn \g__spath_output_tl {1}}
+ \tl_gset:Nx #2 {\tl_item:Nn \g__spath_output_tl {2}}
+ \tl_gclear:N \g__spath_output_tl
+}
+\cs_generate_variant:Nn \spath_gsplit_at_normalised:NNnn {NNVn, NNVV, NNnV, ccvn}
+\cs_new_protected_nopar:Npn \spath_split_at_normalised_keep_start:Nnn #1#2#3
+{
+ \__spath_split_at_normalised:nn {#2}{#3}
+ \tl_set:Nx #1 {\tl_item:Nn \g__spath_output_tl {1}}
+ \tl_gclear:N \g__spath_output_tl
+}
+\cs_generate_variant:Nn \spath_split_at_normalised_keep_start:Nnn {NVn}
+\cs_new_protected_nopar:Npn \spath_split_at_normalised_keep_start:Nn #1#2
+{
+ \spath_split_at_normalised_keep_start:NVn #1#1{#2}
+}
+\cs_generate_variant:Nn \spath_split_at_normalised_keep_start:Nn {cn}
+\cs_new_protected_nopar:Npn \spath_gsplit_at_normalised_keep_start:Nnn #1#2#3
+{
+ \__spath_split_at_normalised:nn {#2}{#3}
+ \tl_gset:Nx #1 {\tl_item:Nn \g__spath_output_tl {1}}
+ \tl_gclear:N \g__spath_output_tl
+}
+\cs_generate_variant:Nn \spath_gsplit_at_normalised_keep_start:Nnn {NVn}
+\cs_new_protected_nopar:Npn \spath_gsplit_at_normalised_keep_start:Nn #1#2
+{
+ \spath_gsplit_at_normalised_keep_start:NVn #1#1{#2}
+}
+\cs_generate_variant:Nn \spath_gsplit_at_normalised_keep_start:Nn {cn}
+\cs_new_protected_nopar:Npn \spath_split_at_normalised_keep_end:Nnn #1#2#3
+{
+ \__spath_split_at_normalised:nn {#2}{#3}
+ \tl_set:Nx #1 {\tl_item:Nn \g__spath_output_tl {2}}
+ \tl_gclear:N \g__spath_output_tl
+}
+\cs_generate_variant:Nn \spath_split_at_normalised_keep_end:Nnn {NVn}
+\cs_new_protected_nopar:Npn \spath_split_at_normalised_keep_end:Nn #1#2
+{
+ \spath_split_at_normalised_keep_end:NVn #1#1{#2}
+}
+\cs_generate_variant:Nn \spath_split_at_normalised_keep_end:Nn {cn}
+\cs_new_protected_nopar:Npn \spath_gsplit_at_normalised_keep_end:Nnn #1#2#3
+{
+ \__spath_split_at_normalised:nn {#2}{#3}
+ \tl_gset:Nx #1 {\tl_item:Nn \g__spath_output_tl {2}}
+ \tl_gclear:N \g__spath_output_tl
+}
+\cs_generate_variant:Nn \spath_gsplit_at_normalised_keep_end:Nnn {NVn}
+\cs_new_protected_nopar:Npn \spath_gsplit_at_normalised_keep_end:Nn #1#2
+{
+ \spath_gsplit_at_normalised_keep_end:NVn #1#1{#2}
+}
+\cs_generate_variant:Nn \spath_gsplit_at_normalised_keep_end:Nn {cn}
\cs_new_protected_nopar:Npn \spath_split_at:Nnn #1#2#3
{
\__spath_split_at:nn {#2}{#3}
@@ -2409,6 +3677,38 @@ manipulating PGF soft paths}
{
\spath_gsplit_at:NVn #1#1{#2}
}
+\cs_new_protected_nopar:Npn \spath_split_at_normalised:Nnn #1#2#3
+{
+ \__spath_split_at_normalised:nn {#2}{#3}
+ \tl_set:Nx #1
+ {
+ \tl_item:Nn \g__spath_output_tl {1}
+ \tl_item:Nn \g__spath_output_tl {2}
+ }
+ \tl_gclear:N \g__spath_output_tl
+}
+\cs_generate_variant:Nn \spath_split_at_normalised:Nnn {NVn, NVV}
+\cs_new_protected_nopar:Npn \spath_split_at_normalised:Nn #1#2
+{
+ \spath_split_at_normalised:NVn #1#1{#2}
+}
+\cs_generate_variant:Nn \spath_split_at_normalised:Nn {cn}
+\cs_new_protected_nopar:Npn \spath_gsplit_at_normalised:Nnn #1#2#3
+{
+ \__spath_split_at_normalised:nn {#2}{#3}
+ \tl_gset:Nx #1
+ {
+ \tl_item:Nn \g__spath_output_tl {1}
+ \tl_item:Nn \g__spath_output_tl {2}
+ }
+ \tl_gclear:N \g__spath_output_tl
+}
+\cs_generate_variant:Nn \spath_gsplit_at_normalised:Nnn {NVn, NVV}
+\cs_new_protected_nopar:Npn \spath_gsplit_at_normalised:Nn #1#2
+{
+ \spath_gsplit_at_normalised:NVn #1#1{#2}
+}
+\cs_generate_variant:Nn \spath_gsplit_at_normalised:Nn {cn}
\cs_new_protected_nopar:Npn \__spath_shorten_at_end:nn #1#2
{
\int_compare:nTF
@@ -2714,6 +4014,28 @@ manipulating PGF soft paths}
\spath_gshorten_at_start:NVn #1#1{#2}
}
\cs_generate_variant:Nn \spath_gshorten_at_start:Nn {cn, cV, NV}
+\cs_new_protected_nopar:Npn \spath_shorten_at_both_ends:Nnn #1#2#3
+{
+ \spath_shorten_at_start:Nnn #1{#2}{#3}
+ \spath_shorten_at_end:Nnn #1{#2}{#3}
+}
+\cs_new_protected_nopar:Npn \spath_shorten_at_both_ends:Nn #1#2
+{
+ \spath_shorten_at_start:Nn #1{#2}
+ \spath_shorten_at_end:Nn #1{#2}
+}
+\cs_generate_variant:Nn \spath_shorten_at_both_ends:Nn {cn, cV, NV}
+\cs_new_protected_nopar:Npn \spath_gshorten_at_both_ends:Nnn #1#2#3
+{
+ \spath_gshorten_at_start:Nnn #1{#2}{#3}
+ \spath_gshorten_at_end:Nnn #1{#2}{#3}
+}
+\cs_new_protected_nopar:Npn \spath_gshorten_at_both_ends:Nn #1#2
+{
+ \spath_gshorten_at_start:Nn #1{#2}
+ \spath_gshorten_at_end:Nn #1{#2}
+}
+\cs_generate_variant:Nn \spath_gshorten_at_both_ends:Nn {cn, cV, NV}
\cs_new_protected_nopar:Npn \__spath_point_at:nn #1#2
{
\group_begin:
@@ -2792,6 +4114,95 @@ manipulating PGF soft paths}
}
}
+ \c_spath_rectsize_tl
+ {
+ \fp_compare:nTF
+ {
+ \l__spath_tmpa_fp <= .25
+ }
+ {
+ \tl_set:Nx \l__spath_tmpc_tl
+ {
+ {\fp_to_dim:n
+ {
+ ( \tl_item:Nn \l__spath_tmpa_tl {2} )
+ +
+ 4 * \l__spath_tmpa_fp * ( \tl_item:Nn \l__spath_tmpa_tl {5} )
+ }
+ }
+ {\fp_to_dim:n {\tl_item:Nn \l__spath_tmpa_tl {3} } }
+ }
+ }
+ {
+ \fp_compare:nTF
+ {
+ \l__spath_tmpa_fp <= .5
+ }
+ {
+ \tl_set:Nx \l__spath_tmpc_tl
+ {
+ {\fp_to_dim:n
+ {
+ ( \tl_item:Nn \l__spath_tmpa_tl {2} )
+ +
+ ( \tl_item:Nn \l__spath_tmpa_tl {5} )
+ }
+ }
+ {\fp_to_dim:n
+ {
+ ( \tl_item:Nn \l__spath_tmpa_tl {3} )
+ +
+ (4 * (\l__spath_tmpa_fp) - 1) * ( \tl_item:Nn \l__spath_tmpa_tl {6} )
+ }
+ }
+ }
+ }
+ {
+ \fp_compare:nTF
+ {
+ \l__spath_tmpa_fp <= .75
+ }
+ {
+ \tl_set:Nx \l__spath_tmpc_tl
+ {
+ {\fp_to_dim:n
+ {
+ ( \tl_item:Nn \l__spath_tmpa_tl {2} )
+ +
+ (3 - 4 * (\l__spath_tmpa_fp)) *( \tl_item:Nn \l__spath_tmpa_tl {5} )
+ }
+ }
+ {\fp_to_dim:n
+ {
+ ( \tl_item:Nn \l__spath_tmpa_tl {3} )
+ +
+ ( \tl_item:Nn \l__spath_tmpa_tl {6} )
+ }
+ }
+ }
+
+ }
+ {
+ \tl_set:Nx \l__spath_tmpc_tl
+ {
+ {\fp_to_dim:n
+ {
+ ( \tl_item:Nn \l__spath_tmpa_tl {2} )
+ }
+ }
+ {\fp_to_dim:n
+ {
+ ( \tl_item:Nn \l__spath_tmpa_tl {3} )
+ +
+ (4 - 4 *(\l__spath_tmpa_fp)) * ( \tl_item:Nn \l__spath_tmpa_tl {6} )
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
\c_spath_closepath_tl
{
\tl_set:Nx \l__spath_tmpc_tl
@@ -2937,6 +4348,71 @@ manipulating PGF soft paths}
}
}
+ \c_spath_rectsize_tl
+ {
+ \fp_compare:nTF
+ {
+ \l__spath_tmpa_fp <= .25
+ }
+ {
+ \tl_set:Nx \l__spath_tmpc_tl
+ {
+ {\fp_to_dim:n
+ {
+ \tl_item:Nn \l__spath_tmpa_tl {5}
+ }
+ }
+ {0pt}
+ }
+ }
+ {
+ \fp_compare:nTF
+ {
+ \l__spath_tmpa_fp <= .5
+ }
+ {
+ \tl_set:Nx \l__spath_tmpc_tl
+ {
+ {0pt}
+ {\fp_to_dim:n
+ {
+ ( \tl_item:Nn \l__spath_tmpa_tl {6} )
+ }
+ }
+ }
+ }
+ {
+ \fp_compare:nTF
+ {
+ \l__spath_tmpa_fp <= .75
+ }
+ {
+ \tl_set:Nx \l__spath_tmpc_tl
+ {
+ {\fp_to_dim:n
+ {
+ -( \tl_item:Nn \l__spath_tmpa_tl {5} )
+ }
+ }
+ {0pt}
+ }
+
+ }
+ {
+ \tl_set:Nx \l__spath_tmpc_tl
+ {
+ {0pt}
+ {\fp_to_dim:n
+ {
+ - ( \tl_item:Nn \l__spath_tmpa_tl {6} )
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
\c_spath_closepath_tl
{
\tl_set:Nx \l__spath_tmpc_tl
@@ -3083,19 +4559,21 @@ manipulating PGF soft paths}
\tl_set:Nn \l__spath_tmpb_tl {#1}
\tl_set:Nn \l__spath_tmpc_tl {#2}
- \spath_reallength:Nn \l__spath_tmpa_int {#1}
-
% Remember if the component is closed
\spath_finalaction:NV \l__spath_tmpa_tl \l__spath_tmpb_tl
\bool_set:Nn \l__spath_closed_bool
{
\tl_if_eq_p:NN \l__spath_tmpa_tl \c_spath_closepath_tl
+ ||
+ \tl_if_eq_p:NN \l__spath_tmpa_tl \c_spath_rectcorner_tl
}
% Open it
\spath_open:N \l__spath_tmpb_tl
+ \spath_reallength:NV \l__spath_tmpa_int \l__spath_tmpb_tl
+
% Sort intersections along the component
\pgfintersectionsortbyfirstpath
\spath_intersect:NN \l__spath_tmpb_tl \l__spath_tmpc_tl
@@ -3118,6 +4596,7 @@ manipulating PGF soft paths}
{
\bool_set_false:N \l__spath_closed_bool
}
+
\seq_get_right:NN \l__spath_tmpb_seq \l__spath_tmpa_tl
\fp_compare:nT
{
@@ -3925,11 +5404,13 @@ manipulating PGF soft paths}
{
\pgfsyssoftpath@getcurrentpath #1
}
+\cs_generate_variant:Nn \spath_get_current_path:N {c}
\cs_new_protected_nopar:Npn \spath_gget_current_path:N #1
{
\pgfsyssoftpath@getcurrentpath #1
\tl_gset_eq:NN #1 #1
}
+\cs_generate_variant:Nn \spath_gget_current_path:N {c}
\cs_new_protected_nopar:Npn \spath_protocol_path:n #1
{
\spath_minbb:Nn \l__spath_tmpa_tl {#1}
@@ -3958,10 +5439,13 @@ manipulating PGF soft paths}
}
\cs_new_protected_nopar:Npn \spath_tikz_path:nn #1#2
{
- \path[#1] \pgfextra{
- \spath_set_current_path:n {#2}
- \tl_put_right:Nn \tikz@preactions {\def\tikz@actions@path{#2}}
- };
+ \tl_if_empty:nF {#2}
+ {
+ \path[#1] \pgfextra{
+ \spath_set_current_path:n {#2}
+ \tl_put_left:Nn \tikz@preactions {\def\tikz@actions@path{#2}}
+ };
+ }
}
\cs_generate_variant:Nn \spath_tikz_path:nn {Vn, VV, nv, Vv, nV}
\cs_new_protected_nopar:Npn \spath_set_tikz_data:n #1
@@ -3969,8 +5453,8 @@ manipulating PGF soft paths}
\spath_finalpoint:Nn \l__spath_tmpa_tl {#1}
\tl_set:Nx \l__spath_tmpa_tl
{
- \exp_not:c {pgf@x}=\tl_item:Nn \l__spath_tmpa_tl {1}
- \exp_not:c {pgf@y}=\tl_item:Nn \l__spath_tmpa_tl {2}
+ \exp_not:c {pgf@x}=\tl_item:Nn \l__spath_tmpa_tl {1} \relax
+ \exp_not:c {pgf@y}=\tl_item:Nn \l__spath_tmpa_tl {2} \relax
}
\use:c {pgf@process}{%
\tl_use:N \l__spath_tmpa_tl
@@ -3979,32 +5463,41 @@ manipulating PGF soft paths}
}
\tl_set:Nx \l__spath_tmpa_tl
{
- \exp_not:c {tikz@lastx}=\exp_not:c {pgf@x}
- \exp_not:c {tikz@lasty}=\exp_not:c {pgf@y}
- \exp_not:c {tikz@lastxsaved}=\exp_not:c {pgf@x}
- \exp_not:c {tikz@lastysaved}=\exp_not:c {pgf@y}
+ \exp_not:c {tikz@lastx}=\exp_not:c {pgf@x} \relax
+ \exp_not:c {tikz@lasty}=\exp_not:c {pgf@y} \relax
+ \exp_not:c {tikz@lastxsaved}=\exp_not:c {pgf@x} \relax
+ \exp_not:c {tikz@lastysaved}=\exp_not:c {pgf@y} \relax
}
\tl_use:N \l__spath_tmpa_tl
\spath_finalmovepoint:Nn \l__spath_tmpa_tl {#1}
- \ifpgfsyssoftpathmovetorelevant%
- \tl_gset_eq:cN {pgfsyssoftpath@lastmoveto} \l__spath_tmpa_tl
- \fi
+ \bool_if:NT \l_spath_movetorelevant_bool
+ {
+ \ifpgfsyssoftpathmovetorelevant%
+ \tl_gset_eq:cN {pgfsyssoftpath@lastmoveto} \l__spath_tmpa_tl
+ \fi
+ }
\tl_set:Nx \l__spath_tmpa_tl
{
- \exp_not:c {pgf@x}=\tl_item:Nn \l__spath_tmpa_tl {1}
- \exp_not:c {pgf@y}=\tl_item:Nn \l__spath_tmpa_tl {2}
+ \exp_not:c {pgf@x}=\tl_item:Nn \l__spath_tmpa_tl {1} \relax
+ \exp_not:c {pgf@y}=\tl_item:Nn \l__spath_tmpa_tl {2} \relax
}
\use:c {pgf@process}{%
\tl_use:N \l__spath_tmpa_tl
\pgftransforminvert
\use:c {pgf@pos@transform@glob}
}
- \tl_set:Nx \l__spath_tmpa_tl
+ \bool_if:NT \l_spath_movetorelevant_bool
{
- \exp_not:c {tikz@lastmovetox}=\exp_not:c {pgf@x}
- \exp_not:c {tikz@lastmovetoy}=\exp_not:c {pgf@y}
+ \dim_if_exist:cT {tikz@lastmovetox}
+ {
+ \tl_set:Nx \l__spath_tmpa_tl
+ {
+ \exp_not:c {tikz@lastmovetox}=\exp_not:c {pgf@x} \relax
+ \exp_not:c {tikz@lastmovetoy}=\exp_not:c {pgf@y} \relax
+ }
+ \tl_use:N \l__spath_tmpa_tl
+ }
}
- \tl_use:N \l__spath_tmpa_tl
\tl_clear_new:c {tikz@timer}
\tl_set:cn {tikz@timer}
{
diff --git a/Master/texmf-dist/tex/latex/spath3/tikzlibraryknots.code.tex b/Master/texmf-dist/tex/latex/spath3/tikzlibraryknots.code.tex
index c6ae085925a..f075665178c 100644
--- a/Master/texmf-dist/tex/latex/spath3/tikzlibraryknots.code.tex
+++ b/Master/texmf-dist/tex/latex/spath3/tikzlibraryknots.code.tex
@@ -59,6 +59,7 @@
\bool_new:N \l__knot_append_next_bool
\bool_new:N \l__knot_skip_bool
\bool_new:N \l__knot_save_bool
+\bool_new:N \l__knot_debugging_bool
\seq_new:N \g__knot_nodes_seq
@@ -191,6 +192,14 @@
\bool_set_true:N \l__knot_draft_bool
\bool_set_true:N \l__knot_super_draft_bool
},
+ debug/.is~ choice,
+ debug/true/.code={
+ \bool_set_true:N \l__knot_debugging_bool
+ },
+ debug/false/.code={
+ \bool_set_false:N \l__knot_debugging_bool
+ },
+ debug/.default=true,
draft/.is~ family,
draft,
crossing~ label/.style={
@@ -212,8 +221,18 @@
inner~ sep=0pt
},
}
+\cs_new_nopar:Npn \knot_debug:n #1
+{
+ \bool_if:NT \l__knot_debugging_bool
+ {
+ \iow_term:n {===Knot~ debug: #1===}
+ }
+}
+
+\cs_generate_variant:Nn \knot_debug:n {x}
\cs_new_nopar:Npn \knot_apply_style:N #1
{
+ \knot_debug:n {knot~ apply~ style}
\tl_if_exist:NT #1 {
\exp_args:NV \tikzset #1
}
@@ -239,6 +258,7 @@
}
\cs_new_protected_nopar:Npn \knot_initialise:n #1
{
+ \knot_debug:n {knot~ initialise}
\tikzset{knot~ diagram/.cd,every~ knot~ diagram/.try,#1}
\int_zero:N \l__knot_strands_int
\tl_clear:N \l__knot_redraws_tl
@@ -246,6 +266,7 @@
}
\cs_new_protected_nopar:Npn \knot_render:
{
+ \knot_debug:n {knot~ render}
\pgfscope
\pgftransformreset
\dim_set:Nn \l__knot_redraw_tolerance_dim {\fp_to_dim:n
@@ -296,9 +317,12 @@
\seq_use:Nn \g__knot_nodes_seq {}
}
\endpgfscope
+ \knot_debug:x {knot~rendered,
+ ~found~\int_use:N \g__knot_intersections_int \c_space_tl~intersections}
}
\cs_new_protected_nopar:Npn \knot_draw_strand:n #1
{
+ \knot_debug:n {knot~ draw~ strand~ #1}
\pgfscope
\group_begin:
\spath_bake_round:c {knot strand #1}
@@ -308,7 +332,7 @@
{
,
knot~ diagram/only~ when~ rendering/.try,
- only~ when~ rendering/.try
+ only~ when~ rendering/.try,
}
\spath_tikz_path:Vv \l__knot_tmpa_tl {knot strand #1}
\group_end:
@@ -317,6 +341,7 @@
\cs_generate_variant:Nn \tl_put_right:Nn {Nv}
\cs_new_protected_nopar:Npn \knot_draw_labels:n #1
{
+ \knot_debug:n {knot~ draw~ labels}
\bool_if:NT \l__knot_draft_bool
{
\spath_finalpoint:Nv \l__knot_tmpb_tl {knot strand #1}
@@ -348,6 +373,7 @@
}
\cs_new_protected_nopar:Npn \knot_split_self_intersects:N #1
{
+ \knot_debug:n {knot~ split~ self~ intersects}
\tl_set:Nx \l__knot_tmpc_tl {\tl_item:nn {#1} {4}}
\tl_case:NnF \l__knot_tmpc_tl
{
@@ -385,9 +411,11 @@
}
{
\fp_set:Nn \l__knot_tmpa_fp {.5 * \l__knot_tmpa_fp / \l__knot_tmpb_fp}
- \fp_compare:nTF
+ \bool_if:nTF
{
- 0 < \l__knot_tmpa_fp && \l__knot_tmpa_fp < 1
+ \fp_compare_p:n {0 < \l__knot_tmpa_fp}
+ &&
+ \fp_compare_p:n {\l__knot_tmpa_fp < 1}
}
{
\spath_split_curve:NNnV
@@ -435,6 +463,8 @@
}
\cs_new_protected_nopar:Npn \knot_intersections:nn #1#2
{
+ \knot_debug:x {knot~ intersections~ between~
+ \l__knot_prefix_tl \c_space_tl #1~ and~ #2}
\group_begin:
\tl_set_eq:NN \l__knot_tmpa_tl \l__knot_prefix_tl
\tl_put_right:Nn \l__knot_tmpa_tl {#1}
@@ -466,6 +496,7 @@
}
+ \knot_debug:x {found~\pgfintersectionsolutions\c_space_tl~ intersections}
\int_compare:nT {\pgfintersectionsolutions > 0}
{
\int_step_function:nnnN
@@ -480,6 +511,7 @@
}
\cs_new_protected_nopar:Npn \knot_save_intersections:nn #1#2
{
+ \knot_debug:n {knot~ save~ intersections}
\bool_if:NT \l__knot_save_bool
{
\tl_clear:N \l__knot_aux_tl
@@ -527,9 +559,12 @@
\cs_generate_variant:Nn \knot_save_intersections:nn {VV}
\cs_new_protected_nopar:Npn \knot_do_intersection:n #1
{
+ \knot_debug:n {knot~ do~ intersection~ #1}
\pgfpointintersectionsolution{#1}
\dim_set:Nn \l__knot_tmpa_dim {\pgf@x}
\dim_set:Nn \l__knot_tmpb_dim {\pgf@y}
+ \knot_debug:x {intersection~at~
+ (\dim_use:N \l__knot_tmpa_dim,\dim_use:N \l__knot_tmpb_dim)}
\bool_set_false:N \l__knot_skip_bool
\bool_if:NT \l__knot_self_intersections_bool
{
@@ -578,6 +613,7 @@
{
\int_gincr:N \g__knot_intersections_int
+ \knot_debug:x {Processing~intersection~\int_use:N \g__knot_intersections_int}
\bool_if:nF
{
\tl_if_exist_p:c {l__knot_ignore_crossing_ \int_use:N
@@ -643,6 +679,8 @@
!\tl_if_empty_p:c {knot previous \tl_use:N \l__knot_tmpg_tl}
}
{
+ \knot_debug:x {Prepending~
+ \tl_use:c {knot previous \tl_use:N \l__knot_tmpg_tl}}
\spath_prepend_no_move:cv
{knot \tl_use:N \l__knot_prefix_tl -1}
{knot \tl_use:c {knot previous \tl_use:N \l__knot_tmpg_tl}}
@@ -650,9 +688,13 @@
{
\l__knot_splits_bool
&&
- \tl_if_exist_p:c {knot previous \tl_use:N \l__knot_tmpg_tl}
+ \tl_if_exist_p:c {knot previous
+ \tl_use:c {knot previous \tl_use:N \l__knot_tmpg_tl}
+ }
&&
- !\tl_if_empty_p:c {knot previous \tl_use:N \l__knot_tmpg_tl}
+ !\tl_if_empty_p:c {knot previous
+ \tl_use:c {knot previous \tl_use:N \l__knot_tmpg_tl}
+ }
}
{
\knot_test_endpoint:NvnT
@@ -660,6 +702,11 @@
{knot previous \tl_use:N \l__knot_tmpg_tl}
{initial point}
{
+ \knot_debug:x {Prepending~
+ \tl_use:c {knot previous
+ \tl_use:c {knot previous \tl_use:N \l__knot_tmpg_tl}
+ }
+ }
\spath_prepend_no_move:cv
{knot \tl_use:N \l__knot_prefix_tl -1}
{knot \tl_use:c
@@ -667,19 +714,23 @@
{knot previous \tl_use:N \l__knot_tmpg_tl}
}
}
- \tl_set_eq:Nc \l__knot_tmpa_tl {knot \tl_use:N \l__knot_prefix_tl -1}
+ \tl_set_eq:Nc \l__knot_tmpa_tl
+ {knot \tl_use:N \l__knot_prefix_tl -1}
}
}
}
+
\bool_if:nT
{
\l__knot_append_next_bool
&&
\tl_if_exist_p:c {knot next \tl_use:N \l__knot_tmpg_tl}
&&
- !\tl_if_empty_p:c {knot previous \tl_use:N \l__knot_tmpg_tl}
+ !\tl_if_empty_p:c {knot next \tl_use:N \l__knot_tmpg_tl}
}
{
+ \knot_debug:x {Appending~
+ \tl_use:c {knot next \tl_use:N \l__knot_tmpg_tl}}
\spath_append_no_move:cv
{knot \tl_use:N \l__knot_prefix_tl -1}
{knot \tl_use:c {knot next \tl_use:N \l__knot_tmpg_tl}}
@@ -687,17 +738,25 @@
{
\l__knot_splits_bool
&&
- \tl_if_exist_p:c {knot previous \tl_use:N
- \l__knot_tmpg_tl}
+ \tl_if_exist_p:c {knot next \tl_use:c { knot next \tl_use:N
+ \l__knot_tmpg_tl}}
&&
- !\tl_if_empty_p:c {knot previous \tl_use:N \l__knot_tmpg_tl}
+ !\tl_if_empty_p:c {knot next
+ \tl_use:c { knot next \tl_use:N \l__knot_tmpg_tl}
+ }
}
{
+ \knot_debug:x {Testing~ whether~ to~ append~
+ {knot next \tl_use:c { knot next \tl_use:N \l__knot_tmpg_tl}}
+ }
\knot_test_endpoint:NvnT
\l__knot_redraw_tolerance_dim
- {knot previous \tl_use:N \l__knot_tmpg_tl}
+ {knot next \tl_use:N \l__knot_tmpg_tl}
{final point}
{
+ \knot_debug:x {Appending~
+ {knot next \tl_use:c { knot next \tl_use:N \l__knot_tmpg_tl}}
+ }
\spath_append_no_move:cv
{knot \tl_use:N \l__knot_prefix_tl -1}
{knot \tl_use:c
@@ -773,6 +832,7 @@
\cs_generate_variant:Nn \knot_test_endpoint:NnnTF {NVnTF,NvnTF}
\cs_new_protected_nopar:Npn \knot_draw_crossing:nnn #1#2#3
{
+ \knot_debug:n {knot~ draw~ crossing}
\group_begin:
\pgfscope
\path[knot~ diagram/background~ clip] (#2, #3)
@@ -821,17 +881,20 @@
}
\cs_new_protected_nopar:Npn \knot_split_strands:
{
+ \knot_debug:n {knot~ split~ strands}
\int_gzero:N \g__knot_filaments_int
\int_step_function:nnnN {1} {1} {\l__knot_strands_int} \knot_split_strand:n
\int_step_function:nnnN {1} {1} {\g__knot_filaments_int} \knot_compute_nexts:n
}
\cs_new_protected_nopar:Npn \knot_compute_nexts:n #1
{
+ \knot_debug:n {knot~ compute~ nexts}
\tl_clear_new:c {knot next \tl_use:c {knot previous filament #1}}
\tl_set:cn {knot next \tl_use:c {knot previous filament #1}} {filament #1}
}
\cs_new_protected_nopar:Npn \knot_split_strand:n #1
{
+ \knot_debug:n {knot~ split~ strand}
\int_set_eq:NN \l__knot_component_start_int \g__knot_filaments_int
\int_incr:N \l__knot_component_start_int
\tl_set_eq:Nc \l__knot_tmpa_tl {l__knot_options_strand #1}
@@ -840,6 +903,7 @@
}
\cs_new_protected_nopar:Npn \knot_save_filament:N #1
{
+ \knot_debug:n {knot~ save~ filament}
\tl_set:Nx \l__knot_tmpb_tl {\tl_item:nn {#1} {4}}
\tl_case:NnF \l__knot_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 bd81706e3b9..47f61c587d7 100644
--- a/Master/texmf-dist/tex/latex/spath3/tikzlibraryspath3.code.tex
+++ b/Master/texmf-dist/tex/latex/spath3/tikzlibraryspath3.code.tex
@@ -16,32 +16,78 @@
\RequirePackage{expl3}
\ExplSyntaxOn
-\tl_new:N \l__spath_current_tl
-\tl_new:N \l__spath_reverse_tl
-\tl_new:N \l__spath_prefix_tl
-\tl_new:N \l__spath_suffix_tl
-\tl_new:N \g__spath_smuggle_tl
-\seq_new:N \g__spath_tmpa_seq
-\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:nnnn { spath3 } { empty soft path } { Soft~ path~ #1~ is~ empty}
+\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__spath_prefix_tl {tikz@intersect@path@name@}
-\tl_set:Nn \l__spath_suffix_tl {}
-\tl_new:N \g__spath_tikzfinish_tl
+{ 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__spath_tikzfinish_tl
- \tl_gclear:N \g__spath_tikzfinish_tl
+ \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_gput_right:Nn \g__spath_tikzfinish_tl
+ \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}
@@ -51,36 +97,214 @@
\cs_new_protected_nopar:Npn \spath_gsave_path:Nn #1#2
{
- \tl_gput_right:Nn \g__spath_tikzfinish_tl
+ \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 \__spath_process_tikz_point:Nn #1#2
+\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__spath_output_tl
+ \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__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_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}
{
@@ -94,230 +318,804 @@
spath/join/.is~ family,
spath/join/.cd,
reverse/.code = {
- \__spath_set_bool:Nn \l__spath_reverse_bool {#1}
+ \__tikzspath_set_bool:Nn \l__tikzspath_reverse_bool {#1}
},
reverse/.default = true,
weld/.code = {
- \__spath_set_bool:Nn \l__spath_weld_bool {#1}
+ \__tikzspath_set_bool:Nn \l__tikzspath_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}
+ \__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 = {
- \__spath_set_bool:Nn \l__spath_move_bool {#1}
+ \__tikzspath_set_bool:Nn \l__tikzspath_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}
+ \__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 = {
- \__spath_set_bool:Nn \l__spath_global_bool {#1}
+ \__tikzspath_set_bool:Nn \l__tikzspath_global_bool {#1}
},
global/.default = true,
- transform/.store~in=\l__spath_transformation_tl,
+ 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__spath_joinpath_tl \pgfkeyscurrentname
+ \tl_set_eq:NN \l__tikzspath_joinpath_tl \pgfkeyscurrentname
}
}
\cs_set_eq:NN \getComponentOf \clist_item:Nn
-\tikzset{
- spath/.is~family,
- spath/.cd,
- set~ prefix/.store~ in=\l__spath_prefix_tl,
- prefix/.is~choice,
- prefix/default/.style={
- /tikz/spath/set~ prefix=tikz@intersect@path@name@
- },
- set~ suffix/.store~ in=\l__spath_suffix_tl,
- suffix/.is~choice,
- suffix/default/.style={
- /tikz/spath/set~ suffix={}
- },
- set~ name/.style={
- /tikz/spath/prefix=#1,
- /tikz/spath/suffix=#1
- },
- save/.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_save_path:cV
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- \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
+\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
}
- },
- clone/.code~ 2~ args={
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #2 \tl_use:N \l__spath_suffix_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_clear_new:c
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- \tl_set_eq: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}
+ \tl_set:Nn \l__tikzspath_tmpc_tl { {0pt} {0pt} }
}
{
- \msg_warning:nnn { spath3 } { missing soft path } { #2 }
+ \spath_finalpoint:NV
+ \l__tikzspath_tmpc_tl
+ \l__tikzspath_current_tl
}
- },
- clone~ global/.code~ 2~ args={
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #2 \tl_use:N \l__spath_suffix_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_gclear_new:c
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- \tl_gset_eq: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}
+ \tl_set_eq:NN \l__tikzspath_current_tl \c_spath_moveto_tl
+ \tl_put_right:Nn \l__tikzspath_current_tl {{0pt}{0pt}}
}
{
- \msg_warning:nnn { spath3 } { missing soft path } { #2 }
+ \tl_set_eq:NN \l__tikzspath_current_tl \l__tikzspath_joinpath_tl
}
- },
- save~ to~ aux/.code={
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_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
{
- \spath_save_to_aux:c
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ \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
{
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
+ \spath_transform:Nnnnnnn
+ \l__tikzspath_joinpath_tl
}
- },
- export~ to~ svg/.code={
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_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
{
- \spath_export_to_svg:nv {#1}
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ ##1 == \l__tikzspath_tmpb_tl
}
{
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
+ \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}
}
- },
- 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_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
+ }
- \tl_if_exist:cTF
+ \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
{
- \tl_use:N \l__spath_prefix_tl
- \tl_use:N \l__spath_joinpath_tl
- \tl_use:N \l__spath_suffix_tl
+ ##1 == \l__tikzspath_tmpb_tl
}
{
- \tl_if_empty:cT
+ \seq_pop_left:NNF \l__tikzspath_tmpb_seq \l__tikzspath_tmpb_tl
{
- \tl_use:N \l__spath_prefix_tl
- \tl_use:N \l__spath_joinpath_tl
- \tl_use:N \l__spath_suffix_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
{
- \msg_warning:nnn { spath3 } { empty soft path } { #1 }
+ \tl_item:Nn \l__tikzspath_tmpe_tl {1}
+ >
+ \tl_item:Nn \l__tikzspath_tmpf_tl {1}
}
- \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
+ \spath_splice_between:NVn
+ \l__tikzspath_tmpa_tl
+ \l__tikzspath_tmpd_tl
+ {##2}
}
- \spath_get_current_path:N \l__spath_current_tl
-
- \bool_if:NT \l__spath_reverse_bool
{
- \spath_reverse:N \l__spath_joinpath_tl
+ \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:NF \l__spath_transformation_tl
+ \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
{
- \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
+ \int_mod:nn { ##1 }{ \l__tikzspath_tmpa_int } + 1
}
+ }
+ }
- \bool_if:NT \l__spath_move_bool
+ \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
{
- \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
+ \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
- \tl_if_empty:NTF \l__spath_current_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_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_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:
- \tl_clear:N \l__spath_tmpa_tl
- \tl_set:Nn \l__spath_tmpa_tl {spath_}
+ \spath_numberofcomponents:Nn \l__tikzspath_tmpa_int {#1}
+ \__tikzspath_seq_from_foreach:NVn \l__tikzspath_tmpa_seq \l__tikzspath_tmpa_int {#2}
- \tl_put_right:Nn \l__spath_tmpa_tl {append}
+ \spath_components_to_seq:Nn \l__tikzspath_tmpb_seq {#1}
- \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}
+ \seq_pop_left:NNF \l__tikzspath_tmpa_seq \l__tikzspath_tmpa_tl
+ {
+ \tl_clear:N \l__tikzspath_tmpa_tl
+ }
- \use:c {\tl_use:N \l__spath_tmpa_tl }
- \l__spath_current_tl
- \l__spath_joinpath_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}
+ }
+ }
- \spath_set_current_path:N \l__spath_current_tl
- \spath_set_tikz_data:V \l__spath_joinpath_tl
+ \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
{
- \msg_warning:nnx
- { spath3 }
- { missing soft path }
- {\tl_use:N \l__spath_joinpath_tl }
+ \__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}},
@@ -329,914 +1127,534 @@
insert~ reverse/.style={/tikz/spath/use={reverse, #1}},
show~current~path/.code={
\tikz@addmode{
- \pgfsyssoftpath@getcurrentpath\l__spath_tmpa_tl
+ \pgfsyssoftpath@getcurrentpath\l__tikzspath_tmpa_tl
\iow_term:n {---~ current~ soft~ path~ ---}
- \spath_show:V \l__spath_tmpa_tl
+ \spath_show:V \l__tikzspath_tmpa_tl
}
},
show/.code={
- \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}
- {
- \msg_warning:nnn { spath3 } { empty soft path } { #1 }
- }
- {
- \iow_term:n {---~ soft~ path~ #1~ ---}
- \spath_show:v
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- }
- }
- {
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
- }
+ \__tikzspath_check_path:nnn {
+ \iow_term:n {---~ soft~ path~ #1~ ---}
+ \spath_show:v
+ } {#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
- \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
- }
+ \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
+ }
- \use:c {\tl_use:N \l__spath_tmpa_tl }
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- \l__spath_joinpath_tl
- }
+ \__tikzspath_maybe_current_path_reuse:nnn
+ {
+ \__tikzspath_check_two_paths:nnVn
{
- \msg_warning:nnx
- { spath3 }
- { missing soft path }
- {\tl_use:N \l__spath_joinpath_tl }
+ \__tikzspath_join_with:cv
}
- }
- {
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
- }
+ } {#1} { \l__tikzspath_joinpath_tl {} }
},
spot~ weld/.code={
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #1 \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}
- }
+ \__tikzspath_maybe_current_path_reuse:nnn
{
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
- }
+ \__tikzspath_check_path:nnn
+ {
+ \spath_spot_weld_components:c
+ }
+ } {#1} { {} }
},
spot~ weld~ globally/.code={
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #1 \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}
- }
+ \__tikzspath_maybe_current_path_reuse:nnn
{
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
- }
+ \__tikzspath_check_path:nnn
+ {
+ \spath_spot_gweld_components:c
+ }
+ } {#1} { {} }
},
reverse/.code={
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ \__tikzspath_maybe_current_path_reuse:nnn
{
- \spath_reverse:c
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- }
- {
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
- }
+ \__tikzspath_check_path:nnn
+ {
+ \spath_reverse:c
+ }
+ } {#1} { {} }
},
reverse~ globally/.code={
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- {
- \spath_reverse:c
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- }
+ \__tikzspath_maybe_current_path_reuse:nnn
{
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
- }
+ \__tikzspath_check_path:nnn
+ {
+ \spath_greverse:c
+ }
+ } {#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}
+ \__tikzspath_maybe_current_path_reuse:nnn
{
- \__spath_process_tikz_point:Nn \l__spath_tmpa_tl {#2}
- \__spath_process_tikz_point:Nn \l__spath_tmpb_tl {#3}
- \spath_span:cVV
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- \l__spath_tmpa_tl \l__spath_tmpb_tl
- }
- {
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
- }
+ \__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}{
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- {
- \__spath_process_tikz_point:Nn \l__spath_tmpa_tl {#2}
- \__spath_process_tikz_point:Nn \l__spath_tmpb_tl {#3}
- \spath_gspan:cVV
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- \l__spath_tmpa_tl \l__spath_tmpb_tl
- }
+ \__tikzspath_maybe_current_path_reuse:nnn
{
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
- }
+ \__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/append~no~move={#1},
+ spath/use={#1,weld},
]
\tikztonodes
}
},
splice/.code ~n~ args={3}{
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ \__tikzspath_maybe_current_path_reuse:nnn
{
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #2 \tl_use:N \l__spath_suffix_tl}
+ \__tikzspath_check_three_paths:nnnnn
{
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #3 \tl_use:N \l__spath_suffix_tl}
- {
- \spath_splice_between:cvv
- {\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}
- {\tl_use:N \l__spath_prefix_tl #3 \tl_use:N \l__spath_suffix_tl}
- }
- {
- \msg_warning:nnn { spath3 } { missing soft path } { #3 }
- }
+ \spath_splice_between:cvv
}
+ } {#1} { {#2} {#3} {} }
+ },
+ splice~ global/.code ~n~ args={3}{
+ \__tikzspath_maybe_current_path_reuse:nnn
+ {
+ \__tikzspath_check_three_paths:nnnnn
{
- \msg_warning:nnn { spath3 } { missing soft path } { #2 }
+ \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} }
}
{
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
+ \tl_set:Nn \l__tikzspath_tmpc_tl {#2}
+ \tl_clear:N \l__tikzspath_tmpd_tl
}
- },
- splice~ global/.code ~n~ args={3}{
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+
+ \__tikzspath_maybe_current_path_reuse:nnn
{
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #2 \tl_use:N \l__spath_suffix_tl}
- {
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #3 \tl_use:N \l__spath_suffix_tl}
- {
- \spath_gsplice_between:cvv
- {\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}
- {\tl_use:N \l__spath_prefix_tl #3 \tl_use:N \l__spath_suffix_tl}
- }
- {
- \msg_warning:nnn { spath3 } { missing soft path } { #3 }
- }
- }
+ \__tikzspath_check_two_paths:nnVn
{
- \msg_warning:nnn { spath3 } { missing soft path } { #2 }
+ \__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} }
}
{
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
+ \tl_set:Nn \l__tikzspath_tmpc_tl {#2}
+ \tl_clear:N \l__tikzspath_tmpd_tl
}
- },
- 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}
+
+ \__tikzspath_maybe_current_path_reuse:nnn
{
- \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} }
- }
+ \__tikzspath_check_two_paths:nnVn
{
- \tl_set:Nn \l__spath_tmpc_tl {#2}
- \tl_clear:N \l__spath_tmpd_tl
+ \__tikzspath_gjoin_components_with:cvV
}
- \tl_if_exist:cTF
+ } {#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
{
- \tl_use:N \l__spath_prefix_tl
- \tl_use:N \l__spath_tmpc_tl
- \tl_use:N \l__spath_suffix_tl
+ \__tikzspath_join_components_upright_with:cvV
}
- {
- \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
+ } {#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
+ }
- \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
- }
+ \__tikzspath_maybe_current_path_reuse:nnn
+ {
+ \__tikzspath_check_two_paths:nnVn
{
- \msg_warning:nnx
- { spath3 }
- { missing soft path }
- { \tl_use:N \l__spath_tmpc_tl }
+ \__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} }
}
{
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
+ \tl_set:Nn \l__tikzspath_tmpc_tl {#1}
+ \tl_clear:N \l__tikzspath_tmpd_tl
}
- },
- 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}
+
+ \__tikzspath_maybe_current_path_reuse:nVn
{
- \tl_if_head_is_group:nTF {#2}
+ \__tikzspath_check_path:nnn
{
- \tl_set:Nx \l__spath_tmpc_tl { \tl_item:nn {#2} {1} }
- \tl_set:Nx \l__spath_tmpd_tl { \tl_item:nn {#2} {2} }
+ \__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
{
- \tl_set:Nn \l__spath_tmpc_tl {#2}
- \tl_clear:N \l__spath_tmpd_tl
+ \__tikzspath_gjoin_components_with_bezier:cn
}
- \tl_if_exist:cTF
+ } {#1} { {} {#2} }
+ },
+ close/.code={
+ \__tikzspath_maybe_current_path_reuse:nnn
+ {
+ \__tikzspath_check_path:nnn
{
- \tl_use:N \l__spath_prefix_tl
- \tl_use:N \l__spath_tmpc_tl
- \tl_use:N \l__spath_suffix_tl
+ \spath_close:c
}
+ } {#1} { {} }
+ },
+ close~ globally/.code={
+ \__tikzspath_maybe_current_path_reuse:nnn
+ {
+ \__tikzspath_check_path:nnn
{
- \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
+ \spath_gclose:c
}
+ } {#1} { {} }
+ },
+ open/.code={
+ \__tikzspath_maybe_current_path_reuse:nnn
+ {
+ \__tikzspath_check_path:nnn
{
- \msg_warning:nnx
- { spath3 }
- { missing soft path }
- { \tl_use:N \l__spath_tmpc_tl }
+ \spath_open:c
}
- }
- {
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
- }
+ } {#1} { {} }
},
- 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}
+ open~ globally/.code={
+ \__tikzspath_maybe_current_path_reuse:nnn
{
- \tl_if_head_is_group:nTF {#2}
+ \__tikzspath_check_path:nnn
{
- \tl_set:Nx \l__spath_tmpc_tl { \tl_item:nn {#2} {1} }
- \tl_set:Nx \l__spath_tmpd_tl { \tl_item:nn {#2} {2} }
+ \spath_gopen:c
}
+ } {#1} { {} }
+ },
+ adjust~ and~ close/.code={
+ \__tikzspath_maybe_current_path_reuse:nnn
+ {
+ \__tikzspath_check_path:nnn
{
- \tl_set:Nn \l__spath_tmpc_tl {#2}
- \tl_clear:N \l__spath_tmpd_tl
+ \spath_adjust_close:c
}
- \tl_if_exist:cTF
+ } {#1} { {} }
+ },
+ adjust~ and~ close~ globally/.code={
+ \__tikzspath_maybe_current_path_reuse:nnn
+ {
+ \__tikzspath_check_path:nnn
{
- \tl_use:N \l__spath_prefix_tl
- \tl_use:N \l__spath_tmpc_tl
- \tl_use:N \l__spath_suffix_tl
+ \spath_adjust_gclose:c
}
+ } {#1} { {} }
+ },
+ close~ with/.code~ 2~ args={
+ \__tikzspath_maybe_current_path_reuse:nnn
+ {
+ \__tikzspath_check_two_paths:nnnn
{
- \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
-
- \tl_set_eq:Nc \l__spath_tmpc_tl
- {
- \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
+ \spath_close_with:cv
}
+ } {#1} { {#2} {} }
+ },
+ close~ globally~ with/.code~ 2~ args={
+ \__tikzspath_maybe_current_path_reuse:nnn
+ {
+ \__tikzspath_check_two_paths:nnnn
{
- \msg_warning:nnx
- { spath3 }
- { missing soft path }
- { \tl_use:N \l__spath_tmpc_tl }
+ \spath_gclose_with:cv
}
- }
- {
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
- }
+ } {#1} { {#2} {} }
},
- 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}
+ close~ with~ curve/.code={
+ \__tikzspath_maybe_current_path_reuse:nnn
{
- \tl_if_head_is_group:nTF {#2}
+ \__tikzspath_check_path:nnn
{
- \tl_set:Nx \l__spath_tmpc_tl { \tl_item:nn {#2} {1} }
- \tl_set:Nx \l__spath_tmpd_tl { \tl_item:nn {#2} {2} }
+ \spath_close_with_curve:c
}
+ } {#1} { {} }
+ },
+ close~ globally~ with~ curve/.code={
+ \__tikzspath_maybe_current_path_reuse:nnn
+ {
+ \__tikzspath_check_path:nnn
{
- \tl_set:Nn \l__spath_tmpc_tl {#2}
- \tl_clear:N \l__spath_tmpd_tl
+ \spath_gclose_with_curve:c
}
- \tl_if_exist:cTF
+ } {#1} { {} }
+ },
+ shorten~ at~ end/.code~ 2~ args={
+ \__tikzspath_maybe_current_path_reuse:nnn
+ {
+ \__tikzspath_check_path:nnn
{
- \tl_use:N \l__spath_prefix_tl
- \tl_use:N \l__spath_tmpc_tl
- \tl_use:N \l__spath_suffix_tl
+ \spath_shorten_at_end:cn
}
+ } {#1} { {} {#2} }
+ },
+ shorten~ at~ start/.code~ 2~ args ={
+ \__tikzspath_maybe_current_path_reuse:nnn
+ {
+ \__tikzspath_check_path:nnn
{
- \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
-
- \tl_set_eq:Nc \l__spath_tmpc_tl
- {
- \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_gset_eq:cN
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- \l__spath_tmpa_tl
+ \spath_shorten_at_start:cn
}
+ } {#1} { {} {#2} }
+ },
+ shorten~ at~ both~ ends/.code~ 2~ args={
+ \__tikzspath_maybe_current_path_reuse:nnn
+ {
+ \__tikzspath_check_path:nnn
{
- \msg_warning:nnx
- { spath3 }
- { missing soft path }
- { \tl_use:N \l__spath_tmpc_tl }
+ \spath_shorten_at_both_ends:cn
}
- }
- {
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
- }
+ } {#1} { {} {#2} }
},
- close/.code={
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- {
- \spath_close:c
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- }
+ shorten~ globally~ at~ end/.code~ 2~ args={
+ \__tikzspath_maybe_current_path_reuse:nnn
{
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
- }
+ \__tikzspath_check_path:nnn
+ {
+ \spath_gshorten_at_end:cn
+ }
+ } {#1} { {} {#2} }
},
- close~ globally/.code={
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- {
- \spath_gclose:c
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- }
+ shorten~ globally~ at~ start/.code~ 2~ args ={
+ \__tikzspath_maybe_current_path_reuse:nnn
{
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
- }
+ \__tikzspath_check_path:nnn
+ {
+ \spath_gshorten_at_start:cn
+ }
+ } {#1} { {} {#2} }
},
- close~ with/.code~ 2~ args={
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ shorten~ globally~ at~ both~ ends/.code~ 2~ args={
+ \__tikzspath_maybe_current_path_reuse:nnn
{
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #2 \tl_use:N \l__spath_suffix_tl}
+ \__tikzspath_check_path:nnn
{
- \spath_close_with: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}
+ \spath_gshorten_at_both_ends:cn
}
+ } {#1} { {} {#2} }
+ },
+ split~ at/.code~ 2~ args={
+ \__tikzspath_maybe_current_path_reuse:nnn
+ {
+ \__tikzspath_check_path:nnn
{
- \msg_warning:nnn { spath3 } { missing soft path } { #2 }
+ \spath_split_at_normalised:cn
}
- }
- {
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
- }
+ } {#1} { {} {#2} }
},
- close~ globally~ with/.code~ 2~ args={
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ split~ globally~ at/.code~ 2~ args={
+ \__tikzspath_maybe_current_path_reuse:nnn
{
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #2 \tl_use:N \l__spath_suffix_tl}
+ \__tikzspath_check_path:nnn
{
- \spath_gclose_with: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}
+ \spath_gsplit_at_normalised:cn
}
+ } {#1} { {} {#2} }
+ },
+ split~ at~ into/.code~ n~ args={4}{
+ \__tikzspath_maybe_current_path_reuse:nnn
+ {
+ \__tikzspath_check_path:nnn
{
- \msg_warning:nnn { spath3 } { missing soft path } { #2 }
+ \spath_split_at_normalised:ccvn {\__tikzspath_path_name:n {#1}}
+ {\__tikzspath_path_name:n {#2}}
}
- }
- {
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
- }
+ } {#3} { {} {#4} }
},
- shorten~ at~ end/.code~ 2~ args={
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- {
- \spath_shorten_at_end:cn
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} {#2}
- }
+ split~ globally~ at~ into/.code~ n~ args={4}{
+ \__tikzspath_maybe_current_path_reuse:nnn
{
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
- }
+ \__tikzspath_check_path:nnn
+ {
+ \spath_gsplit_at_normalised:ccvn {\__tikzspath_path_name:n {#1}}
+ {\__tikzspath_path_name:n {#2}}
+ }
+ } {#3} { {} {#4} }
},
- shorten~ at~ start/.code~ 2~ args ={
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- {
- \spath_shorten_at_start:cn
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} {#2}
- }
+ split~ at~ keep~ start/.code~ 2~ args={
+ \__tikzspath_maybe_current_path_reuse:nnn
{
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
- }
+ \__tikzspath_check_path:nnn
+ {
+ \spath_split_at_normalised_keep_start:cn
+ }
+ } {#1} { {} {#2} }
},
- shorten~ at~ both~ ends/.code~ 2~ args={
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- {
- \spath_shorten_at_end:cn
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} {#2}
- \spath_shorten_at_start:cn
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} {#2}
- }
+ split~ globally~ at~ keep~ start/.code~ 2~ args={
+ \__tikzspath_maybe_current_path_reuse:nnn
{
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
- }
+ \__tikzspath_check_path:nnn
+ {
+ \spath_gsplit_at_normalised_keep_start:cn
+ }
+ } {#1} { {} {#2} }
},
- shorten~ globally~ at~ end/.code~ 2~ args={
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ split~ at~ keep~ end/.code~ 2~ args={
+ \__tikzspath_maybe_current_path_reuse:nnn
{
- \spath_gshorten_at_end:cn
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} {#2}
- }
- {
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
- }
+ \__tikzspath_check_path:nnn
+ {
+ \spath_split_at_normalised_keep_end:cn
+ }
+ } {#1} { {} {#2} }
},
- shorten~ globally~ at~ start/.code~ 2~ args ={
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- {
- \spath_gshorten_at_start:cn
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} {#2}
- }
+ split~ globally~ at~ keep~ end/.code~ 2~ args={
+ \__tikzspath_maybe_current_path_reuse:nnn
{
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
- }
+ \__tikzspath_check_path:nnn
+ {
+ \spath_gsplit_at_normalised_keep_end:cn
+ }
+ } {#1} { {} {#2} }
},
- shorten~ globally~ at~ both~ ends/.code~ 2~ args={
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- {
- \spath_shorten_at_end:cn
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} {#2}
- \spath_shorten_at_start:cn
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl} {#2}
- }
- {
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
- }
+ 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}{
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ \__tikzspath_maybe_current_path_reuse:nnn
{
- \spath_translate:cnn
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}{#2}{#3}
- }
- {
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
- }
+ \__tikzspath_check_path:nnn
+ {
+ \spath_translate:cnn
+ }
+ } {#1} { {} {#2}{#3} }
},
translate~ globally/.code~ n~ args={3}{
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- {
- \spath_gtranslate:cnn
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}{#2}{#3}
- }
+ \__tikzspath_maybe_current_path_reuse:nnn
{
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
- }
+ \__tikzspath_check_path:nnn
+ {
+ \spath_gtranslate:cnn
+ }
+ } {#1} { {} {#2}{#3} }
},
normalise/.code={
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ \__tikzspath_maybe_current_path_reuse:nnn
{
- \spath_normalise:c
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- }
- {
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
- }
+ \__tikzspath_check_path:nnn
+ {
+ \spath_normalise:c
+ }
+ } {#1} { {} }
},
normalise~ globally/.code={
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- {
- \spath_gnormalise:c
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- }
+ \__tikzspath_maybe_current_path_reuse:nnn
{
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
- }
+ \__tikzspath_check_path:nnn
+ {
+ \spath_gnormalise:c
+ }
+ } {#1} { {} }
},
transform/.code~ 2~ args={
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ \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
{
- \group_begin:
- \pgftransformreset
- \tikzset{#2}
- \pgfgettransform \l__spath_tmpa_tl
- \tl_gset:Nn \g__spath_smuggle_tl
+ \__tikzspath_check_path:nnn
{
- \spath_transform:cnnnnnn
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ \spath_transform:cV
}
- \tl_gput_right:NV \g__spath_smuggle_tl \l__spath_tmpa_tl
- \group_end:
- \tl_use:N \g__spath_smuggle_tl
- }
- {
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
- }
+ } {#1} { {} \g__tikzspath_smuggle_tl }
},
transform~globally/.code~ 2~ args={
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ \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
{
- \group_begin:
- \pgftransformreset
- \tikzset{#2}
- \pgfgettransform \l__spath_tmpa_tl
- \tl_gset:Nn \g__spath_smuggle_tl
+ \__tikzspath_check_path:nnn
{
- \spath_gtransform:cnnnnnn
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ \spath_gtransform:cV
}
- \tl_gput_right:NV \g__spath_smuggle_tl \l__spath_tmpa_tl
- \group_end:
- \tl_use:N \g__spath_smuggle_tl
- }
- {
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
- }
+ } {#1} { {} \g__tikzspath_smuggle_tl }
},
- split~ at~ intersections~ with/.code~ n~ args={2}{
+ split~ at~ intersections~ with/.code~ 2~ args={
\tl_if_exist:cTF
{
tikz@library@intersections@loaded
}
{
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ \__tikzspath_maybe_current_two_paths_reuse_first:nnnn
{
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #2 \tl_use:N \l__spath_suffix_tl}
+ \__tikzspath_check_two_paths:nnnn
{
\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 } { #1 }
- }
+ } {#1} {#2} { {} }
}
{
\msg_warning:nn { spath3 } { load intersections }
@@ -1248,23 +1666,13 @@
tikz@library@intersections@loaded
}
{
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ \__tikzspath_maybe_current_two_paths_reuse_first:nnnn
{
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #2 \tl_use:N \l__spath_suffix_tl}
+ \__tikzspath_check_two_paths:nnnn
{
\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 } { #1 }
- }
+ } {#1} {#2} { {} }
}
{
\msg_warning:nn { spath3 } { load intersections }
@@ -1276,23 +1684,13 @@
tikz@library@intersections@loaded
}
{
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ \__tikzspath_maybe_current_two_paths_reuse_both:nnnn
{
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #2 \tl_use:N \l__spath_suffix_tl}
+ \__tikzspath_check_two_paths:nnnn
{
\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 } { #1 }
- }
+ } {#1} {#2} { {} }
}
{
\msg_warning:nn { spath3 } { load intersections }
@@ -1304,23 +1702,13 @@
tikz@library@intersections@loaded
}
{
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ \__tikzspath_maybe_current_two_paths_reuse_both:nnnn
{
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #2 \tl_use:N \l__spath_suffix_tl}
+ \__tikzspath_check_two_paths:nnnn
{
\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 } { #1 }
- }
+ } {#1} {#2} { {} }
}
{
\msg_warning:nn { spath3 } { load intersections }
@@ -1332,15 +1720,13 @@
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}
- }
+ \__tikzspath_maybe_current_path_reuse:nnn
{
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
- }
+ \__tikzspath_check_path:nnn
+ {
+ \spath_split_at_self_intersections:c
+ }
+ } {#1} { {} }
}
{
\msg_warning:nn { spath3 } { load intersections }
@@ -1352,627 +1738,334 @@
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}
- }
+ \__tikzspath_maybe_current_path_reuse:nnn
{
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
- }
+ \__tikzspath_check_path:nnn
+ {
+ \spath_gsplit_at_self_intersections:c
+ }
+ } {#1} { {} }
}
{
\msg_warning:nn { spath3 } { load intersections }
}
},
get~ components~ of/.code~ 2~ args={
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ \__tikzspath_maybe_current_path:nn
{
- \clist_clear_new:N #2
- \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_map_inline:Nn \l__spath_tmpa_seq
- {
- \tl_new:c
- {
- \tl_use:N \l__spath_prefix_tl
- anonymous_\int_use:N \g__spath_anon_int
- \tl_use:N \l__spath_suffix_tl
- }
- \tl_set:cn
- {
- \tl_use:N \l__spath_prefix_tl
- anonymous_\int_use:N \g__spath_anon_int
- \tl_use:N \l__spath_suffix_tl
- } {##1}
- \clist_put_right:Nx #2 {anonymous_\int_use:N \g__spath_anon_int}
- \int_gincr:N \g__spath_anon_int
+ \__tikzspath_check_path:nnn {
+ \__tikzspath_get_components:Nv #2
}
}
- {
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
- }
+ {#1}
+ {}
},
get~ components~ of~ globally/.code~ 2~ args={
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ \__tikzspath_maybe_current_path:nn
{
- \clist_gclear_new:N #2
- \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_map_inline:Nn \l__spath_tmpa_seq
- {
- \tl_new:c
- {
- \tl_use:N \l__spath_prefix_tl
- anonymous_\int_use:N \g__spath_anon_int
- \tl_use:N \l__spath_suffix_tl
- }
- \tl_gset:cn
- {
- \tl_use:N \l__spath_prefix_tl
- anonymous_\int_use:N \g__spath_anon_int
- \tl_use:N \l__spath_suffix_tl
- } {##1}
- \clist_gput_right:Nx #2 {anonymous_\int_use:N \g__spath_anon_int}
- \int_gincr:N \g__spath_anon_int
+ \__tikzspath_check_path:nnn {
+ \__tikzspath_gget_components:Nv #2
}
}
- {
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
- }
+ {#1}
+ {}
},
render~ components/.code={
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ \__tikzspath_maybe_current_path:nn
{
- \group_begin:
- \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_map_indexed_inline:Nn \l__spath_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
- }
+ \__tikzspath_check_path:nnn {
+ \__tikzspath_render_components:nv {#1}
}
- \group_end:
- }
- {
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
}
+ {#1}
+ {}
},
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}
+ \tl_if_head_is_group:nTF {#2}
{
- \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}
-
- \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
- {
- \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
- }
- }
- }
- }
-
- \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 {\l__spath_tmpc_tl/2}
- }
- \seq_if_in:NnT \g__spath_tmpb_seq {##1}
- {
- \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
- }
- \tl_gset:Nx \g__spath_output_tl {\seq_use:Nn \l__spath_tmpb_seq {} }
- \group_end:
- \tl_set_eq:cN
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- \g__spath_output_tl
- \tl_gclear:N \g__spath_output_tl
+ \tl_set:Nx \l__tikzspath_tmpc_tl { \tl_item:nn {#2} {1} }
+ \tl_set:Nx \l__tikzspath_tmpd_tl { \tl_item:nn {#2} {2} }
}
{
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
+ \tl_set:Nn \l__tikzspath_tmpc_tl {#2}
+ \tl_clear:N \l__tikzspath_tmpd_tl
}
- },
- 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}
-
- \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
- {
- \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}}
- }
- }
+ \__tikzspath_maybe_current_path_reuse:nnn
+ {
+ \__tikzspath_check_path:nnn
{
- \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
- }
- }
- }
+ \__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
+ }
- \seq_clear:N \l__spath_tmpb_seq
- \seq_map_indexed_inline:Nn \l__spath_tmpa_seq
+ \__tikzspath_maybe_current_path_reuse:nnn
+ {
+ \__tikzspath_check_path:nnn
{
- \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 {\l__spath_tmpc_tl/2}
- }
- \seq_if_in:NnT \g__spath_tmpb_seq {##1}
- {
- \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
+ \__tikzspath_ginsert_gaps_after_components:cVV
}
- \tl_gset:Nx \g__spath_output_tl {\seq_use:Nn \l__spath_tmpb_seq {} }
- \group_end:
- \tl_gset_eq:cN
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- \g__spath_output_tl
- \tl_gclear:N \g__spath_output_tl
+ } {#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} }
}
{
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
+ \tl_set:Nn \l__tikzspath_tmpc_tl {#2}
+ \tl_clear:N \l__tikzspath_tmpd_tl
}
- },
- join~ components/.code~ 2~ args={
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+
+ \__tikzspath_maybe_current_path_reuse:nnn
{
- \seq_gclear:N \g__spath_tmpa_seq
- \foreach \l__spath_tmpa_tl in {#2}
+ \__tikzspath_check_path:nnn
{
- \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_map_inline:Nn \g__spath_tmpa_seq
- {
- \spath_join_component:cn
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}{##1}
+ \__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} }
}
{
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
+ \tl_set:Nn \l__tikzspath_tmpc_tl {#2}
+ \tl_clear:N \l__tikzspath_tmpd_tl
}
- },
- join~ components~ globally/.code~ 2~ args={
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+
+ \__tikzspath_maybe_current_path_reuse:nnn
{
- \seq_gclear:N \g__spath_tmpa_seq
- \foreach \l__spath_tmpa_tl in {#2}
+ \__tikzspath_check_path:nnn
{
- \seq_gput_right:NV \g__spath_tmpa_seq \l__spath_tmpa_tl
+ \__tikzspath_ginsert_gaps_after_segments:cVV
}
- \seq_gsort:Nn \g__spath_tmpa_seq
+ } {#1} { {} \l__tikzspath_tmpc_tl \l__tikzspath_tmpd_tl }
+ },
+ join~ components/.code~ 2~ args={
+ \__tikzspath_maybe_current_path_reuse:nnn
+ {
+ \__tikzspath_check_path:nnn
{
- \int_compare:nNnTF {##1} > {##2}
- { \sort_return_same: }
- { \sort_return_swapped: }
+ \__tikzspath_join_components:cn
}
- \seq_map_inline:Nn \g__spath_tmpa_seq
+ } {#1} { {} {#2} }
+ },
+ join~ components~ globally/.code~ 2~ args={
+ \__tikzspath_maybe_current_path_reuse:nnn
+ {
+ \__tikzspath_check_path:nnn
{
- \spath_gjoin_component:cn
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}{##1}
+ \__tikzspath_gjoin_components:cn
}
- }
- {
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
- }
+ } {#1} { {} {#2} }
},
remove~ empty~ components/.code={
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- {
- \spath_remove_empty_components:c
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- }
+ \__tikzspath_maybe_current_path_reuse:nnn
{
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
- }
+ \__tikzspath_check_path:nnn
+ {
+ \spath_remove_empty_components:c
+ }
+ } {#1} { {} }
},
remove~ empty~ components~ globally/.code={
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- {
- \spath_gremove_empty_components:c
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- }
+ \__tikzspath_maybe_current_path_reuse:nnn
{
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
- }
+ \__tikzspath_check_path:nnn
+ {
+ \spath_gremove_empty_components:c
+ }
+ } {#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}
- }
+ \__tikzspath_maybe_current_path_reuse:nnn
{
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
- }
+ \__tikzspath_check_path:nnn
+ {
+ \spath_replace_lines:c
+ }
+ } {#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}
- }
+ \__tikzspath_maybe_current_path_reuse:nnn
{
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
- }
+ \__tikzspath_check_path:nnn
+ {
+ \spath_greplace_lines:c
+ }
+ } {#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}
+ \__tikzspath_maybe_current_path_reuse:nnn
{
- \seq_gclear:N \g__spath_tmpa_seq
- \foreach \l__spath_tmpa_tl in {#2}
- {
- \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: }
- }
- \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_gpop_left:NNF \g__spath_tmpa_seq \l__spath_tmpa_tl
- {
- \tl_clear:N \l__spath_tmpa_tl
- }
- \seq_clear:N \l__spath_tmpb_seq
- \seq_map_indexed_inline:Nn \l__spath_tmpa_seq
+ \__tikzspath_check_path:nnn
{
- \tl_set:Nn \l__spath_tmpb_tl {##1}
- \tl_if_eq:NNTF \l__spath_tmpb_tl \l__spath_tmpa_tl
- {
- \seq_gpop_left:NNF \g__spath_tmpa_seq \l__spath_tmpa_tl
- {
- \tl_clear:N \l__spath_tmpa_tl
- }
- }
- {
- \seq_put_right:Nn \l__spath_tmpb_seq {##2}
- }
+ \__tikzspath_remove_components:cn
}
- \tl_set:cx {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- {\seq_use:Nn \l__spath_tmpb_seq {} }
- }
- {
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
- }
+ } {#1} { {} {#2} }
},
remove~ components~ globally/.code~ 2~ args={
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
+ \__tikzspath_maybe_current_path_reuse:nnn
{
- \seq_gclear:N \g__spath_tmpa_seq
- \foreach \l__spath_tmpa_tl in {#2}
- {
- \seq_gput_right:NV \g__spath_tmpa_seq \l__spath_tmpa_tl
- }
- \seq_gsort:Nn \g__spath_tmpa_seq
+ \__tikzspath_check_path:nnn
{
- \int_compare:nNnTF {##1} < {##2}
- { \sort_return_same: }
- { \sort_return_swapped: }
+ \__tikzspath_gremove_components:cn
}
- \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_gpop_left:NNF \g__spath_tmpa_seq \l__spath_tmpa_tl
- {
- \tl_clear:N \l__spath_tmpa_tl
- }
- \seq_clear:N \l__spath_tmpb_seq
- \seq_map_indexed_inline:Nn \l__spath_tmpa_seq
- {
- \tl_set:Nn \l__spath_tmpb_tl {##1}
- \tl_if_eq:NNTF \l__spath_tmpb_tl \l__spath_tmpa_tl
- {
- \seq_gpop_left:NNF \g__spath_tmpa_seq \l__spath_tmpa_tl
- {
- \tl_clear:N \l__spath_tmpa_tl
- }
- }
- {
- \seq_put_right:Nn \l__spath_tmpb_seq {##2}
- }
- }
- \tl_gset:cx {\tl_use:N \l__spath_prefix_tl #1 \tl_use:N \l__spath_suffix_tl}
- {\seq_use:Nn \l__spath_tmpb_seq {} }
- }
- {
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
- }
+ } {#1} { {} {#2} }
},
draft~ mode/.is~ choice,
draft~ mode/true/.code={
- \bool_set_true:N \l__spath_draft_bool
+ \bool_set_true:N \l__tikzspath_draft_bool
},
draft~ mode/false/.code={
- \bool_set_false:N \l__spath_draft_bool
+ \bool_set_false:N \l__tikzspath_draft_bool
},
maybe~ spot~ weld/.code={
- \bool_if:NF \l__spath_draft_bool
+ \bool_if:NF \l__tikzspath_draft_bool
{
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #1 \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}
- }
+ \__tikzspath_maybe_current_path_reuse:nnn
{
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
- }
+ \__tikzspath_check_path:nnn
+ {
+ \spath_spot_weld_components:c
+ }
+ } {#1} { {} }
}
},
maybe~ spot~ weld~ globally/.code={
- \bool_if:NF \l__spath_draft_bool
+ \bool_if:NF \l__tikzspath_draft_bool
{
- \tl_if_exist:cTF
- {\tl_use:N \l__spath_prefix_tl #1 \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}
- }
+ \__tikzspath_maybe_current_path_reuse:nnn
{
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
- }
+ \__tikzspath_check_path:nnn
+ {
+ \spath_spot_gweld_components:c
+ }
+ } {#1} { {} }
}
},
transform~ to/.code~ 2~ args={
- \group_begin:
- \tl_if_exist:cTF
- {
- \tl_use:N \l__spath_prefix_tl
- #1
- \tl_use:N \l__spath_suffix_tl
- }
+ \__tikzspath_maybe_current_path:nn
{
- \spath_reallength:Nv
- \l__spath_tmpa_int
- {
- \tl_use:N \l__spath_prefix_tl
- #1
- \tl_use:N \l__spath_suffix_tl
- }
-
- \tl_set:Nx \l__spath_tmpb_tl
- {\fp_to_decimal:n {(#2) * (\l__spath_tmpa_int)}}
- \spath_transformation_at:NvV \l__spath_tmpc_tl
- {
- \tl_use:N \l__spath_prefix_tl
- #1
- \tl_use:N \l__spath_suffix_tl
+ \__tikzspath_check_path:nnn {
+ \__tikzspath_transform_to:nv {#2}
}
- \l__spath_tmpb_tl
- \tl_gset_eq:NN \g__spath_smuggle_tl \l__spath_tmpc_tl
}
+ {#1}
{
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
- \tl_gset_eq:NN \g__spath_smuggle_tl { {1}{0}{0}{1}{0pt}{0pt} }
+ \pgfsettransformentries {1}{0}{0}{1}{0pt}{0pt}
}
- \group_end:
- \exp_last_unbraced:NV \pgfsettransformentries \g__spath_smuggle_tl
- \tl_gclear:N \g__spath_smuggle_tl
},
upright~ transform~ to/.code~ 2~ args={
- \group_begin:
- \tl_if_exist:cTF
- {
- \tl_use:N \l__spath_prefix_tl
- #1
- \tl_use:N \l__spath_suffix_tl
- }
+ \__tikzspath_maybe_current_path:nn
{
- \spath_reallength:Nv
- \l__spath_tmpa_int
- {
- \tl_use:N \l__spath_prefix_tl
- #1
- \tl_use:N \l__spath_suffix_tl
- }
-
- \tl_set:Nx \l__spath_tmpb_tl
- {\fp_to_decimal:n {(#2) * (\l__spath_tmpa_int)}}
- \spath_transformation_at:NvV \l__spath_tmpc_tl
- {
- \tl_use:N \l__spath_prefix_tl
- #1
- \tl_use:N \l__spath_suffix_tl
+ \__tikzspath_check_path:nnn {
+ \__tikzspath_transform_upright_to:nv {#2}
}
- \l__spath_tmpb_tl
- \tl_gset_eq:NN \g__spath_smuggle_tl \l__spath_tmpc_tl
- }
- {
- \msg_warning:nnn { spath3 } { missing soft path } { #1 }
- \tl_gset_eq:NN \g__spath_smuggle_tl { {1}{0}{0}{1}{0pt}{0pt} }
}
- \fp_compare:nT { \tl_item:Nn \g__spath_smuggle_tl {4} < 0}
+ {#1}
{
- \tl_gset:Nx \g__spath_smuggle_tl
- {
- { \fp_eval:n { - (\tl_item:Nn \g__spath_smuggle_tl {1})} }
- { \fp_eval:n { - (\tl_item:Nn \g__spath_smuggle_tl {2})} }
- { \fp_eval:n { - (\tl_item:Nn \g__spath_smuggle_tl {3})} }
- { \fp_eval:n { - (\tl_item:Nn \g__spath_smuggle_tl {4})} }
- { \tl_item:Nn \g__spath_smuggle_tl {5} }
- { \tl_item:Nn \g__spath_smuggle_tl {6} }
- }
+ \pgfsettransformentries {1}{0}{0}{1}{0pt}{0pt}
}
- \group_end:
- \exp_last_unbraced:NV \pgfsettransformentries \g__spath_smuggle_tl
- \tl_gclear:N \g__spath_smuggle_tl
},
knot/.style~ n~ args={3}{
- spath/split~ at~ self~ intersections=#1,
- spath/remove~ empty~ components=#1,
- spath/insert~ gaps~ after~ components={#1}{#2}{#3},
- spath/maybe~ spot~ weld=#1,
- spath/render~ components=#1
+ /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}{
- spath/split~ globally~ at~ self~ intersections=#1,
- spath/remove~ empty~ components~ globally=#1,
- spath/insert~ gaps~ globally ~after~ components={#1}{#2}{#3},
- spath/maybe~ spot~ weld~ globally=#1,
- spath/render~ components=#1
- },
+ /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,
}
-\tikzdeclarecoordinatesystem{spath}{%
+\cs_new_protected_nopar:Npn \__tikzspath_get_point_at:nn #1#2
+{
\group_begin:
- \tl_set:Nn \l__spath_tmpa_tl {#1}
- \tl_trim_spaces:N \l__spath_tmpa_tl
+ \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
- \seq_set_split:NnV \l__spath_tmpa_seq {~} \l__spath_tmpa_tl
- \seq_pop_right:NN \l__spath_tmpa_seq \l__spath_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_set:Nx \l__spath_tmpa_tl { \seq_use:Nn \l__spath_tmpa_seq {~} }
- \tl_if_exist:cTF
- {
- \tl_use:N \l__spath_prefix_tl
- \tl_use:N \l__spath_tmpa_tl
- \tl_use:N \l__spath_suffix_tl
- }
- {
+ \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}
- \tl_set_eq:Nc
- \l__spath_tmpa_tl
- {
- \tl_use:N \l__spath_prefix_tl
- \tl_use:N \l__spath_tmpa_tl
- \tl_use:N \l__spath_suffix_tl
- }
+\tikzdeclarecoordinatesystem{spath}{%
+ \group_begin:
+ \tl_set:Nn \l__tikzspath_tmpa_tl {#1}
+ \tl_trim_spaces:N \l__tikzspath_tmpa_tl
- \tl_if_empty:NTF \l__spath_tmpa_tl
- {
- \tl_gset_eq:NN \g__spath_smuggle_tl \pgfpointorigin
- }
- {
- \spath_reallength:NV \l__spath_tmpa_int \l__spath_tmpa_tl
- \tl_set:Nx \l__spath_tmpb_tl
- {\fp_to_decimal:n {(\l__spath_tmpb_tl) * (\l__spath_tmpa_int)}}
- \spath_point_at:NVV \l__spath_tmpc_tl \l__spath_tmpa_tl \l__spath_tmpb_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 {~} }
- \tl_clear:N \l__spath_tmpd_tl
- \tl_put_right:Nn \l__spath_tmpd_tl {\pgf@x=}
- \tl_put_right:Nx \l__spath_tmpd_tl {\tl_item:Nn \l__spath_tmpc_tl {1}}
- \tl_put_right:Nn \l__spath_tmpd_tl {\relax}
- \tl_put_right:Nn \l__spath_tmpd_tl {\pgf@y=}
- \tl_put_right:Nx \l__spath_tmpd_tl {\tl_item:Nn \l__spath_tmpc_tl {2}}
- \tl_put_right:Nn \l__spath_tmpd_tl {\relax}
- \tl_gset_eq:NN \g__spath_smuggle_tl \l__spath_tmpd_tl
+ \__tikzspath_maybe_current_path:nV
+ {
+ \__tikzspath_check_path:nnn {
+ \__tikzspath_get_point_at:Vv \l__tikzspath_tmpb_tl
}
}
+ \l__tikzspath_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
+ \tl_gset_eq:NN \g__tikzspath_output_tl \pgfpointorigin
}
+
\group_end:
\use:c {pgf@process}{%
- \tl_use:N \g__spath_smuggle_tl
+ \tl_use:N \g__tikzspath_output_tl
\pgftransforminvert
\use:c {pgf@pos@transform@glob}
}
+ \tl_gclear:N \g__tikzspath_output_tl
}
\ExplSyntaxOff