summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/spath3/spath3.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/spath3/spath3.sty')
-rw-r--r--Master/texmf-dist/tex/latex/spath3/spath3.sty1395
1 files changed, 1395 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/spath3/spath3.sty b/Master/texmf-dist/tex/latex/spath3/spath3.sty
new file mode 100644
index 00000000000..a1f4b190fe8
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/spath3/spath3.sty
@@ -0,0 +1,1395 @@
+%%
+%% This is file `spath3.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% spath3.dtx (with options: `spath3')
+%% ----------------------------------------------------------------
+%% spath3 --- Functions for manipulating PGF soft paths
+%% E-mail: stacey@math.ntnu.no
+%% Released under the LaTeX Project Public License v1.3c or later
+%% See http://www.latex-project.org/lppl.txt
+%% ----------------------------------------------------------------
+%%
+\NeedsTeXFormat{LaTeX2e}
+\RequirePackage{expl3}
+\RequirePackage{pgf}
+\ProvidesExplPackage {spath3} {2013/04/09} {1.0} {Functions for
+manipulating PGF soft paths}
+\RequirePackage{xparse}
+\tl_new:N \l__spath_tmpa_tl
+\tl_new:N \l__spath_tmpb_tl
+\tl_new:N \l__spath_tmpc_tl
+\tl_new:N \l__spath_tmpd_tl
+\tl_new:N \l__spath_smuggle_tl
+\dim_new:N \l__spath_tmpa_dim
+\dim_new:N \l__spath_tmpb_dim
+\int_new:N \l__spath_tmpa_int
+\tl_new:N \g__spath_moveto_tl
+\tl_new:N \g__spath_lineto_tl
+\tl_new:N \g__spath_curveto_tl
+\tl_new:N \g__spath_curvetoa_tl
+\tl_new:N \g__spath_curvetob_tl
+\tl_set:Nn \g__spath_moveto_tl {\pgfsyssoftpath@movetotoken}
+\tl_set:Nn \g__spath_lineto_tl {\pgfsyssoftpath@linetotoken}
+\tl_set:Nn \g__spath_curveto_tl {\pgfsyssoftpath@curvetotoken}
+\tl_set:Nn \g__spath_curvetoa_tl {\pgfsyssoftpath@curvetosupportatoken}
+\tl_set:Nn \g__spath_curvetob_tl {\pgfsyssoftpath@curvetosupportbtoken}
+\tl_new:N \g__spath_attributes
+\tl_new:N \g__spath_moveable_attributes
+\tl_new:N \g__spath_path_attributes
+\tl_set:Nn \g__spath_attributes {
+ {path}
+ {reverse path}
+ {length}
+ {real length}
+ {number of components}
+ {initial point}
+ {final point}
+ {initial action}
+ {final action}
+ {min bb}
+ {max bb}
+}
+\tl_set:Nn \g__spath_moveable_attributes {
+ {initial point}
+ {final point}
+ {min bb}
+ {max bb}
+}
+\tl_set:Nn \g__spath_path_attributes {
+ {path}
+ {reverse path}
+}
+\cs_new_nopar:Npn \spath_new:n #1
+{
+ \prop_new:c {l__spath_#1}
+}
+\cs_new_nopar:Npn \spath_clear:n #1
+{
+ \prop_gclear:c {l__spath_#1}
+}
+\cs_new_nopar:Npn \spath_clear_new:n #1
+{
+ \prop_gclear_new:c {l__spath_#1}
+}
+\cs_new_nopar:Npn \spath_show:n #1
+{
+ \prop_show:c {l__spath_#1}
+}
+\cs_new_nopar:Npn \spath_put:nnn #1#2#3
+{
+ \prop_gput:cnn {l__spath_#1} {#2} {#3}
+}
+\cs_new_nopar:Npn \spath_remove:nn #1#2
+{
+ \prop_gremove:cn {l__spath_#1} {#2}
+}
+\cs_new_nopar:Npn \__spath_get:nn #1#2
+{
+ \prop_get:cn {l__spath_#1} {#2}
+}
+\cs_new_nopar:Npn \__spath_get:nnN #1#2#3
+{
+ \prop_get:cnN {l__spath_#1} {#2} #3
+}
+\prg_new_conditional:Npnn \spath_if_in:nn #1#2 {p, T, F, TF}
+{
+ \prop_if_in:cnTF {l__spath_#1} {#2}
+ { \prg_return_true: }
+ { \prg_return_false: }
+}
+\cs_generate_variant:Nn \__prop_split:NnTF {cnTF}
+\prg_new_protected_conditional:Npnn \__spath_get:nnN #1#2#3 {T, F, TF}
+{
+ \__prop_split:cnTF {l__spath_#1} {#2}
+ { \__prop_get_true:Nnnn #3 }
+ { \prg_return_false: }
+}
+\cs_generate_variant:Nn \spath_put:nnn {nnV, nnx, nno}
+\cs_generate_variant:Nn \__spath_get:nn {Vn}
+\prg_new_conditional:Npnn \spath_if_exist:n #1 {p,T,F,TF}
+{
+ \prop_if_exist:cTF {l__spath_#1}
+ {
+ \prg_return_true:
+ }
+ {
+ \prg_return_false:
+ }
+}
+\cs_new_nopar:Npn \spath_clone:nn #1 #2
+{
+ \spath_clear_new:n {#2}
+ \tl_map_inline:Nn \g__spath_attributes
+ {
+ \spath_if_in:nnT {#1} {##1}
+ {
+ \__spath_get:nnN {#1} {##1} \l__spath_tmpa_tl
+ \spath_put:nnV {#2} {##1} \l__spath_tmpa_tl
+ }
+ }
+}
+\cs_new_protected_nopar:Npn \spath_get_current_path:n #1
+{
+ \pgfsyssoftpath@getcurrentpath\l__knot_tmpa_tl
+ \spath_clear_new:n {#1}
+ \spath_put:nnV {#1} {path} \l__knot_tmpa_tl
+}
+\cs_new_protected_nopar:Npn \spath_set_current_path:n #1
+{
+ \spath_get:nnN {#1} {min bb} \l__spath_tmpa_tl
+ \exp_last_unbraced:NV \pgf@protocolsizes\l__spath_tmpa_tl
+
+ \spath_get:nnN {#1} {max bb} \l__spath_tmpa_tl
+ \exp_last_unbraced:NV \pgf@protocolsizes\l__spath_tmpa_tl
+
+ \spath_get:nnN {#1} {path} \l__spath_tmpa_tl
+ \pgfsyssoftpath@setcurrentpath\l__spath_tmpa_tl
+ \pgfsyssoftpath@flushcurrentpath
+}
+\cs_new_protected_nopar:Npn \spath_use_path:nn #1#2
+{
+ \spath_set_current_path:n {#1}
+ \pgfusepath{#2}
+}
+\cs_new_protected_nopar:Npn \spath_protocol_path:n #1
+{
+ \spath_get:nnN {#1} {min bb} \l__spath_tmpa_tl
+ \exp_last_unbraced:NV \pgf@protocolsizes\l__spath_tmpa_tl
+
+ \spath_get:nnN {#1} {max bb} \l__spath_tmpa_tl
+ \exp_last_unbraced:NV \pgf@protocolsizes\l__spath_tmpa_tl
+}
+\cs_new_protected_nopar:Npn \spath_tikz_path:nn #1#2
+{
+ \path[#1] \pgfextra{
+ \spath_get:nnN {#2} {path} \l__spath_tmpa_tl
+ \pgfsyssoftpath@setcurrentpath \l__spath_tmpa_tl
+ };
+}
+\cs_generate_variant:Nn \spath_tikz_path:nn {Vn}
+\cs_new_nopar:Npn \spath_get:nn #1#2
+{
+ \spath_if_in:nnF {#1} {#2}
+ {
+ \cs_if_exist_use:cT {spath_generate_#2:n} {{#1}}
+ }
+ \__spath_get:nn {#1} {#2}
+}
+\cs_new_nopar:Npn \spath_get:nnN #1#2#3
+{
+ \spath_if_in:nnF {#1} {#2}
+ {
+ \cs_if_exist_use:cT {spath_generate_#2:n} {{#1}}
+ }
+ \__spath_get:nnN {#1} {#2} #3
+}
+\cs_generate_variant:Nn \spath_get:nnN {nnV}
+\cs_new_nopar:Npn \spath_generate_length:n #1
+{
+ \__spath_get:nnN {#1} {path} \l__spath_tmpa_tl
+ \spath_put:nnx {#1} {length} {\int_eval:n {\tl_count:N \l__spath_tmpa_tl /3 }}
+}
+\cs_new_nopar:Npn \spath_generate_reallength:n #1
+{
+ \__spath_get:nnN {#1} {path} \l__spath_tmpa_tl
+ \int_set:Nn \l__spath_tmpa_int {0}
+ \tl_map_inline:Nn \l__spath_tmpa_tl {
+ \tl_if_eq:nnT {##1} {\pgfsyssoftpath@linetotoken}
+ {
+ \int_incr:N \l__spath_tmpa_int
+ }
+ \tl_if_eq:nnT {##1} {\pgfsyssoftpath@curvetotoken}
+ {
+ \int_incr:N \l__spath_tmpa_int
+ }
+ }
+ \spath_put:nnx {#1} {real length} {\int_use:N \l__spath_tmpa_int}
+}
+\cs_new_nopar:Npn \spath_generate_numberofcomponents:n #1
+{
+ \__spath_get:nnN {#1} {path} \l__spath_tmpa_tl
+ \int_set:Nn \l__spath_tmpa_int {0}
+ \tl_map_inline:Nn \l__spath_tmpa_tl {
+ \tl_if_eq:nnT {##1} {\pgfsyssoftpath@movetotoken}
+ {
+ \int_incr:N \l__spath_tmpa_int
+ }
+ }
+ \spath_put:nnx {#1} {number of components} {\int_use:N \l__spath_tmpa_int}
+}
+\cs_new_nopar:Npn \spath_generate_initialpoint:n #1
+{
+ \__spath_get:nnN {#1} {path} \l__spath_tmpa_tl
+ \tl_clear:N \l__spath_tmpb_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}}
+ \spath_put:nnV {#1} {initial point} \l__spath_tmpb_tl
+}
+\cs_new_nopar:Npn \spath_generate_finalpoint:n #1
+{
+ \tl_clear:N \l__spath_tmpb_tl
+ \spath_if_in:nnTF {#1} {reverse path}
+ {
+ \__spath_get:nnN {#1} {reverse path} \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}}
+ }
+ {
+ \__spath_get:nnN {#1} {path} \l__spath_tmpa_tl
+ \tl_reverse:N \l__spath_tmpa_tl
+ \tl_put_left: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_left:Nx \l__spath_tmpb_tl {{\tl_head:N \l__spath_tmpa_tl}}
+ }
+ \spath_put:nnV {#1} {final point} \l__spath_tmpb_tl
+}
+\cs_new_nopar:Npn \spath_generate_reversepath:n #1
+{
+ \__spath_get:nnN {#1} {path} \l__spath_tmpa_tl
+ \tl_clear:N \l__spath_tmpb_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_tmpb_tl
+ {
+ {\dim_use:N \l__spath_tmpa_dim}
+ {\dim_use:N \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:Nn \l__spath_tmpd_tl {}
+ \tl_case:Nnn \l__spath_tmpc_tl
+ {
+ \g__spath_moveto_tl {\tl_set_eq:NN \l__spath_tmpd_tl \g__spath_moveto_tl }
+ \g__spath_lineto_tl {\tl_set_eq:NN \l__spath_tmpd_tl \g__spath_lineto_tl }
+ \g__spath_curveto_tl {\tl_set_eq:NN \l__spath_tmpd_tl \g__spath_curvetoa_tl }
+ \g__spath_curvetoa_tl {\tl_set_eq:NN \l__spath_tmpd_tl \g__spath_curveto_tl }
+ \g__spath_curvetob_tl {\tl_set_eq:NN \l__spath_tmpd_tl \g__spath_curvetob_tl }
+ }
+ {
+ \tl_show:N \l__spath_tmpc_tl
+ }
+ \tl_put_left:NV \l__spath_tmpb_tl \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_tmpb_tl
+ {
+ {\dim_use:N \l__spath_tmpa_dim}
+ {\dim_use:N \l__spath_tmpb_dim}
+ }
+ }
+ \tl_put_left:NV \l__spath_tmpb_tl \g__spath_moveto_tl
+ \spath_put:nnV {#1} {reverse path} \l__spath_tmpb_tl
+}
+\cs_new_nopar:Npn \spath_generate_initialaction:n #1
+{
+ \__spath_get:nnN {#1} {path} \l__spath_tmpa_tl
+ \tl_clear:N \l__spath_tmpb_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_if_empty:NF \l__spath_tmpa_tl {
+ \tl_set:Nx \l__spath_tmpb_tl {\tl_head:N \l__spath_tmpa_tl}
+ }
+ \spath_put:nnV {#1} {initial action} \l__spath_tmpb_tl
+}
+\cs_new_nopar:Npn \spath_generate_finalaction:n #1
+{
+ \tl_clear:N \l__spath_tmpb_tl
+ \spath_if_in:nnTF {#1} {reverse path}
+ {
+ \__spath_get:nnN {#1} {reverse path} \l__spath_tmpa_tl
+ \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
+ }
+ {
+ \__spath_get:nnN {#1} {path} \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_if_empty:NF \l__spath_tmpa_tl {
+ \tl_set:Nx \l__spath_tmpb_tl {\tl_head:N \l__spath_tmpa_tl}
+ }
+ \tl_if_eq:NNT \l__spath_tmpa_tl \g__spath_curvetoa_tl
+ {
+ \tl_set_eq:NN \l__spath_tmpa_tl \g__spath_curveto_tl
+ }
+ \spath_put:nnV {#1} {final action} \l__spath_tmpb_tl
+}
+\cs_new_nopar:Npn \spath_generate_minbb:n #1
+{
+ \__spath_get:nnN {#1} {path} \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}
+ \bool_until_do:nn {
+ \tl_if_empty_p: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_clear:N \l__spath_tmpb_tl
+ \tl_put_right:Nx \l__spath_tmpb_tl
+ {
+ {\dim_use:N \l__spath_tmpa_dim}
+ {\dim_use:N \l__spath_tmpb_dim}
+ }
+ \spath_put:nnV {#1} {min bb} \l__spath_tmpb_tl
+}
+\cs_new_nopar:Npn \spath_generate_maxbb:n #1
+{
+ \__spath_get:nnN {#1} {path} \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}
+ \bool_until_do:nn {
+ \tl_if_empty_p: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_clear:N \l__spath_tmpb_tl
+ \tl_put_right:Nx \l__spath_tmpb_tl
+ {
+ {\dim_use:N \l__spath_tmpa_dim}
+ {\dim_use:N \l__spath_tmpb_dim}
+ }
+ \spath_put:nnV {#1} {max bb} \l__spath_tmpb_tl
+}
+\tl_new:N \l__spath_rp_tl
+\int_new:N \l__spath_l_int
+\int_new:N \l__spath_rl_int
+\int_new:N \l__spath_nc_int
+\tl_new:N \l__spath_ip_tl
+\tl_new:N \l__spath_fp_tl
+\tl_new:N \l__spath_ia_tl
+\tl_new:N \l__spath_fa_tl
+\dim_new:N \l__spath_minx_dim
+\dim_new:N \l__spath_miny_dim
+\dim_new:N \l__spath_maxx_dim
+\dim_new:N \l__spath_maxy_dim
+
+\cs_new_nopar:Npn \spath_generate_all:n #1
+{
+ \__spath_get:nnN {#1} {path} \l__spath_tmpa_tl
+
+ \tl_clear:N \l__spath_rp_tl
+ \int_set:Nn \l__spath_l_int {1}
+ \int_zero:N \l__spath_rl_int
+ \int_set:Nn \l__spath_nc_int {1}
+ \tl_clear:N \l__spath_ip_tl
+ \tl_clear:N \l__spath_fp_tl
+ \tl_clear:N \l__spath_ia_tl
+ \tl_clear:N \l__spath_fa_tl
+ \dim_zero:N \l__spath_minx_dim
+ \dim_zero:N \l__spath_miny_dim
+ \dim_zero:N \l__spath_maxx_dim
+ \dim_zero:N \l__spath_maxy_dim
+
+ \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_clear:N \l__spath_ip_tl
+ \tl_put_right:Nx \l__spath_ip_tl
+ {
+ {\dim_use:N \l__spath_tmpa_dim}
+ {\dim_use:N \l__spath_tmpb_dim}
+ }
+
+ \dim_set_eq:NN \l__spath_minx_dim \l__spath_tmpa_dim
+ \dim_set_eq:NN \l__spath_miny_dim \l__spath_tmpb_dim
+ \dim_set_eq:NN \l__spath_maxx_dim \l__spath_tmpa_dim
+ \dim_set_eq:NN \l__spath_maxy_dim \l__spath_tmpb_dim
+
+ \tl_put_left:Nx \l__spath_rp_tl
+ {
+ {\dim_use:N \l__spath_tmpa_dim}
+ {\dim_use:N \l__spath_tmpb_dim}
+ }
+
+ \tl_set:Nx \l__spath_ia_tl {\tl_head:N \l__spath_tmpa_tl}
+
+ \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:Nn \l__spath_tmpd_tl {}
+ \tl_set_eq:NN \l__spath_fa_tl \l__spath_tmpc_tl
+ \int_incr:N \l__spath_l_int
+
+ \tl_case:Nnn \l__spath_tmpc_tl
+ {
+ \g__spath_moveto_tl {
+ \tl_set_eq:NN \l__spath_tmpd_tl \g__spath_moveto_tl
+ \int_incr:N \l__spath_nc_int
+ }
+ \g__spath_lineto_tl {
+ \tl_set_eq:NN \l__spath_tmpd_tl \g__spath_lineto_tl
+ \int_incr:N \l__spath_rl_int
+ }
+ \g__spath_curveto_tl {
+ \tl_set_eq:NN \l__spath_tmpd_tl \g__spath_curvetoa_tl
+ \int_incr:N \l__spath_rl_int
+ }
+ \g__spath_curvetoa_tl {
+ \tl_set_eq:NN \l__spath_tmpd_tl \g__spath_curveto_tl
+ }
+ \g__spath_curvetob_tl {
+ \tl_set_eq:NN \l__spath_tmpd_tl \g__spath_curvetob_tl
+ }
+ }
+ {
+ \tl_show:N \l__spath_tmpc_tl
+ }
+ \tl_put_left:NV \l__spath_rp_tl \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}
+
+ \dim_set:Nn \l__spath_minx_dim {\dim_min:nn { \l__spath_minx_dim} {\l__spath_tmpa_dim}}
+ \dim_set:Nn \l__spath_miny_dim {\dim_min:nn { \l__spath_miny_dim} {\l__spath_tmpb_dim}}
+ \dim_set:Nn \l__spath_maxx_dim {\dim_max:nn { \l__spath_maxx_dim} {\l__spath_tmpa_dim}}
+ \dim_set:Nn \l__spath_maxy_dim {\dim_max:nn { \l__spath_maxy_dim} {\l__spath_tmpb_dim}}
+
+ \tl_put_left:Nx \l__spath_rp_tl
+ {
+ {\dim_use:N \l__spath_tmpa_dim}
+ {\dim_use:N \l__spath_tmpb_dim}
+ }
+
+ \tl_set:Nx \l__spath_fp_tl
+ {
+ {\dim_use:N \l__spath_tmpa_dim}
+ {\dim_use:N \l__spath_tmpb_dim}
+ }
+
+ }
+
+ \tl_put_left:NV \l__spath_rp_tl \g__spath_moveto_tl
+
+ \spath_put:nnV {#1} {reverse path} \l__spath_rp_tl
+ \spath_put:nnV {#1} {length} \l__spath_l_int
+ \spath_put:nnV {#1} {real length} \l__spath_rl_int
+ \spath_put:nnV {#1} {number of components} \l__spath_nc_int
+ \spath_put:nnV {#1} {initial point} \l__spath_ip_tl
+ \spath_put:nnV {#1} {final point} \l__spath_fp_tl
+ \spath_put:nnV {#1} {initial action} \l__spath_ia_tl
+ \spath_put:nnV {#1} {final action} \l__spath_fa_tl
+
+ \tl_clear:N \l__spath_tmpb_tl
+ \tl_put_right:Nx \l__spath_tmpb_tl
+ {
+ {\dim_use:N \l__spath_minx_dim}
+ {\dim_use:N \l__spath_miny_dim}
+ }
+ \spath_put:nnV {#1} {min bb} \l__spath_tmpb_tl
+
+ \tl_clear:N \l__spath_tmpb_tl
+ \tl_put_right:Nx \l__spath_tmpb_tl
+ {
+ {\dim_use:N \l__spath_maxx_dim}
+ {\dim_use:N \l__spath_maxy_dim}
+ }
+ \spath_put:nnV {#1} {max bb} \l__spath_tmpb_tl
+
+}
+\cs_new_nopar:Npn \spath_translate:nnn #1#2#3
+{
+ \tl_map_inline:Nn \g__spath_moveable_attributes
+ {
+ \spath_if_in:nnT {#1} {##1}
+ {
+ \__spath_get:nnN {#1} {##1} \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_clear:N \l__spath_tmpb_tl
+ \tl_put_right:Nx \l__spath_tmpb_tl
+ {
+ {\dim_use:N \l__spath_tmpa_dim}
+ {\dim_use:N \l__spath_tmpb_dim}
+ }
+ \spath_put:nnV {#1} {##1} \l__spath_tmpb_tl
+ }
+ }
+ \tl_map_inline:Nn \g__spath_path_attributes
+ {
+ \spath_if_in:nnT {#1} {##1}
+ {
+ \__spath_get:nnN {#1} {##1} \l__spath_tmpa_tl
+ \tl_clear:N \l__spath_tmpb_tl
+ \bool_until_do:nn {
+ \tl_if_empty_p: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_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_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
+
+ \tl_put_right:Nx \l__spath_tmpb_tl
+ {
+ {\dim_use:N \l__spath_tmpa_dim}
+ {\dim_use:N \l__spath_tmpb_dim}
+ }
+ }
+ \spath_put:nnV {#1} {##1} \l__spath_tmpb_tl
+ }
+ }
+}
+
+\cs_generate_variant:Nn \spath_translate:nnn {nxx}
+\cs_new_nopar:Npn \spath_translate:nn #1#2
+{
+ \spath_translate:nnn {#1} #2
+}
+
+\cs_generate_variant:Nn \spath_translate:nn {nV}
+\cs_new_nopar:Npn \spath_scale:nnn #1#2#3
+{
+ \tl_map_inline:Nn \g__spath_moveable_attributes
+ {
+ \spath_if_in:nnT {#1} {##1}
+ {
+ \__spath_get:nnN {#1} {##1} \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_clear:N \l__spath_tmpb_tl
+ \tl_put_right:Nx \l__spath_tmpb_tl
+ {
+ {\dim_use:N \l__spath_tmpa_dim}
+ {\dim_use:N \l__spath_tmpb_dim}
+ }
+ \spath_put:nnV {#1} {##1} \l__spath_tmpb_tl
+ }
+ }
+ \tl_map_inline:Nn \g__spath_path_attributes
+ {
+ \spath_if_in:nnT {#1} {##1}
+ {
+ \__spath_get:nnN {#1} {##1} \l__spath_tmpa_tl
+ \tl_clear:N \l__spath_tmpb_tl
+ \bool_until_do:nn {
+ \tl_if_empty_p: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_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_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
+
+ \tl_put_right:Nx \l__spath_tmpb_tl
+ {
+ {\dim_use:N \l__spath_tmpa_dim}
+ {\dim_use:N \l__spath_tmpb_dim}
+ }
+ }
+ \spath_put:nnV {#1} {##1} \l__spath_tmpb_tl
+ }
+ }
+}
+\cs_new_nopar:Npn \spath_reverse:n #1
+{
+ \spath_if_in:nnF {#1} {reverse path} {
+ \cs_use:c {spath_generate_reverse path}
+ }
+ \spath_swap:nnn {#1} {path} {reverse path}
+ \spath_swap:nnn {#1} {initial point} {final point}
+ \spath_swap:nnn {#1} {initial action} {final action}
+}
+\cs_new_nopar:Npn \spath_swap:nnn #1#2#3
+{
+ \__spath_get:nnNF {#1} {#2} \l__spath_tmpa_tl {\tl_clear:N \l__spath_tmpa_tl}
+ \__spath_get:nnNF {#1} {#3} \l__spath_tmpb_tl {\tl_clear:N \l__spath_tmpb_tl}
+ \tl_if_empty:NTF \l__spath_tmpb_tl
+ {\spath_remove:nnV {#1} {#2}}
+ {\spath_put:nnV {#1} {#2} \l__spath_tmpb_tl}
+ \tl_if_empty:NTF \l__spath_tmpa_tl
+ {\spath_remove:nnV {#1} {#3}}
+ {\spath_put:nnV {#1} {#3} \l__spath_tmpa_tl}
+}
+\cs_new_nopar:Npn \spath_weld:nn #1#2
+{
+ \spath_clone:nn {#2} {tmp_path}
+ \spath_get:nnN {#1} {final point} \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}
+
+ \spath_get:nnN {#2} {initial point} \l__spath_tmpa_tl
+
+ \dim_sub: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_sub:Nn \l__spath_tmpb_dim {\tl_head:N \l__spath_tmpa_tl}
+
+ \spath_translate:nxx {tmp_path} {\dim_use:N \l__spath_tmpa_dim} {\dim_use:N \l__spath_tmpb_dim}
+
+ \__spath_get:nnN {#1} {path} \l__spath_tmpa_tl
+ \__spath_get:nnN {tmp_path} {path} \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_tmpb_tl {\tl_tail:N \l__spath_tmpb_tl}
+ \tl_put_right:NV \l__spath_tmpa_tl \l__spath_tmpb_tl
+
+ \spath_put:nnV {#1} {path} \l__spath_tmpa_tl
+
+ \__spath_get:nnNTF {tmp_path} {final point} \l__spath_tmpa_tl
+ {
+ \spath_put:nnV {#1} {final point} \l__spath_tmpa_tl
+ }
+ {
+ \spath_remove:nn {#1} {final point}
+ }
+
+ \__spath_get:nnNTF {tmp_path} {final action} \l__spath_tmpa_tl
+ {
+ \spath_put:nnV {#1} {final action} \l__spath_tmpa_tl
+ }
+ {
+ \spath_remove:nn {#1} {final action}
+ }
+
+ \__spath_get:nnNT {tmp_path} {min bb} \l__spath_tmpa_tl
+ {
+ \__spath_get:nnNT {#1} {min bb} \l__spath_tmpb_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}
+
+ \dim_set:Nn \l__spath_tmpa_dim {\dim_min:nn {\l__spath_tmpa_dim} {\tl_head:N \l__spath_tmpb_tl}}
+ \tl_set:Nx \l__spath_tmpb_tl {\tl_tail:N \l__spath_tmpb_tl}
+ \dim_set:Nn \l__spath_tmpb_dim {\dim_min:nn {\l__spath_tmpb_dim} {\tl_head:N \l__spath_tmpb_tl}}
+
+ \tl_clear:N \l__spath_tmpb_tl
+ \tl_put_right:Nx \l__spath_tmpb_tl
+ {
+ {\dim_use:N \l__spath_tmpa_dim}
+ {\dim_use:N \l__spath_tmpb_dim}
+ }
+ \spath_put:nnV {#1} {min bb} \l__spath_tmpb_tl
+ }
+ }
+
+ \__spath_get:nnNT {tmp_path} {max bb} \l__spath_tmpa_tl
+ {
+ \__spath_get:nnNT {#1} {max bb} \l__spath_tmpb_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}
+
+ \dim_set:Nn \l__spath_tmpa_dim {\dim_max:nn {\l__spath_tmpa_dim} {\tl_head:N \l__spath_tmpb_tl}}
+ \tl_set:Nx \l__spath_tmpb_tl {\tl_tail:N \l__spath_tmpb_tl}
+ \dim_set:Nn \l__spath_tmpb_dim {\dim_max:nn {\l__spath_tmpb_dim} {\tl_head:N \l__spath_tmpb_tl}}
+
+ \tl_clear:N \l__spath_tmpb_tl
+ \tl_put_right:Nx \l__spath_tmpb_tl
+ {
+ {\dim_use:N \l__spath_tmpa_dim}
+ {\dim_use:N \l__spath_tmpb_dim}
+ }
+ \spath_put:nnV {#1} {max bb} \l__spath_tmpb_tl
+ }
+ }
+
+ \__spath_get:nnNT {tmp_path} {reverse path} \l__spath_tmpa_tl
+ {
+ \__spath_get:nnNT {#1} {reverse path} \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_tmpb_tl {\tl_tail:N \l__spath_tmpb_tl}
+ \tl_put_right:NV \l__spath_tmpa_tl \l__spath_tmpb_tl
+
+ \spath_put:nnV {#1} {reverse path} \l__spath_tmpa_tl
+ }
+ }
+
+ \__spath_get:nnNT {tmp_path} {length} \l__spath_tmpa_tl
+ {
+ \__spath_get:nnNT {#1} {length} \l__spath_tmpb_tl
+ {
+ \int_set:Nn \l__spath_tmpa_int {\l__spath_tmpa_tl + \l__spath_tmpb_tl - 1}
+ \spath_put:nnV {#1} {length} \l__spath_tmpa_int
+ }
+ }
+
+ \__spath_get:nnNT {tmp_path} {real length} \l__spath_tmpa_tl
+ {
+ \__spath_get:nnNT {#1} {real length} \l__spath_tmpb_tl
+ {
+ \int_set:Nn \l__spath_tmpa_int {\l__spath_tmpa_tl + \l__spath_tmpb_tl}
+ \spath_put:nnV {#1} {real length} \l__spath_tmpa_int
+ }
+ }
+
+ \__spath_get:nnNT {tmp_path} {number of components} \l__spath_tmpa_tl
+ {
+ \__spath_get:nnNT {#1} {number of components} \l__spath_tmpb_tl
+ {
+ \int_set:Nn \l__spath_tmpa_int {\l__spath_tmpa_tl + \l__spath_tmpb_tl - 1}
+ \spath_put:nnV {#1} {number of components} \l__spath_tmpa_int
+ }
+ }
+
+}
+\cs_new_nopar:Npn \spath_prepend_no_move:nn #1#2
+{
+ \spath_if_exist:nT {#2}
+ {
+ \__spath_get:nnN {#2} {path} \l__spath_tmpa_tl
+ \__spath_get:nnN {#1} {path} \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_tmpb_tl {\tl_tail:N \l__spath_tmpb_tl}
+ \tl_put_right:NV \l__spath_tmpa_tl \l__spath_tmpb_tl
+ \spath_put:nnV {#1} {path} \l__spath_tmpa_tl
+
+ \spath_if_in:nnTF {#2} {initial point}
+ {
+ \__spath_get:nnN {#2} {initial point} \l__spath_tmpa_tl
+ \spath_put:nnV {#1} {initial point} \l__spath_tmpa_tl
+ }
+ {
+ \spath_remove:nn {#1} {initial point}
+ }
+
+ \spath_if_in:nnTF {#2} {initial action}
+ {
+ \__spath_get:nnN {#2} {initial action} \l__spath_tmpa_tl
+ \spath_put:nnV {#1} {initial action} \l__spath_tmpa_tl
+ }
+ {
+ \spath_remove:nn {#1} {initial action}
+ }
+
+ \bool_if:nTF
+ {
+ \spath_if_in_p:nn {#1} {length}
+ &&
+ \spath_if_in_p:nn {#2} {length}
+ }
+ {
+ \__spath_get:nnN {#1} {length} \l__spath_tmpa_tl
+ \__spath_get:nnN {#2} {length} \l__spath_tmpb_tl
+ \spath_put:nnx {#1} {length} {\int_eval:n {\l__spath_tmpa_tl +
+ \l__spath_tmpb_tl - 1}}
+ }
+ {
+ \spath_remove:nn {#1} {length}
+ }
+ \bool_if:nTF
+ {
+ \spath_if_in_p:nn {#1} {real length}
+ &&
+ \spath_if_in_p:nn {#2} {real length}
+ }
+ {
+ \__spath_get:nnN {#1} {real length} \l__spath_tmpa_tl
+ \__spath_get:nnN {#2} {real length} \l__spath_tmpb_tl
+ \spath_put:nnx {#1} {real length} {\int_eval:n {\l__spath_tmpa_tl +
+ \l__spath_tmpb_tl }}
+ }
+ {
+ \spath_remove:nn {#1} {real length}
+ }
+ \bool_if:nTF
+ {
+ \spath_if_in_p:nn {#1} {number of components}
+ &&
+ \spath_if_in_p:nn {#2} {number of components}
+ }
+ {
+ \__spath_get:nnN {#1} {number of components} \l__spath_tmpa_tl
+ \__spath_get:nnN {#2} {number of components} \l__spath_tmpb_tl
+ \spath_put:nnx {#1} {number of components} {\int_eval:n {\l__spath_tmpa_tl +
+ \l__spath_tmpb_tl - 1}}
+ }
+ {
+ \spath_remove:nn {#1} {number of components}
+ }
+ \bool_if:nTF
+ {
+ \spath_if_in_p:nn {#1} {min bb}
+ &&
+ \spath_if_in_p:nn {#2} {min bb}
+ }
+ {
+ \__spath_get:nnN {#1} {min bb} \l__spath_tmpa_tl
+ \__spath_get:nnN {#2} {min bb} \l__spath_tmpb_tl
+ \dim_set:Nn \l__spath_tmpa_dim {\dim_min:nn {\tl_item:Nn
+ \l__spath_tmpa_tl {1}} {\tl_item:Nn
+ \l__spath_tmpb_tl {1}}}
+ \dim_set:Nn \l__spath_tmpb_dim {\dim_min:nn {\tl_item:Nn
+ \l__spath_tmpa_tl {2}} {\tl_item:Nn
+ \l__spath_tmpb_tl {2}}}
+ \spath_put:nnx {#1} {min bb} {
+ {\dim_use:N \l__spath_tmpa_dim}
+ {\dim_use:N \l__spath_tmpb_dim}
+ }
+ }
+ {
+ \spath_remove:nn {#1} {min bb}
+ }
+ \bool_if:nTF
+ {
+ \spath_if_in_p:nn {#1} {max bb}
+ &&
+ \spath_if_in_p:nn {#2} {max bb}
+ }
+ {
+ \__spath_get:nnN {#1} {max bb} \l__spath_tmpa_tl
+ \__spath_get:nnN {#2} {max bb} \l__spath_tmpb_tl
+ \dim_set:Nn \l__spath_tmpa_dim {\dim_min:nn {\tl_item:Nn
+ \l__spath_tmpa_tl {1}} {\tl_item:Nn
+ \l__spath_tmpb_tl {1}}}
+ \dim_set:Nn \l__spath_tmpb_dim {\dim_min:nn {\tl_item:Nn
+ \l__spath_tmpa_tl {2}} {\tl_item:Nn
+ \l__spath_tmpb_tl {2}}}
+ \spath_put:nnx {#1} {max bb} {
+ {\dim_use:N \l__spath_tmpa_dim}
+ {\dim_use:N \l__spath_tmpb_dim}
+ }
+ }
+ {
+ \spath_remove:nn {#1} {max bb}
+ }
+ \bool_if:nTF
+ {
+ \spath_if_in_p:nn {#1} {reverse path}
+ &&
+ \spath_if_in_p:nn {#2} {reverse path}
+ }
+ {
+ \__spath_get:nnN {#1} {reverse path} \l__spath_tmpa_tl
+ \__spath_get:nnN {#2} {reverse path} \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_tmpb_tl {\tl_tail:N \l__spath_tmpb_tl}
+ \tl_put_right:NV \l__spath_tmpa_tl \l__spath_tmpb_tl
+ \spath_put:nnV {#1} {reverse path} \l__spath_tmpb_tl
+ }
+ {
+ \spath_remove:nn {#1} {reverse path}
+ }
+
+ }
+}
+\cs_new_nopar:Npn \spath_append_no_move:nn #1#2
+{
+ \spath_if_exist:nT {#2}
+ {
+ \spath_get:nnN {#1} {path} \l__spath_tmpa_tl
+ \spath_get:nnN {#2} {path} \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_tmpb_tl {\tl_tail:N \l__spath_tmpb_tl}
+ \tl_put_right:NV \l__spath_tmpa_tl \l__spath_tmpb_tl
+ \spath_put:nnV {#1} {path} \l__spath_tmpa_tl
+ \spath_if_in:nnTF {#2} {final point}
+ {
+ \__spath_get:nnN {#2} {final point} \l__spath_tmpa_tl
+ \spath_put:nnV {#1} {final point} \l__spath_tmpa_tl
+ }
+ {
+ \spath_remove:nn {#1} {final point}
+ }
+ \spath_if_in:nnTF {#2} {final action}
+ {
+ \__spath_get:nnN {#2} {final action} \l__spath_tmpa_tl
+ \spath_put:nnV {#1} {final action} \l__spath_tmpa_tl
+ }
+ {
+ \spath_remove:nn {#1} {final action}
+ }
+ \bool_if:nTF
+ {
+ \spath_if_in_p:nn {#1} {length}
+ &&
+ \spath_if_in_p:nn {#2} {length}
+ }
+ {
+ \__spath_get:nnN {#1} {length} \l__spath_tmpa_tl
+ \__spath_get:nnN {#2} {length} \l__spath_tmpb_tl
+ \spath_put:nnx {#1} {length} {\int_eval:n {\l__spath_tmpa_tl +
+ \l__spath_tmpb_tl - 1}}
+ }
+ {
+ \spath_remove:nn {#1} {length}
+ }
+ \bool_if:nTF
+ {
+ \spath_if_in_p:nn {#1} {real length}
+ &&
+ \spath_if_in_p:nn {#2} {real length}
+ }
+ {
+ \__spath_get:nnN {#1} {real length} \l__spath_tmpa_tl
+ \__spath_get:nnN {#2} {real length} \l__spath_tmpb_tl
+ \spath_put:nnx {#1} {real length} {\int_eval:n {\l__spath_tmpa_tl +
+ \l__spath_tmpb_tl }}
+ }
+ {
+ \spath_remove:nn {#1} {real length}
+ }
+ \bool_if:nTF
+ {
+ \spath_if_in_p:nn {#1} {number of components}
+ &&
+ \spath_if_in_p:nn {#2} {number of components}
+ }
+ {
+ \__spath_get:nnN {#1} {number of components} \l__spath_tmpa_tl
+ \__spath_get:nnN {#2} {number of components} \l__spath_tmpb_tl
+ \spath_put:nnx {#1} {number of components} {\int_eval:n {\l__spath_tmpa_tl +
+ \l__spath_tmpb_tl - 1}}
+ }
+ {
+ \spath_remove:nn {#1} {number of components}
+ }
+ \bool_if:nTF
+ {
+ \spath_if_in_p:nn {#1} {min bb}
+ &&
+ \spath_if_in_p:nn {#2} {min bb}
+ }
+ {
+ \__spath_get:nnN {#1} {min bb} \l__spath_tmpa_tl
+ \__spath_get:nnN {#2} {min bb} \l__spath_tmpb_tl
+ \dim_set:Nn \l__spath_tmpa_dim {\dim_min:nn {\tl_item:Nn
+ \l__spath_tmpa_tl {1}} {\tl_item:Nn
+ \l__spath_tmpb_tl {1}}}
+ \dim_set:Nn \l__spath_tmpb_dim {\dim_min:nn {\tl_item:Nn
+ \l__spath_tmpa_tl {2}} {\tl_item:Nn
+ \l__spath_tmpb_tl {2}}}
+ \spath_put:nnx {#1} {min bb} {
+ {\dim_use:N \l__spath_tmpa_dim}
+ {\dim_use:N \l__spath_tmpb_dim}
+ }
+ }
+ {
+ \spath_remove:nn {#1} {min bb}
+ }
+ \bool_if:nTF
+ {
+ \spath_if_in_p:nn {#1} {max bb}
+ &&
+ \spath_if_in_p:nn {#2} {max bb}
+ }
+ {
+ \__spath_get:nnN {#1} {max bb} \l__spath_tmpa_tl
+ \__spath_get:nnN {#2} {max bb} \l__spath_tmpb_tl
+ \dim_set:Nn \l__spath_tmpa_dim {\dim_min:nn {\tl_item:Nn
+ \l__spath_tmpa_tl {1}} {\tl_item:Nn
+ \l__spath_tmpb_tl {1}}}
+ \dim_set:Nn \l__spath_tmpb_dim {\dim_min:nn {\tl_item:Nn
+ \l__spath_tmpa_tl {2}} {\tl_item:Nn
+ \l__spath_tmpb_tl {2}}}
+ \spath_put:nnx {#1} {max bb} {
+ {\dim_use:N \l__spath_tmpa_dim}
+ {\dim_use:N \l__spath_tmpb_dim}
+ }
+ }
+ {
+ \spath_remove:nn {#1} {max bb}
+ }
+ \bool_if:nTF
+ {
+ \spath_if_in_p:nn {#1} {reverse path}
+ &&
+ \spath_if_in_p:nn {#2} {reverse path}
+ }
+ {
+ \__spath_get:nnN {#2} {reverse path} \l__spath_tmpa_tl
+ \__spath_get:nnN {#1} {reverse path} \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_tmpb_tl {\tl_tail:N \l__spath_tmpb_tl}
+ \tl_put_right:NV \l__spath_tmpa_tl \l__spath_tmpb_tl
+ \spath_put:nnV {#1} {reverse path} \l__spath_tmpb_tl
+ }
+ {
+ \spath_remove:nn {#1} {reverse path}
+ }
+ }
+}
+\cs_new_nopar:Npn \spath_map_component:Nn #1#2
+{
+ \int_gincr:N \g__prg_map_int
+ \cs_gset:cpn { __prg_map_ \int_use:N \g__prg_map_int :w } ##1 {#2}
+ \tl_set:NV \l__spath_tmpa_tl #1
+ \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
+ \tl_put_right:NV \l__spath_tmpa_tl \g__spath_moveto_tl
+ \tl_set_eq:NN \l__spath_tmpb_tl \g__spath_moveto_tl
+ \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_if_eq:NNT \l__spath_tmpc_tl \g__spath_moveto_tl
+ {
+ \exp_args:NnV \use:c { __prg_map_ \int_use:N \g__prg_map_int :w } \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
+ }
+ {
+ \tl_put_right:Nx \l__spath_tmpb_tl {{\l__spath_tmpc_tl}}
+ }
+ \tl_set:Nx \l__spath_tmpa_tl {\tl_tail:N \l__spath_tmpa_tl}
+ }
+}
+\cs_new_nopar:Npn \spath_map_segment_inline:Nn #1#2
+{
+ \int_gincr:N \g__prg_map_int
+ \cs_gset:cpn { __prg_map_ \int_use:N \g__prg_map_int :w } ##1 ##2 {#2}
+ \spath_map_segment_function:Nc #1 { __prg_map_ \int_use:N \g__prg_map_int :w }
+}
+\cs_new_nopar:Npn \spath_map_segment_inline:nn #1#2
+{
+ \int_gincr:N \g__prg_map_int
+ \cs_gset:cpn { __prg_map_ \int_use:N \g__prg_map_int :w } ##1 ##2 {#2}
+ \spath_get:nnN {#1} {path} \l__spath_tmpd_tl
+ \spath_map_segment_function:Nc \l__spath_tmpd_tl { __prg_map_ \int_use:N \g__prg_map_int :w }
+}
+\cs_new_nopar:Npn \spath_map_segment_function:nN #1#2
+{
+ \spath_get:nnN {#1} {path} \l__spath_tmpd_tl
+ \spath_map_segment_function:NN \l__spath_tmpd_tl #2
+}
+\cs_new_nopar:Npn \spath_map_segment_function:NN #1#2
+{
+ \tl_set_eq:NN \l__spath_tmpa_tl #1
+ \tl_clear:N \l__spath_tmpb_tl
+ \dim_zero:N \l__spath_tmpa_dim
+ \dim_zero:N \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}
+ \tl_case:Nnn \l__spath_tmpc_tl
+ {
+ \g__spath_lineto_tl
+ {
+ \tl_set_eq:NN \l__spath_tmpb_tl \g__spath_moveto_tl
+ \tl_put_right:Nx \l__spath_tmpb_tl
+ {
+ {\dim_use:N \l__spath_tmpa_dim}
+ {\dim_use:N \l__spath_tmpb_dim}
+ }
+ \tl_put_right:NV \l__spath_tmpb_tl \g__spath_lineto_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}
+
+ }
+
+ \g__spath_curvetoa_tl
+ {
+ \tl_set_eq:NN \l__spath_tmpb_tl \g__spath_moveto_tl
+ \tl_put_right:Nx \l__spath_tmpb_tl
+ {
+ {\dim_use:N \l__spath_tmpa_dim}
+ {\dim_use:N \l__spath_tmpb_dim}
+ }
+ \tl_put_right:NV \l__spath_tmpb_tl \g__spath_curvetoa_tl
+
+ \prg_replicate:nn {2} {
+ \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}
+
+ }
+ }
+ {
+
+ \tl_set_eq:NN \l__spath_tmpb_tl \l__spath_tmpc_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}
+
+ }
+
+ #2 \l__spath_tmpc_tl \l__spath_tmpb_tl
+ \tl_clear:N \l__spath_tmpb_tl
+
+ }
+}
+\cs_generate_variant:Nn \spath_map_segment_function:NN {Nc}
+\NewDocumentCommand \MakeSPath { m m }
+{
+ \spath_clear_new:n {#1}
+ \spath_put:nno {#1} {path} {#2}
+}
+\NewDocumentCommand \MakeSPathList { m m }
+{
+ \tl_gclear_new:c {l__spath_list_#1}
+ \int_zero:N \l__spath_tmpa_int
+ \spath_map_component:Nn #2 {
+ \spath_clear_new:n {#1 _ \int_use:N \l__spath_tmpa_int}
+ \spath_put:nnn {#1 _ \int_use:N \l__spath_tmpa_int} {path} {##1}
+ \tl_gput_right:cx {l__spath_list_#1} {{#1 _ \int_use:N \l__spath_tmpa_int}}
+ \int_incr:N \l__spath_tmpa_int
+ }
+}
+\NewDocumentCommand \CloneSPath { m m }
+{
+ \spath_clone:nn {#1} {#2}
+}
+\NewDocumentCommand \SPathInfo { m m }
+{
+ \spath_get:nn {#1} {#2}
+}
+\NewDocumentCommand \SPathPrepare { m }
+{
+ \spath_generate_all:n {#1}
+}
+\NewDocumentCommand \SPathListPrepare { m }
+{
+ \tl_map_inline:cn {l__spath_list_#1}
+ {
+ \spath_generate_all:n {##1}
+ }
+}
+\NewDocumentCommand \SPathInfoInto { m m m }
+{
+ \tl_set:Nn \l_tmpa_tl #3
+ \spath_get:nnV {#1} {#2} \l_tmpa_tl
+}
+\NewDocumentCommand \SPathShow { m m }
+{
+ \spath_show:n {#1}
+}
+\NewDocumentCommand \SPathTranslate { m m m }
+{
+ \spath_translate:nnn {#1} {#2} {#3}
+}
+\NewDocumentCommand \SPathTranslateInto { m m m m }
+{
+ \spath_clone:nn {#1} {#2}
+ \spath_translate:nnn {#2} {#3} {#4}
+}
+\NewDocumentCommand \SPathScale { m m m }
+{
+ \spath_translate:nnn {#1} {#2} {#3}
+}
+\NewDocumentCommand \SPathScaleInto { m m m m }
+{
+ \spath_clone:nn {#1} {#2}
+ \spath_translate:nnn {#2} {#3} {#4}
+}
+\NewDocumentCommand \SPathWeld { m m }
+{
+ \spath_weld:nn {#1} {#2}
+}
+\NewDocumentCommand \SPathWeldInto { m m m }
+{
+ \spath_clone:nn {#1} {#2}
+ \spath_weld:nn {#2} {#3}
+}
+\tikzset{
+ save~spath/.code={
+ \tikz@addmode{
+ \spath_get_current_path:n {#1}
+ }
+ },
+ restore~spath/.code={
+ \spath_set_current_path:n {#1}
+ },
+}
+\cs_new_nopar:Npn \spath_split_curve:nnNN #1#2#3#4
+{
+ \group_begin:
+ \tl_gclear:N \l__spath_smuggle_tl
+ \tl_set_eq:NN \l__spath_tmpa_tl \g__spath_moveto_tl
+ \tl_put_right:Nx \l__spath_tmpa_tl {
+ {\tl_item:nn {#2} {3}}
+ {\tl_item:nn {#2} {4}}
+ }
+ \tl_put_right:NV \l__spath_tmpa_tl \g__spath_curvetoa_tl
+ \tl_put_right:Nx \l__spath_tmpa_tl
+ {
+ {\fp_to_dim:n
+ {
+ (1 - #1) * \tl_item:nn {#2} {2} + (#1) * \tl_item:nn {#2} {5}
+ }}
+ {\fp_to_dim:n
+ {
+ (1 - #1) * \tl_item:nn {#2} {3} + (#1) * \tl_item:nn {#2} {6}
+ }}
+ }
+ \tl_put_right:NV \l__spath_tmpa_tl \g__spath_curvetob_tl
+ \tl_put_right:Nx \l__spath_tmpa_tl
+ {
+ {\fp_to_dim:n
+ {
+ (1 - #1)^2 * \tl_item:nn {#2} {2} + 2 * (1 - #1) * (#1) * \tl_item:nn {#2} {5} + (#1)^2 * \tl_item:nn {#2} {8}
+ }}
+ {\fp_to_dim:n
+ {
+ (1 - #1)^2 * \tl_item:nn {#2} {3} + 2 * (1 - #1) * (#1) * \tl_item:nn {#2} {6} + (#1)^2 * \tl_item:nn {#2} {9}
+ }}
+ }
+ \tl_put_right:NV \l__spath_tmpa_tl \g__spath_curveto_tl
+ \tl_put_right:Nx \l__spath_tmpa_tl
+ {
+ {\fp_to_dim:n
+ {
+ (1 - #1)^3 * \tl_item:nn {#2} {2} + 3 * (1 - #1)^2 * (#1) * \tl_item:nn {#2} {5} + 3 * (1 - #1) * (#1)^2 * \tl_item:nn {#2} {8} + (#1)^3 * \tl_item:nn {#2} {11}
+ }}
+ {\fp_to_dim:n
+ {
+ (1 - #1)^3 * \tl_item:nn {#2} {3} + 3 * (1 - #1)^2 * (#1) * \tl_item:nn {#2} {6} + 3 * (1 - #1) * (#1)^2 * \tl_item:nn {#2} {9} + (#1)^3 * \tl_item:nn {#2} {12}
+ }}
+ }
+ \tl_gset_eq:NN \l__spath_smuggle_tl \l__spath_tmpa_tl
+ \group_end:
+ \tl_set_eq:NN #3 \l__spath_smuggle_tl
+ \group_begin:
+ \tl_set_eq:NN \l__spath_tmpa_tl \g__spath_moveto_tl
+ \tl_put_right:Nx \l__spath_tmpa_tl
+ {
+ {\fp_to_dim:n
+ {
+ (1 - #1)^3 * \tl_item:nn {#2} {2} + 3 * (1 - #1)^2 * (#1) * \tl_item:nn {#2} {5} + 3 * (1 - #1) * (#1)^2 * \tl_item:nn {#2} {8} + (#1)^3 * \tl_item:nn {#2} {11}
+ }}
+ {\fp_to_dim:n
+ {
+ (1 - #1)^3 * \tl_item:nn {#2} {3} + 3 * (1 - #1)^2 * (#1) * \tl_item:nn {#2} {6} + 3 * (1 - #1) * (#1)^2 * \tl_item:nn {#2} {9} + (#1)^3 * \tl_item:nn {#2} {12}
+ }}
+ }
+ \tl_put_right:NV \l__spath_tmpa_tl \g__spath_curvetoa_tl
+ \tl_put_right:Nx \l__spath_tmpa_tl
+ {
+ {\fp_to_dim:n
+ {
+ (1 - #1)^2 * \tl_item:nn {#2} {5} + 2 * (1 - #1) * (#1) * \tl_item:nn {#2} {8} + (#1)^2 * \tl_item:nn {#2} {11}
+ }}
+ {\fp_to_dim:n
+ {
+ (1 - #1)^2 * \tl_item:nn {#2} {6} + 2 * (1 - #1) * (#1) * \tl_item:nn {#2} {9} + (#1)^2 * \tl_item:nn {#2} {12}
+ }}
+ }
+ \tl_put_right:NV \l__spath_tmpa_tl \g__spath_curvetob_tl
+ \tl_put_right:Nx \l__spath_tmpa_tl
+ {
+ {\fp_to_dim:n
+ {
+ (1 - #1) * \tl_item:nn {#2} {8} + (#1) * \tl_item:nn {#2} {11}
+ }}
+ {\fp_to_dim:n
+ {
+ (1 - #1) * \tl_item:nn {#2} {9} + (#1) * \tl_item:nn {#2} {12}
+ }}
+ }
+ \tl_put_right:NV \l__spath_tmpa_tl \g__spath_curveto_tl
+ \tl_put_right:Nx \l__spath_tmpa_tl {
+ {\tl_item:nn {#2} {11}}
+ {\tl_item:nn {#2} {12}}
+ }
+ \tl_gset_eq:NN \l__spath_smuggle_tl \l__spath_tmpa_tl
+ \group_end:
+ \tl_set_eq:NN #4 \l__spath_smuggle_tl
+}
+
+\cs_generate_variant:Nn \spath_split_curve:nnNN {nVNN, VVNN}
+%%
+%% Copyright (C) 2011 by Andrew Stacey <stacey@math.ntnu.no>
+%%
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License (LPPL), either
+%% version 1.3c of this license or (at your option) any later
+%% version. The latest version of this license is in the file:
+%%
+%% http://www.latex-project.org/lppl.txt
+%%
+%% This work is "maintained" (as per LPPL maintenance status) by
+%% Andrew Stacey.
+%%
+%% This work consists of the files spath3.dtx
+%% calligraphy_doc.tex
+%% knot_doc.tex
+%% and the derived files spath3.ins,
+%% spath3.pdf,
+%% spath3.sty,
+%% tikzlibrarycalligraphy.code.tex
+%% tikzlibraryknots.code.tex
+%% calligraphy_doc.pdf
+%% knots_doc.pdf
+%% README.txt
+%%
+%%
+%% End of file `spath3.sty'.