[latex3-commits] [git/LaTeX3-latex3-latex3] master: Introduce \draw_point:nn (82f5195)

Joseph Wright joseph.wright at morningstar2.co.uk
Sat Feb 9 09:37:47 CET 2019


Repository : https://github.com/latex3/latex3
On branch  : master
Link       : https://github.com/latex3/latex3/commit/82f5195b63abaf51e3c8ddc609848fe4328e94d3

>---------------------------------------------------------------

commit 82f5195b63abaf51e3c8ddc609848fe4328e94d3
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Sat Feb 9 08:37:47 2019 +0000

    Introduce \draw_point:nn
    
    This will be needed for an upcoming change, which
    will drop evaluation of points in general.


>---------------------------------------------------------------

82f5195b63abaf51e3c8ddc609848fe4328e94d3
 l3experimental/l3draw/l3draw-points.dtx       |   10 ++++++++
 l3experimental/l3draw/l3draw.dtx              |   34 +++++++++++++------------
 l3experimental/l3draw/testfiles/m3draw001.lvt |    8 ++++++
 l3experimental/l3draw/testfiles/m3draw001.tlg |   30 +++++++++++++---------
 4 files changed, 54 insertions(+), 28 deletions(-)

diff --git a/l3experimental/l3draw/l3draw-points.dtx b/l3experimental/l3draw/l3draw-points.dtx
index 5c81074..9320c98 100644
--- a/l3experimental/l3draw/l3draw-points.dtx
+++ b/l3experimental/l3draw/l3draw-points.dtx
@@ -149,6 +149,16 @@
 % \end{macro}
 % \end{macro}
 %
