[latex3-commits] [git/LaTeX3-latex3-latex3] master: l3draw: Polar coords (4bb54ba)

Joseph Wright joseph.wright at morningstar2.co.uk
Thu Feb 8 08:56:25 CET 2018


Repository : https://github.com/latex3/latex3
On branch  : master
Link       : https://github.com/latex3/latex3/commit/4bb54ba8b3a53d2c622a08123193d99f5498afc3

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

commit 4bb54ba8b3a53d2c622a08123193d99f5498afc3
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Thu Feb 8 07:56:25 2018 +0000

    l3draw: Polar coords


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

4bb54ba8b3a53d2c622a08123193d99f5498afc3
 l3trial/l3draw/l3draw-points.dtx |   21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/l3trial/l3draw/l3draw-points.dtx b/l3trial/l3draw/l3draw-points.dtx
index f0d908a..55e0a64 100644
--- a/l3trial/l3draw/l3draw-points.dtx
+++ b/l3trial/l3draw/l3draw-points.dtx
@@ -113,6 +113,27 @@
 %    \end{macrocode}
 % \end{macro}
 %
+% \subsection{Polar co-ordinates}
+%
+% \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.
+%    \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
+  {
+    { \fp_to_dim:n { cosd(#1) * (#2) } }
+    { \fp_to_dim:n { sind(#1) * (#3) } }
+  }
+\cs_generate_variant:Nn \@@_draw_polar:nw { f }
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
 % \subsection{Point expression arithmetic}
 %
 % These functions all take point expressions as arguments.





More information about the latex3-commits mailing list