[latex3-commits] [git/LaTeX3-latex3-latex3] master: l3draw: Alter a few 'optimisations' (35a9c84)
Joseph Wright
joseph.wright at morningstar2.co.uk
Mon Feb 12 21:41:11 CET 2018
Repository : https://github.com/latex3/latex3
On branch : master
Link : https://github.com/latex3/latex3/commit/35a9c84bf285e9b1202b27477c7e593067166fd4
>---------------------------------------------------------------
commit 35a9c84bf285e9b1202b27477c7e593067166fd4
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date: Mon Feb 12 20:41:11 2018 +0000
l3draw: Alter a few 'optimisations'
May have more to adjust here yet: await more ideas from Bruno!
>---------------------------------------------------------------
35a9c84bf285e9b1202b27477c7e593067166fd4
l3trial/l3draw/l3draw-points.dtx | 30 +++++++-----------------------
l3trial/l3draw/testfiles/m3draw001.tlg | 6 +++---
2 files changed, 10 insertions(+), 26 deletions(-)
diff --git a/l3trial/l3draw/l3draw-points.dtx b/l3trial/l3draw/l3draw-points.dtx
index f12ed2f..e853f33 100644
--- a/l3trial/l3draw/l3draw-points.dtx
+++ b/l3trial/l3draw/l3draw-points.dtx
@@ -193,7 +193,6 @@
%
% \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.}
@@ -206,20 +205,12 @@
{ \@@_point_process:nn { \@@_point_unit_vector:nn } {#1} }
\cs_new:Npn \@@_point_unit_vector:nn #1#2
{
- \@@_point_unit_vector:fnn
- { \fp_eval:n { 1 / sqrt( #1 * #1 + #2 * #2 ) } }
- {#1} {#2}
- }
-\cs_new:Npn \@@_point_unit_vector:nnn #1#2#3
- {
\@@_point_to_dim:n
- { ( #2 , #3 ) * #1 }
+ { ( #1 , #2 ) / (sqrt(#1 * #1 + #2 * #2)) }
}
-\cs_generate_variant:Nn \@@_point_unit_vector:nnn { f }
% \end{macrocode}
% \end{macro}
% \end{macro}
-% \end{macro}
%
% \subsection{Intersection calculations}
%
@@ -228,8 +219,6 @@
% \begin{macro}[EXP]{\@@_point_intersect_lines:nnnnnnnn}
% \begin{macro}[EXP]
% {\@@_point_intersect_lines_aux:nnnnnn, \@@_point_intersect_lines_aux:ffffff}
-% \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})$
% and $(x_{4}, y_{4})$ can be calculated using the formulae
@@ -286,23 +275,18 @@
}
\cs_new:Npn \@@_point_intersect_lines_aux:nnnnnn #1#2#3#4#5#6
{
- \@@_point_intersect_lines_aux:fnnnnnn
- { \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
- {
\@@_point_to_dim:n
- { #1 * ( #3 * #4 - #2 * #5 , #3 * #6 - #2 * #7 ) }
+ {
+ ( #2 * #3 - #1 * #4 , #2 * #5 - #1 * #6 )
+ / ( #4 * #5 - #6 * #3 )
+ }
}
-\cs_generate_variant:Nn \@@_point_intersect_lines_aux:nnnnnnn { f }
+\cs_generate_variant:Nn \@@_point_intersect_lines_aux:nnnnnn { ffffff }
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
-% \end{macro}
%
% \begin{macro}[EXP]{\draw_point_intersect_circles:nnnnn}
% \begin{macro}[EXP]{\@@_point_intersect_circles_auxi:nnnnnnn}
@@ -523,7 +507,7 @@
\cs_new:Npn \@@_point_interpolate_distance_aux:nnnnnnn #1#2#3#4#5#6#7
{
\@@_point_interpolate_distance_aux:fnnnn
- { \fp_eval:n { (#7) / sqrt ( #1 * #1 + #2 * #2 ) } }
+ { \fp_eval:n { (#7) / (sqrt ( #1 * #1 + #2 * #2 )) } }
{#3} {#4} {#5} {#6}
}
\cs_generate_variant:Nn \@@_point_interpolate_distance_aux:nnnnnnn { ff }
diff --git a/l3trial/l3draw/testfiles/m3draw001.tlg b/l3trial/l3draw/testfiles/m3draw001.tlg
index 32734a4..93a787d 100644
--- a/l3trial/l3draw/testfiles/m3draw001.tlg
+++ b/l3trial/l3draw/testfiles/m3draw001.tlg
@@ -36,13 +36,13 @@ TEST 5: \draw_point_scale:nn
============================================================
TEST 6: \draw_point_unit_vector:n
============================================================
-0.8944271909999158pt, 0.4472135954999579pt
--0.8944271909999158pt, 0.4472135954999579pt
+0.894427190999916pt, 0.447213595499958pt
+-0.894427190999916pt, 0.447213595499958pt
============================================================
============================================================
TEST 7: \draw_point_intersect_lines:nnnn
============================================================
-28.45275878906251pt, -0.000000000000004117465614979737pt
+28.4527587890625pt, -0.000000000000004117465614979737pt
10.51039396997536pt, 10.51039396997536pt
============================================================
============================================================
More information about the latex3-commits
mailing list