[latex3-commits] [git/LaTeX3-latex3-latex3] master: l3draw: Use new tuple support in l3fp (e4fdbb2)
Joseph Wright
joseph.wright at morningstar2.co.uk
Mon Feb 12 18:19:40 CET 2018
Repository : https://github.com/latex3/latex3
On branch : master
Link : https://github.com/latex3/latex3/commit/e4fdbb2ce6bae521a5ccaedbc8977a93cf95ebad
>---------------------------------------------------------------
commit e4fdbb2ce6bae521a5ccaedbc8977a93cf95ebad
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date: Mon Feb 12 17:19:00 2018 +0000
l3draw: Use new tuple support in l3fp
Means re-working quite a lot of internals!
Should result in much clearer code: some reordering still to do.
>---------------------------------------------------------------
e4fdbb2ce6bae521a5ccaedbc8977a93cf95ebad
l3trial/l3draw/l3draw-paths.dtx | 11 +-
l3trial/l3draw/l3draw-points.dtx | 527 ++++++++++++++------------------
l3trial/l3draw/l3draw-transforms.dtx | 40 +--
l3trial/l3draw/testfiles/m3draw001.lvt | 42 +--
l3trial/l3draw/testfiles/m3draw001.tlg | 78 ++---
l3trial/l3draw/testfiles/m3draw002.lvt | 26 +-
l3trial/l3draw/testfiles/m3draw003.lvt | 12 +-
l3trial/l3draw/testfiles/m3draw003.tlg | 2 +-
8 files changed, 342 insertions(+), 396 deletions(-)
diff --git a/l3trial/l3draw/l3draw-paths.dtx b/l3trial/l3draw/l3draw-paths.dtx
index 9b59633..a6c8608 100644
--- a/l3trial/l3draw/l3draw-paths.dtx
+++ b/l3trial/l3draw/l3draw-paths.dtx
@@ -169,13 +169,14 @@
}
\cs_new_protected:Npn \draw_path_curveto:nnn #1#2#3
{
- \@@_point_process:nn
- { \@@_path_curveto:nnnnnn }
+ \@@_point_process:nnn
{
- \draw_point_transform:n {#1}
- \draw_point_transform:n {#2}
- \draw_point_transform:n {#3}
+ \@@_point_process:nn
+ { \@@_path_curveto:nnnnnn }
+ { \draw_point_transform:n {#1} }
}
+ { \draw_point_transform:n {#2} }
+ { \draw_point_transform:n {#3} }
}
\cs_new_protected:Npn \@@_path_curveto:nnnnnn #1#2#3#4#5#6
{
diff --git a/l3trial/l3draw/l3draw-points.dtx b/l3trial/l3draw/l3draw-points.dtx
index 8bf5e5e..f12ed2f 100644
--- a/l3trial/l3draw/l3draw-points.dtx
+++ b/l3trial/l3draw/l3draw-points.dtx
@@ -88,61 +88,79 @@
%
% \subsection{Support functions}
%
-% \begin{macro}{\@@_point_process:nn}
+% \begin{macro}[EXP]{\@@_point_process:nn}
+% \begin{macro}[EXP]{\@@_point_process_auxi:nn, \@@_point_process_auxi:fn}
+% \begin{macro}[EXP]{\@@_point_process_auxii:nw}
+% \begin{macro}[EXP]{\@@_point_process:nnn}
+% \begin{macro}[EXP]{\@@_point_process_auxiii:nnn, \@@_point_process_auxiii:ffn}
+% \begin{macro}[EXP]{\@@_point_process_auxiv:nw}
% Execute whatever code is passed to extract the $x$ and $y$ co-ordinates.
-% The second argument here should itself absorb two arguments.
+% The first argument here should itself absorb two arguments. There is
+% also a version to deal with two co-ordinates: common enough to justify a
+% separate function.
% \begin{macrocode}
-\cs_new_protected:Npn \@@_point_process:nn #1#2
- { \use:x { \exp_not:n {#1} #2 } }
+\cs_new:Npn \@@_point_process:nn #1#2
+ {
+ \@@_point_process_auxi:fn
+ { \@@_point_to_dim:n {#2} }
+ {#1}
+ }
+\cs_new:Npn \@@_point_process_auxi:nn #1#2
+ { \@@_point_process_auxii:nw {#2} #1 \q_stop }
+\cs_generate_variant:Nn \@@_point_process_auxi:nn { f }
+\cs_new:Npn \@@_point_process_auxii:nw #1 #2 , #3 \q_stop
+ { #1 {#2} {#3} }
+\cs_new:Npn \@@_point_process:nnn #1#2#3
+ {
+ \@@_point_process_auxiii:ffn
+ { \@@_point_to_dim:n {#2} }
+ { \@@_point_to_dim:n {#3} }
+ {#1}
+ }
+\cs_new:Npn \@@_point_process_auxiii:nnn #1#2#3
+ { \@@_point_process_auxiv:nw {#3} #1 \q_mark #2 \q_stop }
+\cs_generate_variant:Nn \@@_point_process_auxiii:nnn { ff }
+\cs_new:Npn \@@_point_process_auxiv:nw #1 #2 , #3 \q_mark #4 , #5 \q_stop
+ { #1 {#2} {#3} {#4} {#5} }
% \end{macrocode}
% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
%
-% \begin{macro}[rEXP]{\@@_point_expand:nnN}
-% \begin{macro}[rEXP]{\@@_point_expand_auxi:nnN, \@@_point_expand_auxi:ffN}
-% \begin{macro}[rEXP]{\@@_point_expand_auxii:nnnnN}
-% \begin{macro}[rEXP]
-% {\@@_point_expand_auxiii:nnnnN, \@@_point_expand_auxiii:ffnnN}
-% The aim here is to expand the point expressions fully. As each one will
-% contain two co-ordinates, we have to \texttt{f}-type expand twice: once
-% to get the co-ordinate pairs (brace groups), then to deal with each of the
-% arguments. As the overhead for expansion is small compared with
-% calculations, everything gets done.
+% \begin{macro}[EXP]{\@@_point_to_dim:n}
+% \begin{macro}[EXP]{\@@_point_to_dim_aux:n, \@@_point_to_dim_aux:f}
+% \begin{macro}[EXP]{\@@_point_to_dim_aux:w}
+% Co-ordinates are always returned as two dimensions.
% \begin{macrocode}
-\cs_new:Npn \@@_point_expand:nnN #1#2#3
- { \@@_point_expand_auxi:ffN {#1} {#2} #3 }
-\cs_new:Npn \@@_point_expand_auxi:nnN #1#2#3
- { \@@_point_expand_auxii:nnnnN #1 #2 #3 }
-\cs_generate_variant:Nn \@@_point_expand_auxi:nnN { ff }
-\cs_new:Npn \@@_point_expand_auxii:nnnnN #1#2#3#4#5
- { \@@_point_expand_auxiii:ffffN {#1} {#2} {#3} {#4} #5 }
-\cs_new:Npn \@@_point_expand_auxiii:nnnnN #1#2#3#4#5
- { #5 {#1} {#2} {#3} {#4} }
-\cs_generate_variant:Nn \@@_point_expand_auxiii:nnnnN { ffff }
+\cs_new:Npn \@@_point_to_dim:n #1
+ { \@@_point_to_dim_aux:f { \fp_eval:n {#1} } }
+\cs_new:Npn \@@_point_to_dim_aux:n #1
+ { \@@_point_to_dim_aux:w #1 }
+\cs_generate_variant:Nn \@@_point_to_dim_aux:n { f }
+\cs_new:Npn \@@_point_to_dim_aux:w ( #1 , #2 ) { #1pt , #2pt }
% \end{macrocode}
% \end{macro}
% \end{macro}
-% \end{macro}
-% \end{macro}
%
% \subsection{Co-ordinates}
%
% The most basic way of giving points is as simple $(x,y)$ co-ordinates.
%
-% \begin{macro}[rEXP]{\draw_point:nn}
+% \begin{macro}[EXP]{\draw_point:nn}
% Simply turn the given values into dimensions.
% \begin{macrocode}
\cs_new:Npn \draw_point:nn #1#2
- {
- { \fp_to_dim:n {#1} }
- { \fp_to_dim:n {#2} }
- }
+ { \@@_point_to_dim:n { #1 , #2 } }
% \end{macrocode}
% \end{macro}
%
% \subsection{Polar co-ordinates}
%
-% \begin{macro}[rEXP]{\draw_point_polar:nn}
-% \begin{macro}[rEXP]{\@@_draw_polar:nw, \@@_draw_polar:fw}
+% \begin{macro}[EXP]{\draw_point_polar:nn}
+% \begin{macro}[EXP]{\@@_draw_polar:nw, \@@_draw_polar:fw}
% 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.
@@ -150,10 +168,7 @@
\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
- {
- { \fp_to_dim:n { cosd(#1) * (#2) } }
- { \fp_to_dim:n { sind(#1) * (#3) } }
- }
+ { \@@_point_to_dim:n { cosd(#1) * (#2) , sind(#1) * (#3) } }
\cs_generate_variant:Nn \@@_draw_polar:nw { f }
% \end{macrocode}
% \end{macro}
@@ -163,58 +178,22 @@
%
% These functions all take point expressions as arguments.
%
-% \begin{macro}[rEXP]{\draw_point_add:nn, \draw_point_diff:nn}
-% \begin{macro}[rEXP]{\@@_point_add:nnnn, \@@_point_diff:nnnn}
-% Simple maths once the expansion is done.
+% \begin{macro}[EXP]
+% {\draw_point_add:nn, \draw_point_diff:nn, \draw_point_scale:nn}
+% Simple mathematics.
% \begin{macrocode}
\cs_new:Npn \draw_point_add:nn #1#2
- {
- \@@_point_expand:nnN {#1} {#2}
- \@@_point_add:nnnn
- }
-\cs_new:Npn \@@_point_add:nnnn #1#2#3#4
- {
- { \fp_to_dim:n { #1 + #3 } }
- { \fp_to_dim:n { #2 + #4 } }
- }
+ { \@@_point_to_dim:n { (#1) + (#2) } }
\cs_new:Npn \draw_point_diff:nn #1#2
- {
- \@@_point_expand:nnN {#1} {#2}
- \@@_point_diff:nnnn
- }
-\cs_new:Npn \@@_point_diff:nnnn #1#2#3#4
- {
- { \fp_to_dim:n { #3 - #1 } }
- { \fp_to_dim:n { #4 - #2 } }
- }
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}[rEXP]{\draw_point_scale:nn}
-% \begin{macro}[rEXP]{\@@_point_scale:nnnn}
-% Much the same idea, but as argument |#1| here is a simple floating point
-% expression there is a bit of \enquote{cheating} to reuse the expansion
-% mechanism.
-% \begin{macrocode}
+ { \@@_point_to_dim:n { (#2) - (#1) } }
\cs_new:Npn \draw_point_scale:nn #1#2
- {
- \@@_point_expand:nnN { { \fp_eval:n {#1} } { } } {#2}
- \@@_point_scale:nnnn
- }
-\cs_new:Npn \@@_point_scale:nnnn #1#2#3#4
- {
- { \fp_to_dim:n { #1 * #3 } }
- { \fp_to_dim:n { #1 * #4 } }
- }
+ { \@@_point_to_dim:n { #1 * (#2) } }
% \end{macrocode}
% \end{macro}
-% \end{macro}
%
-% \begin{macro}[rEXP]{\draw_point_unit_vector:n}
-% \begin{macro}[rEXP]{\@@_point_unit_vector:n, \@@_point_unit_vector:f}
-% \begin{macro}[rEXP]{\@@_point_unit_vector:nn, \@@_point_unit_vector:ff}
-% \begin{macro}[rEXP]{\@@_point_unit_vector:nnn, \@@_point_unit_vector:fnn}
+% \begin{macro}[EXP]{\draw_point_unit_vector:n}
+% \begin{macro}[EXP]{\@@_point_unit_vector:nn}
+% \begin{macro}[EXP]{\@@_point_unit_vector:nnn, \@@_point_unit_vector:fnn}
% Only a single point expression so the expansion is done here. The
% outcome is the normalised vector from $(0,0)$ in the direction of
% the point, \emph{i.e.}
@@ -222,41 +201,34 @@
% P_{x} = \frac{x}{\sqrt{x^{2} + y^{2}}} \quad
% P_{y} = \frac{y}{\sqrt{x^{2} + y^{2}}}
% \]
-% with the obvious optimisation of only evaluating the denominator
-% once.
% \begin{macrocode}
\cs_new:Npn \draw_point_unit_vector:n #1
- { \@@_point_unit_vector:f {#1} }
-\cs_new:Npn \@@_point_unit_vector:n #1
- { \@@_point_unit_vector:ff #1 }
-\cs_generate_variant:Nn \@@_point_unit_vector:n { f }
+ { \@@_point_process:nn { \@@_point_unit_vector:nn } {#1} }
\cs_new:Npn \@@_point_unit_vector:nn #1#2
{
\@@_point_unit_vector:fnn
- { \fp_eval:n { sqrt( #1 * #1 + #2 * #2 ) } }
+ { \fp_eval:n { 1 / sqrt( #1 * #1 + #2 * #2 ) } }
{#1} {#2}
}
-\cs_generate_variant:Nn \@@_point_unit_vector:nn { ff }
\cs_new:Npn \@@_point_unit_vector:nnn #1#2#3
{
- { \fp_to_dim:n { #2 / #1 } }
- { \fp_to_dim:n { #3 / #1 } }
+ \@@_point_to_dim:n
+ { ( #2 , #3 ) * #1 }
}
\cs_generate_variant:Nn \@@_point_unit_vector:nnn { f }
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
-% \end{macro}
%
% \subsection{Intersection calculations}
%
-% \begin{macro}[rEXP]{\draw_point_intersect_lines:nnnn}
-% \begin{macro}[rEXP]{\@@_point_intersect_lines:nnnnnn}
-% \begin{macro}[rEXP]{\@@_point_intersect_lines:nnnnnnnn}
-% \begin{macro}[rEXP]
+% \begin{macro}[EXP]{\draw_point_intersect_lines:nnnn}
+% \begin{macro}[EXP]{\@@_point_intersect_lines:nnnnnn}
+% \begin{macro}[EXP]{\@@_point_intersect_lines:nnnnnnnn}
+% \begin{macro}[EXP]
% {\@@_point_intersect_lines_aux:nnnnnn, \@@_point_intersect_lines_aux:ffffff}
-% \begin{macro}[rEXP]
+% \begin{macro}[EXP]
% {\@@_point_intersect_lines_aux:fnnnnnn, \@@_point_intersect_lines_aux:fnnnnnn}
% The intersection point~$P$ between a line joining points $(x_{1}, y_{1})$
% and $(x_{2}, y_{2})$ with a second line joining points $(x_{3}, y_{3})$
@@ -281,15 +253,12 @@
% \begin{macrocode}
\cs_new:Npn \draw_point_intersect_lines:nnnn #1#2#3#4
{
- \@@_point_expand:nnN {#1} {#2}
- \@@_point_intersect_lines:nnnnnn
- {#3} {#4}
- }
-\cs_new:Npn \@@_point_intersect_lines:nnnnnn #1#2#3#4#5#6
- {
- \@@_point_expand:nnN {#5} {#6}
- \@@_point_intersect_lines:nnnnnnnn
- {#1} {#2} {#3} {#4}
+ \@@_point_process:nnn
+ {
+ \@@_point_process:nnn
+ { \@@_point_intersect_lines:nnnnnnnn } {#3} {#4}
+ }
+ {#1} {#2}
}
% \end{macrocode}
% At this stage we have all of the information we need, fully expanded:
@@ -318,14 +287,14 @@
\cs_new:Npn \@@_point_intersect_lines_aux:nnnnnn #1#2#3#4#5#6
{
\@@_point_intersect_lines_aux:fnnnnnn
- { \fp_eval:n { #4 * #5 - #6 * #3 } }
+ { \fp_eval:n { 1 / ( #4 * #5 - #6 * #3 ) } }
{#1} {#2} {#3} {#4} {#5} {#6}
}
\cs_generate_variant:Nn \@@_point_intersect_lines_aux:nnnnnn { ffffff }
\cs_new:Npn \@@_point_intersect_lines_aux:nnnnnnn #1#2#3#4#5#6#7
{
- { \fp_to_dim:n { ( #3 * #4 - #2 * #5 ) / #1 } }
- { \fp_to_dim:n { ( #3 * #6 - #2 * #7 ) / #1 } }
+ \@@_point_to_dim:n
+ { #1 * ( #3 * #4 - #2 * #5 , #3 * #6 - #2 * #7 ) }
}
\cs_generate_variant:Nn \@@_point_intersect_lines_aux:nnnnnnn { f }
% \end{macrocode}
@@ -335,31 +304,31 @@
% \end{macro}
% \end{macro}
%
-% \begin{macro}[rEXP]{\draw_point_intersect_circles:nnnnn}
-% \begin{macro}[rEXP]{\@@_point_intersect_circles_auxi:nnnnnnn}
-% \begin{macro}[rEXP]
+% \begin{macro}[EXP]{\draw_point_intersect_circles:nnnnn}
+% \begin{macro}[EXP]{\@@_point_intersect_circles_auxi:nnnnnnn}
+% \begin{macro}[EXP]
% {
% \@@_point_intersect_circles_auxii:nnnnnnn,
% \@@_point_intersect_circles_auxii:ffnnnnn,
% \@@_point_intersect_circles_auxiii:nnnnnnn,
% \@@_point_intersect_circles_auxiii:ffnnnnn
% }
-% \begin{macro}[rEXP]
+% \begin{macro}[EXP]
% {
% \@@_point_intersect_circles_auxiv:nnnnnnnn,
% \@@_point_intersect_circles_auxiv:fnnnnnnn
% }
-% \begin{macro}[rEXP]
+% \begin{macro}[EXP]
% {
% \@@_point_intersect_circles_auxv:nnnnnnnnn,
% \@@_point_intersect_circles_auxv:ffnnnnnnn
% }
-% \begin{macro}[rEXP]
+% \begin{macro}[EXP]
% {
% \@@_point_intersect_circles_auxvi:nnnnnnnn,
% \@@_point_intersect_circles_auxvi:fnnnnnnn
% }
-% \begin{macro}[rEXP]
+% \begin{macro}[EXP]
% {
% \@@_point_intersect_circles_auxvii:nnnnnnn,
% \@@_point_intersect_circles_auxvii:fffnnnn
@@ -389,14 +358,14 @@
% \begin{macrocode}
\cs_new:Npn \draw_point_intersect_circles:nnnnn #1#2#3#4#5
{
- \@@_point_expand:nnN {#1} {#3}
- \@@_point_intersect_circles_auxi:nnnnnnn
- {#2} {#4} {#5}
+ \@@_point_process:nnn
+ { \@@_point_intersect_circles_auxi:nnnnnnn {#2} {#4} {#5} }
+ {#1} {#3}
}
\cs_new:Npn \@@_point_intersect_circles_auxi:nnnnnnn #1#2#3#4#5#6#7
{
\@@_point_intersect_circles_auxii:ffnnnnn
- { \fp_eval:n {#5} } { \fp_eval:n {#6} } {#1} {#2} {#3} {#4} {#7}
+ { \fp_eval:n {#1} } { \fp_eval:n {#2} } {#4} {#5} {#6} {#7} {#3}
}
% \end{macrocode}
% At this stage we have all of the information we need, fully expanded:
@@ -476,8 +445,8 @@
\cs_generate_variant:Nn \@@_point_intersect_circles_auxvi:nnnnnnnn { f }
\cs_new:Npn \@@_point_intersect_circles_auxvii:nnnnnnn #1#2#3#4#5#6#7
{
- { \fp_to_dim:n { #6 + #4 * #1 + #2 * #3 * #5 } }
- { \fp_to_dim:n { #7 + #5 * #1 + -1 * #2 * #3 * #4 } }
+ \@@_point_to_dim:n
+ { #6 + #4 * #1 + #2 * #3 * #5 , #7 + #5 * #1 + -1 * #2 * #3 * #4 }
}
\cs_generate_variant:Nn \@@_point_intersect_circles_auxvii:nnnnnnn { fff }
% \end{macrocode}
@@ -491,14 +460,13 @@
%
% \subsection{Interpolation on a line (vector) or arc}
%
-% \begin{macro}[rEXP]{\draw_point_interpolate_line:nnn}
-% \begin{macro}[rEXP]{\@@_point_interpolate_line:nnnnn}
-% \begin{macro}[rEXP]
+% \begin{macro}[EXP]{\draw_point_interpolate_line:nnn}
+% \begin{macro}[EXP]
% {
% \@@_point_interpolate_line_aux:nnnnn,
% \@@_point_interpolate_line_aux:fnnnn,
% }
-% \begin{macro}[rEXP]
+% \begin{macro}[EXP]
% {
% \@@_point_interpolate_line_aux:nnnnnn,
% \@@_point_interpolate_line_aux:fnnnnn,
@@ -507,14 +475,9 @@
% \begin{macrocode}
\cs_new:Npn \draw_point_interpolate_line:nnn #1#2#3
{
- \@@_point_expand:nnN {#2} {#3}
- \@@_point_interpolate_line:nnnnn
- {#1}
- }
-\cs_new:Npn \@@_point_interpolate_line:nnnnn #1#2#3#4#5
- {
- \@@_point_interpolate_line_aux:fnnnn { \fp_eval:n {#5} }
- {#1} {#2} {#3} {#4}
+ \@@_point_process:nnn
+ { \@@_point_interpolate_line_aux:fnnnn { \fp_eval:n {#1} } }
+ {#2} {#3}
}
\cs_new:Npn \@@_point_interpolate_line_aux:nnnnn #1#2#3#4#5
{
@@ -523,25 +486,21 @@
}
\cs_generate_variant:Nn \@@_point_interpolate_line_aux:nnnnn { f }
\cs_new:Npn \@@_point_interpolate_line_aux:nnnnnn #1#2#3#4#5#6
- {
- { \fp_to_dim:n { #2 * #3 + #1 * #5 } }
- { \fp_to_dim:n { #2 * #4 + #1 * #6 } }
- }
+ { \@@_point_to_dim:n { #2 * #3 + #1 * #5 , #2 * #4 + #1 * #6 } }
\cs_generate_variant:Nn \@@_point_interpolate_line_aux:nnnnnn { f }
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
-% \end{macro}
%
-% \begin{macro}[rEXP]{\draw_point_interpolate_distance:nnn}
-% \begin{macro}[rEXP]{\@@_point_interpolate_distance:nnnnn}
-% \begin{macro}[rEXP]
+% \begin{macro}[EXP]{\draw_point_interpolate_distance:nnn}
+% \begin{macro}[EXP]{\@@_point_interpolate_distance:nnnnn}
+% \begin{macro}[EXP]
% {
% \@@_point_interpolate_distance_aux:nnnnnnn,
% \@@_point_interpolate_distance_aux:nnnnnnn,
% }
-% \begin{macro}[rEXP]
+% \begin{macro}[EXP]
% {
% \@@_point_interpolate_distance_aux:nnnnnn,
% \@@_point_interpolate_distance_aux:fnnnnn,
@@ -550,16 +509,16 @@
% \begin{macrocode}
\cs_new:Npn \draw_point_interpolate_distance:nnn #1#2#3
{
- \@@_point_expand:nnN {#2} {#3}
- \@@_point_interpolate_distance:nnnnn
- {#1}
+ \@@_point_process:nnn
+ { \@@_point_interpolate_distance:nnnnn {#1} }
+ {#2} {#3}
}
\cs_new:Npn \@@_point_interpolate_distance:nnnnn #1#2#3#4#5
{
\@@_point_interpolate_distance_aux:nnnnnnn
- { \fp_eval:n { #3 - #1 } }
{ \fp_eval:n { #4 - #2 } }
- {#1} {#2} {#3} {#4} {#5}
+ { \fp_eval:n { #5 - #3 } }
+ {#2} {#3} {#4} {#5} {#1}
}
\cs_new:Npn \@@_point_interpolate_distance_aux:nnnnnnn #1#2#3#4#5#6#7
{
@@ -569,10 +528,7 @@
}
\cs_generate_variant:Nn \@@_point_interpolate_distance_aux:nnnnnnn { ff }
\cs_new:Npn \@@_point_interpolate_distance_aux:nnnnn #1#2#3#4#5
- {
- { \fp_to_dim:n { #2 + #1 * #4 } }
- { \fp_to_dim:n { #3 + #1 * #5 } }
- }
+ { \@@_point_to_dim:n { #2 + #1 * #4 , #3 + #1 * #5 } }
\cs_generate_variant:Nn \@@_point_interpolate_distance_aux:nnnnn { f }
% \end{macrocode}
% \end{macro}
@@ -580,23 +536,22 @@
% \end{macro}
% \end{macro}
%
-% \begin{macro}[rEXP]{\draw_point_interpolate_arc:nnnnnn}
-% \begin{macro}[rEXP]{\@@_point_interpolate_arc_auxi:nnnnnnnn}
-% \begin{macro}[rEXP]{\@@_point_interpolate_arc_auxii:nnnnnnnn}
-% \begin{macro}[rEXP]
+% \begin{macro}[EXP]{\draw_point_interpolate_arc:nnnnnn}
+% \begin{macro}[EXP]{\@@_point_interpolate_arc_auxi:nnnnnnnnn}
+% \begin{macro}[EXP]
% {
-% \@@_point_interpolate_arc_auxiii:nnnnnnnnn,
-% \@@_point_interpolate_arc_auxiii:fnnnnnnnn
+% \@@_point_interpolate_arc_auxii:nnnnnnnnn,
+% \@@_point_interpolate_arc_auxii:fnnnnnnnn
% }
-% \begin{macro}[rEXP]
+% \begin{macro}[EXP]
% {
-% \@@_point_interpolate_arc_auxiv:nnnnnnn,
-% \@@_point_interpolate_arc_auxiv:fnnnnnn
+% \@@_point_interpolate_arc_auxiii:nnnnnnn,
+% \@@_point_interpolate_arc_auxiii:fnnnnnn
% }
-% \begin{macro}[rEXP]
+% \begin{macro}[EXP]
% {
-% \@@_point_interpolate_arc_auxv:nnnnnnnn,
-% \@@_point_interpolate_arc_auxv:ffnnnnnn
+% \@@_point_interpolate_arc_auxiv:nnnnnnnn,
+% \@@_point_interpolate_arc_auxiv:ffnnnnnn
% }
% Finding a point on an ellipse arc is relatively easy: find the correct
% angle between the two given, use the sine and cosine of that angle,
@@ -605,20 +560,18 @@
% \begin{macrocode}
\cs_new:Npn \draw_point_interpolate_arc:nnnnnn #1#2#3#4#5#6
{
- \@@_point_expand:nnN {#2} {#3}
- \@@_point_interpolate_arc_auxi:nnnnnnnn
- {#1} {#4} {#5} {#6}
- }
-\cs_new:Npn \@@_point_interpolate_arc_auxi:nnnnnnnn #1#2#3#4#5#6#7#8
- {
- \@@_point_expand:nnN {#6} { { } { } }
- \@@_point_interpolate_arc_auxii:nnnnnnnn
- {#5} { {#1} {#2} {#3} {#4} } {#7} {#8}
+ \@@_point_process:nnn
+ {
+ \@@_point_process:nn
+ { \@@_point_interpolate_arc_auxi:nnnnnnnnn {#1} {#5} {#6} }
+ {#4}
+ }
+ {#2} {#3}
}
-\cs_new:Npn \@@_point_interpolate_arc_auxii:nnnnnnnn #1#2#3#4#5#6#7#8
+\cs_new:Npn \@@_point_interpolate_arc_auxi:nnnnnnnnn #1#2#3#4#5#6#7#8#9
{
- \@@_point_interpolate_arc_auxiii:fnnnnnnnn
- { \fp_eval:n {#5} } {#7} {#8} #6 {#1} {#2}
+ \@@_point_interpolate_arc_auxii:fnnnnnnnn
+ { \fp_eval:n {#1} } {#2} {#3} {#6} {#7} {#8} {#9} {#4} {#5}
}
% \end{macrocode}
% At this stage, the three co-ordinate pairs are fully expanded but somewhat
@@ -637,27 +590,27 @@
% We are now in a position to find the target angle, and from that
% the sine and cosine required.
% \begin{macrocode}
-\cs_new:Npn \@@_point_interpolate_arc_auxiii:nnnnnnnnn #1#2#3#4#5#6#7#8#9
+\cs_new:Npn \@@_point_interpolate_arc_auxii:nnnnnnnnn #1#2#3#4#5#6#7#8#9
{
- \@@_point_interpolate_arc_auxiv:fnnnnnn
+ \@@_point_interpolate_arc_auxiii:fnnnnnn
{ \fp_eval:n { #1 * (#3) + ( 1 - #1 ) * (#2) } }
{#4} {#5} {#6} {#7} {#8} {#9}
}
-\cs_generate_variant:Nn \@@_point_interpolate_arc_auxiii:nnnnnnnnn { f }
-\cs_new:Npn \@@_point_interpolate_arc_auxiv:nnnnnnn #1#2#3#4#5#6#7
+\cs_generate_variant:Nn \@@_point_interpolate_arc_auxii:nnnnnnnnn { f }
+\cs_new:Npn \@@_point_interpolate_arc_auxiii:nnnnnnn #1#2#3#4#5#6#7
{
- \@@_point_interpolate_arc_auxv:ffnnnnnn
+ \@@_point_interpolate_arc_auxiv:ffnnnnnn
{ \fp_eval:n { cosd (#1) } }
{ \fp_eval:n { sind (#1) } }
{#2} {#3} {#4} {#5} {#6} {#7}
}
-\cs_generate_variant:Nn \@@_point_interpolate_arc_auxiv:nnnnnnn { f }
-\cs_new:Npn \@@_point_interpolate_arc_auxv:nnnnnnnn #1#2#3#4#5#6#7#8
+\cs_generate_variant:Nn \@@_point_interpolate_arc_auxiii:nnnnnnn { f }
+\cs_new:Npn \@@_point_interpolate_arc_auxiv:nnnnnnnn #1#2#3#4#5#6#7#8
{
- { \fp_to_dim:n { #3 + #1 * #5 + #2 * #7 } }
- { \fp_to_dim:n { #4 + #1 * #6 + #2 * #8 } }
+ \@@_point_to_dim:n
+ { #3 + #1 * #5 + #2 * #7 , #4 + #1 * #6 + #2 * #8 }
}
-\cs_generate_variant:Nn \@@_point_interpolate_arc_auxv:nnnnnnnn { ff }
+\cs_generate_variant:Nn \@@_point_interpolate_arc_auxiv:nnnnnnnn { ff }
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -666,31 +619,30 @@
% \end{macro}
% \end{macro}
%
-% \begin{macro}[rEXP]{\draw_point_interpolate_curve:nnnnn}
-% \begin{macro}[rEXP]{\draw_point_interpolate_curve_auxi:nnnnnnn}
-% \begin{macro}[rEXP]{\draw_point_interpolate_curve_auxii:nnnnnnnnn}
-% \begin{macro}[rEXP]
+% \begin{macro}[EXP]{\draw_point_interpolate_curve:nnnnn}
+% \begin{macro}[EXP]{\draw_point_interpolate_curve_auxi:nnnnnnnnn}
+% \begin{macro}[EXP]
% {
-% \draw_point_interpolate_curve_auxiii:nnnnnnnnn,
-% \draw_point_interpolate_curve_auxiii:fnnnnnnnn,
+% \draw_point_interpolate_curve_auxii:nnnnnnnnn,
+% \draw_point_interpolate_curve_auxii:fnnnnnnnn,
% }
-% \begin{macro}[rEXP]
+% \begin{macro}[EXP]
% {
-% \draw_point_interpolate_curve_auxiv:nnnnnn,
-% \draw_point_interpolate_curve_auxiv:fnnnnn,
+% \draw_point_interpolate_curve_auxiii:nnnnnn,
+% \draw_point_interpolate_curve_auxiii:fnnnnn,
% }
-% \begin{macro}[rEXP]{\draw_point_interpolate_curve_auxv:nnnnnn}
-% \begin{macro}[rEXP]
+% \begin{macro}[EXP]{\draw_point_interpolate_curve_auxiv:nnnnnn}
+% \begin{macro}[EXP]
% {
-% \draw_point_interpolate_curve_auxvi:nnw,
-% \draw_point_interpolate_curve_auxvi:ffw,
+% \draw_point_interpolate_curve_auxv:nnw,
+% \draw_point_interpolate_curve_auxv:ffw,
% }
-% \begin{macro}[rEXP]{\draw_point_interpolate_curve_auxvii:n}
-% \begin{macro}[rEXP]{\draw_point_interpolate_curve_auxviii:nnnnnnnn}
-% \begin{macro}[rEXP]
+% \begin{macro}[EXP]{\draw_point_interpolate_curve_auxvi:n}
+% \begin{macro}[EXP]{\draw_point_interpolate_curve_auxvii:nnnnnnnn}
+% \begin{macro}[EXP]
% {
-% \draw_point_interpolate_curve_auxix:nnnnnn,
-% \draw_point_interpolate_curve_auxix:ffnnnn,
+% \draw_point_interpolate_curve_auxviii:nnnnnn,
+% \draw_point_interpolate_curve_auxviii:ffnnnn,
% }
% Here we start with a proportion of the curve ($p$) and four points
% \begin{enumerate}
@@ -703,21 +655,19 @@
% \begin{macrocode}
\cs_new:Npn \draw_point_interpolate_curve:nnnnnn #1#2#3#4#5
{
- \@@_point_expand:nnN {#2} {#3}
- \@@_point_interpolate_curve_auxi:nnnnnnn
- {#1} {#4} {#5}
- }
-\cs_new:Npn \@@_point_interpolate_curve_auxi:nnnnnnn #1#2#3#4#5#6#7
- {
- \@@_point_expand:nnN {#6} {#7}
- \@@_point_interpolate_curve_auxii:nnnnnnnnn
- {#5} {#1} {#2} {#3} {#4}
+ \@@_point_process:nnn
+ {
+ \@@_point_process:nnn
+ { \@@_point_interpolate_curve_auxi:nnnnnnnnn {#1} }
+ {#4} {#5}
+ }
+ {#2} {#3}
}
-\cs_new:Npn \@@_point_interpolate_curve_auxii:nnnnnnnnn #1#2#3#4#5#6#7#8#9
+\cs_new:Npn \@@_point_interpolate_curve_auxi:nnnnnnnnn #1#2#3#4#5#6#7#8#9
{
- \@@_point_interpolate_curve_auxiii:fnnnnnnnn
- { \fp_eval:n {#5} }
- {#6} {#7} {#8} {#9} {#1} {#2} {#3} {#4}
+ \@@_point_interpolate_curve_auxii:fnnnnnnnn
+ { \fp_eval:n {#1} }
+ {#6} {#7} {#8} {#9} {#2} {#3} {#4} {#5}
}
% \end{macrocode}
% At this stage, everything is fully expanded and back in the input order.
@@ -745,64 +695,64 @@
% \end{align*}
% Of course, this does mean a lot of calculations and expansion!
% \begin{macrocode}
-\cs_new:Npn \@@_point_interpolate_curve_auxiii:nnnnnnnnn
+\cs_new:Npn \@@_point_interpolate_curve_auxii:nnnnnnnnn
#1#2#3#4#5#6#7#8#9
{
- \@@_point_interpolate_curve_auxiv:fnnnnn
+ \@@_point_interpolate_curve_auxiii:fnnnnn
{ \fp_eval:n { 1 - #1 } }
{#1}
{ {#2} {#3} } { {#4} {#5} } { {#6} {#7} } { {#8} {#9} }
}
-\cs_generate_variant:Nn \@@_point_interpolate_curve_auxiii:nnnnnnnnn { f }
+\cs_generate_variant:Nn \@@_point_interpolate_curve_auxii:nnnnnnnnn { f }
% \begin{macrocode}
% We need to do the first cycle, but haven't got enough arguments to keep
% everything in play at once. So her ewe use a but of argument re-ordering
% and a single auxiliary to get the job done.
% \begin{macrocode}
-\cs_new:Npn \@@_point_interpolate_curve_auxiv:nnnnnn #1#2#3#4#5#6
+\cs_new:Npn \@@_point_interpolate_curve_auxiii:nnnnnn #1#2#3#4#5#6
{
- \@@_point_interpolate_curve_auxv:nnnnnn {#1} {#2} #3 #4
- \@@_point_interpolate_curve_auxv:nnnnnn {#1} {#2} #4 #5
- \@@_point_interpolate_curve_auxv:nnnnnn {#1} {#2} #5 #6
+ \@@_point_interpolate_curve_auxiv:nnnnnn {#1} {#2} #3 #4
+ \@@_point_interpolate_curve_auxiv:nnnnnn {#1} {#2} #4 #5
+ \@@_point_interpolate_curve_auxiv:nnnnnn {#1} {#2} #5 #6
\prg_do_nothing:
- \@@_point_interpolate_curve_auxvii:n { {#1} {#2} }
+ \@@_point_interpolate_curve_auxvi:n { {#1} {#2} }
}
-\cs_generate_variant:Nn \@@_point_interpolate_curve_auxiv:nnnnnn { f }
-\cs_new:Npn \@@_point_interpolate_curve_auxv:nnnnnn #1#2#3#4#5#6
+\cs_generate_variant:Nn \@@_point_interpolate_curve_auxiii:nnnnnn { f }
+\cs_new:Npn \@@_point_interpolate_curve_auxiv:nnnnnn #1#2#3#4#5#6
{
- \@@_point_interpolate_curve_auxvi:ffw
+ \@@_point_interpolate_curve_auxv:ffw
{ \fp_eval:n { #1 * #3 + #2 * #5 } }
{ \fp_eval:n { #1 * #4 + #2 * #6 } }
}
-\cs_new:Npn \@@_point_interpolate_curve_auxvi:nnw
+\cs_new:Npn \@@_point_interpolate_curve_auxv:nnw
#1#2#3 \prg_do_nothing: #4#5
{
#3
\prg_do_nothing:
#4 { #5 {#1} {#2} }
}
-\cs_generate_variant:Nn \@@_point_interpolate_curve_auxvi:nnw { ff }
+\cs_generate_variant:Nn \@@_point_interpolate_curve_auxv:nnw { ff }
% \begin{macrocode}
% Get the arguments back into the right places and to the second and
% third cycles directly.
% \begin{macrocode}
-\cs_new:Npn \@@_point_interpolate_curve_auxvii:n #1
- { \@@_point_interpolate_curve_auxviii:nnnnnnnn #1 }
-\cs_new:Npn \@@_point_interpolate_curve_auxviii:nnnnnnnn #1#2#3#4#5#6#7#8
+\cs_new:Npn \@@_point_interpolate_curve_auxvi:n #1
+ { \@@_point_interpolate_curve_auxvii:nnnnnnnn #1 }
+\cs_new:Npn \@@_point_interpolate_curve_auxvii:nnnnnnnn #1#2#3#4#5#6#7#8
{
- \@@_point_interpolate_curve_auxix:ffffnn
+ \@@_point_interpolate_curve_auxviii:ffffnn
{ \fp_eval:n { #1 * #5 + #2 * #3 } }
{ \fp_eval:n { #1 * #6 + #2 * #4 } }
{ \fp_eval:n { #1 * #7 + #2 * #5 } }
{ \fp_eval:n { #1 * #8 + #2 * #6 } }
{#1} {#2}
}
-\cs_new:Npn \@@_point_interpolate_curve_auxix:nnnnnn #1#2#3#4#5#6
+\cs_new:Npn \@@_point_interpolate_curve_auxviii:nnnnnn #1#2#3#4#5#6
{
- { \fp_to_dim:n { #5 * #3 + #6 * #1 } }
- { \fp_to_dim:n { #5 * #4 + #6 * #2 } }
+ \@@_point_to_dim:n
+ { #5 * #3 + #6 * #1 , #5 * #4 + #6 * #2 }
}
-\cs_generate_variant:Nn \@@_point_interpolate_curve_auxix:nnnnnn { ffff }
+\cs_generate_variant:Nn \@@_point_interpolate_curve_auxviii:nnnnnn { ffff }
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -813,7 +763,6 @@
% \end{macro}
% \end{macro}
% \end{macro}
-% \end{macro}
%
% \subsection{Vector support}
%
@@ -866,15 +815,15 @@
%
% Initialise the vectors.
% \begin{macrocode}
-\draw_xvec_set:n { { 1cm } { 0cm } }
-\draw_yvec_set:n { { 0cm } { 1cm } }
-\draw_zvec_set:n { { -0.385cm } { -0.385cm } }
+\draw_xvec_set:n { 1cm , 0cm }
+\draw_yvec_set:n { 0cm , 1cm }
+\draw_zvec_set:n { -0.385cm , -0.385cm }
% \end{macrocode}
%
-% \begin{macro}[rEXP]{\draw_point_vec:nn}
-% \begin{macro}[rEXP]{\@@_point_vec:nn, \@@_point_vec:ff}
-% \begin{macro}[rEXP]{\draw_point_vec:nnn}
-% \begin{macro}[rEXP]{\@@_point_vec:nnn, \@@_point_vec:fff}
+% \begin{macro}[EXP]{\draw_point_vec:nn}
+% \begin{macro}[EXP]{\@@_point_vec:nn, \@@_point_vec:ff}
+% \begin{macro}[EXP]{\draw_point_vec:nnn}
+% \begin{macro}[EXP]{\@@_point_vec:nnn, \@@_point_vec:fff}
% Force a single evaluation of each factor, then use these to work out the
% underlying point.
% \begin{macrocode}
@@ -882,14 +831,11 @@
{ \@@_point_vec:ff { \fp_eval:n {#1} } { \fp_eval:n {#2} } }
\cs_new:Npn \@@_point_vec:nn #1#2
{
- {
- \fp_to_dim:n
- { #1 * \l_@@_xvec_x_dim + #2 * \l_@@_yvec_x_dim }
- }
- {
- \fp_to_dim:n
- { #1 * \l_@@_xvec_y_dim + #2 * \l_@@_yvec_y_dim }
- }
+ \@@_point_to_dim:n
+ {
+ #1 * \l_@@_xvec_x_dim + #2 * \l_@@_yvec_x_dim ,
+ #1 * \l_@@_xvec_y_dim + #2 * \l_@@_yvec_y_dim
+ }
}
\cs_generate_variant:Nn \@@_point_vec:nn { ff }
\cs_new:Npn \draw_point_vec:nnn #1#2#3
@@ -899,21 +845,15 @@
}
\cs_new:Npn \@@_point_vec:nnn #1#2#3
{
- {
- \fp_to_dim:n
- {
- #1 * \l_@@_xvec_x_dim
- + #2 * \l_@@_yvec_x_dim
- + #3 * \l_@@_zvec_x_dim
- }
- }
- {
- \fp_to_dim:n
- {
+ \@@_point_to_dim:n
+ {
+ #1 * \l_@@_xvec_x_dim
+ + #2 * \l_@@_yvec_x_dim
+ + #3 * \l_@@_zvec_x_dim
+ ,
#1 * \l_@@_xvec_y_dim
+ #2 * \l_@@_yvec_y_dim
+ #3 * \l_@@_zvec_y_dim
- }
}
}
\cs_generate_variant:Nn \@@_point_vec:nnn { fff }
@@ -923,16 +863,19 @@
% \end{macro}
% \end{macro}
%
-% \begin{macro}[rEXP]{\draw_point_vec_polar:nn}
-% \begin{macro}[rEXP]{\@@_point_vec_polar:nn, \@@_point_vec_polar:ff}
+% \begin{macro}[EXP]{\draw_point_vec_polar:nn}
+% \begin{macro}[EXP]{\@@_point_vec_polar:nn, \@@_point_vec_polar:ff}
% 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
{
- { \fp_to_dim:n { cosd(#1) * (#2) * \l_@@_xvec_x_dim } }
- { \fp_to_dim:n { sind(#1) * (#3) * \l_@@_yvec_y_dim } }
+ \@@_point_to_dim:n
+ {
+ cosd(#1) * (#2) * \l_@@_xvec_x_dim ,
+ sind(#1) * (#3) * \l_@@_yvec_y_dim
+ }
}
\cs_generate_variant:Nn \@@_draw_vec_polar:nw { f }
% \end{macrocode}
@@ -941,52 +884,48 @@
%
% \subsection{Transformations}
%
-% \begin{macro}[rEXP]{\draw_point_transform:n}
-% \begin{macro}[rEXP]{\@@_point_transform:nnnn}
-% \begin{macro}[rEXP]{\@@_point_transform:nn}
+% \begin{macro}[EXP]{\draw_point_transform:n}
+% \begin{macro}[EXP]{\@@_point_transform:nn}
% Applies a transformation matrix to a point: see \texttt{l3draw-transforms}
-% for the business end. As there is only one point expression, we provide
-% a dummy one for the expansion. After that, it's the usual requirement:
-% apply the mathematics (or not!). Where possible, we avoid the relatively
-% expensive multiplication step.
+% for the business end. Where possible, we avoid the relatively expensive
+% multiplication step.
% \begin{macrocode}
\cs_new:Npn \draw_point_transform:n #1
{
- \@@_point_expand:nnN {#1} { { } { } }
- \@@_point_transform:nnnn
+ \@@_point_process:nn
+ { \@@_point_transform:nn } {#1}
}
-\cs_new:Npn \@@_point_transform:nnnn #1#2#3#4
- { \@@_point_transform:nn {#1} {#2} }
\cs_new:Npn \@@_point_transform:nn #1#2
{
\bool_if:NTF \l_@@_transformcm_active_bool
{
- {
- \fp_to_dim:n
- {
+ \@@_point_to_dim:n
+ {
+ (
\l_@@_transformcm_aa_fp * #1
+ \l_@@_transformcm_ba_fp * #2
+ \l_@@_transformcm_xshift_dim
- }
- }
- {
- \fp_to_dim:n
- {
+ )
+ ,
+ (
\l_@@_transformcm_ab_fp * #1
+ \l_@@_transformcm_bb_fp * #2
+ \l_@@_transformcm_yshift_dim
- }
+ )
}
}
{
- { \fp_to_dim:n { #1 + \l_@@_transformcm_xshift_dim } }
- { \fp_to_dim:n { #2 + \l_@@_transformcm_yshift_dim } }
+ \@@_point_to_dim:n
+ {
+ (#1, #2)
+ + ( \l_@@_transformcm_xshift_dim ,
+ \l_@@_transformcm_yshift_dim )
+ }
}
}
% \end{macrocode}
% \end{macro}
% \end{macro}
-% \end{macro}
%
% \begin{macrocode}
%</initex|package>
diff --git a/l3trial/l3draw/l3draw-transforms.dtx b/l3trial/l3draw/l3draw-transforms.dtx
index 58cc209..f9f6747 100644
--- a/l3trial/l3draw/l3draw-transforms.dtx
+++ b/l3trial/l3draw/l3draw-transforms.dtx
@@ -102,24 +102,25 @@
% \end{macro}
%
% \begin{macro}{\draw_transform_set:nnnnn}
-% \begin{macro}{\@@_transform_set:nnnnnw}
+% \begin{macro}{\@@_transform_set:nnnnnnn}
% Setting the transform matrix is straight-forward, with just a bit
% of expansion to sort out. With the mechanism active, the identity
% matrix is set.
% \begin{macrocode}
\cs_new_protected:Npn \draw_transform_set:nnnnn #1#2#3#4#5
{
- \use:x
- { \@@_transform_set:nnnnnw {#1} {#2} {#3} {#4} \fp_eval:n {#5} }
+ \@@_point_process:nn
+ { \@@_transform_set:nnnnnnn {#1} {#2} {#3} {#4} }
+ {#5}
}
-\cs_new_protected:Npn \@@_transform_set:nnnnnw #1#2#3#4 ( #5 , #6 )
+\cs_new_protected:Npn \@@_transform_set:nnnnnnn #1#2#3#4#5#6
{
\fp_set:Nn \l_@@_transformcm_aa_fp {#1}
\fp_set:Nn \l_@@_transformcm_ab_fp {#2}
\fp_set:Nn \l_@@_transformcm_ba_fp {#3}
\fp_set:Nn \l_@@_transformcm_bb_fp {#4}
- \dim_set:Nn \l_@@_transformcm_xshift_dim { #5pt }
- \dim_set:Nn \l_@@_transformcm_yshift_dim { #6pt }
+ \dim_set:Nn \l_@@_transformcm_xshift_dim {#5}
+ \dim_set:Nn \l_@@_transformcm_yshift_dim {#6}
\bool_lazy_all:nTF
{
{ \fp_compare_p:nNn \l_@@_transformcm_aa_fp = \c_one_fp }
@@ -136,7 +137,7 @@
% \end{macro}
%
% \begin{macro}{\draw_transform_add:nnnnn}
-% \begin{macro}{\@@_transform_add:nnnnnw}
+% \begin{macro}{\@@_transform_add:nnnnnn}
% \begin{macro}{\@@_transform_add_aux:nnnnnn}
% Much the same story for adding to an existing matrix. The part that is more
% complex is the calculations required: everything gets passed back to
@@ -146,10 +147,11 @@
% \begin{macrocode}
\cs_new_protected:Npn \draw_transform_add:nnnnn #1#2#3#4#5
{
- \use:x
- { \@@_transform_add:nnnnnw {#1} {#2} {#3} {#4} \fp_eval:n {#5} }
+ \@@_point_process:nn
+ { \@@_transform_add:nnnnnn {#1} {#2} {#3} {#4} }
+ {#5}
}
-\cs_new_protected:Npn \@@_transform_add:nnnnnw #1#2#3#4 ( #5 , #6 )
+\cs_new_protected:Npn \@@_transform_add:nnnnnn #1#2#3#4#5#6
{
\use:x
{
@@ -166,23 +168,27 @@
{
\use:x
{
- \@@_transform_set:nnnnnw
+ \@@_transform_set:nnnnnnn
{ #1 * \l_@@_transformcm_aa_fp + #2 * \l_@@_transformcm_ba_fp }
{ #1 * \l_@@_transformcm_ab_fp + #2 * \l_@@_transformcm_bb_fp }
{ #3 * \l_@@_transformcm_aa_fp + #4 * \l_@@_transformcm_ba_fp }
{ #3 * \l_@@_transformcm_ab_fp + #4 * \l_@@_transformcm_bb_fp }
- \fp_eval:n
- {
- (
+ {
+ \fp_to_dim:n
+ {
\l_@@_transformcm_xshift_dim
+ \l_@@_transformcm_aa_fp * #5
+ \l_@@_transformcm_ba_fp * #6
- ,
+ }
+ }
+ {
+ \fp_to_dim:n
+ {
\l_@@_transformcm_yshift_dim
+ \l_@@_transformcm_ab_fp * #5
+ \l_@@_transformcm_bb_fp * #6
- )
- }
+ }
+ }
}
}
% \end{macrocode}
diff --git a/l3trial/l3draw/testfiles/m3draw001.lvt b/l3trial/l3draw/testfiles/m3draw001.lvt
index 22b0060..90df972 100644
--- a/l3trial/l3draw/testfiles/m3draw001.lvt
+++ b/l3trial/l3draw/testfiles/m3draw001.lvt
@@ -44,7 +44,7 @@
{ \draw_point_vec:nn { 0 } { 1 } }
{ \draw_point_vec:nn { 2 } { 3 } }
\NEWLINE
- \draw_point_add:nn { { 1cm } { 1cm } } { { 2cm } { 2cm } }
+ \draw_point_add:nn { 1cm , 1cm } { 2cm , 2cm }
}
\TESTEXP { \draw_point_diff:nn }
@@ -53,7 +53,7 @@
{ \draw_point_vec:nn { 1 } { 1 } }
{ \draw_point_vec:nn { 2 } { 3 } }
\NEWLINE
- \draw_point_diff:nn { { 1cm } { 1cm } } { { 2cm } { 2cm } }
+ \draw_point_diff:nn { 1cm , 1cm } { 2cm , 2cm }
}
\TESTEXP { \draw_point_scale:nn }
@@ -61,7 +61,7 @@
\draw_point_scale:nn { 2 }
{ \draw_point_vec:nn { 0 } { 1 } }
\NEWLINE
- \draw_point_scale:nn { 0.5 ^ 2 } { { 2cm } { 2cm } }
+ \draw_point_scale:nn { 0.5 ^ 2 } { 2cm , 2cm }
}
\TESTEXP { \draw_point_unit_vector:n }
@@ -119,6 +119,17 @@
{ \draw_point_vec:nn { 0 } { 1 } }
}
+\TESTEXP { \draw_point_interpolate_arc:nnnnnn }
+ {
+ \draw_point_interpolate_arc:nnnnnn
+ { 0.25 }
+ { 1cm , 1cm }
+ { 1cm , 0cm }
+ { 0cm , 1cm }
+ { 30 }
+ { 40 }
+ }
+
\TESTEXP { \draw_point_interpolate_curve:nnnnnn }
{
\draw_point_interpolate_curve:nnnnnn
@@ -129,31 +140,20 @@
{ \draw_point_vec:nn { 2 } { 3 } }
}
-\TESTEXP { \draw_point_interpolate_arc:nnnnnn }
- {
- \draw_point_interpolate_arc:nnnnnn
- { 0.25 }
- { { 1cm } { 1cm } }
- { { 1cm } { 0cm } }
- { { 0cm } { 1cm } }
- { 30 }
- { 40 }
- }
-
\TEST { \draw_set_<axis>vec:n }
{
\exp_args:Nx \tl_show:n { \draw_point_vec:nnn { 1 } { 1 } { 1 } }
- \draw_xvec_set:n { { 1cm } { 1cm } }
+ \draw_xvec_set:n { 1cm , 1cm }
\exp_args:Nx \tl_show:n { \draw_point_vec:nnn { 1 } { 1 } { 1 } }
- \draw_yvec_set:n { { 1cm } { 1cm } }
+ \draw_yvec_set:n { 1cm , 1cm }
\exp_args:Nx \tl_show:n { \draw_point_vec:nnn { 1 } { 1 } { 1 } }
- \draw_zvec_set:n { { 1cm } { 1cm } }
+ \draw_zvec_set:n { 1cm , 1cm }
\exp_args:Nx \tl_show:n { \draw_point_vec:nnn { 1 } { 1 } { 1 } }
}
\OMIT
- \draw_xvec_set:n { { 1cm } { 1cm } }
- \draw_yvec_set:n { { 0cm } { 1cm } }
+ \draw_xvec_set:n { 1cm , 1cm }
+ \draw_yvec_set:n { 0cm , 1cm }
\TIMO
\TESTEXP { \draw_point_vec:nn }
@@ -168,8 +168,8 @@
}
\OMIT
- \draw_xvec_set:n { { 1cm } { 0cm } }
- \draw_yvec_set:n { { 0cm } { 1cm } }
+ \draw_xvec_set:n { 1cm , 0cm }
+ \draw_yvec_set:n { 0cm , 1cm }
\TIMO
\TESTEXP { \draw_point_vec:nnn }
diff --git a/l3trial/l3draw/testfiles/m3draw001.tlg b/l3trial/l3draw/testfiles/m3draw001.tlg
index 38067e8..32734a4 100644
--- a/l3trial/l3draw/testfiles/m3draw001.tlg
+++ b/l3trial/l3draw/testfiles/m3draw001.tlg
@@ -3,109 +3,109 @@ Don't change this file in any respect.
============================================================
TEST 1: \draw_point:nn
============================================================
-{87.35826771653543pt}{85.35826771653543pt}
-{10pt}{28.45275590551181pt}
-{10pt}{1pt}
-{995.8464566929134pt}{1.414213562373095pt}
+87.35826771653543pt, 85.35826771653543pt
+10pt, 28.45275590551181pt
+10pt, 1pt
+995.8464566929134pt, 1.414213562373095pt
============================================================
============================================================
TEST 2: \draw_point_polar:nn
============================================================
-{24.64080942185094pt}{14.2263779527559pt}
-{24.64080942185094pt}{28.45275590551181pt}
-{24.64080942185094pt}{28.45275590551181pt}
+24.64080942185094pt, 14.2263779527559pt
+24.64080942185094pt, 28.45275590551181pt
+24.64080942185094pt, 28.45275590551181pt
============================================================
============================================================
TEST 3: \draw_point_add:nn
============================================================
-{56.90548706054688pt}{113.8109741210938pt}
-{85.35826771653543pt}{85.35826771653543pt}
+56.905517578125pt, 113.81103515625pt
+85.35826771653543pt, 85.35826771653543pt
============================================================
============================================================
TEST 4: \draw_point_diff:nn
============================================================
-{28.45274353027344pt}{56.90548706054688pt}
-{28.45275590551181pt}{28.45275590551181pt}
+28.4527587890625pt, 56.905517578125pt
+28.45275590551181pt, 28.45275590551181pt
============================================================
============================================================
TEST 5: \draw_point_scale:nn
============================================================
-{0pt}{56.90548706054688pt}
-{14.2263779527559pt}{14.2263779527559pt}
+0pt, 56.905517578125pt
+14.2263779527559pt, 14.2263779527559pt
============================================================
============================================================
TEST 6: \draw_point_unit_vector:n
============================================================
-{0.894427190999916pt}{0.447213595499958pt}
-{-0.894427190999916pt}{0.447213595499958pt}
+0.8944271909999158pt, 0.4472135954999579pt
+-0.8944271909999158pt, 0.4472135954999579pt
============================================================
============================================================
TEST 7: \draw_point_intersect_lines:nnnn
============================================================
-{28.45274353027345pt}{-0.000000000000008234940062507525pt}
-{10.51038833340825pt}{10.51038833340825pt}
+28.45275878906251pt, -0.000000000000004117465614979737pt
+10.51039396997536pt, 10.51039396997536pt
============================================================
============================================================
TEST 8: \draw_point_intersect_circles:nnnnn
============================================================
-{-0.00001237523567pt}{-0.00001237523569pt}
+0.00000288355082pt, 0.00000288355084pt
============================================================
============================================================
TEST 9: \draw_point_interpolate_line:nnn
============================================================
-{28.45274353027344pt}{56.90548706054688pt}
+28.4527587890625pt, 56.905517578125pt
============================================================
============================================================
TEST 10: \draw_point_interpolate_distance:nnn
============================================================
-{1.414213562373095pt}{30.57406387383308pt}
-{56.90548706054688pt}{86.41889076260014pt}
+1.414213562373095pt, 30.57407913262214pt
+56.905517578125pt, 86.41893653896732pt
============================================================
============================================================
-TEST 11: \draw_point_interpolate_curve:nnnnnn
+TEST 11: \draw_point_interpolate_arc:nnnnnn
============================================================
-{28.45274353027344pt}{35.5659294128418pt}
+52.44956684602254pt, 43.74041050993108pt
============================================================
============================================================
-TEST 12: \draw_point_interpolate_arc:nnnnnn
+TEST 12: \draw_point_interpolate_curve:nnnnnn
============================================================
-{52.44956684602254pt}{43.74041050993108pt}
+28.4527587890625pt, 35.56594848632813pt
============================================================
============================================================
TEST 13: \draw_set_ <axis>vec:n
============================================================
-> {17.49859619140625pt}{17.49859619140625pt}.
+> 17.49844360351562pt, 17.49844360351562pt.
<recently read> }
l. ... }
-> {17.49859619140625pt}{45.95133972167969pt}.
+> 17.49844360351562pt, 45.95120239257812pt.
<recently read> }
l. ... }
-> {45.95133972167969pt}{45.95133972167969pt}.
+> 45.95120239257812pt, 45.95120239257812pt.
<recently read> }
l. ... }
-> {85.35823059082032pt}{85.35823059082032pt}.
+> 85.3582763671875pt, 85.3582763671875pt.
<recently read> }
l. ... }
============================================================
============================================================
TEST 14: \draw_point_vec:nn
============================================================
-{0pt}{0pt}
-{28.45274353027344pt}{28.45274353027344pt}
-{28.45274353027344pt}{56.90548706054688pt}
-{28.45274353027344pt}{28.45274353027344pt}
+0pt, 0pt
+28.4527587890625pt, 28.4527587890625pt
+28.4527587890625pt, 56.905517578125pt
+28.4527587890625pt, 28.4527587890625pt
============================================================
============================================================
TEST 15: \draw_point_vec:nnn
============================================================
-{0pt}{0pt}
-{-10.95414733886719pt}{-10.95414733886719pt}
-{0pt}{28.45274353027344pt}
-{-10.95414733886719pt}{17.49859619140625pt}
+0pt, 0pt
+-10.95431518554688pt, -10.95431518554688pt
+0pt, 28.4527587890625pt
+-10.95431518554688pt, 17.49844360351562pt
============================================================
============================================================
TEST 16: \draw_point_vec_polar:nn
============================================================
-{49.28159740916025pt}{28.45274353027344pt}
-{24.64079870458013pt}{28.45274353027344pt}
+49.28162383815817pt, 28.4527587890625pt
+24.64081191907909pt, 28.4527587890625pt
============================================================
diff --git a/l3trial/l3draw/testfiles/m3draw002.lvt b/l3trial/l3draw/testfiles/m3draw002.lvt
index 4947b0d..c29fbce 100644
--- a/l3trial/l3draw/testfiles/m3draw002.lvt
+++ b/l3trial/l3draw/testfiles/m3draw002.lvt
@@ -19,26 +19,26 @@
\TEST { \draw_transform_set:nnnnn }
{
- \exp_args:Nx \tl_show:n { \draw_point_transform:n { { 1 } { 1 } } }
- \draw_transform_set:nnnnn { 1 } { 1 } { 1 } { 1 } { ( 0pt , 0pt ) }
- \exp_args:Nx \tl_show:n { \draw_point_transform:n { { 1 } { 1 } } }
- \draw_transform_set:nnnnn { 1 } { 0 } { 0 } { 1 } { ( 10pt , -10pt ) }
- \exp_args:Nx \tl_show:n { \draw_point_transform:n { { 1 } { 1 } } }
+ \exp_args:Nx \tl_show:n { \draw_point_transform:n { 1 , 1 } }
+ \draw_transform_set:nnnnn { 1 } { 1 } { 1 } { 1 } { 0pt , 0pt }
+ \exp_args:Nx \tl_show:n { \draw_point_transform:n { 1 ,1 } }
+ \draw_transform_set:nnnnn { 1 } { 0 } { 0 } { 1 } { 10pt , -10pt }
+ \exp_args:Nx \tl_show:n { \draw_point_transform:n { 1 , 1 } }
}
\TEST { \draw_transform_add:nnnnn }
{
+ \exp_args:Nx \tl_show:n { \draw_point_transform:n { 1 , 1 } }
+ \draw_transform_add:nnnnn { 1 } { 1 } { 1 } { 1 } { 0pt , 0pt }
\exp_args:Nx \tl_show:n { \draw_point_transform:n { { 1 } { 1 } } }
- \draw_transform_add:nnnnn { 1 } { 1 } { 1 } { 1 } { ( 0pt , 0pt ) }
- \exp_args:Nx \tl_show:n { \draw_point_transform:n { { 1 } { 1 } } }
- \draw_transform_add:nnnnn { 1 } { 0 } { 0 } { 1 } { ( 10pt , -10pt ) }
- \exp_args:Nx \tl_show:n { \draw_point_transform:n { { 1 } { 1 } } }
+ \draw_transform_add:nnnnn { 1 } { 0 } { 0 } { 1 } { 10pt , -10pt }
+ \exp_args:Nx \tl_show:n { \draw_point_transform:n { 1 , 1 } }
}
\TEST { \draw_transform_invert: }
{
- \draw_transform_set:nnnnn { 1 } { 0 } { 1 } { 1 } { ( 10pt , 0pt ) }
- \tl_set:Nx \l_tmpa_tl { \draw_point_transform:n { { 1 } { 1 } } }
+ \draw_transform_set:nnnnn { 1 } { 0 } { 1 } { 1 } { 10pt , 0pt }
+ \tl_set:Nx \l_tmpa_tl { \draw_point_transform:n { 1 , 1 } }
\tl_show:N \l_tmpa_tl
\draw_transform_invert:
\exp_args:Nx \tl_show:n { \draw_point_transform:n { \l_tmpa_tl } }
@@ -46,9 +46,9 @@
\TEST { \draw_transform_reset: }
{
- \draw_transform_set:nnnnn { 1 } { 0 } { 1 } { 1 } { ( 10pt , 0pt ) }
+ \draw_transform_set:nnnnn { 1 } { 0 } { 1 } { 1 } { 10pt , 0pt }
\draw_transform_reset:
- \exp_args:Nx \tl_show:n { \draw_point_transform:n { { 1 } { 1 } } }
+ \exp_args:Nx \tl_show:n { \draw_point_transform:n { 1 , 1 } }
}
diff --git a/l3trial/l3draw/testfiles/m3draw003.lvt b/l3trial/l3draw/testfiles/m3draw003.lvt
index 9a077e9..96bcc34 100644
--- a/l3trial/l3draw/testfiles/m3draw003.lvt
+++ b/l3trial/l3draw/testfiles/m3draw003.lvt
@@ -31,13 +31,13 @@
\TEST { \draw_path_moveto:n }
{
\test:n
- { \draw_path_moveto:n { { 10pt } { 10pt } } }
+ { \draw_path_moveto:n { 10pt , 10pt } }
}
\TEST { \draw_path_lineto:n }
{
\test:n
- { \draw_path_lineto:n { { 10pt } { 10pt } } }
+ { \draw_path_lineto:n { 10pt , 10pt } }
}
\TEST { \draw_path_curveto:nnn }
@@ -55,10 +55,10 @@
{
\test:n
{
- \draw_path_moveto:n { { 0 } { 0 } }
- \draw_path_lineto:n { { 1 } { 0 } }
- \draw_path_lineto:n { { 1 } { 1 } }
- \draw_path_lineto:n { { 0 } { 1 } }
+ \draw_path_moveto:n { 0 , 0 }
+ \draw_path_lineto:n { 1 , 0 }
+ \draw_path_lineto:n { 1 , 1 }
+ \draw_path_lineto:n { 0 , 1 }
\draw_path_close:
}
}
diff --git a/l3trial/l3draw/testfiles/m3draw003.tlg b/l3trial/l3draw/testfiles/m3draw003.tlg
index 2e4d4fa..1e9737a 100644
--- a/l3trial/l3draw/testfiles/m3draw003.tlg
+++ b/l3trial/l3draw/testfiles/m3draw003.tlg
@@ -33,7 +33,7 @@ TEST 3: \draw_path_curveto:nnn
\hbox(0.0+0.0)x0.0
.\hbox(0.0+0.0)x0.0
..\pdfliteral{q}
-..\pdfliteral{0 28.34645 28.34645 28.34645 28.34645 56.69289 c}
+..\pdfliteral{0 28.34647 28.34647 28.34647 28.34647 56.69292 c}
..\pdfliteral{Q}
! OK.
<argument> \l_tmpa_box
More information about the latex3-commits
mailing list