summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/euclideangeometry
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-04-27 03:03:41 +0000
committerNorbert Preining <norbert@preining.info>2020-04-27 03:03:41 +0000
commitae496a1c963576dfe63885afa818b2af745ed44a (patch)
tree62604706ca603c17f5f56fe646072d8d2cfab60c /macros/latex/contrib/euclideangeometry
parent7d9d2e08fcab92adcc759e3f1e4bb0a15a63f220 (diff)
CTAN sync 202004270303
Diffstat (limited to 'macros/latex/contrib/euclideangeometry')
-rw-r--r--macros/latex/contrib/euclideangeometry/README.txt2
-rw-r--r--macros/latex/contrib/euclideangeometry/euclideangeometry-man.pdfbin571301 -> 580318 bytes
-rw-r--r--macros/latex/contrib/euclideangeometry/euclideangeometry-man.tex119
-rw-r--r--macros/latex/contrib/euclideangeometry/euclideangeometry.dtx153
-rw-r--r--macros/latex/contrib/euclideangeometry/euclideangeometry.pdfbin431209 -> 443399 bytes
5 files changed, 263 insertions, 11 deletions
diff --git a/macros/latex/contrib/euclideangeometry/README.txt b/macros/latex/contrib/euclideangeometry/README.txt
index b0ea7a4bf8..bd63054ff7 100644
--- a/macros/latex/contrib/euclideangeometry/README.txt
+++ b/macros/latex/contrib/euclideangeometry/README.txt
@@ -10,7 +10,7 @@
%% License information appended
%%
File README.txt for package euclideangeometry
- [2020-03-30 v.0.1.7 Extension package for curve2e]
+ [2020-04-15 v.0.1.8 Extension package for curve2e]
The package bundle euclideangeometry is composed of the following files
diff --git a/macros/latex/contrib/euclideangeometry/euclideangeometry-man.pdf b/macros/latex/contrib/euclideangeometry/euclideangeometry-man.pdf
index c7ab75ca88..1b4b2cb7a5 100644
--- a/macros/latex/contrib/euclideangeometry/euclideangeometry-man.pdf
+++ b/macros/latex/contrib/euclideangeometry/euclideangeometry-man.pdf
Binary files differ
diff --git a/macros/latex/contrib/euclideangeometry/euclideangeometry-man.tex b/macros/latex/contrib/euclideangeometry/euclideangeometry-man.tex
index 3df15a96c4..ac066c69d0 100644
--- a/macros/latex/contrib/euclideangeometry/euclideangeometry-man.tex
+++ b/macros/latex/contrib/euclideangeometry/euclideangeometry-man.tex
@@ -1605,6 +1605,125 @@ Figure~\ref{fig:two-intersecting-circles} shows the geometrical construction to
\caption{Second intersection point $P_2$ of two circles sharing a first intersection point $P_1$}\label{fig:two-intersecting-circles}
\end{figure}
+The following macro allows to determine both intersections, if they exist, of two generic circles; of corse the maro is a little more complicated than the above macro need to find the second intersection when one is already known. Even the reasoning behind the macro is quite different and slightly “creative”.
+
+In facts the reasoning is to avoid any or most analytical computations; analytically it would be quite simple to set up a system of two second degree polynomial equations; after processing such a system it is necessary to solve a second degree equation, but in order to control if there are intersections it should be necessary to discuss the value and sign of the discriminant; it is nothing special when doing all this by hand, but it involves a complicated code in terms of the \LaTeX\ language.
+It is much simpler to reason geometrically; imagine to draw two circles; let $a$ be the distance of their centers, and let $R_1$ and $R_2$ be their radii. Then if
+\[
+|R_1 -R_2| \leq a \leq R_1+R_2
+\]
+the intersections do exist, even if it is possible that the circles are tangent to one another and the two intersection points become a (double) one; this takes place when either ‘equals’ sign applies. I f the left boundary is not satisfied the centers are too close one another and the internal circle is too small compared to the external one. On the opposite if the upper bound is not satisfied the second circle is outside the first one and too far away.
+
+The macro controls the above range, and if the the input data do not satisfy the range boundaries, there are no intersections: a warning message is issued, but computations go on with non sense values for both output coordinates; may be other errors or produced, but in any case the successive drawing lines will not be acceptable; a good sign to the user who may have not noticed the warning message in his/her console, but is immediately “forced” to consult this manual and find out this explanation; s/he will then review his/her code in oder to change the drawing data.
+
+If the data cope with the above range, the computations go on along this simple reasoning, that it drawn in the left part of figure~\ref{fig;Intersections-of-two-circles}. There you see the segment that joins the two centers, and the intersection points to be found. They are the end points of the chord common to both circles; using as vertices the two centers and such chord as the base, two isosceles triangles are formed; the segment joining the centers bisects both triangles forming four right triangles where the hypotenuse is formed by the pertinent radius, and one leg is half the chord; with reference to the right triangles $IC_1P_1$ and $IC_2P_1$, Pithagoras' theorem lets us determine the relation between the common leg $IP_1$ and the other triangle sides; this s the small analytical computation we have to execute, so as to compute the distance $c$ from the center $C_1$ and the common leg length $h$. These two values are sufficient, together with the direction of segment $C_1C_2$ to find the intersection points coordinates.
+
+The syntax il the following
+\begin{ttsyntax}
+\cs{TwoCirclesIntersections}\parg{C1}\parg{C2}withradii\marg{R1} and\marg{R2} to\meta{P1} and\meta{P2}
+\end{ttsyntax}
+Th symbols are self explanatory; as usual, input data (those entered before the keyword \texttt{to}) may be control sequences defined with the necessary data, or explicit data; on the opposite the output ones must be control sequences.
+
+\begin{figure}[!htb]
+\begin{minipage}{0.475\linewidth}
+\unitlength0.01\linewidth
+\begin{picture}(100,100)(-50,-50)
+\AutoGrid
+\VECTOR(-50,0)(50,0) \Pbox(50,0)[tr]{x}[0]
+\VECTOR(0,-50)(0,50) \Pbox(0,50)[l]{y}[0]
+\edef\Kuno{-10,-10}\edef\RKuno{30}%
+\edef\Kdue{20,10}\edef\RKdue{20}
+\thicklines
+\Circlewithcenter\Kuno radius\RKuno
+\Circlewithcenter\Kdue radius\RKdue
+\thinlines
+\TwoCirclesIntersections(\Kuno)(\Kdue)withradii\RKuno and\RKdue to\Puno and\Pdue
+\Pbox(\Kuno)[br]{C_1}[4] \Pbox(\Kdue)[bl]{C_2}[4]
+\Pbox(\Puno)[tl]{P_1}[4] \Pbox(\Pdue)[bc]{P_2}[4]
+\put(\Kuno){\Vector(-45:\RKuno)}\Pbox(5,-27)[bl]{R_1}[0]
+\put(\Kdue){\Vector(-45:\RKdue)}\Pbox(25, 3)[bl]{R_2}[0]
+ \Pbox(\CI)[t]{I}[4]
+%
+\segment(\Kuno)(\Kdue)\segment(\Puno)(\Pdue)
+\segment(\Kuno)(\Pdue)\segment(\Kdue)(\Pdue)
+\segment(\Kuno)(\Puno)\segment(\Puno)(\Kdue)
+\end{picture}
+\end{minipage}
+\hfill
+\begin{minipage}{0.475\linewidth}
+\unitlength0.01\linewidth
+\begin{picture}(100,100)(-50,-50)
+\AutoGrid
+\VECTOR(-50,0)(50,0) \Pbox(50,0)[tr]{x}[0]
+\VECTOR(0,-50)(0,50) \Pbox(0,50)[l]{y}[0]
+\edef\Kuno{-10,-10}\edef\RKuno{30}%
+\edef\Kdue{20,10}\edef\RKdue{20}
+\thicklines
+\Circlewithcenter\Kuno radius\RKuno
+\Circlewithcenter\Kdue radius\RKdue
+\thinlines
+\TwoCirclesIntersections(\Kuno)(\Kdue)withradii\RKuno and\RKdue to\Puno and\Pdue
+\Pbox(\Kuno)[b]{C_1}[4] \Pbox(\Kdue)[b]{C_2}[4]
+\Pbox(\Puno)[tl]{P_1}[4] \Pbox(\Pdue)[b]{P_2}[4]
+\put(\Kuno){\Vector(-45:\RKuno)}\Pbox(5,-27)[bl]{R_1}[0]
+\put(\Kdue){\Vector(-45:\RKdue)}\Pbox(25,3)[bl]{R_2}[0]
+\end{picture}
+\end{minipage}
+\caption{Intersections of two generic circles}\label{fig;Intersections-of-two-circles}
+\end{figure}
+
+The code for drawing figure~\ref{fig;Intersections-of-two-circles} is the following.
+
+\begin{Verbatim}
+\begin{minipage}{0.475\linewidth}
+\unitlength0.01\linewidth
+\begin{picture}(100,100)(-50,-50)
+\AutoGrid
+\VECTOR(-50,0)(50,0) \Pbox(50,0)[tr]{x}[0]
+\VECTOR(0,-50)(0,50) \Pbox(0,50)[l]{y}[0]
+\edef\Kuno{-10,-10}\edef\RKuno{30}%
+\edef\Kdue{20,10}\edef\RKdue{20}
+\thicklines
+\Circlewithcenter\Kuno radius\RKuno
+\Circlewithcenter\Kdue radius\RKdue
+\thinlines
+\TwoCirclesIntersections(\Kuno)(\Kdue)withradii\RKuno
+ and\RKdue to\Puno and\Pdue
+\Pbox(\Kuno)[br]{C_1}[4] \Pbox(\Kdue)[bl]{C_2}[4]
+\Pbox(\Puno)[tl]{P_1}[4] \Pbox(\Pdue)[bc]{P_2}[4]
+\put(\Kuno){\Vector(-45:\RKuno)}\Pbox(5,-27)[bl]{R_1}[0]
+\put(\Kdue){\Vector(-45:\RKdue)}\Pbox(25, 3)[bl]{R_2}[0]
+ \Pbox(\CI)[t]{I}[4]
+%
+\segment(\Kuno)(\Kdue)\segment(\Puno)(\Pdue)
+\segment(\Kuno)(\Pdue)\segment(\Kdue)(\Pdue)
+\segment(\Kuno)(\Puno)\segment(\Puno)(\Kdue)
+\end{picture}
+\end{minipage}
+\hfill
+\begin{minipage}{0.475\linewidth}
+\unitlength0.01\linewidth
+\begin{picture}(100,100)(-50,-50)
+\AutoGrid
+\VECTOR(-50,0)(50,0) \Pbox(50,0)[tr]{x}[0]
+\VECTOR(0,-50)(0,50) \Pbox(0,50)[l]{y}[0]
+\edef\Kuno{-10,-10}\edef\RKuno{30}%
+\edef\Kdue{20,10}\edef\RKdue{20}
+\thicklines
+\Circlewithcenter\Kuno radius\RKuno
+\Circlewithcenter\Kdue radius\RKdue
+\thinlines
+\TwoCirclesIntersections(\Kuno)(\Kdue)withradii\RKuno
+ and\RKdue to\Puno and\Pdue
+\Pbox(\Kuno)[b]{C_1}[4] \Pbox(\Kdue)[b]{C_2}[4]
+\Pbox(\Puno)[tl]{P_1}[4] \Pbox(\Pdue)[b]{P_2}[4]
+\put(\Kuno){\Vector(-45:\RKuno)}\Pbox(5,-27)[bl]{R_1}[0]
+\put(\Kdue){\Vector(-45:\RKdue)}\Pbox(25,3)[bl]{R_2}[0]
+\end{picture}
+\end{minipage}
+\end{Verbatim}
+
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Triangles and their special lines}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
diff --git a/macros/latex/contrib/euclideangeometry/euclideangeometry.dtx b/macros/latex/contrib/euclideangeometry/euclideangeometry.dtx
index 7305301abf..af615d4b55 100644
--- a/macros/latex/contrib/euclideangeometry/euclideangeometry.dtx
+++ b/macros/latex/contrib/euclideangeometry/euclideangeometry.dtx
@@ -45,7 +45,7 @@ This work consists of files:
%<package>\ProvidesPackage{euclideangeometry}%
%<readme>File README.txt for package euclideangeometry
%<*package|readme>
- [2020-03-30 v.0.1.7 Extension package for curve2e]
+ [2020-04-15 v.0.1.8 Extension package for curve2e]
%</package|readme>
%<*driver>
\documentclass{ltxdoc}\errorcontextlines=100
@@ -154,7 +154,7 @@ g\raisebox{-0.715ex}{\kern-0.26em u}\kern-0.13em\I\kern-0.14em t}\xspace}
% installed with your updated complete \TeX system installation.
% Please refer to the user manual before using this package.
-% \CheckSum{1193}
+% \CheckSum{1296}
%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\StopEventually{}
%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -605,11 +605,12 @@ g\raisebox{-0.715ex}{\kern-0.26em u}\kern-0.13em\I\kern-0.14em t}\xspace}
% but it allows to go on with typesetting, although with non sense results.
% Warnings do not stop the compilation program, therefore their message
% goes to the \file{.log} file and the user might not notice it; but
-% since the results are probably absurd, s/he certainly notice this
-% fact and look for messages; the user, therefore, who has carefully
+% since the results are probably absurd, s/he certainly notices this
+% fact and looks for messages; the user, therefore, who has carefully
% read this user manual, immediately looks onto the \file{.log} file
-% and realises the reason of the wrong results.
-%
+% and realises the reason of the wrong results. A similar approach
+% is used for the macro that determines the intersection of two circles;
+% see below
% The syntax of this macro is the following:
%\begin{ttsyntax}
%\cs{IntersectionsOfLine}\parg{point}\parg{direction} WithCircle\parg{center}\marg{radius} to\meta{int1} and\meta{int2}
@@ -659,8 +660,8 @@ g\raisebox{-0.715ex}{\kern-0.26em u}\kern-0.13em\I\kern-0.14em t}\xspace}
\SymmetricalPointOf#3respect\Smed to#4\ignorespaces}
% \end{macrocode}
%
-% Another useful macro draws a circle given its \meta{center} and the
-% coordinates of the \meta{ponit} which the circumference should pass
+% This useful macro draws a circle given its \meta{center} and the
+% coordinates of the \meta{point} which the circumference should pass
% through. The syntax is:
%\begin{ttsyntax}
%\cs{CircleThrough}\parg{[point}WithCenter\marg{center}
@@ -683,8 +684,140 @@ g\raisebox{-0.715ex}{\kern-0.26em u}\kern-0.13em\I\kern-0.14em t}\xspace}
%\end{flushleft}
% where \cs{ignorespaces} may be superfluous, but is always a safety action
% when defining commands to be used within the \amb{picture} environment.
-% In any case see example~XXX in \file{euclideangeometry-man.pdf}
-%^^A\ref{fig:twocircles-second intersection}.
+% In any case see example~15 in \file{euclideangeometry-man.pdf}
+%^^A\ref{fig:two-intersecting-circles}.
+%
+% If it is necessary to find the intersections of two circles that
+% do not share a previously known point; we can use the following
+% macro. Analytically given the equations of two circumferences,
+% it is necessary to solve a system of two second degree equations
+% the processing of which ends up with a second degree polynomial
+% that might have real roots (the coordinates of the intersection
+% points), or two coincident roots (the circles are tangent), or
+% complex roots (the circles do not intersect), or they may be
+% indefinite (the two circles heve the same center and the same
+% radii). Let us exclude the last case, although it would be trivial
+% to create the macro with a test that controls such situation. But
+% even the analysis of the discriminant of the second degree equation
+% requires a complicated code.
+%
+% On the opposite a simple drawing of the two circles, with centers
+% $C_1$ and $C_2$ and radii $R_1$ and $R_2$, with the centers distance
+% of $ a= |C_1-C_2|$, allows to understand that in order to have
+% intersections: $(\alpha)$ if $a\leq \max(R_1,R_2)$ (the center
+% of a circle is contained within the other one) then it must be
+% $ a \geq |R_1 - R_2|$, where the ‘equals’ sign applies when the
+% circles are internally tangent; $(\beta)$ otherwise
+% $a \geq \max(R_1,R_2)$ and it must be $a \leq R_1+R_2$ , where
+% the ‘equals’ sign applies when the circles are externally tangent.
+% In conclusion in any case il the range $|R_1-R_2|\leq a\leq R_1+R_2$
+% is where the two circles intersect, while outside this distance
+% range the circles do not intersect.
+%
+% For simplicity let us assume that $R_1 \geq R_2$; the macro can
+% receive the circle data in any order, but the macro very easily
+% switches their data so that circle number~1 is the one with larger
+% radius. If the distance $a$ is outside the allowed range, there
+% are no intersections, therefore a warning message is output and the
+% intersection point coordinates are both set to \texttt{0,0}, so that
+% processing continues with non sense data; the remaining geometric
+% construction based on such intersection points might continue with
+% other error messages or to absurd results; a string message to the
+% user who, having read the documentation, understand the problem and
+% provides for.
+%
+% The new macro has the following syntax:
+%\begin{ttsyntax}
+%\cs{TwoCirclesIntersections}\parg{C1}\parg{C2}withradii\marg{R1} and\marg{R2} to\meta{P1} and\meta{P2}
+%\end{ttsyntax}
+% where the symbols in input may be macros or explicit numerical
+% values; the output point coordinates \meta{P1} and \meta{P2}
+% should be definable single tokens, therefore the surrounding
+% braces are not necessary.
+% \begin{macrocode}
+\def\TwoCirclesIntersections(#1)(#2)withradii#3and#4to#5and#6{%
+ \fptest{#3 >=#4}{%
+ \edef\Cuno{#1}\edef\Cdue{#2}%
+ \edef\Runo{#3}\edef\Rdue{#4}%
+ }{%
+ \edef\Cdue{#2}\edef\Cuno{#2}%
+ \edef\Rdue{#3}\edef\Runo{#4}%
+ }
+% \end{macrocode}
+% Above we switched the circle data so as to be sure that symbols relating
+% to circle ‘one’ refer to the circle with larger (or equal) radius.
+% Now we define the centers distance in macro \cs{A}; the test if \cs{A}
+% lays in the correct range, otherwise we output a warning message.
+% \begin{macrocode}
+ \SegmentLength(\Cuno)(\Cdue)to\A
+ \edef\TCIdiffR{\fpeval{\Runo-\Rdue}}\edef\TCIsumR{\fpeval{\Runo+\Rdue}}
+ \fptest{\TCIdiffR > \A || \A > \TCIsumR}{%
+ \edef#5{0,0}\edef#6{0,0}% Valori assurdi se i cerchi non si intersecano
+ \PackageWarning{TestFP}{%
+ ***********************************\MessageBreak
+ Circles do not intersect \MessageBreak
+ Check centers and radii and retry \MessageBreak
+ Both intersection point are set to \MessageBreak
+ (0,0) therefore expect errors \MessageBreak
+ ***********************************\MessageBreak}%
+ }{%
+% \end{macrocode}
+% Here we are within the correct range and we proceed with the
+% calculations. We take as a temporary reference the segment
+% that joins the centers. The common chord that joins the
+% intersection points is perpendicular to such a segment crossing
+% it by a distance $c$ form $C_1$, and, therefore by a distance
+% $a-c$ from $C_2$; this chord forms two isosceles triangles with the
+% centers; the above segment bisects such triangles, forming four right
+% triangles; their hypotenuses equal the radii of the respective
+% circles; their bases $h$ are all equal to half the chord; Pythagoras'
+% theorem allows us to write:
+%\[
+%\left\{
+% \begin{aligned}
+% h^2 &= R_1^2 - c^2\\
+% h^2 &= R_2^2 - (a-c)^2
+% \end{aligned}
+%\right.
+%\]
+% Solving for $c$, we get:
+%\[\left\{
+%\begin{aligned}
+%c &= \frac{R_1^2 - R_2^2 + a^2 }{2a}\\
+%h &= \sqrt{R_1^2 -c^2}
+%\end{aligned}
+%\right.
+%\]
+% \begin{macrocode}
+ \SegmentArg(\Cuno)(\Cdue)to\Acompl
+ \SubVect\Cuno from\Cdue to \Cdue
+ \edef\CI{\fpeval{(\Runo^2 - \Rdue^2 +\A^2)/(2*\A)}}
+ \edef\H{\fpeval{sqrt(\Runo^2 - \CI^2)}}
+ \CopyVect\CI,-\H to\Puno
+ \CopyVect\CI,\H to\Pdue
+% \end{macrocode}
+% Now we do not need anymore the chord intersection distance \cs{CI}
+% any more, so we can use for other tasks, and we create a vector with
+% absolute coordinates; We then add the rotated vector corresponding
+% to the base \cs{H} so as to get the absolute chord extrema \cs{PPuno}
+% and \cs{PPdue}.
+% \begin{macrocode}
+ \MultVect\CI,0 by\Acompl:1 to\CI
+ \AddVect\Cuno and\CI to\CI
+ \MultVect\Puno by\Acompl:1 to\PPunorot
+ \AddVect\PPunorot and \Cuno to \PPuno
+ \MultVect\Pdue by\Acompl:1 to\PPduerot
+ \AddVect\PPduerot and \Cuno to \PPdue
+ \edef#5{\PPuno}\edef#6{\PPdue}%
+ }%
+}
+% \end{macrocode}
+% It may be noticed that the first intersection point, assigned to
+% parameter |#5| is the one found along the orthogonal direction
+% to the vector form $C_1$ to $C_2$, obtained by a rotation of
+% $90^\circ$ counterclockwise.
+% The whole construction of the geometry described above is shown
+% in figure~16 in the user manual \file{euclideangeometry-man.pdf}.
%
%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsection{Triangle special points}
diff --git a/macros/latex/contrib/euclideangeometry/euclideangeometry.pdf b/macros/latex/contrib/euclideangeometry/euclideangeometry.pdf
index 06df57e151..4b3c5051ab 100644
--- a/macros/latex/contrib/euclideangeometry/euclideangeometry.pdf
+++ b/macros/latex/contrib/euclideangeometry/euclideangeometry.pdf
Binary files differ