texlive[52978] Master/texmfdist: curve2e (30nov19)
commits+karl at tug.org
commits+karl at tug.org
Sat Nov 30 23:13:04 CET 2019
Revision: 52978
http://tug.org/svn/texlive?view=revision&revision=52978
Author: karl
Date: 20191130 23:13:04 +0100 (Sat, 30 Nov 2019)
Log Message:

curve2e (30nov19)
Modified Paths:

trunk/Master/texmfdist/doc/latex/curve2e/README.txt
trunk/Master/texmfdist/doc/latex/curve2e/curve2e.pdf
trunk/Master/texmfdist/source/latex/curve2e/curve2e.dtx
trunk/Master/texmfdist/tex/latex/curve2e/curve2e.sty
Modified: trunk/Master/texmfdist/doc/latex/curve2e/README.txt
===================================================================
 trunk/Master/texmfdist/doc/latex/curve2e/README.txt 20191130 22:12:51 UTC (rev 52977)
+++ trunk/Master/texmfdist/doc/latex/curve2e/README.txt 20191130 22:13:04 UTC (rev 52978)
@@ 10,7 +10,7 @@
%% License information appended
%%
File README.txt for package curve2e
 [20191021 v.2.0.4 Extension package for pict2e]
+ [20191130 v.2.0.6 Extension package for pict2e]
@@ 19,30 +19,29 @@
curve2e.dtx
curve2e.pdf
README.txt
curve2ev161.sty
ltxdoc.cfg
curve2e.dtx is the documented TeX source file of file curve2e.sty; you
get both curve2e.sty and curve2e.pdf by running pdflatex on curve2e.dtx.
The ltxdoc.cfg file customises the way the documentation file is typeset.
This .cfg file is not subject to the LPPL licence.
+get curve2e.sty, curve2e.pdf, and curve2ev161.sty by running pdflatex
+on curve2e.dtx. The ltxdoc.cfg file customises the way the documentation
+file is typeset. This specific .cfg file is part of the ltxdoc package functionality and it is supposed to be configured for each specifica other bundle.
README.txt, this file, contains general information.
Curve2ev161.sty contains the previous version of the package; see below
+Curve2ev161.sty contains a previous version of the package; see below
why the older version might become necessary for the end user.
Curve2e.sty is an extension of the package pict2e.sty which extends the
standard picture LaTeX environment according to what Leslie Lamport
specified in the second edition of his LaTeX manual.
+specified in the second edition of his LaTeX manual (1994).
This further extension allows to draw lines and vectors with any non
integer slope parameters, to draw dashed lines of any slope, to draw arcs
and curved vectors, to draw curves where just the interpolating nodes are
specified together with the slopes at the nodes; closed paths of any
shape can be filled with color; all coordinates are treated as ordered
pairs, i.e. 'complex numbers'; coordinates may be expressed also in
polar form.
+This further extension curve2e.sty allows to draw lines and vectors
+with any non integer slope parameters, to draw dashed lines of any
+slope, to draw arcs and curved vectors, to draw curves where just
+the interpolating nodes are specified together with the slopes at
+the nodes; closed paths of any shape can be filled with color; all
+coordinates are treated as ordered pairs, i.e. 'complex numbers';
+coordinates may be expressed also in polar form.
Some of these features have been incorporated in the 2011 version of
pict2e; therefore this package avoids any modification to the original
pict2e commands.
@@ 50,14 +49,14 @@
Curve2e now accepts polar coordinates in addition to the usual cartesian
ones; several macros have been upgraded and a new macro for tracing cubic
Bezier splines with their control nodes specified in polar form is
available. The same applies to quadratic Bezier splines. The multiput
+available. The same applies to quadratic Bezier splines. The \multiput
command has been completely modified in a backwards compatible way, as
to manipulate the increment components.
+to manipulate the increment components in a configurable way.
This version solves a conflict with package esopic.
This version of curve2e is almost fully compatible with pict2e dated
2014/01/12 version 0.2z.
+2014/01/12 version 0.2z and later.
If you specify
@@ 67,7 +66,7 @@
The almost compatible frase is necessary to explain that this version
of curve2e uses some `functions' of the LaTeX3 language that were made
available to the LaTeX developer by mid October 2018. Should the user
+available to the LaTeX developers by mid October 2018. Should the user
have an older or a basic/incomplete installation of the TeX system,
such L3 functions might not be available. This is why this
package checks the presence of the developer interface; in case
@@ 84,8 +83,8 @@
Nevertheless this package is an extension to the standard LaTeX package
pict2e (2014). Therefore any change must be controlled on the
parent package pict2e, so as to avoid redefining what has already been
incorporated in the official package.
+parent package pict2e, so as to avoid redefining or interfering with
+what is already contained in the official package.
If you prefer sending me your modifications, as long as I will maintain
this package, I will possibly include every (documented) suggestion or
Modified: trunk/Master/texmfdist/doc/latex/curve2e/curve2e.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmfdist/source/latex/curve2e/curve2e.dtx
===================================================================
 trunk/Master/texmfdist/source/latex/curve2e/curve2e.dtx 20191130 22:12:51 UTC (rev 52977)
+++ trunk/Master/texmfdist/source/latex/curve2e/curve2e.dtx 20191130 22:13:04 UTC (rev 52978)
@@ 39,7 +39,7 @@
%
% \iffalse
%<*package>
%<package>\NeedsTeXFormat{LaTeX2e}[2016/01/01]
+%<package>\NeedsTeXFormat{LaTeX2e}[2019/01/01]
%</package>
%<*driver>
\ProvidesFile{curve2e.dtx}%
@@ 47,7 +47,7 @@
%<+package>\ProvidesPackage{curve2e}%
%<+readme>File README.txt for package curve2e
%<*packagereadme>
 [20191021 v.2.0.4 Extension package for pict2e]
+ [20191130 v.2.0.6 Extension package for pict2e]
%</packagereadme>
%<*driver>
\documentclass{ltxdoc}\errorcontextlines=9
@@ 55,7 +55,7 @@
\usepackage[utf8]{inputenc}
\usepackage{lmodern,textcomp}
\usepackage{mflogo}
\usepackage{multicol,amsmath,fancyvrb,trace}
+\usepackage{multicol,amsmath,fancyvrb,graphics,trace}
\usepackage{xcolor,curve2e}
\GetFileInfo{curve2e.dtx}
\title{The extension package \textsf{curve2e}}
@@ 63,17 +63,27 @@
\date{Version \fileversion~~Last revised \filedate.}
\providecommand*\diff{\mathop{}\!\mathrm{d}}
\renewcommand\meta[1]{{\normalfont\textlangle\textit{#1}\textrangle}}
\renewcommand\marg[1]{\texttt{\char123\meta{#1}\char125}}
+\renewcommand\marg[1]{\texttt{\{\meta{#1}\}}}
+\providecommand\Marg{}
+\renewcommand\Marg[1]{\texttt{\{#1\}}}
\providecommand\oarg{}
\renewcommand\oarg[1]{\texttt{[\meta{#1}]}}
+\providecommand\Oarg{}
+\renewcommand\Oarg[1]{\texttt{[#1]}}
\providecommand\aarg{}
\renewcommand*\aarg[1]{\texttt{<\meta{#1}>}}
+\providecommand\Aarg{}
+\renewcommand\Aarg[1]{\texttt{<#1>}}
\providecommand\parg{}
\renewcommand\parg[1]{\texttt{(\meta{#1})}}
+\providecommand\Parg{}
+\renewcommand\Parg[1]{\texttt{(#1)}}
+
\makeatletter
\newcommand*\Pall[1][1.5]{\def\circdiam{#1}\@Pall}
 \def\@Pall(#1){\put(#1){\circle*{\circdiam}}}
+%\newcommand*\Pall[1][1.5]{\def\circdiam{#1}\@Pall}
+% \def\@Pall(#1){\put(#1){\circle*{\circdiam}}}
+\NewDocumentCommand\Pall{O{1.5} R(){0,0}}{\put(#2){\circle*{#1}}}
\def\legenda(#1)#2{\put(#1){\setbox3333\hbox{$#2$}%
\dimen3333\dimexpr\wd3333*\p@/\unitlength +3\p@\relax
@@ 80,13 +90,9 @@
\edef\@tempA{\strip at pt\dimen3333}%
\framebox(\@tempA,7){\box3333}}}
\def\Zbox(#1){\bgroup\edef\@tempA{#1}\@Zbox}
+\NewDocumentCommand\Zbox{R(){0,0} O{cc} m O{1}}{%
+\put(#1){\makebox(0,0)[#2]{\fboxrule=0pt\fboxsep=3pt\fbox{$#3$}}\makebox(0,0)[cc]{\circle*{#4}}}}
\newcommand*\@Zbox[2][]{\fboxrule\z@\fboxsep=0.75ex\def\@tempB{#1}%
\setbox2575\hbox{\fbox{$\relax\rule[0.5ex]{0pt}{2.5ex}#2\relax$}}\relax
\ifx\@tempB\empty
\put(\@tempA){\makebox(0,0){\box2575}}\else
\put(\@tempA){\makebox(0,0)[#1]{\box2575}}\fi\egroup\ignorespaces}
\providecommand\setfontsize{}
\DeclareRobustCommand\setfontsize[2][1.2]{%
@@ 104,24 +110,24 @@
%</driver>
% \fi
%
% \CheckSum{5569}
+% \CheckSum{5593}
% \begin{abstract}
% This file documents the curve2e extension package to the pict2e
% bundle implementation that has been described by Lamport
+% bundle implementation; the latter was described by Lamport
% himself in the 1994 second edition of his \LaTeX\ handbook.
%
% Please take notice that in April 2011 a new updated version of the
+% Please take notice that on April 2011 a new updated version of the
% package pict2e has been released that incorporates some of the
% commands defined in early versions of this package; apparently there
% are no conflicts, but only the advanced features of curve2e remain
% available for extending the above package.
%
% This extension redefines a couple of commands and introduces some more
% drawing facilities that allow to draw circular arcs and arbitrary curves
% with the minimum of user intervention. This version is open to the
% contribution of other users as well as it may be incorporated in other
% people's packages. Please cite the original author and the chain of
% contributors.
+% This extension redefines some commands and introduces some more
+% drawing facilities that allow to draw circular arcs and arbitrary
+% curves with the minimum of user intervention. This version is open to
+% the contribution of other users as well as it may be incorporated in
+% other people's packages. Please cite the original author and the chain
+% of contributors.
% \end{abstract}
%
%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ 128,18 +134,18 @@
%\section{The configuration file}
%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This package curve2e is distributed with a ltxdoc.cfg configuration
% file that contains, besides the preamble and the postamble comment lines,
% the following code line:
+% file that contains, besides the preamble and the postamble comment
+% lines, the following line of code:
%\begin{verbatim}
%\AtBeginDocument{\OnlyDescription}
%\end{verbatim}
%
% If you want to type the whole documentation, comment out that code line
% in the ltxdoc.cfg file. This is the only modification allowed by the
+% in the ltxdoc.cfg file. This is the only modification allowed by the
% LPPL licence that does not require to change the file name.
%
% For your information the initial part is about 20~pages long; the whole
% documentation is about 80~pages long.
+% For your information, the initial part is about 20~pages long; the
+% whole documentation is about 80~pages long.
%
%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \section{Package \texttt{pict2e} and this extension \texttt{curve2e}}
@@ 146,21 +152,21 @@
%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Package \texttt{pict2e} was announced in issue 15 of \texttt{latexnews}
% around December 2003; it was declared that the new package would replace
% the dummy one that has been accompanying every release of \LaTeXe\ since
% its beginnings in 1994. The dummy package was just issuing an info
% message that simply announced the temporary unavailability of the real
% package.
+% around December 2003; it was declared that the new package would
+% replace the dummy one that has been accompanying every release of
+% \LaTeXe\ since its beginnings in 1994. The dummy package was just
+% issuing an info message that simply announced the temporary
+% unavailability of the real package.
%
% Eventually Gäßlein and Niepraschk implemented what Lamport himself had
% already documented in the second edition of his \LaTeX\ handbook, that is
% a \LaTeX\ package that contained the macros capable of removing all the
% limitations contained in the standard commands of the original
+% already documented in the second edition of his \LaTeX\ handbook, that
+% is a \LaTeX\ package that contained the macros capable of removing all
+% the limitations contained in the standard commands of the original
% \texttt{picture} environment; specifically what follows.
% \begin{enumerate}
% \item The line and vector slopes were limited to the ratios of relative
% prime onedigit integers of magnitude not exceeding 6 for lines and 4 for
% vectors.
+% prime onedigit integers of magnitude not exceeding 6 for lines and 4
+% for vectors.
%^^A
% \item Filled and unfilled full circles were limited by the necessarily
% limited number of specific glyphs contained in the special \LaTeX\
@@ 170,10 +176,10 @@
% reason.
%^^A
% \item Ovals (rectangles with rounded corners) could not be too small
% because of the unavailability of small radius quarter circles, nor could
% be too large, in the sense that after a certain radius the rounded
% corners remained the same and would not increase proportionally to the
% oval size.
+% because of the unavailability of small radius quarter circles, nor
+% could be too large, in the sense that after a certain radius the
+% rounded corners remained the same and would not increase proportionally
+% to the oval size.
%^^A
% \item Vector arrows had only one possible shape and matched the limited
% number of vector slopes.
@@ 185,22 +191,23 @@
% The package \texttt{pict2e} removes most if not all the above
% limitations.
% \begin{enumerate}
% \item Line and vector slopes are virtually unlimited; the only remaining
% limitation is that the direction coefficients must be threedigit integer
% numbers; they need not be relatively prime; with the 2009 upgrade even
% this limitation was removed and now slope coefficients can be any
% fractional number whose magnitude does not exceed 16\,384, the maximum
% dimension in points that \TeX\ can handle.
+% \item Line and vector slopes are virtually unlimited; the only
+% remaining limitation is that the direction coefficients must be
+% threedigit integer numbers; they need not be relatively prime; with
+% the 2009 upgrade even this limitation was removed and now slope
+% coefficients can be any fractional number whose magnitude does not
+% exceed 16\,384, the maximum dimension in points that \TeX\ can handle.
%^^A
% \item Filled and unfilled circles can be of any size.
%^^A
% \item Ovals can be designed with any specified corner curvature and there
% is virtually no limitation to such curvatures; of course corner radii
% should not exceed half the lower value between the base and the height of
% the oval.
+% \item Ovals can be designed with any specified corner curvature and
+% there is virtually no limitation to such curvatures; of course corner
+% radii should not exceed half the lower value between the base and the
+% height of the oval.
%^^A
% \item There are two shapes for the arrow tips; the triangular one
% traditional with \LaTeX\ vectors, or the arrow tip with PostScript style.
+% traditional with \LaTeX\ vectors, or the arrow tip with PostScript
+% style.
%^^A
% \item The \linethickness command changes the thickness of all lines,
% straight, curved, vertical, horizontal, arrow tipped, et cetera.
@@ 208,157 +215,190 @@
%
% This specific extension package curve2e adds the following features.
% \begin{enumerate}
% \item Point coordinates my be specified in both cartesian and polar form:
% internally they are handeld as cartesian coordinates, but the user can
% specify his/her points also in polar form. In order to avoid confusion
% with other grapgic packages, curve2e uses the usual comma separated
% couple of integer or fractional numebrs for cartesian coordinates, and
% the couple \texttt{\meta{angle}:\meta{radius}} for polar coordinates.
% All graphic object commands accept polar or cartesian coordinates at the
% choice of the user who may use for each object the formalism he/she
+% \item Point coordinates my be specified in both cartesian and polar
+% form: internally they are handled as cartesian coordinates, but the
+% user can specify his/her points also in polar form. In order to avoid
+% confusion with other graphic packages, curve2e uses the usual comma
+% separated couple \meta{$x,y$} of integer or fractional numbers for
+% cartesian coordinates, and the couple \meta{$\theta$}:\meta{$\rho$} for
+% polar coordinates (the angle preceding the radius).
+% All graphic object commands accept polar or cartesian coordinates at
+% the choice of the user who may use for each object the formalism s/he
% prefers. Also the put and \multiput commands have been redefined so
% as to accept cartesian or polar coordinates.
+%
+% Of course the user must pay attention to the meaning of cartesian
+% vs. polar coordinates. Both imply a displacement with respect the
+% actual origin of the axes. So when a circle is placed at coordinates
+% $a,b$ with a normal \put command, the circle is placed exactly in
+% that point; with a normal \put command the same happens if
+% coordinates $\alpha{:}\rho$ are specified.
+% But if the \put command is nested into another \put command, the
+% current origin of the axes is displaced — this is obvious and the
+% purpose of nesting \put commands is exactly that. But if a segment
+% is specified so that its ending point is at a specific distance and in
+% specific direction form its starting point, polar coordinates appear to
+% be the most convenient to use; in this case, though, the origin of the
+% axes become the stating point of the segment, therefore the segment
+% might be drawn in a strange way. Attention has been
+% paid to avoid such misinterpretation, but maybe some unusual
+% situation may not have come to my mind; feedback is very welcome.
+% Meanwhile pay attention when you use polar coordinates.
%^^A
%\item Most if not all cartesian coordinate pairs and slope pairs are
% treated as \emph{ordered pairs}, that is \emph{complex numbers}; in
% practice the user does not notice any difference from what he/she was
+% practice the user does not notice any difference from what s/he was
% used to, but all the mathematical treatment to be applied to these
% entities is coded as complex number operations, since complex numbers may
% be viewed non only as ordered pairs, but also as vectors or as
+% entities is coded as complex number operations, since complex numbers
+% may be viewed non only as ordered pairs, but also as vectors or as
% rotoamplification operators.
%^^A
% \item Commands for setting the line terminations are introduced; the user
% can chose between square or rounded caps; the default is set to rounded
% caps (now this original feature is directly available also with
% pict2e).
+% \item Commands for setting the line terminations were introduced; the
+% user can chose between square or rounded caps; the default is set to
+% rounded caps; now this feature is directly available with pict2e.
%^^A
% \item Commands for specifying the way two lines or curves join to one
% another.
% ^^A
% \item originally the \line macro is redefined so as to allow integer
% and fractional direction coefficients, but maintaining the same syntax as
% in the original \texttt{picture} environment; now this functionality
% available directly with pict2e.
+% \item Originally the \line macro was redefined so as to allow large
+% (up to three digits) integer direction coefficients, but maintaining
+% the same syntax as in the original \texttt{picture} environment; now
+% pict2e removes the integer number limitations and allows fractional
+% values, initially implemented by curve2e.
% ^^A
% \item A new macro \Line was originally defined so as to avoid the need
% to specify the horizontal projection of inclined lines; now this
% functionality id available directly with pict2e; but this macro name
% now conflicts with pict2e 2009 version; therefore its name is changed
% to \LIne and supposedly it will not be used very often, if ever,
% by the end user (but it is used within this package macros).
+% \item A new macro \Line was originally by curve2e defined so as to
+% avoid the need to specify the horizontal projection of inclined lines;
+% now this functionality is available directly with pict2e; but this
+% curve2e macro name now conflicts with pict2e 2009 version;
+% therefore its name is changed to \LIne and supposedly it will not be
+% used very often, if ever, by the end user (but it is used within this
+% package macros).
% ^^A
% \item A new macro \LINE was defined in order to join two points
% specified with their coordinates; this is now the normal behavior of the
% \Line macro of pict2e so that in this package \LINE is now renamed
% \segment; there is no need to use the \put command with this line
% specification.
+% specified with their coordinates; this is now the normal behaviour of
+% the \Line macro of pict2e so that in this package \LINE is now
+% renamed \segment; there is no need to use the \put command with
+% this line specification.
% ^^A
% \item A new macro \DLine is defined in order to draw dashed lines
% joining any two given points; the dash length and gap (equal to one another) get specified through one of the macro arguments.
+% \item A new macro \DashLine (alias: \Dline) is defined in order to
+% draw dashed lines joining any two given points; the dash length and
+% gap (equal to one another) get specified through one of the macro
+% arguments.The stating point mai be specified in cartesiano or polar
+% form; the end point in cartesian format specifies the desired end
+% point; while if the second point is in polar form it is meant
+% \emph{relative to the starting point}, not as an absolute end point.
+% See the examples further on.
% ^^A
% \item A new macro \Dotline is defined in order to draw dotted straight
% lines as a sequence of equally spaced dots, where the gap can be
% specified by the user; such straight line may have any inclination, as
% well as the above dashed lines.
+% \item A similar new macro \Dotline is defined in order to draw dotted
+% straight lines as a sequence of equally spaced dots, where the gap can
+% be specified by the user; such straight line may have any inclination,
+% as well as the above dashed lines.Polar coordinates for the second
+% point have the same relative meaning as specified for the \Dashline
+% macro.
% ^^A
% \item Similar macros are redefined for vectors; \vector redefines the
% original macro but with the vector slope limitations removed; \Vector
% gets specified with its two horizontal and vertical components in analogy
% with \LIne; \VECTOR joins two specified points (without using the
% \put command) with the arrow pointing to the second point.
+% gets specified with its two horizontal and vertical components in
+% analogy with \LIne; \VECTOR joins two specified points (without
+% using the \put command) with the arrow pointing to the second point.
%^^A
% \item A new macro \polyline for drawing polygonal lines is defined that
% accepts from two vertices up to an arbitrary (reasonably limited) number
% of them (available now also in pict2e); here it is redefined so as to
% allow an optional specification of the way segments for the polyline are
% joined to one another. Vertices may be specified with polar coordinates
+% \item A new macro \polyline for drawing polygonal lines is defined
+% that accepts from two vertices up to an arbitrary (reasonably limited)
+% number of them (available now also in pict2e); here it is redefined
+% so as to allow an optional specification of the way segments for the
+% polyline are joined to one another. Vertices may be specified with
+% polar coordinates and are always relative to the preceding point.
%^^A
% \item The pict2e polygon macro to draw closed polylines, in practice
% general polygons, has been redefined in such a way that it can accept the
% various vertices specified with polar coordinates. The polygon* macro
% produces a color filled polygon; the default color is black, but a
% different color may be specified with the usual \color command given
% within the same group where \polygon* is enclosed.
+% \item The pict2e polygon macro to draw closed polylines (in
+% practice general polygons) has been redefined in such a way that it
+% can accept the various vertices specified with (relative) polar
+% coordinates. The polygon* macro produces a color filled polygon; the
+% default color is black, but a different color may be specified with the
+% usual \color command given within the same group where \polygon* is
+% enclosed.
%^^A
% \item A new macro \Arc is defined in order to draw an arc with
% arbitrary radius and arbitrary aperture (angle amplitude); this amplitude
% is specified in sexagesimal degrees, not in radians; a similar
% functionality is now achieved with the \arc macro of pict2e, which
% provides also the starred version \arc* that fills up the interior of
% the generated circular arc with the current color. It must be noticed
% that the syntax is slightly different, so that it's reasonable that these
% commands, in spite of producing identical arcs, might be more comfortable
% with this or that syntax.
+% arbitrary radius and arbitrary aperture (angle amplitude); this
+% amplitude is specified in sexagesimal degrees, not in radians; a
+% similar functionality is now achieved with the \arc macro of
+% pict2e, which provides also the starred version \arc* that fills
+% up the interior of the generated circular arc with the current color.
+% It must be noticed that the syntax is slightly different, so that it's
+% reasonable that these commands, in spite of producing identical arcs,
+% might be more comfortable with this or that syntax.
%^^A
% \item Two new macros \VectorArc and \VectorARC are defined in order
% to draw circular arcs with an arrow at one or both ends.
%^^A
% \item A new macro \Curve is defined so as to draw arbitrary curved
% lines by means of cubic Bézier splines; the \Curve macro requires only
% the curve nodes and the directions of the tangents at each node.The
% starred version fills up the interior of the curve with the current
% color.
+% lines by means of cubic Bézier splines; the \Curve macro requires
+% only the curve nodes and the directions of the tangents at each
+% node. The starred version fills up the interior of the curve with the
+% current color.
%^^A
% \item \Curve is a recursive macro that can draw an unlimited
% (reasonably limited) number of connected Bézier spline arcs with
% continuous tangents except for cusps; these arcs require only the
% specification of the tangent direction at the interpolation nodes. It is
% possible to use a lower level macro \CbezierTo that does the same but
% lets the user specify the control points of each arc; it is more
% difficult to use but it is more performant.
+% \item the above \Curve macro is a recursive macro that can draw an
+% unlimited (reasonably limited) number of connected Bézier spline arcs
+% with% continuous tangents except for cusps; these arcs require only the
+% specification of the tangent direction at the interpolation nodes.
+% It is possible to use a lower level macro \CbezierTo that does the
+% same but lets the user specify the control points of each arc; it is
+% more difficult to use but it is more performant.
%^^A
% \item The basic macros used within the cumulative \Curve macro can be
% used individually in order to draw any curve, one cubic arc at the time;
% but they are intended for internal use, even if it is not prohibited to
% use them; by themselves such arcs are not different form those used by
% Curve, but the final command, \FillCurve, should be used in place of
% \CurveFinish, so as to fill up the closed path with the locally
% specified color; see figure~\ref{fig:coloredcurve}. It is much more
% convenient to use the starred version of the \Curve macro.
+% used individually in order to draw any curve, one cubic arc at the
+% time; but they are intended for internal use, even if it is not
+% prohibited to use them; by themselves such arcs are not different form
+% those used by Curve, but the final command, \FillCurve, should be
+% used in place of \CurveFinish, so as to fill up the closed path with
+% the locally specified color; see figure~\ref{fig:coloredcurve}.
+% It is much more convenient to use the starred version of the \Curve
+% macro.
% \end{enumerate}
%
% The pict2e package already defines macros such as \moveto, \lineto,
% \curveto, \closepath, \fillpath, and \strokepath; of course these
% macros can be used by the end user, and sometimes they perform better
% than the macros defined in this package, because the user has a better
% control on the position of the Bézier splines control points, while here
% the control points are sort of rigid. It would be very useful to resort
% to the hobby package, but its macros are conforming with those of the
% tikz and pgf packages, not with curve2e; an interface should be
% created in order to deal with the hobby package, but this has not been
% done yet.
+% The pict2e package already defines macros such as \moveto,
+% \lineto, \curveto, \closepath, \fillpath, and \strokepath;
+% of course these macros can be used by the end user, and sometimes they
+% perform better than the macros defined in this package, because the
+% user has a better control on the position of the Bézier splines
+% control points, while here the control points are sort of rigid. It
+% would be very useful to resort to the hobby package, but its macros
+% are compatible with those of the tikz and pgf packages, not with
+% curve2e; an interface should be created in order to deal with the
+% hobby package, but this has not been done yet.
+% In any case they are redefined so as to accept symbolic names for the
+% point coordinates in both the cartesian and polar form.
%
% In order to make the necessary calculations many macros have been defined
% so as to use complex number arithmetics to manipulate point coordinates,
% directions (unit vectors, also known as `versors'), rotations and the
% like. In the first versions of this package the trigonometric functions
% were also been defined in a way that the author believed to be more
% efficient than those defined by the \texttt{trig} package; in any case
% the macro names were sufficiently different to accommodate both
% definition sets in the same \LaTeX\ run. With the progress of the
% \LaTeX\,3 language, the xfp has recently become available, by which any
% sort of calculations can be done with floating point numbers; therefore
% the most common algebraic, irrational and transcendental functions can
% be computed in the background with the stable internal floating point
% facilities. We maintain some computation with complex number algebra,
% but use the xfp functionalities for other computations.
+% In order to make the necessary calculations many macros have been
+% defined so as to use complex number arithmetics to manipulate point
+% coordinates, directions (unit vectors, also known as `versors'),
+% rotations and the like. In the first versions of this package the
+% trigonometric functions were also defined in a way that the author
+% believed to be more efficient than those defined by the \texttt{trig}
+% package; in any case the macro names were sufficiently different to
+% accommodate both definition sets in the same \LaTeX\ run. With the
+% progress of the \LaTeX\,3 language, the xfp has recently become
+% available, by which any sort of calculations can be done with floating
+% point decimal numbers; therefore the most common algebraic, irrational
+% and transcendental functions can be computed in the background with the
+% stable internal floating point facilities. We maintain some computation
+% with complex number algebra, but use the xfp functionalities for
+% other computations.
%
% Many aspects of this extension could be fine tuned for better
% performance; many new commands could be defined in order to further
% extend this extension. If the new service macros are accepted by other
% \TeX\ and \LaTeX\ programmers, this version could become the start for a
% real extension of the \texttt{pict2e} package or even become a part of
% it. Actually some macros have already been included in the
% \texttt{pict2e} package. The \Curve algorithm, as I said before, might
% be redefined so as to use the macros introduced in the \texttt{hobby}
% package, that implements for the tikz and pgf packages the same
% functionalities that John Hobby implemented for the \MF\ and \MP\
% programs.
+% \TeX\ and \LaTeX\ programmers, this version could become the start for
+% a real extension of the pict2e package or even become a part of
+% it. Actually some macros have already been included in the pict2e
+% package. The \Curve algorithm, as I said before, might be redefined
+% so as to use the macros introduced in the hobby package, that
+% implements for the tikz and pgf packages the same functionalities
+% that John Hobby implemented for the \MF\ and \MP\ programs.
%
% For these reasons I suppose that every enhancement should be submitted to
% Gäßlein, Niepraschk, and Tkadlec who are the prime maintainers of
% \texttt{pict2e}; they are the only ones who can decide whether or not to
% incorporate new macros in their package.
+% For these reasons I suppose that every enhancement should be submitted
+% to Gäßlein, Niepraschk, and Tkadlec who are the prime maintainers of
+% \texttt{pict2e}; they are the only ones who can decide whether or not
+% to incorporate new macros in their package.
%
%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \section{Summary and examples of new commands}
@@ 369,11 +409,13 @@
% \begin{enumerate}
% \item This package curve2e calls directly the \LaTeX\ packages
% color and pict2e to which it passes any possible option that the
% latter can receive; actually the only options that make sense are
% those concerning the arrow tips, either \LaTeX\ or PostScript styled,
% because it is assumed that if you use this package you are not
% interested in using the original \LaTeX\ commands. See the pict2e
% documentation in order to see the correct options pict2e can receive.
+% latter can receive; actually the only options that make sense for
+% pict2e are those concerning the arrow tips, either \LaTeX\ or
+% PostScript styled, because it is assumed that if you use this package
+% you are not interested in using the original \LaTeX\ commands. See the
+% pict2e documentation in order to see the correct options pict2e
+% can receive. If the user wants to use the xcolor package, it has to
+% load this one before curve2e.
%^^A
% \item The user is offered new commands in order to control the line
% terminators and the line joins; specifically:
@@ 384,15 +426,15 @@
% \item \beveljoin: two lines are joined with a bevel join;
% \item \miterjoin: two lines are joined with a miter join.
% \end{itemize}
% All the above commands should respect the intended range; but since they
% act at the PostScript or PDF level, not at \TeX\ level, it might be
% necessary to issue the necessary command in order to restore the previous
% terminator or join.
+% All the above commands should respect the intended range; but since
+% they act at the PostScript or PDF level, not at \TeX\ level, it might
+% be necessary to issue the necessary command in order to restore the
+% previous terminator or join.
%^^A
% \item The commands \linethickness, \thicklines, \thinlines together
% with \defaultlinethickness always redefine the internal \@wholewidth
% and \@halfwidth so that the latter always refer to a full width and to
% a half of it in this way: if you issue the command
+% \item The commands \linethickness, \thicklines, \thinlines
+% together with \defaultlinethickness always redefine the internal
+% \@wholewidth and \@halfwidth so that the latter always refer to a
+% full width and to a half of it in this way: if you issue the command
% \defaultlinewidth{2pt} all thin lines will be drawn with a thickness
% of 1\,pt while, if a drawing command directly refers to the internal
% value \@wholewidth, its line will be drawn with a thickness of 2\,pt.
@@ 402,29 +444,31 @@
% command \linethickness redefines the above internals but does not
% change the default width value; all these width specifications apply to
% all lines, straight ones, curved ones, circles, ovals, vectors, dashed,
% et cetera. It's better to recall that \thinlines and \thicklines are
% declarations that do not take arguments; on the opposite the other two
% commands follow the standard syntax:
+% et cetera. It's better to recall that \thinlines and \thicklines
+% are declarations that do not take arguments; on the opposite the other
+% two commands follow the standard syntax:
% \begin{flushleft}
% \linethickness\marg{dimensioned value}\\
% \defaultlinewidth\marg{dimensioned value}
% \end{flushleft}
% where \meta{dimensioned value} means a length specification complete of
% its units or a dimensional expression.
+% its units, or a dimensional expression.
%^^A
% \item Straight lines and vectors are redefined in such a way that
% fractional slope coefficients may be specified; the zero length line does
% not produce errors and is ignored; the zero length vectors draw only the
% arrow tips.
+% fractional slope coefficients may be specified; the zero length line
+% does not produce errors and is ignored; the zero length vectors draw
+% only the arrow tips.
%^^A
% \item New line and vector macros are defined that avoid the necessity of
% specifying the horizontal component; \put(3,4){\LIne(25,15)} specifies
% a segment that starts at point $(3,4)$ and goes to point $(3+25,4+15)$;
% the command \segment(3,4)(28,19) achieves the same result without the
% need of using command \put.
+% \item New line and vector macros are defined that avoid the necessity
+% of specifying the horizontal component; \put(3,4){\LIne(25,15)}
+% specifies a segment that starts at point $(3,4)$ and goes to point
+% $(3+25,4+15)$; the command \segment(3,4)(28,19) achieves the same
+% result without the need of using command \put.
+%
% The same applies to the vector commands \Vector and \VECTOR and
% \VVECTOR; the latter command behaves as \VECTOR but draws a vector
% with arrow tips at both ends; furthermore this command is available only with this new release of the curve2e package.
+% with arrow tips at both ends; furthermore this command is available
+% only with this new release of the curve2e package.
% Experience has shown that the commands intended to join two specified
% points are particularly useful.
% \begin{figure}
@@ 463,7 +507,8 @@
%\cs{polyline}\oarg{optional join style}\parg{$P_1$}\parg{$P_2$}\texttt{...}\parg{$P_n$}
% \end{flushleft}
% See figure~\ref{fig:polyline} where a regular pentagon is drawn; usage
% of polar coordinates is also shown.
+% of polar coordinates is also shown; please notice how relative polar
+% coordinates act in this figure.
%
% \begin{figure}[!ht]
% \begin{minipage}{.48\linewidth}
@@ 494,14 +539,10 @@
%\begin{verbatim}
%\begin{picture}(40,30)
%\put(0,0){\GraphGrid(40,30)}
%\put(40,0){\circle*{1.5}}
% \put(41,0){\makebox(0,0)[bl]{40,0}}
%\put(90:30){\circle*{1.5}}
% \put(90:31){\makebox(0,0)[bl]{90:30}}
%\put(60:30){\circle*{1.5}}
% \put(60:31){\makebox(0,0)[bl]{60:30}}
%\put(30,30){\circle*{1.5}}
% \put(30.7,30.7){\makebox(0,0)[bl]{30,30}}
+%\Zbox(40,0)[l]{40,0}[1]
+%\Zbox(90:30)[bc]{90{:}30}[1]
+%\Zbox(60:30)[bc]{60{:}30}[1]
+%\Zbox(30,30)[bc]{30,30}[1]
%\multiput(0,0)(30:10){5}%
% {\makebox(0,0){\rule{1.5mm}{1.5mm}}}
%\end{picture}
@@ 511,14 +552,18 @@
%\begin{minipage}{0.4\textwidth}
%\begin{picture}(40,30)
%\put(0,0){\GraphGrid(40,30)}
%\put(40,0){\circle*{1.5}}\put(41,0){\makebox(0,0)[l]{40,0}}
%\put(90:30){\circle*{1.5}}\put(90:31){\makebox(0,0)[bc]{90:30}}
%\put(60:30){\circle*{1.5}}\put(60:3){\Zbox(60:27)[bc]{60{:}30}}
%\put(30,30){\circle*{1.5}}\put(30.7,30.7){\makebox(0,0)[bc]{30,30}}
+%\Zbox(40,0)[l]{40,0}[1]
+%\Zbox(90:30)[bc]{90{:}30}[1]
+%\Zbox(60:30)[bc]{60{:}30}[1]
+%\Zbox(30,30)[bc]{30,30}[1]
%\multiput(0,0)(30:10){5}{\makebox(0,0){\rule{1.5mm}{1.5mm}}}
%\end{picture}
%\end{minipage}
%\caption{Use of cartesian and polar coordinates}
+%\caption[Use of cartesian and absolute polar coordinates]{Use of
+% cartesian and absolute polar coordinates. The \texttt{\string\Zbox}
+% macro is just a shortcut to set a small dot with a (math) legend close
+% to it; its definition by means of the \texttt{xparse} functionalities
+% is straightforward.}
%\label{fig:polar}
%\end{figure}
%
@@ 545,7 +590,7 @@
% \end{picture}\hspace*{2em}
% \end{minipage}
% \caption{A pentagon obtained by means of the \texttt{\string\polygon*}
% command; vertex coordinates are in polar form.}
+% command; vertex coordinates are in relative polar form.}
% \label{fig:polygon}
% \end{figure}
%
@@ 558,8 +603,8 @@
% as specified, and separated by a gap exactly the same size; actually,
% in order to make an even gapdash sequence, the desired dash length is
% used to do some computations in order to find a suitable length, close
% to the one specified, such that the distance of the end points is evenly
% divided in equally sized dashes and gaps.
+% to the one specified, such that the distance of the end points is
+% evenly divided in equally sized dashes and gaps.
% The end points may be anywhere in the drawing area, without any
% constraint on the slope of the joining segment. The desired dash length
% is specified as a fractional multiple of \unitlength; see
@@ 600,9 +645,10 @@
% \end{minipage}
% \caption{Dashed lines and graph grid}\label{fig:dashline}
% \end{figure}
+%
% Another example of usage of cartesian and polar coordinates usage is
% shown in figure~\ref{fig:polar} together with its code.
%
+%
%\begin{figure}\unitlength=0.007\textwidth
%\begin{minipage}{0.55\textwidth}
%\begin{verbatim}
@@ 612,10 +658,10 @@
%\Dashline(0,0)(40,30){2}\Dashline(0,0)(30,30){2}
%\Dashline(0,0)(20,30){2}\Dashline(0,0)(10,30){2}
%{\color{blue}%
%\Dashline*(40,0)(108:30){2}
%\Dashline*(40,0)(126:30){2}
%\Dashline*(40,0)(144:30){2}
%\Dashline*(40,0)(162:30){2}}
+%\Dashline(40,0)(108:30){2}
+%\Dashline(40,0)(126:30){2}
+%\Dashline(40,0)(144:30){2}
+%\Dashline(40,0)(162:30){2}}
%\end{picture}
%\end{verbatim}
%\end{minipage}
@@ 630,16 +676,19 @@
%\Dashline(0,0)(20,30){2}
%\Dashline(0,0)(10,30){2}
%{\color{blue}%
%\Dashline*(40,0)(108:30){2}
%\Dashline*(40,0)(126:30){2}
%\Dashline*(40,0)(144:30){2}
%\Dashline*(40,0)(162:30){2}}%
+%\Dashline(40,0)(108:30){2}
+%\Dashline(40,0)(126:30){2}
+%\Dashline(40,0)(144:30){2}
+%\Dashline(40,0)(162:30){2}}%
%\end{picture}
%\end{minipage}
%\caption{Different length dashed lines with the same nominal dash length}
+%\caption{Different length dashed lines with the same nominal dash
+% length; notice the relative polar coordinates used for the dashed
+% lines starting at the grid lower right vertex.}
%\label{fig:dashedlines}
%\end{figure}
%
+% Another
%^^A
%\item Analogous to \Dashline, a new command \Dotline draws a dotted
% line with the syntax:
@@ 656,10 +705,10 @@
%\Dotline(0,0)(40,10){1.5}\Dotline(0,0)(40,20){1.5}
%\Dotline(0,0)(40,30){1.5}\Dotline(0,0)(30,30){1.5}
%\Dotline(0,0)(20,30){1.5}\Dotline(0,0)(10,30){1.5}
%{\color{red}\Dotline*(40,0)(108:30){1.5}
%\Dotline*(40,0)(126:30){1.5}
%\Dotline*(40,0)(144:30){1.5}
%\Dotline*(40,0)(162:30){1.5}}%
+%{\color{red}\Dotline(40,0)(108:30){1.5}
+%\Dotline(40,0)(126:30){1.5}
+%\Dotline(40,0)(144:30){1.5}
+%\Dotline(40,0)(162:30){1.5}}%
%\end{picture}
%\end{verbatim}
%\end{minipage}
@@ 674,49 +723,50 @@
%\Dotline(0,0)(20,30){1.5}
%\Dotline(0,0)(10,30){1.5}
%{\color{red}%
%\Dotline*(40,0)(108:30){1.5}
%\Dotline*(40,0)(126:30){1.5}
%\Dotline*(40,0)(144:30){1.5}
%\Dotline*(40,0)(162:30){1.5}}%
+%\Dotline(40,0)(108:30){1.5}
+%\Dotline(40,0)(126:30){1.5}
+%\Dotline(40,0)(144:30){1.5}
+%\Dotline(40,0)(162:30){1.5}}%
%\end{picture}
%\end{minipage}
%\caption{Different length dotted lines with the same nominal dot gap}
+%\caption{Different length dotted lines with the same nominal dot gap;
+% again notice the relative polar coordinates for the dotted lines
+% starting at thhe grid lower right vertex.}
%\label{fig:dottedlines}
%\end{figure}
%^^A
% \item \GraphGrid is a command that draws a red grid under the drawing
% with lines separated 10\unitlengths apart; it is described only with a
% comma separated couple of numbers, representing the base and the height
% of the grid, see figure~\ref{fig:dashline}; it's better to specify
% multiples of ten and the grid can be placed anywhere in the drawing
% canvas by means of \put, whose cartesian coordinates are multiples of
% 10; nevertheless the grid line distance is rounded to the nearest
% multiple of 10, while the point coordinates specified to \put are not
% rounded at all; therefore some care should be used to place the working
% grid on the drawing canvas. This grid is intended as an aid while
% drawing; even if you sketch your drawing on millimetre paper, the
% drawing grid turns out to be very useful; one must only delete or comment
% out the command when the drawing is finished. Several examples of usage of such grid are shown in several figures.
+% with lines separated 10\unitlengths apart; it is described only with
+% a comma separated couple of numbers, representing the base and the
+% height of the grid, see figure~\ref{fig:dashline}; it's better to
+% specify multiples of ten and the grid can be placed anywhere in the
+% drawing canvas by means of \put, whose cartesian coordinates are
+% multiples of 10; nevertheless the grid line distance is rounded to the
+% nearest multiple of 10, while the point coordinates specified to \put
+% are not rounded at all; therefore some care should be used to place the
+% working grid on the drawing canvas. This grid is intended as an aid
+% while drawing; even if you sketch your drawing on millimetre paper, the
+% drawing grid turns out to be very useful; one must only delete or
+% comment out the command when the drawing is finished. Several examples
+% of usage of such grid are shown in several figures.
%^^A
% \item New trigonometric function macros have been computed by means of
% the functionalities of the xfp package. The compared to the other
+% the functionalities of the xfp package. The difference woth the other
% existing macros is that angles are specified in sexagesimal degrees, so
% that the user needs not transform to radians. The computations are done
% taking into account that abnormal values can occasionally be avoided,
+% that the users need not transform to radians. The computations are done
+% taking into account that “abnormal” values can occasionally be avoided,
% for example $\tan90^\circ$ must be avoided and replaced with a suitably
% large number, because the TeX\ system does not handle “infinity”.
%
% These trigonometric functions are used within the complex number macros;
% but if the user wants to use them the syntax is the following:
+% These trigonometric functions are used within the complex number
+% macros; but if the user wants to use them the syntax is the following:
%\begin{flushleft}
% \cs{SinOf}\meta{angle}\texttt{to}\meta{control sequence}
%\\
% \cs{CosOf}\meta{angle}\texttt{to}\meta{control sequence}
%\\
+% \cs{SinOf}\meta{angle}\texttt{to}\meta{control sequence}\\
+% \cs{CosOf}\meta{angle}\texttt{to}\meta{control sequence}\\
% \cs{TanOf}\meta{angle}\texttt{to}\meta{control sequence}
%\end{flushleft}
% The \meta{control sequence} may then be used as a multiplying factor of a
% length.
+% The \meta{control sequence} may then be used, for example, as a
+% multiplying factor of a length.
%
%^^A
% \item Arcs can be drawn as simple circular arcs, or with one or two
@@ 765,26 +815,28 @@
% complex numbers; actually complex numbers are represented as a comma
% separated pair of fractional numbers (here we use only cartesian
% coordinates). They are used to address specific points in the drawing
% plane, but also as operators so as to scale and rotate other objects. In
% the following \meta{vector} means a comma separated pair of fractional
% numbers, \meta{vector macro} means a macro that contains a comma
% separated pair of fractional numbers; \meta{angle macro} means a macro
% that contains the angle of a vector in sexagesimal degrees;
+% plane, but also as operators so as to scale and rotate other objects.
+% In the following \meta{vector} means a comma separated pair of
+% fractional numbers, \meta{vector macro} means a macro that contains a
+% comma separated pair of fractional numbers; \meta{angle macro} means a
+% macro that contains the angle of a vector in sexagesimal degrees;
% \meta{argument} means a brace delimited numeric value, even a macro;
+% \meta{numeric macro} means a macro that contains a fractional number;
% \textit{macro} is a valid macro name, i.e.~a backslash followed by
% letters, or anything else that can receive a definition. A
% \emph{direction} of a vector is its versor;% the angle of a vector is
+% \emph{direction} of a vector is its versor; the angle of a vector is
% the angle between the vector and the positive $x$ axis in
% counterclockwise direction, as generally directly used in the
+% counterclockwise direction, as it is used in the
% Euler formula $ \vec{v} = Me^{\mathrm{j}\varphi}$.
%
% {\footnotesize\begin{itemize}
% \item \MakeVectorFrom\meta{two arguments}to\meta{vector macro}
+% \item \MakeVectorFrom\meta{numeric macro}\meta{numeric macro}to\meta{vector macro}
% \item \CopyVect\meta{first vector}to\meta{second vector macro}
% \item \ModOfVect\meta{vector}to\meta{macro}
+% \item \ModOfVect\meta{vector}to\meta{modulus macro}
% \item \DirOfvect\meta{vector}to\meta{versor macro}
% \item \ModAndDirOfVect\meta{vector}to\meta{1st macro}and\meta{2nd macro}
% \item \DistanceAndDirOfVect\meta{1st vector}minus\meta{2nd vector}to\meta{1st macro}and\meta{2nd macro}
+% \item \ModAndDirOfVect\meta{vector}to\meta{modulus macro}and\meta{versor macro}
+% \item \ModAndAngleOfVect\meta{vector}to\meta{modulus macro}and\meta{angle macro}
+% \item \DistanceAndDirOfVect\meta{1st vector}minus\meta{2nd vector}to\meta{distance macro}and\meta{versor macro}
% \item \XpartOfVect\meta{vector}to\meta{macro}
% \item \YpartOfVect\meta{vector}to\meta{macro}
% \item \DirFromAngle\meta{angle}to\meta{versor macro}
@@ 791,40 +843,43 @@
% \item \ArgOfVect\meta{vector}to\meta{angle macro}
% \item \ScaleVect\meta{vector}by\meta{scaling factor}to\meta{vector macro}
% \item \ConjVect\meta{vector}to\meta{conjugate vector macro}
% \item \SubVect\meta{first vector}from\meta{second vector}to\meta{vector macro}
+% \item \SubVect\meta{subtrahend vector}from\meta{minuend vector}to\meta{vector macro}
% \item \AddVect\meta{first vector}and\meta{second vector}to\meta{vector macro}
% \item \MultVect\meta{first vector}by\meta{second vector}to\meta{vector macro}
% \item \MultVect\meta{first vector}by*\meta{second vector}to\meta{vector macro}
% \item \DivVect\meta{first vector}by\meta{second vector}to\meta{vector macro}
+% \item \Multvect\marg{first vector}*\marg{second vector}*\marg{vector macro} (the asterisks are optional; either one changes the second vector into its complex conjugate)
+% \item \MultVect\meta{first vector}by\meta{second vector}to\meta{vector macro} (discouraged; maintained for backwards compatibility)
+% \item \MultVect\meta{first vector}by*\meta{second vector}to\meta{vector macro} (discouraged; maintained for backwards compatibility)
+% \item \Divvect\marg{dividend vector}\marg{divisor vector}\marg{ vector macro}
+% \item \DivVect\meta{dividend vector}by\meta{divisor vector}to\meta{vector macro} (maintained for backwards compatibility)
% \end{itemize}}
%^^A
% \item General curves can be drawn with the pict2e macro \curve but it
% requires the specification of the thirdorder Bézierspline control
% points; sometimes it's better to be very specific with the control points
% and there is no other means to do a decent graph; sometimes the curves to
% be drawn are not so tricky and a general set of macros can be defined so
% as to compute the control points, while letting the user specify only the
% nodes through which the curve must pass, and the tangent direction of the
% curve in such nodes. Such commands are the following:
+% \item General curves can be drawn with the pict2e macro \curve but
+% it requires the specification of the thirdorder Bézierspline control
+% points; sometimes it's better to be very specific with the control
+% points and there is no other means to do a decent graph; sometimes the
+% curves to be drawn are not so tricky and a general set of macros can be
+% defined so as to compute the control points, while letting the user
+% specify only the nodes through which the curve must pass, and the
+% tangent direction of the curve in such nodes. Such commands are the
+% following:
%\begin{itemize}
%
%\item \cs{Curve} to draw a sequence of arcs as explained above, using
% third order (cubic) Bézier splines. The starred version of this command
% fills the internal part of the curve with the current color; if the last
% arc finishes where the fist arc starts, it is clear what is the interior;
% if it does not, the driver (not the code of this package, but the
% driver between this code and the physical representation on paper or
% screen) assumes a straight line closure of the whole path.
+% fills the internal part of the curve with the current color; if the
+% last arc finishes where the fist arc starts, it is clear what is the
+% interior; if it does not, the driver (not the code of this package,
+% but the driver between this code and the physical representation on
+% paper or screen) assumes a straight line closure of the whole path.
%
%\item \cs{Qurve} similar to \Curve, but with second order (quadratic)
% Bézier splines. The starred version fills the interior with the current
% color
+% color.
%
%\item \cs{CurveBetween} draws a single cubic Bézier spline between two
% given nodes and with two given directions vectors.
%
%\item \cs{CBezierBetween} draws a single cubic Bézier spline between two
% given nodes, with two given directions versors along which the
+%\item \cs{CBezierBetween} draws a single cubic Bézier spline between
+% two given nodes, with two given directions versors along which the
% control node distances are specified. This is the most general macro
% (rather difficult to use) with which not only the arc end points are
% specified but also the control nodes coordinates are given.
@@ 831,8 +886,8 @@
%
%\end{itemize}
%
% The main macro is \Curve and must be followed by an
% ``unlimited'' sequence of nodedirection coordinates as a quadruple
+% The main macro is \Curve and must be followed by an “unlimited”
+% sequence of nodedirection coordinates as a quadruple
% defined as
%\[
% \parg{node coordinates}\aarg{direction vector}
@@ 843,40 +898,40 @@
% \mbox{\dots\parg{...}\aarg{...}\oarg{new direction vector}\parg{...}\aarg{...}\dots}
%\]
%
% Possibly it is necessary to specifiy the “tension” or the “looseness”
+% Possibly it is necessary to specify the “tension” or the “looseness”
% of a specific Bézier arc; such tension parameters range from 0 (zero)
% to~4; the zero value implies a very stiff arc, as if it was a string
% subject to a high tension (i.e. with zero looseness); a value of~4
% implies a very low tension (very high looseness), almost as if the string
% was not subject to any tension. In \MF\ or \MP\ language such a concept
% is used very often; in this package, where the Hobby algorithms are
% not used, the parameter value appears to mean the opposite of tension.
+% implies a very low tension (very high looseness), almost as if the
+% string was not subject to any tension. In \MF\ or \MP\ language such a
+% concept is used very often; in this package, where the Hobby
+% algorithms are not used, the parameter value appears to mean the
+% opposite of tension.
% A couple of comma separated tension values may be optionally used, they
% are separated with a semicolon form the direction vector,
% and they apply to the arc terminating with the last node; their
% specification must
% precede any possible change of tangent according to this
% syntax\footnote{The tension may be specified only for cubic splines,
% because the quadratic ones do not use enough parameters to control the
% tension; not all commands for drawing cubic splines accept this
% optional tension specification.}:
+% specification must precede any possible change of tangent according to
+% this syntax\footnote{The tension may be specified only for cubic
+% splines, because the quadratic ones do not use enough parameters to
+% control the tension; not all commands for drawing cubic splines accept
+% this optional tension specification.}:
%\[
%\mbox{\dots\parg{...}\aarg{\upshape{\em direction vector}\texttt{;}{\em start tension},{\em end tension}}\parg{...}\aarg{...}\dots}
%\]
%
% The \Curve macro does not (still) have facilities for cycling the path,
% that is to close the path from the last specified nodedirection to the
% first specified nodedirection; but, as already mentioned, if the ending
% node of the last arc does not coincide with the stating node of the
% first arc, a straight line is assumed to join such nodes; this line does
% not get drawn, but with starred commands no lines are drawn because only
% the interior is coloured.
% The tangent direction need not be specified with a unit vector, although
% only its direction is relevant; the scaling of the specified direction
% vector to a unit vector is performed by the macro itself.
% Therefore one cannot specify the fine tuning of the curve convexity as it
% can be done with other programs or commands, as for example with \MF\
% or the pgf/tikz package and environment. See figure~\ref{fig:curve} for
+% The \Curve macro does not (still) have facilities for cycling the
+% path, that is to close the path from the last specified nodedirection
+% to the first specified nodedirection; but, as already mentioned, if
+% the ending node of the last arc does not coincide with the starting
+% node of the first arc, a straight line is assumed to join such nodes;
+% this line does not get drawn, but with starred commands no lines are
+% drawn because only the interior is coloured.
+% The tangent direction need not be specified with a unit vector,
+% although only its direction is relevant; the scaling of the specified
+% direction vector to a unit vector is performed by the macro itself.
+% Therefore one cannot specify the fine tuning of the curve convexity as
+% it can be done with other programs or commands, as, for example, with
+% \MF\ or the pgf/tikz package and environment. See figure~\ref{fig:curve} for
% an example.
% \begin{figure}[htb]
% \begin{minipage}{.48\textwidth}
@@ 933,7 +988,10 @@
% the macro fills up the contour with the selected current color,
% figure~\ref{fig:coloredcurve}.
%
% Figure~\ref{fig:arcspline} shows a geometric construction that contains the geometric elements and symbols used to determine the parameters of a cubic spline required to draw a quarter circle. This construction containa many of the commands described so far.
+% Figure~\ref{fig:arcspline} shows a geometric construction that
+% contains the geometric elements and symbols used to determine the
+% parameters of a cubic spline required to draw a quarter circle. This
+% construction contains many of the commands described so far.
%
%\begin{figure}[p]
%\begin{minipage}{\linewidth}\small
@@ 995,7 +1053,7 @@
%\put(32,13){\makebox(0,0)[br]{$K$}}%
%\end{picture}
%\end{minipage}
%\caption{The code to display the Nodes and control points for an arc to
+%\caption{The code to display the nodes and control points for an arc to
% be approximated with a cubic Bézier spline}
%\label{fig:arcspline}
%\end{figure}
@@ 1002,7 +1060,10 @@
%
%
% To show what you can do with \CurveBetween see the code and result
% shown in figure~\ref{fig:curvaduepunti}. Notice the effect of changing the directions at both or a the end nodes os a single cubic spline. The directions are conveniently expressed with unit vectors described by polar coordinates.
+% shown in figure~\ref{fig:curvaduepunti}. Notice the effect of
+% changing the directions at both or a the end nodes of a single cubic
+% spline. The directions are conveniently expressed with unit vectors
+% described by polar coordinates.
%\begin{figure}\centering\unitlength=0.004\textwidth
%\begin{picture}(220,120)(50,20)
@@ 1045,9 +1106,10 @@
% figure~\ref{fig:Cbezier}. The directions are specified with unit
% vectors in polar form; the control points are specified by adding their
% distances from their neighbouring nodes; actually the right distance
% is maintained to the value~1, while the left one increases from~4 to~10.
+% is maintained to the value~1, while the left one increases from~4
+% to~10.
% The black line corresponds to the standard \CurveBetween where the
% default distance is computed by default to trace an arc of a circle and
+% default distance is computed to trace an arc of a circle and
% is approximately~3.5.
%
%\begin{figure}[!tb]
@@ 1087,11 +1149,11 @@
% shown. The red line corresponds to the default tension, since the
% tension values are not specified. The black lines correspond to the
% various values used in the various commands to the \Curve macro.
% With a tension of zero, the spline is almost coincident wit the
% horizontal base line of the frame. Increasing the tension value
+% With a tension of zero, the spline is almost coincident with the
+% horizontal base line of the frame. Increasing the parameter value
% to~4.5, the curved becomes taller and taller, until it wraps itself
% displaying an evident loop. We would say that the value of ~2 is a
% reasonable maximum and increasing that tension value is just to
+% reasonable maximum and increasing that value is just to
% obtain special effects.
%
%\begin{figure}[!htb]\centering
@@ 1130,7 +1192,7 @@
% Figure~\ref{fig:sinewave} displays two approximations of a sine wave;
% Bézier splines can approximate transcendental curves, but the
% approximation may be a poor one, depending on the approximated curve,
% if few arcs are used to draw it. With arcs specified with more
+% when few arcs are used to draw it. With arcs specified with more
% complicated macros the approximation is better even with a lower number
% of arcs. With many arcs it is possible to approximate almost anything.
% On the left side a modest approximation is obtained with just three
@@ 1137,7 +1199,7 @@
% standard arcs obtained with \Curve and four node specifications;
% on the right we have just two arcs created with CBezierBetween
% with tension specification and control point distances; this drawing
%is almost undistinguishable from a real sinusoid.
+% is almost undistinguishable from a real sinusoid.
%
%\begin{figure}[!htb]
%\begin{minipage}{\linewidth}
@@ 1177,18 +1239,18 @@
%\label{fig:sinewave}
%\end{figure}
%
% In figure~\ref{fig:quadraticarcs} some lines drawn with quadratic
% splines by means of the \Qurve macro are shown. In the left there are
% some open and closed curves inscribed within a square. On the right a
% “real" circle is compared to a quadratic spline circle; the word “real”
% is emphasised because it actually is an approximation with four
% quartercircle cubic splines that, in spite of being drawn with third
% degree parametric polynomials, approximate very well a real circle; on
% the opposite the quadratic spline circle is clearly a poor
+% In figure~\ref{fig:quadraticarcs} some lines drawn are shown; they are
+% drawn with quadratic splines by means of the \Qurve macro. In the
+% left there are some open and closed curves inscribed within a square.
+% On the right a “real" circle is compared to a quadratic spline circle;
+% the word “real” is emphasised because it actually is an approximation
+% with four quartercircle cubic splines that, in spite of being drawn
+% with third degree parametric polynomials, approximate very well a real
+% circle; on the opposite the quadratic spline circle is clearly a poor
% approximation even if the maximum radial error amounts just to about
% 6\% of the radius.
%
%\begin{figure}[p]
+%\begin{figure}[!htb]
%\begin{minipage}{\linewidth}
%\begin{Verbatim}[fontsize=\setfontsize{7.75}]
%\unitlength=0.0045\textwidth
@@ 1252,37 +1314,42 @@
% although the latter one performed correctly for everything else except
% for colorfilled quadratic paths.
% ^^A
% \item The new version of \mulpiput is backwards compatibile with
% the original version contained in the \LaTeX\ kernel. The new part
% consists into the handling of the coordinate increments from one
% position to the next for the \meta{object} to include in the drawing.
+% \item The new version of \multiput is backwards compatibile with
+% the original version contained in the \LaTeX\ kernel. The new macro
+% adds the handling of the coordinate increments from one position to
+% the next for the \meta{object} to include in the drawing.
+%
% On page~\pageref{pag:multiput} we show the code for the figure shown
% there. The red grid is nothing new, except that id demonstrate the the
% traditional \multiput used in tis code, shown in a previous example,
% produces exactly the same result. But the for “graphs” on the grid,
+% there. The red grid is nothing new, except that it displays the
+% traditional \multiput used in this code, shown in a previous example,
+% produces exactly the same result. But the for “graphs” on the grid, it
% display an alignment of black dots along the diagonal of the grid
% (again traditional \multiput rendered with the new version);
% a number of blue dots along a parabola; another number of magenta
% dots alined along a half sine wave; a number of little green squares
% aligned along a $15~\circ$ line starting from the center of the grid.
+% aligned along a $15~\circ$ line starting from the center of the grid;
+% notice the polar values that are used as polar relative coordinate
+% increments.
%
%\noindent
+%\noindent\begin{figure}[!htb]
%\begin{minipage}{0.45\linewidth}
%\begin{Verbatim}[fontsize=\setfontsize{8.25}]
+%\begin{Verbatim}[fontsize=\setfontsize{8}]
%\unitlength=0.01\linewidth
%\begin{picture}(100,100)
%\put(0,0){\GraphGrid(100,100)}
%\multiput(0,0)(10,10){11}{\circle*{2}}
%\color{blue!70!white}
%\multiput(0,0)(10,0){11}{%
% \circle*{2}}%
% [\edef\X{\fpeval{\X+10}}%
% \edef\Y{\fpeval{((\X/10)**2)}}]
+%\multiput(0,0)(10,0){11}{\circle*{2}}%
+% [\GetCoord(\R)\X\Y
+% \edef\X{\fpeval{\X+10}}
+% \edef\Y{\fpeval{(\X/10)**2}}
+% \CopyVect\X,\Y to\R]
%\color{magenta}
%\multiput(0,0)(10,1){11}{%
%\circle*{2}}%
% [\edef\X{\fpeval{\X+10}}%
% \edef\Y{\fpeval{sind(\X*1.8)*100}}]
+%\multiput(0,0)(10,1){11}{\circle*{2}}%
+% [\GetCoord(\R)\X\Y
+% \edef\X{\fpeval{\X+10}}
+% \edef\Y{\fpeval{sind(\X*1.8)*100}}
+% \CopyVect\X\Y to\R]
%\color{green!60!black}
%\multiput(50,50)(15:5){11}}{%
%\polygon*(1,1)(1,1)(1,1)(1,1)}
@@ 1297,15 +1364,71 @@
%\multiput(0,0)(10,10){11}{\circle*{2}}
%\color{blue!70!white}
%\multiput(0,0)(10,0){11}{\circle*{2}}%
%[\edef\X{\fpeval{\X+10}}\edef\Y{\fpeval{((\X/10)**2)}}]
+% [\GetCoord(\R)\X\Y
+% \edef\X{\fpeval{\X+10}}
+% \edef\Y{\fpeval{(\X/10)**2}}
+% \CopyVect\X,\Y to\R]
%\color{magenta}
%\multiput(0,0)(10,1){11}{\circle*{2}}%
%[\edef\X{\fpeval{\X+10}}\edef\Y{\fpeval{sind(\X*1.8)*100}}]
+% [\GetCoord(\R)\X\Y
+% \edef\X{\fpeval{\X+10}}
+% \edef\Y{\fpeval{sind(\X*1.8)*100}}
+% \CopyVect\X,\Y to\R]
%\color{green!60!black}
%\multiput(50,50)(15:5){11}{\polygon*(1,1)(1,1)(1,1)(1,1)}
%\end{picture}\label{pag:multiput}
+%\end{picture}
%\end{minipage}
+%\caption{Some examples of the \meta{handler} optional argument}%\label{pag:multiput}
+%\end{figure}
%
+% A new command \xmultiput (not available with the previous versions
+% of curve2e) extended with respect to the original \multiput is
+% defined by using some L3 functions; in particular the cycling
+% counter is accessible to the \LaTeX\ commands and it is stepped
+% forward from~1 to the value specified in the proper command argument
+% (in the original command it starts from that value and is stepped down
+% to zero). See the figure on page~\ref{pag:orologio} to inspect its
+% usage. It is important to notice that if the command\rotatebox
+% has to be used, as in the example of figure~\ref{pag:orologio}, the
+% package graphics should be also loaded, because curve2e does not
+% do it.
+%
+%\begin{figure}[!htb]
+%\begin{minipage}{0.45\textwidth}
+%\begin{verbatim}
+%\unitlength=0.0095\linewidth
+%\begin{picture}(100,100)
+%\put(0,0){\GraphGrid(100,100)}
+%\put(50,50){\thicklines\circle{100}}
+%\xmultiput[50,50](60:40)(30:1){12}%
+% {\makebox(0,0){\circle*{2}}}%
+% [\MultVect\R by\D to\R]%
+%\xmultiput[50,50](60:46)(30:1){12}%
+% {\ArgOfVect\R to\Ang
+% \rotatebox{\fpeval{\Ang90}}%
+% {\makebox(0,0)[b]{\Roman{multicnt}}}}%
+% [\Multvect{\R}{\D}\R]
+%\end{picture}
+%\end{verbatim}
+%\end{minipage}
+%\hfill
+%\begin{minipage}{0.45\textwidth}\raggedleft
+%\unitlength=0.0095\linewidth
+%\begin{picture}(100,100)
+%\put(0,0){\GraphGrid(100,100)}
+%\put(50,50){\thicklines\circle{100}}
+%\xmultiput[50,50](60:40)(30:1){12}%
+% {\makebox(0,0){\circle*{2}}}[\MultVect\R by\D to\R]%
+%\xmultiput[50,50](60:43)(30:1){12}%
+% {\ArgOfVect\R to\Ang\rotatebox{\fpeval{\Ang90}}%
+% {\makebox(0,0)[b]{\Roman{multicnt}}}}%
+% [\Multvect{\R}{\D}\R]
+%\end{picture}
+%\end{minipage}
+%\caption{Usage example of the \texttt{\string\xmultiput} command}
+%\label{pag:orologio}\hfill
+%\end{figure}
+%
% \end{enumerate}
%
%
@@ 1316,10 +1439,10 @@
% Lamport himself announced an extension to his environment when \LaTeXe\
% was first released in 1994; in the latexnews newsletter of December
% 2003; the first implementation was announced; the first version of this
% package was issued in 2006. It was time to have a better drawing
% environment; this package is a simple attempt to follow the initial
% path while extending the drawing facilities; but Till Tantau's pgf
% package has gone much farther.
+% package curve2e was issued in 2006. It was time to have a better
+% drawing environment; this package is a simple attempt to follow the
+% initial path while extending the drawing facilities; but Till Tantau's
+% pgf package has gone much farther.
%
%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \section{Remark}
@@ 1329,18 +1452,19 @@
% tracing curves of various kinds. PSTricks and tikz/pgf are the most
% powerful ones.
% But there is also the package curves that is intended to draw almost
% anything by using little dots or other symbols partially superimposed to
% one another. It uses only quadratic Bézier curves and the curve tracing
% is eased by specifying only the curve nodes, without specifying the
% control nodes; with a suitable option to the package call it is possible
% to reduce the memory usage by using short straight segments drawn with
% the PostScript facilities offered by the dvips driver.
+% anything by using little dots or other symbols partially superimposed
+% to one another. It uses only quadratic Bézier curves and the curve
+% tracing is eased by specifying only the curve nodes, without specifying
+% the control nodes; with a suitable option to the package call it is
+% possible to reduce the memory usage by using short straight segments
+% drawn with the PostScript facilities offered by the dvips driver.
%
% Another package ebezier performs about the same as curve2e but draws
% its Bézier curves by using little dots partially superimposed to one
% another. The documentation is quite interesting but since it explains
% very clearly what exactly are the Bézier splines. Apparently ebezier
% should be used only for dvi output without recourse to PostScript machinery.
+% Another package ebezier performs about the same as curve2e but
+% draws its Bézier curves by using little dots partially superimposed to
+% one another. The documentation is quite interesting since it
+% explains very clearly what exactly are the Bézier splines. Apparently
+% ebezier should be used only for DVI output without recourse to
+% PostScript or PDF machinery.
%
% The picture package extends the performance of the picture
% environment (extended with \texttt{pict2e}) by accepting coordinates
@@ 1349,16 +1473,16 @@
% other packages. In certain circumstances it is very useful.
%
% Package \texttt{xpicture} builds over the picture \LaTeX\ environment
% so as to allow to draw the usual curves that are part of an introductory
% analytic geometry course; lines, circles, parabolas, ellipses,
% hyperbolas, and polynomials; the syntax is very comfortable; for all
% these curves it uses the quadratic Bézier splines.
+% so as to allow to draw the usual curves that are part of an
+% introductory analytic geometry course; lines, circles, parabolas,
+% ellipses, hyperbolas, and polynomials; the syntax is very comfortable;
+% for all these curves it uses the quadratic Bézier splines.
%
% Package hobby extends the cubic Bézier spline handling with the
% algorithms John Hobby created for \MF\ and \MP. But by now this package
% interfaces very well with tikz; it has not (yet) been adapted to the
% common picture environment, even extended with pict2e, and, why not,
% with curve2e.
+% common picture environment, even when extended with pict2e, and,
+% why not, with curve2e.
%
%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \section{Acknowledgements}
@@ 1365,18 +1489,18 @@
%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% I wish to express my deepest thanks to Michel Goosens who spotted some
% errors and very kindly submitted them to me so that I was able to correct
% them.
+% errors and very kindly submitted them to me so that I was able to
+% correct them.
%
% Josef Tkadlec and the author collaborated extensively in order to make a
% better real long division so as to get correctly the quotient fractional
% part and to avoid as much as possible any numeric overflow; many Josef's
% ideas are incorporated in the macro that was implemented in the previous
% version of this package, although the macro used by Josef was slightly
% different. Both versions aim/aimed at a better accuracy and at widening
% the operand ranges. In this version we abandoned the long division macro,
% and substituted it with the floating point division provided by the
% xfp package.
+% Josef Tkadlec and the author collaborated extensively in order to make
+% a better real long division so as to get correctly the quotient
+% fractional part and to avoid as much as possible any numeric overflow;
+% many Josef's ideas are incorporated in the macro that was implemented
+% in the previous version of this package, although the macro used by
+% Josef was slightly different. Both versions aim/aimed at a better
+% accuracy and at widening the operand ranges. In this version we
+% abandoned the long division macro, and substituted it with the
+% floating point division provided by the xfp package.
%
% Daniele Degiorgi spotted a fault in the kernel definition of
% \linethickness that heavily influenced also curve2e; see below in
@@ 1383,20 +1507,21 @@
% the code documentation part.
%
% Thanks also to JinHwan Cho and Juho Lee who suggested a small but
% crucial modification in order to have \texttt{curve2e} work smoothly also
% with XeTeX (XeLaTeX). Actually if version 0.2x or later, dated 2009/08/05
% or later, of pict2e is being used, such modification is not necessary,
% but it's true that it becomes imperative if older versions are used.
+% crucial modification in order to have \texttt{curve2e} work smoothly
+% also with XeTeX (XeLaTeX). Actually if pict2e, version 0.2x or later,
+% dated 2009/08/05 or later, is being used, such modification is not
+% necessary any more, but it's true that it becomes imperative if older
+% versions are used.
%
% \StopEventually{%
% \begin{thebibliography}{9}
% \bibitem{pict2e} Gäßlein H., Niepraschk R., and Tkadlec J.
% \emph{The \texttt{pict2e} package}, 2014, PDF documentation of
% \texttt{pict2e}; this package is part of any modern complete distribution
% of the \TeX\ system. In case of a basic or partial system installation,
% the package may be installed by means of the specific facilities of the
% distribution. It may be read by means of the line command \texttt{texdoc
% pict2e}.
+% \emph{The \texttt{pict2e} package}, 2019, PDF documentation of
+% \texttt{pict2e}; this package is part of any modern complete
+% distribution of the \TeX\ system; it may be read by means of the line
+% command \texttt{texdoc pict2e}. In case of a basic or partial system
+% installation, the package may be installed by means of the specific
+% facilities of the distribution.
% \end{thebibliography}
% }
%
@@ 1410,27 +1535,28 @@
% The necessary preliminary code has already been introduced. Here we
% require the \texttt{color} package and the \texttt{pict2e} one; for the
% latter one we make sure that a sufficiently recent version is used.
% If you want to use package \texttt{xcolor}, load it after
+% If you want to use package \texttt{xcolor}, load it \emph{after}
% \texttt{curve2e}.
%
% Here we load also the xparse and xfp packages because we use their
% functionalities; but we do load them only if they are not already loaded
% with or without options; nevertheless we warn the user who wants to load
% them explicitly, to do this action before loading \texttt{curve2e}.
% The xfp package is absolutely required; if this package can not found
% it in the \TeX\ system installation, the loading of this package is
% aborted, and the previous version 1.61 of curve2e is loaded in its
% place; the overall functionalities should non change much, nevertheless
% the functionalities of xfp are not available.
+% functionalities; but we do load them only if they are not already
+% loaded with or without options; nevertheless we warn the user who wants
+% to load them explicitly, to do this action before loading
+% \texttt{curve2e}.
+% The xfp package is absolutely required; if this package is not found
+% in the \TeX\ system installation, the loading of this new curve2e is
+% aborted, and the previous version 1.61 is loaded in its
+% place; the overall functionalities should non change much, but the
+% functionalities of xfp are not available.
%\iffalse
%<*package>
%\fi
% \begin{macrocode}
\IfFileExists{xfp.sty}{%
 \RequirePackage{color}
 \RequirePackageWithOptions{pict2e}[2014/01/01]
 \@ifl at aded{sty}{xparse}{}{\RequirePackage{xparse}}
 \@ifl at aded{sty}{xfp}{}{\RequirePackage{xfp}}%
+ \RequirePackage{color}
+ \RequirePackageWithOptions{pict2e}[2014/01/01]
+ \@ifl at aded{sty}{xparse}{}{\RequirePackage{xparse}}
+ \@ifl at aded{sty}{xfp}{}{\RequirePackage{xfp}}%
}{%
\RequirePackage{curve2ev161}%
\PackageWarningNoLine{curve2e}{%
@@ 1447,6 +1573,18 @@
\endinput
}
% \end{macrocode}
+% Since we already loaded packagexfp or at least we explicitly load it
+% in our preamble, we add, if not already defined by the package, the two
+% new commands that allow to make floating point tests, and to implement
+% a “while” cycle
+% \begin{macrocode}
+\AtBeginDocument{\@ifpackageloaded{xfp}{%
+\ExplSyntaxOn
+\ProvideExpandableDocumentCommand\fptest{m}{\fp_compare:nTF{#1}}
+\ProvideExpandableDocumentCommand\fpdowhile{m m}{\fp_do_while:nn{#1}{#2}}
+\ExplSyntaxOff
+}{}}
+% \end{macrocode}
%
% The next macros are just for debugging. With the \texttt{trace} package
% it would probably be better to define other macros, but this is not for
@@ 1457,10 +1595,10 @@
% \end{macrocode}
%
% Next we define some new dimension registers that will be used by the
% subsequent macros; should they be already defined, there will not be any
% redefinition; nevertheless the macros should be sufficiently protected
% so as to avoid overwriting register values loaded by other macro
% packages.
+% subsequent macros; should they be already defined, there will not be
+% any redefinition; nevertheless the macros should be sufficiently
+% protected so as to avoid overwriting register values loaded by other
+% macro packages.
% \begin{macrocode}
\ifx\undefined\@tdA \newdimen\@tdA \fi
\ifx\undefined\@tdB \newdimen\@tdB \fi
@@ 1474,18 +1612,19 @@
%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{Line thickness macros}
%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% It is better to define a macro for setting a different value for the line
% and curve thicknesses; the `\defaultlinewidth should contain the
% equivalent of \@wholewidth, that is the thickness of thick lines; thin
% lines are half as thick; so when the default line thickness is specified
% to, say, 1pt, thick lines will be 1pt thick and thin lines will be 0.5pt
% thick. The default whole width of thick lines is 0,8pt, but this is
% specified in the kernel of \LaTeX\ and\slash or in \texttt{pict2e}. On
% the opposite it is necessary to redefine \linethickness because the
% \LaTeX\ kernel global definition does not hide the space after the closed
% brace when you enter something such as \linethickness{1mm} followed by
% a space or a new line.\footnote{Thanks to Daniele Degiorgi
% (\texttt{degiorgi at inf.ethz.ch}).}
+% It is better to define a macro for setting a different value for the
+% line and curve thicknesses; the `\defaultlinewidth should contain
+% the equivalent of \@wholewidth, that is the thickness of thick lines;
+% thin lines are half as thick; so when the default line thickness is
+% specified to, say, 1pt, thick lines will be 1pt thick and thin lines
+% will be 0.5pt thick. The default whole width of thick lines is 0,8pt,
+% but this is specified in the kernel of \LaTeX\ and\slash or in
+% \texttt{pict2e}. On the opposite it is necessary to redefine
+% \linethickness because the \LaTeX\ kernel global definition does not
+% hide the space after the closed brace when you enter something such as
+% \linethickness{1mm} followed by a space or a new
+% line.\footnote{Thanks to Daniele
+% Degiorgi \texttt{degiorgi at inf.ethz.ch}).}
% \begin{macrocode}
\gdef\linethickness#1{%
\@wholewidth#1\@halfwidth.5\@wholewidth\ignorespaces}%
@@ 1505,7 +1644,8 @@
% The macro \LIne allows to draw a line with arbitrary inclination
% as if it was a polygonal with just two vertices; actually it joins the
% canvas coordinate origin with the specified relative coordinate;
% therefore this object must be set in place by means of a \put command.
+% therefore this object must be set in place by means of a \put
+% command.
% Since its starting point is always at a relative 0,0 coordinate point
% inside the box created with \put, the two arguments define the
% horizontal and the vertical component respectively.
@@ 1517,24 +1657,25 @@
% \end{macrocode}
%
% A similar macro \segment operates between two explicit points with
% absolute coordinates, instead of relative to the position specified by a
% \put command; it resorts to the \polyline macro that shall be
% defined in a while. The \@killglue command might be unnecessary, but it
% does not harm; it eliminates any explicit or implicit spacing that might
% precede this command.
+% absolute coordinates, instead of relative to the position specified
+% by a \put command; it resorts to the \polyline macro that shall be
+% defined in a while. The \@killglue command might be unnecessary, but
+% it does not harm; it eliminates any explicit or implicit spacing that
+% might precede this command.
% \begin{macrocode}
\def\segment(#1)(#2){\@killglue\polyline(#1)(#2)}%
% \end{macrocode}
% By passing its ending points coordinates to the \polyline macro, both
% macro arguments are a pair of coordinates, not their components; in other
% words, if $P_1=(x_1, y_2)$ and $P_2=(x_2, y_2)$, then the first argument
% is the couple $x_1, y_1$ and likewise the second argument is $x_2, y_2$.
% Notice that since \polyline accepts also the corner coordinates in
+% macro arguments are a pair of coordinates, not their components; in
+% other words, if $P_1=(x_1, y_2)$ and $P_2=(x_2, y_2)$, then the first
+% argument is the couple $x_1, y_1$ and likewise the second argument is
+% $x_2, y_2$.
+% Notice that since \polyline accepts also the vertex coordinates in
% polar form, also\segment accepts the polar form. Please remember that
% the decimal separator is the decimal \emph{point}, while the \emph{comma}
% acts as coordinate separator. This recommendation is particularly
% important for nonEnglish speaking users, since in all other languages
% the comma must be used as the decimal separator.
+% the decimal separator is the decimal \emph{point}, while the
+% \emph{comma} acts as coordinate separator. This recommendation is
+% particularly important for nonEnglish speaking users, since in all
+% other languages the comma is or must be used as the decimal separator.
%
% The \line macro is redefined by making use of a division routine
% performed in floating point arithmetics; for this reason the \LaTeX\
@@ 1547,8 +1688,8 @@
% direction coefficients in polar mode; that is, instead of specifying a
% slope of $30^\circ$ with the actual sine and cosine (or values
% proportional to such functions), for example (0.5,0.866025), you may
% specify it as (30:1), i.e. as a unit vector with the required slope of
% $30^\circ$.
+% specify it as (30:1), i.e. as a unit vector with the required slope
+% of $30^\circ$.
%
% The beginning of the macro definition is the same as that of \texttt{pict2e}:
% \begin{macrocode}
@@ 1559,13 +1700,13 @@
% but as soon as it is verified that the line length is not negative,
% things change remarkably; in facts the machinery for complex numbers is
% invoked. This makes the code much simpler, not necessarily more
% efficient; nevertheless \DirOfVect takes the only macro argument (that
% actually contains a comma separated pair of fractional numbers) and
% copies it to \Dir at line (an arbitrarily named control sequence) after
% renormalizing to unit magnitude; this is passed to GetCoord that
% separates the two components into the control sequences \d at mX and
% \d at mY; these in turn are the values that are actually operated upon by
% the subsequent commands.
+% efficient; nevertheless \DirOfVect takes the only macro argument
+% (that actually contains a comma separated pair of fractional numbers)
+% and copies it to \Dir at line (an arbitrarily named control sequence)
+% after renormalizing to unit magnitude; this is passed to GetCoord
+% that separates the two components into the control sequences \d at mX
+% and \d at mY; these in turn are the values that are actually operated
+% upon by the subsequent commands.
% \begin{macrocode}
\expandafter\DirOfVect#1to\Dir at line
\GetCoord(\Dir at line)\d at mX\d at mY
@@ 1583,114 +1724,143 @@
\fi
% \end{macrocode}
% Of course, if the line is vertical this division must not take place.
% Finally the \texttt{moveto}, \texttt{lineto} and \texttt{stroke} language
% keywords are invoked by means of the internal \texttt{pict2e} commands in
% order to draw the line. Notice that even vertical lines are drawn with
% the PDF language commands instead of resorting to the DVI low level
% language that was used in both \texttt{pict2e} and the original
% (pre 1994) \texttt{picture} commands; it had a meaning in the old times,
% but it certainly does not have any, since lines are drawn by the driver
% that produces the output in a human visible document form, not by \TeX\
% the program.
+% Finally the \texttt{moveto}, \texttt{lineto} and \texttt{stroke}
+% language keywords are invoked by means of the internal \texttt{pict2e}
+% commands in order to draw the line. Notice that even vertical lines are
+% drawn with the PDF language commands instead of resorting to the DVI
+% low level language that was used in both \texttt{pict2e} and the
+% original (pre 1994) \texttt{picture} commands; it had a meaning in the
+% old times, but it certainly does not have any nowadays, since lines are
+% drawn by the driver that produces the output in a human visible
+% document form, not by \TeX\ the program.
% \begin{macrocode}
 \moveto(0,0)
 \pIIe at lineto{\d at mX\@linelen}{\d at mY\@linelen}%
+ \moveto(0,0)\pIIe at lineto{\d at mX\@linelen}{\d at mY\@linelen}%
\strokepath
\fi
\endgroup\ignorespaces}%
% \end{macrocode}
% The new definition of the command \line, besides the ease with which is
% readable, does not do different things from the definition of pict2e
% 2009, but it did perform in a better way compared to the 2004 version
% that was limited to integer direction coefficients up to 999 in
% magnitude. In any case this curve2e version accepts polar coordinates
% as slope couples, making it much simpler to draw lines with specific
% slopes.
+% The new definition of the command \line, besides the ease with which
+% is readable, does not do different things from the definition of
+% pict2e 2009, even if it did perform in a better way compared to the
+% 2004 version that was limited to integer direction coefficients up to
+% 999 in magnitude. Moreover this curve2e version accepts polar
+% coordinates as slope pairs, making it much simpler to draw lines with
+% specific slopes.
%
+% It is necessary to redefine the low level macros \cs{moveto},
+% \cs{lineto}, and \cs{curveto}, because their original definition
+% accepts only cartesian coordinates. We proceed the same as for the
+% \cs{put} command.
+% \begin{macrocode}
+\let\originalmoveto\moveto
+\let\originallineto\lineto
+\let\originalcurveto\curveto
+
+\def\moveto(#1){\GetCoord(#1)\MTx\MTy
+ \originalmoveto(\MTx,\MTy)\ignorespaces}
+\def\lineto(#1){\GetCoord(#1)\LTx\LTy
+ \originallineto(\LTx,\LTy)\ignorespaces}
+\def\curveto(#1)(#2)(#3){\GetCoord(#1)\CTpx\CTpy
+ \GetCoord(#2)\CTsx\CTsy\GetCoord(#3)\CTx\CTy
+ \originalcurveto(\CTpx,\CTpy)(\CTsx,\CTsy)(\CTx,\CTy)\ignorespaces}
+% \end{macrocode}
+
%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{Dashed and dotted lines}
%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Dashed and dotted lines are very useful in technical drawings; here we
% introduce four macros that help drawing them in the proper way; besides
% the obvious difference between the use of dashes or dots, they may refer
% in a different way to the end points that must be specified to the
% various macros.
+% introduce two macros that help drawing them in the proper way; besides
+% the obvious difference between the use of dashes or dots, they may
+% refer in a different way to the end points that must be specified to
+% the various macros.
%
% The coordinates of the first point $P_1$, where le line starts, are
% always referred to the origin of the coordinate axes; the end point $P_2$
% coordinates with the first macro type are referred to the origin of the
% axes, while with the second macro type they are referred to $P_1$; both
% macro types have their usefulness and figures~\ref{fig:dashedlines} on
% page~\pageref{fig:dashedlines} and~\ref{fig:dottedlines} on
% page~\pageref{fig:dottedlines} show how to use these macros.
+% always referred to the origin of the coordinate axes; the end point
+% $P_2$ coordinates are referred to the origin of the axes if in
+% cartesian form, while with the polar form they are referred to $P_1$;
+% both coordinate types have their usefulness and
+% figures~\ref{fig:dashedlines} on page~\pageref{fig:dashedlines}
+% and~\ref{fig:dottedlines} on page~\pageref{fig:dottedlines} show how
+% to use such coordinate types.
%
% We distinguish these macros with an asterisk; the unstarred version is
% the first macro type, while the starred one refers to the second macro
% type.
%
% The above mentioned macros create dashed lines between two given
% points, with a dash length that must be specified, or dotted lines, with
% a dot gap that must be specified; actually the specified dash length or
% dot gap is a desired one; the actual length or gap is computed by integer
% division between the distance of the given points and the desired dash
% length or dot gap; when dashes are involved, this integer is tested in
% order to see if it is an odd number; if it's not, it is increased by
% unity. Then the actual dash length or dot gap is obtained by dividing the
% above distance by this number.
+% points, with a dash length that must be specified, or dotted lines,
+% with a dot gap that must be specified; actually the specified dash
+% length or dot gap is a desired one; the actual length or gap is
+% computed by integer division between the distance of the given points
+% and the desired dash length or dot gap; when dashes are involved, this
+% integer is tested in order to see if it is an odd number; if it's not,
+% it is increased by unity. Then the actual dash length or dot gap is
+% obtained by dividing the above distance by this number.
%
% Another vector $P_2P_1$ is created by dividing it by this number;
% then, when dashes are involved, it is multiplied by two in order to
% have the increment from one dash to the next; finally the number of
% patterns is obtained by integer division of this number by 2 and
% increasing it by~1.
% A simple \multiput completes the job, but in order to use the various
% vectors and numbers within a group and to throw the result outside the
% group while restoring all the intermediate counters and registers, a
% service macro is created with an expanded definition and then this
% service macro is executed.
+% increasing it by~1. Since the whole dashed or dotted line is put in
+% position by an internal \put command, is is not necessary to enclose
+% the definitions within groups, because they remain interna to the
+% \put argument box.
+%
% Figure~\ref{fig:dashedlines} on page~\pageref{fig:dashedlines} shows
% the effect of the slight changing of the dash length in order to
% maintain approximately the same dashspace pattern along the line,
% irrespective of the line length. The syntax is the following:
% \begin{flushleft}
% \cs{Dashline}\meta{\texttt{*}}\parg{first point}\parg{second point}\marg{dash length}
+% \cs{Dashline}\parg{first point}\parg{second point}\marg{dash length}
% \end{flushleft}
% where \meta{first point} contains the coordinates of the starting point
% and \meta{second point} those of the ending point; of course the
% \meta{dash length}, which equals the dash gap, is mandatory. The
% asterisk plays a specific role; in facts, if coordinates are specified
% in polar form, without the optional asterisk the dashed line is
% misplaced, while if the asterisk is specified, the whole object is put
% in the proper position. On the opposite, if the coordinates are in
% cartesian form the \meta{first point} coordinates play the role they
% are supposed to do even without the asterisk.
+% and \meta{second point} the absolute (cartesian) or relative (polar)
+% coordinates of the ending point; of course the \meta{dash length},
+% which equals the dash gap, is mandatory. An optional asterisk used to
+% play a specific role with previous implementations;
+% it is maintained for backwards compatibility, but its use is now
+% superfluous; with the previous implementation of the code, in facts,
+% if coordinates were specified in polar form, without the optional
+% asterisk the dashed line was misplaced, while if the asterisk was
+% specified, the whole object was put in the proper position. With this
+% new implementation, both the cartesian and polar coordinates always
+% play the role they are supposed to play independently from the
+% asterisk. The \IsPolar macro is introduced to analyse the coordinate
+% type used for the second argument, and uses such second argument
+% accordingly.
% \begin{macrocode}
+\def\IsPolar#1:#2?{\def\@TempOne{#2}\unless\ifx\@TempOne\empty
+ \expandafter\@firstoftwo\else
+ \expandafter\@secondoftwo\fi}
+
\ifx\Dashline\undefined
 \def\Dashline{\@ifstar{\Dashline@@}{\Dashline@}}

 \def\Dashline@(#1)(#2)#3{%
 \bgroup
 \countdef\NumA3254\countdef\NumB3252\relax
 \GetCoord(#1)\@tA\@tB \MakeVectorFrom\@tA\@tB to\V at ttA
 \GetCoord(#2)\@tA\@tB \MakeVectorFrom\@tA\@tB to\V at ttB
 \SubVect\V at ttA from\V at ttB to\V at ttC
 \ModOfVect\V at ttC to\DlineMod
 \DivideFN\DlineMod by#3 to\NumD
 \NumA=\fpeval{trunc(\NumD,0)}\relax
 \unless\ifodd\NumA\advance\NumA\@ne\fi
 \NumB=\NumA \divide\NumB\tw@
 \DividE\DlineMod\p@ by\NumA\p@ to\D at shMod
 \DividE\p@ by\NumA\p@ to \@tempa
 \MultVect\V at ttC by\@tempa,0 to\V at ttB
 \MultVect\V at ttB by 2,0 to\V at ttC
 \advance\NumB\@ne
 \edef\@mpt{\noexpand\egroup
 \noexpand\multiput(\V at ttA)(\V at ttC){\number\NumB}%
 {\noexpand\LIne(\V at ttB)}}%
 \@mpt\ignorespaces}%
+ \def\Dashline{\@ifstar{\Dashline@}{\Dashline@}}% bckwd compatibility
\let\Dline\Dashline
 \def\Dashline@@(#1)(#2)#3{\put(#1){\Dashline@(0,0)(#2){#3}}}
+ \def\Dashline@(#1)(#2)#3{\put(#1){%
+ \GetCoord(#1)\@tA\@tB \MakeVectorFrom\@tA\@tB to\V at ttA
+ \GetCoord(#2)\@tA\@tB \MakeVectorFrom\@tA\@tB to\V at ttB
+ \IsPolar#2:?{% Polar
+ \Dashline@@(0,0)(\V at ttB){#3}}%
+ {% Cartesian
+ \SubVect\V at ttA from\V at ttB to\V at ttC
+ \Dashline@@(0,0)(\V at ttC){#3}%
+ }
+}}
+
+ \def\Dashline@@(#1)(#2)#3{%
+ \countdef\NumA3254\countdef\NumB3252\relax
+ \GetCoord(#1)\@tA\@tB \MakeVectorFrom\@tA\@tB to\V at ttA
+ \GetCoord(#2)\@tA\@tB \MakeVectorFrom\@tA\@tB to\V at ttB
+ \SubVect\V at ttA from\V at ttB to\V at ttC
+ \ModOfVect\V at ttC to\DlineMod
+ \DivideFN\DlineMod by#3 to\NumD
+ \NumA=\fpeval{trunc(\NumD,0)}\relax
+ \unless\ifodd\NumA\advance\NumA\@ne\fi
+ \NumB=\NumA \divide\NumB\tw@
+ \DividE\DlineMod\p@ by\NumA\p@ to\D at shMod
+ \DividE\p@ by\NumA\p@ to \@tempa
+ \Multvect{\V at ttC}{\@tempa,0}\V at ttB
+ \Multvect{\V at ttB}{2,0}\V at ttC
+ \advance\NumB\@ne
+ \put(\V at ttA){\multiput(0,0)(\V at ttC){\NumB}{\LIne(\V at ttB)}}
+ \ignorespaces}
\fi
% \end{macrocode}
%
@@ 1699,43 +1869,51 @@
% computed in such a way as to have the first and the last dot at the
% exact position of the dottedline endpoints; again the specified dot
% distance is nominal in the sense that it is recalculated in such a way
% that the first and last dots coincide with the line end points. The
% syntax is as follows:
+% that the first and last dots coincide with the line end points.
+% Again if the second point coordinates are in polar form they are
+% considered as relative to the first point. The syntax is as follows:
%\begin{flushleft}
%\cs{Dotline}\meta{\texttt{*}}\parg{start point}\parg{end point}\marg{dot distance}
+%\cs{Dotline}\parg{start point}\parg{end point}\marg{dot distance}
%\end{flushleft}
% \begin{macrocode}
\ifx\Dotline\undefined
 \def\Dotline{\@ifstar{\Dotline@@}{\Dotline@}}
 \def\Dotline@(#1)(#2)#3{%
 \bgroup
 \countdef\NumA 3254\relax \countdef\NumB 3255\relax
 \GetCoord(#1)\@tA\@tB \MakeVectorFrom\@tA\@tB to\V at ttA
 \GetCoord(#2)\@tA\@tB \MakeVectorFrom\@tA\@tB to\V at ttB
 \SubVect\V at ttA from\V at ttB to\V at ttC
 \ModOfVect\V at ttC to\DotlineMod
 \DivideFN\DotlineMod by#3 to\NumD
 \NumA=\fpeval{trunc(\NumD,0)}\relax
 \DivVect\V at ttC by\NumA,0 to\V at ttB
 \advance\NumA\@ne
 \edef\@mpt{\noexpand\egroup
 \noexpand\multiput(\V at ttA)(\V at ttB){\number\NumA}%
 {\noexpand\makebox(0,0){\noexpand\circle*{0.5}}}}%
 \@mpt\ignorespaces}%

 \def\Dotline@@(#1)(#2)#3{\put(#1){\Dotline@(0,0)(#2){#3}}}%
+ \def\Dotline{\@ifstar{\Dotline@}{\Dotline@}}% backwards compatibility
+ \def\Dotline@(#1)(#2)#3{\put(#1){%
+ \IsPolar#2:?{% Polar
+ \Dotline@@(0,0)(#2){#3}}
+ {% Cartesian
+ \CopyVect#1to\V at ttA
+ \CopyVect#2to\V at ttB
+ \SubVect\V at ttA from\V at ttB to\V at ttC
+ \Dotline@@(0,0)(\V at ttC){#3}}%
+ }}
+
+ \def\Dotline@@(#1)(#2)#3{%
+ \countdef\NumA 3254\relax
+ \countdef\NumB 3255\relax
+ \CopyVect#1to\V at ttA
+ \CopyVect#2to\V at ttB
+ \SubVect\V at ttA from\V at ttB to\V at ttC
+ \ModOfVect\V at ttC to\DotlineMod
+ \DivideFN\DotlineMod by#3 to\NumD
+ \NumA=\fpeval{trunc(\NumD,0)}\relax
+ \Divvect{\V at ttC}{\NumA,0}\V at ttB
+ \advance\NumA\@ne
+ \put(\V at ttA){\multiput(0,0)(\V at ttB){\NumA}{\makebox(0,0)%
+ {\circle*{0.5}}}}
+ \ignorespaces
+ }%
\fi
% \end{macrocode}
%
% Notice that vectors as complex numbers in their cartesian and polar forms
% always represent a point position referred to the origin of the axes;
% this is why in figures~\ref{fig:dashedlines} on
% page~\pageref {fig:dashedlines} and~\ref{fig:dottedlines} on
% page~\pageref{fig:dottedlines} the dashed and dotted line that depart
+% Notice that vectors as complex numbers in their cartesian and polar
+% forms always represent a point position referred to a local origin
+% of the axes; this is why in figures~\ref{fig:dashedlines} on
+% page~\pageref{fig:dashedlines} and~\ref{fig:dottedlines} on
+% page~\pageref{fig:dottedlines} the dashed and dotted lines that start
% from the lower right corner of the graph grid, and that use polar
% coordinates, have to be put at the proper position with the starred
% version of the commands that take care of the relative specification
% made with the polar coordinates.
+% coordinates, are correctly put in their correct position thanks to the
+% different behaviour obtained with the \IsPolar macro.
%
%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{Coordinate handling}
@@ 1753,7 +1931,7 @@
% \GetCoord macro; its function is to translate real lengths into
% coefficients to be used as multipliers of the current \unitlength; in
% case that the esopic had been loaded, at the \begin{document}
% execution the esopic macro is redefined using the e\TeX\ commands
+% execution, the esopic macro is redefined using the e\TeX\ commands
% so as to make it compatible with these local macros.\footnote{Thanks to
% FranzJoseph Berthold who was so kind to spot the bug.}
% \begin{macrocode}
@@ 1768,31 +1946,32 @@
%
% But let us come to the real subject of this section. We define a
% \GettCoord macro that passes control to the service macro with the
% expanded arguments; expanding arguments allows to use macros to name
+% expanded arguments; expanding arguments allows to use macros to named
% points, instead of explicit coordinates; with this version of curve2e
% this facility is not fully exploited, but a creative user can use this
% feature.
+% feature. Notice the usual trick to pass through a dummy macro that is
+% defined within a group with expanded arguments, but where the group is
+% closed by the macro itself, so that no traces remain behind after its
+% expansion.
% \begin{macrocode}
\def\GetCoord(#1)#2#3{%
\expandafter\SplitNod@\expandafter(#1)#2#3\ignorespaces}
\def\SplitNod@(#1)#2#3{\isnot at polar#1:!!(#1)#2#3}%
+\def\GetCoord(#1)#2#3{\bgroup\edef\x{\egroup\noexpand\IsPolar#1:?}\x
+{% Polar
+ \bgroup\edef\x{\egroup\noexpand\SplitPolar(#1)}\x\SCt at X\SCt at Y}%
+{% Cartesian
+ \bgroup\edef\x{\egroup\noexpand\SplitCartesian(#1)}\x\SCt at X\SCt at Y}%
+ \edef#2{\SCt at X}\edef#3{\SCt at Y}\ignorespaces}
+
+\def\SplitPolar(#1:#2)#3#4{%
+ \edef#3{\fpeval{#2 * cosd#1}}\edef#4{\fpeval{#2 * sind#1}}}
+
+\def\SplitCartesian(#1,#2)#3#4{\edef#3{#1}\edef#4{#2}}
+
% \end{macrocode}
% The macro that detects the form of the coordinates is \isnot at polar;
+% The macro that detects the form of the coordinates is \IsPolar;
% it examines the parameter syntax in order to see if it contains a
% colon; if it does, the coordinates are in polar form, otherwise they
% are in cartesian form. this macro uses delimited arguments, therefore
% low level definition syntax must be used.
% \begin{macrocode}
\def\isnot at polar#1:#2!!{\def\@tempOne{#2}\ifx\@tempOne\empty
\expandafter\@firstoftwo\else
\expandafter\@secondoftwo\fi
{\SplitNod@@}{\SplitPolar@@}}

\def\SplitNod@@(#1,#2)#3#4{\edef#3{#1}\edef#4{#2}}%
\def\SplitPolar@@(#1:#2)#3#4{\DirFromAngle#1to\@DirA
\ScaleVect\@DirA by#2to\@DirA
\expandafter\SplitNod@@\expandafter(\@DirA)#3#4}
% \end{macrocoe}
+% colon; it has already been used with the definition of dashed and
+% dotted lines.
+%
% In order to accept polar coordinates with \put and \multiput
% we resort to using \GetCoord; therefore the redefinition of
% \put is very simple because it suffices to save the original
@@ 1803,30 +1982,33 @@
\def\put(#1){\bgroup\GetCoord(#1)\@tX\@tY
\edef\x{\noexpand\egroup\noexpand\originalput(\@tX,\@tY)}\x}
% \end{macrocode}
% For \multiput it is mor complicated, because the increments from one
+% For \multiput it is more complicated, because the increments from one
% position to the next cannot be done efficiently because the increments
% in the original definition are executed within boxes, therefore any
% macro instruction inside these boxes is lost. It is a good occasion to
% modify the \multiput definition by means of the advanced macro
+% modify the \multiput definition by means of the advanced macro
% definitions provided by package xparse; we can add also some error
% messages for avoiding doing anything when son mandatory parameters are
+% messages for avoiding doing anything when some mandatory parameters are
% missing ore are empty, or do not contain anything different from an
% ordered pair or a polar form. We ad also an optional argument to
+% ordered pair or a polar form. We add also an optional argument to
% handle the increments outside the boxes.
% The new macro has the following syntax:\\[2ex]
% \mbox{\cs{multiput}\texttt{(\meta{initial})}\texttt{(\meta{increment})}\marg{number}\marg{objext}\oarg{handler}}\\[2ex]
% where \meta{initial} contains the cartesian or polar coordinates
+% \mbox{\cs{multiput}\oarg{displacement}\parg{initial}\texttt{(\meta{increment})}\marg{number}\marg{object}\oarg{handler}}\\[2ex]
+% where the optional \meta{displacement} is used to displace to whole
+% set of \meta{object}s from their original position;
+% \meta{initial} contains the cartesian or polar coordinates
% of the initial point; \meta{increment} contains the cartesian or
% polar increment for the coordinates to be used from the second
% argument to the last; \meta{number} il the total number of points
% to be drawn; \meta{object} is the object to be put in position at
% each cycle repetition; the optional \meta{handler} may be used to
% control the current values of the horizontal and vertical increments.
+% position to the last; \meta{number} il the total number of
+% \meta{object}s to be drawn; \meta{object} is the object to be put in
+% position at each cycle repetition; the optional \meta{handler} may be
+% used to control the current values of the horizontal and vertical
+% increments.
% The new definition contains two \put commands where the second is
% nested within a while loop which in turn is within the argument of
+% nested within a whileloop which in turn is within the argument of
% the first \put command. Basically it is the same idea that the
% original macros, but now the increment are computed within the While
% loop, bit outside the argument of the inner \put command. If the
+% original macros, but now the increments are computed within the while
+% loop, but outside the argument of the inner \put command. If the
% optional \meta{handler} is specified the increments are computed
% from the macros specified by the user.
%
@@ 1833,56 +2015,99 @@
% The two increments components inside the optional argument may be set
% by means of mathematical expressions operated upon by the \fpeval
% function given by the \xfp package already loaded by curve2e. Of
% course it the user responsibility to pay attention to the scales of
+% course it is the user responsibility to pay attention to the scales of
% the two axes and to write meaningful expressions; the figure and code
% shown in the first part of this documentation show some examples:
% see page~\pageref{pag:multiput}.
+% see pages~\pageref{pag:multiput} and~\pageref{pag:orologio}.
% \begin{macrocode}
\RenewDocumentCommand{\multiput}{ d() d() m m o }{%
\IfNoValueTF{#1}{\PackageError{curve2e}{%
 \string\multiput\space initial point coordinates missing}%
 {Nothing done}}%
 {\IfNoValueTF{#2}{\PackageError{curve2e}{%
 \string\multiput\space Increment components missing}%
 {Nothing done}%
 }%
 {\GetCoord(#2)\dX\dY
 \put(#1){\def\X{0}\def\Y{0}\@multicnt=#3\relax
 \@whilenum \@multicnt > \z@\do{%
 \put(\X,\Y){#4}\IfValueTF{#5}{#5}{%
 \edef\X{\fpeval{\X+\dX}}\edef\Y{\fpeval{\Y+\dY}}}%
+\RenewDocumentCommand{\multiput}{O{0,0} d() d() m m o }{%
+ \IfNoValueTF{#2}{\PackageError{curve2e}%
+ {\string\multiput\space initial point coordinates missing}%
+ {Nothing done}
+ }%
+ {\IfNoValueTF{#3}{\PackageError{curve2e}
+ {\string\multiput\space Increment components missing}%
+ {Nothing done}
+ }
+ {\put(#1){\let\c at multicnt\@multicnt
+ \CopyVect #2 to \R
+ \CopyVect#3 to\D
+ \@multicnt=#4\relax
+ \@whilenum \@multicnt > \z@\do{%
+ \put(\R){#5}%
+ \IfValueTF{#6}{#6}{\AddVect#3 and\R to \R}%
\advance\@multicnt\m at ne
 }%
 }}
 }%
+ }
+ }
+ }
+ }\ignorespaces
}
% \end{macrocode}
+% And here it is the new \xmultiput command; remember: the internal
+% cycling \TeX\ counter \@multicn is now accessible as it was a
+% \LaTeX\ counter, in particular the user can access its contents
+% with a command such as \value{multicnt}. Such counter is stepped
+% up by one at each cycle, instead of being stepped down as in the
+% original \multiput command. The code is not so different from
+% the one used for the new version of \multiput, but it appears more
+% efficient and its code logically more readable.
+% \begin{macrocode}
+\NewDocumentCommand{\xmultiput}{O{0,0} d() d() m m o }{%
+\IfNoValueTF{#2}{\PackageError{curve2e}{%
+ \string\Xmultiput\space initial point coordinates missing}%
+ {Nothing done}}%
+ {\IfNoValueTF{#3}{\PackageError{curve2e}{%
+ \string\Xmultiput\space Increment components missing}%
+ {Nothing done}}%
+ {\put(#1)%
+ {\let\c at multicnt\@multicnt
+ \CopyVect #2 to \R
+ \CopyVect #3 to \D
+ \@multicnt=\@ne
+ \fpdowhile{\value{multicnt} < \inteval{#4+1}}% Test
+ {%
+ \put(\R){#5}
+ \IfValueTF{#6}{#6}{%
+ \AddVect#3 and\R to \R}
+ \advance\@multicnt\@ne
+ }
+ }
+ }}\ignorespaces
+}
+% \end{macrocode}
+% Notice that the internal macros \R and \D, (respectively the
+% current point coordinates, in form of a complex number, where to put
+% the\meta{object}, and the current displacement to find the next point)
+% are accessible to the user both in the \meta{object} argument field and
+% the \meta{handler} argument field. The code used in
+% page~\pageref{pag:orologio} shows how to create the hour marks of a
+% clock together with the rotated hour roman numerals.
%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{Vectors}
%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The redefinitions and the new definitions for vectors are a little more
% complicated than with segments, because each vector is drawn as a filled
% contour; the original \texttt{pict2e} 2004 macro checks if the slopes
% are corresponding to the limitations specified by Lamport (integer three
% digit signed numbers) and sets up a transformation in order to make it
% possible to draw each vector as an horizontal lefttoright arrow and
% then to rotate it by its angle about its tail point; with pict2e 2009,
% possibly this redefinition of \vector is not necessary, but we do it
% as well and for the same reasons we had for redefining \line; actually
% there are two macros for tracing the contours that are eventually filled
% by the principal macro; each contour macro draws the vector with a
% \LaTeX\ or a PostScript styled arrow tip whose parameters are specified
% by default or may be taken from the parameters taken from thePSTricks
% package if this one is loaded before pict2e; in any case we did not
% change the contour drawing macros because if they are modified the same
% modification is passed on to the arrows drawn with the curve2e package
% redefinitions.
+% complicated than with segments, because each vector is drawn as a
+% filled contour; the original \texttt{pict2e} 2004 macro checks if the
+% slopes are corresponding to the limitations specified by Lamport
+% (integer three digit signed numbers) and sets up a transformation in
+% order to make it possible to draw each vector as an horizontal
+% lefttoright arrow and then to rotate it by its angle about its tail
+% point; with pict2e 2009, possibly this redefinition of \vector is
+% not necessary, but we do it as well and for the same reasons we had for
+% redefining \line; actually there are two macros for tracing the
+% contours that are eventually filled by the principal macro; each
+% contour macro draws the vector with a \LaTeX\ or a PostScript styled
+% arrow tip whose parameters are specified by default or may be taken
+% from the parameters taken from thePSTricks package if this one is
+% loaded before pict2e; in any case we did not change the contour
+% drawing macros because if they are modified the same modification is
+% passed on to the arrows drawn with the curve2e package redefinitions.
%
% Because of these features the redefinitions and the new macros are
% different from those used for straight lines.
+% Because of these features the new macros are different from those used
+% for straight lines.
%
% We start with the redefinition of \vector and we use the machinery for
% vectors (as complex numbers) we used for \line.
+% We start with the redefinition of \vector and we use the machinery
+% for vectors (as complex numbers) we used for \line.
% \begin{macrocode}
\def\vector(#1)#2{%
\begingroup
@@ 1901,10 +2126,10 @@
% \begin{macrocode}
\ifdim\@linelen<\z@ \@linelen=\@linelen\fi
% \end{macrocode}
% We now make a vector with the slope coefficients even if one or the
% other is zero and we determine its direction; the real and imaginary
% parts of the direction vector are also the values we need for the
% subsequent rotation.
+% We now make a vector with the given slope coefficients even if one or
+% the other is zero and we determine its direction; the real and
+% imaginary parts of the direction vector are also the values we need for
+% the subsequent rotation.
% \begin{macrocode}
\MakeVectorFrom\d at mX\d at mY to\@Vect
\DirOfVect\@Vect to\Dir at Vect
@@ 1911,17 +2136,19 @@
% \end{macrocode}
% In order to be compatible with the original \texttt{pict2e} we need to
% transform the components of the vector direction in lengths with the
% specific names \@xdim and \@ydim^^A! Necessario?
+% specific names \@xdim and \@ydim^^A! Really necessary?
% \begin{macrocode}
\YpartOfVect\Dir at Vect to\@ynum \@ydim=\@ynum\p@
\XpartOfVect\Dir at Vect to\@xnum \@xdim=\@xnum\p@
% \end{macrocode}
% If the vector is really sloping we need to scale the $l_x$ component in
% order to get the vector total length; we have to divide by the cosine of
% the vector inclination which is the real part of the vector direction.
% We use the floating point division function; since it yields a ``factor''
% We directly use it to scale the length of the vector. I finally memorise
% the true vector length in the internal dimension @tdB
+% order to get the vector total length; we have to divide by the cosine
+% of the vector inclination which is the real part of the vector
+% direction.
+% We use the floating point division function; since it yields a
+% ``factor''
+% We directly use it to scale the length of the vector. We finally
+% memorise the true vector length in the internal dimension @tdB
% \begin{macrocode}
\ifdim\d at mX\p@=\z@
\else\ifdim\d at mY\p@=\z@
@@ 1932,12 +2159,13 @@
\fi
\@tdB=\@linelen
% \end{macrocode}
% The remaining code is definitely similar to that of \texttt{pict2e}; the
% real difference consists in the fact that the arrow is designed by itself
% without the stem; but it is placed at the vector end; therefore the first
% statement is just the transformation matrix used by the output driver to
% rotate the arrow tip and to displace it the right amount. But in order
% to draw only the arrow tip I have to set the \@linelen length to zero.
+% The remaining code is definitely similar to that of \texttt{pict2e};
+% the real difference consists in the fact that the arrow is designed by
+% itself without the stem; but it is placed at the vector end; therefore
+% the first statement is just the transformation matrix used by the
+% output driver to rotate the arrow tip and to displace it the right
+% amount. But in order to draw only the arrow tip we have to set the
+% \@linelen length to zero.
% \begin{macrocode}
\pIIe at concat\@xdim\@ydim{\@ydim}\@xdim{\@xnum\@linelen}{\@ynum\@linelen}%
\@linelen\z@
@@ 1945,12 +2173,13 @@
\fillpath
% \end{macrocode}
% Now we can restore the stem length that must be shortened by the
% dimension of the arrow; by examining the documentation of \texttt{pict2e}
% we discover that we have to shorten it by an approximate amount of $AL$
% (with the notations of \texttt{pict2e}, figs~10 and~11); the arrow tip
% parameters are stored in certain variables with which we can determine
% the amount of the stem shortening; if the stem was too short and the new
% length is negative, we avoid designing such a stem.
+% dimension of the arrow; by examining the documentation of
+% \texttt{pict2e} we discover that we have to shorten it by an
+% approximate amount of $AL$ (with the notations of \texttt{pict2e},
+% figs~10 and~11); the arrow tip parameters are stored in certain
+% variables with which we can determine the amount of the stem
+% shortening; if the stem was too short and the new length is negative,
+% we avoid designing such a stem.
% \begin{macrocode}
\@linelen=\@tdB
\@tdA=\pIIe at FAW\@wholewidth
@@ 1967,10 +2196,10 @@
% length or the $l_x$ length component; the way the new \vector macro
% works does not actually require this specification, because \TeX\ can
% compute the vector length, provided the two direction components are
% exactly the horizontal and vertical vector components. If the horizontal
% component is zero, the actual length must be specified as the vertical
% component. The object defined with \Vector, as well as \vector,
% must be put in place by means of a \put command.
+% exactly the horizontal and vertical vector components. If the
+% horizontal component is zero, the actual length must be specified as
+% the vertical component. The object defined with \Vector, as well as
+% \vector, must be put in place by means of a \put command.
% \begin{macrocode}
\def\Vector(#1){{%
\GetCoord(#1)\@tX\@tY
@@ 1983,7 +2212,7 @@
%
% On the opposite the next macro specifies a vector by means of the
% coordinates of its end points; the first point is where the vector
% starts, and the second point is the arrow tip side. We need the
+% starts, and the second point is the arrow tip side. We need the
% difference of these two coordinates, because it represents the actual
% vector.
% \begin{macrocode}
@@ 2002,10 +2231,10 @@
\VECTOR(\@tempb)(#2)\VECTOR(\@tempb)(#1)\ignorespaces}}
% \end{macrocode}
%
% The \texttt{pict2e} documentation says that if the vector length is zero
% the macro draws only the arrow tip; this may work with macro \vector,
% certainly not with \Vector and \VECTOR. This might be useful for
% adding an arrow tip to a circular arc. See examples in
+% The \texttt{pict2e} documentation says that if the vector length is
+% zero the macro draws only the arrow tip; this may work with macro
+% \vector, certainly not with \Vector and \VECTOR. This might be
+% useful for adding an arrow tip to a circular arc. See examples in
% figure~\ref{fig:vectors} on page~\pageref{fig:vectors}.
%
%
@@ 2014,31 +2243,33 @@
%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% We now define the polygonal line macro; its syntax is very simple:
% \begin{flushleft}
% \cs{polygonal}\oarg{join}\texttt{(}$P_0$\texttt{)(}$P_1$\texttt{)(}$P_2$)%
% \texttt{\dots(}$P_n$\texttt{)}
+% \cs{polygonal}\oarg{join}\parg{$P_0$}\parg{$P_1$}\parg{$P_2$}%
+% \texttt{\dots}\parg{$P_n$}
% \end{flushleft}
% Remember: \polyline has been incorporated into pict2e 2009, but we
% redefine it so as to allow an optional argument to specify the line join
% type.
+% redefine it so as to allow an optional argument to specify the line
+% join type.
%
% In order to write a recursive macro we need aliases for the parentheses;
% actually we need only the left parenthesis, but some editors complain
% about unmatched delimiters, so we define an alias also for the right parenthesis.
+% In order to write a recursive macro we need aliases for the
+% parentheses; actually we need only the left parenthesis, but some
+% editors complain about unmatched delimiters, so we define an alias also
+% for the right parenthesis.
% \begin{macrocode}
\let\lp at r( \let\rp at r)
% \end{macrocode}
% The first call to \polyline, besides setting the line joints, examines
% the first point coordinates and moves the drawing position to this point;
% afterwards it looks for the second point coordinates; they start with a
% left parenthesis; if this is found the coordinates should be there, but
% if the left parenthesis is missing (possibly preceded by spaces that are
% ignored by the \@ifnextchar macro) then a warning message is output
% together with the line number where the missing parenthesis causes the
% warning: beware, this line number might point to several lines further on
% along the source file! In any case it's necessary to insert a
%\@killgluecommand, because \polyline refers to absolute coordinates,
% and not necessarily is put in position through a \put command that
% provides to eliminate any spurious spaces preceding this command.
+% The first call to \polyline, besides setting the line joints,
+% examines the first point coordinates and moves the drawing position to
+% this point; afterwards it looks for the second point coordinates; they
+% start with a left parenthesis; if this is found the coordinates should
+% be there, but if the left parenthesis is missing (possibly preceded by
+% spaces that are ignored by the \@ifnextchar macro) then a warning
+% message is output together with the line number where the missing
+% parenthesis causes the warning: beware, this line number might point to
+% several lines further on along the source file!
+% In any case it's necessary to insert a \@killgluecommand, because
+% \polyline refers to absolute coordinates, and not necessarily is put
+% in position through a \put command that provides to eliminate any
+% spurious spaces preceding this command.
%
% \begin{figure}[!hb]
% \begin{minipage}{0.55\textwidth}
@@ 2060,9 +2291,9 @@
% polar coordinates}\label{fig:filledpolygon}
% \end{figure}
%
% In order to allow a specification for the joints of the various segments
% of a polyline it is necessary to allow for an optional parameter;
% the default is the bevel join.
+% In order to allow a specification for the joints of the various
+% segments of a polyline it is necessary to allow for an optional
+% parameter; the default is the bevel join.
% \begin{macrocode}
\renewcommand*\polyline[1][\beveljoin]{\p at lylin@[#1]}
@@ 2075,10 +2306,10 @@
\ignorespaces}}
% \end{macrocode}
% But if there is a second or further point coordinate, the recursive macro
% \p at lyline is called; it works on the next point and checks for a
% further point; if such a point exists it calls itself, otherwise it
% terminates the polygonal line by stroking it.
+% But if there is a second or further point coordinate, the recursive
+% macro \p at lyline is called; it works on the next point and checks for
+% a further point; if such a point exists the macro calls itself,
+% otherwise it terminates the polygonal line by stroking it.
% \begin{macrocode}
\def\p at lyline(#1){\GetCoord(#1)\d at mX\d at mY
\pIIe at lineto{\d at mX\unitlength}{\d at mY\unitlength}%
@@ 2090,8 +2321,8 @@
% asterisk; as it is usual with picture convex lines, the command with
% asterisk does not trace the contour, but fills the contour with the
% current color.The asterisk is tested at the beginning and, depending on
% its presence, a temporary switch is set to \texttt{true}; this being the
% case the contour is filled, otherwise it is simply stroked.
+% its presence, a temporary switch is set to \texttt{true}; this being
+% the case the contour is filled, otherwise it is simply stroked.
% \begin{macrocode}
\providecommand\polygon{}
\RenewDocumentCommand\polygon{s O{\beveljoin} }{\@killglue\begingroup
@@ 2118,7 +2349,7 @@
% page~\pageref{fig:filledpolygon}.
%
% Remember; the polygon polar coordinates are relative to the origin of
% the local axes; therefore in order to position a polygon in a different
+% the local axes; therefore in order to put a polygon in a different
% position, it is necessary to do it through a \put command.
%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ 2126,12 +2357,12 @@
%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The next command is very useful for debugging while editing one's
% drawing; it draws a red grid with square meshes that are ten drawing
% units apart; there is no graduation along the grid, since it is supposed
% to be a debugging aid and the user should know what he/she is doing;
% nevertheless it is advisable to displace the grid by means of a \put
% command so that its grid lines coincide with the graph coordinates that
% are multiples of 10. Missing to do so the readings become cumbersome.
% The \RoundUp macro provides to increase the
+% units apart; there is no graduation along the grid, since it is
+% supposed to be a debugging aid and the user should know what he/she is
+% doing; nevertheless it is advisable to displace the grid by means of a
+% \put command so that its grid lines coincide with graph
+% coordinates that are multiples of 10. Missing to do so the readings
+% become cumbersome. The \RoundUp macro provides to increase the
% grid dimensions to integer multiples of ten.
% \begin{macrocode}
\def\GraphGrid(#1,#2){\bgroup\textcolor{red}{\linethickness{.1\p@}%
@@ 2158,9 +2389,9 @@
% point as an argument delimiter. If one has the doubt that the number
% being passed to \Integer might be an integer, he/she should call the
% macro with a further point; if the argument is truly integer this point
% works as the delimiter of the integer part; if the argument being passed
% is fractional this extra point gets discarded as well as the fractional
% part of the number.
+% works as the delimiter of the integer part; if the argument being
+% passed is fractional this extra point gets discarded as well as the
+% fractional part of the number.
% \begin{macrocode}
\def\Integer#1.#2??{#1}%
% \end{macrocode}
@@ 2168,44 +2399,61 @@
%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \section{Math operations on fractional operands}
%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This is not the place to complain about the fact that all programs of the
% \TeX\ system use only integer arithmetics; luckily enough, in 218 the
% package xfp was released: that package resorts in the background
% language \LaTeX\,3; this language now can compute fractional number
% operations coded in decimal digits and accepts also numbers written in
% the usual way in computer science, that is as a fractional, possibly
% signed, number followed by an expression that contains the exponent to
% 10 necessary to (ideally) move the fractional separator in one or the
% other direction according to the sign of the exponent of 10; in other
% words the L3 library for floating point calculations accepts such
% expressions as \texttt{123.456}, \texttt{0.12345e3}, and
+% This is not the place to complain about the fact that all programs of
+% the \TeX\ system used only integer arithmetics; now, with the 2018
+% distribution of the modern \TeX\ system, package xfp is available:
+% this package resorts in the background to language \LaTeX\,3; this language now can compute fractional number
+% operations coded in decimal, not in binary, and accepts also numbers
+% written in the usual way in computer science, that is as a fractional,
+% possibly signed, number followed by an expression that contains the
+% exponent to 10 necessary to (ideally) move the fractional separator
+% in one or the other direction according to the sign of the exponent of
+% 10; in other words the L3 library for floating point calculations
+% accepts such expressions as \texttt{123.456}, \texttt{0.12345e3}, and
% \texttt{12345e3}, and any other equivalent expression. If the first
% number is integer, it assumes that the decimal separator is to the
% right of the rightmost digits of the digit string.
+% right of the rightmost digit of the digit string.
%
% Floating pint calculations may be done through the \fpeval L3
+% Floating point calculations may be done through the \fpeval L3
% function with a very simple syntax:
% \begin{flushleft}
% \cs{fpeval}\marg{mathematical expression}
% \end{flushleft}
% where \meta{mathematica exression} can contain the usual algebraic
+% where \meta{mathematical exression} can contain the usual algebraic
% operation sings, =  * / ** ^ and the function names of the most
% common algebraic, trigonometric, and transcendental functions; for direct
% and inverse trigonometric functions it accepts arguments in radians and
% in sexagesimal degrees; it accepts the group of rounding/truncating
% operators; it can perform several kinds of comparisons; as to this date
% the todo list includes the direct and inverse hyperbolic functions. The
% mantissa length of the floating point operands amounts to 16 decimal
% digits. Further details may be read in the documentations of the xfp
% and interface3 documents, just by typing into a command line window
% the command \texttt{texdoc \meta{document}}, where \meta{document} is
% just the name of the above named files without extension.
+% common algebraic, trigonometric, and transcendental functions; for
+% direct and inverse trigonometric functions it accepts arguments in
+% radians and in sexagesimal degrees; it accepts the group of
+% rounding/truncating operators; it can perform several kinds of
+% comparisons; as to now (Nov. 2019) the todo list includes the direct
+% and inverse hyperbolic functions. The mantissa length of the floating
+% point operands amounts to 16 decimal digits. Further details may be
+% read in the documentations of the xfp and interface3 packages, just
+% by typing into a command line window the command \texttt{texdoc
+% \meta{document}}, where \meta{document} is just the name of the above
+% named files without extension.
%
+% Furthermore we added a couple of more interface macros with the
+% internal L3 floating point functions; \fptest and \fpdowhile.
+% They have the following syntax:
+%\begin{flushleft}\ttfamily\obeylines
+% \string\fptest\marg{logical expression}\marg{true code}\marg{false code}
+% \string\fpdowhile\marg{logical expression}\marg{code}
+%\end{flushleft}
+% The \meta{logical expression} compares the values of any kind by means
+% of the usual \texttt{>}, \texttt{=}, and \texttt{<} operators that may
+% be negated with the “not’ operator \texttt{!}; furthermore the logical
+% results of these comparisons may be acted upon with the “and” operator
+% \texttt{\&\&} and the “or” operator \texttt{}. The \meta{true
+% code}, and \meta{code} are executed if or while the \meta{logical
+% expression} is true, while the \meta{false code} is executed if the
+% \meta{logical expression} is false
+%
% Before the availability of the xfp package, it was necessary to fake
% fractional number computations by means of the native e\TeX\ commands
% \dimexpr, i.e. to multiply each fractional number by the unit \p@
% (1\,pt) so as to get a length; operate un such lengths, and then
% stripping of the `pt' component from the result; very error prone and
+% stripping off the `pt' component from the result; very error prone and
% with less precision as the one that the modern decimal floating point
% calculations can do. Of course it is not so important to use fractional
% numbers with more that 5 or 6 fractional digits, because the other
@@ 2214,7 +2462,10 @@
% new floating point functionality, even if this maintains the curve2e
% functionality, but renders this package unusable with older \LaTeX\
% kernel installations. It has already been explained that the input of
% curve2e gets aborted if the xfp package is not available.
+% this up to date version of curve2e is aborted if the xfp package is
+% not available, but the previous version 1.61 version is loaded; very
+% little functionality is lost, but, evidently, this new version performs
+% in a better way.
%
%
%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ 2226,9 +2477,7 @@
% saves their ratio in a macro; this is done in a simple way with the
% following code.
% \begin{macrocode}
\def\DividE#1by#2to#3{%
 \edef#3{\fpeval{#1 / #2}}\relax
}
+\def\DividE#1by#2to#3{\edef#3{\fpeval{#1 / #2}}}
% \end{macrocode}
% In order to avoid problems with divisions by zero, or with numbers that
% yield results to large to be used as multipliers of lengths, it would
@@ 2235,8 +2484,8 @@
% be preferable that the above code be preceded or followed by some tests
% and possible messages. Actually we decided to avoid such tests and
% messages, because the internal L3 functions already provide some. This
% is what it was done in the previous versions of this package, when the
% \fpeval L3 function was not available.
+% was done in the previous versions of this package, when the \fpeval
+% L3 function was not available.
%
% Notice that operands #1 and #2 may be integer numbers or
% fractional, or mixed numbers. They may be also dimensions, but while
@@ 2248,7 +2497,7 @@
% yields correctly \result=0.33333333. Without parentheses the result
% is unpredictable.
%
% For backward compatibility we need an alias.
+% For backwards compatibility we need an alias.
% \begin{macrocode}
\let\DivideFN\DividE
% \end{macrocode}
@@ 2265,21 +2514,22 @@
% but with multiplication it is better to avoid computations with
% lengths.
%
% The next macro uses the \verb\strip at pt \LaTeX\ kernel macro to get
+% The next macro uses the \fpeval macro to get
% the numerical value of a measure in points. One has to call \Numero
% with a control sequence and a dimension; the dimension value in points
% is assigned to the control sequence.
% \begin{macrocode}
\unless\ifdefined\Numero
 \def\Numero#1#2{\bgroup\dimen3254=#2\relax
 \edef\x{\noexpand\egroup\noexpand\edef\noexpand#1{%
 \strip at pt\dimen3254}}\x\ignorespaces}%
+ \def\Numero#1#2{\edef#1{\fpeval{round(#2,6)}}\ignorespaces}%
\fi
% \end{macrocode}
% The \verb\ifdefined primitive command is provided by the e\TeX\
+% The numerical value is rounded to 6 fractional digits that are more
+% than sufficient for the graphical actions performed by curve2e.
+%
+% The \ifdefined primitive command is provided by the e\TeX\
% extension of the typesetting engine; the test does not create any hash
% table entry; it is a different way than the
% \verb\ifx\csname ...\endcsname test,
+% \verb\ifx\csname...\endcsname test,
% because the latter first possibly creates a macro meaning \verb\relax
% then executes the test; therefore an undefined macro name is always
% defined to mean \relax.
@@ 2287,13 +2537,13 @@
%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{Trigonometric functions}
%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% We now start with trigonometric functions. In previous versions of this
% package we defined the macros \SinOf, \CosOf and \TanOf (\CotOf
% does not appear so essential) by means of the parametric
+% We now start with trigonometric functions. In previous versions of
+% this package we defined the macros \SinOf, \CosOf and \TanOf
+% (\CotOf does not appear so essential) by means of the parametric
% formulas that require the knowledge of the tangent of the half angle.
% We wanted, and still want, to specify the angles in sexagesimal degrees,
% not in radians, so that accurate reductions to the main quadrants are
% possible. The formulas are
+% We wanted, and still want, to specify the angles in sexagesimal
+% degrees, not in radians, so that accurate reductions to the main
+% quadrants are possible. The formulas are
% \begin{eqnarray*}
% \sin\theta &=& \frac{2}{\cot x + \tan x}\\
% \cos\theta &=& \frac{\cot x  \tan x}{\cot x + \tan x}\\
@@ 2304,17 +2554,20 @@
% is the half angle in degrees converted to radians.
%
% But now, in this new version, the availability of the floating point
% computations with the specific L3 library makes al the above superfluous;
% actually the above approach gave good results but it was cumbersome and
% limited by the fixed radix computations of the \TeX\ system programs.
+% computations with the specific L3 library makes all the above
+% superfluous; actually the above approach gave good results but it was
+% cumbersome and limited by the fixed radix computations of the \TeX\
+% system programs.
+%
% Matter of facts, we compared the results (with 6 fractional digits) the
% computations executed with the \texttt{sind} function name, in order to
% use the angles in degrees, and a table of trigonometric functions with
% the same number of fractional digits, and we di not find and difference,
% not even one unit on the sixth decimal digit. Probably the \fpeval
% computations, without rounding before the sixteenth significant digit,
% are much more accurate, but it is useless to have a better accuracy when
% the other \TeX\ and \LaTeX\ macros would not be able to exploit them.
+% the same number of fractional digits, and we di not find any
+% difference, not even one unit on the sixth decimal digit. Probably the
+% \fpeval computations, without rounding before the sixteenth
+% significant digit, are much more accurate, but it is useless to have a
+% better accuracy when the other \TeX\ and \LaTeX\ macros would not be
+% able to exploit them.
%
% Having available such powerful instrument, even the tangent appears to
% be of little use for the kind of computations that are supposed to be
@@ 2321,7 +2574,7 @@
% required in this package.
%
% The codes for the computation of \SinOf and \CosOf of the angle in
% degrees is therefore the following
+% degrees is now therefore the following
% \begin{macrocode}
\def\SinOf#1to#2{\edef#2{\fpeval{round(sind#1,6)}}}\relax
\def\CosOf#1to#2{\edef#2{\fpeval{round(cosd#1,6)}}}\relax
@@ 2328,11 +2581,19 @@
% \end{macrocode}
%
%
% As of today the anomaly (angle) of a complex number may not be necessary,
% but it might become useful in the future; therefore with macro
% \verb\ArgOfVect we calculate the four quadrant arctangent (in degrees)
% of the given vector taking into account the sings of the vector
% components. The \ArgOfVect macro receives on input a vector;
+% As of today the anomaly (angle) of a complex number may not be
+% necessary, but it might become useful in the future; therefore with
+% macro \verb\ArgOfVect we calculate the four quadrant arctangent (in
+% degrees) of the given vector taking into account the sings of the
+% vector components. We use the xfp atand with two arguments, so
+% that it automatically takes into account all the signs for determining
+% the argument of vector $x,y$ by giving the values $x$ and $y$ in the
+% proper order to the function atan:
+%\[
+%\mbox{if\quad } x + \mathrm{i}y = M\mathrm{e}^{\mathrm{i}\varphi}\mbox{\quad then\quad }
+%\varphi = \mathtt{\string\fpeval\{atand(\mbox{$y$},\mbox{$x$})\}}
+%\]
+% The \ArgOfVect macro receives on input a vector;
% from the signs of the horizontal and vertical components it determines
% the ratio and from this ratio the arctangent; but before doing this it
% tests the components in order to determine the quadrant of the vector
@@ 2341,36 +2602,14 @@
% components are zero, the angle is undefined, but for what concerns
% curve2e it is assigned the angle $0^circ$.
% \begin{macrocode}
\def\ArgOfVect#1to#2{\bgroup\GetCoord(#1){\t at X}{\t at Y}%
\def\s at gno{}%
\ifdim\t at X\p@=\z@
 \ifdim\t at Y\p@=\z@
 \def\ArcTan{0}% vettore nullo
 \else
 \def\ArcTan{90}% vettore verticale
 \ifdim\t at Y\p@<\z@\def\ArcTan{90}\fi
 \fi
\else
 \ifdim\t at Y\p@=\z@% vettore orizzontale
 \ifdim\t at X\p@<\z@
 \def\ArcTan{180}%
 \else
 \def\ArcTan{0}%
 \fi
 \else % vettore qualsiasi
 \edef\ArcTan{\fpeval{atand(\t at Y / \t at X)}}\relax
 \ifdim\t at X\p@<\z@% vettore nei quadranti di sinistra
 \ifdim\t at Y\p@<\z@
 \edef\ArcTan{\fpeval{\ArcTan  180}}\relax
 \else
 \edef\ArcTan{\fpeval{\ArcTan + 180}}\relax
 \fi
 \fi
 \fi
\fi
\edef\x{\noexpand\egroup\noexpand\edef\noexpand#2{\ArcTan}}%
\x\ignorespaces}
+\def\ArgOfVect#1to#2{\GetCoord(#1){\t at X}{\t at Y}%
+\fptest{\t at X=\z@ && \t at Y=\z@}{\edef#2{0}}{%
+\edef#2{\fpeval{round(atand(\t at Y,\t at X),6)}}}\ignorespaces}
% \end{macrocode}
+% The anomaly of a null vector is meaningless, but we set it to zero in
+% case that input data are wrong. Computations go on anyway, but the
+% results my be worthless; such strange results are an indications that
+% some controls on the code should be done.
%
% It is worth examining the following table, where the angles of nine
% vectors $45^\circ$ degrees apart from one another are computed from
@@ 2378,12 +2617,12 @@
% \begin{center}
% \begin{tabular}{l*9r}
% Vector &0,0 &1,0 &1,1 & 0,1 & 1,1& 1,0&1,1&0,1&1,1\\
% Angle & 0 & 0 & 45 & 90 & 135 & 180 &135 & 90& 45
+% Angle & 0 & 0 & 45 & 90 & 135 & 180 &135 & 90& 45
% \end{tabular}
% \end{center}
% Real computations with the \ArgOfVect macro produce those very numbers
% without the need of rounding; \fpeval produces all trimming of lagging
% zeros and rounding by itself.
+% Real computations with the \ArgOfVect macro produce those very
+% numbers without the need of rounding; \fpeval produces all trimming
+% of lagging zeros and rounding by itself.
%
%
%
@@ 2391,10 +2630,10 @@
% \subsection{Arcs and curves preliminary information}
%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% We would like to define now a macro for drawing circular arcs of any
% radius and any angular aperture; the macro should require the arc center,
% the arc starting point and the angular aperture. The arc has its
% reference point in its center, therefore it does not need to be put in
% place by the command \put; nevertheless if \put is used, it may
+% radius and any angular aperture; the macro should require the arc
+% center, the arc starting point and the angular aperture. The arc has
+% its reference point in its center, therefore it does not need to be put
+% in place by the command \put; nevertheless if \put is used, it may
% displace the arc into another position.
%
% The command should have the following syntax:
@@ 2403,22 +2642,23 @@
% \end{flushleft}
% which is totally equivalent to:
% \begin{flushleft}\ttfamily
% \cs{put}(\meta{center})\marg{\upshape\cs{Arc}(0,0)(\meta{starting point})\marg{angle}}
+% \cs{put}(\meta{center})\marg{\upshape\cs{Arc}(0,0)(\meta{starting
+% point})\marg{angle}}
% \end{flushleft}
% If the \meta{angle}, i.e. the arc angular aperture, is positive the arc
% runs counterclockwise from the starting point; clockwise if it's
+% runs counterclockwise from the starting point; clockwise if it is
% negative.
% Notice that since the \meta{starting point} is relative to the
% \meta{center} point, its polar coordinates are very convenient, since
% they become \parg{\meta{start angle}:\meta{radius}}, where the
% \meta{start angle} is relative to the arc center. Therefore you can think
% about a syntax such as this one:
+% \meta{start angle} is relative to the arc center. Therefore you can
+% think about a syntax such as this one:
%\begin{flushleft}
%\cs{Arc}\parg{\meta{center}}\parg{\normalfont{\itshape start angle}\texttt{:}{\itshape radius}}\marg{angle}
%\end{flushleft}
%
% The difference between the pict2e \arc definition consists in a very
% different syntax:
+% The difference between the pict2e \arc definition consists in a
+% very different syntax:
%\begin{flushleft}
%\cs{arc}\texttt{[}\meta{start angle}\texttt{,}\meta{end angle}\texttt{]}\marg{radius}
%\end{flushleft}
@@ 2434,9 +2674,9 @@
% It's necessary to determine the end point and the control points of the
% Bézier spline(s) that make up the circular arc.
%
% The end point is obtained from the rotation of the starting point around
% the center; but the \texttt{pict2e} command \pIIe at rotate is such that
% the pivoting point appears to be non relocatable.
+% The end point is obtained from the rotation of the starting point
+% around the center; but the \texttt{pict2e} command \pIIe at rotate is
+% such that the pivoting point appears to be non relocatable.
% It is therefore necessary to resort to low level \TeX\ commands and the
% defined trigonometric functions and a set of macros that operate on
% complex numbers used as vector rotoamplification operators.
@@ 2471,15 +2711,16 @@
% doing some of these operations.
%
% In facts we need macros for summing, subtracting, multiplying, dividing
% complex numbers, for determining their directions (unit vectors); a
% unit vector is the complex number divided by its magnitude so that the
% result is the cartesian or polar form of the Euler's formula
+% complex numbers, for determining their directions (unit vectors or
+% versors); a unit vector is the complex number divided by its magnitude
+% so that the result is the cartesian or polar form of the Euler's
+% formula
% \[
% \mathrm{e}^{\mathrm{j}\phi} = \cos\phi+\mathrm{j}\sin\phi
% \]
%
% The magnitude of a vector is determined by taking a ‘clever’ square
% root of a function of the real and the imaginary parts; see further on.
+% The magnitude of a vector is determined by taking the square root of
+% a function of the real and the imaginary parts; see further on.
%
% It's better to represent each complex number with one control sequence;
% this implies frequent assembling and disassembling the pair of real
@@ 2504,8 +2745,8 @@
% In the preceding version of package curve2e the magnitude $M$ was
% determined by taking the moduli of the real and imaginary parts, by
% changing their signs if necessary; the larger component was
% then taken as the reference one so that, if $a$ is larger than $b$, the
% square root of the sum of their squares is computed as such:
+% then taken as the reference one, so that, if $a$ is larger than $b$,
+% the square root of the sum of their squares is computed as such:
% \[
% M = \sqrt{a^2+b^2} = \vert a\vert\sqrt{1+(b/a)^2}
% \]
@@ 2523,7 +2764,7 @@
% package.
% \begin{macrocode}
\def\ModOfVect#1to#2{\GetCoord(#1)\t at X\t at Y
\edef#2{\fpeval{sqrt(\t at X*\t at X + \t at Y*\t at Y)}}\relax
+\edef#2{\fpeval{round(sqrt(\t at X*\t at X + \t at Y*\t at Y),6)}}%
\ignorespaces}%
% \end{macrocode}
%
@@ 2535,11 +2776,10 @@
% \begin{macrocode}
\def\DirOfVect#1to#2{\GetCoord(#1)\t at X\t at Y
\ModOfVect#1to\@tempa
\unless\ifdim\@tempa\p@=\z@
 \DividE\t at X by\@tempa to\t at X
 \DividE\t at Y by\@tempa to\t at Y
\fi
\MakeVectorFrom\t at X\t at Y to#2\ignorespaces}%
+\fptest{\@tempa=\z@}{}{%
+ \edef\t at X{\fpeval{round(\t at X/\@tempa,6)}}%
+ \edef\t at Y{\fpeval{round(\t at Y/\@tempa,6)}}%
+}\MakeVectorFrom\t at X\t at Y to#2\ignorespaces}%
% \end{macrocode}
%
% A cumulative macro uses the above ones to determine with one call both
@@ 2550,7 +2790,6 @@
% must be specified with control sequences to be used at a later time.
% \begin{macrocode}
\def\ModAndDirOfVect#1to#2and#3{%
\GetCoord(#1)\t at X\t at Y
\ModOfVect#1to#2%
\DirOfVect#1to#3\ignorespaces}%
% \end{macrocode}
@@ 2579,8 +2818,8 @@
% a given angle (first argument, in degrees).
% \begin{macrocode}
\def\DirFromAngle#1to#2{%
\CosOf#1to\t at X
\SinOf#1to\t at Y
+\edef\t at X{\fpeval{round(cosd#1,6)}}%
+\edef\t at Y{\fpeval{round(sind#1,6)}}%
\MakeVectorFrom\t at X\t at Y to#2\ignorespaces}%
% \end{macrocode}
%
@@ 2589,8 +2828,8 @@
% input given vector.
% \begin{macrocode}
\def\ScaleVect#1by#2to#3{\GetCoord(#1)\t at X\t at Y
\edef\t at X{\fpeval{#2 * \t at X}}\relax
\edef\t at Y{\fpeval{#2 * \t at Y}}\relax
+\edef\t at X{\fpeval{#2 * \t at X}}%
+\edef\t at Y{\fpeval{#2 * \t at Y}}%
\MakeVectorFrom\t at X\t at Y to#3\ignorespaces}%
% \end{macrocode}
% Again, sometimes it is necessary to reverse the direction of rotation;
@@ 2609,8 +2848,8 @@
% \begin{macrocode}
\def\AddVect#1and#2to#3{\GetCoord(#1)\tu at X\tu at Y
\GetCoord(#2)\td at X\td at Y
\edef\t at X{\fpeval{\tu at X + \td at X}}\relax
\edef\t at Y{\fpeval{\tu at Y + \td at Y}}\relax
+\edef\t at X{\fpeval{\tu at X + \td at X}}%
+\edef\t at Y{\fpeval{\tu at Y + \td at Y}}%
\MakeVectorFrom\t at X\t at Y to#3\ignorespaces}%
% \end{macrocode}
% Then the subtraction:
@@ 2617,8 +2856,8 @@
% \begin{macrocode}
\def\SubVect#1from#2to#3{\GetCoord(#1)\tu at X\tu at Y
\GetCoord(#2)\td at X\td at Y
\edef\t at X{\fpeval{\td at X  \tu at X}}\relax
\edef\t at Y{\fpeval{\td at Y  \tu at Y}}\relax
+\edef\t at X{\fpeval{\td at X  \tu at X}}%
+\edef\t at Y{\fpeval{\td at Y  \tu at Y}}%
\MakeVectorFrom\t at X\t at Y to#3\ignorespaces}%
% \end{macrocode}
%
@@ 2625,39 +2864,110 @@
% For the multiplication we need to split the operation according to the
% fact that we want to multiply by the second operand or by the complex
% conjugate of the second operand; it would be nice if we could use the
% usual postfixed asterisk notation for the complex conjugate, but we
% could not find a simple means for doing so\footnote{Actually the simple
% means do exist now through the use of the \texttt{xparse} package, but
% they became available only when the syntax of this
% \texttt{\string\MultVect} macro had been already in use for a long
% time; changing the position of the asterisk at this moment, would mean
% to render the new definition incompatible with the existing source
% document files.}; therefore we use the prefixed notation, that is we
% put the asterisk \emph{before} the second operand. The first part of
% the multiplication macro just takes care of the multiplicand and then
% checks for the asterisk; if there is no asterisk it calls a second
% (service) macro that performs a regular complex multiplication,
% otherwise it calls a third service macro that executes the conjugate
% multiplication.
+% usual postfixed asterisk notation for the complex conjugate, but in the
+% previous versions of this package we could not find a simple means for
+% doing so. Therefore the previous version contained e definition of the
+% \MultVect macro that followed a simple syntax with an optional
+% asterisk \emph{prefixed} to the second operand. Its syntax, therefore,
+% allowed the following two forms:
+%\begin{flushleft}\ttfamily
+%\cs{MultVect}\meta{first factor} by \meta{second factor} to \meta{output macro}\\
+%\cs{MultVect}\meta{first factor} by $\star*$ \meta{second factor} to \meta{output macro}\\
+%\end{flushleft}
+%
+% With the availability of the xparse package and its special argument
+% descriptors for the arguments, we were able to define a different
+% macro, \Multvect, with both optional positions for the asterisk:
+% \emph{after} and \emph{before}; its syntax allows the following four
+% forms:
+%\begin{flushleft}
+%\cs{Multvect}\marg{first factor}\marg{second factor}\meta{output macro}
+%\cs{Multvect}\marg{first factor}$\star*$\marg{second factor}\meta{output macro}
+%\cs{Multvect}\marg{first factor}\marg{second factor}$\star*$\meta{output macro}
+%\cs{Multvect}\marg{first factor}$\star*$\marg{second factor}\meta{output macro}
+%\cs{Multvect}\marg{first factor}$\star*$\marg{second factor}$\star*$\meta{output macro}
+%\end{flushleft}
+%
+% Nevertheless we maintain a sort of interface between the old syntax
+% and the new one, so that the two old forms can be mapped to two
+% suitable forms of the new syntax. Old documents are still compilable;
+% users who got used to the old syntax can maintain their habits.
+%
+% First we define the new macro: it receives the three arguments, the
+% first two as balanced texts; the last one must always be a macro,
+% therefore a single (complex) token and doe not require braces, even
+% if it is not forbidden to use them. Asterisks are optional.
+% The input arguments are transformed into couples of anomaly and
+% modulus; this makes multiplication much simpler as the output modulus
+% is just the product of the input moduli, while the output anomaly is
+% just the sum of input anomalies; eventually it is necessary to
+% transform this polar version of the result into an ordered couple of
+% cartesian values to be assigned to the output macro.
+% In order to maintain the single macros pretty simple we need a couple
+% of service macros and a named counter. We use \ModOfVect previously
+% defined, and a new macro \ModAndAngleOfVect with the following
+% syntax:
+%\begin{flushleft}\ttfamily
+%\cs{ModAndAngleOfVect}\meta{input vector} to \meta{output modulus} and \meta{output angle in degrees}
+%\end{flushleft}
+% The output quantities are always macros, so they do not need balanced
+% bracing; angles in degrees are always preferred because, on case of
+% necessity, they are easy to reduce to the range $180^\circ < \alpha \leq +180^\circ$.
% \begin{macrocode}
\def\MultVect#1by{\@ifstar{\@ConjMultVect#1by}{\@MultVect#1by}}%
+\def\ModAndAngleOfVect#1to#2and#3{\ModOfVect#1to#2\relax
+\ArgOfVect#1to#3\ignorespaces}
+% \end{macrocode}
+% We name a counter in the upper range accessible with all the modern
+% three typesetting engines, pdfLaTeX, LuaLaTeX and XeLaTeX.
+% \begin{macrocode}
+\countdef\MV at C=2560\relax
+% \end{macrocode}
+% The user is warned; The counter register number is sort of casual,
+% but it is not excluded that its name or number get in conflict with
+% other macros from other packages. I would be grateful is such an event
+% takes place.
%
\def\@MultVect#1by#2to#3{\GetCoord(#1)\tu at X\tu at Y
\GetCoord(#2)\td at X\td at Y
\edef\t at X{\fpeval{\tu at X * \td at X  \tu at Y * \td at Y}}\relax
\edef\t at Y{\fpeval{\tu at Y * \td at X + \tu at X * \td at Y}}\relax
\MakeVectorFrom\t at X\t at Y to#3\ignorespaces}%
+% Nov comes the real macro\footnote{A warm thankyou to Enrico Gregorio,
+% who kindly attracted my attention on the necessity of braces when using
+% this kind of macro; being used to the syntax with delimited arguments
+% I had taken the bad habit of avoiding braces. Braces are very
+% important, but the syntax of the original \TeX\ language, that did not
+% have available the L3 one, spoiled me with the abuse of delimited
+% arguments.}:
+% \begin{macrocode}
+\NewDocumentCommand\Multvect{m s m s m}{%
+\MV at C=0
+\ModAndAngleOfVect#1to\MV at uM and\MV at uA
+\ModAndAngleOfVect#3to\MV at dM and\MV at dA
+\IfBooleanT{#2}{\MV at C=1}\relax
+\IfBooleanT{#4}{\MV at C=1}\relax
+\unless\ifnum\MV at C=0\edef\MV at dA{\MV at dA}\fi
+\edef\MV at rM{\fpeval{round((\MV at uM * \MV at dM),6)}}%
+\edef\MV at rA{\fpeval{round((\MV at uA + \MV at dA),6)}}%
+\GetCoord(\MV at rA:\MV at rM)\t at X\t at Y
+\MakeVectorFrom\t at X\t at Y to#5}
+% \end{macrocode}
%
\def\@ConjMultVect#1by#2to#3{\GetCoord(#1)\tu at X\tu at Y
\GetCoord(#2)\td at X\td at Y
\edef\t at X{\fpeval{\tu at X * \td at X + \tu at Y * \td at Y}}\relax
\edef\t at Y{\fpeval{\tu at Y * \td at X  \tu at X * \td at Y}}\relax
\MakeVectorFrom\t at X\t at Y to#3\ignorespaces}
+% The macro to remain backward compatible, reduce to two simple macros
+% that take the input delimited arguments and passes them in braced form
+% to the above general macro:
+% \begin{macrocode}
+\def\MultVect#1by{\@ifstar{\let\MV at c\@ne\@MultVect#1by}%
+ {\let\MV at c\empty\@MultVect#1by}}
+
+\def\@MultVect#1by#2to#3{%
+ \unless\ifx\MV at c\empty\Multvect{#1}{#2}*{#3}\else
+ \Multvect{#1}{#2}{#3}\fi}
% \end{macrocode}
+% Testing of both the new and the old macros show that they behave as
+% expected, although, using real numbers for trigonometric functions,
+% some small rounding unit on the sixth decimal digit still remain;
+% nothing to worry about with a package used for drawing.
%
+%
% The division of two complex numbers implies scaling down the dividend
% by the magnitude of the divisor and by rotating the dividend scaled
% vector by the conjugate direction of the divisor;
+% vector by the conjugate versor of the divisor:
%\[
% \frac{\vec{N}}{\vec{D}}= \frac{\vec{N}}{M\vec{u}}=
% \frac{\vec{N}}{M}\vec{u}^{\mkern2mu\star}
@@ 2664,14 +2974,20 @@
%\]
%therefore:
% \begin{macrocode}
\def\DivVect#1by#2to#3{\ModAndDirOfVect#2to\@Mod and\@Dir
\edef\@Mod{\fpeval{1 / \@Mod}}\relax
+\def\DivVect#1by#2to#3{\Divvect{#1}{#2}{#3}}
+
+\NewDocumentCommand\Divvect{ m m m }{%
+\ModAndDirOfVect#2to\@Mod and\@Dir
+\edef\@Mod{\fpeval{1 / \@Mod}}%
\ConjVect\@Dir to\@Dir
\ScaleVect#1by\@Mod to\@tempa
\MultVect\@tempa by\@Dir to#3\ignorespaces}%
+\Multvect{\@tempa}{\@Dir}#3\ignorespaces}%
% \end{macrocode}
+% Macros \DivVect and \Divvect are almost equivalent; the second is
+% possibly slightly more robust. They match the corresponding macros for
+% multiplying two vectors.
%
%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%>>>>>>>>>>>
% \subsection{Arcs and curved vectors}
%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% We are now in the position of really doing graphic work.
@@ 2690,9 +3006,9 @@
\fi
\endgroup\ignorespaces}%
% \end{macrocode}
% The aperture is already memorized in \@tdA; the \@Arc macro receives
% the center coordinates in the first argument and the coordinates of the
% starting point in the second argument.
+% The aperture is already memorised in \@tdA; the \@Arc macro
+% receives the center coordinates in the first argument and the
+% coordinates of the starting point in the second argument.
% \begin{macrocode}
\def\@Arc(#1)(#2){%
\ifdim\@tdA>\z@
@@ 2701,14 +3017,14 @@
\@tdA=\@tdA \let\Segno%
\fi
% \end{macrocode}
% The rotation angle sign is memorised in \Segno and \@tdA now contains
% the absolute value of the arc aperture.
+% The rotation angle sign is memorised in \Segno and \@tdA now
+% contains the absolute value of the arc aperture.
%
% If the rotation angle is larger than $360^\circ$ a message is issued that
% informs the user that the angle will be reduced modulo $360^\circ$; this
% operation is performed by successive subtractions rather than with
% modular arithmetics on the assumption that in general one subtraction
% suffices.
+% If the rotation angle is larger than $360^\circ$ a message is issued
+% that informs the user that the angle will be reduced modulo
+% $360^\circ$; this operation is performed by successive subtractions
+% rather than with modular arithmetics on the assumption that in general
+% one subtraction suffices.
% \begin{macrocode}
\Numero\@gradi\@tdA
\ifdim\@tdA>360\p@
@@ 2734,15 +3050,15 @@
% \end{macrocode}
% And the new macro \@@Arc starts with moving the drawing point to the
% first% point and does everything needed for drawing the requested arc,
% except stroking it; I leave the \texttt{stroke} command to the completion
% of the calling macro and nobody forbids to use the \@@Arc macro for
% other purposes.
+% except stroking it; we leave the \texttt{stroke} command to the
+% completion of the calling macro and nobody forbids to use the \@@Arc
+% macro for other purposes.
% \begin{macrocode}
\def\@@Arc{%
\pIIe at moveto{\@pPunX\unitlength}{\@pPunY\unitlength}%
% \end{macrocode}
% If the aperture is larger than $180^\circ$ it traces a semicircle in the
% right direction and correspondingly reduces the overall aperture.
+% If the aperture is larger than $180^\circ$ it traces a semicircle in
+% the right direction and correspondingly reduces the overall aperture.
% \begin{macrocode}
\ifdim\@tdA>180\p@
\advance\@tdA180\p@
@@ 2749,7 +3065,7 @@
\Numero\@gradi\@tdA
\SubVect\@pPun from\@Cent to\@V
\AddVect\@V and\@Cent to\@sPun
 \MultVect\@V by0,1.3333333to\@V
+ \Multvect{\@V}{0,1.3333333to}\@V
\if\Segno\ScaleVect\@V by1to\@V\fi
\AddVect\@pPun and\@V to\@pcPun
\AddVect\@sPun and\@V to\@scPun
@@ 2765,8 +3081,8 @@
% If the remaining aperture is not zero it continues tracing the rest of
% the arc. Here we need the extrema of the arc and the coordinates of the
% control points of the Bézier cubic spline that traces the arc. The
% control points lay on the perpendicular to the vectors that join the arc
% center to the starting and end points respectively.
+% control points lay on the perpendicular to the vectors that join the
+% arc center to the starting and end points respectively.
%
% With reference to figure~\ref{fig:arcspline} on
% page~\pageref{fig:arcspline}, the points $P_1$ and $P_2$
@@ 2800,7 +3116,7 @@
\ifdim\@tdA>\z@
\DirFromAngle\@gradi to\@Dir \if\Segno\ConjVect\@Dir to\@Dir \fi
\SubVect\@Cent from\@pPun to\@V
 \MultVect\@V by\@Dir to\@V
+ \Multvect{\@V}{\@Dir}\@V
\AddVect\@Cent and\@V to\@sPun
\@tdA=.5\@tdA \Numero\@gradi\@tdA
\DirFromAngle\@gradi to\@Phimezzi
@@ 2818,10 +3134,10 @@
\fi
\SubVect\@sPun from\@pPun to\@V
\DirOfVect\@V to\@V
 \MultVect\@Phimezzi by\@V to\@Phimezzi
+ \Multvect{\@Phimezzi}{\@V}\@Phimezzi
\AddVect\@sPun and\@Phimezzi to\@scPun
\ScaleVect\@V by1to\@V
 \MultVect\@mPhimezzi by\@V to\@mPhimezzi
+ \Multvect{\@mPhimezzi}{\@V}\@mPhimezzi
\AddVect\@pPun and\@mPhimezzi to\@pcPun
\GetCoord(\@pcPun)\@pcPunX\@pcPunY
\GetCoord(\@scPun)\@scPunX\@scPunY
@@ 2835,18 +3151,19 @@
%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsubsection{Arc vectors}
%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% We exploit much of the above definitions for the \Arc macro for drawing
% circular arcs with an arrow at one or both ends; the first macro
% \VerctorArc draws an arrow at the ending point of the arc; the second
% macro \VectorARC draws arrows at both ends; the arrows have the same
% shape as those for vectors; actually they are drawn by putting a vector
% of zero length at the proper arc end(s), therefore they are styled as
% traditional \LaTeX\ or PostScript arrows according to the specific
% option to the \texttt{pict2e} package.
+% We exploit much of the above definitions for the \Arc macro for
+% drawing circular arcs with an arrow at one or both ends; the first
+% macro \VerctorArc draws an arrow at the ending point of the arc; the
+% second macro \VectorARC draws arrows at both ends; the arrows have
+% the same shape as those for vectors; actually they are drawn by putting
+% a vector of zero length at the proper arc end(s), therefore they are
+% styled as traditional \LaTeX\ or PostScript arrows according to the
+% specific option to the \texttt{pict2e} package.
%
% But the arc drawing done here shortens it so as not to overlap on the
% arrow(s); the only arrow (or both ones) are also lightly tilted in order
% to avoid the impression of a corner where the arc enters the arrow tip.
+% arrow(s); the only arrow (or both ones) are also lightly tilted in
+% order to avoid the impression of a corner where the arc enters the
+% arrow tip.
%
% All these operations require a lot of ``playing'' with vector
% directions, but even if the operations are numerous, they do not do
@@ 2854,15 +3171,14 @@
% (b) determining the arrow length as an angular quantity, i.e. the arc
% amplitude that must be subtracted from the total arc to be drawn;
% (c) the direction of the arrow should be corresponding to the tangent
% to the arc at the point where the arrow tip is attached; (d) tilting the
% arrow tip by half its angular amplitude; (e) determining the resulting
% position and direction of the arrow tip so as to draw a zero length
% vector; (f\/) possibly repeating the same procedure for the other end
% of the arc; (g) shortening the total arc angular amplitude by the
% amount of the arrow tip(s) already set, and finally (h) drawing the
% circular arc that joins the starting point to the final arrow or one
% arrow to the other
% one.
+% to the arc at the point where the arrow tip is attached; (d) tilting
+% the arrow tip by half its angular amplitude; (e) determining the
+% resulting position and direction of the arrow tip so as to draw a zero
+% length vector; (f\/) possibly repeating the same procedure for the
+% other end of the arc; (g) shortening the total arc angular amplitude by
+% the amount of the arrow tip(s) already set, and finally (h) drawing
+% the circular arc that joins the starting point to the final arrow or
+% one arrow to the other one.
%
% The calling macros are very similar to the \Arc macro initial one:
% \begin{macrocode}
@@ 2881,19 +3197,20 @@
% \end{macrocode}
%
% The single arrowed arc is defined with the following long macro where
% all the described operations are performed more or less in the described
% succession; probably the macro requires a little cleaning, but since it
% works fine we did not try to optimise it for time or number of tokens.
% The final part of the macro is almost identical to that of the plain arc;
% the beginning also is quite similar. The central part is dedicated to
% the positioning of the arrow tip and to the necessary calculations for
% determining the tip tilt and the reduction of the total arc length; pay
% attention that the arrow length, stored in \@tdE is a real length,
% while the radius stored in \@Raggio is just a multiple of the
% \unitlength, so that the division (that yields a good angular
% approximation to the arrow length as seen from the center of the arc)
% must be done with real lengths. The already defined \@@Arc macro
% actually draws the curved vector stem without stroking it.
+% all the described operations are performed more or less in the
+% described succession; probably the macro requires a little cleaning,
+% but since it works fine we did not try to optimise it for time or
+% number of tokens. The final part of the macro is almost identical to
+% that of the plain arc; the beginning also is quite similar. The central
+% part is dedicated to the positioning of the arrow tip and to the
+% necessary calculations for determining the tip tilt and the reduction
+% of the total arc length; pay attention that the arrow length, stored in
+% \@tdE is a real length, while the radius stored in \@Raggio is just
+% a multiple of the \unitlength, so that the division (that yields a
+% good angular approximation to the arrow length as seen from the center
+% of the arc) must be done with real lengths. The already defined
+% \@@Arc macro actually draws the curved vector stem without stroking
+% it.
% \begin{macrocode}
\def\@VArc(#1)(#2){%
\ifdim\@tdA>\z@
@@ 2914,9 +3231,9 @@
\@tdD=57.29578\@tdD \Numero\DeltaGradi\@tdD
\@tdD=\ifx\Segno\fi\@gradi\p@ \Numero\@tempa\@tdD
\DirFromAngle\@tempa to\@Dir
\MultVect\@V by\@Dir to\@sPun
+\Multvect{\@V}{\@Dir}\@sPun
\edef\@tempA{\ifx\Segno\m at ne\else\@ne\fi}%
\MultVect\@sPun by 0,\@tempA to\@vPun
+\Multvect{\@sPun}{0,\@tempA}\@vPun
\DirOfVect\@vPun to\@Dir
\AddVect\@sPun and #1 to \@sPun
\GetCoord(\@sPun)\@tdX\@tdY
@@ 2923,7 +3240,7 @@
\@tdD\ifx\Segno\fi\DeltaGradi\p@
\@tdD=.5\@tdD \Numero\DeltaGradi\@tdD
\DirFromAngle\DeltaGradi to\@Dird
\MultVect\@Dir by*\@Dird to\@Dir
+\Multvect{\@Dir}*{\@Dird}\@Dir%
\GetCoord(\@Dir)\@xnum\@ynum
\put(\@tdX,\@tdY){\vector(\@xnum,\@ynum){0}}%
\@tdE =\ifx\Segno\fi\DeltaGradi\p@
@@ 2934,8 +3251,9 @@
% \end{macrocode}
%
% The macro for the arc terminated with arrow tips at both ends is again
% very similar, except it is necessary to repeat the arrow tip positioning
% also at the starting point. The \@@Arc macro draws the curved stem.
+% very similar, except it is necessary to repeat the arrow tip
+% positioning also at the starting point. The \@@Arc macro draws the
+% curved stem.
% \begin{macrocode}
\def\@VARC(#1)(#2){%
\ifdim\@tdA>\z@
@@ 2955,9 +3273,9 @@
\@tdD=\DeltaGradi\p@ \@tdD=57.29578\@tdD \Numero\DeltaGradi\@tdD
\@tdD=\if\Segno\fi\@gradi\p@ \Numero\@tempa\@tdD
\DirFromAngle\@tempa to\@Dir
\MultVect\@V by\@Dir to\@sPun% corrects the end point
+\Multvect{\@V}{\@Dir}\@sPun% corrects the end point
\edef\@tempA{\if\Segno\fi1}%
\MultVect\@sPun by 0,\@tempA to\@vPun
+\Multvect{\@sPun}{0,\@tempA}\@vPun
\DirOfVect\@vPun to\@Dir
\AddVect\@sPun and #1 to \@sPun
\GetCoord(\@sPun)\@tdX\@tdY
@@ 2964,25 +3282,25 @@
\@tdD\if\Segno\fi\DeltaGradi\p@
\@tdD=.5\@tdD \Numero\@tempB\@tdD
\DirFromAngle\@tempB to\@Dird
\MultVect\@Dir by*\@Dird to\@Dir
+\Multvect{\@Dir}*{\@Dird}\@Dir
\GetCoord(\@Dir)\@xnum\@ynum
\put(\@tdX,\@tdY){\vector(\@xnum,\@ynum){0}}% end point arrowt ip
+\put(\@tdX,\@tdY){\vector(\@xnum,\@ynum){0}}% end point arrow tip
\@tdE =\DeltaGradi\p@
\advance\@tdA 2\@tdE \Numero\@gradi\@tdA
\CopyVect#1to\@Cent \GetCoord(\@pPun)\@pPunX\@pPunY
\SubVect\@Cent from\@pPun to \@V
\edef\@tempa{\if\Segno\else\fi\@ne}%
\MultVect\@V by0,\@tempa to\@vPun
+\Multvect{\@V}{0,\@tempa}\@vPun
\@tdE\if\Segno\fi\DeltaGradi\p@
\Numero\@tempB{0.5\@tdE}%
\DirFromAngle\@tempB to\@Dird
\MultVect\@vPun by\@Dird to\@vPun% corrects the starting point
+\Multvect{\@vPun}{\@Dird}\@vPun% corrects the starting point
\DirOfVect\@vPun to\@Dir\GetCoord(\@Dir)\@xnum\@ynum
\put(\@pPunX,\@pPunY){\vector(\@xnum,\@ynum){0}}% starting point arrow tip
\edef\@tempa{\if\Segno\fi\DeltaGradi}%
\DirFromAngle\@tempa to \@Dir
\SubVect\@Cent from\@pPun to\@V
\MultVect\@V by\@Dir to\@V
+\Multvect{\@V}{\@Dir}\@V
\AddVect\@Cent and\@V to\@pPun
\GetCoord(\@pPun)\@pPunX\@pPunY
\@@Arc
@@ 2990,12 +3308,13 @@
% \end{macrocode}
%
% It must be understood that the curved vectors, the above circular arcs
% terminated with an arrow tip at one or both ends, have a nice appearance
% only if the arc radius is not too small, or, said in a different way, if
% the arrow tip angular width does not exceed a maximum of a dozen degrees
% (and this is probably already too much); the tip does not get curved as
% the arc is, therefore there is not a smooth transition from the curved
% stem and the straight arrow tip if this one is large in comparison to the arc radius.
+% terminated with an arrow tip at one or both ends, have a nice
+% appearance only if the arc radius is not too small, or, said in a
+% different way, if the arrow tip angular width does not exceed a
+% maximum of a dozen degrees (and this is probably already too much); the
+% tip does not get curved as the arc is, therefore there is not a smooth
+% transition from the curved stem and the straight arrow tip if this one
+% is large in comparison to the arc radius.
%
%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{General curves}
@@ 3002,8 +3321,8 @@
%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The most used method to draw curved lines with computer programs is to
% connect several simple curved lines, general ``arcs'', one to another
% generally maintaining the same tangent at the junction. If the direction
% changes we are dealing with a cusp.
+% generally maintaining the same tangent at the junction. If the
+% direction changes we are dealing with a cusp.
%
% The simple general arcs that are directly implemented in every program
% that display typeset documents, are those drawn with the parametric
@@ 3024,8 +3343,8 @@
% takes off with a direction that points to the next point, while it
% lands on the destination point with a direction coming from the
% penultimate point; moreover, when $t$ varies from 0 to 1, the curve arc
% is completely contained within the convex hull formed by the polygon that
% has the spline points as vertices.
+% is completely contained within the convex hull formed by the polygon
+% that has the spline points as vertices.
%
% Last but not least first order splines implement just straight lines
% and they are out of question for what concerns maxima, minima,
@@ 3032,23 +3351,23 @@
% inflection points and the like. Quadratic splines draw just
% parabolas, therefore they draw arcs that have the concavity just on one
% side of the path; therefore no inflection points. Cubic splines are
% extremely versatile and can draw lines with maxima, minima and inflection
% points. Virtually a multiarc curve may be drawn by a set of cubic
% splines as well as a set of quadratic splines (fonts are a good example:
% Adobe Type~1 fonts have their contours described by cubic splines, while
% TrueType fonts have their contours described with quadratic splines;
% with a naked eye it is impossible to notice the difference).
+% extremely versatile and can draw lines with maxima, minima and
+% inflection points. Virtually a multiarc curve may be drawn by a set of
+% cubic splines as well as a set of quadratic splines (fonts are a good
+% example: Adobe Type~1 fonts have their contours described by cubic
+% splines, while TrueType fonts have their contours described with
+% quadratic splines; at naked eye it is impossible to notice the difference).
%
% Each program that processes the file to be displayed is capable of
% drawing first order Bézier splines (segments) and third order Bézier
% splines, for no other reason, at least, because they have to draw vector
% fonts whose contours are described by Bézier splines; sometimes they
% have also the program commands to draw second order Bézier splines, but
% not always these machine code routines are available to the user for
% general use. For what concerns pdftex, xetex and luatex, they have
% the user commands for straight lines and cubic arcs. At least with
% pdftex, quadratic arcs must be simulated with a clever use of third
% order Bézier splines.
+% splines, for no other reason, at least, because they have to draw
+% vector fonts whose contours are described by Bézier splines; sometimes
+% they have also the program commands to draw second order Bézier
+% splines, but not always these machine code routines are available to
+% the user for general use. For what concerns pdftex, xetex and
+% luatex, they have the user commands for straight lines and cubic
+% arcs. At least with pdftex, quadratic arcs must be simulated with a
+% clever use of third order Bézier splines.
%
% Notice that \LaTeXe\ environment picture by itself is capable of
% drawing both cubic and quadratic Bézier splines as single arcs; but it
@@ 3068,10 +3387,10 @@
% Now we define a macro for tracing a general, not necessarily circular,
% arc. This macro resorts to a general triplet of macros with which it is
% possible to draw almost anything. It traces a single Bézier spline from
% a first point where the tangent direction is specified to a second point
% where again it is specified the tangent direction. Actually this is a
% special (possibly useless) case where the general \curve macro of
% pict2e could do the same or a better job. In any case\dots
+% a first point where the tangent direction is specified to a second
+% point where again it is specified the tangent direction. Actually this
+% is a special (possibly useless) case where the general \curve macro
+% of pict2e could do the same or a better job. In any case\dots
% \begin{macrocode}
\def\CurveBetween#1and#2WithDirs#3and#4{%
\StartCurveAt#1WithDir{#3}\relax
@@ 3085,14 +3404,14 @@
% In any case the directions specified with the direction arguments, both
% here and with the more general macro\Curve, the angle between the
% indicated tangent and the arc chord may give raise to some little
% problems when they are very close to 90° in absolute value. Some control
% is exercised on these values, but some tests might fail if the angle
% derives from computations; this is a good place to use polar forms for
% the direction vectors.
+% problems when they are very close to 90° in absolute value. Some
+% control is exercised on these values, but some tests might fail if the
+% angle derives from computations; this is a good place to use polar
+% forms for the direction vectors.
%
% The first macro initializes the drawing and the third one strokes it; the
% real work is done by the second macro. The first macro initializes the
% drawing but also memorises the starting direction; the second macro
+% The first macro initialises the drawing and the third one strokes it;
+% the real work is done by the second macro. The first macro initialises
+% the drawing but also memorises the starting direction; the second macro
% traces the current Bézier arc reaching the destination point with the
% specified direction, but memorises this direction as the one with which
% to start the next arc. The overall curve is then always smooth because
@@ 3099,16 +3418,17 @@
% the various Bézier arcs join with continuous tangents. If a cusp is
% desired it is necessary to change the memorised direction at the end of
% the arc before the cusp and before the start of the next arc; this is
% better than stroking the curve before the cusp and then starting another
% curve, because the curve joining point at the cusp is not stroked with
% the same command, therefore we get two superimposed curve terminations.
% We therefore need another small macro \ChangeDir to perform this task.
+% better than stroking the curve before the cusp and then starting
+% another curve, because the curve joining point at the cusp is not
+% stroked with the same command, therefore we get two superimposed curve
+% terminations. We therefore need another small macro \ChangeDir to
+% perform this task.
%
% It is necessary to recall that the direction vectors point to the control
% points, but they do not define the control points themselves; they are
% just directions, or, even better, they are simply vectors with the
% desired direction; the macros themselves provide to the normalisation
% and memorization.
+% It is necessary to recall that the direction vectors point to the
+% control points, but they do not define the control points themselves;
+% they are just directions, or, even better, they are simply vectors with
+% the desired direction; the macros themselves provide to the
+% normalisation and memorisation.
%
% The next desirable feature would be to design a macro that accepts
% optional node directions and computes the missing ones according to a
@@ 3120,8 +3440,8 @@
% For the moment we refrain from automatic direction computation, but we
% design the general macro as if directions were optional.
%
% Here we begin with the first initialising macro that receives with the
% first argument the starting point and with the second argument the
+% Here we begin with the first initialising macro that receives with the
+% first argument the starting point and with the second argument the
% direction of the tangent (not necessarily normalised to a unit vector)
% \begin{macrocode}
\def\StartCurveAt#1WithDir#2{%
@@ 3134,7 +3454,7 @@
\DirOfVect\@Dzero to\@Dzero
\ignorespaces}
% \end{macrocode}
% And this reinitializes the direction to create a cusp:
+% And this reinitialises the direction to create a cusp:
% \begin{macrocode}
\def\ChangeDir<#1>{%
\GetCoord(#1)\@tempa\@tempb
@@ 3144,11 +3464,11 @@
% \end{macrocode}
%
% The next macros are the finishing ones; the first strokes the whole
% curve, while the second fills the (closed) curve with the default color;
% both close the group that was opened with \StartCurve. The third macro
% is explained in a while; we anticipate it is functional to chose between
% the first two macros when a star is possibly used to switch between
% stroking and filling.
+% curve, while the second fills the (closed) curve with the default
+% color; both close the group that was opened with \StartCurve. The
+% third macro is explained in a while; we anticipate it is functional to
+% chose between the first two macros when a star is possibly used to
+% switch between stroking and filling.
% \begin{macrocode}
\def\CurveFinish{\strokepath\endgroup\ignorespaces}%
\def\FillCurve{\fillpath\endgroup\ignorespaces}
@@ 3155,20 +3475,20 @@
\def\CurveEnd{\fillstroke\endgroup\ignorespaces}
% \end{macrocode}
%
% In order to draw the internal arcs it would be desirable to have a single
% macro that, given the destination point, computes the control points that
% produce a cubic Bézier spline that joins the starting point with the
% destination point in the best possible way. The problem is strongly ill
% defined and has an infinity of solutions; here we give two solutions:
% $(a)$ a supposedly smart one that resorts to osculating circles and
% requires only the direction at the destination point; and $(b)$ a less
% smart solution that requires the control points to be specified in a
% certain format.
+% In order to draw the internal arcs it would be desirable to have a
+% single macro that, given the destination point, computes the control
+% points that produce a cubic Bézier spline that joins the starting point
+% with the destination point in the best possible way. The problem is
+% strongly ill defined and has an infinity of solutions; here we give two
+% solutions: $(a)$ a supposedly smart one that resorts to osculating
+% circles and requires only the direction at the destination point; and
+% $(b)$ a less smart solution that requires the control points to be
+% specified in a certain format.
%
% We start with solution $(b)$, \CbezierTo, the code of which is simpler
% than that of solution $(a)$; then we will produce the solution $(a)$,
% \CurveTo, that will become the main building block for a general path
% construction macro, \Curve.
+% We start with solution $(b)$, \CbezierTo, the code of which is
+% simpler than that of solution $(a)$; then we will produce the solution
+% $(a)$, \CurveTo, that will become the main building block for a
+% general path construction macro, \Curve.
%
% The “naïve” macro \CBezierTo simply uses the previous point direction
% saved in \@Dzero as a unit vector by the starting macro; specifies
@@ 3176,8 +3496,8 @@
% starting point, the destination point direction that will save also for
% the next arcdrawing macro as a unit vector, and the distance of the
% second control point from the destination point along this last
% direction. Both distances must be positive possibly fractional numbers.
% The syntax therefore is the follwing:
+% direction. Both distances must be positive possibly fractional
+% numbers. The syntax therefore is the following:
%\begin{flushleft}
%\cs{CbezierTo}\meta{end
% point}WithDir\meta{direction}AndDists\meta{$K_0$}And\meta{$K_1$}
@@ 3192,8 +3512,8 @@
% while if it is a macro name (containing the desired fractional or
% integer value) there is no need for braces.
%
% This macro uses the input information to use the internal pict2e macro
% \pIIe at curveto with the proper arguments, and to save the final
+% This macro uses the input information to use the internal pict2e
+% macro \pIIe at curveto with the proper arguments, and to save the final
% direction into the same \@Dzero macro for successive use of other
% arcdrawing macros.
% \begin{macrocode}
@@ 3214,9 +3534,9 @@
\ignorespaces}%
% \end{macrocode}
%
% With this building block it is not difficult to set up a macro that draws
% a Bézier arc between two given points, similarly to the other macro
% \CurveBetween previously described and defined here:
+% With this building block it is not difficult to set up a macro that
+% draws a Bézier arc between two given points, similarly to the other
+% macro \CurveBetween previously described and defined here:
%
% \begin{macrocode}
\def\CbezierBetween#1And#2WithDirs#3And#4UsingDists#5And#6{%
@@ 3227,15 +3547,15 @@
%
% An example of use is shown in figure~\ref{fig:Cbezier} on
% page~\pageref{fig:Cbezier}; notice that the tangents at the end points
% are the same for the black curve drawn with \CurveBetween and the five
% red curves drawn with \CbezierBetween; the five red curves differ only
% for the distance of their control point $C_0$ from the starting point;
% the differences are remarkable and the topmost curve even presents a
% slight inflection close to the end point. These effects cannot be
% obtained with the ``smarter'' macro \CurveBetween. But certainly this
% simpler macro is more difficult to use because the distances of the
% control points are difficult to estimate and require a number of
% cutandtry experiments.
+% are the same for the black curve drawn with \CurveBetween and the
+% five red curves drawn with \CbezierBetween; the five red curves
+% differ only for the distance of their control point $C_0$ from the
+% starting point; the differences are remarkable and the topmost curve
+% even presents a slight inflection close to the end point. These effects
+% cannot be obtained with the “smarter” macro \CurveBetween. But
+% certainly this simpler macro is more difficult to use because the
+% distances of the control points are difficult to estimate and require a
+% number of cutandtry experiments.
%
%
% The ``smarter'' curve macro comes next; it is supposed to determine the
@@ 3243,36 +3563,36 @@
% specified direction to the next point with another specified direction
% (final node).
% Since the control points are along the specified directions, it is
% necessary to determine the distances from the adjacent curve nodes. This
% must work correctly even if nodes and directions imply an inflection
% point somewhere along the arc.
+% necessary to determine the distances from the adjacent curve nodes.
+% This must work correctly even if nodes and directions imply an
+% inflection point somewhere along the arc.
%
% The strategy we devised consists in determining each control point as if
% it were the control point of a circular arc, precisely an arc of an
+% The strategy we devised consists in determining each control point as
+% if it were the control point of a circular arc, precisely an arc of an
% osculating circle, i.e. a circle tangent to the curve at that node. The
% ambiguity of the stated problem may be solved by establishing that the
% chord of the osculating circle has the same direction as the chord of the
% arc being drawn, and that the curve chord is divided into two equal parts
% each of which should be interpreted as half the chord of the osculating
% circle.
+% chord of the osculating circle has the same direction as the chord of
+% the arc being drawn, and that the curve chord is divided into two equal
+% parts each of which should be interpreted as half the chord of the
+% osculating circle.
%
% This makes the algorithm a little rigid; sometimes the path drawn is very
% pleasant, while in other circumstances the determined curvatures are too
% large or too small. We therefore add some optional information that lets
% us have some control over the curvatures; the idea is based on the
% concept of \emph{tension}, similar but not identical to the one used in
% the drawing programs \MF\ and \MP. We add to the direction information,
% with which the control nodes of the osculating circle arcs are
% determined, a scaling factor that should be intuitively related to the
% tension of the arc (actually, since the tension of the ‘rope’ is high
% when this parameter is low, probably a name such as ‘looseness’ would be
% better suited): the smaller this number, the closer the arc resembles
% a straight line as a rope subjected to a high tension; value zero is
% allowed, while a value of 4 is close to ``infinity'' and turns a quarter
% circle into a line with an unusual loop; a value of 2 turns a quarter
% circle almost into a polygonal line with rounded corner. Therefore these
% tension factors should be used only for fine tuning the arcs, not when
% a path is drawn for the first time.
+% This makes the algorithm a little rigid; sometimes the path drawn is
+% very pleasant, while in other circumstances the determined curvatures
+% are too large or too small. We therefore add some optional information
+% that lets us have some control over the curvatures; the idea is based
+% on the concept of \emph{tension}, similar but not identical to the one
+% used in the drawing programs \MF\ and \MP. We add to the direction
+% information, with which the control nodes of the osculating circle arcs
+% are determined, a scaling factor that should be intuitively related to
+% the tension of the arc (actually, since the tension of the ‘rope’ is
+% high when this parameter is low, probably a name such as ‘looseness’
+% would be better suited): the smaller this number, the closer the arc
+% resembles a straight line as a rope subjected to a high tension; value
+% zero is allowed, while a value of 4 is close to ``infinity'' and turns
+% a quarter circle into a line with an unusual loop; a value of 2 turns a
+% quarter circle almost into a polygonal line with rounded vertices
+%. Therefore these tension factors should be used only for fine tuning
+% the arcs, not when a path is drawn for the first time.
%
% We devised a syntax for specifying direction and tensions:
%\begin{flushleft}
@@ 3284,8 +3604,8 @@
% information contained from the semicolon (included) to the rest of the
% specification is optional; if it is present, the \emph{tension factors}
% is simply a comma separated pair of fractional or integer numbers that
% represent respectively the tension at the starting or the ending node of
% a path arc.
+% represent respectively the tension at the starting or the ending node
+% of a path arc.
%
% We therefore need a macro to extract the mandatory and optional parts:
% \begin{macrocode}
@@ 3306,8 +3626,8 @@
%\end{align}
%\end{subequations}
%
% We therefore start with getting the points and directions and calculating
% the chord and its direction:
+% We therefore start with getting the points and directions and
+% calculating the chord and its direction:
% \begin{macrocode}
\def\CurveTo#1WithDir#2{%
\def\@Tuno{1}\def\@Tzero{1}\relax
@@ 3319,8 +3639,8 @@
% Then we rotate everything about the starting point so as to bring the
% chord on the real axis
% \begin{macrocode}
\MultVect\@Dzero by*\@DirChord to \@Dpzero
\MultVect\@Duno by*\@DirChord to \@Dpuno
+\Multvect{\@Dzero}*{\@DirChord}\@Dpzero
+\Multvect{\@Duno}*{\@DirChord}\@Dpuno
\GetCoord(\@Dpzero)\@DXpzero\@DYpzero
\GetCoord(\@Dpuno)\@DXpuno\@DYpuno
\DivideFN\@Chord by2 to\@semichord
@@ 3347,8 +3667,8 @@
\fi
% \end{macrocode}
% The distances we are looking for are positive generally fractional
% numbers; so if the components are negative, we take the absolute values.
% Eventually we determine the absolute control point coordinates.
+% numbers; so if the components are negative, we take the absolute
+% values. Eventually we determine the absolute control point coordinates.
% \begin{macrocode}
\unless\ifdim\@DXpzero\p@=\z@
\unless\ifdim\@DYpzero\p@=\z@
@@ 3403,9 +3723,9 @@
{\@XCPuno\unitlength}{\@YCPuno\unitlength}%
{\@XPuno\unitlength}{\@YPuno\unitlength}\egroup
% \end{macrocode}
% It does not have to stroke the curve because other Bézier splines might
% still be added to the path. On the opposite it memorises the final point
% as the initial point of the next spline
+% It does not have to stroke the curve because other Bézier splines
+% might still be added to the path. On the opposite it memorises the
+% final point as the initial point of the next spline
% \begin{macrocode}
\CopyVect\@Puno to\@Pzero
\CopyVect\@Duno to\@Dzero
@@ 3415,23 +3735,25 @@
%
% We finally define the overall \Curve macro that has two flavours:
% starred and unstarred; the former fills the curve path with the locally
% selected color, while the latter just strokes the path. Both recursively
% examine an arbitrary list of nodes and directions; node coordinates are
% grouped within regular parentheses while direction components are grouped within angle brackets. The first call of the macro initialises the drawing
% process and checks for the next node and direction; if a second node is
% missing, it issues a warning message and does not draw anything. It does
% not check for a change in direction, because it would be meaningless at
% the beginning of a curve. The second macro defines the path to the next
% point and checks for another node; if the next list item is a square
% bracket delimited argument, it interprets it as a change of direction,
% while if it is another parenthesis delimited argument it interprets it as
% a new nodedirection specification; if the node and direction list is
% terminated, it issues the stroking or filling command through
% \CurveEnd, and exits the recursive process. The \CurveEnd control
% sequence has a different meaning depending on the fact that the main
% macro was starred or unstarred. The @ChangeDir macro is just an
% interface to execute the regular \ChangeDir macro, but also for
% recursing again by recalling \@Curve.
+% selected color, while the latter just strokes the path. Both
+% recursively examine an arbitrary list of nodes and directions; node
+% coordinates are grouped within regular parentheses while direction
+% components are grouped within angle brackets. The first call of the
+% macro initialises the drawing process and checks for the next node and
+% direction; if a second node is missing, it issues a warning message and
+% does not draw anything. It does not check for a change in direction,
+% because it would be meaningless at the beginning of a curve. The second
+% macro defines the path to the next point and checks for another node;
+% if the next list item is a square bracket delimited argument, it
+% interprets it as a change of direction, while if it is another
+% parenthesis delimited argument it interprets it as a new nodedirection
+% specification; if the node and direction list is terminated, it issues
+% the stroking or filling command through \CurveEnd, and exits the
+% recursive process. The \CurveEnd control sequence has a different
+% meaning depending on the fact that the main macro was starred or
+% unstarred. The @ChangeDir macro is just an interface to execute the
+% regular \ChangeDir macro, but also for recursing again by recalling
+% \@Curve.
% \begin{macrocode}
\def\Curve{\@ifstar{\let\fillstroke\fillpath\Curve@}%
{\let\fillstroke\strokepath\Curve@}}
@@ 3451,47 +3773,48 @@
%
% As a concluding remark, please notice that the \Curve macro is
% certainly the most comfortable to use, but it is sort of frozen in its
% possibilities. The user may certainly use the \StartCurve, \CurveTo,
% \ChangeDir, and \CurveFinish or \FillCurve for a more versatile
% set of drawing macros; evidently nobody forbids to exploit the full power
% of the \cbezier original macro for cubic splines; we made available
% macros \CbezierTo and the isolated arc macro \CbezierBetween in order
% to use the general internal cubic Bézier splines in a more comfortable
% way.
+% possibilities. The user may certainly use the \StartCurve,
+% \CurveTo, \ChangeDir, and \CurveFinish or \FillCurve for a
+% more versatile set of drawing macros; evidently nobody forbids to
+% exploit the full power of the \cbezier original macro for cubic
+% splines; we made available macros \CbezierTo and the isolated arc
+% macro \CbezierBetween in order to use the general internal cubic
+% Bézier splines in a more comfortable way.
%
% As it can be seen in figure~\ref{fig:sinewave} on
% page~\pageref{fig:sinewave} the two diagrams should approximately
% represent a sine wave. With Bézier curves, that resort on polynomials,
% it is impossible to represent a transcendental function, but it is only
% possible to approximate it. It is evident that the approximation obtained
% with full control on the control points requires less arcs and it is more
% accurate than the approximation obtained with the recursive \Curve
% macro; this macro requires almost two times as many pieces of information
% in order to minimise the effects of the lack of control on the control
% points, and even with this added information the macro approaches the
% sine wave with less accuracy. At the same time for many applications the
% \Curve recursive macro proves to be much easier to use than with single
% arcs drawn with the \CbezierBetween macro.
+% possible to approximate it. It is evident that the approximation
+% obtained with full control on the control points requires less arcs and
+% it is more accurate than the approximation obtained with the recursive
+% \Curve macro; this macro requires almost two times as many pieces of
+% information in order to minimise the effects of the lack of control on
+% the control points, and even with this added information the macro
+% approaches the sine wave with less accuracy. At the same time for many
+% applications the \Curve recursive macro proves to be much easier to
+% use than with single arcs drawn with the \CbezierBetween macro.
%
%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{Quadratic splines}
%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% We want to create a recursive macro with the same properties as the above
% described \Curve macro, but that uses quadratic splines; we call it
% \Qurve so that the initial macro name letter reminds us of the nature
% of the splines being used. For the rest they have an almost identical
% syntax; with quadratic spline it is not possible to specify the distance
% of the control points from the extrema, since quadratic spline have just
% one control point that must lay at the intersection of the two tangent
% directions therefore with quadratic splines the tangents at each point
% cannot have the optional part that starts with a semicolon. The syntax,
% therefore, is just:
+% We want to create a recursive macro with the same properties as the
+% above described \Curve macro, but that uses quadratic splines; we
+% call it \Qurve so that the initial macro name letter reminds us of
+% the nature of the splines being used. For the rest they have an almost
+% identical syntax; with quadratic splines it is not possible to specify
+% the distance of the control points from the extrema, since quadratic
+% splines have just one control point that must lay at the intersection
+% of the two tangent directions; therefore with quadratic splines the
+% tangents at each point cannot have the optional part that starts with a
+% semicolon. The syntax, therefore, is just:
%\begin{flushleft}
%\cs{Qurve}\parg{first point}\aarg{direction}...\parg{any point}\aarg{direction}...\parg{last point}\aarg{direction}
%\end{flushleft}
% As with \Curve, also with \Qurve there is no limitation on the number
% of points, except for the computer memory size; it is advisable not to
% use many arcs otherwise it might become very difficult to find errors.
+% As with \Curve, also with \Qurve there is no limitation on the
+% number of points, except for the computer memory size; it is advisable
+% not to use many arcs otherwise it might become very difficult to find
+% errors.
%
% The first macros that set up the recursion are very similar to those we
% wrote for \Curve:
@@ 3518,12 +3841,12 @@
% macros \StartCurveAt, \QurveTo, \ChangeDir and \CurveFinish
% (or \FillCurve), with their respective syntax, in such a way that a
% long list % of nodedirection specifications passed to \Qurve may be
% split into shorter input lines in order to edit the input data in a more
% comfortable way.
+% split into shorter input lines in order to edit the input data in a
+% more comfortable way.
%
%
% The macro that does everything is \QurveTo. it starts with reading its
% arguments received through the calling macro \@Qurve
+% The macro that does everything is \QurveTo. it starts with reading
+% its arguments received through the calling macro \@Qurve
% \begin{macrocode}
\def\QurveTo#1WithDir#2{%
\edef\@Puno{#1}\DirOfVect#2to\@Duno\bgroup
@@ 3531,13 +3854,13 @@
% \end{macrocode}
% It verifies if \@Dpzero and \@Dpuno, the directions at the two
% extrema of the arc, are parallel or antiparallel by taking their
% ``scalar'' product (\@Dpzero times \@Dpuno*); if the imaginary
+% ``scalar'' product (\@Dpzero times \@Dpuno*); if the imaginary
% component of the scalar product vanishes the two directions are
% parallel; in this case we produce an error message, but we continue by
% skipping this arc destination point; evidently the drawing will not be
% the desired one, but the job should not abort.
% \begin{macrocode}
\MultVect\@Dzero by*\@Duno to \@Scalar
+\Multvect{\@Dzero}*{\@Duno}\@Scalar
\YpartOfVect\@Scalar to \@YScalar
\ifdim\@YScalar\p@=\z@
\PackageWarning{curve2e}%
@@ 3554,15 +3877,16 @@
% vectors, although the user can use the vector specifications that are
% more understandable to him/her:
% \begin{macrocode}
\MultVect\@Dzero by*\@DirChord to \@Dpzero
\MultVect\@Duno by*\@DirChord to \@Dpuno
+\Multvect{\@Dzero}*{\@DirChord}\@Dpzero
+\Multvect{\@Duno}*{\@DirChord}\@Dpuno
\GetCoord(\@Dpzero)\@DXpzero\@DYpzero
\GetCoord(\@Dpuno)\@DXpuno\@DYpuno
% \end{macrocode}
% We check if the two directions point to the same half plane; this implies
% that these rotated directions point to different sides of the chord
% vector; all this is equivalent that the two direction Y components have
% opposite signs, so that their product is strictly negative, while the two
+% We check if the two directions point to the same half plane; this
+% implies that these rotated directions point to different sides of the
+% chord vector; all this is equivalent that the two direction Y
+% components have opposite signs, so that their product is strictly
+% negative, while the two
% X components product is not negative.
% \begin{macrocode}
\MultiplyFN\@DXpzero by\@DXpuno to\@XXD
@@ 3581,8 +3905,8 @@
% the expanded input information into new macros that have more explicit
% names: macros stating wit `S' denote the sine of the direction angle,
% while those starting with `C' denote the cosine of that angle. We will
% use these expanded definitions as we know we are working with the actual
% values. These directions are those relative to the arc chord.
+% use these expanded definitions as we know we are working with the
+% actual values. These directions are those relative to the arc chord.
% \begin{macrocode}
\edef\@CDzero{\@DXpzero}\relax
\edef\@SDzero{\@DYpzero}\relax
@@ 3589,11 +3913,12 @@
\edef\@CDuno{\@DXpuno}\relax
\edef\@SDuno{\@DYpuno}\relax
% \end{macrocode}
% Suppose we write the parametric equations of a straight line that departs
% from the beginning of the chord with direction angle $\phi_0$ and the
% corresponding equation of the straight line departing from the end of the
% chord (of length $c$) with direction angle $\phi_1$. We have to find the
% coordinates of the intersection point of these two straight lines.
+% Suppose we write the parametric equations of a straight line that
+% departs from the beginning of the chord with direction angle $\phi_0$
+% and the corresponding equation of the straight line departing from the
+% end of the chord (of length $c$) with direction angle $\phi_1$. We have
+% to find the coordinates of the intersection point of these two straight
+% lines.
%\begin{subequations}
%\begin{align}
% t \cos\phi_0  s \cos\phi_1 &= c\\
@@ 3635,16 +3960,16 @@
\GetCoord(\@Puno)\@XPuno\@YPuno
\GetCoord(\@CP)\@XCP\@YCP
% \end{macrocode}
% We have now the coordinates of the two extrema point of the quadratic arc
% and of the control point. Keeping in mind that the symbols $P_0$, $P_1$
% and $C$ denote geometrical points but also their coordinates as ordered
% pairs of real numbers (i.e. they are complex numbers) we have to
% determine the parameters of a cubic spline that with suitable values
% get simplifications in its parametric equation so that it becomes a
% second degree function instead of a third degree one. It is possible,
% in spite of the fact the it appears impossible that e cubic form becomes
% a quadratic one; we should determine the values of $P_a$ and $P_b$ such
% that:
+% We have now the coordinates of the two extrema point of the quadratic
+% arc and of the control point. Keeping in mind that the symbols $P_0$,
+% $P_1$ and $C$ denote geometrical points but also their coordinates as
+% ordered pairs of real numbers (i.e. they are complex numbers) we have
+% to determine the parameters of a cubic spline that with suitable
+% values get simplifications in its parametric equation so that it
+% becomes a second degree function instead of a third degree one. It is
+% possible, in spite of the fact the it appears impossible that e cubic
+% form becomes a quadratic one; we should determine the values of $P_a$
+% and $P_b$ such that:
%\[
% P_0(1t)^3 +3P_a(1t)^2t +3P_b(1t)t^2 +P_1t^3
%\]
@@ 3686,8 +4011,8 @@
%
% An example of usage is shown at the left in
% figure~\ref{fig:quadraticarcs}\footnote{The commands \cs{legenda},
% \cs{Pall} and \cs{Zbox} are specifically defined in the preamble of this
% document; they must be used within a \texttt{picture} environment.
+% \cs{Pall} and \cs{Zbox} are specifically defined in the preamble of
+% this document; they must be used within a \texttt{picture} environment.
% \cs{legenda} draws a framed legend made up of a single (short) math
% formula; \cs{Pall} is just a shorthand to put a filled small circle at a
% specified position' \cs{Zbox} puts a symbol in math mode a little
@@ 3715,22 +4040,22 @@
% cubic arcs; the difference is easily seen even without using measuring
% instruments.
%
% With quadratic arcs we decided to avoid defining specific macros similar
% to \CurveBetween and \CbezierBetween; the first macro would not save
% any typing to the operator; furthermore it may be questionable if it was
% really useful even with cubic splines; the second macro with quadratic
% arcs is meaningless, since with quadratic arcs there is just one control
% point and there is no choice on its position.
+% With quadratic arcs we decided to avoid defining specific macros
+% similar to \CurveBetween and \CbezierBetween; the first macro would
+% not save any typing to the operator; furthermore it may be questionable
+% if it was really useful even with cubic splines; the second macro with
+% quadratic arcs is meaningless, since with quadratic arcs there is just
+% one control point and there is no choice on its position.
%
%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \section{Conclusion}
%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% I believe that the set of new macros provided by this package can really
% help the user to draw his/her diagrams with more agility; it will be the
% accumulated experience to decide if this is true.
+% I believe that the set of new macros provided by this package can
+% really help the user to draw his/her diagrams with more agility; it
+% will be the accumulated experience to decide if this is true.
%
% As a personal experience we found very comfortable to draw ellipses and
% to define macros to draw not only such shapes or filled elliptical
+% to define macros to draw not only such shapes or filled elliptical
% areas, but also to create “legends” with coloured backgrounds and
% borders. But this is an application of the functionality implemented in
% this package.
@@ 3744,10 +4069,11 @@
%<*readme>
%\fi
% \section{The \texttt{README.txt} file}
%The following it the text that forms the contents of the README.txt
% file that accompanies the package. We fount it handy to have it in
% the documented source, because in this way certain informations
% don't need to be repeated again and again in different files.
+% The following is the text that forms the contents of the README.txt
+% file that accompanies the package. We found it handy to have it in
+% the documented source, because in this way certain pieces of
+% information don't need to be repeated again and again in different
+% files.
% \begin{macrocode}
The package bundle curve2e is composed of the following files
@@ 3754,46 +4080,44 @@
curve2e.dtx
curve2e.pdf
README.txt
curve2ev161.sty
ltxdoc.cfg
curve2e.dtx is the documented TeX source file of file curve2e.sty; you
get both curve2e.sty and curve2e.pdf by running pdflatex on curve2e.dtx.
The ltxdoc.cfg file customises the way the documentation file is typeset.
This .cfg file is not subject to the LPPL licence.
+curve2e.dtx is the documented TeX source file of file curve2e.sty; you
+get curve2e.sty, curve2e.pdf, and curve2ev161.sty by running pdflatex
+on curve2e.dtx. The ltxdoc.cfg file customises the way the documentation
+file is typeset. This specific .cfg file is part of the ltxdoc package functionality and it is supposed to be configured for each specifica other bundle.
README.txt, this file, contains general information.
Curve2ev161.sty contains the previous version of the package; see below
+Curve2ev161.sty contains a previous version of the package; see below
why the older version might become necessary for the end user.
Curve2e.sty is an extension of the package pict2e.sty which extends the
standard picture LaTeX environment according to what Leslie Lamport
specified in the second edition of his LaTeX manual.
+Curve2e.sty is an extension of the package pict2e.sty which extends the
+standard picture LaTeX environment according to what Leslie Lamport
+specified in the second edition of his LaTeX manual (1994).
This further extension allows to draw lines and vectors with any non
integer slope parameters, to draw dashed lines of any slope, to draw arcs
and curved vectors, to draw curves where just the interpolating nodes are
specified together with the slopes at the nodes; closed paths of any
shape can be filled with color; all coordinates are treated as ordered
pairs, i.e. 'complex numbers'; coordinates may be expressed also in
polar form.
Some of these features have been incorporated in the 2011 version of
pict2e; therefore this package avoids any modification to the original
+This further extension curve2e.sty allows to draw lines and vectors
+with any non integer slope parameters, to draw dashed lines of any
+slope, to draw arcs and curved vectors, to draw curves where just
+the interpolating nodes are specified together with the slopes at
+the nodes; closed paths of any shape can be filled with color; all
+coordinates are treated as ordered pairs, i.e. 'complex numbers';
+coordinates may be expressed also in polar form.
+Some of these features have been incorporated in the 2011 version of
+pict2e; therefore this package avoids any modification to the original
pict2e commands.

Curve2e now accepts polar coordinates in addition to the usual cartesian
ones; several macros have been upgraded and a new macro for tracing cubic
Bezier splines with their control nodes specified in polar form is
available. The same applies to quadratic Bezier splines. The multiput
+Curve2e now accepts polar coordinates in addition to the usual cartesian
+ones; several macros have been upgraded and a new macro for tracing cubic
+Bezier splines with their control nodes specified in polar form is
+available. The same applies to quadratic Bezier splines. The \multiput
command has been completely modified in a backwards compatible way, as
to manipulate the increment components.
+to manipulate the increment components in a configurable way.
This version solves a conflict with package esopic.
This version of curve2e is almost fully compatible with pict2e dated
2014/01/12 version 0.2z.
+This version of curve2e is almost fully compatible with pict2e dated
+2014/01/12 version 0.2z and later.
If you specify
@@ 3801,31 +4125,31 @@
the package pict2e is automatically invoked with the specified options.
The almost compatible frase is necessary to explain that this version
+The almost compatible frase is necessary to explain that this version
of curve2e uses some `functions' of the LaTeX3 language that were made
available to the LaTeX developer by mid October 2018. Should the user
have an older or a basic/incomplete installation of the TeX system,
such L3 functions might not be available. This is why this
package checks the presence of the developer interface; in case
such interface is not available it falls back to the previous version
renamed curve2ev161.sty, which is part of this bundle, and that must
not be renamed in any way. The compatibility mentioned above implies
that the user macros remain the same, but their implementation requires
+available to the LaTeX developers by mid October 2018. Should the user
+have an older or a basic/incomplete installation of the TeX system,
+such L3 functions might not be available. This is why this
+package checks the presence of the developer interface; in case
+such interface is not available it falls back to the previous version
+renamed curve2ev161.sty, which is part of this bundle, and that must
+not be renamed in any way. The compatibility mentioned above implies
+that the user macros remain the same, but their implementation requires
the L3 interface.
The package has the LPPL status of author maintained.
According to the LPPL licence, you are entitled to modify this package,
+According to the LPPL licence, you are entitled to modify this package,
as long as you fulfil the few conditions set forth by the Licence.
Nevertheless this package is an extension to the standard LaTeX package
pict2e (2014). Therefore any change must be controlled on the
parent package pict2e, so as to avoid redefining what has already been
incorporated in the official package.
+Nevertheless this package is an extension to the standard LaTeX package
+pict2e (2014). Therefore any change must be controlled on the
+parent package pict2e, so as to avoid redefining or interfering with
+what is already contained in the official package.
If you prefer sending me your modifications, as long as I will maintain
this package, I will possibly include every (documented) suggestion or
modification into this package and, of course, I will acknowledge your
+If you prefer sending me your modifications, as long as I will maintain
+this package, I will possibly include every (documented) suggestion or
+modification into this package and, of course, I will acknowledge your
contribution.
Claudio Beccari
@@ 3840,8 +4164,8 @@
%\fi
% \section{The fallback package version \texttt{curve2ev161}}
% this is the fallback version of curve2ev161.sty to which the main
% file curve2e.sty falls back in case the interface package xfp is not
% available.
+% file curve2e.sty falls back in case the interface package xfp is
+% not available.
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}[2016/01/01]
\ProvidesPackage{curve2ev161}%
@@ 3889,17 +4213,17 @@
\countdef\NumA3254\countdef\NumB3252\relax
\GetCoord(#1)\@tA\@tB \MakeVectorFrom\@tA\@tB to\V at ttA
\GetCoord(#2)\@tA\@tB \MakeVectorFrom\@tA\@tB to\V at ttB
 \SubVect\V at ttA from\V at ttB to\V at ttC
 \ModOfVect\V at ttC to\DlineMod
 \DivideFN\DlineMod by#3 to\NumD
 \NumA\expandafter\Integer\NumD.??
 \ifodd\NumA\else\advance\NumA\@ne\fi
 \NumB=\NumA \divide\NumB\tw@
 \DividE\DlineMod\p@ by\NumA\p@ to\D at shMod
 \DividE\p@ by\NumA\p@ to \@tempa
 \MultVect\V at ttC by\@tempa,0 to\V at ttB
+ \SubVect\V at ttA from\V at ttB to\V at ttC
+ \ModOfVect\V at ttC to\DlineMod
+ \DivideFN\DlineMod by#3 to\NumD
+ \NumA\expandafter\Integer\NumD.??
+ \ifodd\NumA\else\advance\NumA\@ne\fi
+ \NumB=\NumA \divide\NumB\tw@
+ \DividE\DlineMod\p@ by\NumA\p@ to\D at shMod
+ \DividE\p@ by\NumA\p@ to \@tempa
+ \MultVect\V at ttC by\@tempa,0 to\V at ttB
\MultVect\V at ttB by 2,0 to\V at ttC
 \advance\NumB\@ne
+ \advance\NumB\@ne
\edef\@mpt{\noexpand\egroup
\noexpand\multiput(\V at ttA)(\V at ttC){\number\NumB}%
{\noexpand\LIne(\V at ttB)}}%
Modified: trunk/Master/texmfdist/tex/latex/curve2e/curve2e.sty
===================================================================
 trunk/Master/texmfdist/tex/latex/curve2e/curve2e.sty 20191130 22:12:51 UTC (rev 52977)
+++ trunk/Master/texmfdist/tex/latex/curve2e/curve2e.sty 20191130 22:13:04 UTC (rev 52978)
@@ 9,17 +9,17 @@
%% Copyright (C) 20052019 Claudio Beccari all rights reserved.
%% License information appended
%%
\NeedsTeXFormat{LaTeX2e}[2016/01/01]
+\NeedsTeXFormat{LaTeX2e}[2019/01/01]
\ProvidesPackage{curve2e}%
 [20191021 v.2.0.4 Extension package for pict2e]
+ [20191130 v.2.0.6 Extension package for pict2e]
\IfFileExists{xfp.sty}{%
 \RequirePackage{color}
 \RequirePackageWithOptions{pict2e}[2014/01/01]
 \@ifl at aded{sty}{xparse}{}{\RequirePackage{xparse}}
 \@ifl at aded{sty}{xfp}{}{\RequirePackage{xfp}}%
+ \RequirePackage{color}
+ \RequirePackageWithOptions{pict2e}[2014/01/01]
+ \@ifl at aded{sty}{xparse}{}{\RequirePackage{xparse}}
+ \@ifl at aded{sty}{xfp}{}{\RequirePackage{xfp}}%
}{%
\RequirePackage{curve2ev161}%
\PackageWarningNoLine{curve2e}{%
@@ 35,6 +35,12 @@
***************************************\MessageBreak}%
\endinput
}
+\AtBeginDocument{\@ifpackageloaded{xfp}{%
+\ExplSyntaxOn
+\ProvideExpandableDocumentCommand\fptest{m}{\fp_compare:nTF{#1}}
+\ProvideExpandableDocumentCommand\fpdowhile{m m}{\fp_do_while:nn{#1}{#2}}
+\ExplSyntaxOff
+}{}}
\def\TRON{\tracingcommands\tw@ \tracingmacros\tw@}%
\def\TROF{\tracingcommands\z@ \tracingmacros\z@}%
\ifx\undefined\@tdA \newdimen\@tdA \fi
@@ 64,93 +70,148 @@
\edef\sc at lelen{\fpeval{1 / abs(\d at mX)}}\relax
\@linelen=\sc at lelen\@linelen
\fi
 \moveto(0,0)
 \pIIe at lineto{\d at mX\@linelen}{\d at mY\@linelen}%
+ \moveto(0,0)\pIIe at lineto{\d at mX\@linelen}{\d at mY\@linelen}%
\strokepath
\fi
\endgroup\ignorespaces}%
+\let\originalmoveto\moveto
+\let\originallineto\lineto
+\let\originalcurveto\curveto
+
+\def\moveto(#1){\GetCoord(#1)\MTx\MTy
+ \originalmoveto(\MTx,\MTy)\ignorespaces}
+\def\lineto(#1){\GetCoord(#1)\LTx\LTy
+ \originallineto(\LTx,\LTy)\ignorespaces}
+\def\curveto(#1)(#2)(#3){\GetCoord(#1)\CTpx\CTpy
+ \GetCoord(#2)\CTsx\CTsy\GetCoord(#3)\CTx\CTy
+ \originalcurveto(\CTpx,\CTpy)(\CTsx,\CTsy)(\CTx,\CTy)\ignorespaces}
+
+\def\IsPolar#1:#2?{\def\@TempOne{#2}\unless\ifx\@TempOne\empty
+ \expandafter\@firstoftwo\else
+ \expandafter\@secondoftwo\fi}
+
\ifx\Dashline\undefined
 \def\Dashline{\@ifstar{\Dashline@@}{\Dashline@}}
+ \def\Dashline{\@ifstar{\Dashline@}{\Dashline@}}% bckwd compatibility
+ \let\Dline\Dashline
 \def\Dashline@(#1)(#2)#3{%
 \bgroup
 \countdef\NumA3254\countdef\NumB3252\relax
 \GetCoord(#1)\@tA\@tB \MakeVectorFrom\@tA\@tB to\V at ttA
 \GetCoord(#2)\@tA\@tB \MakeVectorFrom\@tA\@tB to\V at ttB
+ \def\Dashline@(#1)(#2)#3{\put(#1){%
+ \GetCoord(#1)\@tA\@tB \MakeVectorFrom\@tA\@tB to\V at ttA
+ \GetCoord(#2)\@tA\@tB \MakeVectorFrom\@tA\@tB to\V at ttB
+ \IsPolar#2:?{% Polar
+ \Dashline@@(0,0)(\V at ttB){#3}}%
+ {% Cartesian
\SubVect\V at ttA from\V at ttB to\V at ttC
 \ModOfVect\V at ttC to\DlineMod
 \DivideFN\DlineMod by#3 to\NumD
 \NumA=\fpeval{trunc(\NumD,0)}\relax
 \unless\ifodd\NumA\advance\NumA\@ne\fi
 \NumB=\NumA \divide\NumB\tw@
 \DividE\DlineMod\p@ by\NumA\p@ to\D at shMod
 \DividE\p@ by\NumA\p@ to \@tempa
 \MultVect\V at ttC by\@tempa,0 to\V at ttB
 \MultVect\V at ttB by 2,0 to\V at ttC
 \advance\NumB\@ne
 \edef\@mpt{\noexpand\egroup
 \noexpand\multiput(\V at ttA)(\V at ttC){\number\NumB}%
 {\noexpand\LIne(\V at ttB)}}%
 \@mpt\ignorespaces}%
 \let\Dline\Dashline
+ \Dashline@@(0,0)(\V at ttC){#3}%
+ }
+}}
 \def\Dashline@@(#1)(#2)#3{\put(#1){\Dashline@(0,0)(#2){#3}}}
+ \def\Dashline@@(#1)(#2)#3{%
+ \countdef\NumA3254\countdef\NumB3252\relax
+ \GetCoord(#1)\@tA\@tB \MakeVectorFrom\@tA\@tB to\V at ttA
+ \GetCoord(#2)\@tA\@tB \MakeVectorFrom\@tA\@tB to\V at ttB
+ \SubVect\V at ttA from\V at ttB to\V at ttC
+ \ModOfVect\V at ttC to\DlineMod
+ \DivideFN\DlineMod by#3 to\NumD
+ \NumA=\fpeval{trunc(\NumD,0)}\relax
+ \unless\ifodd\NumA\advance\NumA\@ne\fi
+ \NumB=\NumA \divide\NumB\tw@
+ \DividE\DlineMod\p@ by\NumA\p@ to\D at shMod
+ \DividE\p@ by\NumA\p@ to \@tempa
+ \Multvect{\V at ttC}{\@tempa,0}\V at ttB
+ \Multvect{\V at ttB}{2,0}\V at ttC
+ \advance\NumB\@ne
+ \put(\V at ttA){\multiput(0,0)(\V at ttC){\NumB}{\LIne(\V at ttB)}}
+ \ignorespaces}
\fi
\ifx\Dotline\undefined
 \def\Dotline{\@ifstar{\Dotline@@}{\Dotline@}}
 \def\Dotline@(#1)(#2)#3{%
 \bgroup
 \countdef\NumA 3254\relax \countdef\NumB 3255\relax
 \GetCoord(#1)\@tA\@tB \MakeVectorFrom\@tA\@tB to\V at ttA
 \GetCoord(#2)\@tA\@tB \MakeVectorFrom\@tA\@tB to\V at ttB
 \SubVect\V at ttA from\V at ttB to\V at ttC
 \ModOfVect\V at ttC to\DotlineMod
 \DivideFN\DotlineMod by#3 to\NumD
 \NumA=\fpeval{trunc(\NumD,0)}\relax
 \DivVect\V at ttC by\NumA,0 to\V at ttB
 \advance\NumA\@ne
 \edef\@mpt{\noexpand\egroup
 \noexpand\multiput(\V at ttA)(\V at ttB){\number\NumA}%
 {\noexpand\makebox(0,0){\noexpand\circle*{0.5}}}}%
 \@mpt\ignorespaces}%
+ \def\Dotline{\@ifstar{\Dotline@}{\Dotline@}}% backwards compatibility
+ \def\Dotline@(#1)(#2)#3{\put(#1){%
+ \IsPolar#2:?{% Polar
+ \Dotline@@(0,0)(#2){#3}}
+ {% Cartesian
+ \CopyVect#1to\V at ttA
+ \CopyVect#2to\V at ttB
+ \SubVect\V at ttA from\V at ttB to\V at ttC
+ \Dotline@@(0,0)(\V at ttC){#3}}%
+ }}
 \def\Dotline@@(#1)(#2)#3{\put(#1){\Dotline@(0,0)(#2){#3}}}%
+ \def\Dotline@@(#1)(#2)#3{%
+ \countdef\NumA 3254\relax
+ \countdef\NumB 3255\relax
+ \CopyVect#1to\V at ttA
+ \CopyVect#2to\V at ttB
+ \SubVect\V at ttA from\V at ttB to\V at ttC
+ \ModOfVect\V at ttC to\DotlineMod
+ \DivideFN\DotlineMod by#3 to\NumD
+ \NumA=\fpeval{trunc(\NumD,0)}\relax
+ \Divvect{\V at ttC}{\NumA,0}\V at ttB
+ \advance\NumA\@ne
+ \put(\V at ttA){\multiput(0,0)(\V at ttB){\NumA}{\makebox(0,0)%
+ {\circle*{0.5}}}}
+ \ignorespaces
+ }%
\fi
\AtBeginDocument{\@ifpackageloaded{esopic}{%
\renewcommand\LenToUnit[1]{\strip at pt\dimexpr#1*\p@/\unitlength}}{}}%
\def\GetCoord(#1)#2#3{%
\expandafter\SplitNod@\expandafter(#1)#2#3\ignorespaces}
\def\SplitNod@(#1)#2#3{\isnot at polar#1:!!(#1)#2#3}%
\def\isnot at polar#1:#2!!{\def\@tempOne{#2}\ifx\@tempOne\empty
\expandafter\@firstoftwo\else
\expandafter\@secondoftwo\fi
{\SplitNod@@}{\SplitPolar@@}}
+\def\GetCoord(#1)#2#3{\bgroup\edef\x{\egroup\noexpand\IsPolar#1:?}\x
+{% Polar
+ \bgroup\edef\x{\egroup\noexpand\SplitPolar(#1)}\x\SCt at X\SCt at Y}%
+{% Cartesian
+ \bgroup\edef\x{\egroup\noexpand\SplitCartesian(#1)}\x\SCt at X\SCt at Y}%
+ \edef#2{\SCt at X}\edef#3{\SCt at Y}\ignorespaces}
\def\SplitNod@@(#1,#2)#3#4{\edef#3{#1}\edef#4{#2}}%
\def\SplitPolar@@(#1:#2)#3#4{\DirFromAngle#1to\@DirA
\ScaleVect\@DirA by#2to\@DirA
\expandafter\SplitNod@@\expandafter(\@DirA)#3#4}
+\def\SplitPolar(#1:#2)#3#4{%
+ \edef#3{\fpeval{#2 * cosd#1}}\edef#4{\fpeval{#2 * sind#1}}}
+
+\def\SplitCartesian(#1,#2)#3#4{\edef#3{#1}\edef#4{#2}}
+
\let\originalput\put
\def\put(#1){\bgroup\GetCoord(#1)\@tX\@tY
\edef\x{\noexpand\egroup\noexpand\originalput(\@tX,\@tY)}\x}
\RenewDocumentCommand{\multiput}{ d() d() m m o }{%
\IfNoValueTF{#1}{\PackageError{curve2e}{%
 \string\multiput\space initial point coordinates missing}%
 {Nothing done}}%
 {\IfNoValueTF{#2}{\PackageError{curve2e}{%
 \string\multiput\space Increment components missing}%
 {Nothing done}%
 }%
 {\GetCoord(#2)\dX\dY
 \put(#1){\def\X{0}\def\Y{0}\@multicnt=#3\relax
 \@whilenum \@multicnt > \z@\do{%
 \put(\X,\Y){#4}\IfValueTF{#5}{#5}{%
 \edef\X{\fpeval{\X+\dX}}\edef\Y{\fpeval{\Y+\dY}}}%
+\RenewDocumentCommand{\multiput}{O{0,0} d() d() m m o }{%
+ \IfNoValueTF{#2}{\PackageError{curve2e}%
+ {\string\multiput\space initial point coordinates missing}%
+ {Nothing done}
+ }%
+ {\IfNoValueTF{#3}{\PackageError{curve2e}
+ {\string\multiput\space Increment components missing}%
+ {Nothing done}
+ }
+ {\put(#1){\let\c at multicnt\@multicnt
+ \CopyVect #2 to \R
+ \CopyVect#3 to\D
+ \@multicnt=#4\relax
+ \@whilenum \@multicnt > \z@\do{%
+ \put(\R){#5}%
+ \IfValueTF{#6}{#6}{\AddVect#3 and\R to \R}%
\advance\@multicnt\m at ne
 }%
 }}
 }%
+ }
+ }
+ }
+ }\ignorespaces
}
+\NewDocumentCommand{\xmultiput}{O{0,0} d() d() m m o }{%
+\IfNoValueTF{#2}{\PackageError{curve2e}{%
+ \string\Xmultiput\space initial point coordinates missing}%
+ {Nothing done}}%
+ {\IfNoValueTF{#3}{\PackageError{curve2e}{%
+ \string\Xmultiput\space Increment components missing}%
+ {Nothing done}}%
+ {\put(#1)%
+ {\let\c at multicnt\@multicnt
+ \CopyVect #2 to \R
+ \CopyVect #3 to \D
+ \@multicnt=\@ne
+ \fpdowhile{\value{multicnt} < \inteval{#4+1}}% Test
+ {%
+ \put(\R){#5}
+ \IfValueTF{#6}{#6}{%
+ \AddVect#3 and\R to \R}
+ \advance\@multicnt\@ne
+ }
+ }
+ }}\ignorespaces
+}
\def\vector(#1)#2{%
\begingroup
\GetCoord(#1)\d at mX\d at mY
@@ 246,62 +307,30 @@
\advance\@tempcnta\count252\fi\edef#3{\number\@tempcnta}\ignorespaces}%
\def\Integer#1.#2??{#1}%
\def\DividE#1by#2to#3{%
 \edef#3{\fpeval{#1 / #2}}\relax
}
+\def\DividE#1by#2to#3{\edef#3{\fpeval{#1 / #2}}}
\let\DivideFN\DividE
\def\MultiplY#1by#2to#3{\edef#3{\fpeval{#1 * #2}}}\relax
\let\MultiplyFN\MultiplY
\unless\ifdefined\Numero
 \def\Numero#1#2{\bgroup\dimen3254=#2\relax
 \edef\x{\noexpand\egroup\noexpand\edef\noexpand#1{%
 \strip at pt\dimen3254}}\x\ignorespaces}%
+ \def\Numero#1#2{\edef#1{\fpeval{round(#2,6)}}\ignorespaces}%
\fi
\def\SinOf#1to#2{\edef#2{\fpeval{round(sind#1,6)}}}\relax
\def\CosOf#1to#2{\edef#2{\fpeval{round(cosd#1,6)}}}\relax
\def\ArgOfVect#1to#2{\bgroup\GetCoord(#1){\t at X}{\t at Y}%
\def\s at gno{}%
\ifdim\t at X\p@=\z@
 \ifdim\t at Y\p@=\z@
 \def\ArcTan{0}% vettore nullo
 \else
 \def\ArcTan{90}% vettore verticale
 \ifdim\t at Y\p@<\z@\def\ArcTan{90}\fi
 \fi
\else
 \ifdim\t at Y\p@=\z@% vettore orizzontale
 \ifdim\t at X\p@<\z@
 \def\ArcTan{180}%
 \else
 \def\ArcTan{0}%
 \fi
 \else % vettore qualsiasi
 \edef\ArcTan{\fpeval{atand(\t at Y / \t at X)}}\relax
 \ifdim\t at X\p@<\z@% vettore nei quadranti di sinistra
 \ifdim\t at Y\p@<\z@
 \edef\ArcTan{\fpeval{\ArcTan  180}}\relax
 \else
 \edef\ArcTan{\fpeval{\ArcTan + 180}}\relax
 \fi
 \fi
 \fi
\fi
\edef\x{\noexpand\egroup\noexpand\edef\noexpand#2{\ArcTan}}%
\x\ignorespaces}
+\def\ArgOfVect#1to#2{\GetCoord(#1){\t at X}{\t at Y}%
+\fptest{\t at X=\z@ && \t at Y=\z@}{\edef#2{0}}{%
+\edef#2{\fpeval{round(atand(\t at Y,\t at X),6)}}}\ignorespaces}
\def\MakeVectorFrom#1#2to#3{\edef#3{#1,#2}\ignorespaces}%
\def\CopyVect#1to#2{\edef#2{#1}\ignorespaces}%
\def\ModOfVect#1to#2{\GetCoord(#1)\t at X\t at Y
\edef#2{\fpeval{sqrt(\t at X*\t at X + \t at Y*\t at Y)}}\relax
+\edef#2{\fpeval{round(sqrt(\t at X*\t at X + \t at Y*\t at Y),6)}}%
\ignorespaces}%
\def\DirOfVect#1to#2{\GetCoord(#1)\t at X\t at Y
\ModOfVect#1to\@tempa
\unless\ifdim\@tempa\p@=\z@
 \DividE\t at X by\@tempa to\t at X
 \DividE\t at Y by\@tempa to\t at Y
\fi
\MakeVectorFrom\t at X\t at Y to#2\ignorespaces}%
+\fptest{\@tempa=\z@}{}{%
+ \edef\t at X{\fpeval{round(\t at X/\@tempa,6)}}%
+ \edef\t at Y{\fpeval{round(\t at Y/\@tempa,6)}}%
+}\MakeVectorFrom\t at X\t at Y to#2\ignorespaces}%
\def\ModAndDirOfVect#1to#2and#3{%
\GetCoord(#1)\t at X\t at Y
\ModOfVect#1to#2%
\DirOfVect#1to#3\ignorespaces}%
\def\DistanceAndDirOfVect#1minus#2to#3and#4{%
@@ 312,12 +341,12 @@
\def\YpartOfVect#1to#2{%
\GetCoord(#1)\@tempa#2\ignorespaces}%
\def\DirFromAngle#1to#2{%
\CosOf#1to\t at X
\SinOf#1to\t at Y
+\edef\t at X{\fpeval{round(cosd#1,6)}}%
+\edef\t at Y{\fpeval{round(sind#1,6)}}%
\MakeVectorFrom\t at X\t at Y to#2\ignorespaces}%
\def\ScaleVect#1by#2to#3{\GetCoord(#1)\t at X\t at Y
\edef\t at X{\fpeval{#2 * \t at X}}\relax
\edef\t at Y{\fpeval{#2 * \t at Y}}\relax
+\edef\t at X{\fpeval{#2 * \t at X}}%
+\edef\t at Y{\fpeval{#2 * \t at Y}}%
\MakeVectorFrom\t at X\t at Y to#3\ignorespaces}%
\def\ConjVect#1to#2{\GetCoord(#1)\t at X\t at Y
\edef\t at Y{\t at Y}%
@@ 324,30 +353,42 @@
\MakeVectorFrom\t at X\t at Y to#2\ignorespaces}%
\def\AddVect#1and#2to#3{\GetCoord(#1)\tu at X\tu at Y
\GetCoord(#2)\td at X\td at Y
\edef\t at X{\fpeval{\tu at X + \td at X}}\relax
\edef\t at Y{\fpeval{\tu at Y + \td at Y}}\relax
+\edef\t at X{\fpeval{\tu at X + \td at X}}%
+\edef\t at Y{\fpeval{\tu at Y + \td at Y}}%
\MakeVectorFrom\t at X\t at Y to#3\ignorespaces}%
\def\SubVect#1from#2to#3{\GetCoord(#1)\tu at X\tu at Y
\GetCoord(#2)\td at X\td at Y
\edef\t at X{\fpeval{\td at X  \tu at X}}\relax
\edef\t at Y{\fpeval{\td at Y  \tu at Y}}\relax
+\edef\t at X{\fpeval{\td at X  \tu at X}}%
+\edef\t at Y{\fpeval{\td at Y  \tu at Y}}%
\MakeVectorFrom\t at X\t at Y to#3\ignorespaces}%
\def\MultVect#1by{\@ifstar{\@ConjMultVect#1by}{\@MultVect#1by}}%
\def\@MultVect#1by#2to#3{\GetCoord(#1)\tu at X\tu at Y
\GetCoord(#2)\td at X\td at Y
\edef\t at X{\fpeval{\tu at X * \td at X  \tu at Y * \td at Y}}\relax
\edef\t at Y{\fpeval{\tu at Y * \td at X + \tu at X * \td at Y}}\relax
\MakeVectorFrom\t at X\t at Y to#3\ignorespaces}%
\def\@ConjMultVect#1by#2to#3{\GetCoord(#1)\tu at X\tu at Y
\GetCoord(#2)\td at X\td at Y
\edef\t at X{\fpeval{\tu at X * \td at X + \tu at Y * \td at Y}}\relax
\edef\t at Y{\fpeval{\tu at Y * \td at X  \tu at X * \td at Y}}\relax
\MakeVectorFrom\t at X\t at Y to#3\ignorespaces}
\def\DivVect#1by#2to#3{\ModAndDirOfVect#2to\@Mod and\@Dir
\edef\@Mod{\fpeval{1 / \@Mod}}\relax
+\def\ModAndAngleOfVect#1to#2and#3{\ModOfVect#1to#2\relax
+\ArgOfVect#1to#3\ignorespaces}
+\countdef\MV at C=2560\relax
+\NewDocumentCommand\Multvect{m s m s m}{%
+\MV at C=0
+\ModAndAngleOfVect#1to\MV at uM and\MV at uA
+\ModAndAngleOfVect#3to\MV at dM and\MV at dA
+\IfBooleanT{#2}{\MV at C=1}\relax
+\IfBooleanT{#4}{\MV at C=1}\relax
+\unless\ifnum\MV at C=0\edef\MV at dA{\MV at dA}\fi
+\edef\MV at rM{\fpeval{round((\MV at uM * \MV at dM),6)}}%
+\edef\MV at rA{\fpeval{round((\MV at uA + \MV at dA),6)}}%
+\GetCoord(\MV at rA:\MV at rM)\t at X\t at Y
+\MakeVectorFrom\t at X\t at Y to#5}
+\def\MultVect#1by{\@ifstar{\let\MV at c\@ne\@MultVect#1by}%
+ {\let\MV at c\empty\@MultVect#1by}}
+
+\def\@MultVect#1by#2to#3{%
+ \unless\ifx\MV at c\empty\Multvect{#1}{#2}*{#3}\else
+ \Multvect{#1}{#2}{#3}\fi}
+\def\DivVect#1by#2to#3{\Divvect{#1}{#2}{#3}}
+
+\NewDocumentCommand\Divvect{ m m m }{%
+\ModAndDirOfVect#2to\@Mod and\@Dir
+\edef\@Mod{\fpeval{1 / \@Mod}}%
\ConjVect\@Dir to\@Dir
\ScaleVect#1by\@Mod to\@tempa
\MultVect\@tempa by\@Dir to#3\ignorespaces}%
+\Multvect{\@tempa}{\@Dir}#3\ignorespaces}%
\def\Arc(#1)(#2)#3{\begingroup
\@tdA=#3\p@
\unless\ifdim\@tdA=\z@
@@ 378,7 +419,7 @@
\Numero\@gradi\@tdA
\SubVect\@pPun from\@Cent to\@V
\AddVect\@V and\@Cent to\@sPun
 \MultVect\@V by0,1.3333333to\@V
+ \Multvect{\@V}{0,1.3333333to}\@V
\if\Segno\ScaleVect\@V by1to\@V\fi
\AddVect\@pPun and\@V to\@pcPun
\AddVect\@sPun and\@V to\@scPun
@@ 393,7 +434,7 @@
\ifdim\@tdA>\z@
\DirFromAngle\@gradi to\@Dir \if\Segno\ConjVect\@Dir to\@Dir \fi
\SubVect\@Cent from\@pPun to\@V
 \MultVect\@V by\@Dir to\@V
+ \Multvect{\@V}{\@Dir}\@V
\AddVect\@Cent and\@V to\@sPun
\@tdA=.5\@tdA \Numero\@gradi\@tdA
\DirFromAngle\@gradi to\@Phimezzi
@@ 411,10 +452,10 @@
\fi
\SubVect\@sPun from\@pPun to\@V
\DirOfVect\@V to\@V
 \MultVect\@Phimezzi by\@V to\@Phimezzi
+ \Multvect{\@Phimezzi}{\@V}\@Phimezzi
\AddVect\@sPun and\@Phimezzi to\@scPun
\ScaleVect\@V by1to\@V
 \MultVect\@mPhimezzi by\@V to\@mPhimezzi
+ \Multvect{\@mPhimezzi}{\@V}\@mPhimezzi
\AddVect\@pPun and\@mPhimezzi to\@pcPun
\GetCoord(\@pcPun)\@pcPunX\@pcPunY
\GetCoord(\@scPun)\@scPunX\@scPunY
@@ 453,9 +494,9 @@
\@tdD=57.29578\@tdD \Numero\DeltaGradi\@tdD
\@tdD=\ifx\Segno\fi\@gradi\p@ \Numero\@tempa\@tdD
\DirFromAngle\@tempa to\@Dir
\MultVect\@V by\@Dir to\@sPun
+\Multvect{\@V}{\@Dir}\@sPun
\edef\@tempA{\ifx\Segno\m at ne\else\@ne\fi}%
\MultVect\@sPun by 0,\@tempA to\@vPun
+\Multvect{\@sPun}{0,\@tempA}\@vPun
\DirOfVect\@vPun to\@Dir
\AddVect\@sPun and #1 to \@sPun
\GetCoord(\@sPun)\@tdX\@tdY
@@ 462,7 +503,7 @@
\@tdD\ifx\Segno\fi\DeltaGradi\p@
\@tdD=.5\@tdD \Numero\DeltaGradi\@tdD
\DirFromAngle\DeltaGradi to\@Dird
\MultVect\@Dir by*\@Dird to\@Dir
+\Multvect{\@Dir}*{\@Dird}\@Dir%
\GetCoord(\@Dir)\@xnum\@ynum
\put(\@tdX,\@tdY){\vector(\@xnum,\@ynum){0}}%
\@tdE =\ifx\Segno\fi\DeltaGradi\p@
@@ 488,9 +529,9 @@
\@tdD=\DeltaGradi\p@ \@tdD=57.29578\@tdD \Numero\DeltaGradi\@tdD
\@tdD=\if\Segno\fi\@gradi\p@ \Numero\@tempa\@tdD
\DirFromAngle\@tempa to\@Dir
\MultVect\@V by\@Dir to\@sPun% corrects the end point
+\Multvect{\@V}{\@Dir}\@sPun% corrects the end point
\edef\@tempA{\if\Segno\fi1}%
\MultVect\@sPun by 0,\@tempA to\@vPun
+\Multvect{\@sPun}{0,\@tempA}\@vPun
\DirOfVect\@vPun to\@Dir
\AddVect\@sPun and #1 to \@sPun
\GetCoord(\@sPun)\@tdX\@tdY
@@ 497,25 +538,25 @@
\@tdD\if\Segno\fi\DeltaGradi\p@
\@tdD=.5\@tdD \Numero\@tempB\@tdD
\DirFromAngle\@tempB to\@Dird
\MultVect\@Dir by*\@Dird to\@Dir
+\Multvect{\@Dir}*{\@Dird}\@Dir
\GetCoord(\@Dir)\@xnum\@ynum
\put(\@tdX,\@tdY){\vector(\@xnum,\@ynum){0}}% end point arrowt ip
+\put(\@tdX,\@tdY){\vector(\@xnum,\@ynum){0}}% end point arrow tip
\@tdE =\DeltaGradi\p@
\advance\@tdA 2\@tdE \Numero\@gradi\@tdA
\CopyVect#1to\@Cent \GetCoord(\@pPun)\@pPunX\@pPunY
\SubVect\@Cent from\@pPun to \@V
\edef\@tempa{\if\Segno\else\fi\@ne}%
\MultVect\@V by0,\@tempa to\@vPun
+\Multvect{\@V}{0,\@tempa}\@vPun
\@tdE\if\Segno\fi\DeltaGradi\p@
\Numero\@tempB{0.5\@tdE}%
\DirFromAngle\@tempB to\@Dird
\MultVect\@vPun by\@Dird to\@vPun% corrects the starting point
+\Multvect{\@vPun}{\@Dird}\@vPun% corrects the starting point
\DirOfVect\@vPun to\@Dir\GetCoord(\@Dir)\@xnum\@ynum
\put(\@pPunX,\@pPunY){\vector(\@xnum,\@ynum){0}}% starting point arrow tip
\edef\@tempa{\if\Segno\fi\DeltaGradi}%
\DirFromAngle\@tempa to \@Dir
\SubVect\@Cent from\@pPun to\@V
\MultVect\@V by\@Dir to\@V
+\Multvect{\@V}{\@Dir}\@V
\AddVect\@Cent and\@V to\@pPun
\GetCoord(\@pPun)\@pPunX\@pPunY
\@@Arc
@@ 570,8 +611,8 @@
\expandafter\DirOfVect\@tempA to\@Duno
\bgroup\unless\ifx\@tempB\empty\GetCoord(\@tempB)\@Tzero\@Tuno\fi
\DistanceAndDirOfVect\@Puno minus\@Pzero to\@Chord and\@DirChord
\MultVect\@Dzero by*\@DirChord to \@Dpzero
\MultVect\@Duno by*\@DirChord to \@Dpuno
+\Multvect{\@Dzero}*{\@DirChord}\@Dpzero
+\Multvect{\@Duno}*{\@DirChord}\@Dpuno
\GetCoord(\@Dpzero)\@DXpzero\@DYpzero
\GetCoord(\@Dpuno)\@DXpuno\@DYpuno
\DivideFN\@Chord by2 to\@semichord
@@ 659,7 +700,7 @@
\def\QurveTo#1WithDir#2{%
\edef\@Puno{#1}\DirOfVect#2to\@Duno\bgroup
\DistanceAndDirOfVect\@Puno minus\@Pzero to\@Chord and\@DirChord
\MultVect\@Dzero by*\@Duno to \@Scalar
+\Multvect{\@Dzero}*{\@Duno}\@Scalar
\YpartOfVect\@Scalar to \@YScalar
\ifdim\@YScalar\p@=\z@
\PackageWarning{curve2e}%
@@ 669,8 +710,8 @@
a dotted line.\MessageBreak}%
\Dotline(\@Pzero)(\@Puno){2}\relax
\else
\MultVect\@Dzero by*\@DirChord to \@Dpzero
\MultVect\@Duno by*\@DirChord to \@Dpuno
+\Multvect{\@Dzero}*{\@DirChord}\@Dpzero
+\Multvect{\@Duno}*{\@DirChord}\@Dpuno
\GetCoord(\@Dpzero)\@DXpzero\@DYpzero
\GetCoord(\@Dpuno)\@DXpuno\@DYpuno
\MultiplyFN\@DXpzero by\@DXpuno to\@XXD
More information about the texlivecommits
mailing list