[latex3-commits] [git/LaTeX3-latex3-latex3] master: l3draw: Split up polar arguments (febba10)
Joseph Wright
joseph.wright at morningstar2.co.uk
Sat Feb 17 16:11:38 CET 2018
Repository : https://github.com/latex3/latex3
On branch : master
Link : https://github.com/latex3/latex3/commit/febba1064a0c5eaf3900a347cad2d58d4d32ef2f
>---------------------------------------------------------------
commit febba1064a0c5eaf3900a347cad2d58d4d32ef2f
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date: Sat Feb 17 14:36:43 2018 +0000
l3draw: Split up polar arguments
>---------------------------------------------------------------
febba1064a0c5eaf3900a347cad2d58d4d32ef2f
l3trial/l3draw/l3draw-paths.dtx | 32 ++++++++++++++------------
l3trial/l3draw/l3draw-points.dtx | 24 ++++++++++++-------
l3trial/l3draw/l3draw.dtx | 16 +++++++++++--
l3trial/l3draw/testfiles/m3draw001.lvt | 10 ++++----
l3trial/l3draw/testfiles/m3draw001.tlg | 4 ++--
l3trial/l3draw/testfiles/m3draw003.lvt | 4 ++--
l3trial/l3draw/testfiles/m3draw003.ptex.tlg | 2 +-
l3trial/l3draw/testfiles/m3draw003.tlg | 2 +-
l3trial/l3draw/testfiles/m3draw003.uptex.tlg | 2 +-
l3trial/l3draw/testfiles/m3draw003.xetex.tlg | 2 +-
10 files changed, 60 insertions(+), 38 deletions(-)
diff --git a/l3trial/l3draw/l3draw-paths.dtx b/l3trial/l3draw/l3draw-paths.dtx
index e302302..27e3b35 100644
--- a/l3trial/l3draw/l3draw-paths.dtx
+++ b/l3trial/l3draw/l3draw-paths.dtx
@@ -59,12 +59,12 @@
% \end{macrocode}
%
% \begin{variable}
-% {\l_@@_path_tmp_tl, \l_@@_path_xtmp_fp, \l_@@_path_ytmp_fp}
+% {\l_@@_path_tmp_tl, \l_@@_path_tmpa_fp, \l_@@_path_tmpb_fp}
% Scratch space.
% \begin{macrocode}
\tl_new:N \l_@@_path_tmp_tl
-\fp_new:N \l_@@_path_xtmp_fp
-\fp_new:N \l_@@_path_ytmp_fp
+\fp_new:N \l_@@_path_tmpa_fp
+\fp_new:N \l_@@_path_tmpb_fp
% \end{macrocode}
% \end{variable}
%
@@ -310,8 +310,8 @@
}
\cs_new_protected:Npn \@@_path_curveto:nnnn #1#2#3#4
{
- \fp_set:Nn \l_@@_path_xtmp_fp { \c_@@_path_curveto_b_fp * #1 }
- \fp_set:Nn \l_@@_path_ytmp_fp { \c_@@_path_curveto_b_fp * #2 }
+ \fp_set:Nn \l_@@_path_tmpa_fp { \c_@@_path_curveto_b_fp * #1 }
+ \fp_set:Nn \l_@@_path_tmpb_fp { \c_@@_path_curveto_b_fp * #2 }
\use:x
{
\@@_path_mark_corner:
@@ -320,23 +320,23 @@
\fp_to_dim:n
{
\c_@@_path_curveto_a_fp * \g_@@_path_lastx_dim
- + \l_@@_path_xtmp_fp
+ + \l_@@_path_tmpa_fp
}
}
{
\fp_to_dim:n
{
\c_@@_path_curveto_a_fp * \g_@@_path_lasty_dim
- + \l_@@_path_ytmp_fp
+ + \l_@@_path_tmpb_fp
}
}
{
\fp_to_dim:n
- { \c_@@_path_curveto_a_fp * #3 + \l_@@_path_xtmp_fp }
+ { \c_@@_path_curveto_a_fp * #3 + \l_@@_path_tmpa_fp }
}
{
\fp_to_dim:n
- { \c_@@_path_curveto_a_fp * #4 + \l_@@_path_ytmp_fp }
+ { \c_@@_path_curveto_a_fp * #4 + \l_@@_path_tmpb_fp }
}
{#3}
{#4}
@@ -350,6 +350,7 @@
% \end{macro}
%
% \begin{macro}{\draw_path_arc:nnn}
+% \begin{macro}{\draw_path_arc:nnnn}
% \begin{macro}{\@@_path_arc:nnnn}
% \begin{macro}{\@@_path_arc:nnNnn}
% \begin{macro}
@@ -371,8 +372,8 @@
% the line, with the split set at a final part of $115^{\circ}$.
% \begin{macrocode}
\cs_new_protected:Npn \draw_path_arc:nnn #1#2#3
- { \@@_path_arc:nnw {#1} {#2} #3 ~ and ~ #3 ~ \q_stop }
-\cs_new_protected:Npn \@@_path_arc:nnw #1#2#3 ~ and ~ #4 ~ #5 \q_stop
+ { \draw_path_arc:nnnn {#1} {#2} {#3} {#3} }
+\cs_new_protected:Npn \draw_path_arc:nnnn #1#2#3#4
{
\use:x
{
@@ -470,7 +471,7 @@
{ \@@_path_arc_auxiii:nn }
{
\draw_point_transform:n
- { \draw_point_polar:nn { #1 #4 90 } { #7 ~and~ #8 } }
+ { \draw_point_polar:nnn { #1 #4 90 } {#7} {#8} }
}
\@@_point_process:nn
{
@@ -478,18 +479,18 @@
{ \@@_path_arc_auxiv:nnnn }
{
\draw_point_transform:n
- { \draw_point_polar:nn {#1} { #5 ~and~ #6 } }
+ { \draw_point_polar:nnn {#1} {#5} {#6} }
}
}
{
\draw_point_transform:n
- { \draw_point_polar:nn {#2} { #5 ~and~ #6 } }
+ { \draw_point_polar:nnn {#2} {#5} {#6} }
}
\@@_point_process:nn
{ \@@_path_arc_auxv:nn }
{
\draw_point_transform:n
- { \draw_point_polar:nn { #2 #4 -90 } { #7 ~and~ #8 } }
+ { \draw_point_polar:nnn { #2 #4 -90 } {#7} {#8} }
}
\exp_after:wN \@@_path_curveto:nnnnnn \l_@@_path_tmp_tl
\fp_set:Nn \l_@@_path_arc_delta_fp { abs ( #2 - #3 ) }
@@ -560,6 +561,7 @@
% \end{macro}
% \end{macro}
% \end{macro}
+% \end{macro}
%
% \begin{macrocode}
%</initex|package>
diff --git a/l3trial/l3draw/l3draw-points.dtx b/l3trial/l3draw/l3draw-points.dtx
index 02ca0c9..eb244ef 100644
--- a/l3trial/l3draw/l3draw-points.dtx
+++ b/l3trial/l3draw/l3draw-points.dtx
@@ -160,19 +160,23 @@
% \subsection{Polar co-ordinates}
%
% \begin{macro}[EXP]{\draw_point_polar:nn}
-% \begin{macro}[EXP]{\@@_draw_polar:nw, \@@_draw_polar:fw}
+% \begin{macro}[EXP]{\draw_point_polar:nnn}
+% \begin{macro}[EXP]{\@@_draw_polar:nnn, \@@_draw_polar:fnn}
% Polar co-ordinates may have either one or two lengths, so there is a need
% to do a simple split before the calculation. As the angle gets used twice,
% save on any expression evaluation there and force expansion.
% \begin{macrocode}
\cs_new:Npn \draw_point_polar:nn #1#2
- { \@@_draw_polar:fw { \fp_eval:n {#1} } #2 ~ and ~ #2 ~ \q_stop }
-\cs_new:Npn \@@_draw_polar:nw #1#2 ~ and ~ #3 ~ #4 \q_stop
+ { \draw_point_polar:nnn {#1} {#2} {#2} }
+\cs_new:Npn \draw_point_polar:nnn #1#2#3
+ { \@@_draw_polar:fnn { \fp_eval:n {#1} } {#2} {#3} }
+\cs_new:Npn \@@_draw_polar:nnn #1#2#3
{ \@@_point_to_dim:n { cosd(#1) * (#2) , sind(#1) * (#3) } }
-\cs_generate_variant:Nn \@@_draw_polar:nw { f }
+\cs_generate_variant:Nn \@@_draw_polar:nnn { f }
% \end{macrocode}
% \end{macro}
% \end{macro}
+% \end{macro}
%
% \subsection{Point expression arithmetic}
%
@@ -848,12 +852,15 @@
% \end{macro}
%
% \begin{macro}[EXP]{\draw_point_vec_polar:nn}
-% \begin{macro}[EXP]{\@@_point_vec_polar:nn, \@@_point_vec_polar:ff}
+% \begin{macro}[EXP]{\draw_point_vec_polar:nnn}
+% \begin{macro}[EXP]{\@@_point_vec_polar:nnn, \@@_point_vec_polar:fnn}
% Much the same as the core polar approach.
% \begin{macrocode}
\cs_new:Npn \draw_point_vec_polar:nn #1#2
- { \@@_draw_vec_polar:fw { \fp_eval:n {#1} } #2 ~ and ~ #2 ~ \q_stop }
-\cs_new:Npn \@@_draw_vec_polar:nw #1#2 ~ and ~ #3 ~ #4 \q_stop
+ { \draw_point_vec_polar:nnn {#1} {#2} {#2} }
+\cs_new:Npn \draw_point_vec_polar:nnn #1#2#3
+ { \@@_draw_vec_polar:fnn { \fp_eval:n {#1} } {#2} {#3} }
+\cs_new:Npn \@@_draw_vec_polar:nnn #1#2#3
{
\@@_point_to_dim:n
{
@@ -861,10 +868,11 @@
sind(#1) * (#3) * \l_@@_yvec_y_dim
}
}
-\cs_generate_variant:Nn \@@_draw_vec_polar:nw { f }
+\cs_generate_variant:Nn \@@_draw_vec_polar:nnn { f }
% \end{macrocode}
% \end{macro}
% \end{macro}
+% \end{macro}
%
% \subsection{Transformations}
%
diff --git a/l3trial/l3draw/l3draw.dtx b/l3trial/l3draw/l3draw.dtx
index 68beb09..921deee 100644
--- a/l3trial/l3draw/l3draw.dtx
+++ b/l3trial/l3draw/l3draw.dtx
@@ -125,10 +125,12 @@
% \end{syntax}
% \end{function}
%
-% \begin{function}[EXP]{\draw_point_polar:nn}
+% \begin{function}[EXP]{\draw_point_polar:nn, \draw_point_polar:nnn}
% \begin{syntax}
% \cs{draw_point_polar:nn} \Arg{angle} \Arg{length}
+% \cs{draw_point_polar:nnn} \Arg{angle} \Arg{length-a} \Arg{length-b}
% \end{syntax}
+% % Note interface
% \end{function}
%
% \begin{function}[EXP]{\draw_point_add:nn}
@@ -168,10 +170,12 @@
% \end{syntax}
% \end{function}
%
-% \begin{function}[EXP]{\draw_point_vec_polar:nn}
+% \begin{function}[EXP]{\draw_point_vec_polar:nn, \draw_point_vec_polar:nnn}
% \begin{syntax}
% \cs{draw_point_vec_polar:nn} \Arg{angle} \Arg{length}
+% \cs{draw_point_vec_polar:nnn} \Arg{angle} \Arg{length-a} \Arg{length-b}
% \end{syntax}
+% % Note syntax
% \end{function}
%
% \begin{function}[EXP]{\draw_point_intersect_lines:nnnn}
@@ -245,6 +249,14 @@
% \end{syntax}
% \end{function}
%
+% \begin{function}{\draw_path_arc:nnn, \draw_path_arc:nnnn}
+% \begin{syntax}
+% \cs{draw_path_arc:nnn} \Arg{angle1} \Arg{angle2}
+% \cs{draw_path_arc:nnnn} \Arg{angle1} \Arg{angle2} \Arg{length-a} \Arg{length-b}
+% \end{syntax}
+% % Note interface
+% \end{function}
+%
% \begin{function}{\draw_path_close:}
% \begin{syntax}
% \cs{draw_path_close:}
diff --git a/l3trial/l3draw/testfiles/m3draw001.lvt b/l3trial/l3draw/testfiles/m3draw001.lvt
index 90df972..e8da443 100644
--- a/l3trial/l3draw/testfiles/m3draw001.lvt
+++ b/l3trial/l3draw/testfiles/m3draw001.lvt
@@ -28,13 +28,13 @@
\draw_point:nn { 10 * 3.5cm } { sqrt(2) }
}
-\TESTEXP { \draw_point_polar:nn }
+\TESTEXP { \draw_point_polar:nn(n) }
{
\draw_point_polar:nn { 30 } { 1cm }
\NEWLINE
- \draw_point_polar:nn { 30 } { 1cm ~ and ~ 2cm }
+ \draw_point_polar:nnn { 30 } { 1cm } { 2cm }
\NEWLINE
- \draw_point_polar:nn { 15 + 15 } { 2 * 0.5cm ~ and ~ 2 * 1cm }
+ \draw_point_polar:nnn { 15 + 15 } { 2 * 0.5cm } { 2 * 1cm }
\NEWLINE
}
@@ -183,11 +183,11 @@
\draw_point_vec:nnn { 0 } { 1 } { 1 }
}
-\TESTEXP { \draw_point_vec_polar:nn }
+\TESTEXP { \draw_point_vec_polar:nn(n) }
{
\draw_point_vec_polar:nn { 30 } { 2 }
\NEWLINE
- \draw_point_vec_polar:nn { 30 } { 1~and~2 }
+ \draw_point_vec_polar:nnn { 30 } { 1 } { 2 }
}
\END
diff --git a/l3trial/l3draw/testfiles/m3draw001.tlg b/l3trial/l3draw/testfiles/m3draw001.tlg
index ac1c6b6..5085c03 100644
--- a/l3trial/l3draw/testfiles/m3draw001.tlg
+++ b/l3trial/l3draw/testfiles/m3draw001.tlg
@@ -9,7 +9,7 @@ TEST 1: \draw_point:nn
995.8464566929134pt,1.414213562373095pt
============================================================
============================================================
-TEST 2: \draw_point_polar:nn
+TEST 2: \draw_point_polar:nn (n)
============================================================
24.64080942185094pt,14.2263779527559pt
24.64080942185094pt,28.45275590551181pt
@@ -104,7 +104,7 @@ TEST 15: \draw_point_vec:nnn
-10.95431518554688pt,17.49844360351562pt
============================================================
============================================================
-TEST 16: \draw_point_vec_polar:nn
+TEST 16: \draw_point_vec_polar:nn (n)
============================================================
49.28162383815817pt,28.4527587890625pt
24.64081191907909pt,28.4527587890625pt
diff --git a/l3trial/l3draw/testfiles/m3draw003.lvt b/l3trial/l3draw/testfiles/m3draw003.lvt
index 178db17..54b9631 100644
--- a/l3trial/l3draw/testfiles/m3draw003.lvt
+++ b/l3trial/l3draw/testfiles/m3draw003.lvt
@@ -74,7 +74,7 @@
}
}
-\TEST { \draw_path_arc:nnn }
+\TEST { \draw_path_arc:nnn(n) }
{
\test:n
{
@@ -119,7 +119,7 @@
\test:n
{
\draw_path_moveto:n { 0 , 0 }
- \draw_path_arc:nnn { 0 } { 90 } { 1cm ~ and ~ 2cm }
+ \draw_path_arc:nnnn { 0 } { 90 } { 1cm } { 2cm }
}
}
diff --git a/l3trial/l3draw/testfiles/m3draw003.ptex.tlg b/l3trial/l3draw/testfiles/m3draw003.ptex.tlg
index dc52be6..c10d1e0 100644
--- a/l3trial/l3draw/testfiles/m3draw003.ptex.tlg
+++ b/l3trial/l3draw/testfiles/m3draw003.ptex.tlg
@@ -85,7 +85,7 @@ TEST 5: \draw_path_curveto:nnn
l. ... }
============================================================
============================================================
-TEST 6: \draw_path_arc:nnn
+TEST 6: \draw_path_arc:nnn (n)
============================================================
> \box...=
\hbox(56.90552+0.0)x56.90552
diff --git a/l3trial/l3draw/testfiles/m3draw003.tlg b/l3trial/l3draw/testfiles/m3draw003.tlg
index d25181e..5cef8e8 100644
--- a/l3trial/l3draw/testfiles/m3draw003.tlg
+++ b/l3trial/l3draw/testfiles/m3draw003.tlg
@@ -85,7 +85,7 @@ TEST 5: \draw_path_curveto:nnn
l. ... }
============================================================
============================================================
-TEST 6: \draw_path_arc:nnn
+TEST 6: \draw_path_arc:nnn (n)
============================================================
> \box...=
\hbox(56.90552+0.0)x56.90552
diff --git a/l3trial/l3draw/testfiles/m3draw003.uptex.tlg b/l3trial/l3draw/testfiles/m3draw003.uptex.tlg
index dc52be6..c10d1e0 100644
--- a/l3trial/l3draw/testfiles/m3draw003.uptex.tlg
+++ b/l3trial/l3draw/testfiles/m3draw003.uptex.tlg
@@ -85,7 +85,7 @@ TEST 5: \draw_path_curveto:nnn
l. ... }
============================================================
============================================================
-TEST 6: \draw_path_arc:nnn
+TEST 6: \draw_path_arc:nnn (n)
============================================================
> \box...=
\hbox(56.90552+0.0)x56.90552
diff --git a/l3trial/l3draw/testfiles/m3draw003.xetex.tlg b/l3trial/l3draw/testfiles/m3draw003.xetex.tlg
index dc52be6..c10d1e0 100644
--- a/l3trial/l3draw/testfiles/m3draw003.xetex.tlg
+++ b/l3trial/l3draw/testfiles/m3draw003.xetex.tlg
@@ -85,7 +85,7 @@ TEST 5: \draw_path_curveto:nnn
l. ... }
============================================================
============================================================
-TEST 6: \draw_path_arc:nnn
+TEST 6: \draw_path_arc:nnn (n)
============================================================
> \box...=
\hbox(56.90552+0.0)x56.90552
More information about the latex3-commits
mailing list