+% \subsection{Cartesian co-ordinates}
+%
+% \begin{macro}[EXP]{\draw_point:n}
+%   A simple wrapper.
+%    \begin{macrocode}
+\cs_new:Npn \draw_point:nn #1#2
+  { \@@_point_to_dim:n { #1 , #2 } }
+%    \end{macrocode}
+% \end{macro}
+%
 % \subsection{Polar co-ordinates}
 %
 % \begin{macro}[EXP]{\draw_point_polar:nn}
diff --git a/l3experimental/l3draw/l3draw.dtx b/l3experimental/l3draw/l3draw.dtx
index 90e9b27..5ee9f41 100644
--- a/l3experimental/l3draw/l3draw.dtx
+++ b/l3experimental/l3draw/l3draw.dtx
@@ -152,10 +152,10 @@
 %   \begin{demo}
 %     \dim_new:N \l_mypos_dim
 %     \draw_begin:
-%       \draw_path_moveto:n { 0cm , \l_mypos_dim }
-%       \draw_path_lineto:n { 1cm , \l_mypos_dim }
+%       \draw_path_moveto:n { \draw_point:nn { 0cm } { \l_mypos_dim } }
+%       \draw_path_lineto:n { \draw_point:nn { 1cm } { \l_mypos_dim } }
 %       \dim_set:Nn \l_mypos_dim { 1cm }
-%       \draw_path_lineto:n { 1cm , \l_mypos_dim }
+%       \draw_path_lineto:n { \draw_point:nn { 1cm } { \l_mypos_dim } }
 %       \draw_path_close:
 %       \draw_path_use_clear:n { stroke }
 %     \draw_end:
@@ -367,7 +367,7 @@
 % and may be used outside of the drawing environment. When used in this
 % way, they all yield a co-ordinate tuple, for example
 % \begin{verbatim}
-%   \tl_set:Nx \l_tmpa_tl { \draw_point:nn { 1 } { 2 } }
+%   \tl_set:Nx \l_tmpa_tl { \draw_point:n { 1 } { 2 } }
 %   \tl_show:N \l_tmpa_tl
 % \end{verbatim}
 % gives
@@ -378,17 +378,10 @@
 %
 % This output form is then suitable as \emph{input} for subsequent point
 % calculations, \emph{i.e.}~where a \meta{point} is required it may be
-% given as a tuple. This \emph{may} include units and surrounding
-% parentheses, for example
-% \begin{verbatim}
-%   1,2
-%   (1,2)
-%   1cm,3pt
-%   (1pt,2cm)
-%   2 * sind(30), 2^4in
-% \end{verbatim}
-% are all valid input forms. Notice that each part of the tuple may itself
-% be a float point expression.
+% given as a tuple. For performance reasons, points are subject to
+% \texttt{f}-type expansion but no further processing. Functions such as
+% \cs{draw_point:nn} should therefore be used when a point contains
+% expression material.
 %
 % Point co-ordinates are relative to the canvas axes, but can be transformed
 % by \cs{draw_point_transform:n}. These manipulation is applied by many
@@ -399,10 +392,19 @@
 % manipulation of the canvas axes themselves.
 %
 % Notice that in contrast to \pkg{pgf} it is possible to give the positions
-% of points \emph{directly}.
+% of points \emph{directly} provided it is given explicitly as a tuple of
+% dimensions.
 %
 % \subsubsection{Basic point functions}
 %
+% \begin{function}[EXP]{\draw_point:nn}
+%   \begin{syntax}
+%     \cs{draw_point:n} \Arg{x} \Arg{y}
+%   \end{syntax}
+%   Gives the co-ordinates of the point at the two co-ordindates. These
+%   may both be given as floating point expressions.
+% \end{function}
+%
 % \begin{function}[EXP]{\draw_point_polar:nn, \draw_point_polar:nnn}
 %   \begin{syntax}
 %     \cs{draw_point_polar:nn} \Arg{angle} \Arg{radius}
diff --git a/l3experimental/l3draw/testfiles/m3draw001.lvt b/l3experimental/l3draw/testfiles/m3draw001.lvt
index 00e8f67..eeebd2a 100644
--- a/l3experimental/l3draw/testfiles/m3draw001.lvt
+++ b/l3experimental/l3draw/testfiles/m3draw001.lvt
@@ -17,6 +17,14 @@
 
 \START
 
+\TESTEXP { \draw_point:nn }
+  {
+    \draw_point:nn { 1 } { 2 }
+    \NEWLINE
+    \draw_point:nn { 1 + 2 } { 3 * sqrt(4) cm }
+    \NEWLINE
+  }
+
 \TESTEXP { \draw_point_polar:nn(n) }
   {
     \draw_point_polar:nn { 30 } { 1cm }
diff --git a/l3experimental/l3draw/testfiles/m3draw001.tlg b/l3experimental/l3draw/testfiles/m3draw001.tlg
index f8c56c7..0d3f99c 100644
--- a/l3experimental/l3draw/testfiles/m3draw001.tlg
+++ b/l3experimental/l3draw/testfiles/m3draw001.tlg
@@ -1,52 +1,58 @@
 This is a generated file for the LaTeX (2e + expl3) validation system.
 Don't change this file in any respect.
 ============================================================
-TEST 1: \draw_point_polar:nn (n)
+TEST 1: \draw_point:nn 
+============================================================
+1pt,2pt
+3pt,170.7165354330709pt
+============================================================
+============================================================
+TEST 2: \draw_point_polar:nn (n)
 ============================================================
 24.64080942185094pt,14.2263779527559pt
 24.64080942185094pt,28.45275590551181pt
 24.64080942185094pt,28.45275590551181pt
 ============================================================
 ============================================================
-TEST 2: \draw_point_unit_vector:n 
+TEST 3: \draw_point_unit_vector:n 
 ============================================================
 0.894427190999916pt,0.447213595499958pt
 -0.894427190999916pt,0.447213595499958pt
 ============================================================
 ============================================================
-TEST 3: \draw_point_intersect_lines:nnnn 
+TEST 4: \draw_point_intersect_lines:nnnn 
 ============================================================
 28.4527587890625pt,-0.000000000000004117465614979737pt
 10.51039396997536pt,10.51039396997536pt
 ============================================================
 ============================================================
-TEST 4: \draw_point_intersect_circles:nnnnn 
+TEST 5: \draw_point_intersect_circles:nnnnn 
 ============================================================
 0.00000288355082pt,0.00000288355084pt
 ============================================================
 ============================================================
-TEST 5: \draw_point_interpolate_line:nnn 
+TEST 6: \draw_point_interpolate_line:nnn 
 ============================================================
 28.4527587890625pt,56.905517578125pt
 ============================================================
 ============================================================
-TEST 6: \draw_point_interpolate_distance:nnn 
+TEST 7: \draw_point_interpolate_distance:nnn 
 ============================================================
 1.414213562373095pt,29.8669723514356pt
 54.78419723456536pt,83.23695602362786pt
 ============================================================
 ============================================================
-TEST 7: \draw_point_interpolate_arcaxes:nnnnnn 
+TEST 8: \draw_point_interpolate_arcaxes:nnnnnn 
 ============================================================
 52.44956684602254pt,43.74041050993108pt
 ============================================================
 ============================================================
-TEST 8: \draw_point_interpolate_curve:nnnnnn 
+TEST 9: \draw_point_interpolate_curve:nnnnnn 
 ============================================================
 28.4527587890625pt,35.56594848632813pt
 ============================================================
 ============================================================
-TEST 9: \draw_set_ <axis>vec:n
+TEST 10: \draw_set_ <axis>vec:n
 ============================================================
 > 17.49844360351562pt,17.49844360351562pt.
 <recently read> }
@@ -62,7 +68,7 @@ l. ...  }
 l. ...  }
 ============================================================
 ============================================================
-TEST 10: \draw_point_vec:nn 
+TEST 11: \draw_point_vec:nn 
 ============================================================
 0pt,0pt
 28.4527587890625pt,28.4527587890625pt
@@ -70,7 +76,7 @@ TEST 10: \draw_point_vec:nn
 28.4527587890625pt,28.4527587890625pt
 ============================================================
 ============================================================
-TEST 11: \draw_point_vec:nnn 
+TEST 12: \draw_point_vec:nnn 
 ============================================================
 0pt,0pt
 -10.95431518554688pt,-10.95431518554688pt
@@ -78,7 +84,7 @@ TEST 11: \draw_point_vec:nnn
 -10.95431518554688pt,17.49844360351562pt
 ============================================================
 ============================================================
-TEST 12: \draw_point_vec_polar:nn (n)
+TEST 13: \draw_point_vec_polar:nn (n)
 ============================================================
 49.28162383815817pt,28.4527587890625pt
 24.64081191907909pt,28.4527587890625pt





More information about the latex3-commits mailing list