diff options
author | Karl Berry <karl@freefriends.org> | 2014-01-26 22:14:21 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2014-01-26 22:14:21 +0000 |
commit | f743052d85acf7d676d00e1903db1806032ac9f6 (patch) | |
tree | 09ad4bdf5a9a5607a4727be3a8e7adcd23fe2662 /Master/texmf-dist/tex/latex/hobby/hobby.code.tex | |
parent | fc11ec42903196eb886eff26e3c251aa47fdd8fb (diff) |
hobby
git-svn-id: svn://tug.org/texlive/trunk@32795 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/hobby/hobby.code.tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/hobby/hobby.code.tex | 66 |
1 files changed, 48 insertions, 18 deletions
diff --git a/Master/texmf-dist/tex/latex/hobby/hobby.code.tex b/Master/texmf-dist/tex/latex/hobby/hobby.code.tex index 18c3409d5a3..0e567fcc528 100644 --- a/Master/texmf-dist/tex/latex/hobby/hobby.code.tex +++ b/Master/texmf-dist/tex/latex/hobby/hobby.code.tex @@ -20,17 +20,43 @@ \cs_generate_variant:Nn \fp_set:Nn {Nx} \cs_generate_variant:Nn \tl_if_eq:nnTF {VnTF} \cs_generate_variant:Nn \tl_if_eq:nnTF {xnTF} +\tl_clear:N \l_tmpa_tl +\tl_if_exist:NT \g__hobby_version +{ + \tl_set:Nn \l_tmpa_tl { + \ExplSyntaxOff + \tl_clear:N \l_tmpa_tl + \endinput + } +} +\tl_use:N \l_tmpa_tl + +\tl_new:N \g__hobby_version +\tl_new:N \g__hobby_date +\tl_set:Nn \g__hobby_version {1.4} +\tl_set:Nn \g__hobby_date {2014-01-21} +\DeclareDocumentCommand \hobbyVersion {} +{ + \tl_use:N \g__hobby_version +} +\DeclareDocumentCommand \hobbyDate {} +{ + \tl_use:N \g__hobby_date +} \fp_new:N \g_hobby_parama_fp \fp_new:N \g_hobby_paramb_fp \fp_new:N \g_hobby_paramc_fp - \fp_gset:Nn \g_hobby_parama_fp {2^.5} - \fp_gset:Nn \g_hobby_paramb_fp {1/16} - \fp_gset:Nn \g_hobby_paramc_fp {(3-5^.5)/2} \bool_new:N \l_hobby_closed_bool \bool_new:N \l_hobby_disjoint_bool +\bool_new:N \l_hobby_save_aux_bool +\bool_set_true:N \l_hobby_save_aux_bool +\DeclareDocumentCommand \HobbyDisableAux {} +{ + \bool_set_false:N \l_hobby_save_aux_bool +} \array_new:N \l_hobby_points_array \array_new:N \l_hobby_points_x_array \array_new:N \l_hobby_points_y_array @@ -150,16 +176,12 @@ (\array_get:Nn \l_hobby_points_y_array {#1 + 1}) - (\array_get:Nn \l_hobby_points_y_array {#1})} - \fp_atantwo:NNN \l_hobby_tempc_fp \l_hobby_tempb_fp \l_hobby_tempa_fp + \fp_set:Nn \l_hobby_tempc_fp { atan ( \l_hobby_tempb_fp, \l_hobby_tempa_fp ) } \fp_veclen:NVV \l_hobby_tempd_fp \l_hobby_tempa_fp \l_hobby_tempb_fp \array_push:Nx \l_hobby_angles_array {\fp_to_tl:N \l_hobby_tempc_fp} \array_push:Nx \l_hobby_distances_array {\fp_to_tl:N \l_hobby_tempd_fp} } -\cs_new:Nn \fp_atantwo:NNN { - \pgfmathparse{rad(atan2(\fp_use:N #3,\fp_use:N #2))} - \exp_args:NNo \fp_set:Nn #1 {\pgfmathresult} -} \cs_new:Nn \fp_veclen:Nnn { \fp_set:Nn #1 {((#2)^2 + (#3)^2)^.5} } @@ -214,7 +236,7 @@ \fp_if_undefined:NF \l_hobby_out_angle_fp { \fp_set:Nn \l_hobby_tempa_fp { \l_hobby_out_angle_fp - - \array_get:Nn \l_hobby_angles_array {0} } + - \array_get:Nn \l_hobby_angles_array {0}} \fp_compare:nT {\l_hobby_tempa_fp > \c_pi_fp } { \fp_sub:Nn \l_hobby_tempa_fp {2 * \c_pi_fp} @@ -276,7 +298,7 @@ \fp_sub:Nn \l_hobby_tempa_fp {2 * \c_pi_fp} } {} - \fp_compare:nTF {\l_hobby_tempa_fp < -\c_pi_fp } + \fp_compare:nTF {\l_hobby_tempa_fp <= -\c_pi_fp } { \fp_add:Nn \l_hobby_tempa_fp {2 * \c_pi_fp} } @@ -403,7 +425,7 @@ \array_put:Nnn \l_hobby_matrix_b_array {0} {1} \array_put:Nnn \l_hobby_matrix_c_array {0} {0} \fp_set:Nn \l_hobby_tempa_fp { \l_hobby_out_angle_fp - - \array_get:Nn \l_hobby_angles_array {0} } + - \array_get:Nn \l_hobby_angles_array {0}} \fp_compare:nT {\l_hobby_tempa_fp > \c_pi_fp } { \fp_sub:Nn \l_hobby_tempa_fp {2 * \c_pi_fp} @@ -681,8 +703,14 @@ sin ( (\array_get:Nn \l_hobby_angles_array {##1}) #1 } } +\cs_new:Npn \hobby_moveto:nnn #1#2#3 {} +\cs_new:Npn \hobby_curveto:nnn #1#2#3 {} +\cs_new:Npn \hobby_close:n #1 {} +\cs_generate_variant:Nn \hobby_moveto:nnn {VVV,nnV} +\cs_generate_variant:Nn \hobby_curveto:nnn {VVV} +\cs_generate_variant:Nn \hobby_close:n {V} \cs_new:Nn \hobby_set_cmds:nnn { - \cs_gset_eq:NN \hobby_moveto:n #1 + \cs_gset_eq:NN \hobby_moveto:nnn #1 \cs_gset_eq:NN \hobby_curveto:nnn #2 \cs_gset_eq:NN \hobby_close:n #3 } @@ -744,7 +772,7 @@ sin ( (\array_get:Nn \l_hobby_angles_array {##1}) \cs_new:Nn \hobby_use_path: { \bool_if:NT \l_hobby_disjoint_bool { \array_get:NnN \l_hobby_points_array {0} \l_tmpa_tl - \exp_args:No \hobby_moveto:n {\l_tmpa_tl} + \hobby_moveto:nnV {} {} \l_tmpa_tl } \int_step_inline:nnnn {1} {1} {\l_hobby_npoints_int} { \array_get:NnN \l_hobby_controla_array {##1} \l_tmpa_tl @@ -752,20 +780,20 @@ sin ( (\array_get:Nn \l_hobby_angles_array {##1}) \array_get:NnN \l_hobby_points_array {##1} \l_tmpc_tl \array_get:NnN \l_hobby_actions_array {##1} \l_tmpd_tl \int_compare:nNnTF {\tl_item:Nn \l_tmpd_tl {1}} = {\l_hobby_draw_int} { - \exp_args:Nooo \hobby_curveto:nnn {\l_tmpa_tl} {\l_tmpb_tl} {\l_tmpc_tl} + \hobby_curveto:VVV \l_tmpa_tl \l_tmpb_tl \l_tmpc_tl }{ \bool_gset_false:N \l_hobby_closed_bool - \exp_args:No \hobby_moveto:n {\l_tmpc_tl} + \hobby_moveto:VVV \l_tmpa_tl \l_tmpb_tl \l_tmpc_tl } \tl_if_eq:xnTF {\tl_item:Nn \l_tmpd_tl {2}} {1} { \bool_gset_false:N \l_hobby_closed_bool - \exp_args:No \hobby_moveto:n {\l_tmpc_tl} + \hobby_moveto:VVV \l_tmpa_tl \l_tmpb_tl \l_tmpc_tl }{} } \bool_if:NT \l_hobby_closed_bool { \array_get:NnN \l_hobby_points_array {0} \l_tmpa_tl - \exp_args:No \hobby_close:n {\l_tmpa_tl} - } + \hobby_close:V \l_tmpa_tl + } } \cs_new:Nn \hobby_save_path:n { \tl_clear:N \l_tmpa_tl @@ -817,6 +845,8 @@ sin ( (\array_get:Nn \l_hobby_angles_array {##1}) \tl_if_exist_p:c {g_hobby_#1_path} && ! \tl_if_exist_p:c {g_hobby_#1_path_saved} + && + \l_hobby_save_aux_bool } { \tl_clear:N \l_tmpa_tl |