diff options
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/latex/euclideangeometry/README.txt | 52 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/euclideangeometry/euclideangeometry-man.pdf | bin | 0 -> 558102 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/euclideangeometry/euclideangeometry-man.tex | 1657 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/euclideangeometry/euclideangeometry.pdf | bin | 0 -> 455029 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/euclideangeometry/euclideangeometry.dtx | 1588 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/euclideangeometry/euclideangeometry.sty | 518 | ||||
-rwxr-xr-x | Master/tlpkg/bin/tlpkg-ctan-check | 2 | ||||
-rw-r--r-- | Master/tlpkg/tlpsrc/collection-mathscience.tlpsrc | 1 | ||||
-rw-r--r-- | Master/tlpkg/tlpsrc/euclideangeometry.tlpsrc | 0 |
9 files changed, 3817 insertions, 1 deletions
diff --git a/Master/texmf-dist/doc/latex/euclideangeometry/README.txt b/Master/texmf-dist/doc/latex/euclideangeometry/README.txt new file mode 100644 index 00000000000..28e984c5599 --- /dev/null +++ b/Master/texmf-dist/doc/latex/euclideangeometry/README.txt @@ -0,0 +1,52 @@ +%% +%% This is file `README.txt', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% euclideangeometry.dtx (with options: `readme') +%% +%% Copyright (C) 2020 Claudio Beccari all rights reserved. +%% License information appended +%% +File README.txt for package euclideangeometry + [2020-02-02 v.0.1.2 Extension package for curve2e] + +The package bundle euclideangeometry is composed of the following files + +euclideangeometry.dtx +euclideangeometry.pdf +euclideangeometry-man.tex +euclideangeometry-man.pdf +README.txt + +euclideangeometry.dtx is the documented TeX source file of package +euclideangeometry.sty; you get euclideangeometry.sty, +euclideangeometry.pdf by running pdflatex on euclideangeometry.dtx. + +README.txt, this file, contains general information. + +euclideangeometry-man.tex and euclideangeometry-man.pdf are +the source file and the readable document containing the end +user manual. +In other words euclideangeometry.pdf is oriented towards the +developers and euclideangeometry-man.pdf to the end users. + +Claudio Beccari + +claudio dot beccari at gmail dot com +%% +%% Distributable under the LaTeX Project Public License, +%% version 1.3c or higher (your choice). The latest version of +%% this license is at: http://www.latex-project.org/lppl.txt +%% +%% This work is "maintained" +%% +%% This work consists of files: +%% 1) euclideangeometry.dtx, and the derived files euclideangeometry.sty +%% and euclideangeometry.pdf, +%% 2) euclideangeometry-man.tex and the derived file euclideangeometry-man.pdf, +%% 3) the auxiliary derived file README.txt +%% +%% +%% End of file `README.txt'. diff --git a/Master/texmf-dist/doc/latex/euclideangeometry/euclideangeometry-man.pdf b/Master/texmf-dist/doc/latex/euclideangeometry/euclideangeometry-man.pdf Binary files differnew file mode 100644 index 00000000000..1364546e341 --- /dev/null +++ b/Master/texmf-dist/doc/latex/euclideangeometry/euclideangeometry-man.pdf diff --git a/Master/texmf-dist/doc/latex/euclideangeometry/euclideangeometry-man.tex b/Master/texmf-dist/doc/latex/euclideangeometry/euclideangeometry-man.tex new file mode 100644 index 00000000000..9c668874fa0 --- /dev/null +++ b/Master/texmf-dist/doc/latex/euclideangeometry/euclideangeometry-man.tex @@ -0,0 +1,1657 @@ +% !TEX encoding = UTF-8 Unicode +% !TEX TS-program = pdflatex + +\documentclass[11pt,titlepage]{article}\errorcontextlines=100 +\usepackage[T1]{fontenc} +\usepackage[utf8]{inputenc} +\usepackage[english]{babel} +\usepackage{lmodern,textcomp,mflogo} +\usepackage{amsmath,fancyvrb,graphicx,verbatim,afterpage,trace} +\usepackage{etoolbox,enumitem,xspace,xcolor,euclideangeometry} +\usepackage{url} + +\AfterEndPreamble{% +\apptocmd{\TeX}{{}\xspace}{}{} +\apptocmd{\LaTeX}{{}\xspace}{}{}} + +\newcommand\heart[3]{% +\edef\X{\fpeval{#1*16*(sind(#2)^3)}} +\edef\Y{\fpeval{#1*(13*cosd(#2) - 5*cosd(2*#2) + - 2*cosd(3*#2) -cosd(4*#2)+2.4)}} +\CopyVect\X,\Y to#3} +\let\cuore\heart + +\begin{document} + +\begin{titlepage} +\thispagestyle{empty} +\centering +\textsc{\large Claudio Beccari}\\[2ex] +\texttt{claudio dot beccari at gmail dot com} + +\vspace{\stretch{2}} + +{\LARGE\scshape The \pack{euclideangeometry} package\\ +{\large user manual}\par} + +\vspace{\baselineskip} + + +\GetFileInfo{euclideangeometry.sty} +Version \fileversion\ of \filedate + +\vspace*{\stretch{5}} +\end{titlepage} + + \begin{abstract} + This file further extends the functionalities of the \pack{curve2e} + package, which, on turn, is an extension of the \pack{pict2e} package + to the standard \env{picture} environment as defined in the \LaTeX\ + kernel source file. + + The \pack{curve2e} package was upgraded a the beginning of 2020; the + material + of this new package, might have been included in the former one, but is + is sospecific, that we preferred defining a standalone one; this package + takes care of requesting the packages it depends from. + + The purpose is to provide the tools to draw most of the geometrical + constructions that a high school instructor or bachelor degree professor + might need to teach geometry. The connection to Euclide depends on the + fact that in its times calculations were made with ruler, compass, and, + apparently, also with ellipsograph, + + The user of this package has available all the machinery provided by + the \pack{pict2e} and \pack{curve2e} packages, in order to define new functionalities + and build macros that draw the necessary lines, circles, and other such + objects, as they would have done in the ancient times. Actually just one + macro is programmed to solve a linear system of equations + \end{abstract} + + \tableofcontents + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + \section*{Warning} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +The \pack{euclideangeometry} package requires the advanced functionalities of the \LaTeX\!3 (L3) language; if such functionalities are not available for any reason (incomplete/basic installation of the \TeX system; legacy installation of the \TeX system; the \TeX system has not been updated; \dots) input of this package is stopped, the whole job is aborted, and a visible message is issued. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + \section{Introduction} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + The \pack{picture} environment has been available since the very beginning + of \LaTeX in 1985. At that time it was a very simple environment + that allowed to draw very simple line graphics with many limitations. + When \LaTeX was upgraded from \LaTeX\!2.09 to \LaTeXe in 1994, Leslie + Lamport announced an upgrade that eventually became available in 2003 + with package \pack{pict2e}; in 2006 I wrote the \pack{curve2e} package that added + many more functionalities; both packages were upgraded during these + years; and now line graphics with the \env{picture} environment can perform + pretty well. The package \pack{euclideangeometry} adds even more specific + functionalities in order to produce geometric drawings as they were + possible in the old times, when calculus and analytic geometry were + not available. + + In these years other drawing programs were made available to the \TeX + community; \pack{PSTricks} and \pack{TikZ} are the most known ones, but there are + other less known packages, that perform very well; among the latter + I would like to mention \pack{xpicture}, that relies on \pack{pict2e} and + \pack{curve2e}, but extends the functionalities with a very smart handling + of coordinate systems, that allow to draw many line drawings suitable + for teaching geometry in high schools and introductory courses in the + university bachelor degree programs. + + This package \pack{euclideangeomery} in a certain way follows the same + path of \pack{xpicture} but it avoids defining a new user language + interface; rather it builds new macros by using the same philosophy of + the recent \pack{curve2e} package. + + It is worth mentioning that now \pack{curve2e} accepts coordinates in both + cartesian and polar form; it allows to identify specific points of the + drawing with macros, so the same macro can be used over and over again to + address the same points.The package can draw lines, vectors, arcs + with no arrow tips, or with one arrow tip, or with arrow tips at both ends, + arcs included. The macros for drawing poly lines, polygons, circles, + generic curves (by means of Bézier cubic or quadratic splines) are + already available; such facilities are well documented and exemplified + in the user manual of \pack{curve2e} package. + + In what follows there will be several figures drawn with this package; + in the background there is a red grid where the meshes are + 10\,\cs{unitlenth} apart in both directions; they should help to + understand the position of the various drawings on the picture canvas. + This grid is useful also to the end user, while s/he is working on a + particular drawing, but when the drawing is finished, the user can + delete the grid command or comment ot that line of code. + For what regards the commands used to render the images, their codes can + be found in the documented code file \pack{euclideangeometry.pdf}. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + \section{Installing \pack{euclideangeometry}} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + You are not supposed to manually install package \pack{euclideangeometry}. + In facts you have to work with a complete and updated/upgraded \TeX + installation, otherwise this package won't work; this means that + you have done your updating after 2020-01-18. And this package is already + present in any modern updated complete installation of the \TeX system. + Nevertheless the package will load \pack{curve2e} with the wrong version + and file date, but this package will abort its own loading. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + \section{Loading \pack{euclideangeometry}} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + If you want to use the \pack{euclideangeometry} package, we suggest you load it with the following command: +\begin{flushleft}\obeylines +\cs{usepackage}\oarg{options}\Marg{euclideangeomery} +\end{flushleft} + The package will take care of managing the possible \meta{options} + and to call \pack{curve2e} with the specified options; on turn + \pack{curve2e} calls \pack{pict2e} passing on the \meta{options}; such + \meta{options} are only those usable by \pack{pict2e} because neither + \pack{curve2e} nor \pack{euclideangeometry} use any option. If the + user is invoking \pack{euclideangeometry}, it is certain s/he does + not want to use the native picture environment, but the modern + extended one; therefore the only meaningful possible options are + \opt{latex} and\opt{pstricks}; such options influence only the shape + of the arrow tips; with option \opt{latex} they are triangular, + while with \opt{pstricks} they have the shape of a stealth + aircraft. The difference is very small; therefore we imagine that + even if these options are available, they might never be used. + + Nothing happens if the user forgets this mechanism; therefore if s/he + loads \pack{curve2e} and/or \pack{pict2e}, before + \pack{euclideangeomentry} the only problem that might arise is an + “Option clash” error message; if two of these packages are selected + with different arrow tips; not impossible, of course, by we deem + it very unlikely. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + \section{Available commands} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + The commands available with the first extension \pack{pict2e} to the native + \amb{picture} environment, maintain their names but do not maintain the + same restrictions; in particular there are the following improvements. +\begin{enumerate}[noitemsep] + \item Lines and vectors are drawn as usual by \cs{put}ting in place + their forms, but their inclinations are not limited to a limited + number of slope parameters, originally specified with reciprocally + prime single digit values not exceeding~6 for lines, and~4 for vectors; + the length of these sloped objects is still their horizontal component; + now, the slopes may be described with any signed fractional number not + exceeding $2^{30}-1$ in absolute value; it still is a limited number of + slopes, but their combinations are practically countless. +% +\item There is no restriction on the minimum length of lines and vectors. +% +\item Circles and dots can be drawn at any size, not at that dozen + or so of finite sizes that were accepted with the original environment. +% +\item Ovals may be specified the corner curvature; the default + size of the quarter circles that make up the oval corners may be + specified; if no specification is given the radius of such corners + is the maximum that can be fitted in the oval; in practice it is + half the shortest value between the oval height and width. + +\item The quadratic Bézier splines do not require the specification + of the number of dots that were used by the native environment to + draw “arbitrary” curves; now they are drawn with continuous curved + lines. +\end{enumerate} + Some new commands were added by \pack{pict2e} +\begin{enumerate}[noitemsep] + +\item The third degree (cubic) Bézier splines are sort of new; certainly + now they are traced with continuous lines; if it is desired, it is + possible to replace the continuous line with a number of dots so as + to have a (unevenly) dotted curve. It suffices to specify the number + of dots the curve should be made with. + +\item\cs{arc} and \cs{arc*} draw an arc or a filled circular sector, + with their centers at the axes origin; therefore they need to be put + in place somewhere else by means of the usual \cs{put} command. + +\item The new command \cs{Line} traces a segment from one given point + to another point; it is very convenient to specify the end points + instead of the slope the line must have to go form the starting + point to the ending one. The command does not require the \cs{put} + command to put the segment in place; nevertheless it can be shifted + somewhere else with \cs{put} if it becomes necessary. + +\item the new command \cs{polyline} draws a sequence of connected + segments that form a piecewise linear “curve”; the way segments are + joined to one another depend from the “join” specifiers that + \pack{pict2e} has introduced; they will be described further on. + +\item \cs{polygon} and \cs{polygon*} produce closed paths as it would + be possible when using \cs{polyline} and specifying the last point + coincident with the first point of that curve. The closed path is + filled with the default color if the asterisk is used. +\end{enumerate} + + There were also the low level commands user interfaces to the various + drivers; these drivers really exist, but \pack{pict2e} + knows how to detect the correct language of the necessary drive; + the user is therefore allowed to pretend to ignore the existence + of such drivers; s/he can simply use these commands; their names are + almost self explanatory. +\begin{enumerate}[noitemsep] +\item \cs{moveto} Sets the start of a line tracing to an initial point. + +\item \cs{lineto} traces a segment up to a specified point. + +\item \cs{curveto} traces a third degree Bézier up to the third specified + point, while using the other two ones as control points.\footnote{If + these terms are unfamiliar, please read the \pack{pict2e} documentation.} + + \item \cs{circlearc} traces a circumference arc from the last line + point to a specified destination; its center, its angle amplitude, its + initial point are among the specified arguments, but the reader should + check on the \pack{pict2e} documentation for the details. + +\item[]\mbox{\bfseries Attention!} Notice that these commands produce + just information to trace lines, but by themselves they do not trace + anything; in order to actually trace the curve or do other operations + with what has been done after the user finished describing the line to + trace, the following low level commands must be used. + +\item A \cs{closepath} is necessary if it is desired to + join the last position to the initial one. But if the last point + specified coincides with the very first one, a closed loop is + effectively already completed. + +\item If a \cs{strokepath} command is used the line is drawn. + +\item If a \cs{fillpath} command is used, the line loop is filled by + the current color. Notice, if the described line is not a closed loop, + this filling command acts as if the line first point and last point were + joined by a straight line. + +\end{enumerate} + + While describing a line with the above low level commands, or with + the previous high level commands, lines and segments join and finish + as described hereafter; the following commands must be used, possibly + within a group, before actually tracing a specific line made up with + several joined lines or curves. Notice that their effect is just + visible with lines as thin as 1\,pt, and very visible with thicker + lines. +\begin{enumerate}[noitemsep] +\item \cs{buttcap} truncates each line with a sharp cut perpendicular + to the line axis exactly through the line end point (default). + +\item \cs{roundcap} adds a semicircle to the very end of each line. + +\item \cs{squarecap} adds the half square to the very end of each line. + +\item \cs{miterjoin} joins two (generally straight) lines with a miter + (or mitre) joint; this means that the borders of the line are prolonged + until they meet; it is very nice when the junction angle is not far away + from, or is larger than $90^\circ$. Apparently for \pack{pict2e} this + type of joint is the default. + +\item \cs{roundjoin} joins each (generally straight) line with + a \cs{roundcap}; it is good in most circumstances. + +\item \cs{beveljoin} joins two (generally straight) lines with a miter + joint truncated with a sharp cut perpendicular to the bisector of the + lines axes; with acute angles it is better than the miter joint, but + when angles are very small, even this joint is not adequate. +\end{enumerate} + + Notice that \cs{buttcap} is the default, but in general it might be + better to declare the \cs{roundcap} for the whole document. + + We do not go further in the description of the new \pack{pict2e} + modified and new new commands; the reader unfamiliar with programmable + drawing and the \pack{pic2e} extensions can consult that package + documentation. Actually all commands have been redefined or modified + by \pack{curve2e} in order to render them at least compatible with + both the cartesian and polar coordinates. In oder to have a better understanding of these details, see figure~\ref{fig:joins}\footnote{The \cs{polyline} macro has the default join of type bevel; remember to specify a different join type if you want a different one.}. + + \begin{figure}[!htb] \centering + \makebox[\textwidth]{\unitlength=0.009\textwidth + \begin{picture}(130,50) + \GraphGrid(130,50) + \linethickness{4mm} + \buttcap\miterjoin + \put(10,10){\polyline[\miterjoin](0,0)(30,0)(30,30) + \put(0,-10){\makebox(30,10)[b]{\cs{buttcap},\cs{miterjoin}}}} + \roundcap\roundjoin + \put(50,10){\polyline[\roundjoin](0,0)(30,0)(30,30) + \put(0,-10){\makebox(30,10)[b]{\cs{roundcap},\cs{roundjoin}}}} + \squarecap\beveljoin + \put(90,10){\polyline(0,0)(30,0)(30,30) + \put(0,-10){\makebox(30,10)[b]{\cs{squarecap},\cs{beveljoin}}}} + \end{picture}} + \caption{Different caps and joins}\label{fig:joins} + \end{figure} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%>>> +\section{\pack{curve2e} extensions} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + Again we do not enter into the details, because the user can read the + new user manual \file{curve2e-manual.pdf} simply by entering and + executing the \verb|texdoc curve2e-manual| command into a terminal or + command prompt window; this new manual is available with version~2.2.0 + (or higher) of \pack{curve2e} and it contains the extensions and sample + codes for (simple) sample drawings; some examples are not so simple, but + show the power of this package upgrade. + + The most important two changes are $(a)$ the choice of different + coordinates for addressing points on the drawing canvas, and $(b)$ + the possibility of using macros to identify specific points. + As already mentioned, such changes have been applied also to most, + if not all\footnote{I assume I have upgraded all such commands; if not, + please, send me a bug notice; I will acknowledge your contribution.} + commands defined by \pack{pict2e}. + + \pack{curve2e} defines a lot of operations the user can do with + the point coordinates; this is done by assuming they are complex + numbers, or vectors, or roto\-amplification operators, and making + with such entities a lot of actions compatible with their “incarnation". + For example multiplying a vector by a roto\`amplification operator, + in spite the fact that internally they are both represented by ordered + pairs of (generally) fractional numbers, means simply obtaining a new + vector rotated and scaled with respect to the original one; the point + addressed by the first vector, becomes another point in a different + precise position. + + Below you see several examples of usage of such commands; but here space + will be saved if a short list is made concerning these “complex number” + operations. + + Remember the double nature of such complex numbers: +\[ +z = x + \iu y = m\eu^{\iu \phi} +\] + therefore addition and subtraction are simply done with +\[ +z_1 \pm z_2 = x_1 \pm x_2 +\iu (y_1 \pm y_2) +\] + Multiplications and divisions are simply done with +\begin{align*} +z_1 z_2 &=( m_1 m_2) \eu^{\iu(\phi_1 + \phi_2)} \\ +z_1/z_2 &=( m_1/m_2) \eu^{\iu(\phi_1 - \phi_2)} +\end{align*} + Squares and square roots\footnote{The square root of a complex number + has two values; here we do not go into the details on how \pack{curve2e} + choses one or the other value. In practice, the \pack{curve2e} macros + that use square roots, work mostly on scalars to find magnitudes that + are always positive.} are simply done with: +\begin{align*} +z^2 &= m^2\eu^{\iu 2\phi}\\ +\sqrt{z} &= \sqrt{m}\eu^{\iu\phi/2} +\end{align*} + The complex conjugate of a complex number is shown with a superscript + asterisk: +\[\text{if } z= x+\iu y \text{ then } z^\star = x- \iu y\] + and from these simple formal rules many results can be obtained; + and therefore several macros must be defined. + + But let us summarise. Here is a short list with a minimum of + explanation of the commands functionalities introduced by + \pack{curve2e}. The user notices that many commands rely on + a delimited argument command syntax; the first arguments can + generally be introduced with point macros, as well as numerical + coordinates (no matter if cartesian and polar ones) while + the output(s) should always be in form of point macro(s). Parentheses + for delimiting the ordered couples or the point macros are seldom + required. On the other side, the variety of multiple optional + arguments, sometimes requires the use of different delimiters, + most often than not the signs~\texttt{<~>}, in addition to the + usual brackets. These syntax functionalities are available with the + \pack{xparse} and \pack{xfp} packages, that render the language~L3 + very useful and effective. + + Handling of complex numbers is done with the following commands. + New commands to draw special objects, are also described. +\begin{enumerate}[noitemsep] +% +\item Cartesian and polar coordinates; they are distinguished by + their separator; cartesian coordinates are the usual comma separated + couple \meta{$x,y$}; polar coordinates are specified with a colon + separated couple \meta{$\theta{:}\,\rho$}. In general they are + specified within parentheses, but some commands require them without + any parentheses. In what follows a generic math symbol, such as for + example $P_1$, is used to indicate a complex number that addresses + a particular point, irrespective of the chosen coordinate type, + or a macro defined to contain those coordinates. + +\item The complex number/vector operations already available with + \pack{curve2e} are the following; we specify “macro” because in general + macros are used, instead of explicit numerical values, but for input + vector macros it is possible to use the comma or colon separated ordered + couple; “versor” means “unit vector”; angles are always expressed in + degrees; output quantities are everything follows the key word + \texttt{to}; output quantities are alway supposed to be in the form + of control sequences. +\begin{itemize}\small +\item \cs{MakeVectorFrom}\meta{number,number}\meta{numeric macro} to\meta{vector macro} +\item \cs{CopyVect}\meta{vector macro} to\meta{vector macro} +\item \cs{ModOfVect}\meta{vector macro} to\meta{modulus macro} +\item \cs{DirOfVect}\meta{vector macro} to\meta{versor macro} +\item \cs{ModAndDirOfVect}\meta{vector macro} to\meta{modulus macro} + and\meta{versor macro} +\item \cs{ModAndAngleOfVect}\meta{vector macro} to \meta{modulus macro} + and\meta{angle macro} +\item \cs{DistanceAndDirOfVect}\meta{1st vector macro} + minus\meta{2nd vector macro} to\meta{distance macro} + and\meta{versor macro} +\item \cs{XpartOfVect}\meta{vector macro} to\meta{numerical macro} +\item \cs{YpartOfVect}\meta{vector macro} to\meta{numerical macro} +\item \cs{DirFromAngle}\meta{angle macro} to\meta{versor macro} +\item \cs{ArgOfVect}\meta{vector macro} to\meta{angle macro} +\item \cs{ScaleVect}\meta{vector macro} by\meta{scale factor} + to\meta{vector macro} +\item \cs{ConjVect}\meta{vector macro} to\meta{conjugate vector macro} +\item \cs{SubVect}\meta{subtrahend vector} from\meta{minuend vector} + to\meta{vector macro} +\item \cs{AddVect}\meta{1st vector} and\meta{2nd vector} + to\meta{vector macro} +\item \cs{Multvect}\marg{1st vector}\meta{$\star$}\marg{2nd vector}\meta{$ + \star$}\meta{output vector macro}\newline the asterisks are optional; + either one changes the \meta{2nd vector} into its complex conjugate +\item \cs{MultVect}\meta{1st vector}\meta{$\star$}\meta{2nd vector} + to\meta{vector macro}\newline discouraged; maintained for backward + compatibility; the only optional asterisk changes the \meta{2nd vector} + into its complex conjugate +\item \cs{Divvect}\marg{dividend vector}\marg{divisor vector}\marg{output + vector macro} +\item \cs{DivVect}\meta{dividend vector}\meta{divisor vector} + to\meta{vector macro}\newline maintained for backwards + compatibility +\end{itemize} + +\item A new command \cs{segment}\parg{$P_1$}\parg{$P_2$} draws a line that + joins the specified points. + +\item Command \cs{Dashline}\parg{$P_1$}\parg{$P_2$}\marg{dash length} + draws a dashed line between the specified points; the + \meta{dash length} is specified as a coefficient of + \cs{unitlenth} so they are proportioned to the diagram scale. The gap + between dashes is just as wide as the dashes; they are recomputed by + the command in order to slightly adjust the \meta{dash length} so + that the line starts at point $P_1$ with a dash, and ends at $P_2$ + again with a dash. + +\item Command \cs{Dotline}\parg{$P_1$}\parg{$P_2$}\marg{gap}\oarg{diameter} + traces a dotted line between the specified points with dots \meta{gap} + units apart, starting and ending with a dot at the specified points. + Optionally the absolute diameter of the dots may be specified: a + diameter of 1\,pt (default) is visible, but it might be too small; + a diameter of 1\,mm is really very black, and may be too large; if + the diameter is specified without dimensions they are assumed by + default to be typographic points. + +\item Command \cs{polyline}, \cs{polygon} and \cs{polygon*} are redefined + to accept both coordinate kinds. + +\item Commands \cs{VECTOR}\parg{$P_1$}\parg{$P_2$} (and \cs{VVECTOR}, with the same syntax) draw vectors with one arrow tip at the end, or arrow tips at both ends respectively. + +\item New commands \cs{Arc}\parg{center}\parg{start}\marg{angle} and, + with the same syntax, \cs{VectorArc} and \cs{VectorARC} draw + arcs without or with arrow tip(s), with the specified \meta{center}, + starting at point \meta{start}, with an aperture of \meta{angle} + degrees (not radians). \cs{Arc} draws the arc without arrow tips; + \cs{VectorArc} draws the arc with one arrow tip at the end point; + \cs{VectorARC} draws an arc with arrow tips at both ends. + +\item Command \cs{multiput} has been redefined to accept optional + arguments, besides the use of coordinates of both kinds. The new syntax + is the following: +\begin{flushleft}\obeylines +\cs{multiput}\oarg{shift}\parg{origin}\parg{step}\marg{number}\marg{object}\oarg{handler} +\end{flushleft} + where, if you neglect the first and the last (optional) arguments, + you have the original syntax; the \meta{origin} point is where the first + \meta{object} is placed; \meta{step} is the displacement of a new + \meta{object} relative to the previous one; \meta{number} is the + total number of \meta{object}s put in place by the command; possibly + the number may be an integer expression computed with the \cs{inteval} + function of the L3~language, accessed through the \pack{xfp} package + already loaded by \pack{curve2e}. The new features are \meta{shift}, + that is used to displace the whole drawing somewhere else (in case + some fine tuning is required), and \meta{handler}; the latter is a + powerful means to control both the object to be set in place and its + position; further on there will be examples that show that the object + can be put not only on straight paths, but also un other curves, + including parabolas, circles, and other shapes. + +\item Another version of repetitive commands \cs{xmultiput} is very + similar to \cs{multiput} but the iterations are controlled in a + different way so that it is possible also to draw continuous + curves describing analytical functions even with parametric + equations. Further on there will be some examples. + +\item The preloaded \pack{xfp} package provides two important + functionalities, i.e. two L3 “functions”, \cs{fpeval} and \cs{inteval}; + the latter executes expressions on integer numbers containing the usual + operators \texttt{+, -, *, /}; the division quotient is rounded to the + nearest (positive or negative) integer. The former operates with real + fractional numbers and, in addition to the usual arithmetical operators as + \cs{inteval}, it can use many mathematical functions, from square roots, + to exponentials, logarithms, trigonometric and hyperbolic direct and + inverse functions\footnote{The implementation of inverse hyperbolic + function is on the L3~Team “to do” list.}, plus other ones. Normally + fractional numbers are operated on decimal strings, with 16 fractional + places, and 14 integer places but the L3~functions accept also scientific + notation. The user can specify truncation or rounding to a specified + number of digits. Such integer and fractional mathematical operations + are already integrated in most computations performed by \pack{curve2e}. + +\item \pack{curve2e} provides two more L3 functions: \cs{fptest} and + \cs{fpdowhile} with the following syntax: +\begin{flushleft}\obeylines +\cs{fptest}\marg{test}\marg{true}\marg{false} +\cs{fpdowhile}\marg{test}\marg{actions} +\end{flushleft} + For both macros the \meta{test} is a logical F3~expression; its operands + are logical constants, logical values, logical numeric comparisons; its + operators are the typical \texttt{||}, \texttt{\&\&}, and \texttt{!}, + respectively for OR, AND, and NOT. The logical numerical comparisons + are mathematical constants or expressions connected with relation + operators, such as \texttt{>, =, <}; such operators may be negated with + the NOT operator; therefore, for example, \texttt{!>} means “not greater + than”, therefore “lower or equal to”. + +\item The above tests are very useful to control both \cs{fptest} and + \cs{fpdowhile}. The logical \meta{test} result lets \cs{fptest} execute + only the \meta{true} or the \meta{false} code. Before using \cs{fpdowhile} + the \meta{test} expression must be initialised to be \texttt{true}; + the \meta{actions} should contain some code to be iteratively executed, + but they must contain some assignments, typically a change in an + iteration counter, such that eventually the \meta{test} logical + expression becomes \texttt{false}. Lacking this assignments, the + loop continues to infinity, or better, until a fatal error message + is issued that informs that the program working memory is exhausted. + +\item Such new commands are already used to code the \cs{multiput} and + \cs{xmultiput} commands, but they are available also to the user who can + operate in a very advanced way; further on, some examples will show + some advanced drawings. + +\item General curves can be drawn by \pack{pic2e} command \cs{curve} + that is sort of difficult to use, because the user has to specify + also the control points of the third order Bézier splines. Some other + new commands are available with \pack{curve2e}, that are supposed + to be easier to use; they are described in the following items. + +\item The new command \cs{Curve} joins a sequence of third order + splines by simply specifying the node-direction coordinates; i.e. at the + junction of two consecutive splines, in a certain interpolation node the + final previous spline tangent has the same direction of the tangent + at the second spline first node; if a change of direction is required, an + optional new direction can be specified. Therefore this triplet of + information has the following syntax: +\begin{flushleft} + \parg{node}\aarg{direction}\oarg{new direction} +\end{flushleft} + Evidently the \meta{new direction} is specified only for the nodes + that correspond to a cusp. A variation of the command arguments is + available by optionally specifying the “looseness” of the curve: +\begin{flushleft} +\parg{node}\aarg{direction\texttt{;}start\texttt{,}end}\oarg{\dots} +\end{flushleft} + where \meta{start} is the spline starting “looseness” and \meta{end} + is the spline ending one. These (generally different) values + are an index of how far is the control point from the adjacent node. + With this functionality the user has a very good control on the curve + shape and curvature. + +\item A similar command \cs{Qurve} works almost the same way, but it + traces a quadratic Bézier spline; this one is specified only with two + nodes an a single control point, therefore is less configurable than + cubic splines; the same final line requires several quadratic splines + when just a single cubic spline might do the same job. Notice also that + quadratic splines are just parabolic arcs, therefore without inflections, + while a cubic spline can have one inflexion. + +\item A further advanced variation is obtained with the new + \cs{CurveBetween} command that creates a single cubic spline between two + given points with the following syntax: +\begin{flushleft}\ttfamily +\cs{CurveBetween}\meta{node1} And\meta{node2} WithDirs \meta{dir1} + And\meta{dir2} +\end{flushleft} + +\item A similar variant command is defined with the following syntax: +\begin{flushleft}\ttfamily + \cs{CbezierBetween}\meta{node1} And\meta{node2} WithDirs\meta{dir1} + And\meta{dir2}\\ +\qquad UsingDists\meta{dist1} And\meta{dist2} +\end{flushleft} + Usage examples are shown in section~\ref{sec:examples} +\end{enumerate} + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{ Euclidean geometry commands} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + With the already large power of \pack{curve2e} there was a push towards + specialised applications; the first of which was, evidently, geometry; + that kind of geometry that was used in the ancient times when + mathematicians did not have available the sophisticated means they + have today; they did not even have a positional numerical notation, that + arrived in the “west” of the world we are familiar with, just by + the XI-XII century; before replacing the roman numbering system another + couple of centuries passed by; real numbers with the notation we use + today with a decimal separator, had to wait till the XVI century (at + least); many things that naw are taught in elementary school were + still a sort of magic until the end of XVIII century. + + Even a simple algebraic second degree equation was a problem. + In facts the Renaissance was the artistic period when the classical + proportions were brought back to the artists who could not solve the + simple equation where a segment of unit length is divided in two + unequal parts $x$ and $1-x$ such that the following proportion exists + among the various parts and the whole segment: +\[ +\frac{x}{1} = \frac{1-x}{x} \Longrightarrow x = \frac{1}{x} - 1 +\] + today we cam solve the problem by manipulating that simple proportion + to get +\[ + x^2 + x -1 = 0 +\] + and we know that the equation has two solution of opposite signs, and that + their magnitudes are the reciprocal of one another. Since we are + interested in their magnitudes, we adapt the solutions in the form +\begin{equation} + x_{1,2} = \frac{\sqrt{5} \pm 1}{2}= \sqrt{1+0.5^2}\pm 0.5 \Longrightarrow +\begin{cases}x_1=1.618\ldots\\x_2=0.618\ldots \end{cases}\label{equ:aureo} +\end{equation} + The larger number is called the \emph{golden number} and the smaller + one the \emph{golden section}. + + Luca Pacioli, by the turn of centuries XV–XVI, was the tutor of + Guidubaldo, the heir of Federico di Montefeltro, Duke of + Urbino\footnote{If you never visited this Renaissance city and its Ducal + Palace, consider visiting it; it is one of the many UNESCO Heritage + places.}; he wrote the famous book \emph{De Diuina Proportione} that + contained also the theory of the golden section accompanied by beautiful + drawings of many Platonic solids and other non convex ones, drawn by + Leonardo da Vinci. Everything was executed with perfect etchings, even the + construction of the golden section; in its basic form\footnote{The third + formula in equation~\eqref{equ:aureo} is written in such a way as to + explain the graphical construction in figure~\ref{fig:aureo}.} it is + replicated in figure~\ref{fig:aureo}. +\begin{figure} +\begin{Esempio}[\setfontsize{7}](0.40) +\unitlength=0.005\linewidth +\begin{picture}(170,140)(0,-70) +\GraphGrid(0,-70)(170,140) +\VECTOR(0,0)(170,0) +\Pbox(170,0)[t]{x}[0] +\Pbox(100,0)[t]{\mathrm{1}}[2] +\Pbox(0,0)[r]{O}[2] +\Arc(100,0)(50,0){-90} +\segment(100,0)(100,70) +\segment(0,0)(100,50) +\Pbox(50,0)[tr]{\mathrm{0.5}}[2] +\ModAndAngleOfVect100,50 to\M and\A +\Arc(0,0)(\M,0){\A}\Pbox(\M,0)[bl]{C}[2] +\Arc(\M,0)(\M,-50){90} +\Arc(\M,0)(\M,-50){-90} +\Pbox(\fpeval{\M-50},0)[b]{\mathit{x_2}}[3] +\Pbox(\fpeval{\M+50},0)[b]{\mathit{x_1}}[3] +\put(\M,0){\Vector(-70:50)} +\Pbox(120,-25)[bl]{\mathit{r}=\mathrm{0.5}}[0] +\thicklines +\segment(0,0)(100,0) +\end{picture} +\end{Esempio} +\caption{The golden section $x_2$ and the golden number $x_1$}\label{fig:aureo} +\end{figure} + By the way figure~\ref{fig:aureo} shows also the code that is used + for the drawing done completely with the facilities available just with \pack{curv2e}. It is also a usage example of several commands. + + Illiteracy was very widespread; books were expensive and were + common just in the wealthy people mansions. + + Mathematicians in the classical times B.C. up to the artists in the + Renaissance, had no other means but to use geometrical constructions with + ruler and compass. Even today in schools where calculus is not yet + taught as a normal subject, possibly not in certainly high school degree + courses, but certainly not in elementary and junior high schools, the + instructors have to recourse to geometrical constructions. Sometimes, as + in Italy, access to public universities is open with no restrictions to + all students with a high school diploma for degree courses that are + more vocational than cultural. Therefore such students in some university + degree courses have to frequent upgrading courses in order to master some + more mathematics compared to what they studied during their basic + education. + + The instructors nowadays very often prepare some booklets with their + lessons; such documents, especially in electronic form, are a nice help + for many students. And \LaTeX is used to write such documents. + Therefore this extension module is mostly dedicated to such instructors. + + The contents of this module is not exhaustive; it just shows a way to + use the \pack{curve2e} facilities to extend it to be suited for the + kind of geometry they teach. + + Here we describe the new commands provided by this package; then in + section~\ref{sec:examples} we show their usage by means examples. + +\begin{enumerate}[noitemsep] +\item Command \cs{IntersectionOfLines} is a fundamental one; its syntax is + the following: +\begin{ttsintassi} +\cs{IntersecionOfLines}\parg{point1}\parg{dir1} and\parg{point2}\parg{dir2} to\meta{vector} +\end{ttsintassi} + were each line is identified with its \meta{point} and its direction + \meta{dir}; the intersection coordinates go to the output \meta{vector}. + +\item A second command\cs{IntersectionOfSegments} does almost the same + work, but the coordinates of a segment define also its direction, + which is the argument of the difference of the terminal nodes of each + segment; the syntax therefore is the following: +\begin{ttsintassi} +\cs{IntersectionOfSegments}\parg{point11}\parg{point12} + and\parg{point21}\parg{point22}to\meta{vector} +\end{ttsintassi} + Again the intersection point coordinates go to the output \meta{vector}. + The first segment is between points 11 and 12, and, similarly, the second + segment is between points 21 and 22. + +\item Command \cs{ThreePointCircle} draws a circle that goes through three + given points; the syntax is the following: +\begin{ttsintassi} + \cs{ThreePointCircle}\meta{$\star$}\parg{point1}\parg{point2}\parg{point3} +\end{ttsintassi} + A sub product of this macro is formed by the vector \cs{C} that contains + the coordinates of the center of the circle, that might be useful even + if the circle is not drawn; the optional asterisk, if present, does not + draw the circle, but the center is available. + +\item Alternatively +\begin{ttsintassi} + \cs{ThreePointCircleCenter}\parg{point1}\parg{point2}\parg{point3}to\meta{vector} +\end{ttsintassi} + computes the three point circle center assigning its coordinates to + \meta{vector}. + +\item Command \cs{CircleWithCenter} draws a circle given its center and it + radius; in facts the syntax is the following: +\begin{ttsintassi} +\cs{CircleWithCenter}\meta{center} Radius\meta{Radius} +\end{ttsintassi} + This macro does not require the \cs{put} command to put the circle + in place. + +\item A similar macro \cs{Circlewithcenter} does almost the same; its + syntax is the following: +\begin{ttsintassi} +\cs{Circlewithcenter}\meta{center} radius\meta{radius} +\end{ttsintassi} + Apparently these two commands do the same, but, no, they behave + differently: in the former command the \meta{Radius} is a vector the + modulus of which si computed and used as the radius; in the latter + command the \meta{radius} is a scalar and (its magnitude) is directly + used. + +\item Command with syntax: +\begin{ttsintassi} +\cs{AxisOf}\meta{point1} and\meta{point2} to \meta{point3} and\meta{point4} +\end{ttsintassi} + is used to determine the axis of a segment; the given + segment is specified with its end points \meta{point1} and \meta{point2} + and the axis is determined by point \meta{point3} and \meta{point4}; + actually \meta{point3} is the middle point of the given segment. + +\item These two commands with syntax: +\begin{ttsintassi} +\cs{SegmentCenter}\parg{point1}\parg{point2}to\meta{center} +\cs{MiddlePointOf}\parg{point1}\parg{point2}to\meta{center} +\end{ttsintassi} + determine just the middle point between two given points. They are + totally equivalent, aliases to one another; sometimes it is more + convenient to use a name, sometimes the other; it helps reading the + code and maintaining it. + +\item Given a triangle and a specific vertex, it is possible to determine + the middle point of the opposite side; it is not very difficult, but it + is very handy to have all the necessary elements to draw the median line. + The simple syntax is the following: +\begin{ttsintassi} +\cs{TriangleMedianBase}\meta{vertex} on\meta{base1} and\meta{base2} +\qquad to\meta{base middle point} +\end{ttsintassi} + +\item A similar command \cs{TriangleHeightBase} is used to determine the + intersection of the height segment from one vertex to the opposite base; + with triangles that have an obtuse angle, the height base might lay + externally to one of the bases adjacent to such an angle. The syntax is + the following +\begin{ttsintassi} +\cs{TriangleHeigthtBase}\meta{vertex} on\meta{base1} and\meta{base2} to\meta{height base} +\end{ttsintassi} + +\item Similarly there is the \cs{TriangleBisectorBase} macro with + a similar syntax: +\begin{ttsintassi} +\cs{TriangleBisectorBase}\meta{vertex} on\meta{base1} and\meta{base2} +\qquad to\meta{bisector base} +\end{ttsintassi} + +\item A triangle \emph{barycenter} is the point where its median lines + intersect; command \cs{TriangleBarycenter} determines its coordinates + with the following syntax. +\begin{ttsintassi} +\cs{TriangleBarycenter}\parg{vertex1}\parg{vertex2}\parg{vertex3} to\meta{barycenter} +\end{ttsintassi} + +\item A triangle \emph{orthocenter} is the point where its height lines + intersect; command \cs{TriangleOrthocenter} determines its coordinates + with the following syntax: +\begin{ttsintassi} +\cs{TriangleOrthocenter}\parg{vertex1}\parg{vertex2}\parg{vertex3} to\meta{orthocenter} +\end{ttsintassi} + +\item A triangle \emph{incenter} is the point where its bisector lines + intersect; command \cs{TriangleIncenter} determines its coordinates + with the following syntax: +\begin{ttsintassi} +\cs{TriangleIncenter}\parg{vertex1}\parg{vertex2}\parg{vertex3} to\meta{incenter} +\end{ttsintassi} + +\item The distance of a specified point from a given segment or line is + computed with the following command +\begin{ttsintassi} +\cs{DistanceOfPoint}\meta{point} from\parg{point1}\parg{point2} to\meta{distance} +\end{ttsintassi} + where \meta{point} specifies the point and \meta{point1} and \meta{point2} + identify two points on a segment or a line; \meta{distance} is a scalar + value. + +\item In a construction that will be examined in section~\ref{sec:examples} + we need to determine an ellipse axis if the other axis and the focal + distance are know; actually it solves the relation +\begin{equation}a^2= b^2 +c^2\label{equ:axes-foci}\end{equation} + that connects such three quantities; $a$ is always the largest of the + three quantities; therefore the macro tests if the first entry is larger + than the second one: if is is, it computes a Pitagorean difference, + otherwise the user should pay attention to use as the first entry the + smaller among $b$ and $c$, so as to compute a Pitagorean sum. The command + is the following: +\begin{ttsintassi} +\cs{AxisFromAxisAndFocus}\meta{axis or focus} and\meta{focus or axis} +\qquad to\meta{other axis or focus} +\end{ttsintassi} + The word “axis” stands for “semi axis length”; the word “focus" stands + for “focal semi distance”; actually the macro works equally well with + full lengths, instead of half lengths; its is important not to mix + full and half lengths. Such lengths are expressed as factors of + \cs{unitlength}, not as absolute values. This command is described + again when dealing with the specific problem referred to at the + beginning of this list item; the description is going to be more + detailed and another macro is added to avoid possible errors. + +\item Given a segment, i.e. the coordinates of its end points, it is + useful to have a macro that computes its length; at the same time it is + useful to to compute its direction; this operation is not the same as to + compute modulus and argument of a vector, but consists in computing such + quantities from the difference of the vectors pointing to the segment + end points. These two macros are the following: +\begin{ttsintassi} +\cs{SegmentLength}\parg{point1}\parg{point2} to\meta{length} +\cs{SegmentArg}\parg{point1}\parg{point2} to\meta{argument} +\end{ttsintassi} + The \meta{argument} is computed in the interval $-180^\circ < \phi \leq + +180^\circ$; it represents the argument of the vector that goes from + \meta{point1} to \meta{point2}, therefore the user must pay attention to + the order s/he enters the end points coordinates. + +\item The next command \cs{SymmetricalPointOf} is used to find the + reflection of a specified point with respect to a fixed point; of course + the latter is the middle point of the couple, but the unknown to be + determined is not the center of a segment, but one of its end points. + The syntax is the following: +\begin{ttsintassi} +\cs{SymmetricalPointOf}\meta{point1} respect\meta{fixed} to\meta{point2} +\end{ttsintassi} + +\item Command \cs{RegPolygon} draws a regular polygon inscribed within + a circle of given radius and center, with a specified number of sides; + optional arguments allow to specify color and thickness of the sides, + or the polygon interior color; this macro operates differently from the + one for drawing ellipses, that draws simultaneously an ellipse with + the border of a color and the interior of another one; with this macro the + user who wants to achieve this effect must superimpose to polygons with + different settings; but it would not be too difficult to arrange a new + macro or to modify this one in order to get “bicolor” polygons. + It is not necessary for the purpose of this package, therefore we + let the user express his/her phantasy with other macros. The actual + syntax is the following: +\begin{ttsintassi} +\cs{RegPolygon}\meta{$\star$}\parg{center}\marg{radius}\marg{sides}\oarg{angle}\aarg{settings} +\end{ttsintassi} + The initial optional asterisk specifies if the interior has to be + coloured; if yes, the \meta{settings} refer to the color of the + interior; if not, the \meta{settings} refer to the thickness and + color of the sides; no \meta{settings} imply sides drawn with the + default line thickness, generally the one corresponding to \cs{thinlines}, + and the default color (generally black) for the sides or the interior. + By default the first vertex is set to an angle of $0^\circ$ with + respect to the \meta{center}; the optional \meta{angle} modifies + this value to what is necessary for a particular polygon. The + \meta{center} itself is optional, in the sense that if it is not + specified the center lays in the origin of the \env{picture} axes; if this + argument is specified, the polygon center is displaced accordingly. + The number of sides in theory may be very high, but it is not wise + to exceed a couple of dozen sides; if the number of sides is too + high, the polygon becomes undistinguishable from a circumference. + +\item Several macros are dedicated to ellipses; their names are spelled + in Italian, “ellisse”, because the name “ellipse” is already taken by + other packages; with Italian user command names there should be no + interference with other packages, or the risk is reduced to + a minimum. The various macros are \cs{ellisse}, \cs{Sellisse}, + \cs{Xellisse}, \cs{XSellisse}, \cs{EllisseConFuoco} \cs{EllisseSteiner}; + the last two control sequence names are aliased with the corresponding + English ones \cs{EllipseWithFocus} and \cs{SteinerEllipse}. For the + other four ones it is wise to avoid English names for the reasons + explained above. After all the Italian and the English names are very + similar and are pronounced almost identically. + + {\tolerance=3000 Actually \cs{ellisse} is practically a shorthand for + \cs{Sellisse} because + some optional arguments are already fixed, but the meaning of + \cs{fillstroke} depends on the presence or absence of an initial + asterisk; similarly \cs{Xellisse} is a sort of a shorthand for + \cs{XSellisse}; in facts those commands, that contain + an ‘S’ in their names, can optionally perform also the affine + \emph{shear} transformation, while those without the ‘S’ do not execute + such transformation. Figure~\ref{fig:shear} displays a normal ellipse + with its bounding rectangle, and the same ellipse to which the shear + affine transformation is applied; the labeled points represent the + third order Bézier spline nodes and control points.\par} +\begin{figure}[!htb] +\dimendef\Wmp=2000 \Wmp=\dimexpr(\textwidth-\columnsep)/2\relax +\begin{minipage}{\Wmp}\centering +\unitlength=0.007\linewidth +\begin{picture}(100,70)(-50,-35) +\XSellisse(0,0){50}{25}* +\end{picture} +\end{minipage} +\hfill +\begin{minipage}{\Wmp}\centering +\unitlength=0.007\linewidth +\begin{picture}(100,70)(-50,-35) +\XSellisse(0,0)<20>{50}{25}* +\end{picture} +\end{minipage} +\caption{The effect of shearing an ellipse with its bounding rectangle}\label{fig:shear} +\end{figure} + +\item The syntax of those six commands are the following: +\begin{ttsintassi} +\cs{Sellisse}\meta{$\star$}\marg{semiaxis-h}\marg{semiaxis-v}\oarg{shear} +\cs{ellisse}\meta{$\star$}\marg{semiaxis-h}\marg{semiaxis-v} +\cs{XSellisse}\meta{$\star$}\parg{center}\oarg{angle}\aarg{shear}\marg{semiaxis-h}\% +\qquad \marg{semiaxis-v}\meta{$\star$}\oarg{settings1}\oarg{settings2} +\cs{Xellisse}\meta{$\star$}\parg{center}\oarg{angle}\marg{semiaxis-h}\% +\qquad\marg{semiaxis-v}\oarg{settings1}\marg{settings2} +\cs{EllipseWithFocus}\meta{$\star$}\parg{vertex1}\parg{vertex2}\parg{vertex3}\parg{focus} +\cs{SteinerEllipse}\meta{$\star$}\parg{vertex1}\parg{vertex2}\parg{vertex3}\oarg{diameter} +\end{ttsintassi} + All require the semi axis lengths; the \meta{semiaxis-h} and + \meta{semiaxis-v} refer to the semi axes before possible rotation by + \meta{angle} degrees, and do not make assumptions on which axis is the + larger one. The optional parameter \meta{shear} is the angle in degrees + by which the vertical coordinate lines are rotated by effect of shearing. + If \meta{shear}, that by default equals zero, is not set + to another value, the asterisks of command \cs{Sellisse} and + \cs{XSellisse} do not have any effect. Otherwise the asterisk of + \cs{Sellisse} forces to draw the ellipse bounding box (rectangle before + shearing, parallelogram after shearing) as shown together with some + marked special points (the vertices, spline nodes and control points + of the quarter circles or quarter ellipses) in figure~\ref{fig:shear}. + For \cs{ellipse} the asterisk implies filling, instead of stroking the + ellipse contour. + The \meta{setting}~1 and~2 refer to the color filling and/or border + color, and contour thickness, as already explained. For the + \cs{EllipseWithFocus}, the \meta{focus} contains the coordinates + of one of the two ellipse foci; such coordinates should point to + some position \emph{inside} the triangle. The \cs{SteinerEllipse} + requires less data, in the sense that such ellipse is unique; it + is the ellipse internally tangent to the triangle at its side middle + points. + +\end{enumerate} + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{Examples}\label{sec:examples} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + Here we can show some examples of the advanced \pack{curve2e} commands + and of what can be done with this \pack{euclideangeometry} extension. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\subsection{Straight and curved vectors} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + Figure~\ref{fig:vectors} shows some vectors and vector arcs with the + code used to draw them; as usual some points are described with cartesian + coordinates and some with polar ones. + +\begin{figure}[!htb] +\begin{Esempio}[\setfontsize{8.5}](0.45) +\unitlength=0.01\linewidth +\begin{picture}(100,60) +\GraphGrid(100,60) +\put(0,30){\vector(1,2){10}} +\put(20,30){\Vector(10,20)} +\VECTOR(40,30)(50,50) +\VVECTOR(60,30)(70,60) +\Arc(100,60)(80,60){90} +\VectorArc(0,0)(20,0){90} +\VectorARC(100,0)(80,0){-90} +\polyvector(30,0)(35,10)(55,20)(60,0) +\end{picture} +\end{Esempio} +\caption{Some vectors and vector arcs}\label{fig:vectors} +\end{figure} + + +\begin{figure*}[!tb] +\begin{Esempio}*[\setfontsize{10}]\centering +\unitlength=0.006\linewidth\begin{picture}(120,90) +% +\RegPolygon(9,20){20}{6}<\linethickness{3pt}\color{red}> +\RegPolygon(55,20){20}{7}[90] +\RegPolygon(100,20){20}{8}[22.5]<\linethickness{0.5ex}\color{blue}> +% +\put(0,50){% + \RegPolygon(9,20){20}{3}\RegPolygon(9,20){20}{3}[30] + \RegPolygon(9,20){20}{3}[60]\RegPolygon(9,20){20}{3}[90] +% + \RegPolygon*(55,20){20}{4}<\color{green}> + \RegPolygon(55,20){20}{4}<\linethickness{1ex}> +% + \RegPolygon*(100,20){20}{4}[45]<\color{orange}> + \RegPolygon(100,20){20}{4}[45]<\linethickness{1ex}\color{blue}> +} +\end{picture} +\end{Esempio} +\caption{A variety of polygons and their codes}\label{fig:variety-of-polygons} +\end{figure*} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\subsection{Polygons} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + Figures~\ref{fig:pentagon} and~\ref{fig:filled-pentagon} display + a normal and a color filled pentagon with their codes. + Figure~\ref{fig:variety-of-polygons} shows a variety of polygons + with their codes. + +\begin{figure}[!htb] +\begin{Esempio}[\setfontsize{10}](0.8) +\unitlength=0.5mm +\begin{picture}(40,32)(-20,-17) +\polyline(90:20)(162:20)(234:20)(306:20)(378:20)(90:20) +\end{picture} +\end{Esempio} +\caption{A normal polygon drawn with \cs{polyline}} +\label{fig:pentagon} +\end{figure} + + +\begin{figure}[!htb] +\begin{Esempio}[\setfontsize{10}](0.8) +\unitlength=.5mm +\begin{picture}(40,32)(-20,-20) +\color{magenta} +\polygon*(90:20)(162:20)(234:20)(306:20)(378:20) +\end{picture} +\end{Esempio} +\caption{A filled polygon drawn with \cs{polygon}} +\label{fig:filled-pentagon} +\end{figure} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + \subsection{Dashed and dotted lines} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + For dotted lines there is a possibility of specifying the dot size; + it can be specified with an explicit unit of measure, or, if no unit is + specified, it is assumed to be “points”. The \cs{Dotline} takes care + of transforming the implied or the explicit dimension in multiples of + \cs{unitlength}. Figure~\ref{fig:DashDot} shows some examples with their + codes. + +\begin{figure}[!htb] +\begin{Esempio}[\setfontsize{10}](0.65) +\unitlength=1mm +\begin{picture}(40,40) +\GraphGrid(40,40) +\Dashline(0,0)(40,10){4} +\put(0,0){\circle*{2}} +\Dashline(40,10)(0,25){4} +\put(40,10){\circle*{2}} +\Dashline(0,25)(20,40){4} +\put(0,25){\circle*{2}} +\put(20,40){\circle*{2}} +\Dotline(0,0)(40,40){2}[0.75mm] +\put(40,40){\circle*{2}} +\end{picture} +\end{Esempio} +\caption{Dashed and dotted lines}\label{fig:DashDot} +\end{figure} + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\subsection{Generic curves} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + With the \cs{Curve} macro it is possible to make line art or filled shapes. Figures~\ref{fig:hearts} show the same shape, the first just stroked and the second color filled. + +\begin{figure}[!htp] +\begin{Esempio}[\setfontsize{9}](0.65) +\unitlength=8mm\relax +\begin{picture}(5,5) +\put(0,0){\framebox(5,5){}}\thicklines\roundcap +\Curve(2.5,0)<0.1,1>(5,3.5)<0,1>% + (4,5)<-1,0>(2.5,3.5)<-0.1,-1.2>[-0.1,1.2]% + (1,5)<-1,0>(0,3.5)<0,-1>(2.5,0)<0.1,-1> +\end{picture} +\end{Esempio} + +\vspace*{2\baselineskip} + +\begin{Esempio}[\setfontsize{9}](0.65) +\unitlength=8mm\relax +\begin{picture}(5,5) +\put(0,0){\framebox(5,5){}}\thicklines\roundcap +\color{orange}\relax +\Curve*(2.5,0)<0.1,1>(5,3.5)<0,1>% +(4,5)<-1,0>(2.5,3.5)<-0.1,-1.2>[-0.1,1.2]% +(1,5)<-1,0>(0,3.5)<0,-1>(2.5,0)<0.1,-1> +\end{picture} +\end{Esempio} +\caption{A stroked and a filled heart shaped contour} +\label{fig:hearts} +\end{figure} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\subsection{The \cs{multiput} command} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + The new \cs{multiput} and \cs{xmultiput} commands are extensions of the + original \cs{multiput} macro; both are used to put a number of objects + according to a discrete law; but they can produce surprising effects. + Figure~\ref{fig:multiput} displays several examples. As it possible + to see, the black dots are evenly distributed along the canvas diagonal; + the green filled squares are along a sloping down line inclined by + $15^\circ$ as specified by the polar coordinates of the \meta{increment}; + the blue filled triangles are distributed along a parabola; the red + stroked diamonds are distributed along a half sine wave. + +\noindent\begin{figure}[!htb] +\begin{Esempio}[\setfontsize{8}](0.55) +\unitlength=0.01\linewidth +\begin{picture}(100,100) +\GraphGrid(100,100) +\multiput(0,0)(10,10){11}{\circle*{2}} +\color{blue!70!white} +\multiput(0,0)(10,0){11}{% +\RegPolygon*{2}{3}<\color{blue!70!white}>}% + [\GetCoord(\R)\X\Y + \edef\X{\fpeval{\X+10}} + \edef\Y{\fpeval{(\X/10)**2}} + \CopyVect\X,\Y to\R] +\multiput(0,0)(10,1){11}{% +\RegPolygon{2}{4}<\color{magenta}>}% + [\GetCoord(\R)\X\Y + \edef\X{\fpeval{\X+10}} + \edef\Y{\fpeval{sind(\X*1.8)*100}} + \CopyVect\X,\Y to\R] +\multiput(50,50)(-15:5){11}{% +\RegPolygon*{2}{4}[45]<\color{green!60!black}>} +\end{picture} +\end{Esempio} +\caption{Some examples of the \meta{handler} optional argument} +\label{fig:multiput} +\end{figure} + + Another interesting construction is a clock quadrant; this is shown + in figure~\ref{fig:orologio} + +\begin{figure}[!htb] +\begin{Esempio}[\setfontsize{9.5}](0.525) +\unitlength=0.0095\linewidth +\begin{picture}(100,100) +\GraphGrid(100,100) +\put(50,50){\thicklines\circle{100}} +\xmultiput[50,50](60:35)(-30:1){12}% + {\makebox(0,0){\circle*{2}}}% + [\MultVect\R by\D to\R]% +\xmultiput[50,50](60:40)(-30:1){12}% + {\ArgOfVect\R to\Ang + \rotatebox{\fpeval{\Ang-90}}% + {\makebox(0,0)[b]{% + \Roman{multicnt}}}}% + [\Multvect{\R}{\D}\R] +\thicklines\put(50,50){\circle*{4}} +\put(50,50){\Vector(37.5:30)} +\put(50,50){\Vector(180:33)} +\end{picture} +\end{Esempio} +\caption{Usage example of the \texttt{\string\xmultiput} command} +\label{fig:orologio} +\end{figure} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + \subsection{Drawing mathematical functions} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + Figure~\ref{fig:iperbole} shows an equilateral hyperbola; since it + has asymptotes, the drawing must be carefully done avoiding overflows, + parts of drawing out of the \env{picture} area. Nevertheless + the possibility of describing mathematical functions in terms of L3 + functions (in spite of the same name, they are completely different + things) makes it possible to exploit the \meta{settings} argument to + do the job with \cs{xmultiput}. + +\begin{figure*}[!tp] +\begin{Esempio}[\setfontsize{9}](0.5)% +\unitlength=0.008\linewidth +\begin{picture}(100,100) +\GraphGrid(100,100) +\VECTOR(0,0)(100,0)\Pbox(100,0)[tr]{x}[0] +\VECTOR(0,0)(0,100)\Pbox(0,100)[tr]{y}[0] +\Pbox(0,0)[r]{O}[3pt] +\thicklines +\moveto(10,100)\countdef\I=2560 \I=11 +\xmultiput(0,0)(1,0){101}% + {\lineto(\I,\fpeval{1000/\I})}% + [\advance\I by1 \value{multicnt}=\I] +\strokepath +\end{picture} +\end{Esempio} +\caption{An equilateral hyperbola drawn with a thinly sampled piecewise + continuous line}\label{fig:iperbole} +\end{figure*} + + A more complicated drawing can be done by expressing the function to draw + with parametric equations; the idea is to code the math formulas +\[\begin{cases} +x(t) = f_1(t)\\ +y(t) = f_2(t) +\end{cases}\] +because it is easy to code the $x$ and the $y$ component and use the + \cs{fpdowhile} command to trace the curve with a piecewise continuous + line; actually a continuous line with a piecewise continuous derivative; + it is important to sample the curve in a sufficient dense way. + A heart shaped mathematical function taken from the internet + \footnote{\url{http://mathworld.wolfram.com/HeartCurve.html} reports + several formulas, including the cardioid, but the one we use here is + a different function} is the following +\begin{align*} +x(t) &= \sin^3(t)\\ +y(t) &= \dfrac{13\cos(t)-5\cos(2t)-2\cos(3t)-\cos(4t)}{16} +\end{align*} + Figure~\ref{fig:math-heart} displays the graph, and its code, and, most + important, the L3 definition of the parametric equations. Compared to + the previous equations we applied a scale factor and added the final + term \texttt(2.4) in order to shift a little bit the drawing so as to + vertically center it . + +\begin{figure*}[!tbp] +\begin{minipage}{\textwidth} +\def\codefraction{0.5} +\dimendef\Wuno=2000 \Wuno=\codefraction\textwidth +\dimendef\Wdue=2002 \Wdue=\dimexpr\textwidth-\columnsep-\Wuno\relax +\begin{minipage}{\Wuno}\setfontsize{6.9}% +\begin{verbatim} +% Parametric equations of the "heart" +\providecommand\heart[3]{% +\edef\X{\fpeval{#1*16*(sind(#2)^3)}} +\edef\Y{\fpeval{#1*(13*cosd(#2) - 5*cosd(2*#2) + - 2*cosd(3*#2) -cosd(4*#2)+2.4)}} +\CopyVect\X,\Y to#3} +% +% Drawing +\unitlength=0,005\linewidth +\begin{picture}(200,200)(-100,-100) +\GraphGrid(-100,-100)(200,200) +\VECTOR(-100,0)(100,0)\Pbox(100,0)[tr]{x}[0] +\VECTOR(0,-100)(0,100)\Pbox(0,100)[tl]{y}[0] +\Pbox(0,0)[tr]{O}\linethickness{1pt}\bgroup +\edef\scala{\fpeval{100/16}} +\countdef\I=2560 \I=0\roundjoin +\fpdowhile{\I !>360}{\heart\scala\I\Punto +\ifnum\I=0 \moveto(\Punto)\else \lineto(\Punto)\fi +\advance\I by 3}\strokepath\egroup +\end{picture}\end{verbatim} +\end{minipage} +\hfill +\begin{minipage}{\Wdue}\raggedleft +\setfontsize{8}% +% +\providecommand\heart[3]{% +\edef\X{\fpeval{#1*16*(sind(#2)^3)}} +\edef\Y{\fpeval{#1*(13*cosd(#2) - 5*cosd(2*#2) + - 2*cosd(3*#2) -cosd(4*#2)+2.4)}} +\CopyVect\X,\Y to#3} +% +\unitlength=0,005\linewidth +\begin{picture}(200,200)(-100,-100) +\GraphGrid(-100,-100)(200,200) +\VECTOR(-100,0)(100,0)\Pbox(100,0)[tr]{x}[0] +\VECTOR(0,-100)(0,100)\Pbox(0,100)[tl]{y}[0] +\Pbox(0,0)[tr]{O}\linethickness{1pt}\bgroup +\edef\scala{\fpeval{100/16}} +\countdef\I=2560 \I=0\roundjoin +\fpdowhile{\I !>360}{\heart\scala\I\Punto +\ifnum\I=0 \moveto(\Punto)\else \lineto(\Punto)\fi +\advance\I by 3}\strokepath\egroup +\end{picture} +\end{minipage} +\end{minipage} +\caption{A heart shaped mathematical function drawn with a thinly sampled + piecewise continuous line}\label{fig:math-heart} +\end{figure*} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\subsection{Triangles and their special lines} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + Triangles have special lines; they are the median, the height, and the + bisector lines. They join each vertex with a specific point of the + apposite side, respectively with the middle point, the intersection + with the side perpendicular line, and the intersection with the bisector + line. Figure~\ref{fig:MHBlines} displays the construction of the three + special lines relative to a specific vertex. Thanks to the macros + described earlier in this list, this drawing is particularly simple; most + of the code is dedicated to labelling the various points and to + assign coordinate values to the macros that are going to use them + in a symbolic way. The generic triangle (not a regular polygon) requires + one line, and the determination of the intersections of the lines with + the suitable triangle side, and their tracing requires two code lines + each. + +\begin{figure}[!tb]\centering +\begin{Esempio}[\setfontsize{6.9}](0.4) +\unitlength=0.008\linewidth +\begin{picture}(100,100)(0,-10) +\GraphGrid(0,-10)(100,100) +\def\Puno{0,0} \def\Pdue{0,80} \def\Ptre{100,60} + {\thicklines\polygon(\Puno)(\Pdue)(\Ptre)}% + \Pbox(\Puno)[tc]{P_1}[1] +\Pbox(\Pdue)[bc]{P_2}[1]\Pbox(\Ptre)[bc]{P_3}[1] + % Median + \TriangleMedianBase\Puno on \Pdue and \Ptre to\M + \Pbox(\M)[bc]{M}[1.5]\segment(\Puno)(\M) +% Height + \TriangleHeightBase\Puno on \Pdue and\Ptre to\H + \Dotline(\Puno)(\H){2}[1.5]\Pbox(\H)[bc]{H}[1.5] +% Bisector + \TriangleBisectorBase\Puno on\Pdue and\Ptre to\B + \Dashline(\Puno)(\B){3}\Pbox(\B)[b]{B}[1.5] +\end{picture} +\end{Esempio} +\caption{A triangle with the median, the height, and the bisector lines + from a specific vertex}\label{fig:MHBlines} +\end{figure} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + \subsection{Special triangle centers} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + Each triplet of a triangle special lines of the same kind intersect each + other in a special point; the median lines intersect in the + \emph{barycenter}, the height lines in the \emph{orthocenter}, the + bisectors lines in the \emph{incenter}; these centers may be those of + special circles: Figures~\ref{fig:barycenter} to~\ref{fig:circumcenter}; + the \emph{incircle}, centered in the incenter, + has a special name, because it has the property of being tangent to all + the three triangle sides; there is also the circumcircle that passes + through the three vertices, its center is the intersection of the + three side axes. There is also the \emph{nine point circle}. + Figures~\ref{fig:barycenter}, \ref{fig:orthocenter}, \ref{fig:incenter}, + and~\ref{fig:circumcenter} display the necessary constructions and, + possibly, also the special circles they are centers of. + +\begin{figure}[!htb] +\begin{Esempio}[\setfontsize{6.5}](0.45) +\unitlength=0.008\linewidth +\begin{picture}(100,100)(0,-10) +\GraphGrid(0,-10)(100,100) +\def\Puno{0,0}\def\Pdue{0,80}\def\Ptre{100,60} +{\linethickness{0.6pt}\polygon(\Puno)(\Pdue)(\Ptre)}% +\Pbox(\Puno)[tl]{P_1}[1.5]% +\Pbox(\Pdue)[bl]{P_2}[1.5]\Pbox(\Ptre)[bc]{P_3}[1.5] + \TriangleMedianBase\Puno on\Pdue and \Ptre to\Mu + \TriangleMedianBase\Pdue on\Ptre and \Puno to\Md + \TriangleMedianBase\Ptre on\Puno and \Pdue to\Mt +\Dotline(\Puno)(\Mu){3}[1.5] +\Dotline(\Pdue)(\Md){3}[1.5] +\Dotline(\Ptre)(\Mt){3}[1.5] +\IntersectionOfSegments(\Puno)(\Mu)and(\Pdue)(\Md)to\C +\Pbox(\C)[t]{B}[2] +\end{picture} +\end{Esempio} +\caption{Determination of the barycenter}\label{fig:barycenter} +\end{figure} + +\begin{figure}[!htb] +\begin{Esempio}[\setfontsize{6.5}](0.45) +\unitlength=0.008\linewidth +\begin{picture}(100,100)(0,-10) +\GraphGrid(0,-10)(100,100) +\def\Puno{0,0}\def\Pdue{0,80}\def\Ptre{100,60} +{\linethickness{0.6pt}\polygon(\Puno)(\Pdue)(\Ptre)}% +\Pbox(\Puno)[tl]{P_1}[1.5]% +\Pbox(\Pdue)[bl]{P_2}[1.5]\Pbox(\Ptre)[bc]{P_3}[1.5] + \TriangleHeightBase\Puno on\Pdue and \Ptre to\Hu + \TriangleHeightBase\Pdue on\Ptre and \Puno to\Hd + \TriangleHeightBase\Ptre on\Puno and \Pdue to\Ht +\Dotline(\Puno)(\Hu){3}[1.5] +\Dotline(\Pdue)(\Hd){3}[1.5] +\Dotline(\Ptre)(\Ht){3}[1.5] +\IntersectionOfSegments(\Puno)(\Hu)and(\Pdue)(\Hd)to\C +\Pbox(\C)[t]{H}[2] +\end{picture} +\end{Esempio} +\caption{Determination of the orthocenter}\label{fig:orthocenter} +\end{figure} + +\begin{figure}[!htb] +\begin{Esempio}[\setfontsize{6}](0.45) +\unitlength=0.008\linewidth +\begin{picture}(100,100)(0,-10) +\GraphGrid(0,-10)(100,100) +\def\Puno{0,0}\def\Pdue{0,80}\def\Ptre{100,60} +{\linethickness{0.6pt}% + \polygon(\Puno)(\Pdue)(\Ptre)}% +\Pbox(\Puno)[tl]{P_1}[1.5]% +\Pbox(\Pdue)[bl]{P_2}[1.5] +\Pbox(\Ptre)[bc]{P_3}[1.5] + \TriangleBisectorBase\Puno on\Pdue and \Ptre to\Iu + \TriangleBisectorBase\Pdue on\Ptre and \Puno to\Id + \TriangleBisectorBase\Ptre on\Puno and \Pdue to\It +\Dotline(\Puno)(\Iu){3}[1.5] +\Dotline(\Pdue)(\Id){3}[1.5] +\Dotline(\Ptre)(\It){3}[1.5] +\IntersectionOfSegments(\Puno)(\Iu)% + and(\Pdue)(\Id)to\C +\Pbox(\C)[t]{I}[2] +\DistanceOfPoint\C from(\Puno)(\Pdue)to\R +\Circlewithcenter\C radius\R +\end{picture} +\end{Esempio} +\caption{Determination of the incenter and of the incircle}\label{fig:incenter} +\end{figure} + +\begin{figure}[!htb] +\begin{Esempio}[\setfontsize{6.25}](0.45) +\unitlength=0.01\linewidth +\begin{picture}(100,110) +\GraphGrid(100,110) +\CopyVect20,10to\Pu \Pbox(\Pu)[t]{P_1} +\CopyVect10,90to\Pd \Pbox(\Pd)[br]{P_2} +\CopyVect100,70to\Pt \Pbox(\Pt)[l]{P_3} +{\linethickness{0.6pt}\polygon(\Pu)(\Pd)(\Pt)}% +\AxisOf\Pd and\Pu to\Mu\Du +\AxisOf\Pu and\Pt to\Md\Dd +\AxisOf\Pt and\Pd to\Mt\Dt +\IntersectionOfLines(\Mu)(\Du)and(\Md)(\Dd)to\C +\AddVect\Mu and\Du to\Du\Dotline(\Mu)(\Du){3}[2] +\AddVect\Md and\Dd to\Dd\Dotline(\Md)(\Dd){3}[2] +\AddVect\Mt and\Dt to\Dt\Dotline(\Mt)(\Dt){3}[2] +\Pbox(\C)[t]{C}[2.5] +\ThreePointCircle*(\Pu)(\Pd)(\Pt) +\end{picture}\end{Esempio} +\caption{Determination of the circumcenter and of the circumcircle}\label{fig:circumcenter} +\end{figure} + + Although these examples require some new simple macros, described + in the previous sections; some more more examples can be made that require + more complex macros. Even these macros are just examples. For other + applications it is probably necessary to add more macros. + + Let us proceed with the construction of the Steiner ellipse: given a + triangle, there exists only one ellipse that is internally tangent to + the side middle points. + + The geometrical construction goes on this way; suppose you have to draw + the Steiner ellipse of triangle $T$; finding the side middle points + has already been shown, but the process to build the ellipse is still + to be found. So let us chose a side to work as the base of triangle $T$, + and perform an affine shear transformation parallel to the base + so as to move the vertex of triangle $T$, opposite to the base, to the + base axis, we get another triangle $T_1$ that is isosceles; if it is + not yet so, let us make another compression/expansion affine + transformation, so as to get an equilateral triangle $T_2$; this last + triangle is particularly simple to handle, because its Steiner ellipse + reduces to its incircle. If we apply in reverse order the above + transformations we get the Steiner ellipse we were looking for. + The only difficult part is the affine shear transformation. + + The L3 functions we already created take care of all such + transformations, but with an optional asterisk we can draw the + intermediate passages where triangles $T_2$ and $T_1$ have their base + shifted and rotated to be horizontal, so that some translations and + rotations are also necessary. Figure~\ref{fig:Steiner-finale} displays + the final result and the code necessary to build it. + +\begin{figure}[!htb] +\begin{Esempio}[\setfontsize{8}](0.5) +\unitlength=0.01\linewidth +\begin{picture}(100,110) +\GraphGrid(100,110)% +\SteinerEllipse(10,10)(90,20)(60,105)[2] +\end{picture}\end{Esempio} +\caption{The Steiner ellipse of a given triangle} +\label{fig:Steiner-finale} +\end{figure} + + With just the addition of an asterisk we can draw the whole geometrical + construction; see figure~\ref{fig:Steiner-intermedio} + +\begin{figure}[!htb] +\begin{Esempio}[\setfontsize{8}](0.5) +\unitlength=0.01\linewidth +\begin{picture}(100,110)(0,-10) +\GraphGrid(0,-10)(100,110)% +\SteinerEllipse*(10,10)(90,20)(60,105)[2] +\end{picture}\end{Esempio} +\caption{The construction of the Steiner ellipse of a given triangle} +\label{fig:Steiner-intermedio} +\end{figure} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\subsection{A triangle internally tangent ellipse given one of its foci} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + It is possible to draw an ellipse that is internally tangent to + a triangle if one of its foci is specified; without this specification + the problem is not definite, and the number o such ellipses is countless. + But with the focus specification, just one ellipse exists with that + tangency constraint. It suffices to find the other focus and at least + one point of tangency, because the focal distance and the sum of + distances of that tangency point from the foci, is sufficient to + determine all the parameters required to draw the ellipse. + +\begin{figure}[!tb]\centering +\begin{Esempio}[\setfontsize{7}](0.375) +\unitlength=0.0065\linewidth +\begin{picture}(150,150)(-30,-20) +\GraphGrid(-30,-20)(150,150) +\EllipseWithFocus% + (10,40)(110,10)(0,110)(20,60) +\end{picture}\end{Esempio} +\caption{An ellipse internally tangent to a triangle, given a focus} +\label{fig:ellisse-interna-finale} +\end{figure} + +\begin{figure}[!tb] +\begin{Esempio}[\setfontsize{7}](0.375) +\unitlength0.0065\linewidth +\begin{picture}(150,150)(-30,-20) +\GraphGrid(-30,-20)(150,150) +\EllipseWithFocus*% + (10,40)(110,10)(0,110)(20,60) +\end{picture}\end{Esempio} +\caption{Construction of the ellipse of figure~\ref{fig:ellisse-interna-finale}}\label{fig:ellisse-interna} +\end{figure} + + + The geometrical construction is rather complicated; the steps to follow + are the following: +\begin{itemize}[noitemsep] + +\item draw the triangle and the given focus $\mathsf{F}$; + +\item Find the symmetrical points $\mathsf G_i$ of this focus with + respect to the sides of the triangle; + +\item use these three points $\mathsf G_i$ as the vertices of a triangle + with which to draw its circumcircle, actually only its center is of + interest, because it represents the second focus $\mathsf F'$; the + inter focal distance $2c$; is just le length of vector $F' -F$; + +\item join with segments each symmetrical point $\mathsf G_i$ with the + second focus $\mathsf F'$ and find their intersections $\mathsf T_i$ + with the triangle sides; they represent the tangency points of the + ellipse to be drawn; + +\item use one of these tangency points to find its distances from the + foci; their sum gives the ellipse larger axis length $2a$; + +\item equation~\eqref{equ:axes-foci} allows to find the second axis + length; the segment that joins the foci has the required inclination + of the main axis; therefore all necessary pieces of information to + draw the ellipse are known. + +\end{itemize} + Figures~\ref{fig:ellisse-interna-finale} and~\ref{fig:ellisse-interna} + display the construction steps and the final result. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + \section{Conclusion} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + We have shown that the \amb{picture} environment, extended with + this package \pack{euclideangeometry} (that takes care of loading + \pack{curve2e} and \pack{pict2e}) can make important diagrams that + certainly were not foreseen by Leslie Lamport when he first wrote the + code for the initial \env{picture} environment. + + The reader can easily understand that this package is far from being + exhaustive for all geometrical problema]s to be solved with ruler and + compass; it shows a way to add more commands to approach further problems; + if any author, who creates new commands, would like to contribute more + macros to this package, I will be happy to integrate his/her contribution + to a new version of this package; depending on the contribution, I would + be very happy to add its author name to this package author list; for + simpler contributions each contributor will be duly acknowledged. + + Creating new macros to solve more problems is pleasant and more + difficult is the problem, greater is the satisfaction in solving it. + + +\begin{center} + Have fun with \LaTeX and its potential applications! +\end{center} + +\end{document}
\ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/euclideangeometry/euclideangeometry.pdf b/Master/texmf-dist/doc/latex/euclideangeometry/euclideangeometry.pdf Binary files differnew file mode 100644 index 00000000000..6246a0b6045 --- /dev/null +++ b/Master/texmf-dist/doc/latex/euclideangeometry/euclideangeometry.pdf diff --git a/Master/texmf-dist/source/latex/euclideangeometry/euclideangeometry.dtx b/Master/texmf-dist/source/latex/euclideangeometry/euclideangeometry.dtx new file mode 100644 index 00000000000..6078fe5cfae --- /dev/null +++ b/Master/texmf-dist/source/latex/euclideangeometry/euclideangeometry.dtx @@ -0,0 +1,1588 @@ +% \iffalse +% !TEX encoding = UTF-8 Unicode +%<*internal> +\begingroup +\input docstrip.tex +\keepsilent +\preamble + + Copyright (C) 2020 Claudio Beccari all rights reserved. + License information appended + +\endpreamble + +\postamble + +Distributable under the LaTeX Project Public License, +version 1.3c or higher (your choice). The latest version of +this license is at: http://www.latex-project.org/lppl.txt + +This work is "maintained" + +This work consists of files: +1) euclideangeometry.dtx, and the derived files euclideangeometry.sty + and euclideangeometry.pdf, +2) euclideangeometry-man.tex and the derived file euclideangeometry-man.pdf, +3) the auxiliary derived file README.txt + +\endpostamble +\askforoverwritefalse + +\generate{\file{euclideangeometry.sty}{\from{euclideangeometry.dtx}{package}}} +\generate{\file{README.txt}{\from{euclideangeometry.dtx}{readme}}} + +\def\tmpa{plain} +\ifx\tmpa\fmtname\endgroup\expandafter\bye\fi +\endgroup +%</internal> +% \fi +% +% \iffalse +%<*driver> +\ProvidesFile{euclideangeometry.dtx}% +%</driver> +%<package>\NeedsTeXFormat{LaTeX2e}[2019/01/01] +%<package>\ProvidesPackage{euclideangeometry}% +%<readme>File README.txt for package euclideangeometry +%<*package|readme> + [2020-02-02 v.0.1.2 Extension package for curve2e] +%</package|readme> +%<*driver> +\documentclass{ltxdoc}\errorcontextlines=100 +\hfuzz 10pt +\usepackage[utf8]{inputenc} +\usepackage{lmodern,textcomp} +\usepackage{mflogo} +\usepackage{multicol,amsmath,fancyvrb,graphicx,verbatim} +\usepackage{etoolbox,enumitem,xspace,xcolor,euclideangeometry} +\providecommand*\diff{\mathop{}\!\mathrm{d}} +\renewcommand\meta[1]{{\normalfont\textlangle\textit{#1}\textrangle}} +\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)}} +\providecommand\pack{} +\renewcommand*\pack[1]{{\textsf{#1}}} +\providecommand\opt{} +\renewcommand*\opt[1]{{\normalfont\textsl{#1}}}\let\opz\opt +\providecommand\env{} +\renewcommand*\env[1]{{\normalfont\textit{\bfseries#1}}}\let\amb\env + +\providecommand\TB{\mbox{\normalfont\slshape TUGboat}\xspace} + +\AfterEndPreamble{% +\apptocmd{\TeX}{{}\xspace}{}{} +\apptocmd{\LaTeX}{{}\xspace}{}{}} + + +\begin{document}\errorcontextlines=100 +\GetFileInfo{euclideangeometry.dtx} +\title{The \textsf{euclideangeometry} package} +\author{Claudio Beccari\\[1ex]\texttt{claudio dot beccari at gmail dot com}} +\date{Version \fileversion~--~Last revised \filedate.} +\maketitle +\columnseprule=0.4pt +\begin{multicols}{2} + \tableofcontents + \end{multicols} + \DocInput{euclideangeometry.dtx} +\end{document} +%</driver> +% \fi +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \section*{Preface} +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% This file contains the documented code of \pack{euclideangeometry}. +% The user manual source file \file{euclideangeometry-man.tex} and the +% readable document is \file{euclideangeometry.pdf}; it should already be +% installed with your updated complete \TeX system installation. + +% Please refer to the user manual before using this package. +% \CheckSum{1557} +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%\StopEventually{} +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +%\iffalse +%<*package> +%\fi +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \section{The code} +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \subsection{Checking the date of a sufficiently recent \texttt{curve2e} +% package} +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% This package has been already identified by the commands extracted +% by the |docstrip| package, during the |.dtx| file compilation. +% Therefore we start providing the |\GetFileInfo| in case the package +% is used outside a “documented \TeX\ source”; we just provide the +% definition from the |ltxdoc| class code. +% \begin{macrocode} +\makeatletter +\providecommand\GetFileInfo{} +\renewcommand\GetFileInfo[1]{% + \def\filename{#1}% + \def\@tempb##1 v.##2 ##3\relax##4\relax{% + \def\filedate{##1}\def\fileversion{##2}\def\fileinfo{##3}}% + \edef\@tempa{\csname ver@#1\endcsname}% + \expandafter\@tempb\@tempa\relax? ? \relax\relax} +% \end{macrocode} +% +% But in order to make the file date comparison for loading a suitable +% version of |curve2e| we need to strip away its date dash signs, +% so we define the |\cleanfiledate| macro that defines a |\FileDate| macro +% with a purely numerical string, suitable for numerical comparisons; +% if the fetched class file is so old that the date is not in the ISO +% format (for example with slashes instead of dashes) the macro fails +% and the interpreter comparison algorithm produces \TeX\ error messages. +% \begin{macrocode} +\def\cleanfiledate#1-#2-#3!{\unless\ifx#3\empty +\edef\FileDate{#1#2#3}\else\unless\ifx#2\empty +\edef\FileDate{#1#2}\else\edef\FileDate{#1}\fi\fi} +% \end{macrocode} +% In any case, if the test checks that the |curve2e| file date is too old; +% it warns the user with an emphasised error message on the console, +% loading this |euclideangeometry| package is stopped and the whole +% job aborts. The emphasised error message appears like this: +%\begin{flushleft}\ttfamily\obeylines +%************************************************************* +%Package curve2e too old +%Be sure that your TeX installation is complete and up to date +%************************************************************* +%Input of euclideangeometry is stopped and job aborted +%************************************************************* +%\end{flushleft} +% This message should be sufficiently strong in order to avoid using +% this package with a vintage version of \TeXLive or Mik\TeX. +% \begin{macrocode} +\RequirePackage{curve2e} +\GetFileInfo{curve2e.sty} +\expandafter\cleanfiledate\filedate! + +\ifnum\FileDate<20200118 +\typeout{*************************************************************} +\typeout{Package curve2e too old} +\typeout{Be sure that your TeX installation is complete and up to date} +\typeout{*************************************************************} +\typeout{Input of euclideangeometry stopped and job aborted} +\typeout{*************************************************************} +\expandafter\@@end\fi + +% \end{macrocode} +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \subsection{Service macros} +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% The following macros are useful for typesetting the manual; but they +% might be useful also for the final user; they mostly define commands +% that classify the various entities of the programming language with +% (generally different) font families, series and shapes; but the commands +% that receive the “name of an argument” enclose this name between math +% angle brackets. +% \begin{macrocode} +\providecommand\file{} +\renewcommand*\file[1]{{\normalfont\texttt{#1}}} +\providecommand\prog{} +\renewcommand*\prog[1]{{\normalfont\texttt{#1}}} +\newcommand*\conta[1]{\texttt{\slshape#1}} +\providecommand\cs{} +\renewcommand\cs[1]{{\normalfont\texttt{\char92#1}}} +\providecommand\meta{} +\renewcommand*\meta[1]{{\normalfont$\langle$\textit{#1}$\rangle$}} +\providecommand\marg{} +\renewcommand*\marg[1]{{\ttfamily \char123\meta{#1}\char125}} +\newcommand*\Marg[1]{{\normalfont\ttfamily\{#1\}}}\let\Arg\Marg +\providecommand\oarg{} +\renewcommand*\oarg[1]{{\ttfamily[\meta{#1}]}} +\newcommand*\Oarg[1]{{\ttfamily[#1]}} +\newcommand*\aarg[1]{{\ttfamily{<\meta{#1}>}}} +\newcommand*\Aarg[1]{{\ttfamily<#1>}} +\newcommand*\Bambiente[1]{\texttt{\char92begin\{#1\}}} +\newcommand*\Eambiente[1]{\texttt{\char92end\{#1\}}} +\newcommand*\garg[1]{\texttt{(\splitgarg#1,!)}}\let\parg\garg +\newcommand*\Garg[1]{\texttt{(#1)}}\let\Parg\Garg + \def\secgarg#1,{#1} + \def\splitgarg#1,#2!{% + \ifstrequal{#2}{}{\meta{#1}}{\meta{#1},\meta{\secgarg#2}}} +\providecommand\pack{} +\renewcommand*\pack[1]{{\normalfont\textsf{#1}}} +\providecommand\opt{} +\renewcommand*\opt[1]{{\normalfont\textsl{#1}}}\let\opz\opt +\providecommand\env{} +\renewcommand*\env[1]{{\normalfont\textit{\bfseries#1}}}\let\amb\env +% \end{macrocode} +% The next commands are defined in the |babel-italian| module for |babel|; +% |\ped| introduces a subscript in math mode, but the command may be used +% also in text mode; the same holds true also for |\ap| that introduces +% a superscript. |\unit| is a shorthand for attaching the units of measure +% in math upright roman font, with an unbreakable space between the measure +% and its units; |\sigla| is the Italian equivalent of |\acronym|, that +% avoids any conflict with other packages; |\iu| (alias|\gei|) typesets +% the imaginary unit in roman font according to the ISO regulations; +% |\eu| defines the roman type “e”, the Neper number, as a math operator; +% we all know that “e” is not an operator, but it is used very often as +% the base of an exponential, therefore, in math mode it is better to +% leave the necessary space before and after it, without any space between +% it and its exponent. +% \begin{macrocode} +\providecommand*\ped[1]{\ensuremath{_{\mathrm{#1}}}} +\providecommand*\ap[1]{\ensuremath{^{\mathrm{#1}}}} +\providecommand*\unit[1]{\ensuremath{\,\mathrm{#1}}} +\providecommand*\sigla[1]{\textsc{\lowercase{#1}}} +\providecommand*\iu{\ensuremath{\mathrm{i}}}\let\gei\iu +\providecommand*\eu{\ensuremath{\mathop{\mathrm{e}}\nolimits}} +% \end{macrocode} +% +% The next code is used to typeset the logo of \Ars logo, and the logo +% of \LyX; the other command |\GuIT| typesets equally well the \GuIT logo; +% if necessary the |\RequirePackage| macro loads the |xspace| package; +% therefore these macros do not require any special terminator of the +% control sequence name, because the |\xspace| command takes care of the +% necessary space; this command avoids inserting any space if macros are +% followed by any reasonable sign different form a space, such as +% punctuation marks, parentheses, quotation marks, and so on. +% +% \begin{macrocode} +\DeclareRobustCommand*{\Ars}{% + \textsf{\lower -.48ex\hbox{\rotatebox{-20}{A}}\kern -.3em{rs}}% + \kern -.05em\TeX\unskip\kern -.17em\lower -.357ex\hbox{nica}\xspace} + +\DeclareRobustCommand*\LyX{% + L\kern-0.2em\raisebox{-0.5ex}{Y}\kern-0.2em{X}\xspace} + +\definecolor{verdeguit}{rgb}{0, 0.40, 0} +\RequirePackage{iftex} +\def\GuIT{\mbox{\color{verdeguit}\def\I{\textcolor{black}{I}}% +\ifPDFTeX + \usefont{T1}{lmr}{m}{sc} +\else + \usefont{TU}{lmr}{m}{sc} +\fi +g\raisebox{-0.715ex}{\kern-0.26em u}\kern-0.13em\I\kern-0.14em t}\xspace} +% \end{macrocode} +% The following macros |\usecs| and |\whilenum| allow the use the internal +% \LaTeX control sequence names that contain a |@| sign. They are not so +% useful in this package, but they might be useful for the end user. +% \begin{macrocode} +\providecommand*\usecs[1]{\csname#1\endcsname} +\providecommand*\whilenum[2]{\usecs{@whilenum}#1\do{#2}} +% \end{macrocode} +% Accordingly the following two macros, and their English aliases, allow +% to delay the output of a (possibly floating) object to a page of the +% desired parity; they are not infallible, because the the |\afterpage| +% command defined by package |afterpage| (loaded if necessary) operates +% on the typesetting program output routine and the object to be delayed +% might be lost on the way, or might get delayed too much; these facts +% take place very seldom, but are not impossible, the solution is to move +% back several paragraphs the command with is argument. +% \begin{macrocode} +\RequirePackage{afterpage} +\providecommand\supaginapari[1]{% + \afterpage{% + \ifodd\value{page}\expandafter\@firstoftwo + \else\expandafter\@secondoftwo + \fi{\supaginapari{#1}}{#1} + } +}\let\onevenpage\supaginapari +\providecommand\supaginadispari[1]{% + \afterpage{% + \ifodd\value{page}\expandafter\@secondoftwo + \else\expandafter\@firstoftwo + \fi{\supaginadispari{#1}}{#1} + } +}\let\onoddpage\supaginadispari +% \end{macrocode} +% The following \LaTeX related logos are provided so as to make them +% coherent with the smart final space we have discussed above. The real +% difference is that it is necessary to use tue |etoolbox| facilities; +% therefore the package is (possibly) loaded. With it we add at the end +% of their original definition the |\xspace| command. But what is the +% “original definition”? Of course |\TeX| and |\LaTeX| macros are defined +% within the \LaTeX kernel, but the user might have loaded other packages +% that have redefined them; therefore these patches are applied only at +% the preamble end, so if other definitions were provided by other +% packages loaded in the preamble, such redefinitions are patched. +% Only |\XeLaTeX| is completely redefined, because the other existing +% definitions work correctly only with OpenType fonts; with Type~1 fonts +% and oblique fonts (italics, slanted, etc.) the reversed “E” generally +% is inclined in the wrong direction; by rotating it, instead of +% reflecting it, the “E” might not be the best, but al least slants in +% the right direction. +% \begin{macrocode} +\RequirePackage{etoolbox} +\AfterEndPreamble{% +\apptocmd{\TeX}{{}\xspace}{}{} +\apptocmd{\LaTeX}{{}\xspace}{}{}} + +\DeclareRobustCommand*\TeXLive{\TeX\ Live\xspace} +\DeclareRobustCommand*\MiKTeX{MiK\TeX} +\DeclareRobustCommand*\MacTeX{Mac\TeX} +\DeclareRobustCommand*\pdfLaTeX{pdf\/\LaTeX} +\DeclareRobustCommand*\LuaLaTeX{Lua\LaTeX} +\DeclareRobustCommand*\XeLaTeX{X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi +\lower.5ex\hbox{\rotatebox[origin=c]{180}{E}}% +\ifdim\fontdimen1\font=0pt\kern-0.15em\else\kern-0.275em\fi +\LaTeX} +\DeclareRobustCommand*\TikZ{Ti\emph{k}Z\xspace} +\DeclareRobustCommand*\TUGboat{\textsl{TUG\-boat}\xspace} +% \end{macrocode} +% The following command is useful to output two column floats when +% typesetting in |twocolumn| mode. +% \begin{macrocode} +\renewcommand\dbltopfraction{1.} +% \end{macrocode} +% This apparently useless command becomes useful to separate a font +% selection command or the |\item| command from the following text so +% as to allow hyphenation in what follows; it is just a very innocent +% dirty trick, but it works. +% \begin{macrocode} +\def\hz{\hskip0pt} +% \end{macrocode} +% Here we have a command that allows to display some framed code; it is +% usable also to display the syntax of some commands; and when doing this +% action the full range of service macros at the beginning of this section +% play the best of their role. The English aliases for the opening and +% closing environments are also provided. Attention: do not use |\\| +% commands to specify new lines, unless you want to produce empty/blank +% lines; within this environment the source code “end of line” characters +% are not treated as spaces, but are actually executed according to their +% name. +% \begin{macrocode} +\newenvironment{ttsintassi}{\begin{lrbox}{0} +\minipage{\dimexpr\linewidth-2\fboxrule-2\fboxsep}\ttfamily\obeylines}% +{\endminipage\end{lrbox}\center\fbox{\box0}\endcenter} +\let\ttsyntax\ttsintassi \let\endttsyntax\endttsintassi +% \end{macrocode} +% The following macro probably will migrate to |curve2e|; meanwhile +% this redefinition is useful in order to save some input and to make +% a more flexible macro. We used it virtually in every picture we +% inserted in the user manual of this package; of course the user does +% not need to have any drawing superimposed onto a red grid. Actually +% the grid is useful while drawing; when the image is complete, the +% grid command may be deleted or its line commented out. The purpose +% of this macro is to avoid the |\put| command to place the grid; and +% since its reference point in the original definition is arbitrary, +% the connection with real coordinates is very small and might become +% confusing or of little help. +% Now the syntax is the following: +%\begin{ttsyntax} +%\cs(GraphGrid)\parg{reference point or dimensions}\parg{overall dimensions} +%\end{ttsyntax} +% where the second argument is optional; if it is missing, the first +% argument contains the \meta{overall dimensions}, otherwise it +% contains the lower left corner coordinate that represent the +% \meta{reference point} that an internal |\put| command will use +% to place the grid; if no \meta{reference point} is specified, the +% reference point is \texttt{0,0}, and the grid is |\put| with its +% lower left corner in the origin of the |picture| coordinates. +% \begin{macrocode} + +\unless\ifcsname Gr@phGrid\endcsname +\let\originalGraphGrid\GraphGrid +\RenewDocumentCommand\GraphGrid{r() d()}{% +\IfValueTF{#2}{\put(#1){\originalGraphGrid(#2)}}% + {\put(0,0){\originalGraphGrid(#1)}}}\fi +% \end{macrocode} +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%\subsection{Labelling} +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% While doing any graphical geometrical drawing it is necessary to label +% points, lines, angles and other such items. Non measurable labels should +% be in upright sans serif font, according to the ISO regulations, but here +% we are dealing witt point identified by macros the contain their +% (cartesian or polar) coordinates that very often are both labels +% and math variables. +% +% Here we provide a versatile macro that can do several things. Its name +% is |\Pbox| and it produces a box containing the label in math format. By +% default the point label is typeset with the math font variant produced +% by command |\mathsf|, but the macro is sufficiently versatile to allow +% other settings; It accepts several optional arguments, therefore it syntax is particular: +%\begin{ttsyntax} +%\cs{Pbox}\parg{coordinates}\oarg{alignment}\marg{label}\oarg{diameter}\meta{$\star$}\aarg{angle} +%\end{ttsyntax} +% where \meta{coordinates} are the coordinates where to possibly set a +% black dot with the specified \meta{diameter}; in any case it is the +% reference point of the \meta{label}; the \meta{alignment} is formed by +% the usual letters \texttt{t, b, c, l, r} that can be paired in a +% coherent way (for example the couple \texttt{tb} is evidently +% incoherent, as well as \texttt{lr}), but in absence of this optional +% specification, the couple \texttt{cc} is assumed; most often than +% not, the label position becomes such that when the user reviews the +% document drafts, s/he understands immediately that s/he forgot to specify +% some reasonable \meta{alignment} codes. Think of the \meta{alignment} +% letters as the position of the reference point with respect to the +% the \meta{label} optical center. The optional \meta{angle} argument +% produces a rotation of the whole label by that angle; it may be used +% in several circumstances, especially when the label is just text, to +% produce, for example, a sideways legend. It is useful also when the +% labels are produced within a rotated box, in order to counterrotate them. +% +% The optional asterisk draws a frame around the \emph{label}. Notice that +% the separator between the visible or the invisible frame and the box +% contents varies according the the fact the the \meta{alignment} +% specification contains just one or two letter codes; this is useful, +% because the diagonal position of the label should be optically equal +% to the gap that exists between the reference point and the \meta{label} +% box. +% +% If the \meta{diameter} is zero, no dot is drawn, the whole \meta{label} +% is typeset with the |\mathit| math font; otherwise only the first symbol +% of a math expression si typeset in sans serif. The presence of subscripts +% makes the labels appear more distant from their reference point; the same +% is true when math symbols, even without subscripts, are used, because +% of the oblique nature of the math letters alphabet. +% +% If some text has to be printed as a label, it suffices to surround it +% with dollar signs, that switch back to text mode when the default mode +% is the math one. With this kind of textual labels it might be convenient +% to use the optional asterisk to frame the text. +% \begin{macrocode} +\providecommand\Pbox{} +\RenewDocumentCommand\Pbox{D(){0,0} O{cc} m O{0.5ex} s D<>{0}}{% +\put(#1){\rotatebox{#6}{\makebox(0,0){% +\dimendef\Dim=2566\relax +\settowidth\Dim{#2}% +\edef\Rapp{\fpeval{\Dim/{1ex}}}% +\fptest{\Rapp > 1.5}{\fboxsep=0.5ex}{\fboxsep=0.75ex}% +\IfBooleanTF{#5}{\fboxrule=0.4pt}{\fboxrule=0pt}% +\fptest{#4 = 0sp}% + {\makebox(0,0)[#2]{\fbox{$\relax#3\relax$}}}% + {\edef\Diam{\fpeval{(#4)/\unitlength}}% + \makebox(0,0){\circle*{\Diam}}% + \makebox(0,0)[#2]{\fbox{$\relax\mathsf#3\relax$}}% + }}}% +}\ignorespaces} +% \end{macrocode} +% The following command, to be used always within a group, or a +% environment or inside a box, works only with piecewise continuously +% scalable font collection, such as, for example, the Latin Modern +% fonts, or with continuously scalable fonts, such as, for example, +% the Times ones. They let the operator select, for the scope of the +% command ,any size, even fractional so as to fine adjust the text +% width in the space allowed for it; it is particularly useful with +% the monospaced fonts, that forbid hyphenation, and therefore cannot +% be adjusted to the current line width. +% \begin{macrocode} +\DeclareRobustCommand\setfontsize[2][1.2]{% + \linespread{#1}\fontsize{#2}{#2}\selectfont} +% \end{macrocode} +% With OpenType fonts there should not be any problems even with math +% fonts; with Type~1 fonts the only scalable fonts I know of, are the +% LibertinusMath fonts, usable through the LibertinusT1math package, are +% also the only ones that have 8~bit encoded math fonts (256 +% glyph fonts), while the standard default Type~1 math fonts are just +% 7~bit encoded (128 glyphs fonts). +% +% Another useful labelling command is |Zbox|; this command is an +% evolution of a command that I been using for years in several +% documents of mine. It uses some general text, not necessarily +% connected to a particular point of the |picture| environment, +% as a legend; It can draw short text as a simple horizontal box, +% and longer texts as a vertical box of specified width and height +% +% Is syntax is the following: +%\begin{ttsyntax} +%\cs{Zbox}\parg{position}\parg(dimensions)\oarg{alignment}\marg{text} +%\end{ttsyntax} +% where \meta{position} is where the reference point of the box has +% to be put in the picture; \meta{dimensions} are optional; if not +% specified, the box is a horizontal one, and it is as wide as its +% contents; if it is specified, it must be a comma separated list +% of two integer or fractional numbers that are the width and the +% height of the box; if the height is specified as zero, the width +% specifies a horizontal box of that width; \meta{alignment} is optional +% and is formed by one or two coherent letter codes from the usual set +% \texttt{t, b, c, l, r}; if the \meta{alignment} is absent, the +% default alignment letters are \texttt{bl}, i.e. the box reference +% point is the bottom left corner; \meta{text} contains general text, +% even containing some math. +% \begin{macrocode} + +\def\EUGsplitArgs(#1,#2)#3#4{\edef#3{#1}\edef#4{#2}} + +\providecommand\Zbox{} +\RenewDocumentCommand\Zbox{R(){0,0} D(){0,0} O{bl} m}{% +\EUGsplitArgs(#2)\ZboxX\ZboxY % separa la x e la y della scatola +\fboxsep=2\unitlength +\ifnum\ZboxX=\csuse{z@} + \def\ZTesto{\fbox{#4}}% +\else + \ifnum\ZboxY=\csuse{z@} + \def\ZTesto{\fbox{\parbox{\ZboxX\unitlength}{#4}}}% + \else + \def\ZTesto{% + \setbox2560=\hbox{\fbox{% + \parbox[c][\ZboxY\unitlength][c]{\ZboxX\unitlength}{#4}}}% + \dimen2560=\dimexpr(\ht2560 +\dp2560)/2\relax + \ht2560=\dimen2560\relax + \dp2560=\dimen2560\relax + \box2560% + }% + \fi +\fi +\put(#1){\makebox(0,0)[#3]{\ZTesto}}\ignorespaces} +% \end{macrocode} + +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%\subsection{The \texttt{Example} environment} +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Another very useful facility is the |Esempio| environment; +% it has an English alias |Example|, but we suggest to use the Italian +% name, because it is safer in order to avoid conflicts with other packages; +% this environment is very handy to typeset a stretch of code side by +% side its typeset result obtained by executing it; it has advantages and +% disadvantages, though. A similar environment was used to show the +% examples in the \emph{The \LaTeX Companion}; another similar environment +% may be used from the |tcolorbox| package (by T.F.~Sturm, read its +% documentation by using the terminal command |texdoc tcolorbox|) +% environment |tcolorbox| and using the keyword |sidebyside| among the +% options; package |fancyvrb| also offers a similar environment. +% The critical disadvantage is that that you cannot use any of these +% environments, not even this |Esempio| one, when typesetting a +% documented \TeX file, such as the one you are reading now. In facts +% the |.dtx| file has all text lines that start with a comment character, +% and the code parts, to be output to a |.sty|, or |.cls|, or whatever +% other file used by the \TeX system to format documents, are explicitly +% marked with the special delimiters \verb*|% \begin{macrocode}| and +% \verb*|% \end{macrocode}|. +% +% Therefore with those packages and with this |Esempio| environment +% the code you want to show appears with all lines with a |%| at the +% beginning. This certainly does not help the description of a software +% and this is the very reason why this package has a separate +% |euclideangeometry-man| manual typeset with the |article| class. +% +% Nevertheless this environment makes use of the facilities of the +% |verbatim| environment. +% +% \begin{macrocode} +\RequirePackage{verbatim} +\newwrite\example@out +\ProvideDocumentEnvironment{Esempio}{s O{\normalsize} D(){0.40}} +{\par\addvspace{3.0ex plus 0.8ex minus 0.5ex}\vskip -\parskip +\dimendef\Wboxu=2570 \dimendef\Wboxd=2572 +\Wboxu=#3\textwidth\relax +\Wboxd=\dimexpr\linewidth-\columnsep-\Wboxu\relax +\begingroup +\@bsphack +\immediate\openout\example@out\jobname-temp.tex +\let\do\@makeother\dospecials\catcode`\^^M\active +\def\verbatim@processline{% + \immediate\write\example@out{\the\verbatim@line}}% +\verbatim@start\relax}% +{\immediate\closeout\example@out\@esphack\endgroup +\begin{minipage}{\textwidth}% +\IfBooleanTF{#1}{\begin{minipage}{\textwidth}}{\begin{minipage}{\Wboxu}}% +#2\relax +\verbatiminput{\jobname-temp.tex} +\end{minipage}% +\IfBooleanTF{#1}{\par\bigskip}{\hfill}% +\IfBooleanTF{#1}{\begin{minipage}{\textwidth}}{\begin{minipage}{\Wboxd}}% +\raggedleft +\input{\jobname-temp} +\end{minipage} +\end{minipage}\par +%\medskip +%\par\addvspace{3.0ex plus 0.8ex minus 0.5ex}\vskip -\parskip +} +% \end{macrocode} + +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \subsection{Service macros for ellipses} +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% The |\ellisse| has a control sequence name in Italian; it differs for +% just one letter from the name |ellipse| English name, but we cannot use +% the latter one because it may conflict with other packages loaded by +% the user; actually this command and the next one are just shortcuts +% for executing more general commands with specific sets of arguments. +% For details and syntax, please refer yourself to +% section~\ref{ssec:ellissi} +% \begin{macrocode} + +\NewDocumentCommand\ellisse{ s m m}{% +\IfBooleanTF{#1}% + {\let\fillstroke\fillpath}% + {\let\fillstroke\strokepath}% +\Sellisse{#2}{#3}% +} + +\NewDocumentCommand\Xellisse{ s D(){0,0} O{0} m m O{} o}{% +\IfBooleanTF{#1}% + {\XSellisse*(#2)[#3]{#4}{#5}[#6][#7]}% + {\XSellisse(#2)[#3]{#4}{#5}[#6][#7]}% +} +% \end{macrocode} +% +% We do not know if the following macro |\polyvector| may be useful for +% euclidean geometry constructions, but it may be useful in block +% diagrams; it is simply a polyline where the last segment is a geometrical +% vector. As in polyline the number of recursions is done until the last +% specified coordinate pair; recognising that it is the last one, instead +% of drawing a segment, the macro draws a vector. +% +% \begin{macrocode} + +\def\polyvector(#1){\roundcap\def\EUGpreviouspoint{#1}\EUGpolyvector} +\def\EUGpolyvector(#1){% +\@ifnextchar({% + \segment(\EUGpreviouspoint)(#1)\def\EUGpreviouspoint{#1}\EUGpolyvector}% + {\VECTOR(\EUGpreviouspoint)(#1)}% +} +% \end{macrocode} +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \subsection{Processing lines and segments} +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% The next macros are functional for the geometric constructions we are +% going to make: finding the intersection of lines or segments, +% finding the lengths and arguments of segments, directions, distances, +% distance of a point from a line or a segment, the symmetrical +% point of a another one specified with respect to a given center of +% symmetry; the axes of segments, the solutions of the relationship +% between the semi axes of an ellipse and the semi focal distance, +% and so on. +% +% Most of these commands have delimited arguments; the delimiters +% may be the usual parentheses, but they may be keywords; many +% commands contain the keyword \texttt{to}, not necessarily the +% last one; the arguments before such keyword may be entered as +% ordered comma separated numerical couples, or comma separated +% macros the containing scalar values; or they may be macros that +% contain the ordered couples representing vectors or directions; +% they all may be in cartesian or polar form. Remember that such +% ordered couples are complex numbers, representable by +% vectors applied to the origin of the axes; therefore sometimes it is +% necessary that the underlying commands execute some vector +% differences so as to work with generic vectors. +% +% On the opposite the output values, i.e. the argument after that +% \texttt{to} keyword, should be tokens that can receive a definition, +% in general macros, to which the user should assign a mnemonic name; +% s/he should use such macros for further computations or for drawing +% commands. +% +% The first and principal command is |\IntersectionOfLines| and +% it has the following syntax: +%\begin{ttsyntax} +%\cs{IntersectionOfLines}\parg{point1}\parg{dir1}and\parg{point2}\parg{dir2}to\meta{crossing} +%\end{ttsyntax} +% where \meta{point1} and \meta{dir1} are respectively a point of the +% first line and its \emph{direction}, not a second point, but the +% \emph{direction} — it is important to stress this point; similarly +% for the second line; the output is stored in +% the macro that identifies the \meta{crossing} point. The directions +% do not need to be expressed with unit vectors, but the lines must not +% be parallel or anti parallel (equal directions or differing by +% $180^\circ$); the macro contains a test that checks this anomalous +% situation because an intersection at infinity or too far away +% ($2^{14}-1$ typographical points, approximately 5,758\,m) is of no +% interest; in case, no warning message is issued, the result is +% put to \texttt{0,0}, and the remaining computations become nonsense. +% It is a very unusual situation and I never encountered~it; +% nevertheless\dots + +% \begin{macrocode} + +\def\IntersectionOfLines(#1)(#2)and(#3)(#4)to#5{\bgroup +\def\IntPu{#1}\def\Uu{#2}\def\IntPd{#3}\def\Ud{#4}% + \DirOfVect\Uu to\Du + \DirOfVect\Ud to\Dd + \XpartOfVect\Du to \a \YpartOfVect\Du to \b + \XpartOfVect\Dd to \c \YpartOfVect\Dd to \d + \XpartOfVect\IntPu to \xu \YpartOfVect\IntPu to \yu + \XpartOfVect\IntPd to \xd \YpartOfVect\IntPd to \yd + \edef\Den{\fpeval{-(\a*\d-\b*\c)}}% + \fptest{abs(\Den)<1e-5}{% almost vanishing determinant + \def#5{0,0}% + }{% Determinant OK + \edef\Numx{\fpeval{(\c*(\b*\xu-\a*\yu)-\a*(\d*\xd-\c*\yd))/\Den}}% + \edef\Numy{\fpeval{(\d*(\b*\xu-\a*\yu)-\b*(\d*\xd-\c*\yd))/\Den}}% + \CopyVect\Numx,\Numy to\Paux + \edef\x{\egroup\noexpand\edef\noexpand#5{\Paux}}\x\ignorespaces}} +% \end{macrocode} +% +% The |IntersectionOfSegments| macro is similar but in input it +% contains the end points of two segments: internally it uses +% |\IntersectionOfLines| and to do so it has to determine the +% directions of both segments. The syntax is the following: +%\begin{ttsyntax} +%\cs{IntersectionOfSegments}\parg{point11}\parg{point12}and\parg{point21}\parg{point22} +%\qquad to\meta{crossing} +%\end{ttsyntax} +% The \meta{crossing} point might fall outside one or both segments. +% It is up to the users to find out if the result is meaningful +% or nonsense. Two non parallel lines are infinitely long in both +% directions and any \meta{crossing} point is acceptable; with +% segments the situation might become nonsense. +% \begin{macrocode} + +\def\IntersectionOfSegments(#1)(#2)and(#3)(#4)to#5{% +\SubVect#1from#2to\IoSvectu \DirOfVect\IoSvectu to\DirIoSVecu +\SubVect#3from#4to\IoSvectd \DirOfVect\IoSvectd to\DirIoSVecd +\IntersectionOfLines(#1)(\DirIoSVecu)and(#3)(\DirIoSVecd)to#5\ignorespaces} +% \end{macrocode} +% +% An application of the above intersections is formed by the next +% two macros; they find the axes of a couple of sides of a triangle +% and use their base point and direction to identify two lines the +% intersection of which is the circumcenter; the distance of one +% base point from the circumcenter is the radius of the circumcircle +% that can be drawn with the usual macros. We have to describe +% the macros |\AxisOf| and |CircleWithCenter| and we will do it in +% a little while. Meanwhile the syntax of the whole macro is the +% following: +%\begin{ttsyntax} +%\cs{ThreePointCircle}\meta{$\star$}\parg{vetex1}\parg{vertex2}\parg{vertex3} +%\end{ttsyntax} +% where the three vertices are the three points where the circle +% must pass, but they identify also a triangle. Its side axes +% intersect in one point that by construction is at the same +% distance from the three vertices, therefore it is the center of +% the circle that passes through the three vertices. A sub product +% of the computations is the macro |\C| that contains the center +% coordinates. If the optional asterisk is used the whole drawing +% is executed, while if it is missing, only the |\C| macro remains +% available but the user is responsible to save/copy its value +% into another macro; for this reason another macro should be more +% easy to use; its syntax is the following: +%\begin{ttsyntax} +%\cs{ThreePointCircleCenter}\parg{vetex1}\parg{vertex2}\parg{vertex3} +%\qquad to\meta{center} +%\end{ttsyntax} +% where the vertices have the same meaning, but\meta{center} is +% the user chosen macro that contains the center coordinates. +% +% \begin{macrocode} + +\NewDocumentCommand\ThreePointCircle{s d() d() d()}{% +\AxisOf#2and#3to\Mu\Du \AxisOf#2and#4to\Md\Dd +\IntersectionOfLines(\Mu)(\Du)and(\Md)(\Dd)to\C +\SubVect#2from\C to\R +\IfBooleanTF{#1}{\CircleWithCenter\C Radius\R}{}\ignorespaces} + +\NewDocumentCommand\ThreePointCircleCenter{d() d() d() m}{% +\ThreePointCircle(#1)(#2)(#3)\CopyVect\C to#4} +% \end{macrocode} +% +% There are some useful commands that help creating |picture| +% diagrams in an easier way; for example one of the above described +% commands internally uses |\CircleWithCenter|. It is well known +% that the native |picture| command |\circle| requires the +% specification of the diameter but many |euclideangeometry| +% commands already get the distance of two points, or the magnitude +% of a segment, or similar objects that may be used as a radius, rather +% than the diameter; why should we not have macros that simultaneously +% compute the require diameter and draw the circle. Here there are two +% such macros; they are similar to one another but their names differ in +% capitalisation, but also in the way they use the available input +% information. The syntax is the following: +%\begin{ttsyntax} +%\cs{CircleWithCenter}\meta{center} Radius\meta{Radius} +%\cs{Circlewithcenter}\meta{center} radius\meta{radius} +%\end{ttsyntax} +% where in both cases \meta{center} is a vector/ordered couple +% that points to the circle center. On the contrary \meta{Radius} +% is a vector obtained through previous calculations, while +% \meta{radius} is a scalar containing a previously calculated length. +% \begin{macrocode} +\def\CircleWithCenter#1Radius#2{\put(#1){\ModOfVect#2to\CWR +\circle{\fpeval{2*\CWR}}}\ignorespaces} +% +\def\Circlewithcenter#1radius#2{\put(#1){\circle{\fpeval{2*abs(#2)}}}% +\ignorespaces} +% \end{macrocode} +% +% As announced, here we have a macro to compute the axis of a segment; +% given two points $P_1$ and $P_2$, for example the end points of a +% segment, or better the end point of the vector that goes from +% $P_1$ to $P_2$, the macro determines the segment middle point and +% a second point the lays on the perpendicular at a distance equal to half +% the first two points distance; this second point lays at the left of +% vector $P_2-P_1$, therefore it is important to select the right initial +% vector, in order to have the second axis point on the desired side. +%\begin{ttsyntax} +%\cs{AxisOf}\meta{P1} and\meta{P2} to\meta{Axis1}\meta{Axis2} +%\end{ttsyntax} +% Macros |\SegmentCenter| and |\MiddlePointOf| are alias to one another; +% their syntax is: +%\begin{ttsyntax} +%\cs{SegmentCenter}\parg{P1}\parg{P2}to\meta{center} +%\cs{MiddlePointOf}\parg{P1}\parg{P2}to\meta{center} +%\end{ttsyntax} +% \meta{P1}, \meta{p2} and \meta{center} are all vectors. +% \begin{macrocode} + +\def\AxisOf#1and#2to#3#4{% +\SubVect#1from#2to\Base \ScaleVect\Base by0.5to\Base +\AddVect\Base and#1to#3 \MultVect\Base by0,1to#4} + +\def\SegmentCenter(#1)(#2)to#3{\AddVect#1and#2to\Segm +\ScaleVect\Segm by0.5to#3\ignorespaces} + +\let\MiddlePointOf\SegmentCenter +% \end{macrocode} +% +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \subsection{Triangle special points} +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Here we have the macros to find the special points on a triangle +% side that are the “foot” of special lines from one vertex to the +% opposite side. We already described the circumcircle and the +% circumcenter, but that is a separate case, because the circumcenter +% is not the intersection of special lines from one vertex to the +% opposite base. The special lines we are interested in here are +% the height, the median, and the bisector +% The macros have the same aspect |\Triangle...Base|, where the dots +% are replaced with each of the (capitalised) special line names. +% Their syntaxes are therefore very similar: +%\begin{ttsyntax} +%\cs{TriangleMedianBase}\meta{vertex} on\meta{base1} and\meta{base2} to\meta{M} +%\cs{TriangleHeightBase}\meta{vertex} on\meta{base1} and\meta{base2} to\meta{H} +%\cs{TrinagleBisectorBase}\meta{vertex} on\meta{base1} and\meta{base2} to\meta{B} +%\end{ttsyntax} +% where \meta{vertex} contains one of the vertices coordinates, and +% \meta{base1} and \meta{base2} are the end points of the side +% opposite to that triangle vertex; \meta{M}, meta{H}, and \meta{B} +% are the intersections of these special lines from the \meta{vertex} +% to the opposite side; in order, they are the foot of the median, +% the foot of the height; the foot of the bisector. The construction +% of the median foot \meta{M} is trivial because this foot is the base +% center; the construction of the height foot is a little more +% complicated, because it is necessary to find the exact direction +% of the perpendicular from the vertex to the base in order to +% find the intersection \meta{H}; the construction of the bisector +% base implies finding the exact direction of the two sides starting at the +% \meta{vertex}, and taking the mean direction, which is trivial if +% polar coordinates are used; at this point the bisector line is completely +% determined and the intersection with the base line \meta{B} is +% easily obtained. +% \begin{macrocode} + +\def\TriangleMedianBase#1on#2and#3to#4{% +\SubVect#1from#2to\TMBu \SubVect#1from#3to\TMBd +\SubVect\TMBu from\TMBd to\Base +\ScaleVect\Base by0.5to\TMBm\AddVect#2and\TMBm to#4\ignorespaces} +% +\def\TriangleHeightBase#1on#2and#3to#4{% +\SubVect#2from#3to\Base +\ArgOfVect\Base to\Ang \CopyVect\fpeval{\Ang+90}:1 to\Perp +\IntersectionOfLines(#1)(\Perp)and(#2)(\Base)to#4\ignorespaces} +% +\def\TriangleBisectorBase#1on#2and#3to#4{% +\SubVect#2from#1to\Luno \SubVect#3from#1to\Ldue +\SubVect#2from#3to\Base +\ArgOfVect\Luno to\Arguno \ArgOfVect\Ldue to\Argdue +\edef\ArgBis{\fpeval{(\Arguno+\Argdue)/2}}% +\CopyVect \ArgBis:1to \Bisect +\IntersectionOfLines(#2)(\Base)and(#1)(\Bisect)to#4\ignorespaces} +% \end{macrocode} +% Having defined the previous macros, it becomes very easy to create +% the macros to find the\emph{barycenter}, the \emph{orthocenter}, +% the\emph{incenter}; for the \emph{circumcenter} and the +% \emph{circumcircle} we have already solved the question with the +% |\ThreePointCircleCenter| and the |ThreePointCircle| macros; for +% homogeneity, we create here their aliases with the same form as +% the new “center” macros. Actually, for the “circle” macros, +% once the center is known, there is no problem with the circumcircle, +% while for the incircle it suffices a macro to determine the distance +% of the incenter from one of the triangle sides; such a macro is going to +% be defined in a little while; it is more general than simply to +% determine the radius of the incircle. +% \begin{macrocode} + +\let\TriangleCircumcenter\ThreePointCircleCenter +\let\TriangleCircummcircle\ThreePointCircle +% \end{macrocode} +% +% The other “center” macros are the following; they all consist +% in finding two of the specific triangle lines, and finding their +% intersection. Therefore for the barycenter we intersect two +% median lines; for the orthocenter we intersect two height lines; +% for the incenter we intersect two bisector lines; +% \begin{macrocode} + +\def\TriangleBarycenter(#1)(#2)(#3)to#4{% +\TriangleMedianBase#1on#2and#3to\Pa +\TriangleMedianBase#2on#3and#1to\Pb +\DistanceAndDirOfVect#1minus\Pa to\ModPa and\AngPa +\DistanceAndDirOfVect#2minus\Pb to\ModPb and\AngPb +\IntersectionOfLines(#1)(\AngPa)and(#2)(\AngPb)to#4} + +\def\TriangleOrthocenter(#1)(#2)(#3)to#4{% +\TriangleHeightBase#1on#2and#3to\Pa +\TriangleHeightBase#2on#3and#1to\Pb +\DistanceAndDirOfVect#1minus\Pa to\ModPa and\AngPa +\DistanceAndDirOfVect#2minus\Pb to\ModPb and\AngPb +\IntersectionOfLines(#1)(\AngPa)and(#2)(\AngPb)to#4} + +\def\TriangleIncenter(#1)(#2)(#3)to#4{% +\TriangleBisectorBase#1on#2and#3to\Pa +\TriangleBisectorBase#2on#3and#1to\Pb +\DistanceAndDirOfVect#1minus\Pa to\ModPa and\AngPa +\DistanceAndDirOfVect#2minus\Pb to\ModPb and\AngPb +\IntersectionOfLines(#1)(\AngPa)and(#2)(\AngPb)to#4} +% \end{macrocode} +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%\subsection{Other specific service macros}\label{ssec:ellissi} +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% And here it comes the general macro to determine the distance +% of a point from a segment or from a line that contains that +% segment; it may be used for determining the radius of the +% incenter, but it is going to be used also for other purposes. +% Its syntax is the following: +%\begin{ttsyntax} +%\cs{DistanceOfPoint}\meta{point} from\parg{P1}\parg{P2}to\meta{distance} +%\end{ttsyntax} +% where \meta{point} is a generic point; \meta{P1} and \meta{P2} +% are a segment end points, or two generic points on a line; +% \meta{distance} is the macro that receives the computed scalar +% distance value. +% \begin{macrocode} + +\def\DistanceOfPoint#1from(#2)(#3)to#4{% +\SubVect#2from#3to\Base \MultVect\Base by0,1to\AB +\IntersectionOfLines(#1)(\AB)and(#2)(\Base)to\D +\SubVect#1from\D to\D +\ModOfVect\D to#4} +% \end{macrocode} +% The following macros are specific to solve other little geometrical +% problems that arise when creating more complicated constructions. +% +% The |\AxisFromAxisAndFocus| is an unhappy name that describes +% the solution of an ellipse relationship between the ellipse axes +% and the focal distance +%\begin{equation} a^2 = b^2 + c^2\label{equ:axes-foci}\end{equation} +% This relation exists between the “semi” values, but it works equally +% well with the full values. Evidently $a$ is the largest quantity and +% refers to the main ellipse axis, the one that passes through the two +% foci; $b$ refers to the other shorter ellipse axis and $c$ refers to +% the foci; $b$ and $c$ are smaller than $a$, but there is no specific +% relationship among these two quantities It goes by itself that +% these statements apply to a veritable ellipse, not to a circle, +% that is the special case where $b=a$ and $c=0$. +% +% Since to solve the above equation we have one unknown and two +% known data, but we do not know what they represent, we have to +% assume some relationship exist between the known data; therefore +% if $a$ is known it must be entered as the first macro argument; +% otherwise $a$ is the unknown and the first Argument has to be the +% smaller one among $b$ and $c$. Since $b$ and$c$ may come from other +% computation the user has a dilemma: which is the smaller one? +% But this is a wrong approach; of course if the user knows which is the +% smaller, s/he can use the macro by entering the data in the proper +% order; but the user is determining the main axis, therefore it better +% that s/he uses directly the second macro |\MainAxisFromAxisAndFocus| +% that directly computes $a$ disregarding the order with which $b$ +% and $c$ are entered; the macro name suggests to enter $b$ first +% and $c$ second, but it is irrelevant thanks to the sum properties. +% Summarising: +%\begin{itemize}[noitemsep] +%\item if the main axis is known use |\AxisFromAxisAndFocus| by +% entering the main axis as the first argument; otherwise +%\item ~ +% \begin{itemize} +% \item if it is known which is smaller among $b$ and $c$, it is +% possible to use |\AxisFromAxisAndFocus| by entering the smaller +% one as the first argument; otherwise +% \item determine the main axis by using |\MainAxisFromAxisAndFocus| +% \end{itemize} +%\end{itemize} +% Their syntaxes of these two commands are basically the following: +%\begin{ttsyntax} +%\cs{AxisFromAxisAndFocus}\meta{main axis} and\meta{axis or focus} to\meta{focus or axis} +%\cs{MainAxisFromAxisAndFocus}\meta{axis or focus} and\meta{focus or axis} to\meta{main axis} +%\end{ttsyntax} +% but it is possible to enter the data in a different way with the +% first command; the described syntax is the suggested one. +% Evidently \meta{axis or focus} and \meta{focus or axis} imply +% that if you specify the focus in one of the two, you have to +% specify the axis in the other one. +% \begin{macrocode} + +\def\AxisFromAxisAndFocus#1and#2to#3{% +\fptest{abs(#1)>abs(#2)}% + {\edef#3{\fpeval{sqrt(#1**2-#2**2)}}}% + {\edef#3{\fpeval{sqrt(#2**2+#1**2)}}}} + +\def\MainAxisFromAxisAndFocus#1and#2to#3{% +\edef#3{\fpeval{sqrt(#2**2+#1**2)}}} +% \end{macrocode} +% The following macros allow to determine some scalar values relative +% to segments; in the second one the order of the segment end points is +% important, because the computed argument refers to the vector $P_2 - P_1$. +% Their syntaxes are the following: +%\begin{ttsyntax} +%\cs{SegmentLength}\parg{P1}\parg{P2}to\meta{length} +%\cs{SegmentArg}\parg{P1}\parg{P2}to\meta{argument} +%\end{ttsyntax} +% Both \meta{length} and \meta{argument} are macros that contain +% scalar quantities; the argument is in the range +% $-180^\circ <\Phi \leq +180^\circ$. +% \begin{macrocode} + +\def\SegmentLength(#1)(#2)to#3{\SubVect#1from#2to\Segm +\ModOfVect\Segm to#3} + +\def\SegmentArg(#1)(#2)to#3{\SubVect#1from#2to\Segm +\GetCoord(\Segm)\SegmX\SegmY\edef#3{\fpeval{atand(\SegmY,\SegmX)}}% +\ignorespaces} +% \end{macrocode} +% +% In the following sections we need some transformations, in +% particular the affine shear one. The macros we define here are +% not for general use, but are specific for the purpose of this package. +% +% The fist macro shears a segment, or better a vector that goes +% from point $P_1$ to point $P_2$ with a horizontal shear +% factor/angle $\alpha$; the origin of the vector does not vary +% and remains $P_1$ but the arrow tip of the vector is moved +% according to the shear factor; in practice this shearing macro +% is valid only for vectors that start from any point laying on +% the $x$ axis. The shear factor $\alpha$ is the angle of the +% \emph{clock wise} rotation vector operator by which the vertical +% coordinate lines get rotated with respect to their original position. +% The syntax is the following: +%\begin{ttsyntax} +%\cs{ShearVect}\parg{P1}\parg{P2}by\meta{shear} to\meta{vector} +%\end{ttsyntax} +% where \meta{P1} and \meta{P2} are the initial and final points of the +% vector to be sheared with the \meta{shear} angle, and the result is put +% in the output \meta{vector} +% \begin{macrocode} + +\def\ShearVect(#1)(#2)by#3to#4{% +\SubVect#1from#2to\AUX +\GetCoord(\AUX)\Aux\Auy +\edef\Aux{\fpeval{\Aux + #3*\Auy}}% +\edef\Auy{\fpeval{\Auy}}% +\AddVect\Aux,\Auy and#1to#4\ignorespaces} + +% \end{macrocode} +% Again we have another different |\ScaleVector| macro that takes in input +% the starting and ending points of a vector, and scales the vector +% independently of the initial point. +% \begin{macrocode} + +\def\ScaleVector(#1)(#2)by#3to#4{% +% Scala per il fattore #3 il vettore da #1 a #2 +\SubVect#1from#2to\AUX +\ScaleVect\AUX by#3to\AUX +\AddVect\AUX and#1to#4\ignorespaces} +% \end{macrocode} +% +% The following macro to draw a possibly sheared ellipse appears +% complicated; but in reality it is not much different from a +% “normal” ellipse drawing command. In oder to do the whole work +% the ellipse center is set in the origin of the axes, therefore +% it is not altered by the shearing process; everything else is +% horizontally sheared by the shear angle $\alpha$. In particular the +% 12~nodes and control point that are required by the Bézier +% splines that draw the four ellipse quarters. It is this multitude +% of shearing commands that makes the macro mach longer and apparently +% complicated. +% The syntax is the following: +%\begin{ttsyntax} +%\cs{Sellisse}\meta{$\star$}\marg{h-axis}\marg{v-axis}\oarg{shear} +% \end{ttsyntax} +% where the optional asterisk is used to mark and label the Bézier +% spline nodes and the control points of the possibly sheared ellipse; +% without the asterisk the ellipse is drawn without any “decoration”; +% the optional \meta{shear} is as usual the angle of the sheared +% vertical coordinate lines; its default value is zero. +% \begin{macrocode} +% +\NewDocumentCommand\Sellisse{s m m O{0}}{\bgroup +\CopyVect#2,#3to\Ptr \ScaleVect\Ptr by-1to\Pbl +\CopyVect#2,-#3to\Pbr \ScaleVect\Pbr by-1to\Ptl +\edef\Ys{\fpeval{tand{#4}}}% +\edef\K{\fpeval{4*(sqrt(2)-1)/3}}% +% +\ShearVect(0,0)(0,#3)by\Ys to\Pmt +\ShearVect(0,0)(0,-#3)by\Ys to\Pmb +\ShearVect(0,0)(#2,0)by\Ys to\Pmr +\ShearVect(0,0)(-#2,0)by\Ys to\Pml +% +\ShearVect(\Pmr)(\Ptr)by\Ys to\Ptr +\ShearVect(\Pml)(\Ptl)by\Ys to\Ptl +\ShearVect(\Pmr)(\Pbr)by\Ys to\Pbr +\ShearVect(\Pml)(\Pbl)by\Ys to\Pbl +% +\IfBooleanTF{#1}{\Pbox(\Ptr)[bl]{P_{tr}}\Pbox(\Pbl)[tr]{P_{bl}}% +\Pbox(\Pbr)[tl]{P_{br}}\Pbox(\Ptl)[br]{P_{tl}}% +\polygon(\Pbr)(\Ptr)(\Ptl)(\Pbl)}{}% +% +\ScaleVector(\Pmr)(\Ptr)by\K to\Crt +\ScaleVector(\Pmr)(\Pbr)by\K to\Crb +\ScaleVector(\Pml)(\Ptl)by\K to\Clt +\ScaleVector(\Pml)(\Pbl)by\K to\Clb +\ScaleVector(\Pmt)(\Ptr)by\K to\Ctr +\ScaleVector(\Pmt)(\Ptl)by\K to\Ctl +\ScaleVector(\Pmb)(\Pbr)by\K to\Cbr +\ScaleVector(\Pmb)(\Pbl)by\K to\Cbl +% +\IfBooleanTF{#1}{% + \Pbox(\Crt)[l]{C_{rt}}\Pbox(\Crb)[l]{C_{rb}} + \Pbox(\Clt)[r]{C_{lt}}\Pbox(\Clb)[r]{C_{lb}} + \Pbox(\Ctr)[b]{C_{tr}}\Pbox(\Ctl)[b]{C_{tl}} + \Pbox(\Cbr)[t]{C_{br}}\Pbox(\Cbl)[t]{C_{bl}} +% +\Pbox(\Pmr)[l]{P_{mr}}\Pbox(\Pmt)[b]{P_{mt}}% +\Pbox(\Pml)[r]{P_{ml}}\Pbox(\Pmb)[t]{P_{mb}}% +% +\polygon(\Pbr)(\Ptr)(\Ptl)(\Pbl)\thicklines}{}% +% +\moveto(\Pmr) +\curveto(\Crt)(\Ctr)(\Pmt) +\curveto(\Ctl)(\Clt)(\Pml) +\curveto(\Clb)(\Cbl)(\Pmb) +\curveto(\Cbr)(\Crb)(\Pmr) +\fillstroke +\egroup} + +% \end{macrocode} +% This user macro is used to call the |\Sellisse| macro with +% the desired parameters, but also to act with it on order +% to fill or stroke the ellipse contour, and to select some +% settings such as the contour line thickness, or the color +% of the ellipse contour or interior. +% the syntax is the following: +%\begin{ttsyntax} +%\cs{XSellisse}\meta{$\star$1}\parg{center}\oarg{angle}\aarg{shear}\marg{h-axis}\marg{v axis}\meta{$\star$2}\oarg{settings1}\oarg{settings2} +%\end{ttsyntax} +% where there are two optional asterisks, \meta{$\star$1} and +% \meta{$\star$2}; the first one controls the coloring of the ellipse: +% if present the interior is filled, if absent the contour is stroked; the +% second one controls the way a possibly sheared ellipse appears: +% if present, the construction is shown, if absent only the final result +% is shown; \meta{center} is optional: if present, the ellipse center is +% specified; if absent, its center is at the origin of the picture axes; +% \meta{angle} is optional with default value zero: if absent, +% the ellipse is not rotated and the \meta{h-axis} remains horizontal, +% while the \meta{v-axis} remains vertical, while if present and with a +% non vanishing value, the ellipse is rotated counterclockwise +% the amount specified, and, of course, if the value is negative, +% the rotation is clockwise. The optional parameter \meta{shear}, +% if present, shears the ellipse paralle the \meta{h-axis} direction; +% the \meta{settings1} and \meta{settings2} operate as described +% for command \cs{Xellisse}. +% \begin{macrocode} + +\NewDocumentCommand\XSellisse{ s D(){0,0} O{0} D<>{0} m m s O{} o }% + {\IfBooleanTF#1{\let\fillstroke\fillpath}% + {\let\fillstroke\strokepath}% + \put(#2){\rotatebox{#3}{#8\relax + \IfBooleanTF{#7}{\Sellisse*{#5}{#6}[#4]}% + {\Sellisse{#5}{#6}[#4]}% + \IfValueTF{#9}{\let\fillstroke\strokepath + #9\Sellisse{#5}{#7}[#4]}{}}}% + \ignorespaces} +% \end{macrocode} +% +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \subsection{Regular polygons and special ellipses} +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% We finally arrive to more complex macros used to create special +% polygons and special ellipses. +% +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \subsubsection{Regular polygons} +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Regular polygons are not that special; it is possible to draw them +% by using the |\multiput| or |\xmultiput| commands, but a single +% command that does everything by itself with more built in +% functionalities is much handier. The new command |\RegPolygon| +% has the following syntax: +%\begin{ttsyntax} +%\cs{RegPoligon}\meta{$\star$}\parg{center}\marg{radius}\marg{number}\oarg{angle}\aarg{settings} +%\end{ttsyntax} +% where \meta{$\star$} is an optional asterisk; its presence means +% that the polygon interior is filled, instead of the polygon +% contour being stroked; the \meta{center} specification of the +% polygon is optional; if it is omitted, the polygon center goes +% to the origin of the |picture| coordinates; \meta{radius} is the +% mandatory radius of the circumscribed circle, or, in other words, +% the distance of each polygon vertex form the \meta{center}; the +% mandatory \meta{number} is an integer that specifies the number of +% polygon sides; the first vertex that is being drawn by this +% command, has an angle of zero degrees with respect to the +% \meta{center}; if a different initial \meta{angle} different from +% zero is desired, it is specified through this optional argument; +% possibly the angle bracketed optional \meta{setting} parameter +% may be used to specify, for example, the line thickness for the +% contour, and/or the color for the polygon contour or interior. +% See the documentation \file{euclideangeometry-man.pdf} for more +% information and usage examples. +% \begin{macrocode} + +\NewDocumentCommand\RegPolygon{s D(){0,0} m m O{0} D<>{\relax} }{{% +\countdef\I=258 \I=0 +\CopyVect#5:#3to\P +\CopyVect\fpeval{360/#4}:1to\R +\put(#2){#6\relax + \moveto(\P)\fpdowhile{\I < #4}% + {\MultVect\P by\R to\P%\GetCoord(\P)\X\Y + \lineto(\P)\advance\I by 1}% + \IfBooleanTF{#1}% + {\fillpath}{#6\strokepath}}}\ignorespaces} +%%%%%%%%% +\def\DirOfVect#1to#2{\GetCoord(#1)\t@X\t@Y +\ModOfVect#1to\@tempa +\unless\ifdim\@tempa\p@=\z@ + \DividE\t@X by\@tempa to\t@X + \DividE\t@Y by\@tempa to\t@Y +\fi\MakeVectorFrom\t@X\t@Y to#2\ignorespaces}% +% \end{macrocode} +% +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \subsubsection{The Steiner ellipse} +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% The construction of the Steiner ellipse is very peculiar; it is +% almost intuitive that any triangle has infinitely many internal +% tangent ellipses; therefore it is necessary to state some other +% constraints to find one specific ellipse out from this unlimited set. +% +% One such ellipse is the Steiner one, obtained by adding the +% constraint that the ellipse be tangent to the median points +% of the triangle sides. But one thing is the definition, and +% another totally different one is to find the parameters of +% such an ellipse; and working with ruler and compass, it is +% necessary to find a procedure to draw such an ellipse. +% +% The construction described here and implemented with the +% |SteinerEllipse| macro is based on the following steps, each +% one requiring the use of some of the commands and/or +% transformations described in the previous sections. +%\begin{enumerate}[noitemsep] +%^^A +%\item Given a generic triangle (the coordinates of its three +% vertices) it is not necessary, but it is clearer to explain, +% if the triangle is shifted and rotated so as to have one of +% its sides horizontal, and the third vertex in the upper part +% of the |picture| drawing. So we first perform the initial +% shift and rotation and memorise the parameters of this +% transformation so that, at the end of the procedure, we can +% put back the triangle (and its Steiner ellipse) in its +% original position. Let us call this shifted and rotated triangle +% with the symbol $T_0$. +%^^A +%\item We transform $T_0$ with an affine shear transformation into an +% isosceles triangle $T_1$ that has the same base and the same +% height as $T_0$. We memorise the shear “angle” so as to proceed +% to an inverse transformation when the following steps are completed: +% let be $\alpha$ this shear angle; geometrically it represents the +% angle of the sheared vertical coordinate lines with respect +% to the original vertical position.\label{enum:shear} +%^^A +%\item With another affine vertical scaling transformation we transform $T_1$ into an equilateral triangle $T_2$; the ratio of the vertical +% transformation equals the ratio between the $T_2$ to the +% $T_1$ heights; we memorise this ratio for the reverse transformation +% at the end of the procedure.\label{enum:ratio} +%^^A +%\item The Steiner ellipse of the equilateral triangle $T_2$ is its +% incircle. We are almost done; we just have to proceed to the +% inverse transformations; getting back from $T_2$ to $T_1$ first implies +% transforming the incircle of $T_2$ into an ellipse with its +% vertical axis scaled by the inverse ratio memorised in +% step~\ref{enum:ratio}. +%^^A +%\item The second inverse transformation by the shear angle is easy +% with the passage from $T_1$ to $T_0$, but it would be more difficult +% for transforming the ellipse into the sheared ellipse. We have already +% defined the |\Sellipse| and the |\XSellipse| macros that may take +% care of the ellipse shear transformation; we already memorised the +% shear angle in step~\ref{enum:shear}, therefore the whole procedure, +% except for putting back the triangle, is almost done. +%^^A +%\item Eventually we perform the last shifting and rotating transformation +% and the whole construction is completed. +%^^A +%\end{enumerate} +% +% The new macro Steiner ellipse has therefore the following syntax: +%\begin{ttsyntax} +%\cs{SteinerEllipse}\meta{$\star$}\parg{P1}\parg{P2}\parg{P3}\oarg{diameter} +%\end{ttsyntax} +% where \meta{P1}, \meta{P2}, \meta{P3} are the vertices of the +% triangle; \meta{$\star$} is an optional asterisk; without it +% the maro draws only the final result, that contains only the +% given triangle and its Steiner ellipse; on the opposite, if the asterisk +% is used the whole construction from $T_0$ to its Steiner ellipse +% is drawn; the labelling of points is done with little dots of +% the default \meta{diameter} or a specified value; by default it is a 1\,pt +% diameter, but sometimes it would be better to use a slightly +% larger value (remembering that 1\,mm — about three points — +% is already too much). +% Please refer to the documentation file \file{euclideangeometry-man.pdf} +% for usage examples and suggestions. +% \begin{macrocode} +% + +\NewDocumentCommand\SteinerEllipse{s d() d() d() O{1}}{\bgroup +% +\IfBooleanTF{#1}{}{\put(#2)}{% + \CopyVect0,0to\Pu + \SubVect#2from#3to\Pd + \SubVect#2from#4to\Pt + \ModAndAngleOfVect\Pd to\M and\Rot + \MultVect\Pd by-\Rot:1 to\Pd \MultVect\Pt by-\Rot:1 to\Pt + \IfBooleanTF{#1}{}{\rotatebox{\Rot}}{\makebox(0,0)[bl]{% + \Pbox(\Pu)[r]{P_1}[#5]<-\Rot>\Pbox(\Pd)[t]{P_2}[#5]<-\Rot> + \Pbox(\Pt)[b]{P_3}[#5]<-\Rot>% + \polygon(\Pu)(\Pd)(\Pt)% + \edef\B{\fpeval{\M/2}}\edef\H{\fpeval{\B*tand(60)}} + \IfBooleanTF{#1}{\Pbox(\B,\H)[b]{H}[#5] + \polygon(\Pu)(\B,\H)(\Pd)}{}% + \edef\R{\fpeval{\B*tand(30)}} + \IfBooleanTF{#1}{\Pbox(\B,\R)[bl]{C}[#5] + \Circlewithcenter\B,\R radius{\R}}{}% + \GetCoord(\Pt)\Xt\Yt\edef\VScale{\fpeval{\Yt/\H}} + \IfBooleanTF{#1}{\polyline(\Pu)(\B,\Yt)(\Pd) + \Pbox(\B,\Yt)[b]{V}[#5]}{}% + \edef\Ce{\fpeval{\R*\VScale}} + \IfBooleanTF{#1}{\Xellisse(\B,\Ce){\R}{\Ce} + \Pbox(\B,\Ce)[r]{C_e}[#5]\Pbox(\B,0)[t]{B}[#5]}{}% + \SubVect\B,0 from\Pt to\SlMedian + \IfBooleanTF{#1}{\Dotline(\B,0)(\Pt){2}[1.5]}{}% + \ModAndAngleOfVect\SlMedian to\Med and\Alfa + \edef\Alfa{\fpeval{90-\Alfa}} + \IfBooleanTF{#1}{\Dotline(\B,\Yt)(\B,0){2}[1.5] + \Pbox(\fpeval{\B+\Ce*tand{\Alfa}},\Ce)[l]{C_i}[#5] + \VectorArc(\B,0)(\B,15){-\Alfa} + \Pbox(\fpeval{\B+2.5},14)[t]{\alpha}[0]}{}% + \edef\a{\R}\edef\b{\Ce}% +\CopyVect\fpeval{\B+\Ce*tand{\Alfa}},\Ce to\CI +\XSellisse(\CI)<\Alfa>{\R}{\Ce} +}}}% +\egroup\ignorespaces} +\let\EllisseSteiner\SteinerEllipse +% \end{macrocode} +% +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%\subsubsection{The ellipse that is internally tangent to a triangle while one of its foci is prescribed} +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% We now are going to tackle another problem. As we said before, any +% triangle has an infinite set of internally tangent circles, unless +% some further constraint is specified. +% +% Another problem of this kind is the determination and geometrical +% construction of an internally tangent ellipse when one focus is +% specified; of course since the whole ellipse is totally internal +% to the triangle, we assume that the user has already verified +% that the coordinates of the focus fall inside the triangle. +% We are not going to check this feature in place of the user; +% after all, if the user draws the triangle within a |picture| image, +% together with the chosen focus, is suffices a glance to verify that +% such focus lays within the triangle perimeter. +% +% The geometrical construction is quite complicated, but it is +% described in a paper by Estevão V.~Candia on \TB~2019 \textbf{40}(3); +% it consists of the following steps. +%\begin{enumerate}[noitemsep] +%^^A +%\item Suppose you have specified a triangle by means of its three +% vertices, and a point inside it to play the role of a focus; it +% is necessary to find the other focus and the main axis length in +% order to have a full description of the ellipse. +%^^A +%\item To do so, it is necessary to find the focus three symmetrical +% points with respect to the three sides. +%^^A +%\item The center of the three point circle through these symmetrical +% points is the second focus. +%^^A +%\item The lines that join the second focus to the three symmetrical +% points of the first focus, intersect the triangle sides in three +% points that result to be the tangency points of the ellipse to the +% triangle. +%^^A +%\item Chosen one of these tangency points and computing the sum of its +% distances from both foci, the total length of the ellipsis main axis +% is found. +%^^A +%\item Knowing both foci, the total inter focal distance is found, +% therefore equation~\eqref{equ:axes-foci} allows to find the other +% axis length. +%^^A +%\item The inclination of the focal segment gives us the the rotation +% to which the ellipse is subject, and the middle point of such +% segment gives the ellipse center. +%^^A +%\item At this point we have all the necessary elements to draw +% the ellipse. +%^^A +%\end{enumerate} +% +% We need another little macro to find the symmetrical points; +% if the focus $F$ and its symmetrical point $P$ with respect +% to a side/segment, the intersection of such segment $F-P$ with +% the side is the segment middle point $M$; from this property +% we derive the formula $P= 2M -F$. Now $M$ is also the +% intersection of the line passing through $F$ and perpendicular +% to the side. Therefore it is particularly simple to compute, +% but its better to have available a macro that does the whole +% work; here it is, but it assumes the the center of symmetry is +% already known: +% \begin{macrocode} + +\def\SymmetricalPointOf#1respect#2to#3{\ScaleVect#2by2to\Segm +\SubVect#1from\Segm to#3\ignorespaces} +% \end{macrocode} +% And its syntax is the following: +%\begin{ttsyntax} +%\cs{SymmetricalPointOf}\meta{focus} respect\meta{symmetry center} +%\qquad to\meta{symmetrical point} +%\end{ttsyntax} +% where the argument names are self explanatory. +% +% The overall macro that executes all the passages described in +% the above enumeration follows; the reader can easily recognise +% the various steps, since the names of the macros are self +% explanatory; the $G_i$ point names are the symmetrical ones +% to the first focus $F$; the $M_i$ points are the centers of +% symmetry; the $F'$ point is the second focus; the $T_i$ points +% are the tangency points. The macro |\EllipseWithFOcus| has the +% following syntax: +%\begin{ttsyntax} +%\cs{EllipseWithFocus}\meta{$\star$}\parg{P1}\parg{P2}\parg{P3}\parg{focus} +%\end{ttsyntax} +% where \meta{P1}, \meta{P2}, \meta{P3} are the triangle vertices +% and \meta{focus} contains the first focus coordinates; the +% optional asterisk, as usual, selects the construction steps +% versus the final result: no asterisk, no construction steps. +% \begin{macrocode} + +\NewDocumentCommand\EllipseWithFocus{s d() d() d() d()}{\bgroup% +\CopyVect#2to\Pu +\CopyVect#3to\Pd +\CopyVect#4to\Pt +\CopyVect#5to\F +\polygon(\Pu)(\Pd)(\Pt) +\Pbox(\Pu)[r]{P_1}[1.5pt]\Pbox(\Pd)[t]{P_2}[1.5pt] +\Pbox(\Pt)[b]{P_3}[1.5pt]\Pbox(\F)[b]{F}[1.5pt] +\SegmentArg(\Pu)(\Pt)to\At +\SegmentArg(\Pu)(\Pd)to\Ad +\SegmentArg(\Pd)(\Pt)to\Au +\IntersectionOfLines(\Pu)(\At:1)and(\F)(\fpeval{\At+90}:1)to\Mt +\IntersectionOfLines(\Pd)(\Ad:1)and(\F)(\fpeval{\Ad+90}:1)to\Md +\IntersectionOfLines(\Pd)(\Au:1)and(\F)(\fpeval{\Au+90}:1)to\Mu +\IfBooleanTF{#1}{\Pbox(\Mt)[br]{M_3}[1.5pt]\Pbox(\Md)[t]{M_2}[1.5pt] + \Pbox(\Mu)[b]{M_1}[1.5pt]}{} +\SymmetricalPointOf\F respect\Mu to\Gu +\IfBooleanTF{#1}{\Pbox(\Gu)[l]{G_1}[1.5pt]}{} +\SymmetricalPointOf\F respect \Md to\Gd +\IfBooleanTF{#1}{\Pbox(\Gd)[t]{G_2}[1.5pt]}{} +\SymmetricalPointOf\F respect \Mt to\Gt +\IfBooleanTF{#1}{\Pbox(\Gt)[r]{G_3}[1.5pt]}{} +\IfBooleanTF{#1}{\ThreePointCircle*(\Gu)(\Gd)(\Gt)}% + {\ThreePointCircle(\Gu)(\Gd)(\Gt)} +\CopyVect\C to\Fp \Pbox(\Fp)[l]{F'}[1.5pt] +\IfBooleanTF{#1}{% +\Dotline(\F)(\Gt){2}[1.5pt] +\Dotline(\F)(\Gd){2}[1.5pt] +\Dotline(\F)(\Gu){2}[1.5pt]}{} +\IntersectionOfSegments(\Pu)(\Pt)and(\Fp)(\Gt)to\Tt +\IntersectionOfSegments(\Pu)(\Pd)and(\Fp)(\Gd)to\Td +\IntersectionOfSegments(\Pd)(\Pt)and(\Fp)(\Gu)to\Tu +\IfBooleanTF{#1}{\Pbox(\Tu)[l]{T_1}[1.5pt] +\Pbox(\Td)[b]{T_2}[1.5pt] +\Pbox(\Tt)[tl]{T_3}[1.5pt] +\Dashline(\Fp)(\Gu){1}\Dashline(\Fp)(\Gd){1}\Dashline(\Fp)(\Gt){1}}{} +\DistanceAndDirOfVect\Fp minus\Tt to\DFp and\AFu +\DistanceAndDirOfVect\F minus\Tt to\DF and\AF +\SegmentCenter(\F)(\Fp)to\CE \Pbox(\CE)[b]{C}[1.5pt] +\edef\a{\fpeval{(\DFp+\DF)/2}} +\SegmentArg(\F)(\Fp)to\AngFocalAxis +\SegmentLength(\F)(\CE)to\c +\AxisFromAxisAndFocus\a and\c to\b +\Xellisse(\CE)[\AngFocalAxis]{\a}{\b}[\thicklines] +\VECTOR(-30,0)(120,0)\Pbox(120,0)[t]{x}[0] +\VECTOR(0,-20)(0,130)\Pbox(0,130)[r]{y}[0]\Pbox(0,0)[tr]{O}[1.5pt] +\egroup\ignorespaces} +\let\EllisseConFuoco\EllipseWithFocus +% \end{macrocode} +% +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \section{Comments on this package} +%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% In general we found very comfortable to draw ellipses and +% to define macros to draw not only such shapes or filled elliptical +% areas, but also to create “legends” with coloured backgrounds and +% borders; such applications found their way in other works. +% But here we dealt with other geometrical problems. The accompanying +% document |euclideangeometry-man.pdf| describes much clearly with +% examples what you can do with the macros described in this package. +% In facts, this file just describes the package macros, and it gives +% some ideas on how to extend the ability of |curve2e| to draw geometrical +% diagrams. +% The users who would like to modify or to add some functionalities +% are invited to do so; I will certainly acknowledge their contributions +% and even add their names to the list of authors. +% +% As long as I can, I enjoy playing with \LaTeX and its wonderful +% facilities; but, taking into consideration my age, I would invite +% the users to consider the possibility of assuming the maintenance +% of this package. +% +%\iffalse +%</package> +%\fi +% +%\iffalse +%<*readme> +%^^A\fi +% \section{The \texttt{README.txt} file} +% 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 euclideangeometry is composed of the following files + +euclideangeometry.dtx +euclideangeometry.pdf +euclideangeometry-man.tex +euclideangeometry-man.pdf +README.txt + +euclideangeometry.dtx is the documented TeX source file of package +euclideangeometry.sty; you get euclideangeometry.sty, +euclideangeometry.pdf by running pdflatex on euclideangeometry.dtx. + +README.txt, this file, contains general information. + +euclideangeometry-man.tex and euclideangeometry-man.pdf are +the source file and the readable document containing the end +user manual. +In other words euclideangeometry.pdf is oriented towards the +developers and euclideangeometry-man.pdf to the end users. + + +Claudio Beccari + +claudio dot beccari at gmail dot com +% \end{macrocode} +%^^A\iffalse +%</readme> +%\fi +% \Finale +%^^A <driver>\endinput diff --git a/Master/texmf-dist/tex/latex/euclideangeometry/euclideangeometry.sty b/Master/texmf-dist/tex/latex/euclideangeometry/euclideangeometry.sty new file mode 100644 index 00000000000..77807562370 --- /dev/null +++ b/Master/texmf-dist/tex/latex/euclideangeometry/euclideangeometry.sty @@ -0,0 +1,518 @@ +%% +%% This is file `euclideangeometry.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% euclideangeometry.dtx (with options: `package') +%% +%% Copyright (C) 2020 Claudio Beccari all rights reserved. +%% License information appended +%% +\NeedsTeXFormat{LaTeX2e}[2019/01/01] +\ProvidesPackage{euclideangeometry}% + [2020-02-02 v.0.1.2 Extension package for curve2e] + +\makeatletter +\providecommand\GetFileInfo{} +\renewcommand\GetFileInfo[1]{% + \def\filename{#1}% + \def\@tempb##1 v.##2 ##3\relax##4\relax{% + \def\filedate{##1}\def\fileversion{##2}\def\fileinfo{##3}}% + \edef\@tempa{\csname ver@#1\endcsname}% + \expandafter\@tempb\@tempa\relax? ? \relax\relax} +\def\cleanfiledate#1-#2-#3!{\unless\ifx#3\empty +\edef\FileDate{#1#2#3}\else\unless\ifx#2\empty +\edef\FileDate{#1#2}\else\edef\FileDate{#1}\fi\fi} +\RequirePackage{curve2e} +\GetFileInfo{curve2e.sty} +\expandafter\cleanfiledate\filedate! + +\ifnum\FileDate<20200118 +\typeout{*************************************************************} +\typeout{Package curve2e too old} +\typeout{Be sure that your TeX installation is complete and up to date} +\typeout{*************************************************************} +\typeout{Input of euclideangeometry stopped and job aborted} +\typeout{*************************************************************} +\expandafter\@@end\fi + +\providecommand\file{} +\renewcommand*\file[1]{{\normalfont\texttt{#1}}} +\providecommand\prog{} +\renewcommand*\prog[1]{{\normalfont\texttt{#1}}} +\newcommand*\conta[1]{\texttt{\slshape#1}} +\providecommand\cs{} +\renewcommand\cs[1]{{\normalfont\texttt{\char92#1}}} +\providecommand\meta{} +\renewcommand*\meta[1]{{\normalfont$\langle$\textit{#1}$\rangle$}} +\providecommand\marg{} +\renewcommand*\marg[1]{{\ttfamily \char123\meta{#1}\char125}} +\newcommand*\Marg[1]{{\normalfont\ttfamily\{#1\}}}\let\Arg\Marg +\providecommand\oarg{} +\renewcommand*\oarg[1]{{\ttfamily[\meta{#1}]}} +\newcommand*\Oarg[1]{{\ttfamily[#1]}} +\newcommand*\aarg[1]{{\ttfamily{<\meta{#1}>}}} +\newcommand*\Aarg[1]{{\ttfamily<#1>}} +\newcommand*\Bambiente[1]{\texttt{\char92begin\{#1\}}} +\newcommand*\Eambiente[1]{\texttt{\char92end\{#1\}}} +\newcommand*\garg[1]{\texttt{(\splitgarg#1,!)}}\let\parg\garg +\newcommand*\Garg[1]{\texttt{(#1)}}\let\Parg\Garg + \def\secgarg#1,{#1} + \def\splitgarg#1,#2!{% + \ifstrequal{#2}{}{\meta{#1}}{\meta{#1},\meta{\secgarg#2}}} +\providecommand\pack{} +\renewcommand*\pack[1]{{\normalfont\textsf{#1}}} +\providecommand\opt{} +\renewcommand*\opt[1]{{\normalfont\textsl{#1}}}\let\opz\opt +\providecommand\env{} +\renewcommand*\env[1]{{\normalfont\textit{\bfseries#1}}}\let\amb\env +\providecommand*\ped[1]{\ensuremath{_{\mathrm{#1}}}} +\providecommand*\ap[1]{\ensuremath{^{\mathrm{#1}}}} +\providecommand*\unit[1]{\ensuremath{\,\mathrm{#1}}} +\providecommand*\sigla[1]{\textsc{\lowercase{#1}}} +\providecommand*\iu{\ensuremath{\mathrm{i}}}\let\gei\iu +\providecommand*\eu{\ensuremath{\mathop{\mathrm{e}}\nolimits}} +\DeclareRobustCommand*{\Ars}{% + \textsf{\lower -.48ex\hbox{\rotatebox{-20}{A}}\kern -.3em{rs}}% + \kern -.05em\TeX\unskip\kern -.17em\lower -.357ex\hbox{nica}\xspace} + +\DeclareRobustCommand*\LyX{% + L\kern-0.2em\raisebox{-0.5ex}{Y}\kern-0.2em{X}\xspace} + +\definecolor{verdeguit}{rgb}{0, 0.40, 0} +\RequirePackage{iftex} +\def\GuIT{\mbox{\color{verdeguit}\def\I{\textcolor{black}{I}}% +\ifPDFTeX + \usefont{T1}{lmr}{m}{sc} +\else + \usefont{TU}{lmr}{m}{sc} +\fi +g\raisebox{-0.715ex}{\kern-0.26em u}\kern-0.13em\I\kern-0.14em t}\xspace} +\providecommand*\usecs[1]{\csname#1\endcsname} +\providecommand*\whilenum[2]{\usecs{@whilenum}#1\do{#2}} +\RequirePackage{afterpage} +\providecommand\supaginapari[1]{% + \afterpage{% + \ifodd\value{page}\expandafter\@firstoftwo + \else\expandafter\@secondoftwo + \fi{\supaginapari{#1}}{#1} + } +}\let\onevenpage\supaginapari +\providecommand\supaginadispari[1]{% + \afterpage{% + \ifodd\value{page}\expandafter\@secondoftwo + \else\expandafter\@firstoftwo + \fi{\supaginadispari{#1}}{#1} + } +}\let\onoddpage\supaginadispari +\RequirePackage{etoolbox} +\AfterEndPreamble{% +\apptocmd{\TeX}{{}\xspace}{}{} +\apptocmd{\LaTeX}{{}\xspace}{}{}} + +\DeclareRobustCommand*\TeXLive{\TeX\ Live\xspace} +\DeclareRobustCommand*\MiKTeX{MiK\TeX} +\DeclareRobustCommand*\MacTeX{Mac\TeX} +\DeclareRobustCommand*\pdfLaTeX{pdf\/\LaTeX} +\DeclareRobustCommand*\LuaLaTeX{Lua\LaTeX} +\DeclareRobustCommand*\XeLaTeX{X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi +\lower.5ex\hbox{\rotatebox[origin=c]{180}{E}}% +\ifdim\fontdimen1\font=0pt\kern-0.15em\else\kern-0.275em\fi +\LaTeX} +\DeclareRobustCommand*\TikZ{Ti\emph{k}Z\xspace} +\DeclareRobustCommand*\TUGboat{\textsl{TUG\-boat}\xspace} +\renewcommand\dbltopfraction{1.} +\def\hz{\hskip0pt} +\newenvironment{ttsintassi}{\begin{lrbox}{0} +\minipage{\dimexpr\linewidth-2\fboxrule-2\fboxsep}\ttfamily\obeylines}% +{\endminipage\end{lrbox}\center\fbox{\box0}\endcenter} +\let\ttsyntax\ttsintassi \let\endttsyntax\endttsintassi + +\unless\ifcsname Gr@phGrid\endcsname +\let\originalGraphGrid\GraphGrid +\RenewDocumentCommand\GraphGrid{r() d()}{% +\IfValueTF{#2}{\put(#1){\originalGraphGrid(#2)}}% + {\put(0,0){\originalGraphGrid(#1)}}}\fi +\providecommand\Pbox{} +\RenewDocumentCommand\Pbox{D(){0,0} O{cc} m O{0.5ex} s D<>{0}}{% +\put(#1){\rotatebox{#6}{\makebox(0,0){% +\dimendef\Dim=2566\relax +\settowidth\Dim{#2}% +\edef\Rapp{\fpeval{\Dim/{1ex}}}% +\fptest{\Rapp > 1.5}{\fboxsep=0.5ex}{\fboxsep=0.75ex}% +\IfBooleanTF{#5}{\fboxrule=0.4pt}{\fboxrule=0pt}% +\fptest{#4 = 0sp}% + {\makebox(0,0)[#2]{\fbox{$\relax#3\relax$}}}% + {\edef\Diam{\fpeval{(#4)/\unitlength}}% + \makebox(0,0){\circle*{\Diam}}% + \makebox(0,0)[#2]{\fbox{$\relax\mathsf#3\relax$}}% + }}}% +}\ignorespaces} +\DeclareRobustCommand\setfontsize[2][1.2]{% + \linespread{#1}\fontsize{#2}{#2}\selectfont} + +\def\EUGsplitArgs(#1,#2)#3#4{\edef#3{#1}\edef#4{#2}} + +\providecommand\Zbox{} +\RenewDocumentCommand\Zbox{R(){0,0} D(){0,0} O{bl} m}{% +\EUGsplitArgs(#2)\ZboxX\ZboxY % separa la x e la y della scatola +\fboxsep=2\unitlength +\ifnum\ZboxX=\csuse{z@} + \def\ZTesto{\fbox{#4}}% +\else + \ifnum\ZboxY=\csuse{z@} + \def\ZTesto{\fbox{\parbox{\ZboxX\unitlength}{#4}}}% + \else + \def\ZTesto{% + \setbox2560=\hbox{\fbox{% + \parbox[c][\ZboxY\unitlength][c]{\ZboxX\unitlength}{#4}}}% + \dimen2560=\dimexpr(\ht2560 +\dp2560)/2\relax + \ht2560=\dimen2560\relax + \dp2560=\dimen2560\relax + \box2560% + }% + \fi +\fi +\put(#1){\makebox(0,0)[#3]{\ZTesto}}\ignorespaces} + +\RequirePackage{verbatim} +\newwrite\example@out +\ProvideDocumentEnvironment{Esempio}{s O{\normalsize} D(){0.40}} +{\par\addvspace{3.0ex plus 0.8ex minus 0.5ex}\vskip -\parskip +\dimendef\Wboxu=2570 \dimendef\Wboxd=2572 +\Wboxu=#3\textwidth\relax +\Wboxd=\dimexpr\linewidth-\columnsep-\Wboxu\relax +\begingroup +\@bsphack +\immediate\openout\example@out\jobname-temp.tex +\let\do\@makeother\dospecials\catcode`\^^M\active +\def\verbatim@processline{% + \immediate\write\example@out{\the\verbatim@line}}% +\verbatim@start\relax}% +{\immediate\closeout\example@out\@esphack\endgroup +\begin{minipage}{\textwidth}% +\IfBooleanTF{#1}{\begin{minipage}{\textwidth}}{\begin{minipage}{\Wboxu}}% +#2\relax +\verbatiminput{\jobname-temp.tex} +\end{minipage}% +\IfBooleanTF{#1}{\par\bigskip}{\hfill}% +\IfBooleanTF{#1}{\begin{minipage}{\textwidth}}{\begin{minipage}{\Wboxd}}% +\raggedleft +\input{\jobname-temp} +\end{minipage} +\end{minipage}\par +} + + +\NewDocumentCommand\ellisse{ s m m}{% +\IfBooleanTF{#1}% + {\let\fillstroke\fillpath}% + {\let\fillstroke\strokepath}% +\Sellisse{#2}{#3}% +} + +\NewDocumentCommand\Xellisse{ s D(){0,0} O{0} m m O{} o}{% +\IfBooleanTF{#1}% + {\XSellisse*(#2)[#3]{#4}{#5}[#6][#7]}% + {\XSellisse(#2)[#3]{#4}{#5}[#6][#7]}% +} + +\def\polyvector(#1){\roundcap\def\EUGpreviouspoint{#1}\EUGpolyvector} +\def\EUGpolyvector(#1){% +\@ifnextchar({% + \segment(\EUGpreviouspoint)(#1)\def\EUGpreviouspoint{#1}\EUGpolyvector}% + {\VECTOR(\EUGpreviouspoint)(#1)}% +} + + +\def\IntersectionOfLines(#1)(#2)and(#3)(#4)to#5{\bgroup +\def\IntPu{#1}\def\Uu{#2}\def\IntPd{#3}\def\Ud{#4}% + \DirOfVect\Uu to\Du + \DirOfVect\Ud to\Dd + \XpartOfVect\Du to \a \YpartOfVect\Du to \b + \XpartOfVect\Dd to \c \YpartOfVect\Dd to \d + \XpartOfVect\IntPu to \xu \YpartOfVect\IntPu to \yu + \XpartOfVect\IntPd to \xd \YpartOfVect\IntPd to \yd + \edef\Den{\fpeval{-(\a*\d-\b*\c)}}% + \fptest{abs(\Den)<1e-5}{% almost vanishing determinant + \def#5{0,0}% + }{% Determinant OK + \edef\Numx{\fpeval{(\c*(\b*\xu-\a*\yu)-\a*(\d*\xd-\c*\yd))/\Den}}% + \edef\Numy{\fpeval{(\d*(\b*\xu-\a*\yu)-\b*(\d*\xd-\c*\yd))/\Den}}% + \CopyVect\Numx,\Numy to\Paux + \edef\x{\egroup\noexpand\edef\noexpand#5{\Paux}}\x\ignorespaces}} + +\def\IntersectionOfSegments(#1)(#2)and(#3)(#4)to#5{% +\SubVect#1from#2to\IoSvectu \DirOfVect\IoSvectu to\DirIoSVecu +\SubVect#3from#4to\IoSvectd \DirOfVect\IoSvectd to\DirIoSVecd +\IntersectionOfLines(#1)(\DirIoSVecu)and(#3)(\DirIoSVecd)to#5\ignorespaces} + +\NewDocumentCommand\ThreePointCircle{s d() d() d()}{% +\AxisOf#2and#3to\Mu\Du \AxisOf#2and#4to\Md\Dd +\IntersectionOfLines(\Mu)(\Du)and(\Md)(\Dd)to\C +\SubVect#2from\C to\R +\IfBooleanTF{#1}{\CircleWithCenter\C Radius\R}{}\ignorespaces} + +\NewDocumentCommand\ThreePointCircleCenter{d() d() d() m}{% +\ThreePointCircle(#1)(#2)(#3)\CopyVect\C to#4} +\def\CircleWithCenter#1Radius#2{\put(#1){\ModOfVect#2to\CWR +\circle{\fpeval{2*\CWR}}}\ignorespaces} +\def\Circlewithcenter#1radius#2{\put(#1){\circle{\fpeval{2*abs(#2)}}}% +\ignorespaces} + +\def\AxisOf#1and#2to#3#4{% +\SubVect#1from#2to\Base \ScaleVect\Base by0.5to\Base +\AddVect\Base and#1to#3 \MultVect\Base by0,1to#4} + +\def\SegmentCenter(#1)(#2)to#3{\AddVect#1and#2to\Segm +\ScaleVect\Segm by0.5to#3\ignorespaces} + +\let\MiddlePointOf\SegmentCenter + +\def\TriangleMedianBase#1on#2and#3to#4{% +\SubVect#1from#2to\TMBu \SubVect#1from#3to\TMBd +\SubVect\TMBu from\TMBd to\Base +\ScaleVect\Base by0.5to\TMBm\AddVect#2and\TMBm to#4\ignorespaces} +\def\TriangleHeightBase#1on#2and#3to#4{% +\SubVect#2from#3to\Base +\ArgOfVect\Base to\Ang \CopyVect\fpeval{\Ang+90}:1 to\Perp +\IntersectionOfLines(#1)(\Perp)and(#2)(\Base)to#4\ignorespaces} +\def\TriangleBisectorBase#1on#2and#3to#4{% +\SubVect#2from#1to\Luno \SubVect#3from#1to\Ldue +\SubVect#2from#3to\Base +\ArgOfVect\Luno to\Arguno \ArgOfVect\Ldue to\Argdue +\edef\ArgBis{\fpeval{(\Arguno+\Argdue)/2}}% +\CopyVect \ArgBis:1to \Bisect +\IntersectionOfLines(#2)(\Base)and(#1)(\Bisect)to#4\ignorespaces} + +\let\TriangleCircumcenter\ThreePointCircleCenter +\let\TriangleCircummcircle\ThreePointCircle + +\def\TriangleBarycenter(#1)(#2)(#3)to#4{% +\TriangleMedianBase#1on#2and#3to\Pa +\TriangleMedianBase#2on#3and#1to\Pb +\DistanceAndDirOfVect#1minus\Pa to\ModPa and\AngPa +\DistanceAndDirOfVect#2minus\Pb to\ModPb and\AngPb +\IntersectionOfLines(#1)(\AngPa)and(#2)(\AngPb)to#4} + +\def\TriangleOrthocenter(#1)(#2)(#3)to#4{% +\TriangleHeightBase#1on#2and#3to\Pa +\TriangleHeightBase#2on#3and#1to\Pb +\DistanceAndDirOfVect#1minus\Pa to\ModPa and\AngPa +\DistanceAndDirOfVect#2minus\Pb to\ModPb and\AngPb +\IntersectionOfLines(#1)(\AngPa)and(#2)(\AngPb)to#4} + +\def\TriangleIncenter(#1)(#2)(#3)to#4{% +\TriangleBisectorBase#1on#2and#3to\Pa +\TriangleBisectorBase#2on#3and#1to\Pb +\DistanceAndDirOfVect#1minus\Pa to\ModPa and\AngPa +\DistanceAndDirOfVect#2minus\Pb to\ModPb and\AngPb +\IntersectionOfLines(#1)(\AngPa)and(#2)(\AngPb)to#4} + +\def\DistanceOfPoint#1from(#2)(#3)to#4{% +\SubVect#2from#3to\Base \MultVect\Base by0,1to\AB +\IntersectionOfLines(#1)(\AB)and(#2)(\Base)to\D +\SubVect#1from\D to\D +\ModOfVect\D to#4} + +\def\AxisFromAxisAndFocus#1and#2to#3{% +\fptest{abs(#1)>abs(#2)}% + {\edef#3{\fpeval{sqrt(#1**2-#2**2)}}}% + {\edef#3{\fpeval{sqrt(#2**2+#1**2)}}}} + +\def\MainAxisFromAxisAndFocus#1and#2to#3{% +\edef#3{\fpeval{sqrt(#2**2+#1**2)}}} + +\def\SegmentLength(#1)(#2)to#3{\SubVect#1from#2to\Segm +\ModOfVect\Segm to#3} + +\def\SegmentArg(#1)(#2)to#3{\SubVect#1from#2to\Segm +\GetCoord(\Segm)\SegmX\SegmY\edef#3{\fpeval{atand(\SegmY,\SegmX)}}% +\ignorespaces} + +\def\ShearVect(#1)(#2)by#3to#4{% +\SubVect#1from#2to\AUX +\GetCoord(\AUX)\Aux\Auy +\edef\Aux{\fpeval{\Aux + #3*\Auy}}% +\edef\Auy{\fpeval{\Auy}}% +\AddVect\Aux,\Auy and#1to#4\ignorespaces} + + +\def\ScaleVector(#1)(#2)by#3to#4{% +\SubVect#1from#2to\AUX +\ScaleVect\AUX by#3to\AUX +\AddVect\AUX and#1to#4\ignorespaces} +\NewDocumentCommand\Sellisse{s m m O{0}}{\bgroup +\CopyVect#2,#3to\Ptr \ScaleVect\Ptr by-1to\Pbl +\CopyVect#2,-#3to\Pbr \ScaleVect\Pbr by-1to\Ptl +\edef\Ys{\fpeval{tand{#4}}}% +\edef\K{\fpeval{4*(sqrt(2)-1)/3}}% +\ShearVect(0,0)(0,#3)by\Ys to\Pmt +\ShearVect(0,0)(0,-#3)by\Ys to\Pmb +\ShearVect(0,0)(#2,0)by\Ys to\Pmr +\ShearVect(0,0)(-#2,0)by\Ys to\Pml +\ShearVect(\Pmr)(\Ptr)by\Ys to\Ptr +\ShearVect(\Pml)(\Ptl)by\Ys to\Ptl +\ShearVect(\Pmr)(\Pbr)by\Ys to\Pbr +\ShearVect(\Pml)(\Pbl)by\Ys to\Pbl +\IfBooleanTF{#1}{\Pbox(\Ptr)[bl]{P_{tr}}\Pbox(\Pbl)[tr]{P_{bl}}% +\Pbox(\Pbr)[tl]{P_{br}}\Pbox(\Ptl)[br]{P_{tl}}% +\polygon(\Pbr)(\Ptr)(\Ptl)(\Pbl)}{}% +\ScaleVector(\Pmr)(\Ptr)by\K to\Crt +\ScaleVector(\Pmr)(\Pbr)by\K to\Crb +\ScaleVector(\Pml)(\Ptl)by\K to\Clt +\ScaleVector(\Pml)(\Pbl)by\K to\Clb +\ScaleVector(\Pmt)(\Ptr)by\K to\Ctr +\ScaleVector(\Pmt)(\Ptl)by\K to\Ctl +\ScaleVector(\Pmb)(\Pbr)by\K to\Cbr +\ScaleVector(\Pmb)(\Pbl)by\K to\Cbl +\IfBooleanTF{#1}{% + \Pbox(\Crt)[l]{C_{rt}}\Pbox(\Crb)[l]{C_{rb}} + \Pbox(\Clt)[r]{C_{lt}}\Pbox(\Clb)[r]{C_{lb}} + \Pbox(\Ctr)[b]{C_{tr}}\Pbox(\Ctl)[b]{C_{tl}} + \Pbox(\Cbr)[t]{C_{br}}\Pbox(\Cbl)[t]{C_{bl}} +\Pbox(\Pmr)[l]{P_{mr}}\Pbox(\Pmt)[b]{P_{mt}}% +\Pbox(\Pml)[r]{P_{ml}}\Pbox(\Pmb)[t]{P_{mb}}% +\polygon(\Pbr)(\Ptr)(\Ptl)(\Pbl)\thicklines}{}% +\moveto(\Pmr) +\curveto(\Crt)(\Ctr)(\Pmt) +\curveto(\Ctl)(\Clt)(\Pml) +\curveto(\Clb)(\Cbl)(\Pmb) +\curveto(\Cbr)(\Crb)(\Pmr) +\fillstroke +\egroup} + + +\NewDocumentCommand\XSellisse{ s D(){0,0} O{0} D<>{0} m m s O{} o }% + {\IfBooleanTF#1{\let\fillstroke\fillpath}% + {\let\fillstroke\strokepath}% + \put(#2){\rotatebox{#3}{#8\relax + \IfBooleanTF{#7}{\Sellisse*{#5}{#6}[#4]}% + {\Sellisse{#5}{#6}[#4]}% + \IfValueTF{#9}{\let\fillstroke\strokepath + #9\Sellisse{#5}{#7}[#4]}{}}}% + \ignorespaces} + +\NewDocumentCommand\RegPolygon{s D(){0,0} m m O{0} D<>{\relax} }{{% +\countdef\I=258 \I=0 +\CopyVect#5:#3to\P +\CopyVect\fpeval{360/#4}:1to\R +\put(#2){#6\relax + \moveto(\P)\fpdowhile{\I < #4}% + {\MultVect\P by\R to\P%\GetCoord(\P)\X\Y + \lineto(\P)\advance\I by 1}% + \IfBooleanTF{#1}% + {\fillpath}{#6\strokepath}}}\ignorespaces} +%%%%%%%%% +\def\DirOfVect#1to#2{\GetCoord(#1)\t@X\t@Y +\ModOfVect#1to\@tempa +\unless\ifdim\@tempa\p@=\z@ + \DividE\t@X by\@tempa to\t@X + \DividE\t@Y by\@tempa to\t@Y +\fi\MakeVectorFrom\t@X\t@Y to#2\ignorespaces}% + +\NewDocumentCommand\SteinerEllipse{s d() d() d() O{1}}{\bgroup +\IfBooleanTF{#1}{}{\put(#2)}{% + \CopyVect0,0to\Pu + \SubVect#2from#3to\Pd + \SubVect#2from#4to\Pt + \ModAndAngleOfVect\Pd to\M and\Rot + \MultVect\Pd by-\Rot:1 to\Pd \MultVect\Pt by-\Rot:1 to\Pt + \IfBooleanTF{#1}{}{\rotatebox{\Rot}}{\makebox(0,0)[bl]{% + \Pbox(\Pu)[r]{P_1}[#5]<-\Rot>\Pbox(\Pd)[t]{P_2}[#5]<-\Rot> + \Pbox(\Pt)[b]{P_3}[#5]<-\Rot>% + \polygon(\Pu)(\Pd)(\Pt)% + \edef\B{\fpeval{\M/2}}\edef\H{\fpeval{\B*tand(60)}} + \IfBooleanTF{#1}{\Pbox(\B,\H)[b]{H}[#5] + \polygon(\Pu)(\B,\H)(\Pd)}{}% + \edef\R{\fpeval{\B*tand(30)}} + \IfBooleanTF{#1}{\Pbox(\B,\R)[bl]{C}[#5] + \Circlewithcenter\B,\R radius{\R}}{}% + \GetCoord(\Pt)\Xt\Yt\edef\VScale{\fpeval{\Yt/\H}} + \IfBooleanTF{#1}{\polyline(\Pu)(\B,\Yt)(\Pd) + \Pbox(\B,\Yt)[b]{V}[#5]}{}% + \edef\Ce{\fpeval{\R*\VScale}} + \IfBooleanTF{#1}{\Xellisse(\B,\Ce){\R}{\Ce} + \Pbox(\B,\Ce)[r]{C_e}[#5]\Pbox(\B,0)[t]{B}[#5]}{}% + \SubVect\B,0 from\Pt to\SlMedian + \IfBooleanTF{#1}{\Dotline(\B,0)(\Pt){2}[1.5]}{}% + \ModAndAngleOfVect\SlMedian to\Med and\Alfa + \edef\Alfa{\fpeval{90-\Alfa}} + \IfBooleanTF{#1}{\Dotline(\B,\Yt)(\B,0){2}[1.5] + \Pbox(\fpeval{\B+\Ce*tand{\Alfa}},\Ce)[l]{C_i}[#5] + \VectorArc(\B,0)(\B,15){-\Alfa} + \Pbox(\fpeval{\B+2.5},14)[t]{\alpha}[0]}{}% + \edef\a{\R}\edef\b{\Ce}% +\CopyVect\fpeval{\B+\Ce*tand{\Alfa}},\Ce to\CI +\XSellisse(\CI)<\Alfa>{\R}{\Ce} +}}}% +\egroup\ignorespaces} +\let\EllisseSteiner\SteinerEllipse + +\def\SymmetricalPointOf#1respect#2to#3{\ScaleVect#2by2to\Segm +\SubVect#1from\Segm to#3\ignorespaces} + +\NewDocumentCommand\EllipseWithFocus{s d() d() d() d()}{\bgroup% +\CopyVect#2to\Pu +\CopyVect#3to\Pd +\CopyVect#4to\Pt +\CopyVect#5to\F +\polygon(\Pu)(\Pd)(\Pt) +\Pbox(\Pu)[r]{P_1}[1.5pt]\Pbox(\Pd)[t]{P_2}[1.5pt] +\Pbox(\Pt)[b]{P_3}[1.5pt]\Pbox(\F)[b]{F}[1.5pt] +\SegmentArg(\Pu)(\Pt)to\At +\SegmentArg(\Pu)(\Pd)to\Ad +\SegmentArg(\Pd)(\Pt)to\Au +\IntersectionOfLines(\Pu)(\At:1)and(\F)(\fpeval{\At+90}:1)to\Mt +\IntersectionOfLines(\Pd)(\Ad:1)and(\F)(\fpeval{\Ad+90}:1)to\Md +\IntersectionOfLines(\Pd)(\Au:1)and(\F)(\fpeval{\Au+90}:1)to\Mu +\IfBooleanTF{#1}{\Pbox(\Mt)[br]{M_3}[1.5pt]\Pbox(\Md)[t]{M_2}[1.5pt] + \Pbox(\Mu)[b]{M_1}[1.5pt]}{} +\SymmetricalPointOf\F respect\Mu to\Gu +\IfBooleanTF{#1}{\Pbox(\Gu)[l]{G_1}[1.5pt]}{} +\SymmetricalPointOf\F respect \Md to\Gd +\IfBooleanTF{#1}{\Pbox(\Gd)[t]{G_2}[1.5pt]}{} +\SymmetricalPointOf\F respect \Mt to\Gt +\IfBooleanTF{#1}{\Pbox(\Gt)[r]{G_3}[1.5pt]}{} +\IfBooleanTF{#1}{\ThreePointCircle*(\Gu)(\Gd)(\Gt)}% + {\ThreePointCircle(\Gu)(\Gd)(\Gt)} +\CopyVect\C to\Fp \Pbox(\Fp)[l]{F'}[1.5pt] +\IfBooleanTF{#1}{% +\Dotline(\F)(\Gt){2}[1.5pt] +\Dotline(\F)(\Gd){2}[1.5pt] +\Dotline(\F)(\Gu){2}[1.5pt]}{} +\IntersectionOfSegments(\Pu)(\Pt)and(\Fp)(\Gt)to\Tt +\IntersectionOfSegments(\Pu)(\Pd)and(\Fp)(\Gd)to\Td +\IntersectionOfSegments(\Pd)(\Pt)and(\Fp)(\Gu)to\Tu +\IfBooleanTF{#1}{\Pbox(\Tu)[l]{T_1}[1.5pt] +\Pbox(\Td)[b]{T_2}[1.5pt] +\Pbox(\Tt)[tl]{T_3}[1.5pt] +\Dashline(\Fp)(\Gu){1}\Dashline(\Fp)(\Gd){1}\Dashline(\Fp)(\Gt){1}}{} +\DistanceAndDirOfVect\Fp minus\Tt to\DFp and\AFu +\DistanceAndDirOfVect\F minus\Tt to\DF and\AF +\SegmentCenter(\F)(\Fp)to\CE \Pbox(\CE)[b]{C}[1.5pt] +\edef\a{\fpeval{(\DFp+\DF)/2}} +\SegmentArg(\F)(\Fp)to\AngFocalAxis +\SegmentLength(\F)(\CE)to\c +\AxisFromAxisAndFocus\a and\c to\b +\Xellisse(\CE)[\AngFocalAxis]{\a}{\b}[\thicklines] +\VECTOR(-30,0)(120,0)\Pbox(120,0)[t]{x}[0] +\VECTOR(0,-20)(0,130)\Pbox(0,130)[r]{y}[0]\Pbox(0,0)[tr]{O}[1.5pt] +\egroup\ignorespaces} +\let\EllisseConFuoco\EllipseWithFocus +%% +%% Distributable under the LaTeX Project Public License, +%% version 1.3c or higher (your choice). The latest version of +%% this license is at: http://www.latex-project.org/lppl.txt +%% +%% This work is "maintained" +%% +%% This work consists of files: +%% 1) euclideangeometry.dtx, and the derived files euclideangeometry.sty +%% and euclideangeometry.pdf, +%% 2) euclideangeometry-man.tex and the derived file euclideangeometry-man.pdf, +%% 3) the auxiliary derived file README.txt +%% +%% +%% End of file `euclideangeometry.sty'. diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check index 9238b256537..27402fea3f3 100755 --- a/Master/tlpkg/bin/tlpkg-ctan-check +++ b/Master/tlpkg/bin/tlpkg-ctan-check @@ -272,7 +272,7 @@ my @TLP_working = qw( eso-pic esrelation esstix estcpmm esvect etaremune etdipa etex-pkg etexcmds etextools ethiop ethiop-t1 etoc etoolbox etoolbox-de etsvthor - euenc euflag eukdate + euclideangeometry euenc euflag eukdate euler eulerpx eulervm euro euro-ce europasscv europecv eurosym everyhook everypage exam exam-n exam-randomizechoices examdesign example examplep diff --git a/Master/tlpkg/tlpsrc/collection-mathscience.tlpsrc b/Master/tlpkg/tlpsrc/collection-mathscience.tlpsrc index afe27e23816..bbdcceb62a6 100644 --- a/Master/tlpkg/tlpsrc/collection-mathscience.tlpsrc +++ b/Master/tlpkg/tlpsrc/collection-mathscience.tlpsrc @@ -78,6 +78,7 @@ depend engtlc depend eqexpl depend eqnarray depend eqnnumwarn +depend euclideangeometry depend extarrows depend extpfeil depend faktor diff --git a/Master/tlpkg/tlpsrc/euclideangeometry.tlpsrc b/Master/tlpkg/tlpsrc/euclideangeometry.tlpsrc new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/Master/tlpkg/tlpsrc/euclideangeometry.tlpsrc |