diff options
Diffstat (limited to 'macros/latex/contrib/tkz')
71 files changed, 11551 insertions, 4924 deletions
diff --git a/macros/latex/contrib/tkz/pgfornament/README.md b/macros/latex/contrib/tkz/pgfornament/README.md index 737ee2acc2..901d6554cc 100644 --- a/macros/latex/contrib/tkz/pgfornament/README.md +++ b/macros/latex/contrib/tkz/pgfornament/README.md @@ -1,6 +1,6 @@ # pgfornament – Drawing of Vectorian ornaments with PGF/TikZ -Release 1.2 2020/05/28 +Release 1.3 2024/08/14 ## Description @@ -55,6 +55,9 @@ your LaTeX document. Documentations for `pgfornament` and `tikzrput` are available on CTAN and in your TeX distribution. ## History + +- v 1.3 Correction of bug (spurious space) by Tibor Tómács and correction of the documentation. + - v 1.2 Correction of bug (spurious space) by LianTze Lim. - v 1.00 Add the Han ornanments and some new macros. Add some examples to the documentation. Thanks to Pablo Gonzáles L to help me with "Git". diff --git a/macros/latex/contrib/tkz/pgfornament/doc/ornaments.pdf b/macros/latex/contrib/tkz/pgfornament/doc/ornaments.pdf Binary files differindex 6486f4e253..46f3fe8fef 100644 --- a/macros/latex/contrib/tkz/pgfornament/doc/ornaments.pdf +++ b/macros/latex/contrib/tkz/pgfornament/doc/ornaments.pdf diff --git a/macros/latex/contrib/tkz/pgfornament/doc/ornaments.tex b/macros/latex/contrib/tkz/pgfornament/doc/ornaments.tex index c52dd63e91..2a7f4b0fc1 100644 --- a/macros/latex/contrib/tkz/pgfornament/doc/ornaments.tex +++ b/macros/latex/contrib/tkz/pgfornament/doc/ornaments.tex @@ -8,7 +8,7 @@ % of this license or (at your option) any later version and/or % 2. under the GNU Public License. %---------%---------%---------%---------%---------%---------%---------%--------- -% Version 1.2 2020/0 5/26 +% Version 1.3 2024/08/14 \RequirePackage{luatex85} \RequirePackage{silence} \WarningsOff[latex] @@ -137,7 +137,7 @@ urlcolor=orange} \bigskip -\noindent\pgfornament[width=0.75 cm]{152}\ (Version 1.2 2020/05/26) +\noindent\pgfornament[width=0.75 cm]{152}\ (Version 1.3 2024/08/14) \begin{abstract} This document describes the \LaTeX\ package \emph{\docpkg{pgfornament}} and presents the syntax and parameters of the macro "pgfornament". diff --git a/macros/latex/contrib/tkz/pgfornament/doc/usefulcommands.tex b/macros/latex/contrib/tkz/pgfornament/doc/usefulcommands.tex index 4af2421923..4a54f9ea45 100644 --- a/macros/latex/contrib/tkz/pgfornament/doc/usefulcommands.tex +++ b/macros/latex/contrib/tkz/pgfornament/doc/usefulcommands.tex @@ -5,11 +5,11 @@ \setlength{\@tempdimb}{\paperwidth-\@tempdima-1cm}% \setlength{\@tempdimc}{\paperheight-\@tempdima}% \put(\LenToUnit{\@tempdima},\LenToUnit{\@tempdimc}){% - \pgfornament[color=Maroon,anchor=north west,width=1cm]{39}} -\put(\LenToUnit{\@tempdima},\LenToUnit{\@tempdima}){% - \pgfornament[color=Maroon,anchor=south west,width=1cm,symmetry=h]{39}} + \pgfornament[color=Maroon,anchor=north west,width=1cm]{39}} \put(\LenToUnit{\@tempdimb},\LenToUnit{\@tempdimc}){% \pgfornament[color=Maroon,anchor=north east,width=1cm,symmetry=v]{39}} +\put(\LenToUnit{\@tempdima},\LenToUnit{\@tempdima}){% + \pgfornament[color=Maroon,anchor=south west,width=1cm,symmetry=h]{39}} \put(\LenToUnit{\@tempdimb},\LenToUnit{\@tempdima}){% \pgfornament[color=Maroon,anchor=south east,width=1cm,symmetry=c]{39}} \endgroup diff --git a/macros/latex/contrib/tkz/pgfornament/latex/pgfornament.sty b/macros/latex/contrib/tkz/pgfornament/latex/pgfornament.sty index 27406e8bbf..fad27cbb74 100644 --- a/macros/latex/contrib/tkz/pgfornament/latex/pgfornament.sty +++ b/macros/latex/contrib/tkz/pgfornament/latex/pgfornament.sty @@ -17,7 +17,7 @@ % Inspired from psvectorian P Fradin H Voss \NeedsTeXFormat{LaTeX2e} \RequirePackage{tikz,pgfopts} -\ProvidesPackage{pgfornament}[2020/05/26 v1.2 vector ornaments] +\ProvidesPackage{pgfornament}[2024/08/14 v1.3 vector ornaments] \gdef\pgfOrnamentsObject{pgflibraryvectorian.code.tex} \gdef\OrnamentsFamily{vectorian} \pgfkeys{% @@ -138,7 +138,7 @@ baseline={([yshift=\pgfornamentydelta]current bounding box.\pgfornamentanchor)}, \pgftransformscale{\pgfornamentscale}% \pgf@@ornament{#2}% \end{tikzpicture}% -\tikzset{pgfornamentstyle/.style={cm={1,0,0,1,(0,0)}}} +\tikzset{pgfornamentstyle/.style={cm={1,0,0,1,(0,0)}}}% }% end pgfornament \gdef\ornamenttopos{.5} @@ -180,8 +180,8 @@ baseline={([yshift=\pgfornamentydelta]current bounding box.\pgfornamentanchor)}, \pgfextractx{\pgf@x}{\pgfpointanchor{#2}{#3 west}} \pgf@xb=\pgf@x \advance\pgf@xb by -\pgf@xa -\node[inner sep=0pt] at ($(#1.#3 east)!.5!(#2.#3 west)$) {\pgfornament[width=\pgf@xb]{#4}} ; -} +\node[inner sep=0pt] at ($(#1.#3 east)!.5!(#2.#3 west)$) {\pgfornament[width=\pgf@xb]{#4}}; +}% \def\pgfornamentvline#1#2#3#4{% \pgfextracty{\pgf@y}{\pgfpointanchor{#1}{south #3}} \pgf@ya=\pgf@y @@ -203,7 +203,7 @@ baseline={([yshift=\pgfornamentydelta]current bounding box.\pgfornamentanchor)}, \pgfmathsetmacro{#1}{atan2(\pgf@x,\pgf@y)}% }% \makeatother -\newcommand{\resetpgfornamentstyle}{\tikzset{pgfornamentstyle/.style={}}} +\newcommand{\resetpgfornamentstyle}{\tikzset{pgfornamentstyle/.style={}}}% % 2020 Changing vector objects \def\newpgfornamentfamily#1{% @@ -219,11 +219,10 @@ baseline={([yshift=\pgfornamentydelta]current bounding box.\pgfornamentanchor)}, /ornamentline/.search also={/tikz}} \def\pgfornamentline{\pgfutil@ifnextchar[{\pgf@ornamentline}{\pgf@ornamentline[]}}% \def\pgf@ornamentline[#1]#2#3#4#5{% - \pgfqkeys{/ornamentline}{#1}% \pgfmathsetmacro\nbo{#4} \path (#2) -- (#3) foreach \i in {0,...,\nbo} {coordinate[pos=\i/\nbo] (p\i)} [color=\ornamentcolor] foreach \i [count=\j] in {0,...,\number\numexpr\nbo-1} { (p\i) to [ornament=#5] (p\j)}; -} +}% \makeatother \endinput
\ No newline at end of file diff --git a/macros/latex/contrib/tkz/tkz-elements/README.md b/macros/latex/contrib/tkz/tkz-elements/README.md index a4d8d90fad..e1f8622bb0 100644 --- a/macros/latex/contrib/tkz/tkz-elements/README.md +++ b/macros/latex/contrib/tkz/tkz-elements/README.md @@ -1,10 +1,10 @@ # tkz-elements — for euclidean geometry -Release 2.25c 2024/04/28 +Release 3.10c 2025/01/01 ## Description -`tkz-elements v.2.25c` is the new version of a library written in lua, allowing to make all the necessary calculations to define the objects of a Euclidean geometry figure. You need to compile with `LuaLaTeX`. With `tkz-elements`, the definitions and calculations are only done with `Lua`. +`tkz-elements v.3.10c` is the new version of a library written in lua, allowing to make all the necessary calculations to define the objects of a Euclidean geometry figure. You need to compile with `LuaLaTeX`. With `tkz-elements`, the definitions and calculations are only done with `Lua`. The main possibility of programmation proposed is oriented "object programming" with object classes like point, line, triangle, circle and ellipse. For the moment, once the calculations are done, it is `tkz-euclide` or `TikZ` which allows the drawings. You can use the option `mini` with `tkz-euclide` to load only the modules required for tracing. @@ -43,9 +43,9 @@ your LaTeX document: \usepackage[mini]{tkz-euclide} \usepackage{tkz-elements} \begin{document} -\begin{tkzelements} +\directlua{ your code -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes your code @@ -55,20 +55,43 @@ your LaTeX document: If you use the `xcolor` package, load that package before `tkz-euclide` to avoid package conflicts. +It's possible to use the environment `tkzelements` istead of the directive `\directlua` but in this case, you need to load the package `luacode`. + ## Examples Some examples will be stored on my site : [http://altermundus.fr](http://altermundus.fr). -An important example `Golden Arbelos` using the package is on the site. All the files of the documentation -are on the site. +An important example `Golden Arbelos` using the package is on the site. All the files of the documentation are on the site. ## History + - version 3.10c + - Most of the functions have been optimized, and some have been commented on. + - Object classes have been enhanced with new attributes. For a triangle, you can directly access the semiperimeter, area, inradius and circumradius. In some classes, the `exradius` attribute is replaced by `circumradius`. + - For rectangle, square and circle, `perimeter` and `area` have been added. + - For line, new methods appear: `is_parallel`, `is_orthogonal` and `is_equidistant`. The latter allows you to determine whether a point is equidistant from the two points defining the line. The `swap` argument is available for all triangle creations. The result is now a single triangle, the second is obtained with `swap`. + - It is now possible to define an isosceles triangle from a straight line (segment) with length `isosceles_s`. You can use `isosceles_a` or the old `isosceles` method if you're using an angle. I've added a new test for triangles: `is_acute`. The `two_angles` method is identical to `asa`. + - The line , circle and triangle classes are complemented by methods with complicated names: `c_l_pp`, `c_ll_p`, `c_c_pp` and `c_cc_p`. These methods allow you to determine, from a line or circle, one or more circles tangent to lines or circles and passing through points. So `c_l_pp` means to create a circle tangent to a line (l) and passing through two points (pp). The first `c` reminds us that we're looking for a circle, the second group between `_` and `_` indicates the tangent objects (c or l) and the last indicates the points through which the circle passes. + - In the documentation, I've added a section on important geometry theorems ( + Viviani, Reuschle, Thébault,Varignon, Wittenbauer, Soddy, Six circles ... to be completed ...). Examples of new methods and attributes have also been added. + + - version 3.00c + - It is now possible to use the `directlua` primitive to perform `lua` code. In this case, tables and scaling can be reset using the `init_elements` function. You can still use the `tkzelements` environment, but only if you load the `luacode` package. + - Examples have been added to the `transfers` section. + + - version 2.30c + - New version of the macro `\tkzGetNodes` written by Sanskar Singh. This version now fixes a bug that prevented a figure from being centred with `centering` or the `center` environment. + - Adding methods `bevan_circle`, `symmedial_circle`. + - Correction of the methods `function triangle: bevan_point ()` and `function triangle: mittenpunkt_point ()`. + - Adding `function triangle: similar ()` + - Adding `function line : perpendicular_bisector ()` which is similar to `function line : mediator ()` + - Correction of documentation. + - version 2.25c - French documentation at my site: [http://altermundus.fr](http://altermundus.fr) - Added `colinear_at` a new method for the classe `line` - Added `cevian`, `pedal`, `conway_circle`, `conway_points` new methods to the class `triangle`. - version 2.20c - - Package: + - Package: - Added class matrix; methods are mainly of order 2, sometimes of order 3. - Added function solve_quadratic. This function can be used to solve second-degree equations with real or complex numbers. - Added method print for the class point. Example z.A : print () diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-circle.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-circle.tex index 7ae96c7ada..d1524ea008 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-circle.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-circle.tex @@ -25,8 +25,10 @@ This class is defined by two points: the center and a point through which the ci \Iattr{circle}{south} & |C.AB.south| & |z.S = C.OA.south| \\ \Iattr{circle}{east} & |C.AB.east| & |z.E = C.OA.east| \\ \Iattr{circle}{west} & |C.AB.west| & |z.W = C.OA.west| \\ -\Iattr{circle}{opp} & |z.Ap = C.AB.opp| & Refer to (\ref{ssub:example_circle_attributes}) \\ -\Iattr{circle}{ct} & |L = C.AB.ct| & Refer to (\ref{ssub:example_circle_attributes}) \\ +\Iattr{circle}{opp} & |z.Ap = C.AB.opp| & [\ref{ssub:example_circle_attributes}] \\ +\Iattr{circle}{ct} & |L = C.AB.ct| [ \ref{ssub:example_circle_attributes} ] \\ +\Iattr{circle}{perimeter} & |p = C.AB.perimeter| [\ref{ssub:attributes_perimeter_and_area}] \\ +\Iattr{circle}{area} & |a = C.AB.area| [\ref{ssub:attributes_perimeter_and_area}] \\ \bottomrule % \end{tabular} \egroup @@ -38,7 +40,8 @@ Three attributes are used (south, west, radius). \begin{minipage}{0.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .5 z.a = point: new (1, 1) z.b = point: new (5, 4) @@ -48,7 +51,7 @@ Three attributes are used (south, west, radius). r = C.ab.radius z.c = C.ab.opp z.r,z.t = get_points (C.ab.ct : ortho_from (z.b)) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPoints(a,b,c,s,w) @@ -60,7 +63,8 @@ Three attributes are used (south, west, radius). \end{Verbatim} \end{minipage} \begin{minipage}{0.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () scale = .5 z.a = point: new (1, 1) z.b = point: new (5, 4) @@ -70,9 +74,9 @@ Three attributes are used (south, west, radius). r = C.ab.radius z.c = C.ab.opp z.r,z.t = get_points (C.ab.ct : ortho_from (z.b)) -\end{tkzelements} -\hspace*{\fill} -\begin{tikzpicture} +} + +\hfill\begin{tikzpicture} \tkzGetNodes \tkzDrawPoints(a,b,c,s,w) \tkzLabelPoints(a,b,c,s,w) @@ -80,9 +84,44 @@ Three attributes are used (south, west, radius). \tkzDrawSegments(a,b r,t b,c) \tkzLabelSegment[sloped](a,b){ab = \tkzUseLua{r}} \end{tikzpicture} -\hspace*{\fill} + \end{minipage} % subsubsection example_circle_attributes (end) + +\subsubsection{Attributes perimeter and area} % (fold) +\label{ssub:attributes_perimeter_and_area} + + \pgfkeys{/pgf/number format/.cd,std,precision=4} + \let\pmpn\pgfmathprintnumber + +\begin{mybox} +\begin{Verbatim} + \directlua{ + z.A = point : new (1, 2) + z.B = point : new (4, 3) + C.AB = circle : new (z.A,z.B) + p = C.AB.perimeter + a = C.AB.area + } +Let be two points $A$ and $B$. The circle of center $A$ passing +through $B$ has perimeter \pmpn{\tkzUseLua{p}} $cm$ +and area \pmpn{\tkzUseLua{a} }$cm^2$. + +\end{Verbatim} + +\end{mybox} + +\directlua{ +z.A = point : new (1, 2) +z.B = point : new (4, 3) +C.AB = circle : new (z.A,z.B) +p = C.AB.perimeter +a = C.AB.area +} +Let be two points $A$ and $B$. +The circle of center $A$ passing through $B$ has perimeter \pmpn{\tkzUseLua{p}} $cm$ and area \pmpn{\tkzUseLua{a} }$cm^2$. + +% subsubsection attributes_perimeter_and_area (end) % subsection attributes_of_a_circle (end) \newpage @@ -96,197 +135,402 @@ Three attributes are used (south, west, radius). \toprule \textbf{Methods} & \textbf{Comments} & \\ \midrule \\ -\Igfct{circle}{new(O,A)} & |C.OA = circle : new (z.O,z.A)| & circle center $O$ through $A$\\ -\Igfct{circle}{radius(O,r)} & |C.OA = circle : radius (z.O,2)| & circle center $O$ radius =2 cm\\ -\Igfct{circle}{diameter(A,B)} & |C.OA = circle :diameter(z.A,z.B)| & circle diameter $[AB]$ \\ +\Igfct{circle}{new(O,A)} & |C.OA = circle : new (z.O,z.A)| & center $O$ through $A$; [\ref{ssub:method_imeth_circle_new}]\\ +\Igfct{circle}{radius(O,r)} & |C.OA = circle : radius (z.O,2)| & center $O$ radius =2 cm; [\ref{ssub:method_imeth_circle_radius}]\\ +\Igfct{circle}{diameter(A,B)} & |C.OA = circle :diameter(z.A,z.B)| & diameter $[AB]$; [\ref{ssub:method_imeth_circle_diameter}] \\ +\midrule + \textbf{Reals} &&\\ \midrule +\Imeth{circle}{power (pt)} &| r = C.OA: power (z.M)| & [\ref{ssub:power_v1} ; \ref{ssub:power_v2} ; \ref{sub:apollonius_circle_v1_with_inversion} ] \\ +\midrule + \textbf{Strings} &&\\ + \midrule + \Imeth{circle}{circles\_position (C1)} & result = string & [\ref{ssub:circles_position}] \\ + \midrule + \textbf{Booleans} &&\\ +\midrule +\Imeth{circle}{in\_out (pt)} & |C.OA : in_out (z.M)| & [\ref{ssub:in_out_for_circle_and_disk}] \\ +\Imeth{circle}{in\_out\_disk (pt)} & |C.OA : in_out_disk (z.M)| & [\ref{ssub:in_out_for_circle_and_disk}] \\ +\Imeth{circle}{is\_tangent (L)} & |C.OA : is_tangent (L.CD)| & [\ref{ssub:method_imeth_circle_is__tangent}] \\ \textbf{Points} &&\\ \midrule -\Imeth{circle}{antipode (pt)} & |z.C = C.OA: antipode (z.B)| & $[BC]$ is a diameter \\ -\Imeth{circle}{inversion (pt)} & |z.Bp = C.AC: inversion (z.B)|&\\ -\Imeth{circle}{midarc (pt,pt)} & |z.D = C.AB: midarc (z.B,z.C)|& $D$ is the midarc of $\widearc{BC}$\\ -\Imeth{circle}{point (r)} & |z.E = C.AB: point (0.25)|& |r| between 0 and 1\\ +\Imeth{circle}{antipode (pt)} & |z.C = C.OA: antipode (z.B)| & $[BC]$ = diameter; [\ref{ssub:method_imeth_circle_antipode}] \\ +\Imeth{circle}{midarc (pt,pt)} & |z.D = C.AB: midarc (z.B,z.C)|& $D$ is the midarc of $\widearc{BC}$; [\ref{ssub:method_imeth_circle_midarc}]\\ +\Imeth{circle}{point (r)} & |z.E = C.AB: point (0.25)|& |r| between 0 and 1; [\ref{ssub:method_imeth_circle_point}]\\ \Imeth{circle}{random\_pt(lower, upper)} & &\\ -\Imeth{circle}{internal\_similitude (C)} & |z.I = C.one : internal_similitude (C.two)| &\\ -\Imeth{circle}{external\_similitude (C)} & |z.J = C.one : external_similitude (C.two)| & \\ -\Imeth{circle}{radical\_center (C1<,C2>)} & or only (C1) & Refer to \ref{sub:radical_center} \\ +\Imeth{circle}{inversion (obj)} & |z.Bp = C.AC: inversion (z.B)|& [\ref{ssub:inversion}]\\ +\Imeth{circle}{internal\_similitude (C)} & |z.I= C.one: internal_similitude(C.two)| & [\ref{ssub:method_imeth_circle_internal__similitude}]\\ +\Imeth{circle}{external\_similitude (C)} & |z.J= C.one: external_similitude(C.two)| & [\ref{ssub:method_imeth_circle_external__similitude}] \\ +\Imeth{circle}{radical\_center (C1<,C2>)} & or only (C1) & [\ref{ssub:radical_center} ] \\ \midrule \textbf{Lines} & & \\ \midrule -\Imeth{circle}{radical\_axis (C)} & Refer to ( \ref{sub:d_alembert_2} ; \ref{sub:radical_axis_v1} ; \ref{sub:radical_axis_v2} ; \ref{sub:radical_axis_v3} ; \ref{sub:radical_axis_v4})& \\ -\Imeth{circle}{tangent\_at (pt)} & |z.P = C.OA: tangent_at (z.M)| & Refer to (\ref{ssub:lemoine} ; \ref{ssub:example_combination_of_methods})\\ -\Imeth{circle}{tangent\_from (pt)}& |z.M,z.N = C.OA: tangent_from (z.P)| & Refer to (\ref{tangent_from})\\ -\Imeth{circle}{inversion (line)} & |L or C = C.AC: inversion (L.EF)|& Refer to (\ref{ssub:inversion_line})\\ -\Imeth{circle}{common\_tangent (C)} & |z.a,z.b = C.AC: common_tangent (C.EF)|& Refer to (\ref{sub:common_tangent} ; \ref{sub:common_tangent_orthogonality})\\ +\Imeth{circle}{radical\_axis (C)} & [ \ref{ssub:method_imeth_circle_radical__axis_c} ; \ref{sub:d_alembert_2} ] & \\ +\Imeth{circle}{tangent\_at (pt)} & |z.P=C.OA:tangent_at(z.M)| & [\ref{ssub:method_imeth_circle_tangent}] \\ +\Imeth{circle}{tangent\_from (pt)}& |z.M,z.N=C.OA: tangent_from (z.P)| & [\ref{ssub:method_imeth_circle_tangent} ] \\ +\Imeth{circle}{common\_tangent (C)}& |z.a,z.b = C.AC: common_tangent (C.EF)|& [\ref{ssub:common_tangent} ; \ref{sub:common_tangent_orthogonality}] \\ \midrule \textbf{Circles}& &\\ \midrule -\Imeth{circle}{orthogonal\_from (pt)} &|C=C.OA:orthogonal_from (z.P)| & Refer to (\ref{ssub:altshiller} ; \ref{sub:common_tangent_orthogonality} ; \ref{sub:orthogonal_circles_v1} ; \ref{sub:pencil_v1}) \\ -\Imeth{circle}{orthogonal\_through (pta,ptb)}&|C=C.OA:orthogonal_through (z.z1,z.z2)| & Refer to (\ref{sub:orthogonal_circle_through})\\ -\Imeth{circle}{inversion (...)} &|C.AC:inversion (pt, pts, L or C)|& Refer to \ref{ssub:inversion}, \ref{ssub:inversion_point}, \ref{ssub:inversion_line}, \ref{ssub:inversion_circle}\\ -\Imeth{circle}{midcircle (C)} & |C.inv = C.OA: midcircle (C.EF)| & Refer to \ref{ssub:midcircle} \\ -\Imeth{circle}{radical\_circle (C1<,C2>)} & or only (C1) & Refer to \ref{sub:radical_circle}\\ -\midrule - \textbf{Miscellaneous} &&\\ -\midrule -\Imeth{circle}{power (pt)} &|p = C.OA: power (z.M)| & Refer to (\ref{sub:power_v1} ; \ref{sub:power_v2} ; \ref{sub:apollonius_circle_v1_with_inversion}) \\ -\Imeth{circle}{in\_out (pt)} & |C.OA : in_out (z.M)| & Refer to (\ref{sub:in_out_for_circle_and_disk}) \\ -\Imeth{circle}{in\_out\_disk (pt)} & |C.OA : in_out_disk (z.M)| & Refer to (\ref{sub:in_out_for_circle_and_disk}) \\ -\Imeth{circle}{draw ()} & for further use &\\ -\Imeth{circle}{circles\_position (C1)} & result = string &Refer to (\ref{sub:circles_position}) \\ +\Imeth{circle}{orthogonal\_from (pt)} &|C=C.OA:orthogonal_from (z.P)| & [\ref{ssub:method_imeth_circle_orthogonal_from_pt} ;\ref{sub:altshiller} ; \ref{sub:pencil_v1}] \\ +\Imeth{circle}{orthogonal\_through(pta,ptb)}&|C=C.OA:orthogonal_through (z.z1,z.z2)| & [\ref{ssub:method_imeth_circle_orthogonal_through}]\\ +\Imeth{circle}{midcircle (C)} & |C.inv = C.OA: midcircle (C.EF)| & [\ref{ssub:midcircle}] \\ +\Imeth{circle}{radical\_circle (C1<,C2>)} & or only (C1) & [\ref{ssub:radical_circle}] \\ +\Imeth{circle}{c\_c\_pp(pt,pt)} &|C1,C2=C.A:c_cc_p (z.P,z.Q)| & [\ref{ssub:method_c__c__pp}] \\ +\Imeth{circle}{c\_cc\_p(C,pt)} &|C1,C2=C.A:c_cc_p (C.B,z.P)| & [\ref{ssub:method_c_cc_p}] \\ +\Imeth{circle}{c\_lc\_p(L,pt,<inside>)} &|C1,C2=C.A:c_cc_p (L.AB,z.P)| & [\ref{ssub:method_c_lc_p}] \\ \bottomrule \end{tabular} \egroup % subsection methods_circle (end) -\subsubsection{Altshiller} % (fold) -\label{ssub:altshiller} +\subsubsection{Method \Imeth{circle}{new}} % (fold) +\label{ssub:method_imeth_circle_new} + +A circle is defined by its centre and a point through which it passes. + +\vspace{6pt} +\begin{minipage}{.5\textwidth} +\begin{Verbatim} +\directlua{% +init_elements () +z.O = point: new (0,0) +z.A = point: new (2,1) +C = circle: new (z.O , z.A) +} +\begin{tikzpicture}[gridded] +\tkzGetNodes +\tkzDrawCircles(O,A) +\tkzDrawPoints(A,O) +\tkzLabelPoints[right](A,O) +\end{tikzpicture} +\end{Verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} +\directlua{% +init_elements () +z.O = point: new (0,0) +z.A = point: new (2,1) +C = circle: new (z.O , z.A) +} + \begin{center} +\begin{tikzpicture}[gridded] +\tkzGetNodes +\tkzDrawCircles(O,A) +\tkzDrawPoints(A,O) +\tkzLabelPoints[right](A,O) +\end{tikzpicture} + \end{center} + +\end{minipage} + +% subsubsection method_imeth_circle_new (end) + +\subsubsection{Method \Imeth{circle}{radius}} % (fold) +\label{ssub:method_imeth_circle_radius} + + +We define a circle with its centre and radius. + +\vspace{6pt} +\begin{minipage}{.5\textwidth} +\begin{Verbatim} +\directlua{% +init_elements () +z.O = point: new (0,0) +z.A = point: new (2,1) +C = circle: radius (z.A , math.sqrt(5)) +z.T = C.through +} +\begin{tikzpicture}[gridded] +\tkzGetNodes +\tkzDrawCircles(A,T) +\tkzDrawPoints(A,O,T) +\tkzLabelPoints[right](A,O,T) +\end{tikzpicture} +\end{Verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} + \directlua{% +init_elements () + z.O = point: new (0,0) + z.A = point: new (2,1) + C = circle: radius (z.A , math.sqrt(5)) + z.T = C.through + } + \begin{center} + \begin{tikzpicture}[gridded] + \tkzGetNodes + \tkzDrawCircles(A,T) + \tkzDrawPoints(A,O,T) + \tkzLabelPoints[right](A,O,T) + \end{tikzpicture} + \end{center} +\end{minipage} +% subsubsection method_imeth_circle_radius (end) + +\subsubsection{Method \Imeth{circle}{diameter}} % (fold) +\label{ssub:method_imeth_circle_diameter} +A circle is defined by two points at the ends of one of its diameters. + +\vspace{6pt} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} - z.P = point : new (0,0) - z.Q = point : new (5,0) - z.I = point : new (3,2) - C.QI = circle : new (z.Q,z.I) - C.PE = C.QI : orthogonal_from (z.P) - z.E = C.PE.through - C.QE = circle : new (z.Q,z.E) - _,z.F = intersection (C.PE,C.QE) - z.A = C.PE: point (1/9) - L.AE = line : new (z.A,z.E) - _,z.C = intersection (L.AE,C.QE) - L.AF = line : new (z.A,z.F) - L.CQ = line : new (z.C,z.Q) - z.D = intersection (L.AF,L.CQ) -\end{tkzelements} +\directlua{% +init_elements () +z.A = point: new (0,0) +z.B = point: new (2,1) +C = circle: diameter (z.A , z.B) +z.O = C.center +z.T = C.through +} +\begin{tikzpicture}[gridded] +\tkzGetNodes +\tkzDrawCircles(O,T) +\tkzDrawPoints(A,B,O,T) +\tkzLabelPoints[right](A,B,O,T) +\end{tikzpicture} +\end{Verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} +\directlua{% +init_elements () +z.A = point: new (0,0) +z.B = point: new (2,1) +C = circle: diameter (z.A , z.B) +z.O = C.center +z.T = C.through +} + \begin{center} +\begin{tikzpicture}[gridded] +\tkzGetNodes +\tkzDrawCircles(O,T) +\tkzDrawPoints(A,B,O,T) +\tkzLabelPoints[right](A,B,O,T) +\end{tikzpicture} + \end{center} +\end{minipage} +% subsubsection method_imeth_circle_diameter (end) + +\subsubsection{Method \Imeth{circle}{is\_tangent}} % (fold) +\label{ssub:method_imeth_circle_is__tangent} + +\begin{minipage}{.5\textwidth} +\begin{Verbatim} +\directlua{ + z.A = point: new (0,0) + z.B = point: new (0,2) + C.AB = circle: new (z.A,z.B) + z.C = point: new (2,-2) + z.D = point: new (2,3) + L.CD = line : new (z.C,z.D) + if C.AB : is_tangent (L.CD) + then tex.print("L.CD tangent to C.AB") + else + tex.print("L.CD no tangent to C.AB") + end +} \begin{tikzpicture} - \tkzGetNodes - \tkzDrawCircles(P,E Q,E) - \tkzDrawLines[add=0 and 1](P,Q) - \tkzDrawLines[add=0 and 2](A,E) - \tkzDrawSegments(P,E E,F F,C A,F C,D) - \tkzDrawPoints(P,Q,E,F,A,C,D) - \tkzLabelPoints(P,Q,E,F,A,C,D) -\end{tikzpicture} -\end{Verbatim} -\end{minipage} -\hspace*{\fill} -\begin{minipage}{.5\textwidth} - \begin{tkzelements} - scale =.5 - z.P = point : new (0,0) - z.Q = point : new (5,0) - z.I = point : new (3,2) - C.QI = circle : new (z.Q,z.I) - C.PE = C.QI : orthogonal_from (z.P) - z.E = C.PE.through - C.QE = circle : new (z.Q,z.E) - _,z.F = intersection (C.PE,C.QE) - z.A = C.PE: point (1/9) - L.AE = line : new (z.A,z.E) - _,z.C = intersection (L.AE,C.QE) - L.AF = line : new (z.A,z.F) - L.CQ = line : new (z.C,z.Q) - z.D = intersection (L.AF,L.CQ) - \end{tkzelements} - \begin{tikzpicture} - \tkzGetNodes - \tkzDrawCircles(P,E Q,E) - \tkzDrawLines[add=0 and 1](P,Q) - \tkzDrawLines[add=0 and 2](A,E) - \tkzDrawSegments(P,E E,F F,C A,F C,D) - \tkzDrawPoints(P,Q,E,F,A,C,D) - \tkzLabelPoints(P,Q,E,F,A,C,D) - \end{tikzpicture} +\tkzGetNodes +\tkzDrawCircle(A,B) +\tkzDrawLines(C,D) +\tkzDrawPoints(A,...,D) +\tkzLabelPoints[below left](A,C) +\tkzLabelPoints[above right](B,D) +\end{tikzpicture} +\end{Verbatim} \end{minipage} -%subsubsection altshiller (end) +\begin{minipage}{.5\textwidth} + \directlua{ + z.A = point: new (0,0) + z.B = point: new (0,2) + C.AB = circle: new (z.A,z.B) + z.C = point: new (2,-2) + z.D = point: new (2,3) + L.CD = line : new (z.C,z.D) + if C.AB : is_tangent (L.CD) then + tex.print("L.CD tangent to C.AB") + else + tex.print("L.CD no tangent to C.AB") + end + } + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircle(A,B) + \tkzDrawLines(C,D) + \tkzDrawPoints(A,...,D) + \tkzLabelPoints[below left](A,C) + \tkzLabelPoints[above right](B,D) + \end{tikzpicture} +\end{minipage} + -\subsubsection{Lemoine} % (fold) -\label{ssub:lemoine} +% subsubsection method_imeth_circle_is__tangent (end) +\subsubsection{Method \Imeth{circle}{antipode}} % (fold) +\label{ssub:method_imeth_circle_antipode} +This method is used to define a point that is diametrically opposed to a point on a given circle. +\vspace{6pt} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} - scale = 1.25 - z.A = point: new (1,0) - z.B = point: new (5,2) - z.C = point: new (1.2,2) - T = triangle: new(z.A,z.B,z.C) - z.O = T.circumcenter - C.OA = circle: new (z.O,z.A) - L.tA = C.OA: tangent_at (z.A) - L.tB = C.OA: tangent_at (z.B) - L.tC = C.OA: tangent_at (z.C) - z.P = intersection (L.tA,T.bc) - z.Q = intersection (L.tB,T.ca) - z.R = intersection (L.tC,T.ab) -\end{tkzelements} -\begin{tikzpicture} - \tkzGetNodes - \tkzDrawPolygon[teal](A,B,C) - \tkzDrawCircle(O,A) - \tkzDrawPoints(A,B,C,P,Q,R) - \tkzLabelPoints(A,B,C,P,Q,R) - \tkzDrawLine[blue](Q,R) - \tkzDrawLines[red](A,P B,Q R,C) - \tkzDrawSegments(A,R C,P C,Q) +\directlua{% +init_elements () +z.A = point: new (0,0) +z.O = point: new (2,1) +C = circle: new (z.O , z.A) +z.B = C : antipode (z.A) +} +\begin{tikzpicture}[gridded] +\tkzGetNodes +\tkzDrawCircles(O,A) +\tkzDrawPoints(A,B,O) +\tkzLabelPoints[right](A,B,O) \end{tikzpicture} \end{Verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} +\directlua{% +init_elements () +z.A = point: new (0,0) +z.O = point: new (2,1) +C = circle: new (z.O , z.A) +z.B = C : antipode (z.A) +} + \begin{center} +\begin{tikzpicture}[gridded] +\tkzGetNodes +\tkzDrawCircles(O,A) +\tkzDrawPoints(A,B,O) +\tkzLabelPoints[right](A,B,O) +\end{tikzpicture} + \end{center} +\end{minipage} + +% subsubsection method_imeth_circle_antipode (end) + +\subsubsection{Method \Imeth{circle}{midarc}} % (fold) +\label{ssub:method_imeth_circle_midarc} +The definition given in [ \href{https://mathworld.wolfram.com/Mid-ArcPoints.html}{Weisstein, Eric W. "Mid-Arc Points." From MathWorld--A Wolfram Web Resource.}] is as follows: +The mid-arc points of a triangle as defined by Johnson (1929) are the points on the circumcircle of the triangle which lie half-way along each of the three arcs determined by the vertices. These points arise in the definition of the Fuhrmann circle and Fuhrmann triangle, and lie on the extensions of the perpendicular bisectors of the triangle sides drawn from the circumcenter. + +The definition I use here is more general: the defined point is simply the point that divides an arc into two arcs of the same length. + +\vspace{6pt} +\begin{minipage}{.5\textwidth} +\begin{Verbatim} +\directlua{% +init_elements () +z.A = point: new (0,0) +z.O = point: new (2,1) +C = circle: new (z.O , z.A) +z.B = C : point (0.25) +z.M = C : midarc (z.A,z.B) +} +\begin{tikzpicture}[gridded] +\tkzGetNodes +\tkzDrawCircles(O,A) +\tkzDrawPoints(A,B,O,M) +\tkzLabelPoints[right](A,B,O,M) +\end{tikzpicture} +\end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} -scale = .75 -z.A = point: new (1,0) -z.B = point: new (5,2) -z.C = point: new (1.2,2) -T = triangle: new(z.A,z.B,z.C) -z.O = T.circumcenter -C.OA = circle: new (z.O,z.A) -L.tA = C.OA: tangent_at (z.A) -L.tB = C.OA: tangent_at (z.B) -L.tC = C.OA: tangent_at (z.C) -z.R = intersection (L.tC,T.ab) -z.P = intersection (L.tA,T.bc) -z.Q = intersection (L.tB,T.ca) -\end{tkzelements} -\hspace*{\fill} -\begin{tikzpicture}[rotate=90] -\tkzGetNodes -\tkzDrawPolygon[teal](A,B,C) +\directlua{% +init_elements () +z.A = point: new (0,0) +z.O = point: new (2,1) +C = circle: new (z.O , z.A) +z.B = C : point (0.25) +z.M = C : midarc (z.A,z.B) +} + \begin{center} +\begin{tikzpicture}[gridded] +\tkzGetNodes +\tkzDrawCircles(O,A) +\tkzDrawPoints(A,B,O,M) +\tkzLabelPoints[right](A,B,O,M) +\end{tikzpicture} + \end{center} +\end{minipage} + +% subsubsection method_imeth_circle_midarc (end) + +\subsubsection{Method \Imeth{circle}{point (r)}} % (fold) +\label{ssub:method_imeth_circle_point} + +Let $C$ be a circle with centre $O$ and passing through $A$ such that |z.A = C.through|. This method defines a point $M$ on the circle from A such that the ratio of the length of $\widearc{AM}$ to the circumference of the circle is equal to $r$. + +In the next example, $r=\dfrac{1}{6}$ corresponds to $\dfrac{\pi/3}{2\pi}$, so the angle $\widehat{AOE}$ has the measure $\pi/3$. + +If $r=.5$ the defined point is diametrically opposed to $A$, the angle $\widehat{AOD}$ has the measure $\pi$. + +\vspace{6pt} +\begin{minipage}{.5\textwidth} +\begin{Verbatim} + \directlua{% +init_elements () + z.O = point: new (0,0) + z.A = point: new (1,2) + C.OA = circle: new (z.O,z.A) + z.B = C.OA: point (1/6) + z.C = C.OA: point (0.25) + z.D = C.OA: point (0.5) +} +\begin{tikzpicture} +\tkzGetNodes \tkzDrawCircle(O,A) -\tkzDrawPoints(A,B,C,P,Q,R) -\tkzLabelPoints(A,B,C,P,Q,R) -\tkzDrawLine[blue](Q,R) -\tkzDrawLines[red](A,P B,Q R,C) -\tkzDrawSegments(A,R C,P C,Q) +\tkzDrawPoints(A,...,D,O) +\tkzLabelPoints(A,...,D,O) \end{tikzpicture} +\end{Verbatim} \end{minipage} -%\caption{Lemoine line} -% subsubsection lemoine (end) +\begin{minipage}{.5\textwidth} + \directlua{% +init_elements () + z.O = point: new (0,0) + z.A = point: new (1,2) + C.OA = circle: new (z.O,z.A) + z.B = C.OA: point (1/6) + z.C = C.OA: point (0.25) + z.D = C.OA: point (0.5) +} +\begin{center} +\begin{tikzpicture} +\tkzGetNodes +\tkzDrawCircle(O,A) +\tkzDrawPoints(A,...,D,O) +\tkzLabelPoints(A,...,D,O) +\end{tikzpicture} +\end{center} + +\end{minipage} + +% subsubsection method_imeth_circle_point (end) -\subsubsection{Inversion: point, line and circle} % (fold) +\subsubsection{Method \Imeth{circle}{inversion (obj)}: point, line and circle} % (fold) \label{ssub:inversion} The \code{inversion} method can be used on a point, a line or a circle. Depending on the type of object, the function determines the correct algorithm to use. -\subsubsection{Inversion: point} % (fold) -\label{ssub:inversion_point} +\paragraph{Inversion: point} % (fold) +\label{par:inversion_point} The \code{inversion} method can be used on a point, a group of points, a line or a circle. Depending on the type of object, the function determines the correct algorithm to use. \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.o = point: new (-1,2) z.a = point: new (2,1) C.oa = circle: new (z.o,z.a) z.c = point: new (3,4) z.d = C.oa: inversion (z.c) p = C.oa: power (z.c) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircle(o,a) @@ -299,7 +543,8 @@ The \code{inversion} method can be used on a point, a group of points, a line or \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () scale =.75 z.o = point: new (-1,2) z.a = point: new (2,1) @@ -307,36 +552,40 @@ The \code{inversion} method can be used on a point, a group of points, a line or z.c = point: new (3,4) z.d = C.oa: inversion (z.c) p = C.oa: power (z.c) -\end{tkzelements} -\hspace*{\fill} -\begin{tikzpicture} - \tkzGetNodes - \tkzDrawCircle(o,a) - \tkzDrawSegments(o,a o,c) - \tkzDrawPoints(a,o,c,d) - \tkzLabelPoints(a,o,c,d) - \tkzLabelSegment[sloped,above=1em](c,d){% - La puissance de c est \tkzUseLua{p}} - \end{tikzpicture} +} + +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircle(o,a) + \tkzDrawSegments(o,a o,c) + \tkzDrawPoints(a,o,c,d) + \tkzLabelPoints(a,o,c,d) + \tkzLabelSegment[sloped,above=1em](c,d){% + La puissance de c est \tkzUseLua{p}} + \end{tikzpicture} +\end{center} + \end{minipage} -\subsubsection{Inversion: line} % (fold) -\label{ssub:inversion_line} +\paragraph{Inversion: line} % (fold) +\label{par:inversion_line} The result is either a straight line or a circle. \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.o = point: new (-1,1) z.a = point: new (1,3) C.oa = circle: new (z.o,z.a) z.c = point: new (3,2) z.d = point: new (0,4) - L.cd = line: new (z.c,z.d) + L.cd = line: new (z.c,z.d) C.OH = C.oa: inversion (L.cd) z.O,z.H = get_points(C.OH) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles(o,a O,H) @@ -347,7 +596,8 @@ The result is either a straight line or a circle. \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.o = point: new (-1,1) z.a = point: new (1,3) C.oa = circle: new (z.o,z.a) @@ -356,26 +606,30 @@ The result is either a straight line or a circle. L.cd = line: new (z.c,z.d) C.OH = C.oa: inversion (L.cd) z.O,z.H = get_points(C.OH) -\end{tkzelements} -\hspace*{\fill} -\begin{tikzpicture} - \tkzGetNodes - \tkzDrawCircles(o,a) - \tkzDrawCircles[new](O,H) - \tkzDrawLines(c,d o,H) - \tkzDrawPoints(a,o,c,d,H) - \tkzLabelPoints(a,o,c,d,H) - \end{tikzpicture} +} + +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircles(o,a) + \tkzDrawCircles[new](O,H) + \tkzDrawLines(c,d o,H) + \tkzDrawPoints(a,o,c,d,H) + \tkzLabelPoints(a,o,c,d,H) + \end{tikzpicture} +\end{center} + \end{minipage} - \subsubsection{Inversion: circle} % (fold) - \label{ssub:inversion_circle} +\paragraph{Inversion: circle} % (fold) + \label{par:inversion_circle} The result is either a straight line or a circle. \begin{minipage}{.55\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .7 z.o,z.a = point: new (-1,3),point: new (2,3) z.c = point: new (-2,1) @@ -392,7 +646,7 @@ if obj.type == "line" then z.p,z.q = get_points(obj) else z.f,z.b = get_points(obj) end color = "orange" -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles[black](o,a) @@ -405,7 +659,8 @@ color = "orange" \end{Verbatim} \end{minipage} \begin{minipage}{.45\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () scale = .7 z.o,z.a = point: new (-1,3),point: new (2,3) z.c = point: new (-2,1) @@ -422,21 +677,755 @@ color = "orange" then z.p,z.q = get_points(obj) else z.f,z.b = get_points(obj) end color = "orange" - \end{tkzelements} - \hspace{\fill} + } + + \begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircles[black](o,a) + \tkzDrawCircles[teal](c,o e,d) + \tkzDrawCircles[\tkzUseLua{color}](f,b) + \tkzDrawLines[\tkzUseLua{color}](p,q) + \tkzDrawPoints(a,...,f,o,p,q) + \tkzLabelPoints(a,...,f,o,p,q) + \end{tikzpicture} + \end{center} +\end{minipage} + +% subsubsection inversion (end) + +\subsubsection{Method \Imeth{circle}{internal\_similitude}} % (fold) +\label{ssub:method_imeth_circle_internal__similitude} + +Circles are geometrically similar to one another and mirror symmetric. Hence, a pair of circles has both types of homothetic centers, internal and external, unless the centers are equal or the radii are equal; these exceptional cases are treated after general position. These two homothetic centers lie on the line joining the centers of the two given circles, which is called the line of centers. Circles with radius zero can also be included (see exceptional cases), and negative radius can also be used, switching external and internal. [Wikipedia] + +\begin{minipage}{.5\textwidth} +\begin{Verbatim} +\directlua{% +init_elements () + scale = 0.7 +z.A = point : new ( 0 , 0 ) +z.a = point : new ( 2 , 2 ) +z.B = point : new ( 5 , 2 ) +z.b = point : new ( 6 , 1 ) +C.Aa = circle : new (z.A,z.a) +C.Bb = circle : new (z.B,z.b) +z.I = C.Aa : internal_similitude (C.Bb) +L.TA1,L.TA2 = C.Aa : tangent_from (z.I) +z.A1 = L.TA1.pb +z.A2 = L.TA2.pb +} +\begin{tikzpicture} +\tkzGetNodes +\tkzDrawCircles(A,a B,b) +\tkzDrawPoints(A,a,B,b,I,A1,A2) +\tkzDrawLines[add = 1 and 2](A1,I A2,I) +\end{tikzpicture} +\end{Verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} +\directlua{% +init_elements () + scale = .7 +z.A = point : new ( 0 , 0 ) +z.a = point : new ( 2 , 2 ) +z.B = point : new ( 5 , 2 ) +z.b = point : new ( 6 , 1 ) +C.Aa = circle : new (z.A,z.a) +C.Bb = circle : new (z.B,z.b) +z.I = C.Aa : internal_similitude (C.Bb) +L.TA1,L.TA2 = C.Aa : tangent_from (z.I) +z.A1 = L.TA1.pb +z.A2 = L.TA2.pb +} +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircles(A,a B,b) + \tkzDrawPoints(A,a,B,b,I,A1,A2) + \tkzDrawLines[add = 1 and 2](A1,I A2,I) + \end{tikzpicture} +\end{center} +\end{minipage} + +% subsubsection method_imeth_circle_internal__similitude (end) + +\subsubsection{Method \Imeth{circle}{external\_similitude}} % (fold) +\label{ssub:method_imeth_circle_external__similitude} + +\begin{minipage}{.5\textwidth} +\begin{Verbatim} +\directlua{% +init_elements () +z.A = point : new ( 0 , 0 ) +z.a = point : new ( 2 , 2 ) +z.B = point : new ( 3 , 2 ) +z.b = point : new ( 3.5 , 1 ) +C.Aa = circle : new (z.A,z.a) +C.Bb = circle : new (z.B,z.b) +z.I = C.Aa : external_similitude (C.Bb) +L.TA1,L.TA2 = C.Aa : tangent_from (z.I) +z.A1 = L.TA1.pb +z.A2 = L.TA2.pb +} +\begin{tikzpicture} +\tkzGetNodes +\tkzDrawCircles(A,a B,b) +\tkzDrawPoints(A,a,B,b,I,A1,A2) +\tkzDrawLines[add = .25 and .1](A1,I A2,I) +\end{tikzpicture} +\end{Verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} +\directlua{% +init_elements () + scale = .75 +z.A = point : new ( 0 , 0 ) +z.a = point : new ( 2 , 2 ) +z.B = point : new ( 3 , 2 ) +z.b = point : new ( 3.5, 1 ) +C.Aa = circle : new (z.A,z.a) +C.Bb = circle : new (z.B,z.b) +z.I = C.Aa : external_similitude (C.Bb) +L.TA1,L.TA2 = C.Aa : tangent_from (z.I) +z.A1 = L.TA1.pb +z.A2 = L.TA2.pb +} +\begin{center} +\begin{tikzpicture} +\tkzGetNodes +\tkzDrawCircles(A,a B,b) +\tkzDrawPoints(A,a,B,b,I,A1,A2) +\tkzDrawLines[add = .25 and .1](A1,I A2,I) +\end{tikzpicture} +\end{center} +\end{minipage} +% subsubsection method_imeth_circle_external__similitude (end) + +\newpage +\subsubsection{Method \Imeth{circle}{radical\_center (C1,C2)}} % (fold) +\label{ssub:radical_center} + +The radical lines of three circles are concurrent in a point known as the radical center (also called the power center). This theorem was originally demonstrated by Monge (Dörrie 1965, p. 153). [\href{https://mathworld.wolfram.com/RadicalCenter.html}{Weisstein, Eric W. "Radical Center." From MathWorld--A Wolfram Web Resource. } +] + +Here I have also named \code{radical\_center} the point of intersection of the radical axis of two circles with the centre axis. See the following example for how to obtain point $H$. + + +\begin{minipage}[t]{.5\textwidth}\vspace{0pt}% +\begin{Verbatim} +\directlua{% +init_elements () + scale = .8 + z.O = point : new (0,0) + z.x = point : new (1,0) + z.y = point : new (4,0) + z.z = point : new (2,0) + z.Op = point : new (4,2) + z.P = point : new (2,2.5) + C.Ox = circle : new (z.O,z.x) + C.Pz = circle : new (z.P,z.z) + C.Opy = circle : new (z.Op,z.y) + z.ap,z.a = intersection (C.Ox,C.Pz) + z.bp,z.b = intersection (C.Opy,C.Pz) + L.aap = line : new (z.a,z.ap) + L.bbp = line : new (z.b,z.bp) + % z.X = intersection (L.aap,L.bbp) + z.X = C.Ox : radical_center(C.Pz,C.Opy) + % L.OOp = line : new (z.O,z.Op) + % z.H = L.OOp : projection (z.X) + z.H = C.Ox : radical_center(C.Opy) +} +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircles(O,a O',b P,z) + \tkzDrawLines[red](a,X b',X H,X O,O') + \tkzDrawPoints(O,O',P,a,a',b,b',X,H) + \tkzLabelPoints[below right](O,O',P,H) +\end{tikzpicture} +\end{Verbatim} +\end{minipage} +\begin{minipage}[t]{.5\textwidth}\vspace{0pt}% +\directlua{% +init_elements () +scale = .8 +z.O = point : new (0,0) +z.x = point : new (1,0) +z.y = point : new (4,0) +z.z = point : new (2,0) +z.Op = point : new (4,2) +z.P = point : new (2,2.5) +C.Ox = circle : new (z.O,z.x) +C.Pz = circle : new (z.P,z.z) +C.Opy = circle : new (z.Op,z.y) +z.ap,z.a = intersection (C.Ox,C.Pz) +z.bp,z.b = intersection (C.Opy,C.Pz) +L.aap = line : new (z.a,z.ap) +L.bbp = line : new (z.b,z.bp) +z.X = intersection (L.aap,L.bbp) +L.OOp = line : new (z.O,z.Op) +z.H = L.OOp : projection (z.X) +} + +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircles(O,a O',b P,z) + \tkzDrawLines[red](a,X b',X H,X O,O') + \tkzDrawPoints(O,O',P,a,a',b,b',X,H) + \tkzLabelPoints[below right](O,O',P,H) + \end{tikzpicture} +\end{center} + +\end{minipage} +% subsubsection radical_center (end) + +\newpage +\subsubsection{Method \Imeth{circle}{radical\_axis}(C)} % (fold) +\label{ssub:method_imeth_circle_radical__axis_c} + +The radical line, also called the radical axis, is the locus of points of equal circle power with respect to two nonconcentric circles. By the chordal theorem, it is perpendicular to the line of centers (Dörrie 1965). [\href{https://mathworld.wolfram.com/RadicalLine.html}{Weisstein, Eric W. "Radical Line." From MathWorld--A Wolfram Web Resource.} ] + +\vspace{6pt} +Radical axis v1 +\label{par:radical_axis_v1} + +\vspace{6pt} +\begin{minipage}{.5\textwidth} +\begin{Verbatim} +\directlua{% +init_elements () +scale = .75 +z.X = point: new (0,0) +z.B = point: new (2,2) +z.Y = point: new (7,1) +z.Ap = point: new (8,-1) +L.XY = line : new (z.X,z.Y) +C.XB = circle : new (z.X,z.B) +C.YAp = circle : new (z.Y,z.Ap) +z.E,z.F= get_points(C.XB:radical_axis(C.YAp)) +z.A = C.XB : point (0.4) +T.ABAp = triangle: new (z.A,z.B,z.Ap) +z.O = T.ABAp.circumcenter +C.OAp = circle : new (z.O,z.Ap) +_,z.Bp = intersection (C.OAp,C.YAp) +L.AB = line : new (z.A,z.B) +L.ApBp = line : new (z.Ap,z.Bp) +z.M = intersection (L.AB,L.ApBp) +z.H = L.XY : projection (z.M) +} +\end{Verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} +\begin{Verbatim} +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircles(X,B Y,A') + \tkzDrawArc[dashed,delta=30](O,A')(A) + \tkzDrawPoints(A,B,A',B',M,H,X,Y,O,E,F) + \tkzDrawLines[red](A,M A',M X,Y E,F) + \tkzDrawLines[red,add=1 and 3](M,H) +\end{tikzpicture} +\end{Verbatim} + + \directlua{% + init_elements () + scale = .4 + z.X = point : new (0,0) + z.B = point : new (2,2) + z.Y = point : new (7,1) + z.Ap = point : new (8,-1) + L.XY = line : new (z.X,z.Y) + C.XB = circle : new (z.X,z.B) + C.YAp = circle : new (z.Y,z.Ap) + z.E,z.F = get_points (C.XB : radical_axis (C.YAp)) + z.A = C.XB : point (0.4) + T.ABAp = triangle: new (z.A,z.B,z.Ap) + z.O = T.ABAp.circumcenter + C.OAp = circle : new (z.O,z.Ap) + _,z.Bp = intersection (C.OAp,C.YAp) + L.AB = line : new (z.A,z.B) + L.ApBp = line : new (z.Ap,z.Bp) + z.M = intersection (L.AB,L.ApBp) + z.H = L.XY : projection (z.M) + } + \begin{center} \begin{tikzpicture} - \tkzGetNodes - \tkzDrawCircles[black](o,a) - \tkzDrawCircles[teal](c,o e,d) - \tkzDrawCircles[\tkzUseLua{color}](f,b) - \tkzDrawLines[\tkzUseLua{color}](p,q) - \tkzDrawPoints(a,...,f,o,p,q) - \tkzLabelPoints(a,...,f,o,p,q) + \tkzGetNodes + \tkzDrawCircles(X,B Y,A') + \tkzDrawArc[dashed,delta=30](O,A')(A) + \tkzDrawPoints(A,B,A',B',M,H,X,Y,O,E,F) + \tkzDrawLines[red](A,M A',M X,Y E,F) + \tkzDrawLines[red,add=1 and 3](M,H) + \end{tikzpicture} + \end{center} +\end{minipage} + +\vspace{6pt} +Radical axis v2 +\label{par:radical_axis_v2} + +\vspace{6pt} +\begin{minipage}{.5\textwidth} +\begin{Verbatim} +\directlua{% +init_elements () +scale = .5 +z.O = point : new (-1,0) +z.Op = point : new (4,-1) +z.B = point : new (0,2) +z.D = point : new (4,0) +C.OB = circle : new (z.O,z.B) +C.OpD = circle : new (z.Op,z.D) +L.EF = C.OB : radical_axis (C.OpD) +z.E,z.F = get_points (L.EF) +z.M = L.EF : point (.75) +L.MT,L.MTp = C.OB : tangent_from (z.M) +_,z.T = get_points (L.MT) +_,z.Tp = get_points (L.MTp) +L.MK,L.MKp = C.OpD : tangent_from (z.M) +_,z.K = get_points (L.MK) +_,z.Kp = get_points (L.MKp) +} +\end{Verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} +\begin{Verbatim} +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircles(O,B O',D) + \tkzDrawLine(E,F) + \tkzDrawLine[add=.25 and .25](O,O') + \tkzDrawLines[add = 0 and .5](M,T M,T' + M,K M,K') + \tkzDrawCircle(M,T) + \tkzDrawPoints(O,O',T,M,T',K,K') + \tkzLabelPoints(O,O',T,T',K,K',M) +\end{tikzpicture} +\end{Verbatim} + + \directlua{% + init_elements () + scale =.5 + z.O = point : new (-1,0) + z.Op = point : new (4,-1) + z.B = point : new (0,2) + z.D = point : new (4,0) + C.OB = circle : new (z.O,z.B) + C.OpD = circle : new (z.Op,z.D) + L.EF = C.OB : radical_axis (C.OpD) + z.E,z.F = get_points (L.EF) + z.M = L.EF : point (.75) + L.MT,L.MTp = C.OB : tangent_from (z.M) + _,z.T = get_points (L.MT) + _,z.Tp = get_points (L.MTp) + L.MK,L.MKp = C.OpD : tangent_from (z.M) + _,z.K = get_points (L.MK) + _,z.Kp = get_points (L.MKp) + } +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircles(O,B O',D) + \tkzDrawLine(E,F) + \tkzDrawLine[add=.25 and .25](O,O') + \tkzDrawLines[add = 0 and .5](M,T M,T' M,K M,K') + \tkzDrawCircle(M,T) + \tkzDrawPoints(O,O',T,M,T',K,K') + \tkzLabelPoints(O,O',T,T',K,K',M) + \end{tikzpicture} +\end{center} +\end{minipage} + + + +Radical axis v3 +\label{par:radical_axis_v3} + +\begin{minipage}{.5\textwidth} +\begin{Verbatim} +\directlua{% +init_elements () +scale =.5 +z.O = point : new (0,0) +z.B = point : new (4,0) +z.Op = point : new (6,0) +C.OB = circle : new (z.O,z.B) +C.OpB = circle : new (z.Op,z.B) +L.EF = C.OB : radical_axis (C.OpB) +z.E,z.F = get_points(L.EF) +z.M = L.EF : point (0.2) +L = C.OB : tangent_from (z.M) +_,z.T = get_points (L) +L = C.OpB : tangent_from (z.M) +_,z.Tp = get_points (L) +} +\end{Verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} +\begin{Verbatim} +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircles(O,B O',B) + \tkzDrawSegments(M,T M,T') + \tkzDrawSegments(E,F) + \tkzDrawLine[add=.5 and .5](O,O') + \tkzDrawPoints(O,B,O',E,F,M,T,T') + \tkzLabelPoints(O,O',B,E,F,T,T') + \tkzDrawArc(M,T')(T) +\end{tikzpicture} +\end{Verbatim} +\directlua{% +init_elements () +scale =.5 +z.O = point : new (0,0) +z.B = point : new (4,0) +z.Op = point : new (6,0) +C.OB = circle : new (z.O,z.B) +C.OpB = circle : new (z.Op,z.B) +L.EF = C.OB : radical_axis (C.OpB) +z.E,z.F = get_points(L.EF) +z.M = L.EF : point (0.2) +L = C.OB : tangent_from (z.M) +_,z.T = get_points (L) +L = C.OpB : tangent_from (z.M) +_,z.Tp = get_points (L) +} +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircles(O,B O',B) + \tkzDrawSegments(M,T M,T') + \tkzDrawSegments(E,F) + \tkzDrawLine[add=.5 and .5](O,O') + \tkzDrawPoints(O,B,O',E,F,M,T,T') + \tkzLabelPoints(O,O',B,E,F,T,T') + \tkzDrawArc(M,T')(T) + \end{tikzpicture} +\end{center} +\end{minipage} +% paragraph radical_axis_v3 (end) + +Radical axis v4 +\label{par:radical_axis_v4} + +\begin{minipage}{.5\textwidth} +\begin{Verbatim} +\directlua{% +init_elements () +scale =.5 +z.O = point : new (0,0) +z.B = point : new (5,0) +z.Op = point : new (3,0) +C.OB = circle : new (z.O,z.B) +C.OpB = circle : new (z.Op,z.B) +L.EF = C.OB : radical_axis (C.OpB) +z.E,z.F = get_points(L.EF) +z.H = L.EF.mid +z.M = L.EF : point (.8) +_,L = C.OB : tangent_from (z.M) +_,z.T = get_points (L) +_,L = C.OpB : tangent_from (z.M) +_,z.Tp = get_points (L)} +\end{Verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} +\begin{Verbatim} +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircles(O,B O',B) + \tkzDrawSegments(M,T M,T') + \tkzDrawSegments(E,F) + \tkzDrawLine[add=.3 and .3](O,H) + \tkzDrawPoints(O,O',B,E,H,M) + \tkzLabelPoints[below right](O,O',E,F,M,T,T') + \tkzDrawArc(M,B)(T) +\end{tikzpicture} +\end{Verbatim} + +\directlua{% +init_elements () +scale =.5 + z.O = point : new (0,0) + z.B = point : new (5,0) + z.Op = point : new (3,0) + C.OB = circle : new (z.O,z.B) + C.OpB = circle : new (z.Op,z.B) + L.EF = C.OB : radical_axis (C.OpB) + z.E,z.F = get_points(L.EF) + z.H = L.EF.mid + z.M = L.EF : point (.8) + _,L = C.OB : tangent_from (z.M) + _,z.T = get_points (L) + _,L = C.OpB : tangent_from (z.M) + _,z.Tp = get_points (L) +} + +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircles(O,B O',B) + \tkzDrawSegments(M,T M,T') + \tkzDrawSegments(E,F) + \tkzDrawLine[add=.3 and .3](O,H) + \tkzDrawPoints(O,O',B,E,H,M) + \tkzLabelPoints[below right](O,O',E,F,M,T,T') + \tkzDrawArc(M,B)(T) + \end{tikzpicture} +\end{center} +\end{minipage} +% paragraph radical_axis_v4 (end) + +% subsubsection method_imeth_circle_radical__axis_c (end) + + +\subsubsection{Methods \Imeth{circle}{tangent\_at (P)} and \Imeth{circle}{tangent\_from (P)}} % (fold) +\label{ssub:method_imeth_circle_tangent} + +\begin{minipage}{.5\textwidth} +\begin{Verbatim} + \directlua{% +init_elements () + z.A = point: new (0,0) + z.B = point: new (1,2) + C.AB = circle: new (z.A,z.B) + z.C = point: new (3,-2) + L.T = C.AB : tangent_at (z.B) + z.D = L.T.pb + L.T1,L.T2 = C.AB : tangent_from (z.C) + z.T1 = L.T1.pb + z.T2 = L.T2.pb +} +\begin{tikzpicture} +\tkzGetNodes +\tkzDrawCircle(A,B) +\tkzDrawLines[add =.5 and .5](B,D C,T1 C,T2) +\tkzDrawSegments[dashed](A,B A,T1 A,T2) +\tkzDrawPoints(A,...,D,T1,T2) +\tkzLabelPoints[below left](A,T2,C) +\tkzLabelPoints[above right](B,T1,D) +\tkzMarkRightAngles(A,B,D A,T1,C A,T2,C) +\end{tikzpicture} +\end{Verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} + \directlua{% +init_elements () + z.A = point: new (0,0) + z.B = point: new (1,2) + C.AB = circle: new (z.A,z.B) + z.C = point: new (3,-2) + L.T = C.AB : tangent_at (z.B) + z.D = L.T.pb + L.T1,L.T2 = C.AB : tangent_from (z.C) + z.T1 = L.T1.pb + z.T2 = L.T2.pb +} +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircle(A,B) + \tkzDrawLines[add =.5 and .5](B,D C,T1 C,T2) + \tkzDrawSegments[dashed](A,B A,T1 A,T2) + \tkzDrawPoints(A,...,D,T1,T2) + \tkzLabelPoints[below left](A,T2,C) + \tkzLabelPoints[above right](B,T1,D) + \tkzMarkRightAngles(A,B,D A,T1,C A,T2,C) + \end{tikzpicture} +\end{center} + +\end{minipage} +% subsubsection (end) + +\subsubsection{Common tangent: Angle of two intersecting circles} % (fold) +\label{ssub:common_tangent} + +Let be a tangent common to both circles at $T$ and $T'$ (closest to $C$). Let a secant parallel to this tangent pass through $C$. Then the segment $[TT']$ is seen from the other common point $D$ at an angle equal to half the angle of the two circles. + +\begin{Verbatim} +\directlua{% +init_elements () + z.A = point : new ( 0 , 0 ) + z.B = point : new ( 5 , 2 ) + L.AB = line : new ( z.A , z.B ) + z.C = point : new ( 1 , 2 ) + C.AC = circle : new (z.A,z.C) + C.BC = circle : new (z.B,z.C) + z.T,z.Tp = C.AC : common_tangent (C.BC) + L.TTp = line : new (z.T,z.Tp) + z.M = C.AC : point (0.45) + L.MC =line : new (z.M,z.C) + z.Mp = intersection (L.MC, C.BC) + L.mm = L.TTp : ll_from (z.C) + _,z.M = intersection (L.mm, C.AC) + z.Mp = intersection (L.mm, C.BC) + _,z.D = intersection (C.AC,C.BC) +} +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircles(A,C B,C) + \tkzDrawSegments(M,M' A,D B,D A,B C,D T,C T',C) + \tkzDrawSegments[gray](D,M D,M' T,T' D,T D,T') + \tkzDrawPoints(A,B,C,D,M,M',T,T') + \tkzLabelPoints(A,B,D,M) + \tkzLabelPoints[above](C,M',T,T') + \tkzMarkAngles[mark=|,size=.75](T,C,M C,T,T' C,D,T T,D,M) + \tkzMarkAngles[mark=||,size=.75](M',C,T' T,T',C T',D,C M',D,T') +\end{tikzpicture} +\end{Verbatim} + + +\directlua{% +init_elements () +z.A = point : new ( 0 , 0 ) +z.B = point : new ( 5 , 2 ) +L.AB = line : new ( z.A , z.B ) +z.C = point : new ( 1 , 2 ) +C.AC = circle : new (z.A,z.C) +C.BC = circle : new (z.B,z.C) +z.T,z.Tp = C.AC : common_tangent (C.BC) +L.TTp = line : new (z.T,z.Tp) +z.M = C.AC : point (0.45) +L.MC =line : new (z.M,z.C) +z.Mp = intersection (L.MC, C.BC) +L.mm = L.TTp : ll_from (z.C) +_,z.M = intersection (L.mm, C.AC) +z.Mp = intersection (L.mm, C.BC) +_,z.D = intersection (C.AC,C.BC) +} + +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircles(A,C B,C) + \tkzDrawSegments(M,M' A,D B,D A,B C,D T,C T',C) + \tkzDrawSegments[gray](D,M D,M' T,T' D,T D,T') + \tkzDrawPoints(A,B,C,D,M,M',T,T') + \tkzLabelPoints(A,B,D,M) + \tkzLabelPoints[above](C,M',T,T') + \tkzMarkAngles[mark=|,size=.75](T,C,M C,T,T' C,D,T T,D,M) + \tkzMarkAngles[mark=||,size=.75](M',C,T' T,T',C T',D,C M',D,T') + \end{tikzpicture} +\end{center} +% subsubsection common_tangent (end) + +\subsubsection{Method \Imeth{circle}{orthogonal\_from (pt)}} % (fold) +\label{ssub:method_imeth_circle_orthogonal_from_pt} + +In geometry, two circles are said to be orthogonal if their respective tangent lines at the points of intersection are perpendicular (meet at a right angle). [wikipedia] + +This method determines a circle with a given centre, orthogonal to a circle that is also given. + +\vspace{6pt} +\begin{minipage}{.5\textwidth} + \begin{Verbatim} + \directlua{% + init_elements () + scale = .6 + z.C_1 = point: new (0,0) + z.C_2 = point: new (8,0) + z.A = point: new (5,0) + C = circle: new (z.C_1,z.A) + z.S,z.T = get_points (C: orthogonal_from (z.C_2)) + } + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircles(C_1,T C_2,T) + \tkzDrawSegments(C_1,T C_2,T) + \tkzDrawLine(C_1,C_2) + \tkzMarkRightAngle[fill=teal,% + opacity=.2,size=1](C_1,T,C_2) + \tkzDrawPoints(C_1,C_2,T) + \tkzLabelPoints(C_1,C_2) + \tkzLabelPoints[above](T) + \tkzLabelSegment[left](C_1,T){r} + \tkzLabelSegments[right](C_2,T){$\gamma$} + \tkzLabelSegment[below](C_1,C_2){d} + \tkzLabelCircle[left=10pt](C_1,T)(180){Circle 1} + \tkzLabelCircle[right=10pt](C_2,T)(180){Circle 2} + \end{tikzpicture} + \end{Verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} + \directlua{% + init_elements () + scale = .25 + z.C_1 = point: new (0,0) + z.C_2 = point: new (8,0) + z.A = point: new (5,0) + C = circle: new (z.C_1,z.A) + z.S,z.T = get_points (C: orthogonal_from (z.C_2)) + } + \begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircles(C_1,T C_2,T) + \tkzDrawSegments(C_1,T C_2,T) + \tkzDrawLine(C_1,C_2) + \tkzMarkRightAngle[fill=teal,opacity=.2,size=.5](C_1,T,C_2) + \tkzDrawPoints(C_1,C_2,T) + \tkzLabelPoints(C_1,C_2) + \tkzLabelPoints[above](T) + \tkzLabelSegment[left](C_1,T){r} + \tkzLabelSegments[right](C_2,T){$\gamma$} + \tkzLabelSegment[below](C_1,C_2){d} + \tkzLabelCircle[left=10pt](C_1,T)(180){Circle 1} + \tkzLabelCircle[right=10pt](C_2,T)(180){Circle 2} \end{tikzpicture} + \end{center} \end{minipage} -% subsubsection inversion (end) -\subsubsection{midcircle} % (fold) + +% subsubsection method_imeth_circle_orthogonal__from_pt (end) + +\subsubsection{Method \Imeth{circle}{orthogonal\_through}} % (fold) +\label{ssub:method_imeth_circle_orthogonal_through} + +\begin{minipage}{.5\textwidth} +\begin{Verbatim} +\directlua{% +init_elements () + z.O = point: new (0,1) + z.A = point: new (1,0) + z.z1 = point: new (-1.5,-1.5) + z.z2 = point: new (2.5,-1.25) + C.OA = circle: new (z.O,z.A) + C = C.OA: orthogonal_through (z.z1,z.z2) + z.c = C.center +} +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircle(O,A) + \tkzDrawCircle[new](c,z1) + \tkzDrawPoints[new](O,A,z1,z2,c) + \tkzLabelPoints[right](O,A,z1,z2,c) +\end{tikzpicture} +\end{Verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth}\directlua{% +init_elements () + z.O = point: new (0,1) + z.A = point: new (1,0) + z.z1 = point: new (-1.5,-1.5) + z.z2 = point: new (2.5,-1.25) + C.OA = circle: new (z.O,z.A) + C = C.OA: orthogonal_through (z.z1,z.z2) + z.c = C.center +} + +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircle(O,A) + \tkzDrawCircle[orange](c,z1) + \tkzDrawPoints[orange](O,A,z1,z2,c) + \tkzLabelPoints[right](O,A,z1,z2,c) + \end{tikzpicture} +\end{center} +\end{minipage} +% subsubsection method_imeth_circle_orthogonal__through (end) + +\subsubsection{Method \Imeth{circle}{mmidcircle}} % (fold) \label{ssub:midcircle} \begin{minipage}{0.95\linewidth } @@ -460,7 +1449,8 @@ We can obtain the centers of similarity of these two circles by constructing $EH \begin{minipage}{.4\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .8 z.A = point : new ( 1 , 0 ) z.B = point : new ( 3 , 0 ) @@ -473,14 +1463,15 @@ z.H = C.AO.north z.F = C.BP.north z.G = C.BP.south C.IT,C.JV = C.AO : midcircle (C.BP) -z.I,z.T = get_points ( C.IT ) -z.J,z.V = get_points ( C.JV ) +z.I,z.T = get_points (C.IT) +z.J,z.V = get_points (C.JV) z.X,z.Y = intersection (C.AO,C.BP) -\end{tkzelements} +} \end{Verbatim} \end{minipage} \begin{minipage}{.6\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () scale = .8 z.A = point : new ( 1 , 0 ) z.B = point : new ( 3 , 0 ) @@ -493,10 +1484,10 @@ z.X,z.Y = intersection (C.AO,C.BP) z.F = C.BP.north z.G = C.BP.south C.IT,C.JV = C.AO : midcircle (C.BP) - z.I,z.T = get_points ( C.IT ) - z.J,z.V = get_points ( C.JV ) + z.I,z.T = get_points (C.IT) + z.J,z.V = get_points (C.JV) z.X,z.Y = intersection (C.AO,C.BP) - \end{tkzelements} + } \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles[teal,thick](A,O B,P) @@ -520,10 +1511,11 @@ z.X,z.Y = intersection (C.AO,C.BP) \vfill \item One given circle is in the interior of the other given circle. - +\label{midcircle_diameter} \begin{minipage}{.6\textwidth} \begin{Verbatim} - \begin{tkzelements} + \directlua{% +init_elements () scale =.75 z.A = point : new ( 3 , 0 ) z.B = point : new ( 5 , 0 ) @@ -539,12 +1531,13 @@ z.X,z.Y = intersection (C.AO,C.BP) z.x = C.SV.center z.y = C.UR.center C.IT = C.AO : midcircle (C.BP) - z.I,z.T = get_points ( C.IT ) -\end{tkzelements} + z.I,z.T = get_points (C.IT) +} \end{Verbatim} \end{minipage} \begin{minipage}{.6\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () scale =.75 z.A = point : new ( 3 , 0 ) z.B = point : new ( 5 , 0 ) @@ -560,8 +1553,8 @@ z.X,z.Y = intersection (C.AO,C.BP) z.x = C.SV.center z.y = C.UR.center C.IT = C.AO : midcircle (C.BP) - z.I,z.T = get_points ( C.IT ) - \end{tkzelements} + z.I,z.T = get_points (C.IT) + } \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles[teal,thick](A,O B,P) @@ -583,7 +1576,8 @@ $I$ is the center of external similarity of the two given circles. To obtain the \begin{minipage}{.4\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale=.75 local a,b,c,d z.A = point : new ( 0 , 0 ) @@ -597,16 +1591,17 @@ z.E = C.Aa.north z.F = C.Bb.north L.EF = line : new (z.E,z.F) C.IT = C.Aa : midcircle (C.Bb) -z.I,z.T = get_points ( C.IT ) +z.I,z.T = get_points (C.IT) L.TF = C.Bb : tangent_from (z.I) z.H = intersection (L.TF,C.IT) z.E = intersection (L.TF,C.Aa) z.F=L.TF.pb -\end{tkzelements} +} \end{Verbatim} \end{minipage} \begin{minipage}{.6\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () scale=.75 local a,b,c,d z.A = point : new ( 0 , 0 ) @@ -620,12 +1615,12 @@ z.E = C.Aa.north z.F = C.Bb.north L.EF = line : new (z.E,z.F) C.IT = C.Aa : midcircle (C.Bb) -z.I,z.T = get_points ( C.IT ) +z.I,z.T = get_points (C.IT) L.TF = C.Bb : tangent_from (z.I) z.H = intersection (L.TF,C.IT) z.E = intersection (L.TF,C.Aa) z.F=L.TF.pb -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles[teal,thick](A,a B,b) @@ -648,7 +1643,8 @@ z.F=L.TF.pb \begin{minipage}{.4\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale=.75 local a,b,c,d z.A = point : new ( 0 , 0 ) @@ -662,16 +1658,17 @@ z.E = C.Aa.north z.F = C.Bb.north L.EF = line : new (z.E,z.F) C.IT = C.Aa : midcircle (C.Bb) -z.I,z.T = get_points ( C.IT ) +z.I,z.T = get_points(C.IT) L.TF = C.Bb : tangent_from (z.I) z.H = intersection (L.TF,C.IT) z.E = intersection (L.TF,C.Aa) z.F=L.TF.pb -\end{tkzelements} +} \end{Verbatim} \end{minipage} \begin{minipage}{.6\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () scale=.75 local a,b,c,d z.A = point : new ( 0 , 0 ) @@ -685,12 +1682,12 @@ z.E = C.Aa.north z.F = C.Bb.north L.EF = line : new (z.E,z.F) C.IT = C.Aa : midcircle (C.Bb) -z.I,z.T = get_points ( C.IT ) +z.I,z.T = get_points (C.IT) L.TF = C.Bb : tangent_from (z.I) z.H = intersection (L.TF,C.IT) z.E = intersection (L.TF,C.Aa) z.F=L.TF.pb -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles[teal,thick](A,a B,b) @@ -710,20 +1707,22 @@ z.F=L.TF.pb \begin{minipage}{.4\textwidth} \begin{Verbatim} -\begin{tkzelements} -z.A = point : new ( 2 , 0 ) -z.B = point : new ( 4 , 0 ) -z.a = point : new ( 1 , 0) -z.b = point : new ( 1 , 0) -C.Aa = circle : new (z.A,z.a) -C.Bb = circle : new (z.B,z.b) -C.IT = C.Aa : midcircle (C.Bb) -z.I,z.T = get_points ( C.IT ) -\end{tkzelements} +\directlua{% +init_elements () +z.A = point : new ( 2 , 0 ) +z.B = point : new ( 4 , 0 ) +z.a = point : new ( 1 , 0) +z.b = point : new ( 1 , 0) +C.Aa = circle : new (z.A,z.a) +C.Bb = circle : new (z.B,z.b) +C.IT = C.Aa : midcircle (C.Bb) +z.I,z.T = get_points(C.IT) +} \end{Verbatim} \end{minipage} \begin{minipage}{.6\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 2 , 0 ) z.B = point : new ( 4 , 0 ) z.a = point : new ( 1 , 0) @@ -731,8 +1730,8 @@ z.b = point : new ( 1 , 0) C.Aa = circle : new (z.A,z.a) C.Bb = circle : new (z.B,z.b) C.IT = C.Aa : midcircle (C.Bb) -z.I,z.T = get_points ( C.IT ) -\end{tkzelements} +z.I,z.T = get_points (C.IT) +} \begin{tikzpicture} \tkzGetNodes @@ -748,10 +1747,271 @@ z.I,z.T = get_points ( C.IT ) \end{enumerate} % subsubsection midcircle (end) -% subsection methods_of_the_class_circle (end) -\subsection{Circles\_position} % (fold) -\label{sub:circles_position} + +\subsubsection{Radical circle} % (fold) +\label{ssub:radical_circle} + +\begin{minipage}[t]{.5\textwidth}\vspace{0pt}% +\begin{Verbatim} +\directlua{% +init_elements () + scale = .5 + z.A = point: new (0,0) + z.B = point: new (6,0) + z.C = point: new (0.8,4) + T.ABC = triangle : new ( z.A,z.B,z.C ) + C.exa = T.ABC : ex_circle () + z.I_a,z.Xa = get_points (C.exa) + C.exb = T.ABC : ex_circle (1) + z.I_b,z.Xb = get_points (C.exb) + C.exc = T.ABC : ex_circle (2) + z.I_c,z.Xc = get_points (C.exc) + C.ortho = C.exa : radical_circle (C.exb,C.exc) + z.w,z.a = get_points (C.ortho) +} +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygon(A,B,C) + \tkzDrawCircles(I_a,Xa I_b,Xb I_c,Xc) + \tkzDrawCircles[red,thick](w,a) + \tkzDrawPoints(A,B,C) + \tkzLabelPoints(A,B,C) +\end{tikzpicture} +\end{Verbatim} +\end{minipage} + +\directlua{% +init_elements () + scale = .5 + z.A = point: new (0,0) + z.B = point: new (6,0) + z.C = point: new (0.8,4) + T.ABC = triangle : new ( z.A,z.B,z.C ) + C.exa = T.ABC : ex_circle () + z.I_a,z.Xa = get_points (C.exa) + C.exb = T.ABC : ex_circle (1) + z.I_b,z.Xb = get_points (C.exb) + C.exc = T.ABC : ex_circle (2) + z.I_c,z.Xc = get_points (C.exc) + C.ortho = C.exa : radical_circle (C.exb,C.exc) + z.w,z.a = get_points (C.ortho) +} + +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygon(A,B,C) + \tkzDrawCircles(I_a,Xa I_b,Xb I_c,Xc) + \tkzDrawCircles[red,thick](w,a) + \tkzDrawPoints(A,B,C) + \tkzLabelPoints(A,B,C) + \end{tikzpicture} +\end{center} +% subsubsection radical_circle (end) + +\subsubsection{Method \Imeth{circle}{power(C)} Power v1} % (fold) +\label{ssub:power_v1} + + +\begin{minipage}[t]{.45\textwidth}\vspace{0pt}% +\begin{Verbatim} +\directlua{% +init_elements () + z.O = point : new (0,0) + z.A = point : new (2,-2) + z.M = point : new (-6,0) + L.AM = line : new (z.A,z.M) + C.OA = circle : new (z.O,z.A) + z.Ap = C.OA : antipode (z.A) + z.B = intersection (L.AM, C.OA) +} +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircle(O,A) + \tkzMarkRightAngle[fill=gray!10](A',B,M) + \tkzDrawSegments(M,O A,A' A',B) + \tkzDrawPoints(O,A,A',M,B) + \tkzLabelPoints(O,A,A',M,B) + \tkzDrawSegments[-Triangle](M,A M,A') +\end{tikzpicture} +\end{Verbatim} +\end{minipage} +\begin{minipage}[t]{.55\textwidth}\vspace{0pt}% +\directlua{% +init_elements () +scale = .75 +z.O = point : new (0,0) +z.A = point : new (2,-2) +z.M = point : new (-6,0) +L.AM = line : new (z.A,z.M) +C.OA = circle : new (z.O,z.A) +z.Ap = C.OA : antipode (z.A) +z.B = intersection (L.AM, C.OA) +} +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircle(O,A) + \tkzMarkRightAngle[fill=gray!10](A',B,M) + \tkzDrawSegments(M,O A,A' A',B) + \tkzDrawPoints(O,A,A',M,B) + \tkzLabelPoints(O,A,A',M,B) + \tkzDrawSegments[-Triangle](M,A M,A') + \end{tikzpicture} +\end{minipage} +% subsubsection power_v1 (end) + +\subsubsection{Method \Imeth{circle}{power(C)} Power v2} % (fold) +\label{ssub:power_v2} +\vspace{6pt} + + +\begin{minipage}[t]{.5\textwidth}\vspace{0pt}% +\begin{Verbatim} +\directlua{% +init_elements () + z.O = point : new (0,0) + z.A = point : new (2,2) + z.M = point : new (-1.5,0) + L.AM = line : new (z.A,z.M) + C.OA = circle : new (z.O,z.A) + z.Ap = C.OA : antipode (z.A) + _,z.B = intersection (L.AM, C.OA) + z.m = z.M : north(1) + L.mM = line : new (z.m,z.M) + z.U,z.V = intersection (L.mM,C.OA) +} +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircle(O,A) + \tkzMarkRightAngle[fill=gray!10](A',B,M) + \tkzDrawSegments(M,O A,A' A',B A,B U,V) + \tkzDrawPoints(O,A,A',M,B,U,V,m) + \tkzLabelPoints(O,A,M,U,V,m) + \tkzLabelPoints[below left](A',B) + \tkzDrawSegments(M,A M,A') +\end{tikzpicture} +\end{Verbatim} +\end{minipage} +\begin{minipage}[t]{.5\textwidth}\vspace{0pt}% +\directlua{% +init_elements () +scale = .8 +z.O = point : new (0,0) +z.A = point : new (2,2) +z.M = point : new (-1.5,0) +L.AM = line : new (z.A,z.M) +C.OA = circle : new (z.O,z.A) +z.Ap = C.OA : antipode (z.A) +_,z.B = intersection (L.AM, C.OA) +z.m = z.M : north(1) +L.mM = line : new (z.m,z.M) +z.U,z.V = intersection (L.mM,C.OA) +} + +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircle(O,A) + \tkzMarkRightAngle[fill=gray!10](A',B,M) + \tkzDrawSegments(M,O A,A' A',B A,B U,V) + \tkzDrawPoints(O,A,A',M,B,U,V,m) + \tkzLabelPoints(O,A,M,U,V,m) + \tkzLabelPoints[below left](A',B) + \tkzDrawSegments(M,A M,A') + \end{tikzpicture} +\end{center} + +\end{minipage} +% subsubsection power_v2 (end) + +% subsubsection method_imeth_circle_power_c (end) + +\subsubsection{Method \Imeth{circle}{in\_out} for circle and disk} % (fold) +\label{ssub:in_out_for_circle_and_disk} + +\begin{minipage}{.5\textwidth} + \begin{Verbatim} + \directlua{% +init_elements () + z.O = point : new (0,0) + z.A = point : new (1,2) + C.OA = circle : new (z.O,z.A) + z.N = point : new (-2,2) + z.M = point : new (1,0) + z.P = point : new (2,1) + BCm = C.OA : in_out (z.M) + BDm = C.OA : in_out_disk (z.M) + BCn = C.OA : in_out (z.N) + BDn = C.OA : in_out_disk (z.N) + BCp = C.OA : in_out (z.P) + BDp = C.OA : in_out_disk (z.P) + } +\end{Verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth}\directlua{% +init_elements () +z.O = point : new (0,0) +z.A = point : new (1,2) +C.OA = circle : new (z.O,z.A) +z.N = point : new (-2,2) +z.M = point : new (1,0) +z.P = point : new (2,1) +BCm = C.OA : in_out (z.M) +BDm = C.OA : in_out_disk (z.M) +BCn = C.OA : in_out (z.N) +BDn = C.OA : in_out_disk (z.N) +BCp = C.OA : in_out (z.P) +BDp = C.OA : in_out_disk (z.P) +} +\def\tkzPosPoint#1#2#3#4{% +\tkzLabelPoints(O,M,N,P) + \ifthenelse{\equal{\tkzUseLua{#1}}{true}}{ + \tkzLabelPoint[below=#4pt,font=\scriptsize](#2){on the #3}}{% + \tkzLabelPoint[below=#4pt,font=\scriptsize](#2){out the #3}} +} +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawSegments[dashed](O,M O,N O,P) + \tkzDrawCircle(O,A) + \tkzDrawPoints(O,M,N,P) + \tkzPosPoint{BCm}{M}{circle}{8} + \tkzPosPoint{BCn}{N}{circle}{8} + \tkzPosPoint{BCp}{P}{circle}{8} + \tkzPosPoint{BDm}{M}{disk}{14} + \tkzPosPoint{BDn}{N}{disk}{14} + \tkzPosPoint{BDp}{P}{disk}{14} + \end{tikzpicture} +\end{center} +\end{minipage} + +\begin{minipage}{.5\textwidth} + \begin{Verbatim} + \def\tkzPosPoint#1#2#3#4{% + \tkzLabelPoints(O,M,N,P) + \ifthenelse{\equal{\tkzUseLua{#1}}{true}}{ + \tkzLabelPoint[below=#4pt,font=\scriptsize](#2){on the #3}}{% + \tkzLabelPoint[below=#4pt,font=\scriptsize](#2){out the #3}}} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawSegments[dashed](O,M O,N O,P) + \tkzDrawCircle(O,A) + \tkzDrawPoints(O,M,N,P) + \tkzPosPoint{BCm}{M}{circle}{8} + \tkzPosPoint{BCn}{N}{circle}{8} + \tkzPosPoint{BCp}{P}{circle}{8} + \tkzPosPoint{BDm}{M}{disk}{14} + \tkzPosPoint{BDn}{N}{disk}{14} + \tkzPosPoint{BDp}{P}{disk}{14} + \end{tikzpicture} + \end{Verbatim} +\end{minipage} + +% subsubsection in_out_for_circle_and_disk (end) + +\subsubsection{Method \Imeth{circle}{circles\_position}} % (fold) +\label{ssub:circles_position} This function returns a string indicating the position of the circle in relation to another. Useful for creating a function. Cases are: @@ -765,7 +2025,8 @@ This function returns a string indicating the position of the circle in relation \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 0 , 0 ) z.a = point : new ( 3 , 0 ) z.B = point : new ( 2 , 0 ) @@ -776,8 +2037,7 @@ This function returns a string indicating the position of the circle in relation if position == "inside tangent" then color = "orange" else color = "blue" end -\end{tkzelements} - +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircle(A,a) @@ -786,7 +2046,8 @@ This function returns a string indicating the position of the circle in relation \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 1 , 0 ) z.a = point : new ( 3 , 0 ) z.B = point : new ( 2 , 0 ) @@ -795,7 +2056,7 @@ C.Aa = circle: new (z.A,z.a) C.Bb = circle: new (z.B,z.b) position = C.Aa : circles_position (C.Bb) if position == "inside tangent" then color = "orange" else color = "blue" end -\end{tkzelements} +} \hspace{\fill} \begin{tikzpicture} \tkzGetNodes @@ -803,215 +2064,571 @@ if position == "inside tangent" then color = "orange" else color = "blue" end \tkzDrawCircle[color=\tkzUseLua{color}](B,b) \end{tikzpicture}\hspace{\fill} \end{minipage} -% subsection circles__position (end) +% subsubsection circles__position (end) -\subsection{Common tangent: Angle of two intersecting circles} % (fold) -\label{sub:common_tangent} -Let be a tangent common to both circles at $T$ and $T'$ (closest to $C$). Let a secant parallel to this tangent pass through $C$. Then the segment $[TT']$ is seen from the other common point $D$ at an angle equal to half the angle of the two circles. +\subsubsection{Method \Imeth{circle}{c\_c\_pp}} % (fold) +\label{ssub:method_c__c__pp} + +Find a circle tangent to a circle and passing through two given points. If one of the points is on the inside and the other on the outside, then there's no solution. +\begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} - z.A = point : new ( 0 , 0 ) - z.B = point : new ( 5 , 2 ) - L.AB = line : new ( z.A , z.B ) - z.C = point : new ( 1 , 2 ) - C.AC = circle : new (z.A,z.C) - C.BC = circle : new (z.B,z.C) - z.T,z.Tp = C.AC : common_tangent (C.BC) - L.TTp = line : new (z.T,z.Tp) - z.M = C.AC : point (0.45) - L.MC =line : new (z.M,z.C) - z.Mp = intersection (L.MC, C.BC) - L.mm = L.TTp : ll_from (z.C) - _,z.M = intersection (L.mm, C.AC) - z.Mp = intersection (L.mm, C.BC) - _,z.D = intersection (C.AC,C.BC) -\end{tkzelements} +\directlua{ + init_elements () + scale =.75 + z.A = point: new (5,4) + z.B = point: new (3,0) + z.O = point: new (0,0) + z.C = point: new (1,0) + L.AB = line: new ( z.A,z.B ) + C.OC = circle: new (z.O,z.C) + C1,C2 = C.OC: c_c_pp (z.A,z.B) + z.O1 = C1.center + z.T1 = C1.through + z.O2 = C2.center + z.T2 = C2.through +} \begin{tikzpicture} - \tkzGetNodes - \tkzDrawCircles(A,C B,C) - \tkzDrawSegments(M,M' A,D B,D A,B C,D T,C T',C) - \tkzDrawSegments[gray](D,M D,M' T,T' D,T D,T') - \tkzDrawPoints(A,B,C,D,M,M',T,T') - \tkzLabelPoints(A,B,D,M) - \tkzLabelPoints[above](C,M',T,T') - \tkzMarkAngles[mark=|,size=.75](T,C,M C,T,T' C,D,T T,D,M) - \tkzMarkAngles[mark=||,size=.75](M',C,T' T,T',C T',D,C M',D,T') +\tkzGetNodes +\tkzDrawLines[red](A,B) +\tkzDrawCircle[red](O,C) +\tkzDrawPoints(A,B,C,O) + \tkzDrawCircles[cyan](O1,T1 O2,T2) + \tkzDrawPoints(O1,O2,T1,T2) + \tkzLabelPoints(O1,O2,T1,T2,A,B) + \tkzLabelPoints(O,C,A,B) \end{tikzpicture} \end{Verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} +\directlua{ + init_elements () + scale =.75 + z.A = point: new (5,4) + z.B = point: new (3,0) + z.O = point: new (0,0) + z.C = point: new (1,0) + L.AB = line: new ( z.A,z.B ) + C.OC = circle: new (z.O,z.C) + C1,C2 = C.OC: c_c_pp (z.A,z.B) + z.O1 = C1.center + z.T1 = C1.through + z.O2 = C2.center + z.T2 = C2.through +} +\begin{tikzpicture} +\tkzGetNodes +\tkzDrawLines[red](A,B) +\tkzDrawCircle[red](O,C) +\tkzDrawPoints(A,B,C,O) + \tkzDrawCircles[cyan](O1,T1 O2,T2) + \tkzDrawPoints(O1,O2,T1,T2) + \tkzLabelPoints(O1,O2,T1,T2,A,B) + \tkzLabelPoints(O,C,A,B) +\end{tikzpicture} +\end{minipage} +\begin{minipage}{.5\textwidth} +\begin{Verbatim} +\directlua{ + init_elements () + z.A = point: new (3,0) + z.B = point: new (0,-3) + z.O = point: new (0,0) + z.C = point: new (1,0) + L.AB = line: new ( z.A,z.B ) + C.OC = circle: new (z.O,z.C) + C1,C2 = C.OC: c_c_pp (z.A,z.B) + z.O1 = C1.center + z.T1 = C1.through + z.O2 = C2.center + z.T2 = C2.through +} +\begin{tikzpicture} +\tkzGetNodes +\tkzDrawLines[red](A,B) +\tkzDrawCircle[red](O,C) +\tkzDrawPoints(A,B,C,O) + \tkzDrawCircles[cyan](O1,T1 O2,T2) + \tkzDrawPoints(T1,T2) + \tkzLabelPoints(O1,O2,T1,T2,A,B) + \tkzLabelPoints(O,C,A,B) +\end{tikzpicture} +\end{Verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} +\directlua{ + init_elements () + z.A = point: new (3,0) + z.B = point: new (0,-3) + z.O = point: new (0,0) + z.C = point: new (1,0) + L.AB = line: new ( z.A,z.B ) + C.OC = circle: new (z.O,z.C) + C1,C2 = C.OC: c_c_pp (z.A,z.B) + z.O1 = C1.center + z.T1 = C1.through + z.O2 = C2.center + z.T2 = C2.through +} +\begin{tikzpicture} +\tkzGetNodes +\tkzDrawLines[red](A,B) +\tkzDrawCircle[red](O,C) +\tkzDrawPoints(A,B,C,O) + \tkzDrawCircles[cyan](O1,T1 O2,T2) + \tkzDrawPoints(T1,T2) + \tkzLabelPoints(O1,O2,T1,T2,A,B) + \tkzLabelPoints(O,C,A,B) +\end{tikzpicture} +\end{minipage} -\begin{tkzelements} -z.A = point : new ( 0 , 0 ) -z.B = point : new ( 5 , 2 ) -L.AB = line : new ( z.A , z.B ) -z.C = point : new ( 1 , 2 ) -C.AC = circle : new (z.A,z.C) -C.BC = circle : new (z.B,z.C) -z.T,z.Tp = C.AC : common_tangent (C.BC) -L.TTp = line : new (z.T,z.Tp) -z.M = C.AC : point (0.45) -L.MC =line : new (z.M,z.C) -z.Mp = intersection (L.MC, C.BC) -L.mm = L.TTp : ll_from (z.C) -_,z.M = intersection (L.mm, C.AC) -z.Mp = intersection (L.mm, C.BC) -_,z.D = intersection (C.AC,C.BC) -\end{tkzelements} -\hspace*{\fill} +Special case: the two points are equidistant from the center of the circle + +\begin{minipage}{.5\textwidth} +\begin{Verbatim} +\directlua{ + init_elements () + scale =.5 + z.A = point: new (2,3) + z.B = point: new (2,-3) + z.O = point: new (0,0) + z.C = point: new (1,0) + L.AB = line: new ( z.A,z.B ) + C.OC = circle: new (z.O,z.C) + C1,C2 = C.OC: c_c_pp (z.A,z.B) + z.O1 = C1.center + z.T1 = C1.through + z.O2 = C2.center + z.T2 = C2.through} +\end{Verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} +\directlua{ + init_elements () + scale =.5 + z.A = point: new (2,3) + z.B = point: new (2,-3) + z.O = point: new (0,0) + z.C = point: new (1,0) + L.AB = line: new ( z.A,z.B ) + C.OC = circle: new (z.O,z.C) + C1,C2 = C.OC: c_c_pp (z.A,z.B) + z.O1 = C1.center + z.T1 = C1.through + z.O2 = C2.center + z.T2 = C2.through +} \begin{tikzpicture} \tkzGetNodes -\tkzDrawCircles(A,C B,C) -\tkzDrawSegments(M,M' A,D B,D A,B C,D T,C T',C) -\tkzDrawSegments[gray](D,M D,M' T,T' D,T D,T') -\tkzDrawPoints(A,B,C,D,M,M',T,T') -\tkzLabelPoints(A,B,D,M) -\tkzLabelPoints[above](C,M',T,T') -\tkzMarkAngles[mark=|,size=.75](T,C,M C,T,T' C,D,T T,D,M) -\tkzMarkAngles[mark=||,size=.75](M',C,T' T,T',C T',D,C M',D,T') +\tkzDrawLines[red](A,B) +\tkzDrawCircles[red](O,C) +\tkzDrawPoints(A,B,C,O) +\tkzDrawCircles[cyan](O1,T1 O2,T2) +\tkzLabelPoints(O,C,A,B) \end{tikzpicture} -\hspace*{\fill} +\end{minipage} -% subsection common_tangent (end) +The line $(AB)$ is tangent to the circle. Only one circle answers the question. -\subsection{Common tangent: orthogonality} % (fold) -\label{sub:common_tangent_orthogonality} -For two circles to be orthogonal, it is necessary and sufficient for a secant passing through one of their common points to be seen from the other common point at a right angle. +\begin{minipage}{.5\textwidth} +\begin{Verbatim} + \directlua{ + init_elements () + scale =.5 + z.A = point: new (1,5) + z.B = point: new (1,-3) + z.O = point: new (0,0) + z.C = point: new (1,0) + L.AB = line: new ( z.A,z.B ) + C.OC = circle: new (z.O,z.C) + C1,C2 = C.OC: c_c_pp (z.A,z.B) + z.O1 = C1.center + z.T1 = C1.through + z.O2 = C2.center + z.T2 = C2.through + } +\end{Verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} +\directlua{ + init_elements () + scale =.5 + z.A = point: new (1,5) + z.B = point: new (1,-3) + z.O = point: new (0,0) + z.C = point: new (1,0) + L.AB = line: new ( z.A,z.B ) + C.OC = circle: new (z.O,z.C) + C1,C2 = C.OC: c_c_pp (z.A,z.B) + z.O1 = C1.center + z.T1 = C1.through + z.O2 = C2.center + z.T2 = C2.through +} +\begin{tikzpicture} +\tkzGetNodes +\tkzDrawLines[red](A,B) +\tkzDrawCircles[red](O,C) +\tkzDrawPoints(A,B,C,O) +\tkzDrawCircles[cyan](O1,T1 O2,T2) +\tkzLabelPoints(O,C,A,B) +\end{tikzpicture} +\end{minipage} +Another special case occurs when the straight line $(AB)$ is tangent to the initial circle, and it's even possible for points $A$ and $B$ to be equidistant from the center and for the straight line to be tangent to the circle. Here too, a single circle answers the question + + +\begin{minipage}{.5\textwidth} + \begin{Verbatim} + \directlua{ + init_elements () + z.A = point: new (1,3) + z.B = point: new (1,-3) + z.O = point: new (0,0) + z.C = point: new (1,0) + L.AB = line: new ( z.A,z.B ) + C.OC = circle: new (z.O,z.C) + C1,C2 = C.OC: c_c_pp (z.A,z.B) + z.O1 = C1.center + z.T1 = C1.through + z.O2 = C2.center + z.T2 = C2.through + } + \end{Verbatim} +\end{minipage} +\begin{minipage}{0.5\textwidth} + \directlua{ + init_elements () + z.A = point: new (1,3) + z.B = point: new (1,-3) + z.O = point: new (0,0) + z.C = point: new (1,0) + L.AB = line: new ( z.A,z.B ) + C.OC = circle: new (z.O,z.C) + C1,C2 = C.OC: c_c_pp (z.A,z.B) + z.O1 = C1.center + z.T1 = C1.through + z.O2 = C2.center + z.T2 = C2.through + } + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawLines[red](A,B) + \tkzDrawCircles[red](O,C) + \tkzDrawPoints(A,B,C,O) + \tkzDrawCircles[cyan](O1,T1 O2,T2) + \tkzLabelPoints(O,C,A,B) + \end{tikzpicture} +\end{minipage} + +% subsubsection method_c__c__pp (end) + +\subsubsection{Method \Imeth{circle}{c\_cc\_p}} % (fold) +\label{ssub:method_c_cc_p} +Circle tangent to two circles passing through a point +Let's begin with the general case. The two circles are disjoint, and point +$P$ lies outside both of them. Notice that the two solution circles intersect at two points, one of which is the given point $P$. To determine the second intersection point, I used a similitude. This approach leads to an intriguing special case known as the Arbelos configuration. In this arrangement, the solution circles are also tangent at point $P$. One of the circles, in this case, is the Pappus circle. + +\begin{minipage}{0.5\textwidth} \begin{Verbatim} -\begin{tkzelements} - z.A = point : new ( 0 , 0 ) - z.B = point : new ( 4 , 2 ) - L.AB = line : new ( z.A , z.B ) - z.a = point : new ( 1 , 2 ) - C.Aa = circle : new (z.A,z.a) - C.BC = C.Aa : orthogonal_from (z.B) - z.C,z.D = intersection (C.Aa,C.BC) - C.AC = circle : new (z.A,z.C) - z.T,z.Tp = C.AC : common_tangent (C.BC) - L.TTp = line : new (z.T,z.Tp) - z.M = C.AC : point (0.45) - L.MC =line : new (z.M,z.C) - z.Mp = intersection (L.MC, C.BC) - L.mm = L.TTp : ll_from (z.C) - _,z.M = intersection (L.mm, C.AC) - z.Mp = intersection (L.mm, C.BC) -\end{tkzelements} - +\directlua{ +init_elements() +scale =.75 +z.A = point : new ( 0 , 0 ) +z.TA = point : new ( 3 , 0 ) +z.B = point : new ( 6 , 2 ) +z.TB = point : new ( 6 , 1 ) +z.P = point : new ( 3 , 6 ) +C.A = circle : new (z.A,z.TA) +C.B = circle : new (z.B,z.TB) +C1,C2= C.A : c_cc_p (C.B,z.P) +z.O1 = C1.center +z.O2 = C2.center +z.T1 = C1.through +z.T2 = C2.through +} \begin{tikzpicture} - \tkzGetNodes - \tkzDrawCircles(A,C B,C) - \tkzDrawSegments(M,M' A,C B,C A,B) - \tkzDrawSegments[gray](D,M D,M' T,T') - \tkzDrawPoints(A,B,C,D,M,M',T,T') - \tkzLabelPoints(A,B,D,M) - \tkzLabelPoints[above](C,M',T,T') - \tkzMarkRightAngles(M',D,M A,C,B) +\tkzGetNodes +\tkzDrawCircles[thick](A,TA B,TB) +\tkzDrawCircles[red](O1,T1 O2,T2) +\tkzDrawPoints(A,B,O1,O2) +\tkzLabelPoints(A,B) +\tkzDrawPoints[size=3](P) +\tkzLabelPoints[above](P) \end{tikzpicture} \end{Verbatim} - -\begin{tkzelements} -z.A = point : new ( 0 , 0 ) -z.B = point : new ( 4 , 2 ) -L.AB = line : new ( z.A , z.B ) -z.a = point : new ( 1 , 2 ) -C.Aa = circle : new (z.A,z.a) -C.BC = C.Aa : orthogonal_from (z.B) -z.C,z.D = intersection (C.Aa,C.BC) -C.AC = circle : new (z.A,z.C) -z.T,z.Tp = C.AC : common_tangent (C.BC) -L.TTp = line : new (z.T,z.Tp) -z.M = C.AC : point (0.45) -L.MC =line : new (z.M,z.C) -z.Mp = intersection (L.MC, C.BC) -L.mm = L.TTp : ll_from (z.C) -_,z.M = intersection (L.mm, C.AC) -z.Mp = intersection (L.mm, C.BC) -\end{tkzelements} - \hspace*{\fill} +\end{minipage} +\begin{minipage}{0.5\textwidth} +\directlua{ +init_elements() +scale = .75 +z.A = point : new ( 0 , 0 ) +z.TA = point : new ( 3 , 0 ) +z.B = point : new ( 6 , 2 ) +z.TB = point : new ( 6 , 1 ) +z.P = point : new ( 3 , 6 ) +C.A = circle : new (z.A,z.TA) +C.B = circle : new (z.B,z.TB) +C1,C2= C.A : c_cc_p (C.B,z.P) +z.O1 = C1.center +z.O2 = C2.center +z.T1 = C1.through +z.T2 = C2.through +} \begin{tikzpicture} - \tkzGetNodes - \tkzDrawCircles(A,C B,C) - \tkzDrawSegments(M,M' A,C B,C A,B) - \tkzDrawSegments[gray](D,M D,M' T,T') - \tkzDrawPoints(A,B,C,D,M,M',T,T') - \tkzLabelPoints(A,B,D,M) - \tkzLabelPoints[above](C,M',T,T') - \tkzMarkRightAngles(M',D,M A,C,B) +\tkzGetNodes +\tkzDrawCircles[thick](A,TA B,TB) +\tkzDrawCircles[red](O1,T1 O2,T2) +\tkzDrawPoints(A,B,O1,O2) +\tkzLabelPoints(A,B) +\tkzDrawPoints[size=3](P) +\tkzLabelPoints[above](P) \end{tikzpicture} -\hspace*{\fill} -% subsection common_tangent_orthogonality (end) +\end{minipage} -\subsection{In\_out for circle and disk} % (fold) -\label{sub:in_out_for_circle_and_disk} +\vspace{6pt} +The first special case involves two given tangent circles. The point $P$ is not the point of tangency of the Pappus circle. +\vspace{6pt} +\begin{minipage}{0.5\textwidth} \begin{Verbatim} -\begin{tkzelements} -z.O = point : new (0,0) -z.A = point : new (1,2) -C.OA = circle : new (z.O,z.A) -z.N = point : new (-2,2) -z.M = point : new (1,0) -z.P = point : new (2,1) -BCm = C.OA : in_out (z.M) -BDm = C.OA : in_out_disk (z.M) -BCn = C.OA : in_out (z.N) -BDn = C.OA : in_out_disk (z.N) -BCp = C.OA : in_out (z.P) -BDp = C.OA : in_out_disk (z.P) -\end{tkzelements} -\def\tkzPosPoint#1#2#3#4{% -\tkzLabelPoints(O,M,N,P) - \ifthenelse{\equal{\tkzUseLua{#1}}{true}}{ - \tkzLabelPoint[below=#4pt,font=\scriptsize](#2){on the #3}}{% - \tkzLabelPoint[below=#4pt,font=\scriptsize](#2){out the #3}}} +\directlua{ +z.A = point : new ( 0 , 0 ) +z.TA = point : new ( 2 , 0 ) +z.B = point : new ( 3 , 0 ) +z.TB = point : new ( 2 , 0 ) +z.P = point : new ( 3 , 4 ) +C.A = circle : new (z.A,z.TA) +C.B = circle : new (z.B,z.TB) +C1,C2 = C.A : c_cc_p (C.B,z.P) +z.O1 = C1.center +z.O2 = C2.center +z.T1 = C1.through +z.T2 = C2.through +} +\end{Verbatim} +\end{minipage} +\begin{minipage}{0.5\textwidth} +\directlua{ +z.A = point : new ( 0 , 0 ) +z.TA = point : new ( 2 , 0 ) +z.B = point : new ( 3 , 0 ) +z.TB = point : new ( 2 , 0 ) +z.P = point : new ( 3 , 4 ) +C.A = circle : new (z.A,z.TA) +C.B = circle : new (z.B,z.TB) +C1,C2 = C.A : c_cc_p (C.B,z.P) +z.O1 = C1.center +z.O2 = C2.center +z.T1 = C1.through +z.T2 = C2.through +} \begin{tikzpicture} \tkzGetNodes -\tkzDrawSegments[dashed](O,M O,N O,P) -\tkzDrawCircle(O,A) -\tkzDrawPoints(O,M,N,P) -\tkzPosPoint{BCm}{M}{circle}{8} -\tkzPosPoint{BCn}{N}{circle}{8} -\tkzPosPoint{BCp}{P}{circle}{8} -\tkzPosPoint{BDm}{M}{disk}{14} -\tkzPosPoint{BDn}{N}{disk}{14} -\tkzPosPoint{BDp}{P}{disk}{14} +\tkzDrawCircles[thick](A,TA B,TB) +\tkzDrawCircles[red](O1,T1 O2,T2) +\tkzDrawPoints(A,B,O1,O2) +\tkzDrawPoints[size = 3](P) +\tkzLabelPoints(A,B) +\tkzLabelPoints[above](P) \end{tikzpicture} +\end{minipage} + +\vspace{6pt} + +Here's the Arbelos configuration + +\vspace{6pt} +\begin{minipage}{0.5\textwidth} +\begin{Verbatim} +\directlua{ +z.A = point : new ( 0 , 0 ) +z.TA = point : new ( 2 , 0 ) +z.B = point : new ( 3 , 0 ) +z.TB = point : new ( 2 , 0 ) +C.A = circle : new (z.A,z.TA) +C.B = circle : new (z.B,z.TB) +z.I = C.A: external_similitude (C.B) +z.t1,z.t2 = C.A : common_tangent (C.B) +z.TD = C.B : antipode(z.TB) +z.TE = C.A : antipode(z.TA) +z.O = midpoint(z.TD,z.TE) +C.O = circle : new (z.O,z.TD) +z.P = C.O : tangent_from (z.I).pb +C1,C2 = C.A : c_cc_p (C.B,z.P) +z.O1 = C1.center +z.O2 = C2.center +z.T1 = C1.through +z.T2 = C2.through +} \end{Verbatim} +\end{minipage} +\begin{minipage}{0.5\textwidth} +\directlua{ +z.A = point : new ( 0 , 0 ) +z.TA = point : new ( 2 , 0 ) +z.B = point : new ( 3 , 0 ) +z.TB = point : new ( 2 , 0 ) +C.A = circle : new (z.A,z.TA) +C.B = circle : new (z.B,z.TB) +z.I = C.A: external_similitude (C.B) +z.t1,z.t2 = C.A : common_tangent (C.B) +z.TD = C.B : antipode(z.TB) +z.TE = C.A : antipode(z.TA) +z.O = midpoint(z.TD,z.TE) +C.O = circle : new (z.O,z.TD) +z.P = C.O : tangent_from (z.I).pb +C1,C2 = C.A : c_cc_p (C.B,z.P) +z.O1 = C1.center +z.O2 = C2.center +z.T1 = C1.through +z.T2 = C2.through +} +\begin{tikzpicture} +\tkzGetNodes +\tkzDrawCircles[thick](A,TA B,TB) +\tkzDrawCircles[red](O1,T1 O2,T2) +\tkzDrawPoints(A,B,O1,O2) +\tkzLabelPoints(A,B) +\tkzDrawPoints[size=3](P) +\tkzLabelPoints[above](P) +\end{tikzpicture} +\end{minipage} -\begin{tkzelements} -z.O = point : new (0,0) -z.A = point : new (1,2) -C.OA = circle : new (z.O,z.A) -z.N = point : new (-2,2) -z.M = point : new (1,0) -z.P = point : new (2,1) -BCm = C.OA : in_out (z.M) -BDm = C.OA : in_out_disk (z.M) -BCn = C.OA : in_out (z.N) -BDn = C.OA : in_out_disk (z.N) -BCp = C.OA : in_out (z.P) -BDp = C.OA : in_out_disk (z.P) -\end{tkzelements} -\def\tkzPosPoint#1#2#3#4{% -\tkzLabelPoints(O,M,N,P) - \ifthenelse{\equal{\tkzUseLua{#1}}{true}}{ - \tkzLabelPoint[below=#4pt,font=\scriptsize](#2){on the #3}}{% - \tkzLabelPoint[below=#4pt,font=\scriptsize](#2){out the #3}} -} +\vspace{6pt} +If the point $P$ is not the contact point of the Pappus circle, we return to the general case. + +\vspace{6pt} +\begin{minipage}{0.5\textwidth} +\begin{Verbatim} +\directlua{ +z.A = point : new ( 0 , 0 ) +z.TA = point : new ( 2 , 0 ) +z.B = point : new ( 3 , 0 ) +z.TB = point : new ( 2 , 0 ) +C.A = circle : new (z.A,z.TA) +C.B = circle : new (z.B,z.TB) +z.I = C.A: external_similitude (C.B) +z.t1,z.t2 = C.A : common_tangent (C.B) +z.TD = C.B : antipode(z.TB) +z.TE = C.A : antipode(z.TA) +z.O = midpoint(z.TD,z.TE) +C.O = circle : new (z.O,z.TD) +z.P = C.O : tangent_from (z.I).pb +C1,C2 = C.A : c_cc_p (C.B,z.P) +z.O1 = C1.center +z.O2 = C2.center +z.T1 = C1.through +z.T2 = C2.through +} +\end{Verbatim} +\end{minipage} +\begin{minipage}{0.5\textwidth} +\directlua{ +z.A = point : new ( 0 , 0 ) +z.TA = point : new ( 2 , 0 ) +z.B = point : new ( 3 , 0 ) +z.TB = point : new ( 2 , 0 ) +C.A = circle : new (z.A,z.TA) +C.B = circle : new (z.B,z.TB) +z.I = C.A: external_similitude (C.B) +z.t1,z.t2 = C.A : common_tangent (C.B) +z.TD = C.B : antipode(z.TB) +z.TE = C.A : antipode(z.TA) +z.O = midpoint(z.TD,z.TE) +C.O = circle : new (z.O,z.TD) +z.P = C.O : tangent_from (z.I).pb +C1,C2 = C.A : c_cc_p (C.B,z.P) +z.O1 = C1.center +z.O2 = C2.center +z.T1 = C1.through +z.T2 = C2.through +} \begin{tikzpicture} \tkzGetNodes -\tkzDrawSegments[dashed](O,M O,N O,P) -\tkzDrawCircle(O,A) -\tkzDrawPoints(O,M,N,P) -\tkzPosPoint{BCm}{M}{circle}{8} -\tkzPosPoint{BCn}{N}{circle}{8} -\tkzPosPoint{BCp}{P}{circle}{8} -\tkzPosPoint{BDm}{M}{disk}{14} -\tkzPosPoint{BDn}{N}{disk}{14} -\tkzPosPoint{BDp}{P}{disk}{14} -\end{tikzpicture} -% subsection in_out_for_circle_and_disk (end) +\tkzDrawCircles[thick](A,TA B,TB) +\tkzDrawCircles[red](O1,T1 O2,T2) +\tkzDrawPoints(A,B,O1,O2) +\tkzLabelPoints(A,B) +\tkzDrawPoints[size=3](P) +\tkzLabelPoints[above](P) +\end{tikzpicture} +\end{minipage} +% subsubsection method_c_cc_p (end) + +\subsubsection{Method c\_lc\_p} % (fold) +\label{ssub:method_c_lc_p} + +Circle tangent to a line and a circle passing through a given point. + +First, let's look at the general case. The point and the circle are in the same half-plane with respect to the line. +The point is neither on the line nor on the circle. + +There are 4 circles verifying the conditions. Two are tangent externally, and two internally to the initial circle. The latter two are obtained with the \code{inside} argument. + +\begin{minipage}{0.5\textwidth} +\begin{Verbatim} + \directlua{ + z.A = point : new (0 , 0) + z.B = point : new (4 , 0 ) + L.AB = line : new (z.A,z.B) + z.O = point : new (3 , 3) + z.T = point : new (3 , 2) + z.P = point : new (2 , .25) + C.OT = circle : new (z.O , z.T) + C1,C2 = C.OT : c_lc_p (L.AB , z.P) + z.O1 = C1.center + z.O2 = C2.center + C3,C4 = C.OT : c_lc_p (L.AB , z.P,inside) + z.O3 = C3.center + z.O4 = C4.center + } + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircles[thick](O,T) + \tkzDrawCircles[red](O1,P O2,P) + \tkzDrawCircles[cyan](O3,P O4,P) + \tkzDrawLines[thick](A,B) + \tkzDrawPoints[size = 2](P) + \tkzDrawPoints(A,B,O,O1,O2,O3,O4) + \tkzLabelPoints(A,B,O,O1,O2,O3,O4) + \tkzLabelPoints[above](P) + \end{tikzpicture} +\end{Verbatim} +\end{minipage} +\begin{minipage}{0.5\textwidth} + \directlua{ + init_elements() + z.A = point : new (0 , 0) + z.B = point : new (4 , 0 ) + L.AB = line : new (z.A,z.B) + z.O = point : new (3 , 3) + z.T = point : new (3 , 2) + z.P = point : new (2 , .25) + C.OT = circle : new (z.O , z.T) + C1,C2 = C.OT : c_lc_p (L.AB , z.P) + z.O1 = C1.center + z.O2 = C2.center + C3,C4 = C.OT : c_lc_p (L.AB , z.P,inside) + z.O3 = C3.center + z.O4 = C4.center + } + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircles[thick](O,T) + \tkzDrawCircles[red](O1,P O2,P) + \tkzDrawCircles[cyan](O3,P O4,P) + \tkzDrawLines[thick](A,B) + \tkzDrawPoints[size = 2](P) + \tkzDrawPoints(A,B,O,O1,O2,O3,O4) + \tkzLabelPoints(A,B,O,O1,O2,O3,O4) + \tkzLabelPoints[above](P) + \end{tikzpicture} +\end{minipage} +% subsubsection method_c_lc_p (end) +% subsection methods_of_the_class_circle (end) % section class_circle (end) + \endinput diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-ellipse.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-ellipse.tex index 3146f73461..7b640220e6 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-ellipse.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-ellipse.tex @@ -34,9 +34,10 @@ The first attributes are the three points that define the ellipse: : the \Iattr \subsubsection{Atributes of an ellipse: example} % (fold) \label{ssub:attributes_of_an_ellipse} -\begin{minipage}{.5\textwidth} +\begin{minipage}{.45\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.C = point: new (3 , 2) z.A = point: new (5 , 1) L.CA = line : new (z.C,z.A) @@ -55,11 +56,12 @@ The first attributes are the three points that define the ellipse: : the \Iattr z.S = E.south z.Co = E.covertex z.Ve = E.vertex -\end{tkzelements} +} \end{Verbatim} \end{minipage} -\begin{minipage}{.5\textwidth} - \begin{tkzelements} +\begin{minipage}{.55\textwidth} + \directlua{% +init_elements () z.C = point: new (3 , 2) z.A = point: new (5 , 1) L.CA = line : new (z.C,z.A) @@ -78,7 +80,7 @@ The first attributes are the three points that define the ellipse: : the \Iattr z.S = E.south z.Co = E.covertex z.Ve = E.vertex - \end{tkzelements} + } \begin{tikzpicture} \pgfkeys{/pgf/number format/.cd,fixed,precision=2} \tkzGetNodes @@ -86,7 +88,7 @@ The first attributes are the three points that define the ellipse: : the \Iattr \tkzDrawEllipse[red](C,\tkzUseLua{a},\tkzUseLua{b},\tkzUseLua{slope}) \tkzDrawPoints(C,A,B,b,W,S,F1,F2) \tkzLabelPoints(C,A,B) - \tkzDrawLine[add = .5 and .5](A,W) + \tkzDrawLine[add = .25 and .25](A,W) \tkzLabelSegment[pos=1.25,above,sloped](A,W){slope = \pgfmathprintnumber{\tkzUseLua{slope}}} \tkzLabelPoint[below](S){South} \tkzLabelPoint[below left](F1){Focus 1} @@ -105,7 +107,7 @@ The first attributes are the three points that define the ellipse: : the \Iattr \tkzUseLua{slope}) \tkzDrawPoints(C,A,B,b,W,S,F1,F2) \tkzLabelPoints(C,A,B) - \tkzDrawLine[add = .5 and .5](A,W) + \tkzDrawLine[add = .25 and .25](A,W) \tkzLabelSegment[pos=1.5,above,sloped](A,W){% slope = \pgfmathprintnumber{\tkzUseLua{slope}}} \tkzLabelPoint[below](S){South} @@ -141,10 +143,10 @@ To do this, you'll need to use a macro: \tkzcname{tkzUseLua} defined in \pkg{tk \Imeth{ellipse}{foci (f1,f2,v)} & E = ellipse: foci ( focus 1, focus 2, vertex ) \\ \Imeth{ellipse}{radii (c,a,b,sl) } & E = ellipse: radii ( center, radius a, radius b, slope ) \\ \Imeth{ellipse}{in\_out (pt) } & pt in/out of the ellipse \\ -\Imeth{ellipse}{tangent\_at (pt) } & Refer to ex. \ref{ssub:method_point} \\ -\Imeth{ellipse}{tangent\_from (pt) } & Refer to ex. \ref{ssub:method_point} \\ -\Imeth{ellipse}{point (t) } & vertex = point (0) covertex = point (0.25) ex Refer to \ref{ssub:method_point} \\ -\Imeth{ellipse}{orthoptic\_circle () } & Refer to ex. \ref{ssub:steiner_inellipse_and_circumellipse} \\ +\Imeth{ellipse}{tangent\_at (pt) } & [ ex. \ref{ssub:method_point} ] \\ +\Imeth{ellipse}{tangent\_from (pt) } & [ex. \ref{ssub:method_point} ] \\ +\Imeth{ellipse}{point (t) } & vertex = point (0) covertex = point (0.25) [ex. \ref{ssub:method_point} ] \\ +\Imeth{ellipse}{orthoptic\_circle () } & [ex. \ref{ssub:steiner_inellipse_and_circumellipse}] \\ \bottomrule \end{tabular} @@ -153,11 +155,12 @@ To do this, you'll need to use a macro: \tkzcname{tkzUseLua} defined in \pkg{tk \subsubsection{Method \Imeth{ellipse}{new}} % (fold) \label{ssub:method_imeth_ellipse_new} The main method for creating a new ellipse is \Imeth{ellipse}{new}. The arguments are three: \Iattr{ellipse}{center}, \Iattr{ellipse}{vertex} and \Iattr{ellipse}{covertex} -For attributes Refer to \ref{sec:class_ellipse}. +For attributes [\ref{sec:class_ellipse}]. \begin{minipage}{0.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.C = point: new (3 , 2) z.A = point: new (5 , 1) z.B = z.C : homothety(0.5, @@ -166,7 +169,7 @@ For attributes Refer to \ref{sec:class_ellipse}. a = E.Rx b = E.Ry slope = math.deg(E.slope) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles[teal](C,A) @@ -178,7 +181,8 @@ For attributes Refer to \ref{sec:class_ellipse}. \end{Verbatim} \end{minipage} \begin{minipage}{0.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.C = point: new (3 , 2) z.A = point: new (5 , 1) z.B = z.C : homothety(0.5, @@ -187,7 +191,7 @@ E = ellipse: new (z.C,z.A,z.B) a = E.Rx b = E.Ry slope = math.deg(E.slope) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles[teal](C,A) @@ -197,7 +201,7 @@ slope = math.deg(E.slope) \end{tikzpicture} \end{minipage} -The function \Igfct{package}{tkzUseLua (variable)} is used to transfer values to \TIKZ\ or \pkg{tkz-euclide}. +The macro \tkzcname{tkzUseLua (variable)} is used to transfer values to \TIKZ\ or \pkg{tkz-euclide}. % subsubsection method_imeth_ellipse_new (end) @@ -208,7 +212,8 @@ The first two points are the foci of the ellipse, and the third one is the verte \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0 , 0) z.B = point: new (5 , 1) L.AB = line : new (z.A,z.B) @@ -230,11 +235,12 @@ The first two points are the foci of the ellipse, and the third one is the verte z.R,z.S = intersection (L.XO,E) a,b = E.Rx,E.Ry ang = math.deg(E.slope) -\end{tkzelements} +} \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () scale =1 z.A = point: new (0 , 0) z.B = point: new (5 , 1) @@ -257,23 +263,26 @@ The first two points are the foci of the ellipse, and the third one is the verte z.R,z.S = intersection (L.XO,E) a,b = E.Rx,E.Ry ang = math.deg(E.slope) - \end{tkzelements} - \hspace*{\fill} - \begin{tikzpicture} - \tkzGetNodes - \tkzDrawPolygon(A,B,C) - \tkzDrawCircles[cyan](O,A N,I) - \tkzDrawSegments(X,R A,X) - \tkzDrawEllipse[red](N,\tkzUseLua{a},\tkzUseLua{b},\tkzUseLua{ang}) - \tkzDrawLines[add=.2 and .5](I,H) - \tkzDrawPoints(A,B,C,N,O,X,H,R,S,I) - \tkzLabelPoints[above](C,X) - \tkzLabelPoints[above right](N,O) - \tkzLabelPoints[above left](R) - \tkzLabelPoints[left](A) - \tkzLabelPoints[right](B,I,S,H) - \end{tikzpicture} - \hspace*{\fill} + } + + \begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygon(A,B,C) + \tkzDrawCircles[cyan](O,A N,I) + \tkzDrawSegments(X,R A,X) + \tkzDrawEllipse[red](N,\tkzUseLua{a},\tkzUseLua{b},\tkzUseLua{ang}) + \tkzDrawLines[add=.2 and .5](I,H) + \tkzDrawPoints(A,B,C,N,O,X,H,R,S,I) + \tkzLabelPoints[above](C,X) + \tkzLabelPoints[above right](N,O) + \tkzLabelPoints[above left](R) + \tkzLabelPoints[left](A) + \tkzLabelPoints[right](B,I,S,H) + \end{tikzpicture} + \end{center} + + \end{minipage} \begin{Verbatim} @@ -299,14 +308,16 @@ The first two points are the foci of the ellipse, and the third one is the verte \label{ssub:ellipse_method_point} The method \Imeth{ellipse}{point} defines a point $M$ of the ellipse whose coordinates are $(a\times cos(phi), b\times sin(phi))$. |phi| angle between (center,vertex) and (center,M) - \emph{The environment \tkzNameEnv{tkzelements} uses as \tkzname{lua} the radian as unit for angles. } + \emph{With \code{lua}, the radian is used as unit for angles. } \begin{minipage}{0.6\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () + scale = .6 z.C = point: new (2 , 3) - z.A = point: new (6 , 5) + z.A = point: new (-1 , -2) a = value(4) b = value(3) ang = math.deg(-math.pi/4) @@ -322,14 +333,15 @@ The first two points are the foci of the ellipse, and the third one is the verte z.N = L.tb.pb L.K = E :tangent_at (z.K) z.ka,z.kb = get_points(L.K) -\end{tkzelements} +} \end{Verbatim} \end{minipage} \begin{minipage}{0.4\textwidth} -\begin{tkzelements} -scale = .75 +\directlua{% +init_elements () +scale = .6 z.C = point: new (2 , 3) -z.A = point: new (6 , 5) +z.A = point: new (-1 , -2) a = value(4) b = value(3) ang = math.deg(-math.pi/4) @@ -345,7 +357,7 @@ z.M = L.ta.pb z.N = L.tb.pb L.K = E :tangent_at (z.K) z.ka,z.kb = get_points(L.K) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawSegments(C,V C,CoV) diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-line.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-line.tex index 435ad9bcc6..91eda32430 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-line.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-line.tex @@ -8,7 +8,8 @@ Writing |L.AB = line: new (z.A,z.B)| creates an object of the class \tkzname{line} (the notation is arbitrary for the moment). Geometrically, it represents both the line passing through the points $A$ and $B$ as the segment $[AB]$. Thus, we can use the midpoint of |L.AB|, which is, of course, the midpoint of the segment $[AB]$. This medium is obtained with |L.AB.mid|. Note that |L.AB.pa = z.A| and |L.AB.pb = z.B|. Finally, if a line $L$ is the result of a method, you can obtain the points with |z.A,z.B = get_points (L)| or with the previous remark. \begin{mybox} - Creation |L.AB = line : new ( z.A , z.B ) | + Creation \\ + |L.AB = line : new ( z.A , z.B ) | \end{mybox} @@ -26,24 +27,57 @@ The attributes are : \Iattr{line}{pb} & Second point of the segment & \\ \Iattr{line}{type} & Type is 'line' & |L.AB.type = 'line'| \\ \Iattr{line}{mid} & Middle of the segment& |z.M = L.AB.mid|\\ -\Iattr{line}{slope} & Slope of the line & Refer to (\ref{ssub:example_class_line})\\ -\Iattr{line}{length} &|l = L.AB.length|&Refer to (\ref{sub:transfer_from_lua_to_tex} ; \ref{ssub:example_class_line})\\ -\Iattr{line}{north\_pa} & &Refer to (\ref{ssub:example_class_line}) \\ -\Iattr{line}{north\_pb} & &\\ -\Iattr{line}{south\_pa} & &\\ -\Iattr{line}{south\_pb} & &Refer to (\ref{ssub:example_class_line}) \\ -\Iattr{line}{east} & &\\ -\Iattr{line}{west} & &\\ -\Iattr{line}{vec} & |V.AB = L.AB.vec|& defines $\overrightarrow{AB}$ Refer to (\ref{sec:class_vector})\\ +\Iattr{line}{slope} & Slope of the line & [\ref{ssub:example_class_line}] \\ +\Iattr{line}{length} &|l = L.AB.length|& [\ref{sub:transfer_from_lua_to_tex} ; \ref{ssub:example_class_line}] \\ +\Iattr{line}{north\_pa} & & [\ref{ssub:example_class_line}] \\ +\Iattr{line}{north\_pb} & & \\ +\Iattr{line}{south\_pa} & & \\ +\Iattr{line}{south\_pb} & & \\ +\Iattr{line}{east} & & \\ +\Iattr{line}{west} & & \\ +\Iattr{line}{vec} & |V.AB = L.AB.vec|& defines $\overrightarrow{AB}$ [\ref{sec:class_vector}] \\ \bottomrule \end{tabular} \egroup \subsubsection{Example: attributes of class line} % (fold) \label{ssub:example_class_line} -\begin{minipage}{.5\textwidth} + +\vspace{5pt} +\directlua{% +init_elements () +z.a = point: new (1, 1) +z.b = point: new (5, 4) +L.ab = line : new (z.a,z.b) +z.m = L.ab.mid +z.w = L.ab.west +z.e = L.ab.east +z.r = L.ab.north_pa +z.s = L.ab.south_pb +sl = L.ab.slope +len = L.ab.length +} + +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawPoints(a,b,m,e,r,s,w) + \tkzLabelPoints(a,b) + \tkzLabelPoint(r){north\_pa} + \tkzLabelPoint(s){south\_pb} + \tkzLabelPoint[below](m){mid} + \tkzLabelPoint[right](w){west} + \tkzLabelPoint[left](e){east} + \tkzDrawLine(a,b) + \tkzLabelSegment[above = 1em,sloped](a,b){ab = \pmpn{\tkzUseLua{len}}} + \tkzLabelSegment[above=2em,sloped](a,b){slope of (ab) = \pmpn{\tkzUseLua{sl}}} + \end{tikzpicture} +\end{center} + + \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .5 z.a = point: new (1, 1) z.b = point: new (5, 4) @@ -55,7 +89,7 @@ The attributes are : z.s = L.ab.south_pb sl = L.ab.slope len = L.ab.length -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes @@ -67,35 +101,8 @@ The attributes are : \tkzLabelSegment[above=12pt,sloped](a,b){slope of (ab) = \tkzUseLua{sl}} \end{tikzpicture} \end{Verbatim} -\end{minipage} -\begin{minipage}{.5\textwidth}\begin{tkzelements} -scale = .5 -z.a = point: new (1, 1) -z.b = point: new (5, 4) -L.ab = line : new (z.a,z.b) -z.m = L.ab.mid -z.w = L.ab.west -z.e = L.ab.east -z.r = L.ab.north_pa -z.s = L.ab.south_pb -sl = L.ab.slope -len = L.ab.length -\end{tkzelements} -\hspace*{\fill} -\begin{tikzpicture} - \tkzGetNodes - \tkzDrawPoints(a,b,m,e,r,s,w) - \tkzLabelPoints(a,b) - \tkzLabelPoint(r){north\_pa} - \tkzLabelPoint(s){south\_pb} - \tkzLabelPoint[below](m){mid} - \tkzLabelPoint[right](w){west} - \tkzLabelPoint[left](e){east} - \tkzDrawLine(a,b) - \tkzLabelSegment[above = 1em,sloped](a,b){ab = \pmpn{\tkzUseLua{len}}} - \tkzLabelSegment[above=2em,sloped](a,b){slope of (ab) = \pmpn{\tkzUseLua{sl}}} -\end{tikzpicture} -\end{minipage} + + % subsubsection example_class_line (end) \subsubsection{Method \Imeth{line}{new} and line attributes} @@ -109,13 +116,14 @@ With | L.AB = line : new (z.A,z.B)|, a line is defined. \begin{minipage}{0.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new (1,1) z.B = point : new (3,2) L.AB = line : new (z.A,z.B) z.C = L.AB.north_pa z.D = L.AB.south_pa -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawLines(A,B C,D) @@ -127,14 +135,15 @@ With | L.AB = line : new (z.A,z.B)|, a line is defined. \end{Verbatim} \end{minipage} \begin{minipage}{0.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () scale = 1 z.A = point : new (1,1) z.B = point : new (3,2) L.AB = line : new (z.A,z.B) z.C = L.AB.north_pa z.D = L.AB.south_pa -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawLines(A,B C,D) @@ -161,62 +170,66 @@ Here's the list of methods for the \tkzNameObj{line} object. The results can be \toprule \textbf{Methods} & \textbf{Comments} & \\ \midrule -\Igfct{line}{new(pt, pt)} & |L.AB = line : new(z.A,z.B)| & Create line $(AB)$ ; Refer to (\ref{ssub:altshiller})\\ +\Igfct{line}{new(pt, pt)} & |L.AB = line : new(z.A,z.B)| & Create line $(AB)$ ; [\ref{sub:altshiller}] \\ +\midrule +\textbf{Real} &&\\ +\midrule +\Imeth{line}{distance (pt)} & |d = L.AB : distance (z.C)| & [\ref{ssub:method_imeth_line_distance}; \ref{ssub:example_distance_and_projection}] \\ +\Imeth{line}{slope ()} & |a = L.AB : slope()| & better is L.AB.slope; [\ref{ssub:example_class_line}]\\ +\textbf{Boolean} &&\\ \midrule +\Imeth{line}{in\_out (pt)} & |b = L.AB: in_out(z.C)| & b=true if $C\in (AB)$ ; [\ref{ssub:method_imeth};\ref{ssub:in_out_for_a_line}] \\ +\Imeth{line}{in\_out\_segment(pt)} & |b = L.AB:in_out_segment(z.C)| & b=true if $C\in [AB$] [\ref{ssub:method_imeth_line_in__in__out__segment}] \\ +\Imeth{line}{is\_parallel(L)} & & \\ +\Imeth{line}{is\_orthogonal(L)} & & \\ +\Imeth{line}{is\_equidistant(pt)} & & \\\midrule \textbf{Points} &&\\ \midrule -\Imeth{line}{gold\_ratio ()} & |z.C=L.AB : gold_ratio()| & Refer to (\ref{sub:gold_ratio_with_segment} ; \ref{sub:the_figure_pappus_circle} ; \ref{sub:bankoff_circle}) \\ -\Imeth{line}{normalize ()} & |z.C=L.AB : normalize()| & AC =1 and $C\in (AB)$ Refer to (\ref{ssub:normalize}) \\ +\Imeth{line}{gold\_ratio ()} & |z.C=L.AB : gold_ratio()| & [\ref{sub:gold_ratio_with_segment} ; \ref{sub:the_figure_pappus_circle} ; \ref{sub:bankoff_circle} ] \\ +\Imeth{line}{normalize ()} & |z.C=L.AB : normalize()| & AC =1 and $C\in (AB)$ [ \ref{ssub:normalize}] \\ \Imeth{line}{normalize\_inv ()} & |z.C=L.AB : normalize_inv()| & CB=1 and $C\in (AB)$ \\ -\Imeth{line}{barycenter (r,r)} & |z.C=L.AB : barycenter (1,2)| & Refer to (\ref{ssub:barycenter_with_a_line})\\ -\Imeth{line}{point (r)} & |z.C=L.AB : point (2)| & $\overrightarrow{AC} = 2\overrightarrow{AB}$ Refer to (\ref{sub:ellipse} ; \ref{ssub:method_point})\\ +\Imeth{line}{barycenter (r,r)} & |z.C=L.AB : barycenter (1,2)| & [\ref{ssub:barycenter_with_a_line}] \\ +\Imeth{line}{point (r)} & |z.C=L.AB : point (2)| & $\overrightarrow{AC} = 2\overrightarrow{AB}$ [\ref{sub:ellipse} ; \ref{ssub:method_point}] \\ \Imeth{line}{midpoint ()} & |z.M=L.AB : midpoint ()| & better is |z.M = L.AB.mid| \\ -\Imeth{line}{harmonic\_int (pt)} & |z.D=L.AB : harmonic_int (z.C)| & Refer to (\ref{sub:bankoff_circle})\\ -\Imeth{line}{harmonic\_ext (pt)} & |z.D=L.AB : harmonic_ext (z.C)| & Refer to (\ref{sub:bankoff_circle})\\ -\Imeth{line}{harmonic\_both (r)} & |z.C,z.D=L.AB : harmonic_both|($\varphi$) & \ref{sub:harmonic_division_with_tkzphi}\\ +\Imeth{line}{harmonic\_int (pt)} & |z.D=L.AB : harmonic_int (z.C)| & [ \ref{sub:bankoff_circle}] \\ +\Imeth{line}{harmonic\_ext (pt)} & |z.D=L.AB : harmonic_ext (z.C)| & [ \ref{sub:bankoff_circle}] \\ +\Imeth{line}{harmonic\_both (r)} & |z.C,z.D=L.AB : harmonic_both|($\varphi$) & [\ref{sub:harmonic_division_with_tkzphi}] \\ \Imeth{line}{\_east(d)} & |z.M=L.AB : _east(2)| & |BM = 2| $A,B,M$ aligned \\ \Imeth{line}{\_west(d)} & |z.M=L.AB : _east(2)| & |BM = 2| $A,B,M$ aligned \\ -\Imeth{line}{\_north\_pa(d)} &|z.M=L.AB: _north_pa(2)| &|AM=2| $AM\perp AB$ ; $\overrightarrow{AB},\overrightarrow{AM}$ counterclockwise \\ -\Imeth{line}{\_south\_pa(d)} &|z.M=L.AB:_south_pa(2)| &|AM=2|; $AM\perp AB$ ; $\overrightarrow{AB},\overrightarrow{AM}$ clockwise \\ -\Imeth{line}{\_north\_pb(d)} &|z.M=L.AB:_north_pb(2)| &|BM=2|; $BM\perp BA$ ; $\overrightarrow{BA},\overrightarrow{BM}$ clockwise \\ -\Imeth{line}{\_south\_pb(d)} &|z.M=L.AB:_south_pb(2)| &|BM=2|; $BM\perp BA$ ; $\overrightarrow{AB},\overrightarrow{AM}$ counterclockwise \\ -\Imeth{line}{report(d,pt)} &|z.M=L.AB:report(2,z.N)| &|MN=2|; $AB\parallel MN$ ; Refer to ex. (\ref{ssub:method_report})\\ -\Imeth{line}{colinear\_at(pt,k)} &|z.D=L.AB:colinear_at(z.C,2)| &|CD=2AB|; $AB\parallel CD$ ; Refer to ex. (\ref{ssub:method_imeth_line_colinear__at})\\ +\Imeth{line}{\_north\_pa(d)} &|z.M=L.AB: _north_pa(2)| &|AM=2|; $AM\perp AB$ ; $\overrightarrow{AB},\overrightarrow{AM}$ counterclockwise. \\ +...&& [\ref{ssub:new_line_from_a_defined_line}; \ref{ssub:attributes_of_an_ellipse}]\\ +\Imeth{line}{\_south\_pa(d)} &|z.M=L.AB: _south_pa(2)| &|AM=2|; $AM\perp AB$ ; $\overrightarrow{AB},\overrightarrow{AM}$ clockwise \\ +\Imeth{line}{\_north\_pb(d)} &|z.M=L.AB: _north_pb(2)| &|BM=2|; $BM\perp BA$ ; $\overrightarrow{BA},\overrightarrow{BM}$ clockwise \\ +\Imeth{line}{\_south\_pb(d)} &|z.M=L.AB: _south_pb(2)| &|BM=2|; $BM\perp BA$ ; $\overrightarrow{AB},\overrightarrow{AM}$ counterclockwise \\ +\Imeth{line}{report(d,pt)} &|z.M=L.AB: report(2,z.N)| &|MN=2|; $AB\parallel MN$ ; [ex. \ref{ssub:method_report}]\\ +\Imeth{line}{colinear\_at(pt,k)} &|z.D=L.AB: colinear_at(z.C,2)| &|CD=2AB|; $AB\parallel CD$ ; [ex. \ref{ssub:method_imeth_line_colinear__at}]\\ \midrule + \textbf{Lines} &&\\ \midrule -\Imeth{line}{ll\_from ( pt )} &|L.CD=L.AB: ll_from(z.C)| &$(CD) \parallel (AB)$ \\ -\Imeth{line}{ortho\_from ( pt )} &|L.CD=L.AB: ortho_from(z.C)|&$(CD) \perp (AB)$\\ -\Imeth{line}{mediator ()}&|L.uv=L.AB: mediator()| & $(u,v)$mediator of $(A,B)$\\ +\Imeth{line}{ll\_from ( pt )} &|L.CD=L.AB: ll_from(z.C)| &$(CD) \parallel (AB)$; [\ref{ssub:new_line_from_a_defined_line}] \\ +\Imeth{line}{ortho\_from ( pt )} &|L.CD=L.AB: ortho_from(z.C)|&$(CD) \perp (AB)$; [\ref{ssub:newline_ortho_from}] \\ + \Imeth{line}{mediator ()} & |L.uv=L.AB: mediator()| & perpendicular bisector of $(A,B)$ \footnote{You can use |perpendicular_bisector| intead of \tkzname{mediator}.}; [\ref{ssub:method_imeth_line_mediator}]\\ \midrule + \textbf{Triangles}&&\\ \midrule -\Imeth{line}{equilateral (<swap>)} & |T.ABC=L.AB:equilateral()| & $(\overrightarrow{AB},\overrightarrow{AC})>0$ or $<0$ with swap \footnote{Triangles are defined in the direct sense of rotation, unless the "swap" option is present.} \\ -\Imeth{line}{isosceles (an<,swap>)}&|T.ABC=L.AB:isosceles(math.pi/6)|&\\ -\Imeth{line}{two\_angles (an,an)} &|T.ABC=L.AB:two_angles(an,an)|¬e \footnote{The given side is between the two angles} Refer to (\ref{ssub:triangle_with_two__angles}) \\ +\Imeth{line}{equilateral (<swap>)} & |T.ABC=L.AB:equilateral()| & $(\overrightarrow{AB},\overrightarrow{AC})>0$ or $<0$ with swap \footnote{Triangles are defined in the direct sense of rotation, unless the "swap" option is present.}; [\ref{ssub:object_rotation}] \\ +\Imeth{line}{isosceles (an<,swap>)}&|T.ABC=L.AB:isosceles(math.pi/6)|& [\ref{ssub:method_imeth_line_isosceles}]\\ +\Imeth{line}{isosceles\_a (an<,swap>)}& same as |isosceles| & \\ +\Imeth{line}{isosceles\_s (an<,swap>)}&|T.ABC=L.AB:isosceles_s(4)| AC=BC = 4& \\ +\Imeth{line}{two\_angles (an,an)} &|T.ABC=L.AB:two_angles(an,an)|¬e \footnote{The given side is between the two angles} [\ref{ssub:triangle_with_two__angles}] \\ \Imeth{line}{school ()} & 30°,60°, 90° & \\ -\Imeth{line}{sss (r,r)} & $AC=r$ $BC=r$ & \\ -\Imeth{line}{as (r,an)} & $AC =r$ $\widehat{BAC} = an$& \\ -\Imeth{line}{sa (r,an)} & $AC =r$ $\widehat{ABC} = an$& \\ -\midrule -\textbf{Sacred triangles}&&\\ -\midrule -\Imeth{line}{gold (<swap>)} &|T.ABC=L.AB:gold()| & right in $B$ and $AC = \varphi \times AB $ \\ -\Imeth{line}{euclide (<swap>)} &|T.ABC=L.AB:euclide()| &$AB=AC$ ; $(\overrightarrow{AB},\overrightarrow{AC}) = \pi/5$ \\ -\Imeth{line}{golden (<swap>)} &|T.ABC=L.AB:golden()| & - $(\overrightarrow{AB},\overrightarrow{AC}) = 2\times \pi/5$ \\ -\Imeth{line}{divine ()} & & \\ -\Imeth{line}{egyptian ()} & & \\ -\Imeth{line}{cheops ()} & & \\ -\midrule -\textbf{Squares}&&\\ -\midrule -\Imeth{line}{square ()} &|S.AB=L.AB : square () | & create a square |S.AB|.\footnote{ |_,_,z.C,z.D = get_points(S.AB)|}\\ +\Imeth{line}{half (<swap>)} & T.ABC = L.AB:half() $\widehat{B}$ = 90° and 2BC = AB& \\ +\Imeth{line}{sss (r,r<,swap>)} & $AC=r$ $BC=r$ & [\ref{ssub:triangle_with_three_given_sides}] \\ +\Imeth{line}{sas (r,an<,swap>)} & $AC =r$ $\widehat{BAC} = an$ & [\ref{ssub:triangle_with_three_given_sides}] \\ +\Imeth{line}{ssa (r,an<,swap>)} & $AC =r$ $\widehat{ABC} = an$& [\ref{ssub:triangle_with_three_given_sides}]\\ \bottomrule \end{tabular} \egroup \end{minipage} + \begin{minipage}{\textwidth} \bgroup \catcode`_=12 @@ -226,61 +239,412 @@ Here's the list of methods for the \tkzNameObj{line} object. The results can be \toprule \textbf{Methods} & \textbf{Comments} & \\ \midrule +\textbf{Squares}&&\\ +\midrule +\Imeth{line}{square ()} &|S.AB=L.AB : square () | & create a square |S.AB|.\footnote{ |_,_,z.C,z.D = get_points(S.AB)|}; [\ref{ssub:object_rotation}] \\ +\midrule +\textbf{Sacred triangles}&&\\ +\midrule +\Imeth{line}{gold (<swap>)} &|T.ABC=L.AB:gold()| & right in $B$ and $AC = \varphi \times AB $; [\ref{line:met}] \\ +\Imeth{line}{euclide (<swap>)} &|T.ABC=L.AB:euclide()| &$AB=AC$ ; $(\overrightarrow{AB},\overrightarrow{AC}) = \pi/5$; [\ref{line:met}] \\ +\Imeth{line}{golden (<swap>)} &|T.ABC=L.AB:golden()| & + $(\overrightarrow{AB},\overrightarrow{AC}) = 2\times \pi/5$ ; [\ref{line:met}] \\ +\Imeth{line}{sublime (<swap>)} & = golden & [\ref{line:met}] \\ +\Imeth{line}{divine (<swap>)} & & [\ref{line:met}] \\ +\Imeth{line}{golden\_gnomon (<swap>)} & = devine & [\ref{line:met}] \\ +\Imeth{line}{egyptian (<swap>)} & & [\ref{line:met}] \\ +\Imeth{line}{pythagoras (<swap>)} & = egyptian & [\ref{line:met}] \\ +\Imeth{line}{isis (<swap>)} & = egyptian & [\ref{line:met}] \\ +\Imeth{line}{cheops (<swap>)} & & [\ref{line:met}] \\ +\midrule \textbf{Circles} &&\\ \midrule \Imeth{line}{circle ()} & |C.AB = L.AB : circle ()| & center pa through pb \\ -\Imeth{line}{circle\_swap ()} & |C.BA = L.AB : circle_swap ()|& center pb through pa \\ -\Imeth{line}{apollonius (r)} & |C.apo = L.AB : apollonius (2)|& Set of points tq. |MA/MB = 2| \\ +\Imeth{line}{apollonius (r)} & |C.apo = L.AB : apollonius (2)|& Set of points tq. |MA/MB = 2|; [\ref{ssub:apollonius_circle_ma_mb_k}] \\ +\Imeth{line}{c\_l\_pp (pt,pt)} & |C1,C2 = L.AB : c_l_pp(z.M,z.N)| & [\ref{ssub:c_l_pp}] \\ +\Imeth{line}{c\_ll\_p (pt,pt)} & |C1,C2 = L.AB : c_ll_p(z.C,z.P)| & [\ref{ssub:method_c__ll__p}] \\ \midrule \textbf{Transformations} &&\\ \midrule -\Imeth{line}{reflection ( obj )} & |new obj = L.AB : reflection (obj|&\\ -\Imeth{line}{translation ( obj )} & |new obj = L.AB : translation (obj)|&\\ -\Imeth{line}{projection ( obj )} & |z.H = L.AB : projection (z.C)| & $CH \perp (AB)$ and $H\in (AB)$\\ -\midrule -\textbf{Miscellaneous} &&\\ -\midrule -\Imeth{line}{distance (pt)} & |d = L.Ab : distance (z.C)| & Refer to \ref{ssub:example_distance_and_projection}\\ -\Imeth{line}{in\_out (pt)} & |b = L.AB: in_out(z.C)| & b=true if $C\in (AB)$ \\ -\Imeth{line}{slope ()} & |a = L.AB : slope()| & better is L.AB.slope \\ -\Imeth{line}{in\_out\_segment (pt)} & |b = L.AB : in_out_segment(z.C)| & b=true if $C\in [AB$] \\ +\Imeth{line}{reflection ( obj )} & |new obj = L.AB : reflection (obj|& [\ref{ssub:reflection_of_object}] \\ +\Imeth{line}{translation ( obj )} & |new obj = L.AB : translation (obj)|& [\ref{ssub:example_translation}] \\ +\Imeth{line}{projection ( obj )} & |z.H = L.AB : projection (z.C)| & $CH \perp (AB)$ and $H\in (AB)$; [\ref{ssub:example_projection_of_several_points}; \ref{ssub:example_combination_of_methods}]\\ +... & & [ \ref{ssub:example_projection_of_several_points}; \ref{ssub:example_combination_of_methods}]\\ \bottomrule \end{tabular} \egroup \end{minipage} +\subsubsection{Method \Imeth{line}{distance}} % (fold) +\label{ssub:method_imeth_line_distance} + +This method gives the distance from a point to a straight line. + +\vspace{6pt} +\begin{minipage}{.5\textwidth} +\begin{Verbatim} +\directlua{ +function calc_distance (L,p) + if L : in_out (p) + then + return point.abs(p-L.pa)/L.length + else + return 0 + end +end +z.A = point: new (0,0) +z.B = point: new (2,4) +z.X = point: new (3,6) +z.Y = point: new (2,0) +L.AB = line : new (z.A,z.B) +dx = calc_distance (L.AB,z.X) +dy = calc_distance (L.AB,z.Y) +} +\tkzUseLua{k} +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawLine(A,B) + \tkzDrawPoints(A,B,X,Y) + \tkzLabelPoints(A,B) + \tkzLabelPoint(X){X : \tkzUseLua{dx}} + \tkzLabelPoint(Y){Y : \tkzUseLua{dy}} +\end{tikzpicture} +\end{Verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} +\directlua{ + z.A = point : new (0 , 0) + z.B = point : new (4 , 3) + z.C = point : new (1 , 5) + L.AB = line : new (z.A,z.B) + d = L.AB : distance (z.C) + l = L.AB.length + z.H = L.AB : projection (z.C) +} +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawLines(A,B C,H) + \tkzDrawPoints(A,B,C,H) + \tkzLabelPoints(A,B,C,H) + \tkzLabelSegment[above right=2em,draw](C,H){$CH = \tkzUseLua{d}$} + \tkzLabelSegment[below right=1em,draw](A,B){$AB = \tkzUseLua{l}$} + \end{tikzpicture} +\end{center} + +\end{minipage} +% subsubsection method_imeth_line_distance (end) + +\subsubsection{Method \Imeth{line}{in\_out}} % (fold) +\label{ssub:method_imeth} + +This method shows whether a point belongs to a straight line. + +\vspace{6pt} +\begin{minipage}{.5\textwidth} +\begin{Verbatim} +\directlua{ +function calc_ratio (L,p) + if L : in_out (p) + then + return point.abs(p-L.pa)/L.length + else + return 0 + end +end +z.A = point: new (0,0) +z.B = point: new (2,4) +z.X = point: new (3,6) +z.Y = point: new (2,0) +L.AB = line : new (z.A,z.B) +dx = calc_ratio (L.AB,z.X) +dy = calc_ratio (L.AB,z.Y) +} +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawLine(A,B) + \tkzDrawPoints(A,B,X,Y) + \tkzLabelPoints(A,B) + \tkzLabelPoint(X){X : \tkzUseLua{dx}} + \tkzLabelPoint(Y){Y : \tkzUseLua{dy}} +\end{tikzpicture} +\end{Verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} +\directlua{ +function calc_distance (L,p) + if L : in_out (p) + then + return point.abs(p-L.pa)/L.length + else + return 0 + end +end +z.A = point: new (0,0) +z.B = point: new (2,4) +z.X = point: new (3,6) +z.Y = point: new (2,0) +L.AB = line : new (z.A,z.B) +dx = calc_distance (L.AB,z.X) +dy = calc_distance (L.AB,z.Y) +} +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawLine(A,B) + \tkzDrawPoints(A,B,X,Y) + \tkzLabelPoints(A,B) + \tkzLabelPoint(X){X : \tkzUseLua{dx}} + \tkzLabelPoint(Y){Y : \tkzUseLua{dy}} + \end{tikzpicture} +\end{center} +\end{minipage} + +% subsubsection method_imeth (end) + +\subsubsection{Method \Imeth{line}{in\_in\_out\_segment}} % (fold) +\label{ssub:method_imeth_line_in__in__out__segment} + +Variant of the previous method; indicates whether a point is on or off a segment. + +\vspace{6pt} +\begin{minipage}{.5\textwidth} +\begin{Verbatim} + \directlua{ + function foo (L,p) + if L : in_out_segment (p) + then + return "in" + else + return "out" + end + end + z.A = point: new (0,0) + z.B = point: new (2,4) + z.X = point: new (-1,-2) + z.Y = point: new (1,2) + L.AB = line : new (z.A,z.B) + bx = foo(L.AB,z.X) + by = foo(L.AB,z.Y) + } + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawLine(A,B) + \tkzDrawPoints(A,B,X,Y) + \tkzLabelPoints(A,B) + \tkzLabelPoint(X){X : \tkzUseLua{bx}} + \tkzLabelPoint(Y){Y : \tkzUseLua{by}} + \end{tikzpicture} +\end{Verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} + \directlua{ + function foo (L,p) + if L : in_out_segment (p) + then + return "in" + else + return "out" + end + end + z.A = point: new (0,0) + z.B = point: new (2,4) + z.X = point: new (-1,-2) + z.Y = point: new (1,2) + L.AB = line : new (z.A,z.B) + bx = foo(L.AB,z.X) + by = foo(L.AB,z.Y) + } + \begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawLine(A,B) + \tkzDrawPoints(A,B,X,Y) + \tkzLabelPoints(A,B) + \tkzLabelPoint(X){X : \tkzUseLua{bx}} + \tkzLabelPoint(Y){Y : \tkzUseLua{by}} + \end{tikzpicture} + \end{center} + +\end{minipage} + +% subsubsection method_imeth_line_in__in__out__segment (end) + +\subsubsection{Method \Imeth{line}{is\_parallel}} % (fold) +\label{ssub:method_imeth_line_is__parallel} + +\begin{minipage}{.5\textwidth} +\begin{Verbatim} +\directlua{ +z.A = point : new ( 0 , 0 ) +z.B = point : new ( 4 , 2 ) +L.AB = line : new (z.A,z.B) +z.C = point : new ( 1 , 2 ) +z.D = point : new ( 5 , 4 ) +L.CD = line : new (z.C,z.D) +if L.AB:is_parallel (L.CD) +then tex.print("parallel") +else tex.print("no parallel") +end +} +\begin{tikzpicture} +\tkzGetNodes +\tkzDrawLines(A,B C,D) +\tkzDrawPoints(A,B,C,D) +\tkzLabelPoints(A,B,C,D) +\end{tikzpicture} +\end{Verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} + \directlua{ + z.A = point : new ( 0 , 0 ) + z.B = point : new ( 4 , 2 ) + L.AB = line : new (z.A,z.B) + z.C = point : new ( 1 , 2 ) + z.D = point : new ( 5 , 4 ) + L.CD = line : new (z.C,z.D) + if L.AB:is_parallel (L.CD) then tex.print("parallel") else tex.print("no parallel") end + } + \begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawLines(A,B C,D) + \tkzDrawPoints(A,B,C,D) + \tkzLabelPoints(A,B,C,D) + \end{tikzpicture} + \end{center} +\end{minipage} + +% subsubsection method_imeth_line_is__parallel (end) + +\subsubsection{Method \Imeth{line}{is\_orthogonal}} % (fold) +\label{ssub:method_imeth_line_is__orthogonal} + +\begin{minipage}{.5\textwidth} +\begin{Verbatim} + \directlua{ + z.A = point : new (0 , 0 ) + z.B = point : new (0 , 4 ) + L.AB = line : new (z.A,z.B) + z.C = point : new (3 , 4 ) + L.BC = line : new (z.B,z.C) + if L.AB:is_orthogonal (L.BC) + then tex.print("orthogonal") + else tex.print("no orthogonal") + end + } + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawLines(A,B B,C A,C) + \tkzDrawPoints(A,B,C) + \tkzLabelPoints(A,B,C) + \end{tikzpicture} +\end{Verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} + \directlua{ + z.A = point : new ( 0 , 0 ) + z.B = point : new ( 0 , 4 ) + L.AB = line : new (z.A,z.B) + z.C = point : new ( 3 , 4 ) + L.BC = line : new (z.B,z.C) + if L.AB:is_orthogonal (L.BC) then + tex.print("orthogonal") else + tex.print("no orthogonal") + end + } + \begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawLines(A,B B,C A,C) + \tkzDrawPoints(A,B,C) + \tkzLabelPoints(A,B,C) + \end{tikzpicture} + \end{center} +\end{minipage} +% subsubsection method_imeth_line_is__orthogonal (end) + +\subsubsection{Method \Imeth{line}{is\_equidistant}} % (fold) +\label{ssub:method_imeth_line_is__equidistant} + +\begin{minipage}{.5\textwidth} +\begin{Verbatim} +\directlua{ + z.A = point : new (0 , 0 ) + z.B = point : new (0 , 4 ) + z.C = point : new (4 , 4 ) + L.AC = line : new (z.A,z.C) + if L.AC:is_equidistant (z.B) + then tex.print("equidistant") + else tex.print("no equidistant") + end + } + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawLines(A,B B,C A,C) + \tkzDrawPoints(A,B,C) + \tkzLabelPoints(A,B,C) + \end{tikzpicture} +\end{Verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} +\directlua{ + z.A = point : new (0 , 0 ) + z.B = point : new (0 , 4 ) + z.C = point : new (4 , 4 ) + L.AC = line : new (z.A,z.C) + if L.AC:is_equidistant (z.B) + then tex.print("equidistant") + else tex.print("no equidistant") + end + } + \begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawLines(A,B B,C A,C) + \tkzDrawPoints(A,B,C) + \tkzLabelPoints(A,B,C) + \end{tikzpicture} + \end{center} +\end{minipage} + +% subsubsection method_imeth_line_is__equidistant (end) + \subsubsection{Method \Imeth{line}{report}} % (fold) \label{ssub:method_report} |report (d,pt)| If the point is absent, the transfer is made from the first point that defines the line. +\vspace{6pt} \begin{minipage}{.5\textwidth} \begin{Verbatim} - \begin{tkzelements} - z.A = point : new (1,-1) - z.B = point : new (5,0) - L.AB = line : new ( z.A , z.B ) - z.M = point : new (2,3) - z.N = L.AB : report (3,z.M) - z.O = L.AB : report (3) - \end{tkzelements} - \begin{tikzpicture} + \directlua{% +init_elements () +z.A = point : new (0,0) +z.B = point : new (4,3) +L.AB = line : new ( z.A , z.B ) +z.M = point : new (0,2) +z.N = L.AB : report (2.5,z.M) +z.O = L.AB : report (2.5) +} +\begin{tikzpicture} \tkzGetNodes \tkzDrawSegments(A,B M,N) \tkzDrawPoints(A,B,M,N,O) \tkzLabelPoints(A,B,M,N,O) - \end{tikzpicture} - \end{Verbatim} +\end{tikzpicture} +\end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} - \begin{tkzelements} -z.A = point : new (1,-1) -z.B = point : new (5,0) -L.AB = line : new ( z.A , z.B ) -z.M = point : new (2,3) -z.N = L.AB : report (3,z.M) -z.O = L.AB : report (3) -\end{tkzelements} + \directlua{% +init_elements () +z.A = point : new (0,0) +z.B = point : new (4,3) +L.AB = line : new ( z.A , z.B ) +z.M = point : new (0,2) +z.N = L.AB : report (2.5,z.M) +z.O = L.AB : report (2.5) +} \begin{tikzpicture} \tkzGetNodes \tkzDrawSegments(A,B M,N) @@ -297,103 +661,187 @@ The angles are on either side of the given segment \begin{minipage}{.4\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 0 , 0 ) z.B = point : new ( 4 , 0 ) L.AB = line : new ( z.A , z.B ) T.ABC = L.AB : two_angles (math.pi/6,math.pi/2) z.C = T.ABC.pc -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes - \tkzDrawPolygons(A,B,C) + \tkzDrawPolygons(A,B,C) \tkzDrawPoints(A,B,C) \tkzLabelPoints(A,B) - \tkzLabelPoints[above](C) + \tkzLabelPoints[above](C) + \tkzMarkAngle[red](C,B,A) + \tkzMarkAngle[red](B,A,C) + \tkzLabelAngle[red,pos=1.3](C,B,A){$\pi/2$} + \tkzLabelAngle[red,pos=1.3](B,A,C){$\pi/6$} \end{tikzpicture} \end{Verbatim} \end{minipage} \begin{minipage}{.6\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () z.A = point : new ( 0 , 0 ) z.B = point : new ( 4 , 0 ) L.AB = line : new ( z.A , z.B ) T.ABC= L.AB : two_angles (math.pi/6,math.pi/2) z.C = T.ABC.pc - \end{tkzelements} - \hspace*{\fill} - \begin{tikzpicture} - \tkzGetNodes - \tkzDrawPolygons(A,B,C) - \tkzDrawPoints(A,B,C) - \tkzLabelPoints(A,B) - \tkzLabelPoints[above](C) - \end{tikzpicture} - \hspace*{\fill} + } + + \begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygons(A,B,C) + \tkzDrawPoints(A,B,C) + \tkzLabelPoints(A,B) + \tkzLabelPoints[above](C) + \tkzMarkAngle[red](C,B,A) + \tkzMarkAngle[red](B,A,C) + \tkzLabelAngle[red,pos=1.3](C,B,A){$\pi/2$} + \tkzLabelAngle[red,pos=1.3](B,A,C){$\pi/6$} + \end{tikzpicture} + \end{center} + \end{minipage} % subsubsection triangle_with_two__angles (end) -\subsubsection{Method \Imeth{line}{sss}} % (fold) +\subsubsection{Method \Imeth{line}{isosceles}} % (fold) +\label{ssub:method_imeth_line_isosceles} +\begin{minipage}{.5\textwidth} + \begin{Verbatim} +\directlua{% +init_elements () + scale = 2 + z.a = point : new (1,2) + z.b = point : new (5,1) + L.ab = line : new (z.a,z.b) + T.abc = L.ab : isosceles (math.pi/6,indirect) + z.c = T.abc.pc + z.L = T.abc : lemoine_point () + T.SY = T.abc : symmedian () + z.Ka,z.Kb,z.Kc = get_points (T.SY) + L.Kb = T.abc : symmedian_line (1) + _,z.Kb = get_points(L.Kb) +} +\begin{tikzpicture} +\tkzGetNodes +\tkzDrawPolygons(a,b,c Ka,Kb,Kc) +\tkzDrawPoints(a,b,c,L,Ka,Kb,Kc) +\tkzLabelPoints(c,L,Ka,Kb) +\tkzLabelPoints[above](a,b,Kc) +\tkzDrawSegments[cyan](a,Ka b,Kb c,Kc) +\end{tikzpicture} +\end{Verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} +\directlua{% +init_elements () + scale = 2 + z.a = point : new (1,2) + z.b = point : new (5,1) + L.ab = line : new (z.a,z.b) + T.abc = L.ab : isosceles (math.pi/6,indirect) + z.c = T.abc.pc + z.L = T.abc : lemoine_point () + T.SY = T.abc : symmedian () + z.Ka,z.Kb, + z.Kc = get_points (T.SY) + L.Kb = T.abc : symmedian_line (1) + _,z.Kb = get_points(L.Kb) +} +\begin{tikzpicture} +\tkzGetNodes +\tkzDrawPolygons(a,b,c Ka,Kb,Kc) +\tkzDrawPoints(a,b,c,L,Ka,Kb,Kc) +\tkzLabelPoints(c,L,Ka,Kb) +\tkzLabelPoints[above](a,b,Kc) +\tkzDrawSegments[cyan](a,Ka b,Kb c,Kc) +\end{tikzpicture} +\end{minipage} + +% subsubsection method_imeth_line_isosceles (end) + +\subsubsection{Methods \Imeth{line}{sss}, \Imeth{line}{sas}, \Imeth{line}{ssa}} % (fold) \label{ssub:triangle_with_three_given_sides} In the following example, a small difficulty arises. The given lengths are not affected by scaling, so it's necessary to use the \Igfct{math}{value (r) } function, which will modify the lengths according to the scale. +\vspace{6pt} \begin{minipage}{.4\textwidth} \begin{Verbatim} -\begin{tkzelements} - z.A = point : new ( 0 , 0 ) - z.B = point : new ( 5 , 0 ) - L.AB = line : new ( z.A , z.B ) - T.ABC = L.AB : sss (value(3),value(4)) - z.C = T.ABC.pc -\end{tkzelements} +\directlua{% +init_elements () + z.A = point : new ( 0 , 0 ) + z.B = point : new ( 5 , 0 ) + L.AB = line : new ( z.A , z.B ) + T.ABC = L.AB : sss (value(3),value(4)) + T.ABD = L.AB : sas (value(3),math.pi/2) + T.ABE = L.AB : ssa (value(7),math.pi/2) + z.C = T.ABC.pc + z.D = T.ABD.pc + z.E = T.ABE.pc +} +\hspace{\fill} \begin{tikzpicture}[gridded] - \tkzGetNodes - \tkzDrawPolygons(A,B,C) - \tkzDrawPoints(A,B,C) - \tkzLabelPoints(A,B) - \tkzLabelPoints[above](C) + \tkzGetNodes + \tkzDrawPolygons(A,B,C A,B,D A,B,E) + \tkzDrawPoints(A,B,C,D,E) + \tkzLabelPoints(A,B) + \tkzLabelPoints[above](C,D,E) \end{tikzpicture} \end{Verbatim} \end{minipage} \begin{minipage}{.6\textwidth} - \begin{tkzelements} - z.A = point : new ( 0 , 0 ) - z.B = point : new ( 5 , 0 ) - L.AB = line : new ( z.A , z.B ) - T.ABC = L.AB : sss (value(3),value(4)) - z.C = T.ABC.pc - \end{tkzelements} -\hspace{\fill} - \begin{tikzpicture}[gridded] - \tkzGetNodes - \tkzDrawPolygons(A,B,C) - \tkzDrawPoints(A,B,C) - \tkzLabelPoints(A,B) - \tkzLabelPoints[above](C) - \end{tikzpicture} +\directlua{% +init_elements () + z.A = point : new ( 0 , 0 ) + z.B = point : new ( 5 , 0 ) + L.AB = line : new ( z.A , z.B ) + T.ABC = L.AB : sss (value(3),value(4)) + T.ABD = L.AB : sas (value(3),math.pi/2) + T.ABE = L.AB : ssa (value(7),math.pi/2) + z.C = T.ABC.pc + z.D = T.ABD.pc + z.E = T.ABE.pc +} + +\begin{center} + \begin{tikzpicture}[gridded] + \tkzGetNodes + \tkzDrawPolygons(A,B,C A,B,D A,B,E) + \tkzDrawPoints(A,B,C,D,E) + \tkzLabelPoints(A,B) + \tkzLabelPoints[above](C,D,E) + \end{tikzpicture} +\end{center} + \end{minipage} % subsubsection triangle_with_three_given_sides (end) \subsubsection{Triangle with side between side and angle} % (fold) \label{ssub:triangle_with_side_between_side_and_angle} -In some cases, two solutions are possible. \begin{minipage}{.4\textwidth} \begin{Verbatim} -\begin{tkzelements} - scale =1 - z.A = point : new ( 0 , 0 ) - z.B = point : new ( 5 , 0 ) - L.AB = line : new ( z.A , z.B ) - T.ABC,T.ABD = L.AB : ssa (value(3),math.pi/6) - z.C = T.ABC.pc - z.D = T.ABD.pc -\end{tkzelements} +\directlua{% +init_elements () + scale = 1 + z.A = point : new ( 0 , 0 ) + z.B = point : new ( 5 , 0 ) + L.AB = line : new ( z.A , z.B ) + T.ABC = L.AB : ssa (value(3),math.pi/6) + T.ABD = L.AB : ssa (value(3),math.pi/6,swap) + z.C = T.ABC.pc + z.D = T.ABD.pc +} \begin{tikzpicture}[gridded] \tkzGetNodes - \tkzDrawPolygons(A,B,C A,B,D) + \tkzDrawPolygons(A,B,C A,B,D) \tkzDrawPoints(A,B,C,D) \tkzLabelPoints(A,B) \tkzLabelPoints[above](C,D) @@ -404,25 +852,31 @@ In some cases, two solutions are possible. \end{Verbatim} \end{minipage} \begin{minipage}{.6\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () scale =1 z.A = point : new ( 0 , 0 ) z.B = point : new ( 5 , 0 ) L.AB = line : new ( z.A , z.B ) - T.ABC,T.ABD = L.AB : ssa (value(3),math.pi/6) + T.ABC = L.AB : ssa (value(3),math.pi/6) + T.ABD = L.AB : ssa (value(3),math.pi/6,swap) z.C = T.ABC.pc z.D = T.ABD.pc - \end{tkzelements} - \hspace{\fill} \begin{tikzpicture}[gridded] - \tkzGetNodes - \tkzDrawPolygons(A,B,C A,B,D) - \tkzDrawPoints(A,B,C,D) - \tkzLabelPoints(A,B) - \tkzLabelPoints[above](C,D) - \tkzLabelAngle[teal](C,B,A){$\pi/6$} - \tkzLabelSegment[below left](A,C){$7$} - \tkzLabelSegment[below left](A,D){$7$} - \end{tikzpicture} + } + +\begin{center} + \begin{tikzpicture}[gridded] + \tkzGetNodes + \tkzDrawPolygons(A,B,C A,B,D) + \tkzDrawPoints(A,B,C,D) + \tkzLabelPoints(A,B) + \tkzLabelPoints[above](C,D) + \tkzLabelAngle[teal](C,B,A){$\pi/6$} + \tkzLabelSegment[below left](A,C){$7$} + \tkzLabelSegment[below left](A,D){$7$} + \end{tikzpicture} +\end{center} + \end{minipage} % subsubsection triangle_with_side_between_side_and_angle (end) @@ -435,10 +889,10 @@ The side lengths are proportional to the lengths given in the table. They depend \begin{tabular}{ll} \toprule \textbf{Name} & \textbf{definition} \\ -\midrule +\midrule \Imeth{line}{gold (<swap>)} & Right triangle with $a=\varphi$, $b=1$ and $c=\sqrt{\varphi}$\\ -\Imeth{line}{golden (<swap>)} &Right triangle $b=\varphi$ $c=1$ ; half of gold rectangle \\ -\Imeth{line}{divine ()} & Isosceles $a=\varphi$, $b=c=1$ and $\beta = \gamma=\pi/5$ \\ +\Imeth{line}{golden (<swap>)} & Right triangle $b=\varphi$, $c=1$ ; half of gold rectangle \\ +\Imeth{line}{divine ()} & Isosceles $a=\varphi$, $b=c=1$ and $\beta = \gamma=\pi/5$ \\ \Imeth{line}{pythagoras ()} & $a=5$, $b=4$, $c=3$ and other names: isis or egyptian\\ \Imeth{line}{sublime ()} & Isosceles $a=1$, $b=c=\varphi$ and $\beta =\gamma=2\pi/5$ ; other name: euclid\\ \Imeth{line}{cheops ()} & Isosceles $a=2$, $b=c=\varphi$ and height = $\sqrt{\varphi}$ \\ @@ -447,7 +901,8 @@ The side lengths are proportional to the lengths given in the table. They depend \begin{minipage}{.4\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 0 , 0 ) z.B = point : new ( 4 , 0 ) L.AB = line : new ( z.A , z.B ) @@ -463,17 +918,18 @@ The side lengths are proportional to the lengths given in the table. They depend z.G = T.ABG.pc T.ABH = L.AB : pythagoras () z.H = T.ABH.pc -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes - \tkzDrawPolygons(A,B,C A,B,D A,B,E A,B,F A,B,G A,B,H) + \tkzDrawPolygons(A,B,C A,B,D A,B,E A,B,F A,B,G A,B,H) \tkzDrawPoints(A,...,H) \tkzLabelPoints(A,...,H) \end{tikzpicture} \end{Verbatim} \end{minipage} \begin{minipage}{.6\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 0 , 0 ) z.B = point : new ( 4 , 0 ) L.AB = line : new ( z.A , z.B ) @@ -489,10 +945,10 @@ The side lengths are proportional to the lengths given in the table. They depend z.G = T.ABG.pc T.ABH = L.AB : pythagoras () z.H = T.ABH.pc -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes - \tkzDrawPolygons(A,B,C A,B,D A,B,E A,B,F A,B,G A,B,H) + \tkzDrawPolygons(A,B,C A,B,D A,B,E A,B,F A,B,G A,B,H) \tkzDrawPoints(A,...,H) \tkzLabelPoints(A,...,H) \end{tikzpicture} @@ -511,14 +967,15 @@ This method exists for all objects except quadrilaterals. \begin{minipage}{.4\textwidth} \begin{Verbatim} -\begin{tkzelements} - z.A = point : new (-1,-1) - z.B = point : new (1,1) +\directlua{% +init_elements () + z.A = point : new (-1,-1) + z.B = point : new (1,1) L.AB = line : new (z.A,z.B) - z.I = L.AB : point (0.5) - z.J = L.AB : point (-0.5) - z.K = L.AB : point (2) -\end{tkzelements} + z.I = L.AB : point (0.5) + z.J = L.AB : point (-0.5) + z.K = L.AB : point (2) +} \begin{tikzpicture}[gridded] \tkzGetNodes \tkzDrawLine(J,K) @@ -528,20 +985,24 @@ This method exists for all objects except quadrilaterals. \end{Verbatim} \end{minipage} \begin{minipage}{.6\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () z.A = point : new (-1,-1) z.B = point : new (1,1) L.AB = line : new (z.A,z.B) z.I = L.AB : point (0.5) z.J = L.AB : point (-0.5) z.K = L.AB : point (2) -\end{tkzelements} -\begin{tikzpicture}[gridded] -\tkzGetNodes - \tkzDrawLine(J,K) - \tkzDrawPoints(A,B,I,J,K) - \tkzLabelPoints(A,B,I,J,K) - \end{tikzpicture} +} +\begin{center} + \begin{tikzpicture}[gridded] + \tkzGetNodes + \tkzDrawLine(J,K) + \tkzDrawPoints(A,B,I,J,K) + \tkzLabelPoints(A,B,I,J,K) + \end{tikzpicture} +\end{center} + \end{minipage} % subsubsection method_point (end) @@ -551,14 +1012,15 @@ If the coefficient is missing then it defaults to $1$ and in the following examp \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0 , 0) z.B = point: new (4 , 0) z.C = point: new (1 , 3) L.AB = line : new (z.A,z.B) z.D = L.AB : colinear_at (z.C,.5) z.E = L.AB : colinear_at (z.C) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawSegments(A,B C,E) @@ -568,20 +1030,24 @@ If the coefficient is missing then it defaults to $1$ and in the following examp \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0 , 0) z.B = point: new (4 , 0) z.C = point: new (1 , 3) L.AB = line : new (z.A,z.B) z.D = L.AB : colinear_at (z.C,.5) z.E = L.AB : colinear_at (z.C) -\end{tkzelements} -\begin{tikzpicture} - \tkzGetNodes - \tkzDrawSegments(A,B C,E) - \tkzDrawPoints(A,B,C,D,E) - \tkzLabelPoints(A,B,C,D,E) -\end{tikzpicture} +} +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawSegments(A,B C,E) + \tkzDrawPoints(A,B,C,D,E) + \tkzLabelPoints(A,B,C,D,E) + \end{tikzpicture} +\end{center} + \end{minipage} % subsubsection method_imeth_line_colinear__at (end) @@ -592,12 +1058,13 @@ If the coefficient is missing then it defaults to $1$ and in the following examp \begin{minipage}{.4\textwidth} \begin{Verbatim} -\begin{tkzelements} - z.a = point: new (1, 1) - z.b = point: new (5, 4) +\directlua{% +init_elements () + z.a = point: new (1, 1) + z.b = point: new (5, 4) L.ab = line : new (z.a,z.b) - z.c = L.ab : normalize () -\end{tkzelements} + z.c = L.ab : normalize () +} \begin{tikzpicture}[gridded] \tkzGetNodes @@ -609,21 +1076,24 @@ If the coefficient is missing then it defaults to $1$ and in the following examp \end{Verbatim} \end{minipage} \begin{minipage}{.6\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.a = point: new (1, 1) z.b = point: new (5, 4) L.ab = line : new (z.a,z.b) z.c = L.ab : normalize () -\end{tkzelements} -\hspace*{\fill} -\begin{tikzpicture}[gridded] -\tkzGetNodes -\tkzDrawSegments(a,b) -\tkzDrawCircle(a,c) -\tkzDrawPoints(a,b,c) -\tkzLabelPoints(a,b,c) -\end{tikzpicture} -\hspace*{\fill} +} + +\begin{center} + \begin{tikzpicture}[gridded] + \tkzGetNodes + \tkzDrawSegments(a,b) + \tkzDrawCircle(a,c) + \tkzDrawPoints(a,b,c) + \tkzLabelPoints(a,b,c) + \end{tikzpicture} +\end{center} + \end{minipage} % subsubsection normalize (end) @@ -633,12 +1103,13 @@ If the coefficient is missing then it defaults to $1$ and in the following examp \begin{minipage}{.4\textwidth} \begin{Verbatim} -\begin{tkzelements} - z.A = point : new ( 0 , -1 ) - z.B = point : new ( 4 , 2 ) +\directlua{% +init_elements () + z.A = point : new ( 0 , -1 ) + z.B = point : new ( 4 , 2 ) L.AB = line : new ( z.A , z.B ) - z.G = L.AB : barycenter (1,2) -\end{tkzelements} + z.G = L.AB : barycenter (1,2) +} \begin{tikzpicture} \tkzGetNodes \tkzDrawLine(A,B) @@ -648,26 +1119,31 @@ If the coefficient is missing then it defaults to $1$ and in the following examp \end{Verbatim} \end{minipage} \begin{minipage}{.6\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 0 , -1 ) z.B = point : new ( 4 , 2 ) L.AB = line : new ( z.A , z.B ) z.G = L.AB : barycenter (1,2) -\end{tkzelements} -\begin{tikzpicture} - \tkzGetNodes - \tkzDrawLine(A,B) - \tkzDrawPoints(A,B,G) - \tkzLabelPoints(A,B,G) -\end{tikzpicture} +} +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawLine(A,B) + \tkzDrawPoints(A,B,G) + \tkzLabelPoints(A,B,G) + \end{tikzpicture} +\end{center} + \end{minipage} % subsubsection barycenter_with_a_line (end) -\subsubsection{method \Imeth{line}{ll\_from}} % (fold) +\subsubsection{Method \Imeth{line}{ll\_from}} % (fold) \label{ssub:new_line_from_a_defined_line} \begin{minipage}{0.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = 1.25 z.A = point : new (1,1) z.B = point : new (3,2) @@ -675,9 +1151,9 @@ If the coefficient is missing then it defaults to $1$ and in the following examp z.C = L.AB.north_pa z.D = L.AB.south_pa L.CD = line : new (z.C,z.D) - _,z.E = get_points ( L.CD: ll_from (z.B)) - -- z.E = L2.pb -\end{tkzelements} + _,z.E = get_points ( L.CD: ll_from (z.B)) + % z.E = L2.pb +} \begin{tikzpicture} \tkzGetNodes \tkzDrawLines(A,B C,D B,E) @@ -689,7 +1165,8 @@ If the coefficient is missing then it defaults to $1$ and in the following examp \end{Verbatim} \end{minipage} \begin{minipage}{0.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () scale = 1.25 z.A = point : new (1,1) z.B = point : new (3,2) @@ -698,28 +1175,176 @@ z.C = L.AB.north_pa z.D = L.AB.south_pa L.CD = line : new (z.C,z.D) _,z.E = get_points ( L.CD: ll_from (z.B)) --- or z.E = L2.pb with |L2 = L.CD: ll_from (z.B)| -\end{tkzelements} -\hspace*{\fill} +% or z.E = L2.pb with |L2 = L.CD: ll_from (z.B)| +} + +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawLines(A,B C,D B,E) + \tkzDrawPoints(A,...,E) + \tkzLabelPoints(A,...,E) + \tkzMarkRightAngle(B,A,C) + \tkzMarkSegments(A,C A,B A,D) + \end{tikzpicture} +\end{center} + + +\end{minipage} + % \caption{New line from defined line} +% subsubsection new_line_from_a_defined_line (end) + +\subsubsection{Method \Imeth{line}{ortho\_from}} % (fold) +\label{ssub:newline_ortho_from} +\begin{minipage}{0.5\textwidth} +\begin{Verbatim} +\directlua{% +init_elements () + z.A = point : new (1,1) + z.B = point : new (3,2) + L.AB = line : new (z.A,z.B) + z.C = point : new (1,3) + L.CD = L.AB : ortho_from(z.C) + z.D = L.CD.pb +} \begin{tikzpicture} -\tkzGetNodes -\tkzDrawLines(A,B C,D B,E) -\tkzDrawPoints(A,...,E) -\tkzLabelPoints(A,...,E) -\tkzMarkRightAngle(B,A,C) -\tkzMarkSegments(A,C A,B A,D) + \tkzGetNodes + \tkzDrawLines(A,B C,D) + \tkzDrawPoints(A,...,D) + \tkzLabelPoints(A,...,D) \end{tikzpicture} -\hspace*{\fill} +\end{Verbatim} \end{minipage} - % \caption{New line from defined line} +\begin{minipage}{0.5\textwidth} +\directlua{% +init_elements () + z.A = point : new (1,1) + z.B = point : new (3,2) + L.AB = line : new (z.A,z.B) + z.C = point : new (1,3) + L.CD = L.AB : ortho_from(z.C) + z.D = L.CD.pb +} + +\begin{center} +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawLines(A,B C,D) + \tkzDrawPoints(A,...,D) + \tkzLabelPoints(A,...,D) +\end{tikzpicture} +\end{center} + + +\end{minipage} + % subsubsection new_line_from_a_defined_line (end) +\subsubsection{Method \Imeth{line}{mediator}} % (fold) +\label{ssub:method_imeth_line_mediator} + +In Mathworld, the mediator is the plane through the midpoint of a line segment and perpendicular to that segment, also called a mediating plane. The term "mediator" was introduced by J. Neuberg (Altshiller-Court 1979, p. 298). Here, I have adopted the French term and the mediator or +the perpendicular bisector of a line segment, is a line segment perpendicular to the segment and passing through the midpoint of this segment. +\begin{minipage}{.5\textwidth} +\begin{Verbatim} +\directlua{% +init_elements () + z.A = point: new(0,0) + z.B = point: new(5,0) + L.AB = line: new (z.A,z.B) + L.med = L.AB : mediator () + z.M = L.AB.mid + z.x,z.y= get_points(L.med) +} +\begin{tikzpicture} +\tkzGetNodes +\tkzDrawLine(A,B) +\tkzDrawSegments(x,y) +\tkzDrawPoints(A,B,M) +\tkzLabelPoints(A,B) +\tkzLabelPoints[below left](x,y,M) +\tkzMarkSegments(A,M M,B) +\end{tikzpicture} +\end{Verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} +\directlua{% +init_elements () + z.A = point: new(0,0) + z.B = point: new(5,0) + L.AB = line: new (z.A,z.B) + L.med = L.AB : mediator () + z.M = L.AB.mid + z.x,z.y= get_points(L.med) +} +\begin{center} +\begin{tikzpicture} +\tkzGetNodes +\tkzDrawLine(A,B) +\tkzDrawSegments(x,y) +\tkzDrawPoints(A,B,M) +\tkzLabelPoints(A,B) +\tkzLabelPoints[below left](x,y,M) +\tkzMarkSegments(A,M M,B) +\end{tikzpicture} +\end{center} +\end{minipage} + +% subsubsection method_imeth_line_mediator (end) + +\subsubsection{Method \Imeth{line}{equilateral}} % (fold) +\label{ssub:method_imeth_line_equilateral} + +\begin{minipage}{.5\textwidth} +\begin{Verbatim} +\directlua{% +init_elements () + z.A = point: new(0,0) + z.B = point: new(5,0) + L.AB = line: new (z.A,z.B) + T.ABC = L.AB : equilateral () + z.C = T.ABC.pc +} +\begin{tikzpicture} +\tkzGetNodes +\tkzDrawLine(A,B) +\tkzDrawPolygon(A,B,C) +\tkzMarkSegments(A,B B,C C,A) +\tkzDrawPoints(A,B,C) +\tkzMarkAngles(B,A,C C,B,A A,C,B) +\end{tikzpicture} +\end{Verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} +\directlua{% +init_elements () + z.A = point: new(0,0) + z.B = point: new(5,0) + L.AB = line: new (z.A,z.B) + T.ABC = L.AB : equilateral () + z.C = T.ABC.pc +} +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawLine(A,B) + \tkzDrawPolygon(A,B,C) + \tkzMarkSegments(A,B B,C C,A) + \tkzDrawPoints(A,B,C) + \tkzMarkAngles(B,A,C C,B,A A,C,B) + \end{tikzpicture} +\end{center} + +\end{minipage} + +% subsubsection method_imeth_line_equilateral (end) \subsubsection{Method \Imeth{line}{projection}} % (fold) \label{ssub:example_projection_of_several_points} \begin{minipage}{0.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .8 z.a = point: new (0, 0) z.b = point: new (4, 1) @@ -727,7 +1352,7 @@ _,z.E = get_points ( L.CD: ll_from (z.B)) z.d = point: new (5, 2) L.ab = line: new (z.a,z.b) z.cp,z.dp = L.ab: projection(z.c,z.d) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawLines(a,b c,c' d,d') @@ -737,7 +1362,8 @@ _,z.E = get_points ( L.CD: ll_from (z.B)) \end{Verbatim} \end{minipage} \begin{minipage}{0.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () scale = .8 z.a = point: new (0, 0) z.b = point: new (4, 1) @@ -745,15 +1371,17 @@ z.c = point: new (2, 5) z.d = point: new (5, 2) L.ab = line: new (z.a,z.b) z.cp,z.dp = L.ab : projection(z.c,z.d) -\end{tkzelements} -\hspace*{\fill} -\begin{tikzpicture} -\tkzGetNodes -\tkzDrawLines(a,b c,c' d,d') -\tkzDrawPoints(a,...,d,c',d') -\tkzLabelPoints(a,...,d,c',d') -\end{tikzpicture} -\hspace*{\fill} +} + +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawLines(a,b c,c' d,d') + \tkzDrawPoints(a,...,d,c',d') + \tkzLabelPoints(a,...,d,c',d') + \end{tikzpicture} +\end{center} + \end{minipage} % \caption{Projection of several points} @@ -764,7 +1392,8 @@ z.cp,z.dp = L.ab : projection(z.c,z.d) \begin{minipage}{0.6\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0 , 0) z.B = point: new (6 , 0) z.C = point: new (1 , 5) @@ -775,8 +1404,8 @@ z.cp,z.dp = L.ab : projection(z.c,z.d) z.H = L.AB: projection (z.O) L.ab = C.OA: tangent_at (z.A) z.a,z.b = L.ab.pa,L.ab.pb - -- or z.a,z.b = get_points (L.ab) -\end{tkzelements} + % or z.a,z.b = get_points (L.ab) +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygon(A,B,C) @@ -795,7 +1424,8 @@ z.cp,z.dp = L.ab : projection(z.c,z.d) \end{Verbatim} \end{minipage} \begin{minipage}{0.4\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () scale = .5 z.A = point: new (0 , 0) z.B = point: new (6 , 0) @@ -807,25 +1437,28 @@ C.OA = circle: new (z.O,z.A) z.H = L.AB : projection (z.O) L.ab = C.OA : tangent_at (z.A) z.a,z.b = L.ab.pa,L.ab.pb - -- or z.a,z.b = get_points (L.ab) -\end{tkzelements} -\hspace*{\fill} -\begin{tikzpicture} -\tkzGetNodes -\tkzDrawPolygon(A,B,C) -\tkzDrawCircle(O,A) -\tkzDrawSegments[purple](O,A O,B O,H) -\tkzDrawArc[red](O,A)(B) -\tkzDrawArc[blue](O,B)(A) -\tkzDrawLine[add = 2 and 1](A,a) -\tkzFillAngles[teal!30,opacity=.4,,size=.5](A,C,B b,A,B A,O,H) -\tkzMarkAngles[mark=|,size=.5](A,C,B b,A,B A,O,H H,O,B) -\tkzDrawPoints(A,B,C,H,O) -\tkzLabelPoints(B,H) -\tkzLabelPoints[above](O,C) -\tkzLabelPoints[left](A) -\end{tikzpicture} -\hspace*{\fill} + % or z.a,z.b = get_points (L.ab) +} + +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygon(A,B,C) + \tkzDrawCircle(O,A) + \tkzDrawSegments[purple](O,A O,B O,H) + \tkzDrawArc[red](O,A)(B) + \tkzDrawArc[blue](O,B)(A) + \tkzDrawLine[add = 2 and 1](A,a) + \tkzFillAngles[teal!30,opacity=.4,,size=.5](A,C,B b,A,B A,O,H) + \tkzMarkAngles[mark=|,size=.5](A,C,B b,A,B A,O,H H,O,B) + \tkzDrawPoints(A,B,C,H,O) + \tkzLabelPoints(B,H) + \tkzLabelPoints[above](O,C) + \tkzLabelPoints[left](A) + \end{tikzpicture} +\end{center} + + \end{minipage} % subsubsection example_combination_of_methods (end) @@ -835,14 +1468,15 @@ z.a,z.b = L.ab.pa,L.ab.pb \begin{minipage}{0.6\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0,0) z.B = point: new (1,2) z.C = point: new (-3,2) z.D = point: new (0,2) L.AB = line : new (z.A,z.B) z.E,z.F = L.AB : translation (z.C,z.D) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPoints(A,...,F) @@ -852,88 +1486,48 @@ z.a,z.b = L.ab.pa,L.ab.pb \end{Verbatim} \end{minipage} \begin{minipage}{0.4\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0,0) z.B = point: new (1,2) z.C = point: new (-3,2) z.D = point: new (0,2) L.AB = line : new (z.A,z.B) z.E,z.F = L.AB : translation (z.C,z.D) -\end{tkzelements} -\hspace*{\fill} -\begin{tikzpicture} -\tkzGetNodes -\tkzDrawPoints(A,...,F) -\tkzLabelPoints(A,...,F) -\tkzDrawSegments[->,red,> =latex](C,E D,F A,B) ) -\end{tikzpicture} -\hspace*{\fill} -\end{minipage} +} -% subsubsection example_translation (end) +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawPoints(A,...,F) + \tkzLabelPoints(A,...,F) + \tkzDrawSegments[->,red,> =latex](C,E D,F A,B) ) + \end{tikzpicture} +\end{center} -\subsubsection{Method \Imeth{line}{distance}} % (fold) -\label{ssub:example_distance_and_projection} -\begin{minipage}{0.5\textwidth} -\begin{Verbatim} -\begin{tkzelements} - z.A = point : new (0 , 0) - z.B = point : new (5 , -2) - z.C = point : new (3 , 3) - L.AB = line : new (z.A,z.B) - d = L.AB : distance (z.C) - z.H = L.AB : projection (z.C) -\end{tkzelements} -\begin{tikzpicture} - \tkzGetNodes - \tkzDrawLines(A,B C,H) - \tkzDrawPoints(A,B,C,H) - \tkzLabelPoints(A,B,C,H) - \tkzLabelSegment[above left, - draw](C,H){$CH = \tkzUseLua{d}$} -\end{tikzpicture} -\end{Verbatim} -\end{minipage} -\begin{minipage}{0.5\textwidth} -\begin{tkzelements} - z.A = point : new (0 , 0) - z.B = point : new (5 , -2) - z.C = point : new (3 , 3) - L.AB = line : new (z.A,z.B) - d = L.AB : distance (z.C) - z.H = L.AB : projection (z.C) -\end{tkzelements} -\hspace*{\fill} -\begin{tikzpicture} -\tkzGetNodes -\tkzDrawLines(A,B C,H) -\tkzDrawPoints(A,B,C,H) -\tkzLabelPoints(A,B,C,H) -\tkzLabelSegment[above left,draw](C,H){$CH = \tkzUseLua{d}$} -\end{tikzpicture} -\hspace*{\fill} \end{minipage} -% \caption{Method distance with line object} -% subsubsection example_distance_and_projection (end) +% subsubsection example_translation (end) + \subsubsection{Method \Imeth{line}{reflection} of an object} % (fold) \label{ssub:reflection_of_object} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} - z.A = point : new ( 0 , 0 ) +\directlua{% +init_elements () + z.A = point : new ( 0 , 0 ) z.B = point : new ( 4 , 1 ) - z.E = point : new ( 0 , 2 ) - z.F = point : new ( 3 , 3 ) + z.E = point : new ( 0 , 2 ) + z.F = point : new ( 3 , 3 ) z.G = point : new ( 4 , 2 ) L.AB = line : new ( z.A , z.B ) T.EFG = triangle : new (z.E,z.F,z.G) T.new = L.AB : reflection (T.EFG) z.Ep,z.Fp,z.Gp = get_points(T.new) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawLine(A,B) @@ -944,86 +1538,629 @@ z.a,z.b = L.ab.pa,L.ab.pb \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} - z.A = point : new ( 0 , 0 ) +\directlua{% +init_elements () + z.A = point : new ( 0 , 0 ) z.B = point : new ( 4 , 1 ) - z.E = point : new ( 0 , 2 ) - z.F = point : new ( 3 , 3 ) + z.E = point : new ( 0 , 2 ) + z.F = point : new ( 3 , 3 ) z.G = point : new ( 4 , 2 ) L.AB = line : new ( z.A , z.B ) T.EFG = triangle : new (z.E,z.F,z.G) T.new = L.AB : reflection (T.EFG) z.Ep,z.Fp,z.Gp = get_points(T.new) -\end{tkzelements} -\hspace{\fill}\begin{tikzpicture} - \tkzGetNodes - \tkzDrawLine(A,B) - \tkzDrawPolygon(E,F,G) - \tkzDrawPolygon[new](E',F',G') - \tkzDrawSegment[red,dashed](E,E') -\end{tikzpicture} +} + +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawLine(A,B) + \tkzDrawPolygon(E,F,G) + \tkzDrawPolygon[new](E',F',G') + \tkzDrawSegment[red,dashed](E,E') + \end{tikzpicture} +\end{center} + \end{minipage} % subsubsection reflection_of_object (end) +\subsubsection{Method \Imeth{line}{distance}} % (fold) +\label{ssub:example_distance_and_projection} + +\begin{minipage}{0.5\textwidth} +\begin{Verbatim} +\directlua{% +init_elements () + z.A = point : new (0 , 0) + z.B = point : new (4 , -2) + z.C = point : new (3 , 3) + L.AB = line : new (z.A,z.B) + d = L.AB : distance (z.C) + z.H = L.AB : projection (z.C) +} +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawLines(A,B C,H) + \tkzDrawPoints(A,B,C,H) + \tkzLabelPoints(A,B,C,H) + \tkzLabelSegment[above left, + draw](C,H){$CH = \tkzUseLua{d}$} +\end{tikzpicture} +\end{Verbatim} +\end{minipage} +\begin{minipage}{0.5\textwidth} +\directlua{% +init_elements () + z.A = point : new (0 , 0) + z.B = point : new (4 , -2) + z.C = point : new (3 , 3) + L.AB = line : new (z.A,z.B) + d = L.AB : distance (z.C) + z.H = L.AB : projection (z.C) +} + +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawLines(A,B C,H) + \tkzDrawPoints(A,B,C,H) + \tkzLabelPoints(A,B,C,H) + \tkzLabelSegment[above left,draw](C,H){$CH = \tkzUseLua{d}$} + \end{tikzpicture} +\end{center} +\end{minipage} -\subsection{Method \Imeth{line}{apollonius} Apollonius circle MA/MB = k} % (fold) -\label{sub:apollonius_circle_ma_mb_k} +% \caption{Method distance with line object} +% subsubsection example_distance_and_projection (end) + + +\subsubsection{Method \Imeth{line}{apollonius} (Apollonius circle MA/MB = k)} % (fold) +\label{ssub:apollonius_circle_ma_mb_k} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 0 , 0 ) - z.B = point : new ( 6 , 0 ) + z.B = point : new ( 6 , 0 ) L.AB =line: new (z.A,z.B) C.apo = L.AB : apollonius (2) - z.O,z.C = get_points ( C.apo ) + z.O,z.C = get_points ( C.apo ) z.D = C.apo : antipode (z.C) z.P = C.apo : point (0.30) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzFillCircle[blue!20,opacity=.2](O,C) \tkzDrawCircle[blue!50!black](O,C) \tkzDrawPoints(A,B,O,C,D,P) - \tkzLabelPoints[below right](A,B,O,C,D,P) \tkzDrawSegments[orange](P,A P,B P,D B,D P,C) \tkzDrawSegments[red](A,C) \tkzDrawPoints(A,B) \tkzLabelCircle[draw,fill=green!10,% text width=3cm,text centered,left=24pt](O,D)(60)% {$CA/CB=2$\\$PA/PB=2$\\$DA/DB=2$} - \tkzMarkRightAngle[opacity=.3,fill=lightgray](O,P,C) + \tkzLabelPoints[below right](A,B,O,C,D) + \tkzLabelPoints[above](P) + \tkzMarkRightAngle[opacity=.3,fill=lightgray](D,P,C) \tkzMarkAngles[mark=||](A,P,D D,P,B) \end{tikzpicture} \end{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 0 , 0 ) -z.B = point : new ( 6 , 0 ) +z.B = point : new ( 6 , 0 ) L.AB =line: new (z.A,z.B) C.apo = L.AB : apollonius (2) -z.O,z.C = get_points ( C.apo ) +z.O,z.C = get_points ( C.apo ) z.D = C.apo : antipode (z.C) z.P = C.apo : point (0.30) -\end{tkzelements} +} +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzFillCircle[blue!20,opacity=.2](O,C) + \tkzDrawCircle[blue!50!black](O,C) + \tkzDrawPoints(A,B,O,C,D,P) + \tkzDrawSegments[orange](P,A P,B P,D B,D P,C) + \tkzDrawSegments[red](A,C) + \tkzDrawPoints(A,B) + \tkzLabelCircle[draw,fill=green!10,% + text width=3cm,text centered,left=24pt](O,D)(60)% + {$CA/CB=2$\\$PA/PB=2$\\$DA/DB=2$} + \tkzLabelPoints[below right](A,B,O,C,D) + \tkzLabelPoints[above](P) + \tkzMarkRightAngle[opacity=.3,fill=lightgray](D,P,C) + \tkzMarkAngles[mark=||](A,P,D D,P,B) + \end{tikzpicture} +\end{center} + + +Remark: |\tkzUseLua{length(z.P,z.A)/length(z.P,z.B)}| = \tkzUseLua{length(z.P,z.A)/length(z.P,z.B)} +% subsubsection apollonius_circle_ma_mb_k (end) + +\subsubsection{Method \Imeth{line}{c\_l\_pp}} % (fold) +\label{ssub:c_l_pp} +Circle tangent to a line passing through two points. + +First, consider the general case: a straight line $(AB)$ and two points, $M$ and $N$. We are tasked with finding the circle that is tangent to the line and passes through the two points. We will focus on the straight line $(AB)$ and apply a specific method designed for such cases. +The method takes into account the following special cases: +\begin{itemize} + \item line $(MN)$ is perpendicular to the line $(AB)$; + \item line $(MN)$ is parallel to line $(AB)$; + \item these points are on either side of the line $(AB)$; + \item one of the points lies on the line $(AB)$. +\end{itemize} + +\vspace{6pt} +\begin{minipage}{0.4\textwidth} +\begin{Verbatim} + \directlua{ + init_elements () + scale = .75 + z.A = point : new ( 0 , 0 ) + z.B = point : new ( 8 , 0 ) + z.M = point : new ( 1 , 1 ) + z.N = point : new ( 2 , 5 ) + L.AB = line:new(z.A,z.B) + C1,C2 = L.AB : c_l_pp (z.M,z.N) + z.O1 = C1.center + z.O2 = C2.center + z.T1 = C1.through + z.T2 = C2.through + } + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawLines(A,B M,N) + \tkzDrawCircles(O1,T1 O2,T2) + \tkzDrawPoints(A,B,M,N) + \tkzLabelPoints(A,B,M,N) + \tkzDrawPoints(A,B,M,N,O1,T1,O2,T2) + \end{tikzpicture} +\end{Verbatim} +\end{minipage} +\begin{minipage}{0.6\textwidth} +\directlua{ +init_elements () +scale =.75 +z.A = point : new ( 0 , 0 ) +z.B = point : new ( 6 , 0 ) +z.M = point : new ( 1 , 1 ) +z.N = point : new ( 2 , 5 ) +L.AB = line:new(z.A,z.B) +C1,C2 = L.AB : c_l_pp(z.M,z.N) +z.O1 = C1.center +z.O2 = C2.center +z.T1 = C1.through +z.T2 = C2.through +} \begin{tikzpicture} \tkzGetNodes -\tkzFillCircle[blue!20,opacity=.2](O,C) -\tkzDrawCircle[blue!50!black](O,C) -\tkzDrawPoints(A,B,O,C,D,P) -\tkzLabelPoints[below right](A,B,O,C,D,P) -\tkzDrawSegments[orange](P,A P,B P,D B,D P,C) -\tkzDrawSegments[red](A,C) -\tkzDrawPoints(A,B) -\tkzLabelCircle[draw,fill=green!10,% - text width=3cm,text centered,left=24pt](O,D)(60)% - {$CA/CB=2$\\$PA/PB=2$\\$DA/DB=2$} -\tkzMarkRightAngle[opacity=.3,fill=lightgray](O,P,C) -\tkzMarkAngles[mark=||](A,P,D D,P,B) +\tkzDrawLines(A,B M,N) +\tkzDrawCircles(O1,T1 O2,T2) +\tkzDrawPoints(A,B,M,N) +\tkzLabelPoints(A,B,M,N) +\tkzDrawPoints(A,B,M,N,O1,T1,O2,T2) \end{tikzpicture} +\end{minipage} -Remark: |\tkzUseLua{length(z.P,z.A)/length(z.P,z.B)}| = \tkzUseLua{length(z.P,z.A)/length(z.P,z.B)} -% subsection apollonius_circle_ma_mb_k (end) +\vspace{6pt} +Let's look at the impossible case: the points are on either side of the line. The method returns \code{nil} and \code{nil}. + +\begin{minipage}{0.4\textwidth} +\begin{Verbatim} +\directlua{ +init_elements () +scale =.75 +z.A = point :new (0, 0) +z.B = point :new (6, 0) +z.M = point :new (1, 1) +z.N = point :new (3 ,-5) +L.AB = line:new(z.A,z.B) +L.MN = line:new(z.M,z.N) +z.I = intersection(L.AB,L.MN) +C1,C2 = L.AB : c_l_pp(z.M,z.N) +if C1 == nil + then + tex.print('\\message{Error: Argument is nil}') + tex.print('Error: Argument is nil') +else + z.C = C1.center + z.Cp = C2.center + z.T = C1.through + z.Tp = C2.through +end +} +\begin{tikzpicture} +\tkzGetNodes +\tkzDrawLines(A,B M,N) +\tkzDrawPoints(A,B,M,N) +\tkzLabelPoints(A,B,M,N) +\end{tikzpicture} +\end{Verbatim} +\end{minipage} +\begin{minipage}{0.6\textwidth} +\directlua{ +init_elements () +scale =.75 +z.A = point : new ( 0 , 0 ) +z.B = point : new ( 6 , 0 ) +z.M = point : new ( 1 , 1 ) +z.N = point : new ( 3 , -5 ) +L.AB = line:new(z.A,z.B) +L.MN = line:new(z.M,z.N) +z.I = intersection(L.AB,L.MN) +C1,C2 = L.AB : c_l_pp(z.M,z.N) +if C1 == nil + then + tex.print('\\message{Error: Argument is nil}') + tex.print('Error: Argument is nil') +else + z.C = C1.center + z.Cp = C2.center + z.T = C1.through + z.Tp = C2.through +end +} +\begin{tikzpicture} +\tkzGetNodes +\tkzDrawLines(A,B M,N) +\tkzDrawPoints(A,B,M,N) +\tkzLabelPoints(A,B,M,N) +\end{tikzpicture} +\end{minipage} + +\vspace{6pt} +Let's look at the case where the line $(MN)$ is parallel to the initial line. + + +\begin{minipage}{0.4\textwidth} +\begin{Verbatim} + \directlua{ + init_elements () + z.A = point : new ( 0 , 0 ) + z.B = point : new ( 8 , 0 ) + z.M = point : new ( 0 , 3 ) + z.N = point : new ( 5 , 3 ) + L.AB = line:new(z.A,z.B) + C1,C2 = L.AB : c_l_pp(z.M,z.N) + z.O1 = C1.center + z.O2 = C2.center + z.T1 = C1.through + z.T2 = C2.through + } + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawLines(A,B M,N) + \tkzDrawCircles(O1,T1) + \tkzDrawPoints(A,B,M,N) + \tkzDrawPoints(A,B,M,N) + \tkzLabelPoints(A,B,M,N) + \end{tikzpicture} +\end{Verbatim} +\end{minipage} +\begin{minipage}{0.4\textwidth} +\directlua{ +init_elements () +z.A = point : new ( 0 , 0 ) +z.B = point : new ( 8 , 0 ) +z.M = point : new ( 0 , 3 ) +z.N = point : new ( 5 , 3 ) +L.AB = line:new(z.A,z.B) +C1,C2 = L.AB : c_l_pp(z.M,z.N) +z.O1 = C1.center +z.O2 = C2.center +z.T1 = C1.through +z.T2 = C2.through +} +\begin{tikzpicture} +\tkzGetNodes +\tkzDrawLines(A,B M,N) +\tkzDrawCircles(O1,T1) +\tkzDrawPoints(A,B,M,N) +\tkzDrawPoints(A,B,M,N) +\tkzLabelPoints(A,B,M,N) +\end{tikzpicture} +\end{minipage} + + +\vspace{6pt} +Where the line is perpendicular to the initial line. + +\vspace{6pt} +\begin{minipage}{0.4\textwidth} +\begin{Verbatim} +\directlua{ +init_elements () +scale = .75 +z.A = point : new(0, 0 ) +z.B = point : new(6, 0 ) +z.M = point : new(1, 1 ) +z.N = point : new(1, 5 ) +L.AB = line:new(z.A,z.B) +C1,C2 = L.AB : c_l_pp(z.M,z.N) +z.O1 = C1.center +z.O2 = C2.center +z.T1 = C1.through +z.T2 = C2.through +} +\end{Verbatim} +\end{minipage} +\begin{minipage}{0.6\textwidth} +\directlua{ +init_elements () +scale = .75 +z.A = point : new ( 0 , 0 ) +z.B = point : new ( 6 , 0 ) +z.M = point : new ( 1 , 1 ) +z.N = point : new ( 1 , 5 ) +L.AB = line:new(z.A,z.B) +C1,C2 = L.AB : c_l_pp(z.M,z.N) +z.O1 = C1.center +z.O2 = C2.center +z.T1 = C1.through +z.T2 = C2.through +} +\begin{tikzpicture} +\tkzGetNodes +\tkzDrawLines(A,B M,N) +\tkzDrawCircles(O1,T1 O2,T2) +\tkzDrawPoints(A,B,M,N) +\tkzLabelPoints(A,B,M,N) +\tkzDrawPoints(A,B,M,N,O1,T1,O2,T2) +\end{tikzpicture} +\end{minipage} + +The last special case is when one of the points is on the initial line. In this case, there's only one solution. + +\vspace{6pt} +\begin{minipage}{0.5\textwidth} +\begin{Verbatim} +\directlua{ +init_elements () +z.A = point : new ( 0 , 0 ) +z.B = point : new ( 5 , 0 ) +z.M = point : new ( 1 , 0 ) +z.N = point : new ( 3 , 5 ) +L.AB = line:new(z.A,z.B) +L.MN = line:new(z.M,z.N) +z.I = intersection(L.AB,L.MN) +C1,C2 = L.AB : c_l_pp(z.M,z.N) +z.O1 = C1.center +z.O2 = C2.center +z.T1 = C1.through +z.T2 = C2.through +} +\begin{tikzpicture} +\tkzGetNodes +\tkzDrawLines(A,B M,N) +\tkzDrawCircles(O1,T1 O2,T2) +\tkzDrawPoints(A,B,M,N) +\tkzLabelPoints(A,B,M,N) +\tkzDrawPoints(A,B,M,N,O1,T1,O2,T2) +\end{tikzpicture} +\end{Verbatim} +\end{minipage} +\begin{minipage}{0.5\textwidth} +\directlua{ +init_elements () +z.A = point : new ( 0 , 0 ) +z.B = point : new ( 5 , 0 ) +z.M = point : new ( 1 , 0 ) +z.N = point : new ( 3 , 5 ) +L.AB = line:new(z.A,z.B) +L.MN = line:new(z.M,z.N) +z.I = intersection(L.AB,L.MN) +C1,C2 = L.AB : c_l_pp(z.M,z.N) +z.O1 = C1.center +z.O2 = C2.center +z.T1 = C1.through +z.T2 = C2.through +} +\begin{tikzpicture} +\tkzGetNodes +\tkzDrawLines(A,B M,N) +\tkzDrawCircles(O1,T1 O2,T2) +\tkzDrawPoints(A,B,M,N) +\tkzLabelPoints(A,B,M,N) +\tkzDrawPoints(A,B,M,N,O1,T1,O2,T2) +\end{tikzpicture} +\end{minipage} +% subsubsection c_l_pp (end) + +\subsubsection{Method \Imeth{line}{c\_ll\_p}} % (fold) +\label{ssub:method_c__ll__p} + + + +Let's consider two straight lines $(AB)$ and $(AC)$ and a point $P$ not belonging to these lines. +Is there a circle through $P$ tangent to these two lines? + +The following example shows that there are two solutions using the method linked to the line. A more natural method, linked to the $ABC$ triangle, can also be used. + +\vspace{6pt} +\begin{minipage}{0.5\textwidth} +\begin{Verbatim} + \directlua{ + init_elements() + scale =.75 + z.A = point : new ( 0 , 0 ) + z.B = point : new ( 6 , 0 ) + L.AB = line : new ( z.A,z.B ) + z.C = point : new ( 6 , 4 ) + L.AC = line : new ( z.A,z.C ) + T = triangle : new (z.A,z.B,z.C) + z.P = point : new ( 3 , 1 ) + C1,C2 = L.AB : c_ll_p (z.C,z.P) + z.O1 = C1.center + z.T1 = C1.through + z.O2 = C2.center + z.T2 = C2.through + } + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawLines[thick](A,B A,C) + \tkzDrawCircles[red](O1,T1 O2,T2) + \tkzDrawPoints(A,B,C,P) + \tkzLabelPoints(A,B,C,P) + \end{tikzpicture} +\end{Verbatim} +\end{minipage} +\begin{minipage}{0.5\textwidth} +\directlua{ +init_elements() + scale = .75 + z.A = point : new ( 0 , 0 ) + z.B = point : new ( 6 , 0 ) + L.AB = line : new ( z.A,z.B ) + z.C = point : new ( 6 , 4 ) + L.AC = line : new ( z.A,z.C ) + T = triangle : new (z.A,z.B,z.C) + z.P = point : new ( 3 , 1 ) + C1,C2 = L.AB : c_ll_p (z.C,z.P) + z.O1 = C1.center + z.T1 = C1.through + z.O2 = C2.center + z.T2 = C2.through +} +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawLines[thick](A,B A,C) + \tkzDrawCircles[red](O1,T1 O2,T2) + \tkzDrawPoints(A,B,C,P) + \tkzLabelPoints(A,B,C,P) + \end{tikzpicture} +\end{center} +\end{minipage} + +\vspace{6pt} + +The first special case is where the point $P$ lies on the bisector of $A$. + +\begin{minipage}{0.5\textwidth} +\begin{Verbatim} +\directlua{ +init_elements() +scale =.75 + z.A = point : new (0 , 0) + z.B = point : new (6 , 0) + L.AB = line : new ( z.A,z.B) + z.C = point : new ( 6 , 4) + L.AC = line : new ( z.A,z.C ) + T = triangle : new (z.A,z.B,z.C) + L.bi = bisector(z.A,z.B,z.C) + z.P = L.bi :point (0.4) + C1,C2 = L.AB : c_ll_p (z.C,z.P) + z.O1 = C1.center + z.T1 = C1.through + z.O2 = C2.center + z.T2 = C2.through +} +\begin{tikzpicture} +\tkzGetNodes +\tkzDrawLines(A,B A,C A,P) + \tkzDrawCircles(O1,T1 O2,T2) + \tkzDrawPoints(A,B,C,P) + \tkzLabelPoints(A,B,C,P) +\end{tikzpicture} +\end{Verbatim} +\end{minipage} +\begin{minipage}{0.5\textwidth} +\directlua{ +init_elements() +scale = .75 + z.A = point : new (0 , 0) + z.B = point : new (6 , 0) + L.AB = line : new ( z.A,z.B) + z.C = point : new ( 6 , 4) + L.AC = line : new ( z.A,z.C ) + T = triangle : new (z.A,z.B,z.C) + L.bi = bisector(z.A,z.B,z.C) + z.P = L.bi :point (0.4) + C1,C2 = L.AB : c_ll_p (z.C,z.P) + z.O1 = C1.center + z.T1 = C1.through + z.O2 = C2.center + z.T2 = C2.through +} +\begin{center} +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawLines(A,B A,C A,P) + \tkzDrawCircles(O1,T1 O2,T2) + \tkzDrawPoints(A,B,C,P) + \tkzLabelPoints(A,B,C,P) +\end{tikzpicture} +\end{center} +\end{minipage} + + +\vspace{6pt} +A first special case is when the point $P$ lies on one of the lines + +\vspace{6pt} +\begin{minipage}{0.5\textwidth} +\begin{Verbatim} +\directlua{ +init_elements() +scale =.75 + z.A = point:new(0, 0) + z.B = point:new(6, 0) + L.AB = line:new(z.A,z.B) + z.C = point:new(6, 4) + L.AC = line:new(z.A,z.C) + T = triangle:new(z.A,z.B,z.C) + z.P = point:new(3, 2) + L.bi = bisector(z.A,z.B,z.C) + z.I = L.bi:point(0.4) + C1,C2 = L.AB : c_ll_p (z.C,z.P) + z.O1 = C1.center + z.T1 = C1.through + z.O2 = C2.center + z.T2 = C2.through +} +\begin{tikzpicture} +\tkzGetNodes +\tkzDrawLines(A,B A,C A,I) + \tkzDrawCircles(O1,T1 O2,T2) + \tkzDrawPoints(A,B,C,P,I) + \tkzLabelPoints(A,B,C,P,I) +\end{tikzpicture} +\end{Verbatim} +\end{minipage} +\begin{minipage}{0.5\textwidth} +\directlua{ +init_elements() +scale = .75 + z.A = point : new ( 0 , 0 ) + z.B = point : new ( 6 , 0 ) + L.AB = line : new ( z.A,z.B ) + z.C = point : new ( 6 , 4 ) + L.AC = line : new ( z.A,z.C ) + T = triangle : new (z.A,z.B,z.C) + z.P = point : new ( 3 , 2 ) + L.bi = bisector(z.A,z.B,z.C) + z.I = L.bi.pb + C1,C2 = L.AB : c_ll_p (z.C,z.P) + z.O1 = C1.center + z.T1 = C1.through + z.O2 = C2.center + z.T2 = C2.through +} +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawLines(A,B A,C A,I) + \tkzDrawCircles(O1,T1 O2,T2) + \tkzDrawPoints(A,B,C,P,I) + \tkzLabelPoints(A,B,C,P,I) + \end{tikzpicture} +\end{center} +\end{minipage} + +%subsubsection method_c__ll__p (end) % subsection methods_from_class_line (end) diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-matrices.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-matrices.tex index 04b874532d..dfb17d2cc2 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-matrices.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-matrices.tex @@ -15,7 +15,7 @@ This \code{matrix} class has been created to avoid the need for an external libr \begin{itemize} -\item The first method is: (Refer to \ref{ssub:method_new}) +\item The first method is: [\ref{ssub:method_new}] \begin{minipage}{.5\textwidth} \begin{mybox} @@ -25,21 +25,22 @@ This \code{matrix} class has been created to avoid the need for an external libr \end{mybox} \end{minipage} \begin{minipage}{.5\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () M = matrix: new {{a,b},{c,d}} tex.print('M = ') M : print () - \end{tkzelements} + } \end{minipage} -\item It is also possible to obtain a square matrix with: (Refer to \ref{ssub:method_square}) +\item It is also possible to obtain a square matrix with: [\ref{ssub:method_square}] \begin{mybox} |M = matrix : square (2,a,b,c,d)| \end{mybox} -\item In the case of a column vector: (Refer to \ref{ssub:method_vector}) +\item In the case of a column vector: [\ref{ssub:method_vector}] \begin{minipage}{.5\textwidth} \begin{mybox} @@ -47,12 +48,13 @@ This \code{matrix} class has been created to avoid the need for an external libr \end{mybox} \end{minipage} \begin{minipage}{.5\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () V = matrix : vector (1,2,3) tex.print('V = ') V : print () - \end{tkzelements} + } \end{minipage} -\item Homogeneous transformation matrix (Refer to \ref{ssub:method_htm}) +\item Homogeneous transformation matrix [\ref{ssub:method_htm}] The objective is to generate a matrix with homogeneous coordinates capable of transforming a coordinate system through rotation, translation, and scaling. To achieve this, it is necessary to define both the rotation angle, the coordinates of the new origin ans the scaling factors. @@ -62,10 +64,11 @@ This \code{matrix} class has been created to avoid the need for an external libr \end{mybox} \end{minipage} \begin{minipage}{.5\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () H = matrix : htm (math.pi/3,1,2,2,1) tex.print('H = ') H: print () - \end{tkzelements} + } \end{minipage} \end{itemize} @@ -79,17 +82,19 @@ This method (Refer to \ref{ssub:method_print}) is necessary to control the resul \begin{minipage}{.5\textwidth} \begin{Verbatim} - \begin{tkzelements} + \directlua{% +init_elements () M = matrix : new {{1,-1},{2,0}} M : print () - \end{tkzelements} + } \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () M = matrix : new {{1,-1},{2,0}} M : print () - \end{tkzelements} + } \end{minipage} @@ -132,21 +137,23 @@ The number of rows is accessed with |M.rows| and the number of columns with |M.c \vspace{.5em} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () M = matrix : new ({{1,2,3},{4,5,6}}) M : print () tex.print("Rows: "..M.rows) tex.print("Cols: "..M.cols) -\end{tkzelements} +} \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () M = matrix : new ({{1,2,3},{4,5,6}}) M : print () tex.print("Rows: "..M.rows) tex.print("Cols: "..M.cols) -\end{tkzelements} +} \end{minipage} % subsubsection attribute_set (end) @@ -157,21 +164,23 @@ The matrix must be square. This library was created for matrices of dimension 2 \vspace{.5em} \begin{minipage}{.6\textwidth} \begin{Verbatim} - \begin{tkzelements} + \directlua{% +init_elements () M = matrix : square (3,1,1,0,2,-1,-2,1,-1,2) M : print () tex.print ('\\\\') tex.print ("Its determinant is: " .. M.det) - \end{tkzelements} + } \end{Verbatim} \end{minipage} \begin{minipage}{.4\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () M = matrix : square (3,1,1,0,2,-1,-2,1,-1,2) M : print () tex.print ('\\\\') tex.print ("Its determinant is: "..M.det) -\end{tkzelements} +} \end{minipage} % subsubsection determinant (end) @@ -180,25 +189,27 @@ tex.print ("Its determinant is: "..M.det) \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () a = point :new (1,-2) b = point :new (0,1) c = point :new (1,1) d = point :new (1,-1) A = matrix : new ({{a, b}, {c,d}}) tex.print(tostring(A.det)) -\end{tkzelements} +} \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () a = point :new (1,-2) b = point :new (0,1) c = point :new (1,1) d = point :new (1,-1) A = matrix : new ({{a, b}, {c,d}}) tex.print(tostring(A.det)) -\end{tkzelements} +} \end{minipage} % subsubsection determinant_with_complex_numbers (end) % subsection attibutes_of_a_matrix (end) @@ -238,7 +249,8 @@ To simplify the entries, I've used a few functions to simplify the displays. \vspace{.5em} \begin{minipage}{.6\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () A = matrix : new ({{1,2},{2,-1}}) B = matrix : new ({{-1,0},{1,3}}) S = A + B @@ -250,11 +262,12 @@ To simplify the entries, I've used a few functions to simplify the displays. dsp(S,'S') sym(" = ") dsp(A) sym(' + ') dsp(B) nl() nl() dsp(D,'D') sym(" = ") dsp(A) sym(' - ') dsp(B) -\end{tkzelements} +} \end{Verbatim} \end{minipage} \begin{minipage}{.4\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () local function dsp (M,name) if name then tex.print(name..' = ')print_matrix(M) @@ -279,7 +292,7 @@ nl() nl() dsp(S,'S') sym(" = ") dsp(A) sym(' + ') dsp(B) nl() nl() dsp(D,'D') sym(" = ") dsp(A) sym(' - ') dsp(B) -\end{tkzelements} +} \end{minipage} % subsubsection addition_of_matrices (end) @@ -290,7 +303,8 @@ To simplify the entries, I've used a few functions. You can find their definitio \begin{minipage}{.5\textwidth} \begin{Verbatim} - \begin{tkzelements} + \directlua{% +init_elements () A = matrix : new ({{1,2},{2,-1}}) B = matrix : new ({{-1,0},{1,3}}) P = A * B @@ -298,11 +312,12 @@ To simplify the entries, I've used a few functions. You can find their definitio C = A^3 K = 2 * A T = A^'T' - \end{tkzelements} + } \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () local function dsp (M,name) if name then tex.print(name..' = ')print_matrix(M) @@ -328,7 +343,7 @@ To simplify the entries, I've used a few functions. You can find their definitio nl() nl() dsp(A^('T'),"$A^{T}$") nl() nl() -\end{tkzelements} +} \end{minipage} \subsubsection{Metamethod \code{eq}} % (fold) @@ -378,7 +393,8 @@ This is the main method for creating a matrix. Here's an example of a 2x3 matrix \vspace{.5em} \begin{minipage}{.5\textwidth} \begin{Verbatim} - \begin{tkzelements} + \directlua{% +init_elements () a = point : new (1,0) b = point : new (1,1) c = point : new (-1,1) @@ -387,11 +403,12 @@ This is the main method for creating a matrix. Here's an example of a 2x3 matrix f = point : new (0,-1) M = matrix : new ({{a,b,c},{d,e,f}}) M : print () - \end{tkzelements} + } \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () a = point : new (1,0) b = point : new (1,1) c = point : new (-1,1) @@ -400,7 +417,7 @@ e = point : new (1,-1) f = point : new (0,-1) M = matrix : new ({{a,b,c},{d,e,f}}) M : print () -\end{tkzelements} +} \end{minipage} % subsubsection method_new (end) @@ -413,17 +430,19 @@ The special case of a column matrix, frequently used to represent a vector, can \vspace{.5em} \begin{minipage}{.5\textwidth} \begin{Verbatim} - \begin{tkzelements} + \directlua{% +init_elements () M = matrix : vector (1,2,3) M : print () - \end{tkzelements} + } \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () M = matrix : vector (1,2,3) M : print () - \end{tkzelements} + } \end{minipage} % subsubsection method_vector (end) @@ -442,7 +461,8 @@ which gives: \begin{minipage}{.5\textwidth} \begin{Verbatim} - \begin{tkzelements} + \directlua{% +init_elements () pi = math.pi M = matrix : htm (pi/4 , 3 , 1) z.A = point : new (2,-1) @@ -450,11 +470,12 @@ which gives: z.A.mtx : print () tex.print ('then after homogenization: ') V : print () - \end{tkzelements} + } \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () pi = math.pi M = matrix : htm (pi/4 , 3 , 1) z.A = point : new (2,-1) @@ -462,7 +483,7 @@ which gives: z.A.mtx : print () tex.print ('then after homogenization: ') V : print () -\end{tkzelements} +} \end{minipage} % subsubsection method_homogenization (end) @@ -481,11 +502,12 @@ The main method is to create the matrix: A 3x3 matrix is created which combines a $\pi/4$ rotation and a $\overrightarrow{t}=(3,1)$ translation. -\begin{tkzelements} +\directlua{% +init_elements () pi = math.pi M = matrix : htm (pi/4 , 3 , 1) M : print () -\end{tkzelements} +} Now we can apply the matrix M. Let $A$ be the point defined here: \ref{ssub:method_homogenization}. By homogenization, we obtain the column matrix $V$. @@ -495,7 +517,8 @@ Now we can apply the matrix M. Let $A$ be the point defined here: \ref{ssub:meth W = A * V \end{mybox} -\begin{tkzelements} +\directlua{% +init_elements () pi = math.pi M = matrix : htm (pi/4 , 3 , 1) M :print () @@ -504,7 +527,7 @@ V = z.A.mtx : homogenization () V : print () tex.print('=') W = M * V W : print () -\end{tkzelements} +} All that remains is to extract the coordinates of the new point. % subsubsection method_htm (end) @@ -518,21 +541,23 @@ The method \code{get\_htm\_point} extracts a point from a vector obtained afte \begin{minipage}{.5\textwidth} \begin{verbatim} -\begin{tkzelements} +\directlua{% +init_elements () W : print () z.P = get_htm_point(W) tex.print("The affix of $P$ is: ") tex.print(display(z.P)) -\end{tkzelements} +} \end{verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () W : print () z.P = get_htm_point(W) tex.print("The affix of $P$ is: ") tex.print(display(z.P)) -\end{tkzelements} +} \end{minipage} % subsubsection method_code_get__htm__point (end) @@ -548,7 +573,8 @@ The above operations can be simplified by using the \code{htm\_apply} method dir Then the method \code{htm\_apply} transforms a point, a list of points or an object. - \begin{tkzelements} + \directlua{% +init_elements () pi = math.pi M = matrix : htm (pi/4 , 3 , 1 ) z.O = point : new (0,0) @@ -566,11 +592,12 @@ z.K = point : new (2,2) T = triangle : new ( z.I , z.J , z.K ) Tp = M : htm_apply (T) z.Kp = Tp.pc -\end{tkzelements} +} \begin{minipage}{.6\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () pi = math.pi M = matrix : htm (pi/4 , 3 , 1 ) z.O = point : new (0,0) @@ -588,7 +615,7 @@ z.Kp = Tp.pc T = triangle : new ( z.I , z.J , z.K ) Tp = M : htm_apply (T) z.Kp = Tp.pc -\end{tkzelements} +} \end{Verbatim} \end{minipage} \begin{minipage}{.4\textwidth} @@ -609,7 +636,8 @@ New cartesian coordinates system: \vspace{.5 em} \begin{minipage}{.5\textwidth} \begin{verbatim} -\begin{tkzelements} +\directlua{% +init_elements () pi = math.pi tp = tex.print nl = '\\\\' @@ -625,11 +653,12 @@ New cartesian coordinates system: V : print () z.N = get_htm_point(V) tex.print(display(z.N)) -\end{tkzelements} +} \end{verbatim} \end{minipage} \begin{minipage}{.5\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () pi = math.pi tp = tex.print nl = '\\\\' @@ -645,7 +674,7 @@ New cartesian coordinates system: V : print () z.N = get_htm_point(V) tex.print(display(z.N)) - \end{tkzelements} + } \end{minipage} % subsubsection method_code_htm__apply (end) @@ -659,18 +688,20 @@ We have already seen this method in the presentation of matrices. We first need \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () M = matrix : square (2,2,3,-5,4) M : print () -\end{tkzelements} +} \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () M = matrix : square (2,2,3,-5,4) M : print () tex.print(S) -\end{tkzelements} +} \end{minipage} % subsubsection method_square (end) @@ -682,17 +713,19 @@ With the \pkg{amsmath} package loaded, this method can be used. By default, the \vspace{.5em} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () M = matrix : new ({{math.sqrt(2),math.sqrt(3)},{math.sqrt(4),math.sqrt(5)}}) M : print ('pmatrix') -\end{tkzelements} +} \end{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () M = matrix : new ({{math.sqrt(2),math.sqrt(3)},{math.sqrt(4),math.sqrt(5)}}) tkz_dc = 3 M : print ('pmatrix') -\end{tkzelements} +} \vspace{.5em} @@ -703,17 +736,19 @@ In the case of a square matrix, it is possible to transmit a list of values whos \vspace{.5em} \begin{minipage}{.5\textwidth} \begin{Verbatim} - \begin{tkzelements} + \directlua{% +init_elements () M = matrix : square (2,1,0,0,2) M : print () - \end{tkzelements} + } \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () M = matrix : square (2,1,0,0,2) M : print () - \end{tkzelements} + } \end{minipage} % subsubsection method_print (end) @@ -727,7 +762,8 @@ Below, $A$ is an array. It can be displayed as a simple array or as a matrix, bu \vspace{.5em} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () A = {{1,2},{1,-1}} tex.print ('A = ') print_array (A) tex.print (' or ') @@ -735,11 +771,12 @@ Below, $A$ is an array. It can be displayed as a simple array or as a matrix, bu M = matrix : new ({{1,1},{0,2}}) tex.print ('\\\\') tex.print ('M = ') M : print () -\end{tkzelements} +} \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () A = {{1,2},{1,-1}} tex.print ('A = ') print_array (A) tex.print (' or ') @@ -747,7 +784,7 @@ Below, $A$ is an array. It can be displayed as a simple array or as a matrix, bu M = matrix : new ({{1,1},{0,2}}) tex.print ('\\\\') tex.print ('M = ') M : print () -\end{tkzelements} +} \end{minipage} @@ -758,19 +795,21 @@ Below, $A$ is an array. It can be displayed as a simple array or as a matrix, bu \begin{minipage}{.5\textwidth} \begin{Verbatim} - \begin{tkzelements} + \directlua{% +init_elements () M = matrix : new {{1,2},{2,-1}} S = M: get(1,1) + M: get(2,2) tex.print(S) - \end{tkzelements} + } \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () M = matrix : new {{1,2},{2,-1}} S = M: get(1,1) + M: get(2,2) tex.print(S) -\end{tkzelements} +} \end{minipage} @@ -781,21 +820,23 @@ tex.print(S) \begin{minipage}{.6\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () A = matrix : new ({{1,2},{2,-1}}) tex.print("Inverse of $A = $") B = A : inverse () B : print () -\end{tkzelements} +} \end{Verbatim} \end{minipage} \begin{minipage}{.4\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () A = matrix : new ({{1,2},{2,-3}}) tex.print("Inverse of $A = $") B = A : inverse () B : print () -\end{tkzelements} +} \end{minipage} % subsubsection inverse_matrix (end) @@ -804,22 +845,24 @@ tex.print(S) \begin{minipage}{.6\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () M = matrix : new ({{1,0,1},{1,2, 1},{0,-1,2}}) tex.print("$M = $") print_matrix (M) tex.print('\\\\') tex.print("Inverse of $M = M^{-1} = $") print_matrix (M^-1) -\end{tkzelements} +} \end{Verbatim} \end{minipage} \begin{minipage}{.4\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () M = matrix : new ({{1,0,1},{1,2,1},{0,-1,2}}) tex.print("$M = $") print_matrix (M) tex.print('\\\\') tex.print("Inverse of $M = M^{-1} = $") print_matrix (M^-1) -\end{tkzelements} +} \end{minipage} % subsubsection inverse_matrix_with_power_syntax (end) @@ -832,21 +875,23 @@ A transposed matrix can be accessed with |A: transpose ()| or with |A^{'T'}|. \vspace{.5em} \begin{minipage}{.6\textwidth} \begin{Verbatim} - \begin{tkzelements} + \directlua{% +init_elements () A = matrix : new ({{1,2},{2,-1}}) AT = A : transpose () tex.print("$A^{'T'} = $") AT : print () - \end{tkzelements} + } \end{Verbatim} \end{minipage} \begin{minipage}{.4\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () A = matrix : new ({{1,2},{2,-1}}) AT = A : transpose () tex.print("$A^{'T'} = $") AT : print () - \end{tkzelements} + } \end{minipage} \vspace{.5em} @@ -860,7 +905,8 @@ Remark: |(A ^'T')^'T' = A| \begin{minipage}{.6\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () N = matrix : new {{1, 0, 3},{2, 1, 0},{-1, 2, 0}} tex.print('N = ') print_matrix(N) tex.print('\\\\') @@ -871,11 +917,12 @@ Remark: |(A ^'T')^'T' = A| tex.print('N $\\times$ adj(N) = ') print_matrix(N.i) tex.print('\\\\') tex.print('det(N) = ') tex.print(N.det) -\end{tkzelements} +} \end{Verbatim} \end{minipage} \begin{minipage}{.4\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () N = matrix : new {{1, 0, 3},{2, 1, 0},{-1, 2, 0}} tex.print('N = ') print_matrix(N) N.a = N : adjugate () @@ -885,7 +932,7 @@ Remark: |(A ^'T')^'T' = A| tex.print('N $\\times$ adj(N) = ') print_matrix(N.i) tex.print('\\\\') tex.print('det(N) = ') tex.print(N.det) -\end{tkzelements} +} \end{minipage} % subsubsection method_adjugate (end) @@ -898,17 +945,19 @@ Creating the identity matrix order 3 \begin{minipage}{.5\textwidth} \begin{Verbatim} - \begin{tkzelements} + \directlua{% +init_elements () Id_3 = matrix : identity (3) Id_3 : print () - \end{tkzelements} + } \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () Id_3 = matrix : identity (3) Id_3 : print () -\end{tkzelements} +} \end{minipage} % subsubsection methode_identity (end) @@ -922,7 +971,8 @@ For the moment, this method only concerns matrices of order 2. \begin{minipage}{.5\textwidth} \begin{Verbatim} - \begin{tkzelements} + \directlua{% +init_elements () A = matrix : new {{5,-3}, {6,-4}} tex.print('A = ') A : print () D,P = A : diagonalize () @@ -936,11 +986,12 @@ For the moment, this method only concerns matrices of order 2. tex.print('Verification: $P^{-1}P = $ ') T = P^(-1)*P T : print () - \end{tkzelements} + } \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () A = matrix : new {{5,-3}, {6,-4}} tex.print('A = ') A : print () D,P = A : diagonalize () @@ -954,7 +1005,7 @@ For the moment, this method only concerns matrices of order 2. tex.print('Verification: $P^{-1}P = $ ') T = P^(-1)*P T : print () - \end{tkzelements} + } \end{minipage} % subsubsection diagonalization (end) @@ -964,7 +1015,8 @@ For the moment, this method only concerns matrices of order 2. The method returns \code{true} if the matrix is orthogonal and \code{false} otherwise. \begin{Verbatim} - \begin{tkzelements} + \directlua{% +init_elements () local cos = math.cos local sin = math.sin local pi = math.pi @@ -983,10 +1035,11 @@ The method returns \code{true} if the matrix is orthogonal and \code{false} othe print_matrix(transposeMatrix (A)) tex.print('=') inv_matrix (A) : print () - \end{tkzelements} + } \end{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () local cos = math.cos local sin = math.sin local pi = math.pi @@ -1000,7 +1053,7 @@ tex.print('Test: $A^T = A^{-1} ?$') print_matrix(transposeMatrix (A)) tex.print('=') inv_matrix (A) : print () -\end{tkzelements} +} % subsubsection method_is_orthogonal (end) \subsubsection{Method \Imeth{matrix}{is\_diagonal}} % (fold) diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-misc.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-misc.tex index c8c5cccd8f..ac2641f52c 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-misc.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-misc.tex @@ -17,21 +17,22 @@ %tkzround( num, idp ) & \\ % Cramer33(a1,a2,a3,b1,b2,b3,c1,c2,c3) & \\ % Cramer22(a1,a2,b1,b2) & \\ -\Igfct{math}{length (a,b) } & point.abs(a-b) Refer to (\ref{ssub:report_de_distance}) \\ +\Igfct{math}{length (a,b) } & point.abs(a-b) [\ref{sub:report_de_distance}] \\ \Igfct{math}{islinear (z1,z2,z3) } & Are the points aligned? (z2-z1) $\parallel$ (z3-z1) ? \\ \Igfct{math}{isortho (z1,z2,z3)} & (z2-z1) $\perp$ (z3-z1) ? boolean\\ -\Igfct{math}{get\_angle (z1,z2,z3)} & the vertex is z1 Refer to (\ref{sub:get_angle}) \\ -\Igfct{math}{bisector (z1,z2,z3)} & L.Aa = bisector (z.A,z.B,z.C) from A (\ref{sub:get_angle})\\ -\Igfct{math}{bisector\_ext (z1,z2,z3)} & L.Aa = bisector_ext (z.A,z.B,z.C) from A \\ -\Igfct{math}{altitude (z1,z2,z3)} & altitude from z1 \\ +\Igfct{math}{get\_angle (z1,z2,z3)} & the vertex is z1 [\ref{sub:get_angle}] \\ +\Igfct{misc}{bisector (z1,z2,z3)} & L.Aa = bisector (z.A,z.B,z.C) from A [\ref{sub:get_angle}] \\ +\Igfct{misc}{bisector\_ext (z1,z2,z3)} & L.Aa = bisector_ext (z.A,z.B,z.C) from A \\ +\Igfct{misc}{altitude (z1,z2,z3)} & altitude from z1 \\ \Igfct{package}{set\_lua\_to\_tex (list)} & set\_lua\_to\_tex('a','n') defines |\a| and |\n| \\ -\Igfct{package}{tkzUseLua (variable)} & |\textbackslash\tkzUseLua{a}| prints the value of a\\ %parabola (a,b,c) & to get \\ \Igfct{math}{value (v) } & apply |scale * value | \\ \Igfct{math}{real (v) } & apply | value /scale | \\ \Igfct{math}{angle\_normalize (an) } & to get a value between 0 and $2\pi$ \\ \Igfct{misc}{barycenter (\{z1,n1\},\{z2,n2\}, ...)} & barycenter of list of points \\ -\Igfct{math}{solve\_quadratic (a,b,c) } & gives the solution of $ax^2+bx+c =0$ a,b,c real or complex (Refer to \ref{ssub:function_solve__quadratic})\\ +\Igfct{math}{solve\_quadratic (a,b,c) } & gives the solution of $ax^2+bx+c =0$ a,b,c real or complex [\ref{ssub:function_solve__quadratic}] \\ +\Igfct{misc}{midpoint (z1,z2)} & midpoint of the segment [\ref{ssub:euler_ellipse}] \\ +\Igfct{misc}{midpoints (z1,z2,...,zn)} & midpoints of z1z2, z2z3 etc. z1zn [\ref{sub:varignon_s_theorem}]\\ \bottomrule \end{tabular} \egroup @@ -39,20 +40,45 @@ \subsection{Length of a segment} % (fold) \label{sub:length_of_a_segment} |length(z.A,z.B)| is a shortcut for |point.abs(z.A-z.B)|. This avoids the need to use complexes. +It's also a shortcut for L.AB = line:new(z.A,z.B) and l = L.AB.length. Depending on the context, you'll need to choose the most appropriate method. % subsection length_of_a_segment (end) +\subsection{Midpoint and midpoints} % (fold) +\label{sub:midpoint_and_midpoints} +As with length, a shortcut is available, e.g. |z.M = midpoint(z.A,z.B)|. If a straight line is required, then use: |z.M = L.AB.mid|. + +The aim here is to determine the midpoints of a polygon. For example, considering a triangle $abc$, we can obtain the middles of the sides, after defining the triangle |T.abc = triangle:new(z.a,z.b,z.c)|, the middles are the vertices of the medial triangle |z.ma,z.mb,z.mc = T.abc : medial()|. + +\code{midpoints} is a shortcut for defining midpoints without using triangles: + + |z.mc,z.ma,z.mb = midpoints(z.a,z.b,z.c)|. + + The medial triangle can be omitted with |z.mc,z.ma,z.mb = midpoints(get_points(T.abc))|. +% subsection midpoint_and_midpoints (end) + +\subsection{Bisector} % (fold) +\label{sub:bisector} +As shown in the previous table, |bisector (z1,z2,z3)| defines the bisector of vertex |z1|. +% subsection bisector (end) + +\subsection{Barycenter} % (fold) +\label{sub:misc_barycenter} + +Explanations are given here: \ref{sub:barycenter} +% subsection barycenter (end) \subsection{Harmonic division with tkzphi } % (fold) \label{sub:harmonic_division_with_tkzphi} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale =.5 z.a = point: new(0,0) z.b = point: new(8,0) L.ab = line: new (z.a,z.b) z.m,z.n = L.ab: harmonic_both (tkzphi) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawLine[add= .2 and .2](a,n) @@ -62,28 +88,30 @@ \end{Verbatim} -\begin{tkzelements} - scale =.5 +\directlua{% +init_elements () + scale =.25 z.a = point: new(0,0) z.b = point: new(8,0) L.ab = line: new (z.a,z.b) z.m,z.n = L.ab: harmonic_both (tkzphi) -\end{tkzelements} +} \hspace*{\fill} \begin{tikzpicture} \tkzGetNodes - \tkzDrawLine[add= .2 and .2](a,n) + \tkzDrawLine[add= .1 and .1](a,n) \tkzDrawPoints(a,b,n,m) \tkzLabelPoints(a,b,n,m) \end{tikzpicture} \hspace*{\fill} % subsection harmonic_division_with_tkzphi (end) -\subsection{Function islinear} % (fold) +\subsection{Function islinear or is\_linear} % (fold) \label{sub:function_islinear} \begin{minipage}{0.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.a = point: new (1, 1) z.b = point: new (2, 2) z.c = point: new (4, 4) @@ -92,7 +120,7 @@ else z.d = point: new (-1, -1) end -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPoints(a,...,d) @@ -101,7 +129,8 @@ \end{Verbatim} \end{minipage} \begin{minipage}{0.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.a = point: new (1, 1) z.b = point: new (2, 2) z.c = point: new (4, 4) @@ -110,7 +139,7 @@ else z.d = point: new (-1, -1) end -\end{tkzelements} +} \hspace*{\fill} \begin{tikzpicture} \tkzGetNodes @@ -141,13 +170,14 @@ If |scale = 1.2| with a = 6 then real(a) = $6 / 1.2 = 5$ . \subsection{Transfer from lua to \TEX} % (fold) \label{sub:transfer_from_lua_to_tex} -It's possible to transfer variable from Lua to \TEX{} with -\Igfct{package}{\textbackslash{tkzUseLua}}. +It's possible to transfer variable from Lua to \TEX{} with the macro +\tkzcname{tkzUseLua}. \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new (0 , 0) z.B = point : new (3 , 2) z.C = point : new (2 , 5) @@ -155,7 +185,7 @@ It's possible to transfer variable from Lua to \TEX{} with d = L.AB : distance (z.C) l = L.AB.length z.H = L.AB : projection (z.C) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawLines(A,B C,H) @@ -167,7 +197,8 @@ It's possible to transfer variable from Lua to \TEX{} with \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new (0 , 0) z.B = point : new (3 , 2) z.C = point : new (2 , 5) @@ -175,7 +206,7 @@ It's possible to transfer variable from Lua to \TEX{} with d = L.AB : distance (z.C) l = L.AB.length z.H = L.AB : projection (z.C) -\end{tkzelements} +} \hspace*{\fill} \begin{tikzpicture} \tkzGetNodes @@ -191,7 +222,8 @@ It's possible to transfer variable from Lua to \TEX{} with \subsection{Normalized angles : Slope of lines (ab), (ac) and (ad)} % (fold) \label{sub:normalized_angles} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.a = point: new(0, 0) z.b = point: new(-3, -3) z.c = point: new(0, 3) @@ -204,16 +236,12 @@ It's possible to transfer variable from Lua to \TEX{} with tex.print('slope normalized of (ac) : '..tostring(angle\_normalize(angle))..'\\\\') angle = point.arg (z.d-z.a) tex.print('slope of (ad) : '..tostring(angle)..'\\\\') - tex.print('slope normalized of (acd) : '..tostring(angle\_normalize(angle))..'\\\\') -\end{tkzelements} -\begin{tikzpicture} - \tkzGetNodes - \tkzDrawLines[red](a,b a,c a,d) - \tkzDrawPoints(a,b,c,d) - \tkzLabelPoints(a,b,c,d) -\end{tikzpicture} + tex.print('slope normalized of (ad) : '..tostring(angle\_normalize(angle))..'\\\\') +} + \end{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .75 z.a = point: new(0, 0) z.b = point: new(-3, -3) @@ -228,16 +256,32 @@ tex.print('slope normalized of (ac) : '..tostring(angle_normalize(angle))..'\\\\ angle = point.arg (z.d-z.a) tex.print('slope of (ad) : '..tostring(angle)..'\\\\') tex.print('slope normalized of (ad) : '..tostring(angle_normalize(angle))..'\\\\') -\end{tkzelements} +} + +\begin{minipage}{.5\textwidth} +\begin{Verbatim} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawLines[red](a,b a,c a,d) + \tkzDrawPoints(a,b,c,d) + \tkzLabelPoints(a,b,c,d) + \end{tikzpicture} +\end{Verbatim} + +\end{minipage} +\begin{minipage}{.5\textwidth} + \begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawLines[red](a,b a,c a,d) + \tkzDrawPoints(a,b,c,d) + \tkzLabelPoints(a,b,c,d) + \end{tikzpicture} + \end{center} +\end{minipage} + + - \hspace*{\fill} -\begin{tikzpicture} - \tkzGetNodes - \tkzDrawLines[red](a,b a,c a,d) - \tkzDrawPoints(a,b,c,d) - \tkzLabelPoints(a,b,c,d) -\end{tikzpicture} - \hspace*{\fill} % subsection normalized_angles (end) @@ -248,13 +292,14 @@ The function |get_angle (a,b,c)| gives the angle normalized of $(\overrightarro \begin{minipage}{0.6\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.a = point: new(0, 0) z.b = point: new(-2, -2) z.c = point: new(0, 3) angcb = tkzround ( get_angle (z.a,z.c,z.b),3) angbc = tkzround ( get_angle (z.a,z.b,z.c),3) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes @@ -269,14 +314,15 @@ The function |get_angle (a,b,c)| gives the angle normalized of $(\overrightarro \end{Verbatim} \end{minipage} \begin{minipage}{0.4\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () scale = 1.2 z.a = point: new(0, 0) z.b = point: new(-2, -2) z.c = point: new(0, 3) angcb = tkzround ( get_angle (z.a,z.c,z.b),3) angbc = tkzround ( get_angle (z.a,z.b,z.c),3) -\end{tkzelements} +} \hspace*{\fill} \begin{tikzpicture} @@ -298,7 +344,8 @@ The function |get_angle (a,b,c)| gives the angle normalized of $(\overrightarro \begin{minipage}{0.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new(0,0) z.B = point: new(5,0) z.C = point: new(0,3) @@ -307,7 +354,7 @@ The function |get_angle (a,b,c)| gives the angle normalized of $(\overrightarro z.B_1, z.C_1 = get_points (T.ABC: anti ()) x = dot_product (z.A,z.B,z.C) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygon(A,B,C) @@ -319,7 +366,8 @@ The function |get_angle (a,b,c)| gives the angle normalized of $(\overrightarro \end{Verbatim} \end{minipage} \begin{minipage}{0.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () scale = .6 z.A = point: new(0,0) z.B = point: new(5,0) @@ -329,7 +377,7 @@ The function |get_angle (a,b,c)| gives the angle normalized of $(\overrightarro z.B_1, z.C_1 = get_points (T.ABC: anti ()) x = dot_product (z.A,z.B,z.C) -\end{tkzelements} +} \hspace*{\fill} \begin{tikzpicture} \tkzGetNodes @@ -359,7 +407,8 @@ These functions are useful if you don't need to create a useful triangle object \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.a = point: new (0, 0) z.b = point: new (5, -2) z.c = point: new (2, 3) @@ -368,7 +417,7 @@ These functions are useful if you don't need to create a useful triangle object angic = tkzround ( get_angle (z.a,z.i,z.c),2) angci = tkzround ( get_angle (z.a,z.b,z.i),2) z.e = bisector_ext (z.a,z.b,z.c).pb -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes @@ -385,7 +434,8 @@ These functions are useful if you don't need to create a useful triangle object \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.a = point: new (0, 0) z.b = point: new (5, -2) z.c = point: new (2, 3) @@ -394,7 +444,7 @@ These functions are useful if you don't need to create a useful triangle object angic = tkzround ( get_angle (z.a,z.i,z.c),2) angci = tkzround ( get_angle (z.a,z.b,z.i),2) z.e = bisector_ext (z.a,z.b,z.c).pb -\end{tkzelements} +} \hspace{\fill} \begin{tikzpicture} \tkzGetNodes @@ -425,7 +475,8 @@ This function solves the equation $ax^2+bx+c= 0$ with real or complex numbers. \begin{minipage}{.6\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () tex.sprint('Solve : $x^2+1=0$ The solution set is ') r1,r2 = solve_quadratic(1,0,1) tex.print('\\{'..tostring(r1)..' , '..tostring(r2)..'\\}') @@ -440,11 +491,12 @@ This function solves the equation $ax^2+bx+c= 0$ with real or complex numbers. tex.sprint('Solve : $ix^2+(1+i)x+(-1+i)=0$ The solution set is ') r1,r2 = solve_quadratic(a,b,c) tex.print('\\{'..tostring(r1)..' , '..tostring(r2)..'\\}') -\end{tkzelements} +} \end{Verbatim} \end{minipage} -\begin{tkzelements} +\directlua{% +init_elements () tex.sprint('Solve : $x^2+1=0$ The solution set is ') r1,r2 = solve_quadratic(1,0,1) tex.print('\\{'..tostring(r1)..' , '..tostring(r2)..'\\}') @@ -459,7 +511,7 @@ This function solves the equation $ax^2+bx+c= 0$ with real or complex numbers. tex.sprint('Solve : $ix^2+(1+i)x+(-1+i)=0$ The solution set is ') r1,r2 = solve_quadratic(a,b,c) tex.print('\\{'..tostring(r1)..' , '..tostring(r2)..'\\}') -\end{tkzelements} +} % subsubsection function_solve__quadratic (end) % section math_functions (end) diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-parallelogram.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-parallelogram.tex index 6088f6cfb3..3ff936a8a8 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-parallelogram.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-parallelogram.tex @@ -39,7 +39,8 @@ Creation | P.new = parallelogram : new (z.A,z.B,z.C,z.D)| % subsubsection example_attributes (end) \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 0 , 0 ) z.B = point : new ( 4 , 1 ) z.C = point : new ( 7 , 5 ) @@ -49,7 +50,7 @@ z.B = P.new.pb z.C = P.new.pc z.D = P.new.pd z.I = P.new.center -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygon(A,B,C,D) @@ -61,7 +62,8 @@ z.I = P.new.center \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 0 , 0 ) z.B = point : new ( 4 , 1 ) z.C = point : new ( 7 , 5 ) @@ -71,7 +73,7 @@ z.B = P.new.pb z.C = P.new.pc z.D = P.new.pd z.I = P.new.center -\end{tkzelements} +} \hspace{\fill} \begin{tikzpicture} \tkzGetNodes @@ -103,21 +105,22 @@ z.I = P.new.center \end{tabular} \egroup -\subsubsection{parallelogram with fourth method} % (fold) +\subsubsection{Parallelogram with fourth method} % (fold) \label{ssub:parallelogram_with_fourth_method} % subsubsection parallelogram_with_fourth_method (end) \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .75 z.A = point : new ( 0 , 0 ) -z.B = point : new ( 4 , 1 ) -z.C = point : new ( 5 , 3 ) +z.B = point : new ( 3 , 1 ) +z.C = point : new ( 4 , 3 ) P.four = parallelogram : fourth (z.A,z.B,z.C) z.D = P.four.pd z.I = P.four.center -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygon(A,B,C,D) @@ -129,14 +132,16 @@ z.I = P.four.center \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () + scale = .75 z.A = point : new ( 0 , 0 ) -z.B = point : new ( 4 , 1 ) -z.C = point : new ( 5 , 3 ) +z.B = point : new ( 3 , 1 ) +z.C = point : new ( 4 , 3 ) P.four = parallelogram : fourth (z.A,z.B,z.C) z.D = P.four.pd z.I = P.four.center -\end{tkzelements} +} \hspace{\fill} \begin{tikzpicture} @@ -147,5 +152,6 @@ z.I = P.four.center \tkzLabelPoints[above](C,D) \tkzDrawPoints[red](I) \end{tikzpicture} +\hspace{\fill} \end{minipage} % subsubsection parallelogram_with_side_method (end) diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-point.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-point.tex index e404dc763b..5dcea5febc 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-point.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-point.tex @@ -3,7 +3,7 @@ \section{Class \Iclass{point}} % (fold) \label{sec:class_point} -The foundation of the entire framework is the \Iclass{point} class. This class is hybrid in the sense that it deals with both points in a plane and complex numbers. The principle is as follows: the plane is equipped with an orthonormal basis, which allows us to determine the position of a point using its abscissa and ordinate coordinate. Similarly, any complex number can be viewed simply as a pair of real numbers (its real part and its imaginary part). We can then designate the plane as the complex plane, and the complex number $x+iy$ is represented by the point of the plane with coordinates $(x,y)$. Thus the point $A$ will have coordinates stored in the object $z.A$. Coordinates are attributes of the "point" object, along with type, argument, and modulus. +The foundation of the entire framework is the \Iclass{point} class. This class is hybrid in the sense that it deals with both points in a plane and complex numbers. The principle is as follows: the plane is equipped with an orthonormal basis, which allows us to determine the position of a point using its abscissa and ordinate coordinate. Similarly, any complex number can be viewed simply as a pair of real numbers (its real part and its imaginary part). We can then designate the plane as the complex plane, and the complex number $x+iy$ is represented by the point of the plane with coordinates $(x,y)$. Thus the point $A$ will have coordinates stored in the object $z.A$. Coordinates are attributes of the \code{point} object, along with type, argument, and modulus. @@ -19,13 +19,14 @@ The creation of a point is done using the following method, but there are other \tikz\node[minimum width=\size,font=\small, draw, fill=cyan!10, - rectangle split, rectangle split parts=5 + rectangle split, rectangle split parts=6 ] { \texttt{re (real)} \nodepart{two}\texttt{im (real)} \nodepart{three}\texttt{type = 'point'} \nodepart{four}\texttt{argument (rad)} \nodepart{five}\texttt{modulus (cm)} + \nodepart{six}\texttt{mtx (matrix)} }; \hspace{\fill} \texttt{Methods}\hspace{\fill} @@ -51,13 +52,14 @@ The creation of a point is done using the following method, but there are other \tikz\node[minimum width=\size,font=\small, draw, fill=cyan!10, - rectangle split, rectangle split parts=5 + rectangle split, rectangle split parts=6 ] { \texttt{re = 1} \nodepart{two}\texttt{im = 2} \nodepart{three}\texttt{type = 'point'} \nodepart{four}\texttt{argument = atan(2)} \nodepart{five}\texttt{modulus = $\sqrt{5}$} + \nodepart{six}\texttt{mtx = \{\{1\},\{2\}\}} }; \hspace{\fill} \texttt{Methods}\hspace{\fill} @@ -86,13 +88,13 @@ The creation of a point is done using the following method, but there are other % Method \Imeth{point}{new} \begin{mybox} - Creation |z.A = point: new (1,2) | + Creation \\ + |z.A = point: new (1,2) | \end{mybox} The point $A$ has coordinates $x=1$ and $y=2$. If you use the notation |z.A|, then $A$ will be referenced as a node in \TIKZ\ or in \pkg{tkz-euclide}. This is the creation of a fixed point with coordinates 1 and 2 and which is named $A$. The notation |z.A| indicates that the coordinates will be stored in a table denoted as |z| (reference to the notation of the affixes of the complex numbers) that $A$ is the name of the point and the key allowing access to the values. - \begin{center} \bgroup \small @@ -101,33 +103,32 @@ This is the creation of a fixed point with coordinates 1 and 2 and which is name \begin{tabular}{lll} \toprule \textbf{Attributes} & \textbf{Application}& \textbf{Example}\\ - \Iattr{point}{re} & |z.A.re = 1| & Refer to (\ref{ssub:methods}) \\ - \Iattr{point}{im} & |z.A.im = 2| & Refer to (\ref{ssub:methods}) \\ + \Iattr{point}{re} & |z.A.re = 1| & [\ref{ssub:methods}] \\ + \Iattr{point}{im} & |z.A.im = 2| & [\ref{ssub:methods}] \\ \Iattr{point}{type} & |z.A.type = 'point'| & \\ - \Iattr{point}{argument} & |z.A.argument $\approx$ 0.78539816339745| & Refer to (\ref{ssub:example_point_attributes})\\ - \Iattr{point}{modulus} & |z.A.modulus| $\approx$ |2.2360...| =$\sqrt{5}$ & Refer to (\ref{ssub:example_point_attributes})\\ + \Iattr{point}{argument} & |z.A.argument| $\approx$ |0.78539816339745| & [\ref{ssub:example_point_attributes}] \\ + \Iattr{point}{modulus} & |z.A.modulus| $\approx$ |2.2360...| =$\sqrt{5}$ & [\ref{ssub:example_point_attributes}] \\ + \Iattr{point}{mtx} & |z.A.mtx = = {{1},{2}}| & [\ref{ssub:example_point_attributes}] \\ \bottomrule \end{tabular} \egroup \end{center} - - - \newpage -\subsubsection{Example:point attributes} % (fold) +\subsubsection{Example: point attributes} % (fold) \label{ssub:example_point_attributes} -\begin{tkzelements} +\directlua{ +init_elements () z.M = point: new (1,2) -\end{tkzelements} +} \hspace*{\fill} \begin{Verbatim} -\begin{tkzelements} - z.M = point: new (1,2) -\end{tkzelements} +\directlua{ + init_elements () + z.M = point: new (1,2)} \end{Verbatim} \pgfkeys{/pgf/number format/.cd,std,precision=2} \let\pmpn\pgfmathprintnumber @@ -176,35 +177,62 @@ $|z_M| =\sqrt{5}\approx \pmpn{\tkzUseLua{z.M.modulus}}$ cm} \begin{scope}[every annotation/.style={fill=lightgray!15,anchor = east}] \node [annotation,font =\small,text width=6cm] at (current bounding box.west) { Attributes of \texttt{z.M} - \begin{itemize} - \item \texttt{z.M.re} = 1 - \item \texttt{z.M.im} = 2 - \item \texttt{z.M.type} = 'point' - \item \texttt{z.M.argument} = $\theta \approx \pmpn{\tkzUseLua{z.M.argument}}$ rad - \item \texttt{z.M.modulus} = $|z_M| =\sqrt{5}\approx \pmpn{\tkzUseLua{z.M.modulus}}$ cm - \end{itemize} + \begin{mybox}{} + \begin{itemize} + \item \texttt{z.M.re} = 1 + \item \texttt{z.M.im} = 2 + \item \texttt{z.M.type} = 'point' + \item \texttt{z.M.argument} = $\theta \approx \pmpn{\tkzUseLua{z.M.argument}}$ rad + \item \texttt{z.M.modulus} = $|z_M| =\sqrt{5}\approx \pmpn{\tkzUseLua{z.M.modulus}}$ cm + \item \texttt{z.M.mtx} = \tkzUseLua{z.M.mtx : print ()} + \end{itemize} + \end{mybox} }; \end{scope} \end{tikzpicture} \end{center} \MakeShortVerb{\|} - \hspace*{\fill} -% \caption{Class Point} + +\subsubsection{Attribute \Iattr{point}{mtx}} % (fold) +\label{ssub:attribute_iattr_point_mtx} + +This method allows the point to be used in conjunction with matrices. + +\vspace{6pt} +\begin{minipage}{.5\textwidth} +\begin{Verbatim} + \directlua{ + z.A = point : new (2,-1) + z.A.mtx : print () + } +\end{Verbatim} +\end{minipage} + \begin{minipage}{.5\textwidth} + \begin{center} + \directlua{ + z.A = point : new (2,-1) + z.A.mtx : print () + } + \end{center} + \end{minipage} +% subsubsection attribute_iattr_point_mtx (end) % subsubsection example_point_attributes (end) % subsection attributes_of_a_point (end) + \subsubsection{Argand diagram} % (fold) \label{ssub:argand_diagram} \normalsize \begin{minipage}{\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{ +init_elements () z.A = point : new ( 2 , 3 ) z.O = point : new ( 0 , 0 ) z.I = point : new ( 1 , 0 ) -\end{tkzelements} -\hspace{\fill}\begin{tikzpicture} +} +\begin{tikzpicture} \tkzGetNodes \tkzInit[xmin=-4,ymin=-4,xmax=4,ymax=4] \tkzDrawCircle[dashed,red](O,A) @@ -220,24 +248,26 @@ Attributes of \texttt{z.M} \end{minipage} \begin{minipage}{\textwidth} - \begin{tkzelements} +\directlua{ +init_elements () z.A = point : new ( 2 , 3 ) z.O = point : new ( 0 , 0 ) z.I = point : new ( 1 , 0 ) - \end{tkzelements} - \hspace{\fill}\begin{tikzpicture} - \tkzGetNodes - \tkzInit[xmin=-4,ymin=-4,xmax=4,ymax=4] - \tkzDrawCircle[dashed,red](O,A) - \tkzPointShowCoord(A) - \tkzDrawPoint(A) - \tkzLabelPoint[above right](A){\normalsize $a+ib$} - \tkzDrawX\tkzDrawY - \tkzDrawSegment(O,A) - \tkzLabelSegment[above,anchor=south,sloped](O,A){ OA = modulus of $z_A$} - \tkzLabelAngle[anchor=west,pos=.5](I,O,A){$\theta$ = argument of $z_A$} - \end{tikzpicture} - \hspace{\fill} +} +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzInit[xmin=-4,ymin=-4,xmax=4,ymax=4] + \tkzDrawCircle[dashed,red](O,A) + \tkzPointShowCoord(A) + \tkzDrawPoint(A) + \tkzLabelPoint[above right](A){\normalsize $a+ib$} + \tkzDrawX\tkzDrawY + \tkzDrawSegment(O,A) + \tkzLabelSegment[above,anchor=south,sloped](O,A){ OA = modulus of $z_A$} + \tkzLabelAngle[anchor=west,pos=.5](I,O,A){$\theta$ = argument of $z_A$} + \end{tikzpicture} +\end{center} \end{minipage} @@ -257,37 +287,37 @@ The methods described in the following table are standard and can be found in mo \toprule \textbf{Functions} & \textbf{Application}& \\ \midrule -\Igfct{point}{new(r,r)} & |z.A = point : new(1,2)| & Refer to (\ref{ssub:method_normalize}) \\ -\Igfct{point}{polar (d,an)} & |z.A = point : polar(1,math.pi/3)| & Refer to (\ref{sub:archimedes} )\\ +\Igfct{point}{new(r,r)} & |z.A = point : new(1,2)| & [\ref{ssub:method_normalize}] \\ +\Igfct{point}{polar (d,an)} & |z.A = point : polar(1,math.pi/3)| & [\ref{sub:archimedes}] \\ \Igfct{point}{polar\_deg (d,an)} & an in deg & polar coordinates an deg \\ \midrule \textbf{Methods} & \textbf{Application}& \\ \midrule \textbf{Points} &&\\ \midrule -\Imeth{point}{north(r)} & |r| distance to the point (1 if empty) & Refer to (\ref{sub:power_v2}) ; \ref{ssub:methods}) \\ +\Imeth{point}{north(r)} & |r| distance to the point (1 if empty) & [\ref{ssub:power_v2} ; \ref{ssub:methods}] \\ \Imeth{point}{south(r)} & & \\ \Imeth{point}{east(r)} & & \\ \Imeth{point}{west(r)} & & \\ -\Imeth{point}{normalize()} & |z.b = z.a: normalize ()| & Refer to (\ref{ssub:method_normalize}) \\ -\Imeth{point}{get\_points (obj)} & retrieves points from the object & \\ -\Imeth{point}{orthogonal (d)} & |z.B=z.A:orthogonal(d)| & $\overrightarrow{OB}\perp \overrightarrow{OA}$ and $OB=d$\\ -\Imeth{point}{at ()} & |z.X = z.B : at (z.A)| & $\overrightarrow{OB}= \overrightarrow{AX}$ and $OB=d$\\ +\Imeth{point}{normalize()} & |z.b = z.a: normalize ()| & [\ref{ssub:method_normalize}] \\ +\Imeth{point}{get\_points (obj)} & retrieves points from the object & [\ref{ssub:object_rotation}; \ref{ssub:apollonius_circle_ma_mb_k} ] \\ +\Imeth{point}{orthogonal (d)} & |z.B=z.A:orthogonal(d)| & $\overrightarrow{OB}\perp \overrightarrow{OA}$ and $OB=d$. [\ref{ssub:orthogonal_method}]\\ +\Imeth{point}{at ()} & |z.X = z.B : at (z.A)| & $\overrightarrow{OB}= \overrightarrow{AX}$ and $OB=d$. [\ref{ssub:_imeth_point_at_method}] \\ \midrule \textbf{Transformations} &&\\ \midrule - \Imeth{point}{symmetry(obj)} & obj : point, line, etc. & Refer to (\ref{ssub:object_symmetry}) \\ - \Imeth{point}{rotation(an , obj)} & point, line, etc. & Refer to (\ref{ssub:object_rotation})\\ - \Imeth{point}{homothety(r,obj)} & |z.c = z.a : homothety (2,z.b)| & Refer to (\ref{sub:homothety}) \\ + \Imeth{point}{symmetry(obj)} & obj : point, line, etc. & [\ref{ssub:object_symmetry}] \\ + \Imeth{point}{rotation(an , obj)} & point, line, etc. & [\ref{ssub:object_rotation}] \\ + \Imeth{point}{homothety(r,obj)} & |z.c = z.a : homothety (2,z.b)| & [\ref{sub:homothety}] \\ \midrule \textbf{Misc.} &&\\ \midrule - \Imeth{point}{print()} & displays the affix of the point & Refer to (\ref{ssub:object_symmetry}) \\ + \Imeth{point}{print()} & displays the affix of the point & [\ref{ssub:object_symmetry} ]\\ \bottomrule % \end{tabular} \egroup -\subsubsection{Example: method \Imeth{point}{north (d)} } % (fold) +\subsubsection{Method \Imeth{point}{north (d)} } % (fold) \label{ssub:example_method_imeth_point_north_d} This function defines a point located on a vertical line passing through the given point. This function is useful if you want to report a certain distance (Refer to the following example). @@ -295,14 +325,15 @@ If |d| is absent then it is considered equal to 1. \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{ + init_elements () z.O = point : new ( 0, 0 ) z.A = z.O : east () z.Ap = z.O : east (2) : north (2) z.B = z.O : north () z.C = z.O : west () z.D = z.O : south () -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygon(A,B,C,D) @@ -311,7 +342,8 @@ If |d| is absent then it is considered equal to 1. \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{ + init_elements () scale = 1.5 z.O = point : new ( 0, 0 ) z.A = z.O : east () @@ -319,110 +351,67 @@ If |d| is absent then it is considered equal to 1. z.B = z.O : north () z.C = z.O : west () z.D = z.O : south () -\end{tkzelements} -\hspace{\fill} -\begin{tikzpicture} - \tkzGetNodes - \tkzDrawPolygon(A,B,C,D) - \tkzDrawPoints(A,B,C,D,O,A') - \tkzLabelPoints(A,B,C,D,O,A') -\end{tikzpicture} -\end{minipage} -% subsubsection example_method_imeth_point_north_d (end) +} +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygon(A,B,C,D) + \tkzDrawPoints(A,B,C,D,O,A') + \tkzLabelPoints(A,B,C,D,O,A') + \end{tikzpicture} +\end{center} -\subsubsection{Length transfer} % (fold) -\label{ssub:report_de_distance} - -Use of |north and east| functions linked to points, to transfer lengths, Refer to (\ref{sub:length_of_a_segment}) - -\begin{minipage}{.4\textwidth} -\begin{Verbatim} -\begin{tkzelements} - z.A = point : new ( 0 , 0 ) - z.B = point : new ( 3 , 0 ) - L.AB = line : new ( z.A , z.B ) - T.ABC = L.AB : sublime () - z.C = T.ABC.pc - z.D = z.B: north (length(z.B,z.C)) - z.E = z.B: east (L.AB.length) - z.M = L.AB.mid - z.F = z.E : north (length(z.C,z.M)) -\end{tkzelements} -\begin{tikzpicture}[gridded] - \tkzGetNodes - \tkzDrawPolygons(A,B,C) - \tkzDrawSegments[gray,dashed](B,D B,E E,F C,M) - \tkzDrawPoints(A,...,F) - \tkzLabelPoints(A,B,E,M) - \tkzLabelPoints[above right](C,D,F) -\end{tikzpicture} -\end{Verbatim} -\end{minipage} -\begin{minipage}{.6\textwidth} -\begin{tkzelements} - z.A = point : new ( 0 , 0 ) - z.B = point : new ( 3 , 0 ) - L.AB = line : new ( z.A , z.B ) - T.ABC = L.AB : sublime () - z.C = T.ABC.pc - z.D = z.B: north (length(z.B,z.C)) - z.E = z.B: east (L.AB.length) - z.M = L.AB.mid - z.F = z.E : north (length(z.C,z.M)) -\end{tkzelements} -\hspace{\fill} -\begin{tikzpicture}[gridded] - \tkzGetNodes - \tkzDrawPolygons(A,B,C) - \tkzDrawSegments[gray,dashed](B,D B,E E,F C,M) - \tkzDrawPoints(A,...,F) - \tkzLabelPoints(A,B,E,M) - \tkzLabelPoints[above right](C,D,F) -\end{tikzpicture} \end{minipage} -% subsubsection report_de_distance (end) +% subsubsection example_method_imeth_point_north_d (end) -\subsubsection{Example: method \Imeth{point}{polar} } % (fold) +\subsubsection{Method \Imeth{point}{polar} } % (fold) \label{ssub:example_polar_method} This involves defining a point using its modulus and argument. \begin{minipage}{0.6\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{ + init_elements () z.O = point: new (0, 0) z.A = point: new (3, 0) z.F = point: polar (3, math.pi/3) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircle(O,A) \tkzDrawSegments[new](O,A) \tkzDrawSegments[purple](O,F) \tkzDrawPoints(A,O,F) - \tkzLabelPoints[below right=6pt](A,O,F) + \tkzLabelPoints[below right=6pt](A,O) + \tkzLabelPoints[above](F) \end{tikzpicture} \end{Verbatim} \end{minipage} \begin{minipage}{0.4\textwidth} -\begin{tkzelements} +\directlua{ +init_elements () scale = .75 z.O = point: new (0, 0) z.A = point: new (3, 0) z.F = point: polar (3, math.pi/3) -\end{tkzelements} -\hspace*{\fill} -\begin{tikzpicture} -\tkzGetNodes -\tkzDrawCircle(O,A) -\tkzDrawSegments[new](O,A) -\tkzDrawSegments[purple](O,F) -\tkzDrawPoints(A,O,F) -\tkzLabelPoints(A,O,F) -\end{tikzpicture} -\hspace*{\fill} +} + +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircle(O,A) + \tkzDrawSegments[new](O,A) + \tkzDrawSegments[purple](O,F) + \tkzDrawPoints(A,O,F) + \tkzLabelPoints[below right=6pt](A,O) + \tkzLabelPoints[above](F) + \end{tikzpicture} +\end{center} + + \end{minipage} % subsubsection example_polar_method (end) @@ -431,15 +420,27 @@ This involves defining a point using its modulus and argument. The result is a point located between the origin and the initial point at a distance of $1$ from the origin. -\begin{minipage}{.4\textwidth} +\directlua{ +init_elements () +scale = 1.5 +z.O = point : new (0,0) +z.A = point : new (2,1) +z.B = z.A : normalize () +z.I = point : new (1,0) +} + + + +\begin{minipage}{0.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{ +init_elements () scale = 1.5 z.O = point : new (0,0) z.A = point : new (1,2) z.B = z.A : normalize () z.I = point : new (1,0) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawSegment(O,A) @@ -450,40 +451,37 @@ The result is a point located between the origin and the initial point at a dist \end{tikzpicture} \end{Verbatim} \end{minipage} -\begin{minipage}{.6\textwidth} -\begin{tkzelements} -scale = 1.5 -z.O = point : new (0,0) -z.A = point : new (1,2) -z.B = z.A : normalize () -z.I = point : new (1,0) -\end{tkzelements} - \hspace*{\fill} -\begin{tikzpicture} -\tkzGetNodes -\tkzDrawSegment(O,A) -\tkzDrawCircle(O,B) -\tkzDrawPoints(O,A,B,I) -\tkzLabelPoints(O,A,B) -\tkzLabelPoint[below right](I){$1$} -\end{tikzpicture} - \hspace*{\fill} -\end{minipage} +\begin{minipage}{0.5\textwidth} +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawSegment(O,A) + \tkzDrawCircle(O,B) + \tkzDrawPoints(O,A,B,I) + \tkzLabelPoints(O,A) + \tkzLabelPoints[above](B) + \tkzLabelPoint[below right](I){$1$} + \end{tikzpicture} +\end{center} + \end{minipage} + + % subsubsection method_normalize (end) -\subsubsection{\Imeth{point}{Orthogonal (d)} method} % (fold) +\subsubsection{Method \Imeth{point}{orthogonal (d)}} % (fold) \label{ssub:orthogonal_method} -Let $O$ be the origin of the plane. The "orthogonal (d)" method is used to obtain a point $B$ from a point $A$ such that $\overrightarrow{OB}\perp \overrightarrow{OA}$ with $OB=OA$ if $d$ is empty, otherwise $OB = d$. +Let $O$ be the origin of the plane. The \code{orthogonal (d)} method is used to obtain a point $B$ from a point $A$ such that $\overrightarrow{OB}\perp \overrightarrow{OA}$ with $OB=OA$ if $d$ is empty, otherwise $OB = d$. \begin{minipage}{.6\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{ +init_elements () z.A = point : new ( 3 , 1 ) z.B = z.A : orthogonal (1) z.O = point : new ( 0,0 ) z.C = z.A : orthogonal () -\end{tkzelements} +} \begin{tikzpicture}[gridded] \tkzGetNodes \tkzDrawSegments(O,A O,C) @@ -493,98 +491,107 @@ Let $O$ be the origin of the plane. The "orthogonal (d)" method is used to obtai \end{Verbatim} \end{minipage} \begin{minipage}{.4\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 3 , 1 ) z.B = z.A : orthogonal (1) z.O = point : new ( 0,0 ) z.C = z.A : orthogonal () -\end{tkzelements} -\begin{tikzpicture}[gridded] - \tkzGetNodes - \tkzDrawSegments(O,A O,C) - \tkzDrawPoints(O,A,B,C) - \tkzLabelPoints[below right](O,A,B,C) -\end{tikzpicture} +} +\begin{center} + \begin{tikzpicture}[gridded] + \tkzGetNodes + \tkzDrawSegments(O,A O,C) + \tkzDrawPoints(O,A,B,C) + \tkzLabelPoints[below right](O,A,B,C) + \end{tikzpicture} +\end{center} + \end{minipage} % subsubsection orthogonal_method (end) -\subsubsection{\Imeth{point}{at} method} % (fold) +\subsubsection{Method \Imeth{point}{at}} % (fold) \label{ssub:_imeth_point_at_method} This method is complementary to the previous one, so you may not wish to have $\overrightarrow{OB}\perp \overrightarrow{OA}$ but $\overrightarrow{AB}\perp \overrightarrow{OA}$. \begin{minipage}{.6\textwidth} \begin{Verbatim} -\begin{tkzelements} - z.A = point : new ( 3 , 1 ) - z.B = z.A : orthogonal (1) - z.O = point : new ( 0,0 ) - -- z.B = z.B : at (z.A) -- or - z.B = z.A : orthogonal (1) : at (z.A) - z.C = z.A+z.B - z.D =(z.C-z.A):orthogonal(2) : at (z.C) -\end{tkzelements} -\begin{tikzpicture}[gridded] +\directlua{% +init_elements () +z.O = point : new ( 0,0 ) +z.A = point : new ( 3 , 2 ) +z.B = z.A : orthogonal (1) +z.C = z.A+z.B +z.D =(z.C-z.A):orthogonal(2) : at (z.C) +} + \begin{tikzpicture}[gridded] \tkzGetNodes - \tkzLabelPoints[below right](O,A,B,C,D) - \tkzDrawSegments(O,A A,B A,C C,D) + \tkzLabelPoints[below right](O,A,C) + \tkzLabelPoints[above](B,D) + \tkzDrawSegments(O,A A,B A,C C,D O,B) \tkzDrawPoints(O,A,B,C,D) -\end{tikzpicture} + \end{tikzpicture} \end{Verbatim} \end{minipage} \begin{minipage}{.4\textwidth} -\begin{tkzelements} -z.A = point : new ( 3 , 1 ) -z.B = z.A : orthogonal (1) +\directlua{% +init_elements () z.O = point : new ( 0,0 ) --- z.B = z.B : at (z.A) -- or -z.B = z.A : orthogonal (1) : at (z.A) +z.A = point : new ( 3 , 2 ) +z.B = z.A : orthogonal (1) z.C = z.A+z.B z.D =(z.C-z.A):orthogonal(2) : at (z.C) -\end{tkzelements} -\begin{tikzpicture}[gridded] -\tkzGetNodes -\tkzLabelPoints[below right](O,A,B,C,D) -\tkzDrawSegments(O,A A,B A,C C,D) -\tkzDrawPoints(O,A,B,C,D) -\end{tikzpicture} +} +\begin{center} + \begin{tikzpicture}[gridded] + \tkzGetNodes + \tkzLabelPoints[below right](O,A,C) + \tkzLabelPoints[above](B,D) + \tkzDrawSegments(O,A A,B A,C C,D O,B) + \tkzDrawPoints(O,A,B,C,D) + \end{tikzpicture} +\end{center} \end{minipage} % subsubsection _imeth_point_at_method (end) -\subsubsection{Example: \Imeth{point}{rotation of points}} % (fold) +\subsubsection{Method \Imeth{point}{rotation} first example} % (fold) \label{ssub:example_rotation_of_points} The arguments are the angle of rotation in radians, and here a list of points. \begin{minipage}{.6\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.a = point: new(0, -1) z.b = point: new(4, 0) z.o = point: new(6, -2) z.ap,z.bp = z.o : rotation (math.pi/2,z.a,z.b) -\end{tkzelements} - \begin{tikzpicture} - \tkzGetNodes - \tkzDrawLines(o,a o,a' o,b o,b') - \tkzDrawPoints(a,a',b,b',o) - \tkzLabelPoints(b,b',o) - \tkzLabelPoints[below left](a,a') - \tkzDrawArc(o,a)(a') - \tkzDrawArc(o,b)(b') - \end{tikzpicture} +} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawLines(o,a o,a' o,b o,b') + \tkzDrawPoints(a,a',b,b',o) + \tkzLabelPoints(b,b',o) + \tkzLabelPoints[below left](a,a') + \tkzDrawArc(o,a)(a') + \tkzDrawArc(o,b)(b') + \end{tikzpicture} \end{Verbatim} \end{minipage} \begin{minipage}{.4\textwidth} -\begin{tkzelements} - scale = .5 +\directlua{% +init_elements () + scale = .5 z.a = point: new(0, -1) z.b = point: new(4, 0) z.o = point: new(6, -2) z.ap,z.bp = z.o : rotation (math.pi/2,z.a,z.b) -\end{tkzelements} -\hspace*{\fill} +} + +\begin{center} \begin{tikzpicture} \tkzGetNodes \tkzDrawLines(o,a o,a' o,b o,b') @@ -594,43 +601,46 @@ The arguments are the angle of rotation in radians, and here a list of points. \tkzDrawArc(o,a)(a') \tkzDrawArc(o,b)(b') \end{tikzpicture} -\hspace*{\fill} +\end{center} \end{minipage} % subsubsection example_rotation_of_points (end) -\subsubsection{Object \Imeth{point}{rotation}} % (fold) +\subsubsection{Method \Imeth{point}{rotation} second example} % (fold) \label{ssub:object_rotation} Rotate a triangle by an angle of $\pi/6$ around $O$. \begin{minipage}{.5\textwidth} - \begin{Verbatim} -\begin{tkzelements} +\begin{Verbatim} +\directlua{% +init_elements () scale = .75 - z.O = point : new ( -1 , -1 ) - z.A = point : new ( 2 , 0 ) - z.B = point : new ( 5 , 0 ) - L.AB = line : new (z.A,z.B) - T.ABC = L.AB : equilateral () - S.fig = L.AB : square () - _,_,z.E,z.F = get_points ( S.fig ) - S.new = z.O : rotation (math.pi/3,S.fig) - _,_,z.Ep,z.Fp = get_points ( S.new ) + z.O = point: new(-1, -1) + z.A = point: new(2, 0) + z.B = point: new(5, 0) + L.AB = line: new(z.Az.B) + T.ABC = L.AB: equilateral() + S.fig = L.AB: square () + _,_, + z.E,z.F = get_points(S.fig) + S.new = z.O : rotation(math.pi/3,S.fig) + _,_,z.Ep,z.Fp = get_points( S.new ) z.C = T.ABC.pc - T.ApBpCp = z.O : rotation (math.pi/3,T.ABC) + T.ApBpCp = z.O : rotation(math.pi/3,T.ABC) z.Ap,z.Bp,z.Cp = get_points ( T.ApBpCp) -\end{tkzelements} - +} \begin{tikzpicture} \tkzGetNodes - \tkzDrawPolygons(A,B,C A',B',C' A,B,E,F A',B',E',F') + \tkzDrawPolygons(A,B,C A',B',C'% + A,B,E,F A',B',E',F') \tkzDrawPoints (A,B,C,A',B',C',O) - \tkzLabelPoints (A,B,C,A',B',C',O) - \tkzDrawArc[delta=0,->](O,A)(A') + \tkzLabelPoints (A,B,C,A',B',C',O) + \tkzDrawArc[delta=0,->](O,A)(A') \end{tikzpicture} \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.O = point : new ( -1 , -1 ) z.A = point : new ( 2 , 0 ) z.B = point : new ( 5 , 0 ) @@ -643,63 +653,72 @@ _,_,z.Ep,z.Fp = get_points ( S.new ) z.C = T.ABC.pc T.ApBpCp = z.O : rotation (math.pi/3,T.ABC) z.Ap,z.Bp,z.Cp = get_points ( T.ApBpCp) -\end{tkzelements} +} -\hspace{\fill}\begin{tikzpicture} +\begin{center} +\begin{tikzpicture} \tkzGetNodes \tkzDrawPolygons(A,B,C A',B',C' A,B,E,F A',B',E',F') \tkzDrawPoints (A,B,C,A',B',C',O) - \tkzLabelPoints (A,B,C,A',B',C',O) + \tkzLabelPoints (A,B,C,A',B',C',O) \begin{scope} \tkzDrawArc[delta=0,->,dashed,red](O,A)(A') \tkzDrawSegments[dashed,red](O,A O,A') \end{scope} - \end{tikzpicture} +\end{center} \end{minipage} % subsubsection object_rotation (end) -\subsubsection{Object \Imeth{point}{symmetry}} % (fold) +\subsubsection{Method \Imeth{point}{symmetry}} % (fold) \label{ssub:object_symmetry} + +Example of the symmetry of an object + + \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} - z.a = point: new(0,-1) - z.b = point: new(2, 0) - L.ab = line : new (z.a,z.b) - C.ab = circle : new (z.a,z.b) - z.o = point: new(1,1) - z.ap,z.bp = get_points (z.o: symmetry (C.ab)) -\end{tkzelements} - +\directlua{% +init_elements () + z.a = point: new(0,-1) + z.b = point: new(2, 0) + L.ab = line : new (z.a,z.b) + C.ab = circle : new (z.a,z.b) + z.o = point: new(1,1) + z.ap,z.bp = get_points (z.o: symmetry (C.ab)) +} \begin{tikzpicture} -\tkzGetNodes -\tkzDrawCircles(a,b a',b') -\tkzDrawLines(a,a' b,b') -\tkzDrawLines[red](a,b a',b') -\tkzDrawPoints(a,a',b,b',o) -\tkzLabelPoints(a,a',b,b',o) + \tkzGetNodes + \tkzDrawCircles(a,b a',b') + \tkzDrawLines(a,a' b,b') + \tkzDrawLines[red](a,b a',b') + \tkzDrawPoints(a,a',b,b',o) + \tkzLabelPoints(a,a',b,b',o) \end{tikzpicture} \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} - z.a = point: new(0, -1) - z.b = point: new(2, 0) - L.ab = line : new (z.a,z.b) - C.ab = circle : new (z.a,z.b) - z.o = point: new(1, 1) - z.ap,z.bp = get_points (z.o: symmetry (C.ab)) -\end{tkzelements} - -\hspace{\fill}\begin{tikzpicture} -\tkzGetNodes -\tkzDrawCircles(a,b a',b') -\tkzDrawLines(a,a' b,b') -\tkzDrawLines[red](a,b a',b') -\tkzDrawPoints(a,a',b,b',o) -\tkzLabelPoints(a,a',b,b',o) -\end{tikzpicture} +\directlua{% +init_elements () + z.a = point: new(0, -1) + z.b = point: new(2, 0) + L.ab = line : new (z.a,z.b) + C.ab = circle : new (z.a,z.b) + z.o = point: new(1, 1) + z.ap,z.bp = get_points (z.o: symmetry (C.ab)) +} + +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircles(a,b a',b') + \tkzDrawLines(a,a' b,b') + \tkzDrawLines[red](a,b a',b') + \tkzDrawPoints(a,a',b,b',o) + \tkzLabelPoints(a,a',b,b',o) + \end{tikzpicture} +\end{center} + \end{minipage} % subsubsection object_symmetry (end) % subsection methods_of_the_class_point (end) diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-quadrilateral.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-quadrilateral.tex index 30ee773eba..ec9765ea6d 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-quadrilateral.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-quadrilateral.tex @@ -42,15 +42,16 @@ Creation | Q.new = rectangle : new (z.A,z.B,z.C,z.D)| \label{ssub:quadrilateral_attributes} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 0 , 0 ) z.B = point : new ( 4 , 0 ) z.C = point : new ( 5 , 1 ) -z.D = point : new ( -1 , 4 ) +z.D = point : new ( 0 , 3 ) Q.ABCD = quadrilateral : new ( z.A , z.B , z.C , z.D ) z.I = Q.ABCD.i z.G = Q.ABCD.g -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes @@ -61,15 +62,16 @@ z.G = Q.ABCD.g \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 0 , 0 ) z.B = point : new ( 4 , 0 ) z.C = point : new ( 5 , 1 ) -z.D = point : new ( -1 , 4 ) +z.D = point : new ( 0 , 3 ) Q.ABCD = quadrilateral : new ( z.A , z.B , z.C , z.D ) z.I = Q.ABCD.i z.G = Q.ABCD.g -\end{tkzelements} +} \hspace{\fill}\begin{tikzpicture} \tkzGetNodes @@ -102,7 +104,8 @@ z.G = Q.ABCD.g \label{ssub:inscribed_quadrilateral} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 0 , 0 ) z.B = point : new ( 4 , 0 ) z.D = point : polar ( 4 , 2*math.pi/3 ) @@ -115,7 +118,7 @@ if bool == true then C.cir = triangle : new (z.A,z.B,z.C): circum_circle () z.O = C.cir.center end -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes @@ -129,7 +132,8 @@ end \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () scale = .75 z.A = point : new ( 0 , 0 ) z.B = point : new ( 4 , 0 ) @@ -143,7 +147,7 @@ if bool == true then C.cir = triangle : new (z.A,z.B,z.C): circum_circle () z.O = C.cir.center end -\end{tkzelements} +} \hspace{\fill} \begin{tikzpicture} \tkzGetNodes @@ -157,4 +161,5 @@ end \end{minipage} % subsubsection inscribed_quadrilateral (end) + % subsection quadrilateral_methods (end)
\ No newline at end of file diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-rectangle.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-rectangle.tex index cd0ae2981c..0a9edc0d6d 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-rectangle.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-rectangle.tex @@ -41,14 +41,15 @@ Creation | R.ABCD = rectangle : new (z.A,z.B,z.C,z.D)| \label{ssub:example} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 0 , 0 ) z.B = point : new ( 4 , 0 ) z.C = point : new ( 4 , 4) z.D = point : new ( 0 , 4) R.new = rectangle : new (z.A,z.B,z.C,z.D) z.I = R.new.center -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes @@ -61,7 +62,8 @@ z.I = R.new.center \end{Verbatim} \end{minipage} \hspace{\fill}\begin{minipage}{.5\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () scale =1.5 z.A = point : new ( 0 , 0 ) z.B = point : new ( 4 , 0 ) @@ -69,7 +71,7 @@ z.I = R.new.center z.D = point : new ( 0 , 2) R.new = rectangle : new (z.A,z.B,z.C,z.D) z.I = R.new.center - \end{tkzelements} + } \begin{tikzpicture} \tkzGetNodes @@ -118,7 +120,8 @@ z.I = R.new.center \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .5 z.A = point : new ( 0 , 0 ) z.B = point : new ( 4 , 0 ) @@ -127,7 +130,7 @@ P.ABCD = rectangle : angle ( z.I , z.A , math.pi/6) z.B = P.ABCD.pb z.C = P.ABCD.pc z.D = P.ABCD.pd -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes @@ -139,7 +142,8 @@ z.D = P.ABCD.pd \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () scale = .5 z.A = point : new ( 0 , 0 ) z.B = point : new ( 4 , 0 ) @@ -148,7 +152,7 @@ P.ABCD = rectangle : angle ( z.I , z.A , math.pi/6) z.B = P.ABCD.pb z.C = P.ABCD.pc z.D = P.ABCD.pd -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygon(A,B,C,D) @@ -165,14 +169,15 @@ z.D = P.ABCD.pd \label{ssub:side_method} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 0 , 0 ) z.B = point : new ( 4 , 3 ) R.side = rectangle : side (z.A,z.B,3) z.C = R.side.pc z.D = R.side.pd z.I = R.side.center -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygon(A,B,C,D) @@ -184,14 +189,15 @@ z.I = R.side.center \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 0 , 0 ) z.B = point : new ( 4 , 3 ) R.side = rectangle : side (z.A,z.B,3) z.C = R.side.pc z.D = R.side.pd z.I = R.side.center -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygon(A,B,C,D) @@ -208,14 +214,15 @@ z.I = R.side.center \label{ssub:diagonal_method} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 0 , 0 ) z.C = point : new ( 4 , 3 ) R.diag = rectangle : diagonal (z.A,z.C) z.B = R.diag.pb z.D = R.diag.pd z.I = R.diag.center -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes @@ -229,14 +236,15 @@ z.I = R.diag.center \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 0 , 0 ) z.C = point : new ( 4 , 3 ) R.diag = rectangle : diagonal (z.A,z.C) z.B = R.diag.pb z.D = R.diag.pd z.I = R.diag.center -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes @@ -254,14 +262,15 @@ z.I = R.diag.center \label{ssub:gold_method} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.X = point : new ( 0 , 0 ) z.Y = point : new ( 4 , 2 ) R.gold = rectangle : gold (z.X,z.Y) z.Z = R.gold.pc z.W = R.gold.pd z.I = R.gold.center -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes @@ -275,14 +284,15 @@ z.I = R.gold.center \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.X = point : new ( 0 , 0 ) z.Y = point : new ( 4 , 2 ) R.gold = rectangle : gold (z.X,z.Y) z.Z = R.gold.pc z.W = R.gold.pd z.I = R.gold.center -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-regular.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-regular.tex index 3ec9e777a6..51cf6fff5d 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-regular.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-regular.tex @@ -1,7 +1,7 @@ \newpage \section{Class \Iclass{regular polygon}} % (fold) -\subsection{regular\_polygon attributes} % (fold) +\subsection{Regular\_polygon attributes} % (fold) \label{sub:regular_polygon_attributes} \begin{mybox} @@ -21,7 +21,7 @@ Creation | RP.IA = regular_polygon : new (z.I,z.A,6)| \Iattr{regular}{circle} & defines the circle with center I passing through A \\ \Iattr{regular}{type} & |RP.IA.type= 'regular\_polygon'| \\ \Iattr{regular}{side} & |s = RP.IA.side| ; s = length of side\\ -\Iattr{regular}{exradius}& |S.AB.exradius| ; radius of the circumscribed circle \\ +\Iattr{regular}{circumradius}& |S.AB.circumradius| ; radius of the circumscribed circle \\ \Iattr{regular}{inradius}& |S.AB.inxradius| ; radius of the inscribed circle \\ \Iattr{regular}{proj} & |RP.IA.proj| ; projection of the center on one side \\ \Iattr{regular}{angle} & |RP.IA.angle| ; angle formed by the center and 2 consecutive vertices \\ @@ -33,7 +33,9 @@ Creation | RP.IA = regular_polygon : new (z.I,z.A,6)| \label{ssub:pentagon} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () +scale = .75 z.O = point: new (0,0) z.I = point: new (1,3) z.A = point: new (2,0) @@ -41,7 +43,7 @@ RP.five = regular_polygon : new (z.I,z.A,5) RP.five : name ("P_") C.ins = circle: radius (z.I,RP.five.inradius) z.H = RP.five.proj -\end{tkzelements} +} \begin{tikzpicture} \def\nb{\tkzUseLua{RP.five.nb}} \tkzGetNodes @@ -53,7 +55,9 @@ z.H = RP.five.proj \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () +scale = .75 z.O = point: new (0,0) z.I = point: new (1,3) z.A = point: new (2,0) @@ -61,7 +65,7 @@ z.H = RP.five.proj RP.five : name ("P_") C.ins = circle : radius ( z.I , RP.five.inradius ) z.H = RP.five.proj - \end{tkzelements} + } \hspace{\fill} \begin{tikzpicture} \def\nb{\tkzUseLua{RP.five.nb}} @@ -71,11 +75,12 @@ z.H = RP.five.proj \tkzDrawPoints[red](P_1,P_...,P_\nb,H,I) \tkzLabelPoints[red](I,A,H) \end{tikzpicture} + \hspace{\fill} \end{minipage} % subsubsection pentagon (end) % subsection regular_polygon_attributes (end) -\subsection{regular\_polygon methods} % (fold) +\subsection{Regular\_polygon methods} % (fold) \label{sub:regular_polygon_methods} \bgroup @@ -94,7 +99,7 @@ z.H = RP.five.proj \midrule \textbf{Points} &\\ \midrule -\Imeth{regular\_polygon}{name (string)} & Refer to\ref{ssub:pentagon} \\ +\Imeth{regular\_polygon}{name (string)} & [\ref{ssub:pentagon}] \\ \bottomrule % \end{tabular} \egroup diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-square.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-square.tex index 17e26d105f..edfdaca474 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-square.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-square.tex @@ -24,7 +24,7 @@ Creation | S.AB = square : new (z.A,z.B,z.C,z.D)| \Iattr{square}{type} & |S.AB.type= 'square'| & \\ \Iattr{square}{side} & |s = S.AB.center| & s = length of side \\ \Iattr{square}{center} & |z.I = S.AB.center| & center of the square \\ -\Iattr{square}{exradius} & |S.AB.exradius| & radius of the circumscribed circle \\ +\Iattr{square}{circumradius} & |S.AB.circumradius| & radius of the circumscribed circle \\ \Iattr{square}{inradius} & |S.AB.inxradius| & radius of the inscribed circle \\ \Iattr{square}{proj} & |S.AB.proj| & projection of the center on one side \\ \Iattr{square}{ab} & |S.AB.ab| & line passing through two vertices \\ @@ -41,7 +41,8 @@ Creation | S.AB = square : new (z.A,z.B,z.C,z.D)| \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 0 , 0 ) z.B = point : new ( 4 , 0 ) z.C = point : new ( 4 , 4) @@ -49,7 +50,7 @@ z.D = point : new ( 0 , 4) S.new = square : new ( z.A , z.B ,z.C,z.D) z.I = S.new.center z.H = S.new.proj -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles[orange](I,A I,H) @@ -58,14 +59,15 @@ z.H = S.new.proj \tkzLabelPoints(A,B,H,I) \tkzLabelPoints[above](C,D) \tkzDrawSegments(I,B I,H) -\tkzLabelSegment[sloped](I,B){\pmpn{\tkzUseLua{S.new.exradius}}} +\tkzLabelSegment[sloped](I,B){\pmpn{\tkzUseLua{S.new.circumradius}}} \tkzLabelSegment[sloped](I,H){\pmpn{\tkzUseLua{S.new.inradius}}} \tkzLabelSegment[sloped](D,C){\pmpn{\tkzUseLua{S.new.side}}} \end{tikzpicture} \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () z.A = point : new ( 0 , 0 ) z.B = point : new ( 4 , 0 ) z.C = point : new ( 4 , 4) @@ -73,7 +75,7 @@ z.H = S.new.proj S.new = square : new ( z.A , z.B ,z.C,z.D) z.I = S.new.center z.H = S.new.proj - \end{tkzelements} + } \hspace{\fill} \begin{tikzpicture} \tkzGetNodes @@ -83,7 +85,7 @@ z.H = S.new.proj \tkzLabelPoints(A,B,H,I) \tkzLabelPoints[above](C,D) \tkzDrawSegments(I,B I,H) - \tkzLabelSegment[sloped](I,B){\pmpn{\tkzUseLua{S.new.exradius}}} + \tkzLabelSegment[sloped](I,B){\pmpn{\tkzUseLua{S.new.circumradius}}} \tkzLabelSegment[sloped](I,H){\pmpn{\tkzUseLua{S.new.inradius}}} \tkzLabelSegment[sloped](D,C){\pmpn{\tkzUseLua{S.new.side}}} \end{tikzpicture} @@ -115,7 +117,8 @@ z.H = S.new.proj % \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = 2 z.A = point : new ( 0 , 0 ) z.B = point : new ( 2 , 1 ) @@ -124,7 +127,7 @@ z.H = S.new.proj z.C = S.side.pc z.D = S.side.pd z.I = S.side.center -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes @@ -137,7 +140,8 @@ z.H = S.new.proj \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () scale = 2 z.A = point : new ( 0 , 0 ) z.B = point : new ( 2 , 1 ) @@ -146,7 +150,7 @@ z.B = S.side.pb z.C = S.side.pc z.D = S.side.pd z.I = S.side.center -\end{tkzelements} +} \hspace{\fill} \begin{tikzpicture} \tkzGetNodes @@ -158,6 +162,7 @@ z.I = S.side.center \end{tikzpicture} \end{minipage} % subsubsection square_with_side_method (end) + % subsubsection example_square_attributes (end) % subsection square_methods (end)
\ No newline at end of file diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-triangle.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-triangle.tex index 80b711e46f..1ca2f6e069 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-triangle.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-triangle.tex @@ -21,12 +21,13 @@ The triangle object is created using the \Imeth{triangle}{new} method, for examp \Iattr{triangle}{pb} &T.ABC.pb \\ \Iattr{triangle}{pc} &T.ABC.pc \\ \Iattr{triangle}{type} & 'triangle' \\ -\Iattr{triangle}{circumcenter} & T.ABC.circumcenter\\ +\Iattr{triangle}{circumcenter} & T.ABC.circumcenter; [\ref{ssub:example_triangle_attributes} +]\\ \Iattr{triangle}{centroid} &T.ABC.centroid\\ \Iattr{triangle}{incenter} &T.ABC.incenter\\ \Iattr{triangle}{orthocenter} &T.ABC.orthocenter\\ \Iattr{triangle}{eulercenter} &T.ABC.eulercenter \\ -\Iattr{triangle}{spiekercenter} &T.ABC.spiekercenter \\ +\Iattr{triangle}{spiekercenter} &T.ABC.spiekercenter; [\ref{ssub:example_apollonius_circle}] \\ \Iattr{triangle}{a}& It's the length of the side opposite the first vertex \\ \Iattr{triangle}{b}& It's the length of the side opposite the second verte\\ \Iattr{triangle}{c}& It's the length of the side opposite the third vertex \\ @@ -36,6 +37,10 @@ The triangle object is created using the \Imeth{triangle}{new} method, for examp \Iattr{triangle}{ab}& Line defined by the first two points of the triangle\\ \Iattr{triangle}{bc}& Line defined by the last two points \\ \Iattr{triangle}{ca}& Line defined by the last and the first points of the triangle\\ +\Iattr{triangle}{semiperimeter}& semiperimeter of the triangle \\ +\Iattr{triangle}{area}& area of the triangle \\ +\Iattr{triangle}{inradius}& radius of the incircle\\ +\Iattr{triangle}{circumradius}& radius of the circumcircle \\ \bottomrule % \end{tabular} \egroup @@ -45,12 +50,13 @@ The triangle object is created using the \Imeth{triangle}{new} method, for examp \begin{minipage}{.6\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new(0,0) z.B = point: new(5,0) z.C = point: new(2,3) T.ABC = triangle: new (z.A,z.B,z.C) -\end{tkzelements} +} \def\wangle#1{\tkzDN[2]{% \tkzUseLua{math.deg(T.ABC.#1)}}} \begin{tikzpicture} @@ -63,12 +69,13 @@ The triangle object is created using the \Imeth{triangle}{new} method, for examp \end{Verbatim} \end{minipage} \begin{minipage}{.4\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new(0,0) z.B = point: new(5,0) z.C = point: new(2,3) T.ABC = triangle: new (z.A,z.B,z.C) -\end{tkzelements} +} \def\wangle#1{\tkzDN[2]{\tkzUseLua{math.deg(T.ABC.#1)}}} \begin{tikzpicture} \tkzGetNodes @@ -84,7 +91,8 @@ The triangle object is created using the \Imeth{triangle}{new} method, for examp \label{ssub:example_triangle_attributes} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0 , 0) z.B = point: new (4 , 0) z.C = point: new (0 , 3) @@ -99,7 +107,7 @@ The triangle object is created using the \Imeth{triangle}{new} method, for examp alpha = T.ABC.alpha beta = T.ABC.beta gamma = T.ABC.gamma -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygon(A,B,C) @@ -113,10 +121,11 @@ The triangle object is created using the \Imeth{triangle}{new} method, for examp \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0 , 0) z.B = point: new (4 , 0) - z.C = point: new (0 , 3) + z.C = point: new (1 , 3) T.ABC = triangle : new (z.A,z.B,z.C) z.O = T.ABC.circumcenter z.I = T.ABC.incenter @@ -128,19 +137,23 @@ The triangle object is created using the \Imeth{triangle}{new} method, for examp alpha = T.ABC.alpha beta = T.ABC.beta gamma = T.ABC.gamma -\end{tkzelements} -\hspace*{\fill} -\begin{tikzpicture} - \tkzGetNodes - \tkzDrawPolygon(A,B,C) - \tkzDrawPoints(A,B,C,O,G,I,H) - \tkzLabelPoints[below](A,B,O,G,I) - \tkzLabelPoints[above right](H,C) - \tkzDrawCircles(O,A) - \tkzLabelSegment[sloped](A,B){\tkzUseLua{c}} - \tkzLabelSegment[sloped,above](B,C){\tkzUseLua{a}} -\end{tikzpicture} -\hspace*{\fill} +} + +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygon(A,B,C) + \tkzDrawPoints(A,B,C,O,G,I,H) + \tkzDrawCircles(O,A) + \tkzLabelPoints[below](A,B,O,G,I) + \tkzLabelPoints[above right](H) + \tkzLabelPoints[above](C) + \tkzLabelSegment[sloped](A,B){\tkzUseLua{c}} + \tkzLabelSegment[sloped,above](B,C){\tkzUseLua{a}} + \end{tikzpicture} +\end{center} + + \end{minipage} % subsubsection example_triangle_attributes (end) @@ -155,64 +168,110 @@ The triangle object is created using the \Imeth{triangle}{new} method, for examp \small \begin{minipage}{\textwidth} \captionof{table}{triangle methods.}\label{triangle:met} -\begin{tabular}{ll} +\begin{tabular}{lll} \toprule -\textbf{Methods} & \textbf{Comments} \\ +\textbf{Methods} & \textbf{Comments} & \\ \midrule -\Imeth{triangle}{new} (a, b ,c) & |T.ABC = triangle : new (z.A,z.B,z.C)| \\ - ... & |T| or |T.name| with what you want for name, is possible.\\ +\Imeth{triangle}{new} (a, b ,c) & |T.ABC = triangle : new (z.A,z.B,z.C)|& [\ref{sub:triangle_attributes_angles}] \footnote{|T| or |T.name| with what you want for name, is possible.} \\ \midrule - \textbf{Points} &\\ +\textbf{Booleans}&&\\ +\midrule +\Imeth{triangle}{in\_out (pt)} & Boolean. Test if |pt| is inside the triangle\\ +\Imeth{triangle}{check\_equilateral ()} & Boolean. Test if the triangle is equilateral\\ +\Imeth{triangle}{check\_acutangle ()} & Boolean. Test if the triangle is acutangle\\ +\midrule + \textbf{Reals} &&\\ + \midrule + \Imeth{triangle}{area ()} & $ \mathcal{A}$| = T.ABC: area ()| better T.ABC.area\\ + \Imeth{triangle}{barycentric\_coordinates(pt)} & Triples of numbers corresponding to masses placed at the vertices\\ + \midrule + \textbf{Points} &&\\ \midrule -\Imeth{triangle}{lemoine\_point ()} & |T.ABC : lemoine_point ()| intersection os the symmedians\\ -\Imeth{triangle}{symmedian\_point ()} & Lemoine point or the Grebe point \\ -\Imeth{triangle}{bevan\_point ()} & Circumcenter of the excentral triangle\\ -\Imeth{triangle}{mittenpunkt\_point ()} & Symmedian point of the excentral triangle\\ -\Imeth{triangle}{gergonne\_point ()} & Intersection of the three cevians that lead to the contact points \\ -\Imeth{triangle}{nagel\_point () } & Intersection of the three cevians that lead to the extouch points\\ -\Imeth{triangle}{feuerbach\_point () } & The point at which the incircle and euler circle are tangent. \\ -\Imeth{triangle}{spieker\_center ()} & Incenter of the medial triangle \\ -\Imeth{triangle}{barycenter (ka,kb,kc)} & |T.ABC: barycenter (2,1,1)| barycenter of |({A,2},{B,1},{C,1}) |\\ -\Imeth{triangle}{base (u,v) } & |z.D = T.ABC: base(1,1)| \tkzar ABDC is a parallelogram \\ -\Imeth{triangle}{projection (p) } & Projection of a point on the sides \\ -\Imeth{triangle}{euler\_points () } & Euler points of euler circle \\ -\Imeth{triangle}{nine\_points () } & 9 Points of the euler circle \\ -\Imeth{triangle}{parallelogram ()} & |z.D = T.ABC : parallelogram ()| \tkzar ABCD is a parallelogram\\ +\Imeth{triangle}{lemoine\_point ()} & |T.ABC : lemoine_point ()| intersection of the symmedians & [\ref{ssub:method_imeth_line_isosceles}]\\ + +\Imeth{triangle}{symmedian\_point ()} & Lemoine point or the Grebe point& [\ref{ssub:method_imeth_triangle_symmedial}] \\ + +\Imeth{triangle}{lemoine\_point ()} & symmedian point or the Grebe point& [\ref{ssub:method_imeth_triangle_symmedial}] \\ + +\Imeth{triangle}{bevan\_point ()} & Circumcenter of the excentral triangle& [\ref{ssub:methods_imeth_triangle_bevan_circle_and_imeth_triangle_bevan_point} +]\\ + +\Imeth{triangle}{mittenpunkt\_point ()} & Symmedian point of the excentral triangle& [\ref{ssub:method_imeth_triangle_mittenpunkt}]\\ + +\Imeth{triangle}{gergonne\_point ()} & Intersection of the three cevians that lead to the contact points& [\ref{ssub:gergonne_point}]\\ + +\Imeth{triangle}{nagel\_point () } & Intersection of the three cevians that lead to the extouch points& [\ref{ssub:method_imeth_triangle_nagel__point}]\\ + +\Imeth{triangle}{feuerbach\_point () } & The point at which the incircle and euler circle are tangent.& [\ref{ssub:method_imeth_triangle_feuerbach}]\\ + +\Imeth{triangle}{spieker\_center ()} & Incenter of the medial triangle& [\ref{sub:apollonius_circle_v1_with_inversion}]\\ + +\Imeth{triangle}{barycentric (ka,kb,kc)} & |T.ABC: barycentric (2,1,1)| barycenter of |({A,2},{B,1},{C,1}) |&Remark \footnote{The function \code{barycenter} is used to obtain the barycentre for any number of points }\\ + +\Imeth{triangle}{base (u,v) } & |z.D = T.ABC: base(1,1)| \tkzar ABDC is a parallelogram & [\ref{ssub:method_imeth_triangle_base}] \\ +\Imeth{triangle}{trilinear (u,v,w) } & |z.D = T.ABC: trilinear(1,1,1)| \tkzar ABDC parallelogram & [\ref{ssub:method_imeth_triangle_trilinear}] \\ + +\Imeth{triangle}{projection (p) } & Projection of a point on the sides &[\ref{sub:euler_relation}; \ref{ssub:method_imeth_triangle_projection}]\\ + +\Imeth{triangle}{euler\_points () } & Euler points of euler circle & [\ref{ssub:method_imeth_triangle_euler__points}] \\ + +\Imeth{triangle}{nine\_points () } & 9 Points of the euler circle & [\ref{ssub:method_imeth_triangle_nine__points}] \\ + +\Imeth{triangle}{parallelogram ()} & |z.D = T.ABC : parallelogram ()| \tkzar ABCD parallelogram& [\ref{sub:director_circle}]\\ + \midrule - \textbf{Lines} &\\ + \textbf{Lines} &&\\ \midrule \Imeth{triangle}{altitude (n) } & |L.AHa = T.ABC : altitude () | n empty or 0 line from $A$ -\footnote{|z.Ha = L.AHa.pb| recovers the common point of the opposite side and altitude. The method |orthic| is usefull.}\\ -\Imeth{triangle}{bisector (n) } & |L.Bb = T.ABC : bisector (1) | n = 1 line from $B$ \footnote{|_,z.b = get_points(L.Bb)| recovers the common point of the opposite side and bisector. }\\ -\Imeth{triangle}{bisector\_ext(n) } & n=2 line from the third vertex.\\ -\Imeth{triangle}{symmedian\_line (n)} & Cevian with respect to Lemoine point. \\ +\footnote{|z.Ha = L.AHa.pb| recovers the common point of the opposite side and altitude. The method |orthic| is usefull. If you don't need to use the triangle object several times, you can obtain a bisector or a altitude with the function |altitude (z.A,z.B,z.C)| ; [ \ref{misc}]}& [\ref{ssub:method_imeth_triangle_altitude} ]\\ + +\Imeth{triangle}{bisector (n) } & |L.Bb = T.ABC : bisector (1) | n = 1 line from $B$ \footnote{|_,z.b = get_points(L.Bb)| recovers the common point of the opposite side and bisector. If you don't need to use the triangle object several times, you can obtain a bisector with the function |bisector (z.A,z.B,z.C)| [\ref{misc}]}& [\ref{ssub:method_imeth_triangle_bisector}]\\ + +\Imeth{triangle}{bisector\_ext(n) } & n=2 line from the third vertex.& [\ref{ssub:harmonic_division_and_bisector}]\\ + +\Imeth{triangle}{symmedian\_line (n)} & Cevian with respect to Lemoine point.& [\ref{ssub:method_imeth_triangle_symmedial} ; \ref{ssub:method_imeth_line_isosceles}]\\ + \Imeth{triangle}{euler\_line () } & the line through $N$ ,$G$, $H$ and $O$ if the triangle is not equilateral -\footnote{N center of nine points circle, G centroid, H orthocenter , O circum center } \\ -\Imeth{triangle}{antiparallel(pt,n)} & n=0 antiparallel through pt to $(BC)$, n=1 to $(AC)$ etc.\\ +\footnote{N center of nine points circle, G centroid, H orthocenter , O circum center } & [\ref{sub:hexagram}]\\ + +\Imeth{triangle}{antiparallel(pt,n)} & n=0 antiparallel through pt to $(BC)$, n=1 to $(AC)$ etc.& [\ref{sub:antiparallel_through_lemoine_point}]\\ \midrule - \textbf{Circles} &\\ + + \textbf{Circles} &&\\ \midrule \Imeth{triangle}{euler\_circle ()} & C.|NP = T.ABC : euler_circle ()| \tkzar $N$ euler point - \footnote{ The midpoint of each side of the triangle, the foot of each altitude, the midpoint of the line segment from each vertex of the triangle to the orthocenter.} \\ -\Imeth{triangle}{circum\_circle ()} & |C.OA = T.ABC : circum ()| Triangle's circumscribed circle \\ -\Imeth{triangle}{in\_circle ()} & Inscribed circle of the triangle\\ -\Imeth{triangle}{ex\_circle (n)} & Circle tangent to the three sides of the triangle ; n =1 swap ; n=2 2 swap \\ -\Imeth{triangle}{first\_lemoine\_circle ()} & The center is the midpoint between Lemoine point and the circumcenter.\footnote{ -Through the Lemoine point draw lines parallel to the triangle's sides. The points where the parallel lines intersect the sides of ABC - then lie on a circle known as the first Lemoine circle. } \\ -\Imeth{triangle}{second\_lemoine\_circle ()} & Refer to example \ref{sub:antiparallel_through_lemoine_point}\\ -\Imeth{triangle}{spieker\_circle ()} & The incircle of the medial triangle\\ -\Imeth{triangle}{cevian\_circle ()} & Circumscribed circle of a Cevian triangle Refer to (\ref{ssub:method_imeth_triangle_cevian})\\ -\Imeth{triangle}{pedal\_circle ()} & Circumscribed circle of the podar triangle Refer to (\ref{ssub:method_imeth_triangle_pedal})\\ -\Imeth{triangle}{conway\_circle ()} & Circumscribed circle of Conway points Refer to (\ref{ssub:method_imeth_triangle_conway})\\ + \footnote{ The midpoint of each side of the triangle, the foot of each altitude, the midpoint of the line segment from each vertex of the triangle to the orthocenter.} & [\ref{ssub:method_imeth_triangle_euler_circle}]\\ + +\Imeth{triangle}{circum\_circle ()} & |C.OA = T.ABC : circum ()| Triangle's circumscribed circle & [\ref{ssub:method_imeth_triangle_circum_circle}] \\ + +\Imeth{triangle}{in\_circle ()} & Inscribed circle of the triangle& +[\ref{ssub:method_imeth_triangle_in_circle}]\\ + +\Imeth{triangle}{ex\_circle (n)} & Circle tangent to the three sides of the triangle ; n =1 swap ; n=2 2 swap & [\ref{ssub:method_imeth_triangle_ex__circle}]\\ + +\Imeth{triangle}{first\_lemoine\_circle ()} & The center is the midpoint between Lemoine point and the circumcenter.\footnote{Through the Lemoine point draw lines parallel to the triangle's sides. The points where the parallel lines intersect the sides of ABC then lie on a circle known as the first Lemoine circle. }& [\ref{sub:first_and_second_lemoine_circles} +] \\ + +\Imeth{triangle}{second\_lemoine\_circle ()} & & \ref{sub:antiparallel_through_lemoine_point}] \\ + +\Imeth{triangle}{spieker\_circle ()} & The incircle of the medial triangle& [\ref{ssub:method_imeth_triangle_spieker__circle}]\\ + +\Imeth{triangle}{bevan\_circle ()} & Circumscribed circle of a excentral triangle & [\ref{ssub:methods_imeth_triangle_bevan_circle_and_imeth_triangle_bevan_point}]\\ + +\Imeth{triangle}{cevian\_circle ()} & Circumscribed circle of a Cevian triangle & [\ref{ssub:method_imeth_triangle_cevian}]\\ + +\Imeth{triangle}{symmedial\_circle ()} & Circumscribed circle of a symmedial triangle & [\ref{ssub:method_imeth_triangle_symmedial}]\\ + +\Imeth{triangle}{pedal\_circle ()} & Circumscribed circle of the podar triangle & [\ref{ssub:method_imeth_triangle_pedal}]\\ + +\Imeth{triangle}{conway\_circle ()} & Circumscribed circle of Conway points & [\ref{ssub:method_imeth_triangle_conway}]\\ + +\Imeth{triangle}{c\_ll\_p (pt)} & circle tgt to two side through pt [\ref{ssub:tr_method_c__ll__p}]\\ \bottomrule \end{tabular} \end{minipage} \egroup -Remark: If you don't need to use the triangle object several times, you can obtain a bisector or a altitude with the next functions - -|bisector (z.A,z.B,z.C)| and |altitude (z.A,z.B,z.C)| Refer to (\ref{misc}) \clearpage\newpage \bgroup @@ -227,31 +286,43 @@ Remark: If you don't need to use the triangle object several times, you can obta \midrule \textbf{Triangles} &\\ \midrule -\Imeth{triangle}{orthic ()} & |T = T.ABC : orthic ()| triangle joining the feet of the altitudes \\ -\Imeth{triangle}{medial ()} & |T = T.ABC : medial ()| triangle with vertices at the midpoints\\ -\Imeth{triangle}{incentral ()} & Cevian triangle of the triangle with respect to its incenter \\ -\Imeth{triangle}{excentral () } & Triangle with vertices corresponding to the excenters \\ -\Imeth{triangle}{extouch ()} & Triangle formed by the points of tangency with the excircles \\ -\Imeth{triangle}{intouch () } & Contact triangle formed by the points of tangency of the incircle \\ -\Imeth{triangle}{tangential ()} & Triangle formed by the lines tangent to the circumcircle at the vertices\\ -\Imeth{triangle}{feuerbach ()} & Triangle formed by the points of tangency of the euler circle with the excircles\\ -\Imeth{triangle}{anti () }& Anticomplementary Triangle The given triangle is its medial triangle. \\ -\Imeth{triangle}{cevian (pt)} & Triangle formed with the endpoints of the three cevians with respect to |pt|. refer to (\ref{ssub:method_imeth_triangle_cevian})\\ -\Imeth{triangle}{pedal (pt)} & Triangle formed by projections onto the sides of |pt| Refer to \ref{ssub:method_imeth_triangle_pedal}\\ -\Imeth{triangle}{symmedian ()} & Triangle formed with the intersection points of the symmedians. \\ -\Imeth{triangle}{euler ()} & Triangle formed with the euler points \\ +\Imeth{triangle}{orthic ()} & |T = T.ABC : orthic ()| triangle joining the feet of the altitudes ; [\ref{ssub:method_imeth_triangle_altitude}] \\ + +\Imeth{triangle}{medial ()} & |T = T.ABC : medial ()| triangle with vertices at the midpoints; [\ref{ssub:method_imeth_triangle_medial} ; \ref{sub:nine_points} ; \ref{ssub:method_imeth_triangle_symmedial}]\\ + +\Imeth{triangle}{incentral ()}& Cevian triangle of the triangle with respect to its incenter. [\ref{ssub:method_incentral}] \\ + +\Imeth{triangle}{excentral ()} & Triangle with vertices corresponding to the excenters. [\ref{ssub:method_imeth_triangle_feuerbach} ] \\ + +\Imeth{triangle}{extouch ()} & Triangle formed by the points of tangency with the excircles. [\ref{sub:excircles} ] \\ + +\Imeth{triangle}{intouch () } & Contact triangle formed by the points of tangency of the incircle [\ref{ssub:gergonne_point}]\\ + +\Imeth{triangle}{contact () } & contact = intouch ; [ +\ref{ssub:gergonne_point}] \\ + +\Imeth{triangle}{tangential ()} & Triangle formed by the lines tangent to the circumcircle at the vertices; [\ref{ssub:method_imeth_triangle_tangential}]\\ + +\Imeth{triangle}{feuerbach ()} & Triangle formed by the points of tangency of the euler circle with the excircles; [\ref{ssub:method_imeth_triangle_feuerbach}]\\ + +\Imeth{triangle}{anti () }& Anticomplementary Triangle The given triangle is its medial triangle.\footnote{You can use \tkzname{similar} instead of \tkzname{anti}.} ; [\ref{ssub:method_imeth_triangle_anti}] \\ + +\Imeth{triangle}{cevian (pt)} & Triangle formed with the endpoints of the three cevians with respect to |pt|; [\ref{ssub:method_imeth_triangle_cevian}] \\ + +\Imeth{triangle}{pedal (pt)} & Triangle formed by projections onto the sides of |pt| [\ref{ssub:method_imeth_triangle_pedal}]\\ + +\Imeth{triangle}{symmedial ()} & Triangle formed with the intersection points of the symmedians ; [\ref{ssub:method_imeth_triangle_symmedial}] \\ + +\Imeth{triangle}{euler ()} & Triangle formed with the euler points ; [\ref{ssub:method_imeth_triangle_euler__points}] \\ + +\Imeth{triangle}{similar ()} & Triangle formed with straight lines parallel to the sides [\ref{ssub:method_imeth_triangle_similar}] \\ \midrule \textbf{Ellipses} &\\ -\Imeth{triangle}{steiner\_inellipse ()} & Refer to ex. (\ref{ssub:steiner_inellipse_and_circumellipse})\\ -\Imeth{triangle}{steiner\_circumellipse ()} & Refer to ex. (\ref{ssub:steiner_inellipse_and_circumellipse})\\ -\Imeth{triangle}{euler\_ellipse ()} & Refer to ex. (\ref{sub:euler_ellipse})\\ - \midrule - \textbf{Miscellaneous} &\\ -\midrule -\Imeth{triangle}{area ()} & $ \mathcal{A}$| = T.ABC: area ()|\\ -\Imeth{triangle}{barycentric\_coordinates (pt)} & Triples of numbers corresponding to masses placed at the vertices\\ -\Imeth{triangle}{in\_out (pt)} & Boolean. Test if |pt| is inside the triangle\\ -\Imeth{triangle}{check\_equilateral ()} & Boolean. Test if the triangle is equilateral\\ +\Imeth{triangle}{steiner\_inellipse ()} & [ex. \ref{ssub:steiner_inellipse_and_circumellipse}] \\ + +\Imeth{triangle}{steiner\_circumellipse ()} & [ex. \ref{ssub:steiner_inellipse_and_circumellipse}] \\ + +\Imeth{triangle}{euler\_ellipse ()} & [ex. (\ref{ssub:euler_ellipse}]\\ \bottomrule \end{tabular} \end{center} @@ -259,119 +330,1240 @@ Remark: If you don't need to use the triangle object several times, you can obta \egroup % subsubsection methods_of_the_class_triangle (end) +\subsubsection{Gergonne point} % (fold) +\label{ssub:gergonne_point} -\subsubsection{Méthodes \Imeth{triangle}{cevian} et \Imeth{triangle}{cevian\_circle}} % (fold) -\label{ssub:method_imeth_triangle_cevian} +In this example, some usefull methods are applied like \Imeth{triangle}{intouch} or \Imeth{triangle}{contact}. +The points of contact of the inscribed circle (incircle) with the triangle in question are obtained. + +\begin{minipage}[t]{.5\textwidth}\vspace{0pt}% +\begin{Verbatim} +\directlua{% +init_elements () +z.a = point: new(1,0) +z.b = point: new(6,2) +z.c = point: new(2,5) +T = triangle : new (z.a,z.b,z.c) +z.g = T : gergonne_point () +z.i = T.incenter +z.ta,z.tb,z.tc = get_points (T : intouch ()) +} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygons(a,b,c) + \tkzDrawSegments (a,ta b,tb c,tc) + \tkzDrawCircle(i,ta) + \tkzDrawPoints(a,b,c,g,ta,tb,tc) + \tkzLabelPoints(a,b,tc) + \tkzLabelPoints[above](c,ta) + \tkzLabelPoints[above left](tb) + \end{tikzpicture} +\end{Verbatim} +\end{minipage} +\begin{minipage}[t]{.5\textwidth}\vspace{0pt}% +\directlua{% +init_elements () +z.a = point: new(1,0) +z.b = point: new(6,2) +z.c = point: new(2,5) +T = triangle : new (z.a,z.b,z.c) +z.g = T : gergonne_point () +z.i = T.incenter +z.ta,z.tb,z.tc = get_points (T : intouch ()) +} + + +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygons(a,b,c) + \tkzDrawSegments (a,ta b,tb c,tc) + \tkzDrawCircle(i,ta) + \tkzDrawPoints(a,b,c,g,ta,tb,tc) + \tkzLabelPoints(a,b,tc) + \tkzLabelPoints[above](c,ta) + \tkzLabelPoints[above left](tb) + \end{tikzpicture} +\end{center} + +\end{minipage} +% subsubsection gergonne_point (end) + +\subsubsection{Method \Imeth{triangle}{Nagel\_point}} % (fold) +\label{ssub:method_imeth_triangle_nagel__point} + +Let $E_a$ be the point at which the $J_a$-excircle meets the side $(BC)$ of a triangle $ABC$, and define $E_b$ and $E_c$ similarly. Then the lines $A,E_a$, $B,E_b$ and $C,E_c$ concur in the Nagel point $Na$. + +\begin{minipage}{.5\textwidth} +\begin{Verbatim} +\directlua{% +init_elements () + scale = .7 + z.A = point : new (0,0) + z.B = point : new (3.6,0) + z.C = point : new (2.8,4) + T.ABC = triangle: new (z.A,z.B,z.C) + z.Na = T.ABC : nagel_point () + z.J_a,z.J_b, + z.J_c = get_points (T.ABC : excentral ()) + z.E_a,z.E_b, + z.E_c = get_points (T.ABC : extouch ()) +} +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawPoints(A,B,C) + \tkzDrawPoints[red,size=2](J_a,J_b,J_c) + \tkzClipBB + \tkzDrawLines[add=1.75 and 1.75,teal](A,B A,C B,C) + \tkzDrawCircles(J_a,E_a J_b,E_b J_c,E_c) + \tkzDrawSegments[dashed,gray](J_a,E_a J_b,E_b J_c,E_c) + \tkzDrawSegments[orange](A,E_a B,E_b C,E_c) + \tkzDrawPoints[red,size=2](Na,E_a,E_b,E_c) + \tkzLabelPoints(A,B,Na) + \tkzLabelPoints(E_c,J_a,J_b,J_c) + \tkzLabelPoints[above](E_a,E_b,C) +\end{tikzpicture} +\end{Verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} +\directlua{% +init_elements () + scale = .7 + z.A = point : new (0,0) + z.B = point : new (3.6,0) + z.C = point : new (2.8,4) + T.ABC = triangle: new (z.A,z.B,z.C) + z.Na = T.ABC : nagel_point () + z.J_a,z.J_b, + z.J_c = get_points (T.ABC : excentral ()) + z.E_a,z.E_b, + z.E_c = get_points (T.ABC : extouch ()) +} + +\begin{center} +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawPoints(A,B,C) + \tkzDrawPoints[red,size=2](J_a,J_b,J_c) + \tkzClipBB + \tkzDrawLines[add=1.75 and 1.75,teal](A,B A,C B,C) + \tkzDrawCircles(J_a,E_a J_b,E_b J_c,E_c) + \tkzDrawSegments[dashed,gray](J_a,E_a J_b,E_b J_c,E_c) + \tkzDrawSegments[orange](A,E_a B,E_b C,E_c) + \tkzDrawPoints[red,size=2](Na,E_a,E_b,E_c) + \tkzLabelPoints(A,B,Na) + \tkzLabelPoints(E_c,J_a,J_b,J_c) + \tkzLabelPoints[above](E_a,E_b,C) +\end{tikzpicture} +\end{center} + +\end{minipage} +% subsubsection method_imeth_triangle_nagel__point (end) + + +\subsubsection{Method \Imeth{triangle}{mittenpunkt}} % (fold) +\label{ssub:method_imeth_triangle_mittenpunkt} + +The Mittenpunkt is the symmedian point of the excentral triangle. The mittenpunkt (also called the middlespoint) of a triangle is the symmedian point of the excentral triangle, i.e., the point of concurrence of the lines from the excenters through the corresponding triangle side midpoints. +[ \href{https://mathworld.wolfram.com/Mittenpunkt.html}{Weisstein, Eric W. "Mittenpunkt." From MathWorld--A Wolfram Web Resource.}] + +\vspace{6pt} +\begin{minipage}{.5\textwidth} +\begin{Verbatim} +\directlua{% +init_elements () + scale = 1 + z.A = point : new ( 0 , 0 ) + z.B = point : new ( 6 , 0 ) + z.C = point : new ( 4 , 6 ) + T = triangle : new (z.A,z.B,z.C) + z.Ma, + z.Mb, + z.Mc = get_points (T : medial ()) + z.Ia,z.Ib,z.Ic = get_points(T : excentral ()) + z.Mi = T : mittenpunkt_point () + T.int = T : extouch () + z.Ta,z.Tb,z.Tc = get_points(T.int) +} +\end{Verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} +\directlua{% +init_elements () + scale = 1 + z.A = point : new ( 0 , 0 ) + z.B = point : new ( 6 , 0 ) + z.C = point : new ( 4 , 6 ) + T = triangle : new (z.A,z.B,z.C) + z.Ma, + z.Mb, + z.Mc = get_points (T : medial ()) + z.Ia,z.Ib,z.Ic = get_points(T : excentral ()) + z.Mi = T : mittenpunkt_point () + T.int = T : extouch () + z.Ta,z.Tb,z.Tc = get_points(T.int) +} +\begin{center} + \begin{tikzpicture}[scale=.5] + \tkzGetNodes + \tkzDrawPolygons[](A,B,C Ma,Mb,Mc) + \tkzDrawPoints(Ma,Mb,Mc,Ia,Ib,Ic) + \tkzDrawPoints[red](Ta,Tb,Tc) + \tkzLabelPoints[below](Ib) + \tkzLabelPoints[above left](Ia,Ic) + \tkzClipBB + \tkzDrawLines[add=0 and 1](Ia,Ma Ib,Mb Ic,Mc) + \tkzDrawLines[add=1 and 1](A,B A,C B,C) + \tkzDrawCircles[red](Ia,Ta Ib,Tb Ic,Tc) + \tkzDrawPoints(B,C,A,Mi) % + \tkzLabelPoints(B,A) + \tkzLabelPoints[above](C,Mi) + \end{tikzpicture} +\end{center} +\end{minipage} + +\begin{minipage}{.5\textwidth} +\begin{Verbatim} +\begin{tikzpicture}[scale=.5] + \tkzGetNodes + \tkzDrawPolygons[](A,B,C Ma,Mb,Mc) + \tkzDrawPoints(Ma,Mb,Mc,Ia,Ib,Ic) + \tkzDrawPoints[red](Ta,Tb,Tc) + \tkzLabelPoints[below](Ib) + \tkzLabelPoints[above left](Ia,Ic) + \tkzClipBB + \tkzDrawLines[add=0 and 1](Ia,Ma Ib,Mb Ic,Mc) + \tkzDrawLines[add=1 and 1](A,B A,C B,C) + \tkzDrawCircles[red](Ia,Ta Ib,Tb Ic,Tc) + \tkzDrawPoints(B,C,A,Mi) + \tkzLabelPoints(B,A) + \tkzLabelPoints[above](C,Mi) +\end{tikzpicture} +\end{Verbatim} +\end{minipage} + + +% subsubsection method_imeth_triangle_mittenpunkt (end) + +\subsubsection{Method \Imeth{triangle}{projection}} % (fold) +\label{ssub:method_imeth_triangle_projection} + +This involves obtaining the projections of a point onto the sides of a triangle. In the following example, we are going to find the projections of a centre of an exinscribed circle. + +\begin{minipage}{.5\textwidth} +\begin{Verbatim} +\directlua{% +init_elements () +z.A = point: new (0 , 0) +z.B = point: new (5 , 0) +z.C = point: new (-.4 , 4) +T.ABC = triangle: new (z.A,z.B,z.C) +z.J,_ = get_points(T.ABC: ex_circle (2)) +z.X , +z.Y, +z.Z = T.ABC : projection (z.J) +} +\end{Verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} +\directlua{% +init_elements () +z.A = point: new (0 , 0) +z.B = point: new (5 , 0) +z.C = point: new (-.4 , 4) +T.ABC = triangle: new (z.A,z.B,z.C) +z.J,_ = get_points(T.ABC: ex_circle (2)) +z.X , +z.Y, +z.Z = T.ABC : projection (z.J) +} +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygon(A,B,C) + \tkzDrawArc(J,X)(Y) + \tkzDrawSegments[blue](J,X J,Y J,Z C,Y C,X) + \tkzDrawPoints(A,B,C,J,X,Y,Z) + \tkzLabelPoints(J,X,Y) + \tkzLabelPoints[above](C,B,Z) + \tkzLabelPoints[left](A) + \tkzMarkRightAngles[fill=gray!20,opacity=.4](A,Z,J A,Y,J J,X,B) + \end{tikzpicture} +\end{center} +\end{minipage} + +\begin{minipage}{.5\textwidth} +\begin{Verbatim} +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygon(A,B,C) + \tkzDrawArc(J,X)(Y) + \tkzDrawSegments[blue](J,X J,Y J,Z C,Y C,X) + \tkzDrawPoints(A,B,C,J,X,Y,Z) + \tkzLabelPoints(J,X,Y) + \tkzLabelPoints[above](C,B,Z) + \tkzLabelPoints[left](A) + \tkzMarkRightAngles[fill=gray!20,opacity=.4](A,Z,J A,Y,J J,X,B) + \end{tikzpicture} +\end{center} +\end{Verbatim} +\end{minipage} + +% subsubsection method_imeth_triangle_projection (end) + +\subsubsection{Method \Imeth{triangle}{trilinear}} % (fold) +\label{ssub:method_imeth_triangle_trilinear} + +Given a reference triangle $ABC$, the trilinear coordinates of a point $P$ with respect to $ABC$ are an ordered triple of numbers, each of which is proportional to the directed distance from $P$ to one of the side lines. Trilinear coordinates are denoted alpha:beta:gamma or (alpha,beta,gamma) and also are known as homogeneous coordinates or "trilinears." Trilinear coordinates were introduced by Plücker in 1835. +[\href{https://mathworld.wolfram.com/TrilinearCoordinates.html}{Weisstein, Eric W. "Trilinear Coordinates." From MathWorld--A Wolfram Web Resource.}] + +\vspace{6pt} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} - scale = 2 - z.a = point: new (1,2) - z.b = point: new (5,1) - z.c = point: new (3,5) - T = triangle: new (z.a,z.b,z.c) - z.i = T.orthocenter - T.cevian = T : cevian (z.i) - z.ta,z.tb,z.tc = get_points (T.cevian) - C.cev = T : cevian_circle (z.i) - z.w = C.cev.center -\end{tkzelements} +\directlua{% +init_elements () +z.A = point : new ( 0 , 0 ) +z.B = point : new ( 4 , 0 ) +z.C = point : new ( 4 , 3 ) +T.ABC = triangle : new ( z.A , z.B , z.C ) +a = T.ABC.a +b = T.ABC.b +c = T.ABC.c +z.Gp = T.ABC : trilinear (b*c,a*c,a*b) +z.G = T.ABC : barycentric (1,1,1) +} \begin{tikzpicture} \tkzGetNodes -\tkzDrawPolygons(a,b,c ta,tb,tc) -\tkzDrawSegments(a,ta b,tb c,tc) -\tkzDrawPoints(a,b,c,i,ta,tb,tc) -\tkzLabelPoints(a,b,c,i) -\tkzDrawCircles(w,ta) +\tkzDrawPolygon(A,B,C) +\tkzDrawPoints(A,B,C,G',G) +\tkzLabelPoints(A,B,G') +\tkzLabelPoints[above](C,G) \end{tikzpicture} \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} -scale = 2 -z.a = point: new (1,2) -z.b = point: new (5,1) -z.c = point: new (3,5) -T = triangle: new (z.a,z.b,z.c) -z.i = T.orthocenter -T.cevian = T : cevian (z.i) -z.ta,z.tb,z.tc = get_points (T.cevian) -C.cev = T : cevian_circle (z.i) -z.w = C.cev.center -\end{tkzelements} +\directlua{% +init_elements () +z.A = point : new ( 0 , 0 ) +z.B = point : new ( 4 , 0 ) +z.C = point : new ( 4 , 3 ) +T.ABC = triangle : new ( z.A , z.B , z.C ) +a = T.ABC.a +b = T.ABC.b +c = T.ABC.c +z.Gp = T.ABC : trilinear (b*c,a*c,a*b) +z.G = T.ABC : barycentric (1,1,1) +} +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygon(A,B,C) + \tkzDrawPoints(A,B,C,G',G) + \tkzLabelPoints(A,B,G') + \tkzLabelPoints[above](C,G) + \end{tikzpicture} +\end{center} + +\end{minipage} +% subsubsection method_imeth_triangle_trilinear (end) + +\subsubsection{Method \Imeth{triangle}{barycentric\_coordinates}} % (fold) +\label{ssub:method_imeth_triangle_barycentric__coordinates} + +This method produces a triplet of coordinates which are the barycentric coordinates of a point as a function of the three points of a given triangle. + +\vspace{6pt} + +\begin{minipage}{.5\textwidth} + \begin{Verbatim} +\directlua{% +init_elements () + z.A = point: new (1,1) + z.B = point: new (8,0) + z.C = point: new (2,5) + T = triangle: new(z.A,z.B,z.C) + z.G = T.centroid + ca,cb,cc = T : barycentric_coordinates (z.G) +} \begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygons(A,B,C) + \tkzDrawPoints(A,B,C,G) + \tkzLabelPoints(A,B,C,G) + \tkzLabelPoint(G){\pmpn{\tkzUseLua{ca}}:\pmpn{\tkzUseLua{cb}}:\pmpn{\tkzUseLua{cc}}} +\end{tikzpicture} + \end{Verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} + \directlua{% +init_elements () + scale = .75 + z.A = point: new (1,1) + z.B = point: new (8,0) + z.C = point: new (2,5) + T = triangle: new(z.A,z.B,z.C) + z.G = T.centroid + ca,cb,cc = T : barycentric_coordinates (z.G) + } + \begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygons(A,B,C) + \tkzDrawPoints(A,B,C,G) + \tkzLabelPoints(A,B) + \tkzLabelPoints[above](C) \tkzLabelPoint(G){\pmpn{\tkzUseLua{ca}}:\pmpn{\tkzUseLua{cb}}:\pmpn{\tkzUseLua{cc}}} + \end{tikzpicture} + \end{center} +\end{minipage} + +% subsubsection method_imeth_triangle_barycentric__coordinates (end) + +\subsubsection{Method \Imeth{triangle}{base}} % (fold) +\label{ssub:method_imeth_triangle_base} + +In the next example, the point $D$ is defined by $\overrightarrow{AD} = 1\cdot \overrightarrow{AB}+1\cdot \overrightarrow{AC}$. + +\vspace{6pt} +\begin{minipage}{.5\textwidth} +\begin{Verbatim} +\directlua{% +init_elements () + scale = .75 + z.A = point: new (1,1) + z.B = point: new (8,0) + z.C = point: new (0,5) + z.X = point: new (2,2) + T = triangle: new(z.A,z.B,z.C) + z.D = T : base (1,1) + z.E = T : base (.5,1) +} +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygons(A,B,D,C A,B,E,C) + \tkzDrawPoints(A,B,C,D,E) + \tkzLabelPoints(A,B) + \tkzLabelPoints[above](C,D,E) +\end{tikzpicture} +\end{Verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} + \directlua{% +init_elements () + scale = .75 + z.A = point: new (1,1) + z.B = point: new (8,0) + z.C = point: new (0,5) + z.X = point: new (2,2) + T = triangle: new(z.A,z.B,z.C) + z.D = T : base (1,1) + z.E = T : base (.5,1) + } + \begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygons(A,B,D,C A,B,E,C) + \tkzDrawPoints(A,B,C,D,E) + \tkzLabelPoints(A,B) + \tkzLabelPoints[above](C,D,E) + \end{tikzpicture} + \end{center} + +\end{minipage} + +% subsubsection method_imeth_triangle_base (end) + + +\subsubsection{Method \Imeth{triangle}{euler\_points}} % (fold) +\label{ssub:method_imeth_triangle_euler__points} + +The points $a$, $b$ and $c$ are the Euler points. They are the midpoints of the segments $AH$, $BH$ and $CH$. + +\begin{minipage}{.5\textwidth} + \begin{Verbatim} + \directlua{% +init_elements () + scale = 1.25 + z.A = point: new (0,0) + z.B = point: new (5,0) + z.C = point: new (1,4) + T = triangle: new(z.A,z.B,z.C) + z.N = T.eulercenter + z.a, + z.b, + z.c = get_points (T : euler ()) + z.H = T.orthocenter + T.orthic = T: orthic() + z.Ha, + z.Hb, + z.Hc = get_points (T.orthic) + } + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygons[red](A,B,C) + \tkzDrawPolygons[cyan](a,b,c) + \tkzDrawCircle[purple](N,a) + \tkzDrawPoints(a,b,B,C,A,c,H) + \tkzDrawSegments[red](C,Hc B,Hb A,Ha) + \tkzLabelPoints(A,B,a,b,H) + \tkzLabelPoints[above](c,C) + \end{tikzpicture} + \end{Verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} + \directlua{% +init_elements () + scale = 1.25 + z.A = point: new (0,0) + z.B = point: new (5,0) + z.C = point: new (1,4) + T = triangle: new(z.A,z.B,z.C) + z.N = T.eulercenter + z.a, + z.b, + z.c = get_points (T : euler ()) + z.H = T.orthocenter + T.orthic = T: orthic() + z.Ha, + z.Hb, + z.Hc = get_points (T.orthic) +} + +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygons[red](A,B,C) + \tkzDrawPolygons[cyan](a,b,c) + \tkzDrawCircle[purple](N,a) + \tkzDrawPoints(a,b,B,C,A,c,H) + \tkzDrawSegments[red](C,Hc B,Hb A,Ha) + \tkzLabelPoints(A,B,a,b,H) + \tkzLabelPoints[above](c,C) + \end{tikzpicture} +\end{center} +\end{minipage} +% subsubsection method_imeth_triangle_euler__points (end) + +\subsubsection{Method \Imeth{triangle}{nine\_points}} % (fold) +\label{ssub:method_imeth_triangle_nine__points} + +This method gives the nine main points belonging to the Euler circle: in order, first the midpoints of the sides of the triangle, then the feet of the altitudes and finally the three Euler points. Refer to the last example. +In the next example, we look for the centre of gravity in two different ways: the first uses the \code{trilinear} method, the second the \code{barycentric} method. + +\vspace{6pt} +\begin{minipage}{.5\textwidth} +\begin{Verbatim} +\directlua{% +init_elements () + scale = 1.5 + z.A = point: new (0,0) + z.B = point: new (5,0) + z.C = point: new (1,4) + T = triangle: new(z.A,z.B,z.C) + z.N = T.eulercenter + z.e1, + z.e2, + z.e3, + z.e4, + z.e5, + z.e6, + z.e7, + z.e8, + z.e9 = T : nine_points () +} +\end{Verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} +\directlua{% +init_elements () + scale = 1.5 + z.A = point: new (0,0) + z.B = point: new (5,0) + z.C = point: new (1,4) + T = triangle: new(z.A,z.B,z.C) + z.N = T.eulercenter + z.e1, + z.e2, + z.e3, + z.e4, + z.e5, + z.e6, + z.e7, + z.e8, + z.e9 = T : nine_points () +} +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygons[red](A,B,C) + \tkzDrawCircle[purple](N,e1) + \tkzDrawPoints(e1,e2,e3,e4,e5,e6,e7,e8,e9) + \tkzLabelPoints(e1,e2,e3,e4,e5,e6,e7,e8,e9) +\end{tikzpicture} +\end{minipage} + +\begin{minipage}{.5\textwidth} +\begin{Verbatim} +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygons[red](A,B,C) + \tkzDrawCircle[purple](N,e1) + \tkzDrawPoints(e1,e2,e3,e4,e5,e6,e7,e8,e9) + \tkzLabelPoints(e1,e2,e3,e4,e5,e6,e7,e8,e9) +\end{tikzpicture} +\end{Verbatim} +\end{minipage} + +% subsubsection method_imeth_triangle_nine__points (end) + +\subsubsection{Method \Imeth{triangle}{altitude}} % (fold) +\label{ssub:method_imeth_triangle_altitude} + +There are several methods to obtain one or more altitudes of a triangle. One possible method is the \Imeth{triangle}{orthic} method. This method allows for defining the \code{orthic} triangle whose vertices are the feet of the altitudes from each vertex. If only one altitude is needed, one can use the \code{altitude(n)} method. The numeric value $n$ can be $0$, $1$, or $2$. By default, if it is absent, it is considered to be $0$. Considering the triangle $ABC$, $n=0$ means no cyclic permutation of the vertices, and the altitude will be from the first point, here $A$. If $n=1$, the point trio $BCA$ is considered, and the altitude will be from $B$. For $n=2$, the altitude will be from $C$. + +\vspace{6pt} +\begin{minipage}{.5\textwidth} +\begin{Verbatim} +\directlua{% +init_elements () + z.A = point: new (0,0) + z.B = point: new (5,0) + z.C = point: new (2,4) + T = triangle: new(z.A,z.B,z.C) + z.H = T.orthocenter + L.HA = T : altitude () + L.HC = T :altitude (2) + z.Hc = L.HC.pb + z.Ha = L.HA.pb + z.a,z.b,z.c = get_points (T : orthic ()) +} +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygon(A,B,C) + \tkzDrawPolygon[red](a,b,c) + \tkzDrawPoints(A,B,C,H) + \tkzDrawSegments[red](C,Hc A,Ha) + \tkzLabelPoints(A,B,H) + \tkzLabelPoints[font=\small](Hc) + \tkzLabelPoints[font=\small,above](Ha,C) + \tkzMarkRightAngles[fill = gray!30,opacity=.4](B,Hc,C A,Ha,C) + \end{tikzpicture} +\end{Verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} +\directlua{% +init_elements () + z.A = point: new (0,0) + z.B = point: new (5,0) + z.C = point: new (2,4) + T = triangle: new(z.A,z.B,z.C) + z.H = T.orthocenter + L.HA = T : altitude () + L.HC = T : altitude (2) + z.Hc = L.HC.pb + z.Ha = L.HA.pb + z.a,z.b,z.c = get_points (T : orthic ()) +} +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygon(A,B,C) + \tkzDrawPolygon[red](a,b,c) + \tkzDrawPoints(A,B,C,H) + \tkzDrawSegments[red](C,Hc A,Ha) + \tkzLabelPoints(A,B,H) + \tkzLabelPoints[font=\small](Hc) + \tkzLabelPoints[font=\small,above](Ha,C) + \tkzMarkRightAngles[fill = gray!30,opacity=.4](B,Hc,C A,Ha,C) + \end{tikzpicture} +\end{center} + +\end{minipage} +% subsubsection method_imeth_triangle_altitude (end) + +\subsubsection{Method \Imeth{triangle}{bisector}} % (fold) +\label{ssub:method_imeth_triangle_bisector} + +There are several methods to obtain one or more bisectors of a triangle. One possible method is the \Imeth{triangle}{incentral} method. This method allows for defining the \code{incentral} triangle whose vertices are the feet of the bisectors from each vertex. If only one bisector is needed, one can use the \code{bisector(n)} method. The numeric value $n$ can be $0$, $1$, or $2$. By default, if it is absent, it is considered to be $0$. Considering the triangle $ABC$, $n=0$ means no cyclic permutation of the vertices, and the bisector will be from the first point, here $A$. If $n=1$, the point trio $BCA$ is considered, and the bisector will be from $B$. For $n=2$, the bisector will be from $C$. + +\vspace{6pt} + +\begin{minipage}{.5\textwidth} +\begin{Verbatim} +\directlua{% +init_elements () + z.A = point : new (0 , 0) + z.B = point : new (3 , 2) + z.C = point : new (2 , 5) + T.ABC = triangle : new ( z.A , z.B , z.C ) + L.AE = T.ABC : bisector () + z.E = L.AE.pb + z.F = T.ABC : bisector (1).pb + z.a,z.b,z.c = get_points (T.ABC : incentral ()) +} +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygon(A,B,C) + \tkzDrawPolygon[red](a,b,c) + \tkzDrawLines(A,B A,C A,E B,F) + \tkzDrawPoints(A,B,C,a,b,c) + \tkzLabelPoints(A,B,c) + \tkzLabelPoints[above](C,b,a) + \tkzMarkAngles[mark=|](B,A,a a,A,C) + \tkzMarkAngles[mark=||](C,B,b b,B,A) +\end{tikzpicture} +\end{Verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} +\directlua{% +init_elements () + z.A = point : new (0 , 0) + z.B = point : new (3 , 2) + z.C = point : new (2 , 5) + T.ABC = triangle : new ( z.A , z.B , z.C ) + L.AE = T.ABC : bisector () + z.E = L.AE.pb + z.F = T.ABC : bisector (1).pb + z.a,z.b,z.c = get_points (T.ABC : incentral ()) +} +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygon(A,B,C) + \tkzDrawPolygon[red](a,b,c) + \tkzDrawLines(A,B A,C A,E B,F) + \tkzDrawPoints(A,B,C,a,b,c) + \tkzLabelPoints(A,B,c) + \tkzLabelPoints[above](C,b,a) + \tkzMarkAngles[cyan,mark=|,size=.75](B,A,a a,A,C) + \tkzMarkAngles[mark=||,size=.5](C,B,b b,B,A) + \end{tikzpicture} +\end{center} + +\end{minipage} + +% subsubsection method_imeth_triangle_bisector (end) + +%%%%%% Circles %%%%%% + +\subsubsection{Method \Imeth{triangle}{euler\_circle}} % (fold) +\label{ssub:method_imeth_triangle_euler_circle} + +The nine-point circle, also called Euler's circle or the Feuerbach circle, is the circle that passes through the perpendicular feet $H_A, H_B, and H_C$ dropped from the vertices of any reference triangle DeltaABC on the sides opposite them. Euler showed in 1765 that it also passes through the midpoints$ M_A, M_B, M_C$ of the sides of DeltaABC. By Feuerbach's theorem, the nine-point circle also passes through the midpoints $E_A, E_B, and E_C$ of the segments that join the vertices and the orthocenter $H$. These points are commonly referred to as the Euler points. +\href{https://mathworld.wolfram.com/Nine-PointCircle.html}{Weisstein, Eric W. "Nine-Point Circle." From MathWorld--A Wolfram Web Resource.} + +\vspace{6pt} +There are several ways of obtaining the Euler circle. The first would be to use an attribute of the triangle to determine the centre. This centre is defined by |z.N = T.eulercenter|. Next, the circle passes through the midpoint of one of the sides. IF this circle is useful later on, it is best to define it using the \code{euler\_circle} method. + +\vspace{6pt} +\begin{minipage}{.5\textwidth} +\begin{Verbatim} +\directlua{% +init_elements () + z.A = point: new (0,0) + z.B = point: new (5,0) + z.C = point: new (1,4) + T = triangle: new(z.A,z.B,z.C) + C.euler = T : euler_circle () + z.N,z.K = get_points (C.euler) +} +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygons[red](A,B,C) + \tkzDrawCircle(N,K) + \tkzDrawPoints(A,B,C,N,K) + \tkzLabelPoints(A,B,N) + \tkzLabelPoints[above](C,K) +\end{tikzpicture} +\end{Verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} +\directlua{% +init_elements () + z.A = point: new (0,0) + z.B = point: new (5,0) + z.C = point: new (1,4) + T = triangle: new(z.A,z.B,z.C) + C.euler = T : euler_circle () + z.N,z.K = get_points (C.euler) +} +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygons[red](A,B,C) + \tkzDrawCircle(N,K) + \tkzDrawPoints(A,B,C,N,K) + \tkzLabelPoints(A,B,N) + \tkzLabelPoints[above](C,K) + \end{tikzpicture} +\end{center} + +\end{minipage} + +% subsubsection method_imeth_triangle_euler_circle (end) + +\subsubsection{Method \Imeth{triangle}{circum\_circle}} % (fold) +\label{ssub:method_imeth_triangle_circum_circle} + +To obtain the circumscribed circle, simply use the \code{T.circumcenter} attribute, but if it is necessary to determine the circle then the method is \code{circum\_circle}. + +\begin{minipage}{.5\textwidth} +\begin{Verbatim} +\directlua{% +init_elements () + z.A = point: new (0,0) + z.B = point: new (5,0) + z.C = point: new (1,4) + T = triangle: new(z.A,z.B,z.C) + C.circum = T : circum_circle () + z.O,z.K = get_points (C.circum) +} +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygons[red](A,B,C) + \tkzDrawCircle(O,K) + \tkzDrawPoints(A,B,C,O,K) + \tkzLabelPoints(A,B,O) + \tkzLabelPoints[above](C,K) +\end{tikzpicture} +\end{Verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} +\directlua{% +init_elements () + z.A = point: new (0,0) + z.B = point: new (5,0) + z.C = point: new (1,4) + T = triangle: new(z.A,z.B,z.C) + C.circum = T : circum_circle () + z.O,z.K = get_points (C.circum) +} + +\begin{center} +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygons[red](A,B,C) + \tkzDrawCircle(O,K) + \tkzDrawPoints(A,B,C,O,K) + \tkzLabelPoints(A,B,O) + \tkzLabelPoints[above](C,K) +\end{tikzpicture} +\end{center} + +\end{minipage} + +% subsubsection method_imeth_triangle_circum_circle (end) + +\subsubsection{Method \Imeth{triangle}{in\_circle}} % (fold) +\label{ssub:method_imeth_triangle_in_circle} + +An incircle is an inscribed circle of a polygon, i.e., a circle that is tangent to each of the polygon's sides. The center $I$ of the incircle is called the incenter, and the radius $r$ of the circle is called the inradius. + +The incenter is the point of concurrence of the triangle's angle bisectors. In addition, the points $M_A, M_B, and M_C$ of intersection of the incircle with the sides of $ABC$ are the polygon vertices of the pedal triangle [\ref{ssub:method_imeth_triangle_pedal}] taking the incenter as the pedal point (c.f. tangential triangle [\ref{ssub:method_imeth_triangle_medial}]). This triangle is called the contact triangle. + +[\href{https://mathworld.wolfram.com/Incircle.html}{Weisstein, Eric W. "Incircle." From MathWorld--A Wolfram Web Resource.}] + +\vspace{6pt} + +\directlua{% +init_elements () + scale = 2 + z.A = point : new (0 , 0) + z.B = point : new (5 , 0) + z.C = point : new (1 , 3) + T.ABC = triangle : new ( z.A , z.B , z.C ) + z.E = T.ABC : bisector ().pb + z.F = T.ABC : bisector (1).pb + z.G = T.ABC : bisector (2).pb + C.IH = T.ABC : in_circle () + z.I,z.H = get_points (C.IH) +} +\begin{tikzpicture}% + [ new/.style ={ color = orange }, + one/.style = { new,/tkzmkangle/size=.5 }, + two/.style = { new,/tkzmkangle/size=.6 }, + l/.style = { /tkzmkangle/arc=l }, + ll/.style = { /tkzmkangle/arc=ll }, + lll/.style = { /tkzmkangle/arc=lll }] \tkzGetNodes -\tkzDrawPolygons(a,b,c ta,tb,tc) -\tkzDrawSegments(a,ta b,tb c,tc) -\tkzDrawPoints(a,b,c,i,ta,tb,tc) -\tkzLabelPoints(a,b,c,i) -\tkzDrawCircles(w,ta) +\tkzDrawPolygon(A,B,C) +\tkzDrawSegments[new](A,E B,F C,G) + \tkzDrawSegments[dashed,add=0 and .5](I,H) + \tkzDrawPoints(A,B,C,E,F,G,I) + \tkzDrawCircle(I,H) + \tkzDrawPoints(I,A,B,C,H) +\begin{scope}[one] + \tkzMarkAngles[l](B,A,E) + \tkzMarkAngles[ll](C,B,F) + \tkzMarkAngles[lll](A,C,G) +\end{scope} +\begin{scope}[two] + \tkzMarkAngles[l](E,A,C) + \tkzMarkAngles[ll](F,B,A) + \tkzMarkAngles[lll](G,C,B) +\end{scope} +\tkzLabelPoints(A,B,I) +\tkzLabelPoints[above](C,H) \end{tikzpicture} + + + +\begin{minipage}{.5\textwidth} +\begin{Verbatim} +\directlua{% +init_elements () + z.A = point : new (0 , 0) + z.B = point : new (5 , 0) + z.C = point : new (1 , 3) + T.ABC = triangle : new(z.A,z.B,z.C) + z.E = T.ABC : bisector ().pb + z.F = T.ABC : bisector (1).pb + z.G = T.ABC : bisector (2).pb + C.IH = T.ABC : in_circle () + z.I,z.H = get_points (C.IH) +} +\end{Verbatim} \end{minipage} +\begin{minipage}{.5\textwidth} +\begin{Verbatim} +\begin{tikzpicture}% + [ new/.style ={color = orange }, + one/.style = { new,/tkzmkangle/size=.5 }, + two/.style = { new,/tkzmkangle/size=.6 }, + l/.style = { /tkzmkangle/arc=l }, + ll/.style = { /tkzmkangle/arc=ll }, + lll/.style = { /tkzmkangle/arc=lll }] +\tkzGetNodes +\tkzDrawPolygon(A,B,C) +\tkzDrawSegments[new](A,E B,F C,G) +\tkzDrawSegments[dashed,add=0 and .5](I,H) +\tkzDrawPoints(A,B,C,E,F,G,I) +\tkzDrawCircle(I,H) +\tkzDrawPoints(I,A,B,C,H) +\begin{scope}[one] + \tkzMarkAngles[l](B,A,E) + \tkzMarkAngles[ll](C,B,F) + \tkzMarkAngles[lll](A,C,G) +\end{scope} +\begin{scope}[two] + \tkzMarkAngles[l](E,A,C) + \tkzMarkAngles[ll](F,B,A) + \tkzMarkAngles[lll](G,C,B) +\end{scope} +\tkzLabelPoints(A,B,I) +\tkzLabelPoints[above](C,H) +\end{tikzpicture} +\end{Verbatim} +\end{minipage} + + +% subsubsection method_imeth_triangle_in_circle (end) + +\subsubsection{Method \Imeth{triangle}{ex\_circle}} % (fold) +\label{ssub:method_imeth_triangle_ex__circle} + +Given a triangle, extend two sides in the direction opposite their common vertex. The circle tangent to these two lines and to the other side of the triangle is called an excircle, or sometimes an escribed circle. The center of the excircle is called the excenter and lies on the external angle bisector of the opposite angle. + +\vspace{6pt} +\begin{minipage}{.5\textwidth} +\begin{Verbatim} +\directlua{% +init_elements () +z.A = point: new (0 , 0) +z.B = point: new (5 , 0) +z.C = point: new (-.4 , 4) +T.ABC = triangle: new (z.A,z.B,z.C) +z.I,_ = get_points(T.ABC: ex_circle ()) +z.J,_ = get_points(T.ABC: ex_circle (1)) +z.K,_ = get_points(T.ABC: ex_circle (2)) +z.Xk , +z.Yk, +z.Zk = T.ABC : projection (z.K) +z.Xi , +z.Yi, +z.Zi = T.ABC : projection (z.I) +z.Xj , +z.Yj, +z.Zj = T.ABC : projection (z.J) +} +\end{Verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} +\directlua{% +init_elements () + scale = .5 +z.A = point: new (0 , 0) +z.B = point: new (5 , 0) +z.C = point: new (-.4 , 4) +T.ABC = triangle: new (z.A,z.B,z.C) +z.I,_ = get_points(T.ABC: ex_circle ()) +z.J,_ = get_points(T.ABC: ex_circle (1)) +z.K,_ = get_points(T.ABC: ex_circle (2)) +z.Xk , +z.Yk, +z.Zk = T.ABC : projection (z.K) +z.Xi , +z.Yi, +z.Zi = T.ABC : projection (z.I) +z.Xj , +z.Yj, +z.Zj = T.ABC : projection (z.J) +} +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygon(A,B,C) + \tkzDrawArc(K,Xk)(Yk) + \tkzDrawArc(I,Yi)(Zi) + \tkzDrawArc(J,Zj)(Yj) + \tkzDrawSegments[blue](K,Xk K,Yk K,Zk C,Yk C,Xk I,Xi J,Yj) + \tkzDrawPoints(A,B,C,I,J,K,Xk,Yk,Zk,Xi,Yj) + \tkzLabelPoints(K,Xk,Yk) + \tkzLabelPoints[above](C,B,Zk,I,J) + \tkzLabelPoints[left](A) + \tkzMarkRightAngles[fill=gray!20,opacity=.4](A,Zk,K A,Yk,K K,Xk,B) + \end{tikzpicture} +\end{center} +\end{minipage} + +\begin{minipage}{.5\textwidth} +\begin{Verbatim} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygon(A,B,C) + \tkzDrawArc(K,Xk)(Yk) + \tkzDrawArc(I,Yi)(Zi) + \tkzDrawArc(J,Zj)(Yj) + \tkzDrawSegments[blue](K,Xk K,Yk K,Zk C,Yk C,Xk I,Xi J,Yj) + \tkzDrawPoints(A,B,C,I,J,K,Xk,Yk,Zk,Xi,Yj) + \tkzLabelPoints(K,Xk,Yk) + \tkzLabelPoints[above](C,B,Zk,I,J) + \tkzLabelPoints[left](A) + \tkzMarkRightAngles[fill=gray!20,opacity=.4](A,Zk,K A,Yk,K K,Xk,B) + \end{tikzpicture} +\end{Verbatim} +\end{minipage} + +% subsubsection method_imeth_triangle_ex__circle (end) + +\subsubsection{Method \Imeth{triangle}{spieker\_circle}} % (fold) +\label{ssub:method_imeth_triangle_spieker__circle} + +In geometry, the incircle of the medial triangle of a triangle is the Spieker circle. Its center is the Spieker center. + +\begin{minipage}{.5\textwidth} +\directlua{% +init_elements () + scale = 1.5 + z.A = point: new (1,1) + z.B = point: new (5,1) + z.C = point: new (2.2,4) + T = triangle: new (z.A,z.B,z.C) + C.first_lemoine = T:spieker_circle() + z.S,z.w = get_points( C.first_lemoine ) + z.Ma,z.Mb,z.Mc = get_points(T : medial ()) + z.N = T : nagel_point () + z.Qa = midpoint(z.A,z.N) + z.Qb = midpoint(z.B,z.N) + z.Qc = midpoint(z.C,z.N) +} +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygons(A,B,C Qa,Qb,Qc) + \tkzDrawPolygons[red](Ma,Mb,Mc) + \tkzDrawCircles[red](S,w) + \tkzDrawSegments[dashed](N,A N,B N,C) + \tkzDrawPoints(A,B,C,S,w,Ma,Mb,Mc,Qa,Qb,Qc,N) + \tkzLabelPoints(A,B,S,w,Mc,N) + \tkzLabelPoints[above](C,Ma,Mb,Qa,Qb,Qc) + \end{tikzpicture} +\end{center} +\end{minipage} + +\begin{minipage}{.5\textwidth} +\begin{Verbatim} +\directlua{% +init_elements () + z.A = point: new (1,1) + z.B = point: new (5,1) + z.C = point: new (2.2,4) + T = triangle: new (z.A,z.B,z.C) + C.first_lemoine = T:spieker_circle() + z.S,z.w = get_points( C.first_lemoine ) + z.Ma,z.Mb,z.Mc = get_points(T : medial ()) + z.N = T : nagel_point () + z.Qa = midpoint(z.A,z.N) + z.Qb = midpoint(z.B,z.N) + z.Qc = midpoint(z.C,z.N) +} +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygons(A,B,C Qa,Qb,Qc) + \tkzDrawPolygons[red](Ma,Mb,Mc) + \tkzDrawCircles[red](S,w) + \tkzDrawSegments[dashed](N,A N,B N,C) + \tkzDrawPoints(A,B,C,S,w,Ma,Mb,Mc,Qa,Qb,Qc,N) + \tkzLabelPoints(A,B,S,w,Mc,N) + \tkzLabelPoints[above](C,Ma,Mb,Qa,Qb,Qc) +\end{tikzpicture} +\end{Verbatim} +\end{minipage} + + +% subsubsection method_imeth_triangle_spieker__circle (end) + +\subsubsection{Methods \Imeth{triangle}{cevian} and \Imeth{triangle}{cevian\_circle}} % (fold) +\label{ssub:method_imeth_triangle_cevian} + +A Cevian is a line segment which joins a vertex of a triangle with a point on the opposite side (or its extension). The condition for three general Cevians from the three vertices of a triangle to concur is known as Ceva's theorem. + +Picking a Cevian point $P$ in the interior of a triangle $ABC$ and drawing Cevians from each vertex through $P$ to the opposite side produces a set of three intersecting Cevians $APa$, $BPb$, and $CPc$ with respect to that point. The triangle $PaPbPc$ is known as the Cevian triangle of $ABC$ with respect to $P$, and the circumcircle of $PaPbPc$ is similarly known as the Cevian circle. [\href{https://mathworld.wolfram.com/CevianTriangle.html}{Weisstein, Eric W. "Cevian Triangle." From MathWorld--A Wolfram Web Resource.}] + + +\vspace{6pt} + +\directlua{% +init_elements () + scale = 1.25 + z.A = point: new (0,0) + z.B = point: new (4,0) + z.C = point: new (1.8,3) + T.ABC = triangle: new(z.A,z.B,z.C) + z.Q = point : new (1,-0.4) + z.P = point : new (2,1) + T.cevian = T.ABC : cevian (z.Q) + z.Qa,z.Qb,z.Qc = get_points (T.cevian) + T.cevian = T.ABC : cevian (z.P) + z.Pa,z.Pb,z.Pc = get_points (T.cevian) + C.cev = T.ABC : cevian_circle (z.P) + z.w = C.cev.center +} +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygons[cyan](A,B,C) + \tkzDrawSegments[cyan](A,Qb B,Qa) + \tkzDrawSegments[red](A,Qa B,Qb C,Q) + \tkzDrawSegments[blue](A,Pa B,Pb C,Pc) + \tkzDrawCircles(w,Pa) + \tkzDrawPoints(A,B,C,Qa,Qb,Qc,P,Q,Pa,Pb,Pc) + \tkzLabelPoints(A,B,P,Q,Pc) + \tkzLabelPoints[above](C,Qc) + \tkzLabelPoints[left](Qb,Pb) + \tkzLabelPoints[right](Qa,Pa) + \end{tikzpicture} +\end{center} + + +\begin{minipage}{.5\textwidth} +\begin{Verbatim} +\directlua{% +init_elements () + z.A = point: new (0,0) + z.B = point: new (4,0) + z.C = point: new (1.8,3) + T.ABC = triangle: new(z.A,z.B,z.C) + z.Q = point : new (1,-0.4) + z.P = point : new (2,1) + T.cevian = T.ABC : cevian (z.Q) + z.Qa,z.Qb,z.Qc = get_points (T.cevian) + T.cevian = T.ABC : cevian (z.P) + z.Pa,z.Pb,z.Pc = get_points (T.cevian) + C.cev = T.ABC : cevian_circle (z.P) + z.w = C.cev.center +} +\begin{tikzpicture} +\tkzGetNodes +\tkzDrawPolygons[cyan](A,B,C) +\tkzDrawSegments[cyan](A,Qb B,Qa) +\tkzDrawSegments[red](A,Qa B,Qb C,Q) +\tkzDrawSegments[blue](A,Pa B,Pb C,Pc) +\tkzDrawCircles(w,Pa) +\tkzDrawPoints(A,B,C,Qa,Qb,Qc,P,Q,Pa,Pb,Pc) +\tkzLabelPoints(A,B,P,Q,Pc) +\tkzLabelPoints[above](C,Qc) +\tkzLabelPoints[left](Qb,Pb) +\tkzLabelPoints[right](Qa,Pa) +\end{tikzpicture} +\end{Verbatim} +\end{minipage} + % subsubsection method_imeth_triangle_cevian (end) -\subsubsection{Méthodes \Imeth{triangle}{pedal} et \Imeth{triangle}{pedal\_circle}} % (fold) +\subsubsection{Methods \Imeth{triangle}{pedal} and \Imeth{triangle}{pedal\_circle}} % (fold) \label{ssub:method_imeth_triangle_pedal} +Given a point $P$, the pedal triangle of $P$ is the triangle whose polygon vertices are the feet of the perpendiculars from $P$ to the side lines. + +\vspace{6pt} \begin{minipage}{.5\textwidth} \begin{Verbatim} - \begin{tkzelements} + \directlua{% +init_elements () z.A = point: new(0,0) z.B = point: new(5,0) z.C = point: new(1.5,3) - z.O = point: new (2,1) + z.O = point: new (2,1) T.ABC = triangle: new (z.A,z.B,z.C) T.pedal = T.ABC : pedal (z.O) z.E,z.F,z.G = get_points(T.pedal) C.pedal = T.ABC : pedal_circle (z.O) z.w = C.pedal.center z.T = C.pedal.through - \end{tkzelements} + } \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygon(A,B,C) \tkzDrawPolygon[red](E,F,G) \tkzDrawCircle(w,T) \tkzDrawPoints(A,B,C,E,F,G,O) - \tkzLabelPoints(A,B,C,E,F,G) + \tkzLabelPoints(A,B,G) + \tkzLabelPoints[above](C,E,F) \tkzDrawSegments(O,E O,F O,G) \end{tikzpicture} \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () z.A = point: new(0,0) z.B = point: new(5,0) z.C = point: new(1.5,3) - z.O = point: new (2,1) + z.O = point: new (2,1) T.ABC = triangle: new (z.A,z.B,z.C) T.pedal = T.ABC : pedal (z.O) z.E,z.F,z.G = get_points(T.pedal) C.pedal = T.ABC : pedal_circle (z.O) z.w = C.pedal.center z.T = C.pedal.through - \end{tkzelements} - \begin{tikzpicture} - \tkzGetNodes - \tkzDrawPolygon(A,B,C) - \tkzDrawPolygon[red](E,F,G) - \tkzDrawCircle(w,T) - \tkzDrawPoints(A,B,C,E,F,G,O) - \tkzLabelPoints(A,B,C,E,F,G) - \tkzDrawSegments(O,E O,F O,G) - \end{tikzpicture} + } + \begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygon(A,B,C) + \tkzDrawPolygon[red](E,F,G) + \tkzDrawCircle(w,T) + \tkzDrawPoints(A,B,C,E,F,G,O) + \tkzLabelPoints(A,B,G) + \tkzLabelPoints[above](C,E,F) + \tkzDrawSegments(O,E O,F O,G) + \end{tikzpicture} + \end{center} + \end{minipage} % subsubsection method_imeth_triangle_pedal (end) -\subsubsection{Méthodes \Imeth{triangle}{conway\_points} et \Imeth{triangle}{conway\_circle}} % (fold) +\subsubsection{Methods \Imeth{triangle}{conway\_points} and \Imeth{triangle}{conway\_circle}} % (fold) \label{ssub:method_imeth_triangle_conway} -En géométrie plane, le théorème du cercle de Conway stipule que lorsque les côtés se rencontrant à chaque sommet d'un triangle sont prolongés par la longueur du côté opposé, les six points d'extrémité des trois segments de droite résultants se trouvent sur un cercle dont le centre est le centre d'incidence du triangle. +In plane geometry, Conway's circle theorem states that when the sides meeting at each vertex of a triangle are extended by the length of the opposite side, the six endpoints of the three resulting line segments lie on a circle whose centre is the centre of incidence of the triangle. +\vspace{6pt} \begin{minipage}{.5\textwidth} \begin{Verbatim} - \begin{tkzelements} + \directlua{% +init_elements () z.A = point:new (0,0) z.C = point:new (5,0) z.B = point:new (1,3) @@ -380,7 +1572,7 @@ En géométrie plane, le théorème du cercle de Conway stipule que lorsque les z.w,z.t = get_points(C.conway) z.t1,z.t2,z.t3,z.t4, z.t5,z.t6= T.ABC : conway_points () - \end{tkzelements} + } \hspace*{5cm} \begin{tikzpicture} \tkzGetNodes @@ -397,7 +1589,8 @@ En géométrie plane, le théorème du cercle de Conway stipule que lorsque les \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () scale = .5 z.A = point:new (0,0) z.C = point:new (5,0) @@ -407,7 +1600,7 @@ En géométrie plane, le théorème du cercle de Conway stipule que lorsque les z.w,z.t = get_points(C.conway) z.t1,z.t2,z.t3, z.t4,z.t5,z.t6= T.ABC : conway_points () - \end{tkzelements} + } \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygon(A,B,C) @@ -424,12 +1617,575 @@ En géométrie plane, le théorème du cercle de Conway stipule que lorsque les % subsubsection methode_imeth_triangle_conway (end) +\subsubsection{Methods \Imeth{triangle}{bevan\_circle} and \Imeth{triangle}{bevan\_point} } % (fold) +\label{ssub:methods_imeth_triangle_bevan_circle_and_imeth_triangle_bevan_point} + +\begin{minipage}{.5\textwidth} +\begin{Verbatim} +\directlua{% +init_elements () + scale = .5 + z.A = point: new (1,1) + z.B = point: new (6,0) + z.C = point: new (2,4) + T = triangle: new(z.A,z.B,z.C) + C.bevan = T : bevan_circle () + z.c,z.t = get_points (C.bevan) + % or z.c = T : bevan_point () +} +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygons(A,B,C) + \tkzDrawCircle(c,t) + \tkzDrawPoints(A,B,C,c,t) + \tkzLabelPoints(A,B,c,t) + \tkzLabelPoints[above](C) +\end{tikzpicture} +\end{Verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} + \directlua{% +init_elements () + scale =.5 + z.A = point: new (1,1) + z.B = point: new (6,0) + z.C = point: new (2,4) + T = triangle: new(z.A,z.B,z.C) + C.bevan = T : bevan_circle () + z.c,z.t = get_points (C.bevan) + } + \begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygons(A,B,C) + \tkzDrawCircle(c,t) + \tkzDrawPoints(A,B,C,c,t) + \tkzLabelPoints(A,B,c,t) + \tkzLabelPoints[above](C) + \end{tikzpicture} + \end{center} + +\end{minipage} + +% subsubsection methods_imeth_triangle_bevan_circle_and_imeth_triangle_bevan_point (end) + + + +%%%%%% Triangles %%%%% + + + +\subsubsection{Method \Imeth{triangle}{feuerbach} and method \Imeth{triangle}{feuerbach\_point}} % (fold) +\label{ssub:method_imeth_triangle_feuerbach} + +The Feuerbach triangle is the triangle formed by the three points of tangency of the nine-point circle with the excircles. (The fact that the excircles touch the nine-point circle is known as Feuerbach's theorem.) +Refer to \href{https://mathworld.wolfram.com/FeuerbachTriangle.html}{Weisstein, Eric W. "Feuerbach Triangle." From MathWorld--A Wolfram Web Resource.}. + +The exinscribed circles of a triangle are tangent to the circle of the nine points of a triangle at points which form the \code{Feuerbach} triangle ($FaFbFc$). The inscribed circle and the circle of nine points are tangent at a point called the Feurerbach point $F$. + +\vspace{6pt} +\begin{minipage}{.5\textwidth} + \begin{Verbatim} +\directlua{% +init_elements () + scale = .8 + z.A = point: new (0,0) + z.B = point: new (6,0) + z.C = point: new (0.8,4) + T.ABC = triangle : new ( z.A,z.B,z.C ) + z.N = T.ABC.eulercenter + z.Fa,z.Fb,z.Fc = get_points ( T.ABC : feuerbach () ) + z.F = T.ABC : feuerbach_point () + z.Ja,z.Jb,z.Jc = get_points ( T.ABC : excentral () ) + z.I = T.ABC.incenter + z.Ia,z.Ib,z.Ic = get_points (T.ABC : intouch ()) +} +\begin{tikzpicture} +\tkzGetNodes +\tkzDrawPoints(Ja,Jb,Jc) +\tkzClipBB +\tkzFillCircles[green!30,,opacity=.5](N,Fa) +\tkzFillCircles[lightgray,,opacity=.5](I,F) +\tkzDrawLines[add=3 and 3](A,B A,C B,C) +\tkzDrawCircles(Ja,Fa Jb,Fb Jc,Fc N,Fa N,F I,F) +\tkzDrawPoints(A,B,C,F,Fa,Fb,Fc,N,I,Ia,Ib,Ic) +\tkzLabelPoints(N,A,B,Ia,Ib,Ic) +\tkzLabelPoints[above](Fa,Fb,Fc,F,I,C) +\end{tikzpicture} +\end{Verbatim} +\end{minipage} + + +\directlua{% +init_elements () + scale = .7 + z.A = point: new (0,0) + z.B = point: new (6,0) + z.C = point: new (0.8,4) + T.ABC = triangle : new ( z.A,z.B,z.C ) + z.N = T.ABC.eulercenter + z.Fa,z.Fb,z.Fc = get_points ( T.ABC : feuerbach () ) + z.F = T.ABC : feuerbach_point () + z.Ja,z.Jb,z.Jc = get_points ( T.ABC : excentral () ) + z.I = T.ABC.incenter + z.Ia,z.Ib,z.Ic = get_points (T.ABC : intouch ()) +} +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawPoints(Ja,Jb,Jc) + \tkzClipBB + \tkzFillCircles[green!30,,opacity=.5](N,Fa) + \tkzFillCircles[lightgray,,opacity=.5](I,F) + \tkzDrawLines[add=3 and 3](A,B A,C B,C) + \tkzDrawCircles(Ja,Fa Jb,Fb Jc,Fc N,Fa N,F I,F) + \tkzDrawPoints(A,B,C,F,Fa,Fb,Fc,N,I,Ia,Ib,Ic) + \tkzLabelPoints(N,A,B,Ia,Ib,Ic) + \tkzLabelPoints[above](Fa,Fb,Fc,F,I,C) + \end{tikzpicture} +\end{center} + +%subsubsection method_imeth_triangle_feuerbach (end) + + +\subsubsection{Method \Imeth{triangle}{similar}} % (fold) +\label{ssub:method_imeth_triangle_similar} + +The \code{similar} method creates a new triangle whose sides are parallel to the sides of the original triangle and pass through its vertices. + +\begin{minipage}{.5\textwidth} + \begin{Verbatim} + \directlua{% +init_elements () + scale =.5 + z.A = point: new (0 , 0) + z.B = point: new (6 , 0) + z.C = point: new (1.5 , 3.5) + T.ABC = triangle: new (z.A,z.B,z.C) + z.X,z.Y,z.Z = get_points ( T.ABC : similar ()) + z.H_a,z.H_b, + z.H_c = get_points (T.ABC : orthic ()) + } + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygons(A,B,C X,Y,Z) + \tkzDrawLines(A,H_a B,H_b C,H_c) + \tkzDrawPoints(A,B,C,X,Y,Z) + \tkzLabelPoints(A,B,Z) + \tkzLabelPoints[above](X,Y,C) + \end{tikzpicture} + \end{Verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} + \directlua{% +init_elements () + scale =.5 + z.A = point: new (0 , 0) + z.B = point: new (6 , 0) + z.C = point: new (1.5 , 3.5) + T.ABC = triangle: new (z.A,z.B,z.C) + z.X,z.Y,z.Z = get_points ( T.ABC : similar ()) + z.H_a,z.H_b, + z.H_c = get_points (T.ABC : orthic ()) + } +\hspace*{\fill} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygons(A,B,C X,Y,Z) + \tkzDrawLines(A,H_a B,H_b C,H_c) + \tkzDrawPoints(A,B,C,X,Y,Z) + \tkzLabelPoints(A,B,Z) + \tkzLabelPoints[above](X,Y,C) + \end{tikzpicture} +\end{minipage} + + +% subsubsection method_imeth_triangle_similar (end) + +\subsubsection{Method \Imeth{triangle}{medial}} % (fold) +\label{ssub:method_imeth_triangle_medial} + +The triangle $MaMbMc$ formed by joining the midpoints of the sides of a triangle $ABC$. The medial triangle is sometimes also called the auxiliary triangle (Dixon 1991). +[\href{https://mathworld.wolfram.com/MedialTriangle.html}{Weisstein, Eric W. "Medial Triangle." From MathWorld--A Wolfram Web Resource.}] + +\vspace{6pt} +\begin{minipage}{.5\textwidth} + \begin{Verbatim} + \directlua{% +init_elements () + scale = 1.25 + z.A = point: new (0,1) + z.B = point: new (6,0) + z.C = point: new (2,4) + T = triangle: new(z.A,z.B,z.C) + T.med = T : medial () + z.Ma,z.Mb,z.Mc= get_points (T.med) + z.G = T.centroid + z.O = T.circumcenter + } + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygons(A,B,C) + \tkzDrawPolygons[red](Ma,Mb,Mc) + \tkzDrawSegments(A,Ma B,Mb C,Mc) + \tkzDrawSegments[dashed,cyan](O,Ma O,Mb O,Mc) + \tkzDrawPoints(A,B,C,Ma,Mb,Mc,O,G) + \tkzLabelPoints(A,B,Mc,O) + \tkzLabelPoints[above](C) + \tkzLabelPoints[left](Mb) + \tkzLabelPoints[right](Ma,G) + \tkzMarkRightAngles[fill=cyan!20, + opacity=.4](O,Ma,B O,Mb,A O,Mc,A) + \end{tikzpicture} + \end{Verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} + \directlua{% +init_elements () + scale = 1.25 + z.A = point: new (0,1) + z.B = point: new (6,0) + z.C = point: new (2,4) + T = triangle: new(z.A,z.B,z.C) + T.med = T : medial () + z.Ma,z.Mb,z.Mc= get_points (T.med) + z.G = T.centroid + z.O = T.circumcenter + } + \begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygons(A,B,C) + \tkzDrawPolygons[red](Ma,Mb,Mc) + \tkzDrawSegments(A,Ma B,Mb C,Mc) + \tkzDrawSegments[dashed,cyan](O,Ma O,Mb O,Mc) + \tkzDrawPoints(A,B,C,Ma,Mb,Mc,O,G) + \tkzLabelPoints(A,B,Mc,O) + \tkzLabelPoints[above](C) + \tkzLabelPoints[left](Mb) + \tkzLabelPoints[right](Ma,G) + \tkzMarkRightAngles[fill=cyan!20, + opacity=.4](O,Ma,B O,Mb,A O,Mc,A) + \end{tikzpicture} + \end{center} +\end{minipage} + + +% subsubsection method_imeth_triangle_medial (end) + +\subsubsection{Method \Imeth{triangle}{incentral} } % (fold) +\label{ssub:method_incentral} + +The incentral triangle $IaIbIc$ is the Cevian triangle of a triangle $ABC$ with respect to its incenter $I$. It is therefore also the triangle whose vertices are determined by the intersections of the reference triangle's angle bisectors with the respective opposite sides. +[ \href{https://mathworld.wolfram.com/IncentralTriangle.html}{Weisstein, Eric W. "Incentral Triangle." From MathWorld--A Wolfram Web Resource.} +] + +\vspace{6pt} +\begin{minipage}{.5\textwidth} +\begin{Verbatim} +\directlua{% +init_elements () + z.A = point: new (0 , 0) + z.B = point: new (6 , 0) + z.C = point: new (1 , 4) + T.ABC = triangle: new (z.A,z.B,z.C) + z.I = T.ABC.incenter + z.Ia,z.Ib, + z.Ic = get_points (T.ABC : incentral ()) + z.Ta,z.Tb, + z.Tc = get_points (T.ABC : intouch ()) +} +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygon(A,B,C) + \tkzDrawPolygon[dashed,red](Ia,Ib,Ic) + \tkzDrawSegments[dashed,red](A,Ia B,Ib C,Ic) + \tkzDrawCircle(I,Ta) + \tkzDrawPoints(A,B,C,Ia,Ib,Ic,I,Ta,Tb,Tc) + \tkzLabelPoints(A,B,Ic,I,Tc) + \tkzLabelPoints[above](Ia,Ta,C) + \tkzLabelPoints[above left](Ib,Tb) +\end{tikzpicture} +\end{Verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} + \directlua{% +init_elements () + z.A = point: new (0 , 0) + z.B = point: new (6 , 0) + z.C = point: new (1 , 4) + T.ABC = triangle: new (z.A,z.B,z.C) + z.I = T.ABC.incenter + z.Ia,z.Ib, + z.Ic = get_points (T.ABC : incentral ()) + z.Ta,z.Tb, + z.Tc = get_points (T.ABC : intouch ()) + } + \begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygon(A,B,C) + \tkzDrawPolygon[dashed,red](Ia,Ib,Ic) + \tkzDrawSegments[dashed,red](A,Ia B,Ib C,Ic) + \tkzDrawCircle(I,Ta) + \tkzDrawPoints(A,B,C,Ia,Ib,Ic,I,Ta,Tb,Tc) + \tkzLabelPoints(A,B,Ic,I,Tc) + \tkzLabelPoints[above](Ia,Ta,C) + \tkzLabelPoints[above left](Ib,Tb) + \end{tikzpicture} + \end{center} + +\end{minipage} + +% subsubsection method_incentral (end) + + +\subsubsection{Method \Imeth{triangle}{tangential}} % (fold) +\label{ssub:method_imeth_triangle_tangential} + +The tangential triangle is the triangle $TaTbTc$ formed by the lines tangent to the circumcircle of a given triangle DeltaABC at its vertices. It is therefore antipedal triangle of $ABC$ with respect to the circumcenter $O$. It is also anticevian triangle of $ABC$ with the symmedian point $K$ as the anticevian point (Kimberling 1998, p. 156). Furthermore, the symmedian point $K$ of $ABC$ is the Gergonne point of $TaTbTc$. + +The sides of an orthic triangle are parallel to the tangents to the circumcircle at the vertices (Johnson 1929, p. 172). This is equivalent to the statement that each line from a triangle's circumcenter to a vertex is always perpendicular to the corresponding side of the orthic triangle (Honsberger 1995, p. 22), and to the fact that the orthic and tangential triangles are homothetic. +[ \href{https://mathworld.wolfram.com/TangentialTriangle.html}{Weisstein, Eric W. "Tangential Triangle." From MathWorld--A Wolfram Web Resource.}] + +\vspace{6pt} +\begin{minipage}{.5\textwidth} +\begin{Verbatim} +\directlua{% +init_elements () + scale = .75 + z.A = point: new (0,0) + z.B = point: new (5,0) + z.C = point: new (1,3) + T = triangle: new(z.A,z.B,z.C) + z.H = T.orthocenter + z.O = T.circumcenter + z.L = T : symmedian_point () + T.orthic = T: orthic() + z.Ha, + z.Hb, + z.Hc = get_points (T.orthic) + z.Ta, + z.Tb, + z.Tc = get_points (T : tangential ()) +} +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygons[red](A,B,C Ta,Tb,Tc) + \tkzDrawCircle(O,A) + \tkzDrawPoints(A,B,C,O,H,Ta,Tb,Tc,L) + \tkzDrawSegments[red](C,Hc B,Hb A,Ha) + \tkzDrawSegments[green](C,Tc B,Tb A,Ta) + \tkzDrawPolygon[blue](Ha,Hb,Hc) + \tkzLabelPoints(A,B,O,Tc) + \tkzLabelPoints[above](C,Tb,Ta) + \tkzLabelPoints[font=\small](Hc) + \tkzLabelPoints[font=\small,above](Ha,Hb) + \tkzMarkRightAngles(A,Ha,C B,Hb,A C,Hc,B) +\end{tikzpicture} +\end{Verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} +\directlua{% +init_elements () + scale = .75 + z.A = point: new (0,0) + z.B = point: new (5,0) + z.C = point: new (1,3) + T = triangle: new(z.A,z.B,z.C) + z.H = T.orthocenter + z.O = T.circumcenter + z.L = T : symmedian_point () + T.orthic = T: orthic() + z.Ha, + z.Hb, + z.Hc = get_points (T.orthic) + z.Ta, + z.Tb, + z.Tc = get_points (T : tangential ()) +} + + \begin{center} +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygons[red](A,B,C Ta,Tb,Tc) + \tkzDrawCircle(O,A) + \tkzDrawPoints(A,B,C,O,H,Ta,Tb,Tc,L) + \tkzDrawSegments[red](C,Hc B,Hb A,Ha) + \tkzDrawSegments[green](C,Tc B,Tb A,Ta) + \tkzDrawPolygon[blue](Ha,Hb,Hc) + \tkzLabelPoints(A,B,O,Tc) + \tkzLabelPoints[above](C,Tb,Ta) + \tkzLabelPoints[font=\small](Hc) + \tkzLabelPoints[font=\small,above](Ha,Hb) + \tkzMarkRightAngles(A,Ha,C B,Hb,A C,Hc,B) +\end{tikzpicture} + \end{center} + +\end{minipage} + +% subsubsection method_imeth_triangle_tangential (end) + + +\subsubsection{Method \Imeth{triangle}{symmedial}} % (fold) +\label{ssub:method_imeth_triangle_symmedial} + +The symmedial triangle $LaLbLc$ is the triangle whose vertices are the intersection points of the symmedians with the reference triangle $ABC$. + +The symmedial circle is the circumcircle of the symmedial triangle. + +The following example groups several concepts around the symmedian. As a reminder, a symmedian of a triangle is the reflection of the median with respect to the angle bisector. + +The points of contact of the symmedians with the sides of the triangle are obtained using the \code{symmedian} method. +The intersection of the symmedians is the point known as the \code{Lemoine} or \code{Symmedian} point. +You can use the triangle methods \code{lemoine\_point} or \code{symmedian\_point}. If you only need one of the lines, you can use the method \code{symmedian\_line(n)}. \(n=0\) corresponds to the line coming from the first vertex of the triangle, \(n=1\) to the second, and so on. + +In the next example, $L$ is the \code{Lemoine point} or the \code{Symmedian point}. $LaLbLc$ is the symmedian triangle.[\href{https://mathworld.wolfram.com/SymmedianPoint.html}{Weisstein, Eric W. "Symmedian Point." From MathWorld--A Wolfram Web Resource.}] + +\vspace{6pt} + +\begin{minipage}{.5\textwidth} +\begin{Verbatim} +\directlua{% +init_elements () + scale = 2 + z.A = point : new (0,0) + z.B = point : new (7,0) + z.C = point : new (2,3) + T.ABC = triangle : new (z.A,z.B,z.C) + z.L = T.ABC : lemoine_point () + T.SY = T.ABC : symmedian () + T.med = T.ABC : medial () + z.Ka,z.Kb,z.Kc = get_points (T.SY) + z.Ma,z.Mb,z.Mc = get_points (T.med) + L.Kb = T.ABC : symmedian_line (1) + _,z.Kb = get_points(L.Kb) + z.G = T.ABC.centroid + z.Ia,z.Ib,z.Ic = get_points ( T.ABC : incentral ()) + % z.T = T.ABC : trilinear (0,1,1) + z.I = T.ABC.incenter +} +\begin{tikzpicture} +\tkzGetNodes +\tkzDrawPolygons(A,B,C) +\tkzDrawPoints(A,B,C,L,Ka,Kb,Kc,G,Ma,Mb,Mc,Ia,Ib,Ic,I) +\tkzDrawSegments[cyan](A,Ka B,Kb C,Kc) +\tkzDrawSegments[green](A,Ma B,Mb C,Mc) +\tkzDrawSegments[dashed,red](A,Ia B,Ib C,Ic) +\tkzLabelPoints[above](C,Ka,Ia,Ma) +\tkzLabelPoints[above left](Kb,Ib,Mb) +\tkzLabelPoints(A,B,L,Kc,I,Ic,Mc,G) +\end{tikzpicture} +\end{Verbatim} +\end{minipage} + +\begin{minipage}{.5\textwidth} +\directlua{% +init_elements () + scale = 2 + z.A = point : new (0,0) + z.B = point : new (7,0) + z.C = point : new (2,3) + T.ABC = triangle : new (z.A,z.B,z.C) + z.L = T.ABC : lemoine_point () + T.SY = T.ABC : symmedian () + T.med = T.ABC : medial () + z.Ka,z.Kb,z.Kc = get_points (T.SY) + z.Ma,z.Mb,z.Mc = get_points (T.med) + L.Kb = T.ABC : symmedian_line (1) + _,z.Kb = get_points(L.Kb) + z.G = T.ABC.centroid + z.Ia,z.Ib,z.Ic = get_points ( T.ABC : incentral ()) + z.I = T.ABC.incenter +} +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygons(A,B,C) + \tkzDrawPoints(A,B,C,L,Ka,Kb,Kc,G,Ma,Mb,Mc,Ia,Ib,Ic,I) + \tkzDrawSegments[cyan](A,Ka B,Kb C,Kc) + \tkzDrawSegments[green](A,Ma B,Mb C,Mc) + \tkzDrawSegments[dashed,red](A,Ia B,Ib C,Ic) + \tkzLabelPoints[above](C,Ka,Ia,Ma) + \tkzLabelPoints[above left](Kb,Ib,Mb) + \tkzLabelPoints(A,B,L,Kc,I,Ic,Mc,G) + \end{tikzpicture} +\end{center} + + +\end{minipage} + +% subsubsection method_imeth_triangle_symmedial (end) + +\subsubsection{Method \Imeth{triangle}{anti}} % (fold) +\label{ssub:method_imeth_triangle_anti} + +The anticomplementary triangle is the triangle $TaTbTc$ which has a given triangle $ABC$ as its medial triangle. It is therefore the anticevian triangle with respect to the triangle centroid G (Kimberling 1998, p. 156). [\href{https://mathworld.wolfram.com/AnticomplementaryTriangle.html}{Weisstein, Eric W. "Anticomplementary Triangle." From MathWorld--A Wolfram Web Resource.}] + +\vspace{6pt} +\begin{minipage}{.5\textwidth} +\begin{Verbatim} +\directlua{% +init_elements () + scale = .6 + z.A = point: new (0,0) + z.B = point: new (5,0) + z.C = point: new (2,4) + T = triangle: new(z.A,z.B,z.C) + T.similar = T: anti() + z.Ta, + z.Tb, + z.Tc = get_points (T.similar) +} +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygons[red](A,B,C) + \tkzDrawPolygon[blue](Ta,Tb,Tc) + \tkzDrawPoints(A,B,C,Ta,Tb,Tc) + \tkzLabelPoints(A,B,Tc) + \tkzLabelPoints[above](Ta,Tb,C) +\end{tikzpicture} +\end{Verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} +\directlua{% +init_elements () + scale = .6 + z.A = point: new (0,0) + z.B = point: new (5,0) + z.C = point: new (2,4) + T = triangle: new(z.A,z.B,z.C) + T.similar = T: anti() + z.Ta, + z.Tb, + z.Tc = get_points (T.similar) +} +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygons[red](A,B,C) + \tkzDrawPolygon[blue](Ta,Tb,Tc) + \tkzDrawPoints(A,B,C,Ta,Tb,Tc) + \tkzLabelPoints(A,B,Tc) + \tkzLabelPoints[above](Ta,Tb,C) + \end{tikzpicture} +\end{center} + +\end{minipage} + +% subsubsection method_imeth_triangle_anti (end) + + \subsubsection{Euler line} % (fold) \label{ssub:euler_line} +The line on which the orthocenter $H$, triangle centroid $G$, circumcenter $O$, nine-point center $N$, and a number of other important triangle centers lie. +[ \href{https://mathworld.wolfram.com/EulerLine.html}{Weisstein, Eric W. "Euler Line." From MathWorld--A Wolfram Web Resource.}] + \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0 , 0) z.B = point: new (6 , 0) z.C = point: new (1.5 , 3.5) @@ -440,7 +2196,7 @@ En géométrie plane, le théorème du cercle de Conway stipule que lorsque les z.H = T.ABC.orthocenter z.P,z.Q,z.R = get_points (T.ABC: orthic()) z.K,z.I,z.J = get_points (T.ABC: medial ()) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawLines[blue](O,H) @@ -456,7 +2212,8 @@ En géométrie plane, le théorème du cercle de Conway stipule que lorsque les \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0 , 0) z.B = point: new (6 , 0) z.C = point: new (1.5 , 3.5) @@ -467,34 +2224,40 @@ En géométrie plane, le théorème du cercle de Conway stipule que lorsque les z.H = T.ABC. orthocenter z.P,z.Q,z.R = get_points (T.ABC: orthic()) z.K,z.I,z.J = get_points (T.ABC: medial ()) -\end{tkzelements} -\hspace*{\fill} -\begin{tikzpicture} -\tkzGetNodes -\tkzDrawLines[blue](O,H) -\tkzDrawCircle[red](N,I) -\tkzDrawCircles[teal](O,A) -\tkzDrawSegments(A,P B,Q C,R) -\tkzDrawSegments[red](A,I B,J C,K) -\tkzDrawPolygons(A,B,C) -\tkzDrawPoints(A,B,C,N,I,J,K,O,P,Q,R,H,G) -\tkzLabelPoints(A,B,C,I,J,K,P,Q,R) -\tkzLabelPoints[below](N,O,G,H) -\end{tikzpicture} +} +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawLines[blue](O,H) + \tkzDrawCircle[red](N,I) + \tkzDrawCircles[teal](O,A) + \tkzDrawSegments(A,P B,Q C,R) + \tkzDrawSegments[red](A,I B,J C,K) + \tkzDrawPolygons(A,B,C) + \tkzDrawPoints(A,B,C,N,I,J,K,O,P,Q,R,H,G) + \tkzLabelPoints(A,B,J,P,R) + \tkzLabelPoints[above](C,I,Q,K) + \tkzLabelPoints[below](N,O,G,H) + \end{tikzpicture} +\end{center} + \end{minipage} % subsubsection euler_line (end) -\subsection{Euler ellipse} % (fold) -\label{sub:euler_ellipse} +\subsubsection{Euler ellipse} % (fold) +\label{ssub:euler_ellipse} +The Euler ellipse is a conic, tangent to the three sides of a triangle, with the orthocentre and the centre of the circumscribed circle as foci. Example of obtaining the Euler circle as well as the Euler ellipse. -\begin{tkzelements} +\vspace{6pt} +\directlua{% +init_elements () z.A = point: new (2,3.8) z.B = point: new (0 ,0) z.C = point: new (6.2 ,0) L.AB = line : new ( z.A , z.B ) T.ABC = triangle: new (z.A,z.B,z.C) -z.K = midpoint (z.B,z.C) +z.K = midpoint (z.B,z.C) E.euler = T.ABC : euler_ellipse () z.N = T.ABC.eulercenter C.euler = circle : new (z.N,z.K) @@ -502,17 +2265,18 @@ ang = math.deg(E.euler.slope) z.O = T.ABC.circumcenter z.G = T.ABC.centroid z.H = T.ABC.orthocenter -\end{tkzelements} +} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (2,3.8) z.B = point: new (0 ,0) z.C = point: new (6.2 ,0) L.AB = line : new ( z.A , z.B ) T.ABC = triangle: new (z.A,z.B,z.C) -z.K = midpoint (z.B,z.C) +z.K = midpoint (z.B,z.C) E.euler = T.ABC : euler_ellipse () z.N = T.ABC.eulercenter C.euler = circle : new (z.N,z.K) @@ -520,7 +2284,7 @@ ang = math.deg(E.euler.slope) z.O = T.ABC.circumcenter z.G = T.ABC.centroid z.H = T.ABC.orthocenter -\end{tkzelements} +} \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} @@ -550,25 +2314,27 @@ z.H = T.ABC.orthocenter \tkzLabelPoints[above](A) \end{tikzpicture} \end{Verbatim} -% subsection euler_ellipse (end) +% subsubsection euler_ellipse (end) \subsubsection{Steiner inellipse and circumellipse} % (fold) \label{ssub:steiner_inellipse_and_circumellipse} -In this example, the inner and outer Steiner ellipses, referred to as the "inellipse" and "circumellipse" (Mathworld.com), respectively, along with the orthoptic circle, are depicted.. The triangle must be acutangle. +In this example, the inner and outer Steiner ellipses, referred to as the "inellipse" and "circumellipse" [\href{https://mathworld.wolfram.com/SteinerInellipse.html}{Weisstein, Eric W. "Steiner Inellipse." From MathWorld--A Wolfram Web Resource.} and \href{https://mathworld.wolfram.com/SteinerCircumellipse.html}{Weisstein, Eric W. "Steiner Circumellipse." From MathWorld--A Wolfram Web Resource.}], respectively, along with the orthoptic circle, are depicted.. The triangle must be acutangle. +\vspace{6pt} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .5 z.A = point: new (1 , 4) z.B = point: new (11 , 1) - z.C = point: new (5 , 12) + z.C = point: new (5 , 12) T.ABC = triangle: new(z.A,z.B,z.C) E = T.ABC: steiner_inellipse () z.G = E.center ang = math.deg(E.slope) z.F = E.Fa - z.E = E.Fb + z.E = E.Fb C = E: orthoptic_circle () z.w = C.center z.o = C.through @@ -577,20 +2343,21 @@ In this example, the inner and outer Steiner ellipses, referred to as the "inell L.T1,L.T2= E : tangent_from (z.M) z.T1 = L.T1.pb z.T2 = L.T2.pb -\end{tkzelements} +} \end{Verbatim} \end{minipage} -\begin{minipage}{.5\textwidth}\begin{tkzelements} +\begin{minipage}{.5\textwidth}\directlua{% +init_elements () scale = .5 z.A = point: new (1 , 4) z.B = point: new (11 , 1) -z.C = point: new (5 , 12) +z.C = point: new (5 , 12) T.ABC = triangle: new(z.A,z.B,z.C) E = T.ABC: steiner_inellipse () z.G = E.center ang = math.deg(E.slope) z.F = E.Fa -z.E = E.Fb +z.E = E.Fb C = E: orthoptic_circle () z.w = C.center z.o = C.through @@ -599,7 +2366,7 @@ z.M = C : point (0) L.T1,L.T2= E : tangent_from (z.M) z.T1 = L.T1.pb z.T2 = L.T2.pb -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes @@ -611,7 +2378,7 @@ z.T2 = L.T2.pb \tkzUseLua{EE.Ry},\tkzUseLua{ang}) \tkzDrawLines(F,E M,T1 M,T2) % \tkzDrawPoints(A,B,C,F,E,G,M,T1,T2) -\tkzLabelPoints[above](C,M,T1) +\tkzLabelPoints[above](C,M,T1) \tkzLabelPoints[right](T2,B) \tkzLabelPoints[below left](A,F,E,G) \end{tikzpicture} @@ -628,7 +2395,7 @@ z.T2 = L.T2.pb \tkzUseLua{EE.Ry},\tkzUseLua{ang}) \tkzDrawLines(F,E M,T1 M,T2) % \tkzDrawPoints(A,B,C,F,E,G,M,T1,T2) -\tkzLabelPoints[above](C,M,T1) +\tkzLabelPoints[above](C,M,T1) \tkzLabelPoints[right](T2,B) \tkzLabelPoints[below left](A,F,E,G) \end{tikzpicture} @@ -636,12 +2403,21 @@ z.T2 = L.T2.pb % subsubsection steiner_inellipse_and_circumellipse (end) -\subsection{Harmonic division and bisector} % (fold) -\label{sub:harmonic_division_and_bisector} +\subsubsection{Harmonic division and bisector} % (fold) +\label{ssub:harmonic_division_and_bisector} +Let four points $A$, $C$, $B$ and $D$, in this order, lying on the straight line $(d)$ and $M$ un point pris hors de $(d)$. Then, if two of the following three propositions are true, then the third is also true: + \begin{enumerate} + \item The division (A,B;C,D) is harmonic. ($CA/CB = DA/DB$) + \item $(MC)$ is the internal angle bisector of $\widehat{AMB}$. + \item $(MD) \perp (MC)$. + \end{enumerate} + + \vspace{6pt} \begin{minipage}{.4\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .4 z.A = point: new (0 , 0) z.B = point: new (6 , 0) @@ -660,11 +2436,12 @@ z.T2 = L.T2.pb L.MD = line: new (z.M,z.D) z.E = intersection (L.LL,L.MC) z.F = intersection (L.LL,L.MD) -\end{tkzelements} +} \end{Verbatim} \end{minipage} \begin{minipage}{.6\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () scale =.4 z.A = point: new (0 , 0) z.B = point: new (6 , 0) @@ -683,8 +2460,8 @@ z.T2 = L.T2.pb L.MD = line: new (z.M,z.D) z.E = intersection (L.LL,L.MC) z.F = intersection (L.LL,L.MD) -\end{tkzelements} -\hspace{\fill} +} +\hspace{\fill} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygon(A,B,M) @@ -717,61 +2494,69 @@ z.T2 = L.T2.pb \tkzMarkSegments(B,E B,M B,F) \end{tikzpicture} \end{Verbatim} -% subsection harmonic_division_and_bisector (end) +% subsubsection harmonic_division_and_bisector (end) -\subsubsection{Method \Imeth{triangle}{cevan}} % (fold) -\label{ssub:method_imeth_triangle_cevan} +\subsubsection{Method \Imeth{triangle}{c\_ll\_p}} % (fold) +\label{ssub:tr_method_c__ll__p} +See [\ref{ssub:method_c__ll__p}] for special cases. Please note that the arguments are not the same as for the \code{line} class. + +\vspace{6pt} \begin{minipage}{.5\textwidth} \begin{Verbatim} - \begin{tkzelements} - scale = 2 - z.a = point: new (1,2) - z.b = point: new (5,1) - z.c = point: new (3,5) - T = triangle: new (z.a,z.b,z.c) - z.i = T.orthocenter - T.cevian = T : cevian (z.i) - z.ta,z.tb,z.tc = get_points (T.cevian) - C.cev = T : cevian_circle (z.i) - z.w = C.cev.center - \end{tkzelements} - \begin{tikzpicture} - \tkzGetNodes - \tkzDrawPolygons(a,b,c ta,tb,tc) - \tkzDrawSegments(a,ta b,tb c,tc) - \tkzDrawPoints(a,b,c,i,ta,tb,tc) - \tkzLabelPoints(a,b,c,i) - \tkzDrawCircles(w,ta) - \end{tikzpicture} +\directlua{ +init_elements() + z.A = point : new ( 0 , 0 ) + z.B = point : new ( 8 , 0 ) + L.AB = line : new ( z.A,z.B ) + z.C = point : new ( 6 , 4 ) + L.AC = line : new ( z.A,z.C ) + T = triangle : new (z.A,z.B,z.C) + z.P = point : new ( 3 , 1 ) + C1,C2 = T : c_ll_p (z.P) + z.O1 = C1.center + z.T1 = C1.through + z.O2 = C2.center + z.T2 = C2.through +} +\begin{tikzpicture} +\tkzGetNodes + \tkzDrawLines[thick](A,B A,C B,C) + \tkzDrawCircles[red](O1,T1 O2,T2) + \tkzDrawPoints(A,B,C,P) + \tkzLabelPoints(A,B,C,P) +\end{tikzpicture} \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} - \begin{tkzelements} - scale = 2 - z.a = point: new (1,2) - z.b = point: new (5,1) - z.c = point: new (3,5) - T = triangle: new (z.a,z.b,z.c) - z.i = T.orthocenter - T.cevian = T : cevian (z.i) - z.ta,z.tb,z.tc = get_points (T.cevian) - C.cev = T : cevian_circle (z.i) - z.w = C.cev.center - \end{tkzelements} - \begin{tikzpicture} - \tkzGetNodes - \tkzDrawPolygons(a,b,c ta,tb,tc) - \tkzDrawSegments(a,ta b,tb c,tc) - \tkzDrawPoints(a,b,c,i,ta,tb,tc) - \tkzLabelPoints(a,b,c,i) - \tkzDrawCircles(w,ta) - \end{tikzpicture} -\end{minipage} - +\directlua{ +init_elements() + z.A = point : new ( 0 , 0 ) + z.B = point : new ( 8 , 0 ) + L.AB = line : new ( z.A,z.B ) + z.C = point : new ( 6 , 4 ) + L.AC = line : new ( z.A,z.C ) + T = triangle : new (z.A,z.B,z.C) + z.P = point : new ( 3 , 1 ) + C1,C2 = T : c_ll_p (z.P) + z.O1 = C1.center + z.T1 = C1.through + z.O2 = C2.center + z.T2 = C2.through +} + \begin{center} +\begin{tikzpicture} +\tkzGetNodes + \tkzDrawLines[thick](A,B A,C B,C) + \tkzDrawCircles[red](O1,T1 O2,T2) + \tkzDrawPoints(A,B,C,P) + \tkzLabelPoints(A,B,C,P) +\end{tikzpicture} + \end{center} -% subsubsection method_imeth_triangle_cevan (end) +\end{minipage} -% subsection methods_of_the_class_triangle (end) -% section class_triangle (end) +% subsubsection method_c__ll__p (end) +% % subsection methods_of_the_class_triangle (end) +% % section class_triangle (end) \endinput diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-vectors.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-vectors.tex index b981ef555a..f5e1e3a430 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-vectors.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes-vectors.tex @@ -25,8 +25,8 @@ z.C = ... z.D = ... V.AB = vector : new (z.A,z.B) V.CD = vector : new (z.C,z.D) -V.AE = V.AB + V.CD -- possible V.AB : add (V.CD) -z.E = V.AE.head -- we recover the final point (head) +V.AE = V.AB + V.CD % possible V.AB : add (V.CD) +z.E = V.AE.head % we recover the final point (head) \end{Verbatim} \subsection{Attributes of a vector} % (fold) @@ -41,11 +41,11 @@ z.E = V.AE.head -- we recover the final point (head) \begin{tabular}{lll} \toprule \textbf{Attributes} & \textbf{Application}& \textbf{Example}\\ -\Iattr{vector}{tail} & |V.AB.t = z.A| & Refer to (\ref{ssub:methods}) \\ -\Iattr{vector}{head} & |V.AB.head = z.B| & Refer to (\ref{ssub:methods}) \\ +\Iattr{vector}{tail} & |V.AB.t = z.A| & [\ref{ssub:methods}]\\ +\Iattr{vector}{head} & |V.AB.head = z.B| & [\ref{ssub:methods}] \\ \Iattr{vector}{type} & |V.AB.type = 'vector'| & \\ -\Iattr{vector}{slope} & |V.AB.slope| & Refer to (\ref{ssub:example_vector_attributes})\\ -\Iattr{vector}{length} & |V.AB.norm|& Refer to (\ref{ssub:example_vector_attributes})\\ +\Iattr{vector}{slope} & |V.AB.slope| & [\ref{ssub:example_vector_attributes}] \\ +\Iattr{vector}{length} & |V.AB.norm|& [\ref{ssub:example_vector_attributes} ]\\ \Iattr{vector}{mtx} & |V.AB.mtx| & The result is a column matrix |{{V.AB.t},{V.AB.h}}|\\ \bottomrule \end{tabular} @@ -56,7 +56,8 @@ z.E = V.AE.head -- we recover the final point (head) \begin{minipage}{.6\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.O = point: new (0,0) z.A = point: new (0,1) z.B = point: new (3,4) @@ -67,7 +68,7 @@ z.E = V.AE.head -- we recover the final point (head) v = vector : new (z.C,z.D) w =u+v z.E = w.head -\end{tkzelements} +} \begin{tikzpicture}[gridded] \tkzGetNodes \tkzLabelPoints(A,B,C,D,O,E) @@ -81,7 +82,8 @@ $\tkzDN{\tkzUseLua{math.deg(w.slope)}}^\circ$ \end{Verbatim} \end{minipage} \begin{minipage}{.4\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.O = point: new (0,0) z.A = point: new (0,1) z.B = point: new (3,4) @@ -92,7 +94,7 @@ $\tkzDN{\tkzUseLua{math.deg(w.slope)}}^\circ$ v = vector : new (z.C,z.D) w = u+v z.E = w.head -\end{tkzelements} +} \begin{tikzpicture}[gridded] \tkzGetNodes \tkzLabelPoints(A,B,C,D,O,E) @@ -139,7 +141,9 @@ $\tkzDN{\tkzUseLua{math.deg(w.slope)}}^\circ$ \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () +scale = .75 z.O = point: new (0,0) z.A = point: new (0,1) z.B = point: new (3,4) @@ -156,7 +160,7 @@ $\tkzDN{\tkzUseLua{math.deg(w.slope)}}^\circ$ z.X = V.AX.head V.OY = V.AX : at (z.O) z.Y = V.OY.head -\end{tkzelements} +} \begin{tikzpicture}[gridded] \tkzGetNodes \tkzDrawSegments[>=stealth,->,red](A,B A,C A,D A,N A,R A,X O,Y) @@ -165,7 +169,9 @@ $\tkzDN{\tkzUseLua{math.deg(w.slope)}}^\circ$ \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () +scale = .75 z.O = point: new (0,0) z.A = point: new (0,1) z.B = point: new (3,4) @@ -182,7 +188,7 @@ $\tkzDN{\tkzUseLua{math.deg(w.slope)}}^\circ$ z.X = V.AX.head V.OY = V.AX : at (z.O) z.Y = V.OY.head -\end{tkzelements} +} \begin{tikzpicture}[gridded] \tkzGetNodes \tkzDrawSegments[>=stealth,->,red](A,B A,C A,D A,N A,R A,X O,Y) diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes.tex index 1228c60e08..3b7e1db188 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-classes.tex @@ -41,20 +41,22 @@ A method is an operation (function or procedure) associated (linked) with an obj Example: The point object is used to vertically determine a new point object located at a certain distance from it (here 2). Then it is possible to rotate objects around it. \begin{Verbatim} - \begin{tkzelements} +\directlua{ + init_elements () z.A = point (1,0) z.B = z.A : north (2) z.C = z.A : rotation (math.pi/3,z.B) tex.print(tostring(z.C)) - \end{tkzelements} +} \end{Verbatim} -\begin{tkzelements} +\directlua{ + init_elements () z.A = point (1,0) z.B = z.A : north (2) z.C = z.A : rotation (math.pi/3,z.B) tex.print(tostring("The coordinates of $C$ are: " .. z.C.re .." and "..z.C.im)) -\end{tkzelements} +} % subsubsection methods (end) diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-convention.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-convention.tex index 70b61fb902..bc7b8f223f 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-convention.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-convention.tex @@ -14,7 +14,7 @@ |if bool == ... then ... else ... end| \end{mybox} - and outside the environment \tkzNameEnv{tkzelements} you can use the macro + and you can use the macro \begin{mybox} |\ifthenelse{\equal{\tkzUseLua{bool}}{true}}{ ... }{ ... }| \end{mybox} @@ -34,12 +34,12 @@ At present, the only obligation is to store the points in the table |z| \footnote{To place the point M in the table, simply write |z.M| = \ldots or |z["M"]|= \ldots} if you intend to use them in \TIKZ\ or \pkg{tkz-euclide}. f a point will not be used, you can designate it as you wish while adhering to Lua conventions. - Points within the \tkzNameEnv{tkzelements} environment must follow a convention in the form |z.name|, where |name| represents the name of the corresponding \tkzname{node}. + Points in the lua code must follow a convention in the form |z.name|, where |name| represents the name of the corresponding \tkzname{node}. As for the conventions for designating |name| you must adhere to Lua conventions in particular cases. \begin{enumerate} - \item The use of prime can be problematic. If the point name contains more than one symbol and ends with |p| then when passing into \pkg{TikZ} or \pkg{tkz-euclide}, the letters |p| will be replaced by |'| using the macro \tkzcname{tkzGetNodes}; \index{prime} + \item The use of prime can be problematic. If the point name contains more than one symbol and ends with |p| then when passing into \pkg{tkz-euclide}, the letters |p| will be replaced by |'| using the macro \tkzcname{tkzGetNodes}; \index{prime} \item Alternatively, for a more explicit code, suppose you want to designate a point as "euler". You could, for example, write |euler = ...|, and at the end of the code for the transfer, |z.E = euler|. It is also possible to use a temporary name |euler| and to replace it in \TIKZ{}. Either at the time of placing the labels, or for example by using |pgfnodealias{E}{euler}|. This possibility also applies in other cases: prime, double prime, etc. \end{enumerate} diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-examples.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-examples.tex index 4f46d4a127..4672d6982e 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-examples.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-examples.tex @@ -2,13 +2,74 @@ \section{Examples} % (fold) \label{sec:examples} - + +\subsection{Length transfer} % (fold) +\label{sub:report_de_distance} + +Use of |north and east| functions linked to points, to transfer lengths, Refer to (\ref{sub:length_of_a_segment}) + +\begin{minipage}{.5\textwidth} +\begin{Verbatim} +\directlua{% +init_elements () + scale = .75 + z.A = point : new ( 0 , 0 ) + z.B = point : new ( 3 , 0 ) + L.AB = line : new ( z.A , z.B ) + T.ABC = L.AB : sublime () + z.C = T.ABC.pc + z.D = z.B: north (length(z.B,z.C)) + z.E = z.B: east (L.AB.length) + z.M = L.AB.mid + z.F = z.E : north (length(z.C,z.M)) +} +\begin{tikzpicture}[gridded] + \tkzGetNodes + \tkzDrawPolygons(A,B,C) + \tkzDrawSegments[gray,dashed](B,D B,E E,F C,M) + \tkzDrawPoints(A,...,F) + \tkzLabelPoints(A,B,E,M) + \tkzLabelPoints[above right](C,D,F) +\end{tikzpicture} +\end{Verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} +\directlua{% +init_elements () + scale = .75 + z.A = point : new ( 0 , 0 ) + z.B = point : new ( 3 , 0 ) + L.AB = line : new ( z.A , z.B ) + T.ABC = L.AB : sublime () + z.C = T.ABC.pc + z.D = z.B: north (length(z.B,z.C)) + z.E = z.B: east (L.AB.length) + z.M = L.AB.mid + z.F = z.E : north (length(z.C,z.M)) +} + +\begin{center} + \begin{tikzpicture}[gridded] + \tkzGetNodes + \tkzDrawPolygons(A,B,C) + \tkzDrawSegments[gray,dashed](B,D B,E E,F C,M) + \tkzDrawPoints(A,...,F) + \tkzLabelPoints(A,B,E,M) + \tkzLabelPoints[above right](C,D,F) + \end{tikzpicture} +\end{center} + +\end{minipage} +% subsection report_de_distance (end) + + \subsection{D'Alembert 1} % (fold) \label{sub:d_alembert_1} \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new (0,0) z.a = point : new (4,0) z.B = point : new (7,-1) @@ -24,7 +85,7 @@ z.Ip = C.Aa : internal_similitude (C.Bb) z.Jp = C.Aa : internal_similitude (C.Cc) z.Kp = C.Cc : internal_similitude (C.Bb) -\end{tkzelements} +} \begin{tikzpicture}[rotate=-60] \tkzGetNodes \tkzDrawCircles(A,a B,b C,c) @@ -36,7 +97,8 @@ \end{Verbatim} \end{minipage} \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% -\begin{tkzelements} +\directlua{% +init_elements () scale = .5 z.A = point : new (0,0) z.a = point : new (4,0) @@ -53,16 +115,19 @@ z.K = C.Cc : external_similitude (C.Bb) z.Ip = C.Aa : internal_similitude (C.Bb) z.Jp = C.Aa : internal_similitude (C.Cc) z.Kp = C.Cc : internal_similitude (C.Bb) -\end{tkzelements} -\hspace*{\fill} -\begin{tikzpicture}[rotate=30] - \tkzGetNodes - \tkzDrawCircles(A,a B,b C,c) - \tkzDrawPoints(A,B,C,I,J,K,I',J',K') - \tkzDrawSegments[new](I,K A,I A,J B,I B,K C,J C,K) - \tkzDrawSegments[purple](I,J' I',J I',K) - \tkzLabelPoints(I,J,K,I',J',K') -\end{tikzpicture} +} + +\begin{center} + \begin{tikzpicture}[rotate=30] + \tkzGetNodes + \tkzDrawCircles(A,a B,b C,c) + \tkzDrawPoints(A,B,C,I,J,K,I',J',K') + \tkzDrawSegments[new](I,K A,I A,J B,I B,K C,J C,K) + \tkzDrawSegments[purple](I,J' I',J I',K) + \tkzLabelPoints(I,J,K,I',J',K') + \end{tikzpicture} +\end{center} + \end{minipage} % subsection d_alembert_1 (end) @@ -71,7 +136,8 @@ z.Kp = C.Cc : internal_similitude (C.Bb) \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .75 z.A = point : new (0,0) z.a = point : new (5,0) @@ -85,7 +151,7 @@ z.Kp = C.Cc : internal_similitude (C.Bb) z.i,z.j = get_points (C.Aa : radical_axis (C.Bb)) z.k,z.l = get_points (C.Aa : radical_axis (C.Cc)) z.m,z.n = get_points (C.Bb : radical_axis (C.Cc)) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles(A,a B,b C,c) @@ -94,7 +160,8 @@ z.Kp = C.Cc : internal_similitude (C.Bb) \end{Verbatim} \end{minipage} \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% -\begin{tkzelements} +\directlua{% +init_elements () scale = .5 z.A = point : new (0,0) z.a = point : new (5,0) @@ -108,22 +175,161 @@ z.Kp = C.Cc : internal_similitude (C.Bb) z.i,z.j = get_points (C.Aa : radical_axis (C.Bb)) z.k,z.l = get_points (C.Aa : radical_axis (C.Cc)) z.m,z.n = get_points (C.Bb : radical_axis (C.Cc)) -\end{tkzelements} +} + +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircles(A,a B,b C,c) + \tkzDrawLines[new](i,j k,l m,n) + \end{tikzpicture} +\end{center} + +\end{minipage} +% subsection d_alembert_2 (end) + +\subsection{Altshiller} % (fold) +\label{sub:altshiller} -\hspace*{\fill} +\begin{minipage}{.5\textwidth} +\begin{Verbatim} +\directlua{% +init_elements () + z.P = point : new (0,0) + z.Q = point : new (5,0) + z.I = point : new (3,2) + C.QI = circle : new (z.Q,z.I) + C.PE = C.QI : orthogonal_from (z.P) + z.E = C.PE.through + C.QE = circle : new (z.Q,z.E) + _,z.F = intersection (C.PE,C.QE) + z.A = C.PE: point (1/9) + L.AE = line : new (z.A,z.E) + _,z.C = intersection (L.AE,C.QE) + L.AF = line : new (z.A,z.F) + L.CQ = line : new (z.C,z.Q) + z.D = intersection (L.AF,L.CQ) +} \begin{tikzpicture} -\tkzGetNodes -\tkzDrawCircles(A,a B,b C,c) -\tkzDrawLines[new](i,j k,l m,n) + \tkzGetNodes + \tkzDrawCircles(P,E Q,E) + \tkzDrawLines[add=0 and 1](P,Q) + \tkzDrawLines[add=0 and 2](A,E) + \tkzDrawSegments(P,E E,F F,C A,F C,D) + \tkzDrawPoints(P,Q,E,F,A,C,D) + \tkzLabelPoints(P,Q,E,F,A,C,D) \end{tikzpicture} +\end{Verbatim} \end{minipage} -% subsection d_alembert_2 (end) +\begin{minipage}{.5\textwidth} + \directlua{% +init_elements () + scale =.5 + z.P = point : new (0,0) + z.Q = point : new (5,0) + z.I = point : new (3,2) + C.QI = circle : new (z.Q,z.I) + C.PE = C.QI : orthogonal_from (z.P) + z.E = C.PE.through + C.QE = circle : new (z.Q,z.E) + _,z.F = intersection (C.PE,C.QE) + z.A = C.PE: point (1/9) + L.AE = line : new (z.A,z.E) + _,z.C = intersection (L.AE,C.QE) + L.AF = line : new (z.A,z.F) + L.CQ = line : new (z.C,z.Q) + z.D = intersection (L.AF,L.CQ) + } + \begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircles(P,E Q,E) + \tkzDrawLines[add=0 and 1](P,Q) + \tkzDrawLines[add=0 and 2](A,E) + \tkzDrawSegments(P,E E,F F,C A,F C,D) + \tkzDrawPoints(P,Q,E,F,A,C,D) + \tkzLabelPoints(P,Q,E,F,A,C,D) + \end{tikzpicture} + \end{center} +\end{minipage} +%subsection altshiller (end) + +\subsection{Lemoine} % (fold) +\label{sub:lemoine} + +\begin{minipage}{.5\textwidth} +\begin{Verbatim} +\directlua{% +init_elements () + scale = 1.25 + z.A = point: new (1,0) + z.B = point: new (5,2) + z.C = point: new (1.2,2) + T = triangle: new(z.A,z.B,z.C) + z.O = T.circumcenter + C.OA = circle: new (z.O,z.A) + L.tA = C.OA: tangent_at (z.A) + L.tB = C.OA: tangent_at (z.B) + L.tC = C.OA: tangent_at (z.C) + z.P = intersection (L.tA,T.bc) + z.Q = intersection (L.tB,T.ca) + z.R = intersection (L.tC,T.ab) +} +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygon[teal](A,B,C) + \tkzDrawCircle(O,A) + \tkzDrawPoints(A,B,C,P,Q,R) + \tkzLabelPoints(A,B,C,P,Q,R) + \tkzDrawLine[blue](Q,R) + \tkzDrawLines[red](A,P B,Q R,C) + \tkzDrawSegments(A,R C,P C,Q) +\end{tikzpicture} +\end{Verbatim} + +\end{minipage} +\begin{minipage}{.5\textwidth} +\directlua{% +init_elements () +scale = .75 +z.A = point: new (1,0) +z.B = point: new (5,2) +z.C = point: new (1.2,2) +T = triangle: new(z.A,z.B,z.C) +z.O = T.circumcenter +C.OA = circle: new (z.O,z.A) +L.tA = C.OA: tangent_at (z.A) +L.tB = C.OA: tangent_at (z.B) +L.tC = C.OA: tangent_at (z.C) +z.R = intersection (L.tC,T.ab) +z.P = intersection (L.tA,T.bc) +z.Q = intersection (L.tB,T.ca) +} + +\begin{center} + \begin{tikzpicture}[rotate=90] + \tkzGetNodes + \tkzDrawPolygon[teal](A,B,C) + \tkzDrawCircle(O,A) + \tkzDrawPoints(A,B,C,P,Q,R) + \tkzLabelPoints(A,B,C,P,Q,R) + \tkzDrawLine[blue](Q,R) + \tkzDrawLines[red](A,P B,Q R,C) + \tkzDrawSegments(A,R C,P C,Q) + \end{tikzpicture} +\end{center} + +\end{minipage} +%\caption{Lemoine line} +% subsection lemoine (end) + \subsection{Alternate} % (fold) \label{sub:alternate} \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0 , 0) z.B = point: new (6 , 0) z.C = point: new (1 , 5) @@ -133,7 +339,7 @@ z.Kp = C.Cc : internal_similitude (C.Bb) z.D = intersection (L.AI,T.bc) L.LLC = T.ab: ll_from (z.C) z.E = intersection (L.AI,L.LLC) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygon(A,B,C) @@ -148,9 +354,10 @@ z.Kp = C.Cc : internal_similitude (C.Bb) \end{tikzpicture} \end{Verbatim} \end{minipage} -\hspace*{\fill} + \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0 , 0) z.B = point: new (6 , 0) z.C = point: new (1 , 5) @@ -160,26 +367,102 @@ L.AI = line: new (z.A,z.I) z.D = intersection (L.AI,T.bc) L.LLC = T.ab: ll_from (z.C) z.E = intersection (L.AI,L.LLC) -\end{tkzelements} -\begin{tikzpicture} -\tkzGetNodes -\tkzDrawPolygon(A,B,C) -\tkzDrawLine[purple](C,E) -\tkzDrawSegment[purple](A,E) -\tkzFillAngles[purple!30,opacity=.4](B,A,C C,E,D) -\tkzMarkAngles[mark=|](B,A,D D,A,C C,E,D) -\tkzDrawPoints(A,...,E) -\tkzLabelPoints(A,B) -\tkzLabelPoints[above](C,D,E) -\tkzMarkSegments(A,C C,E) -\end{tikzpicture} +} +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygon(A,B,C) + \tkzDrawLine[purple](C,E) + \tkzDrawSegment[purple](A,E) + \tkzFillAngles[purple!30,opacity=.4](B,A,C C,E,D) + \tkzMarkAngles[mark=|](B,A,D D,A,C C,E,D) + \tkzDrawPoints(A,...,E) + \tkzLabelPoints(A,B) + \tkzLabelPoints[above](C,D,E) + \tkzMarkSegments(A,C C,E) + \end{tikzpicture} +\end{center} + \end{minipage} % subsection alternate (end) +\subsection{Method \Imeth{circle}{common tangent}: orthogonality} % (fold) +\label{sub:common_tangent_orthogonality} +For two circles to be orthogonal, it is necessary and sufficient for a secant passing through one of their common points to be seen from the other common point at a right angle. + +\begin{Verbatim} +\directlua{% +init_elements () + z.A = point : new ( 0 , 0 ) + z.B = point : new ( 4 , 2 ) + L.AB = line : new ( z.A , z.B ) + z.a = point : new ( 1 , 2 ) + C.Aa = circle : new (z.A,z.a) + C.BC = C.Aa : orthogonal_from (z.B) + z.C,z.D = intersection (C.Aa,C.BC) + C.AC = circle : new (z.A,z.C) + z.T,z.Tp = C.AC : common_tangent (C.BC) + L.TTp = line : new (z.T,z.Tp) + z.M = C.AC : point (0.45) + L.MC =line : new (z.M,z.C) + z.Mp = intersection (L.MC, C.BC) + L.mm = L.TTp : ll_from (z.C) + _,z.M = intersection (L.mm, C.AC) + z.Mp = intersection (L.mm, C.BC) +} + +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircles(A,C B,C) + \tkzDrawSegments(M,M' A,C B,C A,B) + \tkzDrawSegments[gray](D,M D,M' T,T') + \tkzDrawPoints(A,B,C,D,M,M',T,T') + \tkzLabelPoints(A,B,D,M) + \tkzLabelPoints[above](C,M',T,T') + \tkzMarkRightAngles(M',D,M A,C,B) +\end{tikzpicture} +\end{Verbatim} + +\directlua{% +init_elements () +z.A = point : new ( 0 , 0 ) +z.B = point : new ( 4 , 2 ) +L.AB = line : new ( z.A , z.B ) +z.a = point : new ( 1 , 2 ) +C.Aa = circle : new (z.A,z.a) +C.BC = C.Aa : orthogonal_from (z.B) +z.C,z.D = intersection (C.Aa,C.BC) +C.AC = circle : new (z.A,z.C) +z.T,z.Tp = C.AC : common_tangent (C.BC) +L.TTp = line : new (z.T,z.Tp) +z.M = C.AC : point (0.45) +L.MC =line : new (z.M,z.C) +z.Mp = intersection (L.MC, C.BC) +L.mm = L.TTp : ll_from (z.C) +_,z.M = intersection (L.mm, C.AC) +z.Mp = intersection (L.mm, C.BC) +} + +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircles(A,C B,C) + \tkzDrawSegments(M,M' A,C B,C A,B) + \tkzDrawSegments[gray](D,M D,M' T,T') + \tkzDrawPoints(A,B,C,D,M,M',T,T') + \tkzLabelPoints(A,B,D,M) + \tkzLabelPoints[above](C,M',T,T') + \tkzMarkRightAngles(M',D,M A,C,B) + \end{tikzpicture} +\end{center} +% subsection common_tangent_orthogonality (end) + + \subsection{Apollonius circle} % (fold) \label{sub:apollonius_circle} -\begin{tkzelements} +\directlua{% +init_elements () scale=.75 z.A = point: new (0 , 0) z.B = point: new (6 , 0) @@ -193,11 +476,12 @@ scale=.75 z.O = L.CD.mid L.AM = T.MAB.ab z.E = z.M : symmetry (z.A) -\end{tkzelements} +} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale=.75 z.A = point: new (0 , 0) z.B = point: new (6 , 0) @@ -211,27 +495,30 @@ scale=.75 z.O = L.CD.mid L.AM = T.MAB.ab z.E = z.M : symmetry (z.A) -\end{tkzelements} +} \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} - \hspace*{\fill} - \begin{tikzpicture}[scale=.8] - \tkzGetNodes - \tkzDrawSegment[add=0 and 1](A,M) - \tkzDrawSegments[purple](M,C M,D) - \tkzDrawCircle[purple](O,C) - \tkzDrawSegments(A,B B,M D,B) - \tkzDrawPoints(A,B,M,C,D) - \tkzLabelPoints[below right](A,B,C,D) - \tkzLabelPoints[above](M) - \tkzFillAngles[opacity=.4,cyan!20](A,M,B) - \tkzFillAngles[opacity=.4,purple!20](B,M,E) - \tkzMarkRightAngle[opacity=.4,fill=gray!20](C,M,D) - \tkzMarkAngles[mark=|](A,M,C C,M,B) - \tkzMarkAngles[mark=||](B,M,D D,M,E) - \end{tikzpicture} - \hspace*{\fill} + + \begin{center} + \begin{tikzpicture}[scale=.8] + \tkzGetNodes + \tkzDrawSegment[add=0 and 1](A,M) + \tkzDrawSegments[purple](M,C M,D) + \tkzDrawCircle[purple](O,C) + \tkzDrawSegments(A,B B,M D,B) + \tkzDrawPoints(A,B,M,C,D) + \tkzLabelPoints[below right](A,B,C,D) + \tkzLabelPoints[above](M) + \tkzFillAngles[opacity=.4,cyan!20](A,M,B) + \tkzFillAngles[opacity=.4,purple!20](B,M,E) + \tkzMarkRightAngle[opacity=.4,fill=gray!20](C,M,D) + \tkzMarkAngles[mark=|](A,M,C C,M,B) + \tkzMarkAngles[mark=||](B,M,D D,M,E) + \end{tikzpicture} + \end{center} + + \end{minipage} @@ -265,7 +552,8 @@ Remark : The circle can be obtained with: \label{sub:apollonius_and_circle_circumscribed} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale =.75 z.A = point: new (0 , 0) z.B = point: new (6 , 0) @@ -283,7 +571,7 @@ Remark : The circle can be obtained with: C.GA = circle: new (z.G,z.A) C.OC = circle: new (z.O,z.C) _,z.N = intersection (C.GA , C.OC) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygon(A,B,M) @@ -299,7 +587,8 @@ Remark : The circle can be obtained with: \end{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale =.75 z.A = point: new (0 , 0) z.B = point: new (6 , 0) @@ -317,22 +606,25 @@ Remark : The circle can be obtained with: C.GA = circle: new (z.G,z.A) C.OC = circle: new (z.O,z.C) _,z.N = intersection (C.GA , C.OC) -\end{tkzelements} +} + + +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygon(A,B,M) + \tkzDrawCircles[purple](O,C G,A) + \tkzDrawSegments[purple](M,D) + \tkzDrawSegments(D,B O,G M,C) + \tkzDrawSegments[red,dashed](M,N M,O M,G) + \tkzDrawPoints(A,B,M,C,D,N,O,G) + \tkzLabelPoints[below right](A,B,C,D,N,O,G) + \tkzLabelPoints[above](M) + \tkzMarkRightAngle[opacity=.4,fill=gray!20](C,M,D) + \end{tikzpicture} +\end{center} + -\hspace*{\fill} -\begin{tikzpicture} -\tkzGetNodes -\tkzDrawPolygon(A,B,M) -\tkzDrawCircles[purple](O,C G,A) -\tkzDrawSegments[purple](M,D) -\tkzDrawSegments(D,B O,G M,C) -\tkzDrawSegments[red,dashed](M,N M,O M,G) -\tkzDrawPoints(A,B,M,C,D,N,O,G) -\tkzLabelPoints[below right](A,B,C,D,N,O,G) -\tkzLabelPoints[above](M) -\tkzMarkRightAngle[opacity=.4,fill=gray!20](C,M,D) -\end{tikzpicture} -\hspace*{\fill} % subsection apollonius_and_circle_circumscribed (end) \subsection{Apollonius circles in a triangle} % (fold) @@ -340,7 +632,8 @@ Remark : The circle can be obtained with: \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0 , 0) z.B = point: new (6 , 0) z.C = point: new (4.5 , 1) @@ -368,7 +661,7 @@ Remark : The circle can be obtained with: z.T = intersection (L.Bz,T.ABC.ca) L.Bpt = line: new (z.Bp,z.T) z.O3 = L.Bpt.mid -\end{tkzelements} +} \end{Verbatim} \begin{Verbatim} \begin{tikzpicture} @@ -384,7 +677,8 @@ Remark : The circle can be obtained with: \end{tikzpicture} \end{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0 , 0) z.B = point: new (6 , 0) z.C = point: new (4.5 , 1) @@ -412,26 +706,30 @@ L.Bz = line: new (z.B,z.z) z.T = intersection (L.Bz,T.ABC.ca) L.Bpt = line: new (z.Bp,z.T) z.O3 = L.Bpt.mid -\end{tkzelements} +} + + +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircles[blue!50!black](O1,C' O2,A' O3,B') + \tkzDrawSegments[new](B,S C,T A,R) + \tkzDrawPolygon(A,B,C) + \tkzDrawPoints(A,B,C,A',B',C',O,I,R,S,T,O1,O2,O3) + \tkzLabelPoints(A,B,C,A',B',C',O,I) + \tkzLabelPoints(O1,O2,O3) + \tkzDrawCircle[purple](O,A) + \tkzDrawLine(O1,O2) + \end{tikzpicture} +\end{center} + -\hspace*{\fill} -\begin{tikzpicture} -\tkzGetNodes -\tkzDrawCircles[blue!50!black](O1,C' O2,A' O3,B') -\tkzDrawSegments[new](B,S C,T A,R) -\tkzDrawPolygon(A,B,C) -\tkzDrawPoints(A,B,C,A',B',C',O,I,R,S,T,O1,O2,O3) -\tkzLabelPoints(A,B,C,A',B',C',O,I) -\tkzLabelPoints(O1,O2,O3) -\tkzDrawCircle[purple](O,A) -\tkzDrawLine(O1,O2) -\end{tikzpicture} -\hspace*{\fill} Same result using the function |T.ABC.ab : apollonius (k) | \begin{Verbatim} - \begin{tkzelements} + \directlua{% +init_elements () scale = .75 z.A = point: new (0 , 0) z.B = point: new (6 , 0) @@ -444,7 +742,7 @@ Same result using the function |T.ABC.ab : apollonius (k) | z.w2,z.t2 = get_points ( C.AC ) C.BC = T.ABC.bc : apollonius (length(z.A,z.B)/length(z.A,z.C)) z.w3,z.t3 = get_points ( C.BC ) - \end{tkzelements} + } \end{Verbatim} % subsection apollonius_circles (end) @@ -454,7 +752,8 @@ Same result using the function |T.ABC.ab : apollonius (k) | \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.O_1 = point: new (0, 0) z.O_2 = point: new (0, 1) z.A = point: new (0, 3) @@ -467,7 +766,7 @@ Same result using the function |T.ABC.ab : apollonius (k) | L = line: new (z.x,z.O_2) C = circle: new (z.O_2,z.A) z.C,z.D = intersection (L ,C) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles(O_1,A O_2,A) @@ -479,7 +778,8 @@ Same result using the function |T.ABC.ab : apollonius (k) | \end{Verbatim} \end{minipage} \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% -\begin{tkzelements} +\directlua{% +init_elements () z.O_1 = point: new (0, 0) z.O_2 = point: new (0, 1) z.A = point: new (0, 3) @@ -492,23 +792,27 @@ Same result using the function |T.ABC.ab : apollonius (k) | L = line: new (z.x,z.O_2) C = circle: new (z.O_2,z.A) z.C,z.D = intersection (L ,C) -\end{tkzelements} -\hspace*{\fill} -\begin{tikzpicture} -\tkzGetNodes -\tkzDrawCircles(O_1,A O_2,A) -\tkzDrawSegments[new](O_1,A E,F C,D) -\tkzDrawSegments[purple](A,E A,F) -\tkzDrawPoints(A,O_1,O_2,E,F,C,D) -\tkzLabelPoints(A,O_1,O_2,E,F,C,D) -\end{tikzpicture} +} + +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircles(O_1,A O_2,A) + \tkzDrawSegments[new](O_1,A E,F C,D) + \tkzDrawSegments[purple](A,E A,F) + \tkzDrawPoints(A,O_1,O_2,E,F,C,D) + \tkzLabelPoints(A,O_1,O_2,E,F,C,D) + \end{tikzpicture} +\end{center} + \end{minipage} % subsection archimedes (end) \subsection{Bankoff circle} % (fold) \label{sub:bankoff_circle} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0 , 0) z.B = point: new (10 , 0) L.AB = line : new (z.A,z.B) @@ -546,7 +850,7 @@ Same result using the function |T.ABC.ab : apollonius (k) | z.O_4 = T.P0P1P2.circumcenter T.CP1P2 = triangle : new (z.C,z.P_1,z.P_2) z.O_5 = T.CP1P2.circumcenter -\end{tkzelements} +} \end{Verbatim} \begin{Verbatim} @@ -574,7 +878,8 @@ Same result using the function |T.ABC.ab : apollonius (k) | \end{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = 1.25 z.A = point: new (0 , 0) z.B = point: new (10 , 0) @@ -613,38 +918,169 @@ Same result using the function |T.ABC.ab : apollonius (k) | z.O_4 = T.P0P1P2.circumcenter T.CP1P2 = triangle : new (z.C,z.P_1,z.P_2) z.O_5 = T.CP1P2.circumcenter -\end{tkzelements} +} -\hspace*{\fill} +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawSemiCircles[teal](O_0,B) + \tkzDrawSemiCircles[teal,fill=teal!20,opacity=.5](O_1,C O_2,B) + \tkzDrawCircle[fill=green!10](O_4,P_0) + \tkzDrawCircle[purple,fill=purple!10,opacity=.5](O_5,C) + \tkzDrawSegments(A,B O_0,P' B,P A,Q) + \tkzDrawSegments(P,B Q,O_2 P,O_1) + \tkzDrawSegments[purple](O_5,P_2 O_5,P_1 O_5,C) + \tkzDrawPoints(A,B,C,P_0,P_2,P_1,O_0,O_1,O_2,O_4,O_5,Q,P,P',S) + \tkzLabelPoints[below](A,B,C,O_0,O_1,O_2,P') + \tkzLabelPoints[above](Q,P) + \tkzLabelPoints[above right](P_0,P_2,P_1,O_5,O_4,S) + \begin{scope}[font=\scriptsize] + \tkzLabelCircle[above](O_1,C)(120){$(\beta)$} + \tkzLabelCircle[above](O_2,B)(70){$(\gamma)$} + \tkzLabelCircle[above](O_0,B)(110){$(\alpha)$} + \tkzLabelCircle[left](O_4,P_2)(60){$(\delta)$} + \tkzLabelCircle[left](O_5,C)(140){$(\epsilon)$} + \end{scope} + \end{tikzpicture} +\end{center} + +% subsection bankoff_circle (end) + +\subsection{Symmedian property} % (fold) +\label{sub:example_symmedian_property} + +$L$ is the symmedian point or lemoine point. $\dfrac{CL}{CLc} = \dfrac{a^2+b^2}{a^2+b^2+c^2}$ + +\vspace{6pt} +\begin{minipage}{.5\textwidth} + \begin{Verbatim} + \directlua{% +init_elements () + scale = 1.5 + z.A = point : new (1,2) + z.B = point : new (5,1) + z.C = point : new (3,5) + T.ABC = triangle : new (z.A,z.B,z.C) + T.SY = T.ABC : symmedian () + z.La,z.Lb,z.Lc = get_points (T.SY) + k = (T.ABC.a*T.ABC.a + + T.ABC.b*T.ABC.b)/(T.ABC.a*T.ABC.a + + T.ABC.b*T.ABC.b+T.ABC.c*T.ABC.c) + L.SY = line : new (z.C,z.Lc) + z.L = L.SY : point (k) + } + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygons(A,B,C) + \tkzDrawPoints(A,B,C,L,Lc) + \tkzDrawPoints[red](L) + \tkzDrawSegments[cyan](C,Lc) + \tkzLabelPoints(A,B,Lc) + \tkzLabelPoints[above](C) + \tkzLabelPoints[left](L) + \tkzLabelSegment(B,C){$a$} + \tkzLabelSegment(A,C){$b$} + \tkzLabelSegment(A,B){$ca$} + \end{tikzpicture} + \end{Verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} + \directlua{% +init_elements () + scale = 1.5 + z.A = point : new (1,2) + z.B = point : new (5,1) + z.C = point : new (3,5) + T.ABC = triangle : new (z.A,z.B,z.C) + T.SY = T.ABC : symmedian () + z.La,z.Lb,z.Lc = get_points (T.SY) + k = (T.ABC.a*T.ABC.a + + T.ABC.b*T.ABC.b)/(T.ABC.a*T.ABC.a + + T.ABC.b*T.ABC.b+T.ABC.c*T.ABC.c) + L.SY = line : new (z.C,z.Lc) + z.L = L.SY : point (k) + } + \begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygons(A,B,C) + \tkzDrawPoints(A,B,C,L,Lc) + \tkzDrawPoints[red](L) + \tkzDrawSegments[cyan](C,Lc) + \tkzLabelPoints(A,B,Lc) + \tkzLabelPoints[above](C) + \tkzLabelPoints[left](L) + \tkzLabelSegment(B,C){$a$} + \tkzLabelSegment(A,C){$b$} + \tkzLabelSegment(A,B){$ca$} + \end{tikzpicture} + \end{center} +\end{minipage} + + +% subsection example_symmedian_property (end) + +\subsection{Example: Cevian with orthocenter} % (fold) +\label{sub:example_cevian_with_orthocenter} +\begin{minipage}{.5\textwidth} +\begin{Verbatim} +\directlua{% +init_elements () + scale = 1.5 + z.a = point: new (1,2) + z.b = point: new (5,1) + z.c = point: new (3,5) + T = triangle: new (z.a,z.b,z.c) + z.i = T.orthocenter + T.cevian = T : cevian (z.i) + z.ta,z.tb,z.tc = get_points (T.cevian) + C.cev = T : cevian_circle (z.i) + z.w = C.cev.center +} \begin{tikzpicture} -\tkzGetNodes -\tkzDrawSemiCircles[teal](O_0,B) -\tkzDrawSemiCircles[teal,fill=teal!20,opacity=.5](O_1,C O_2,B) -\tkzDrawCircle[fill=green!10](O_4,P_0) -\tkzDrawCircle[purple,fill=purple!10,opacity=.5](O_5,C) -\tkzDrawSegments(A,B O_0,P' B,P A,Q) -\tkzDrawSegments(P,B Q,O_2 P,O_1) -\tkzDrawSegments[purple](O_5,P_2 O_5,P_1 O_5,C) -\tkzDrawPoints(A,B,C,P_0,P_2,P_1,O_0,O_1,O_2,O_4,O_5,Q,P,P',S) -\tkzLabelPoints[below](A,B,C,O_0,O_1,O_2,P') -\tkzLabelPoints[above](Q,P) -\tkzLabelPoints[above right](P_0,P_2,P_1,O_5,O_4,S) -\begin{scope}[font=\scriptsize] - \tkzLabelCircle[above](O_1,C)(120){$(\beta)$} - \tkzLabelCircle[above](O_2,B)(70){$(\gamma)$} - \tkzLabelCircle[above](O_0,B)(110){$(\alpha)$} - \tkzLabelCircle[left](O_4,P_2)(60){$(\delta)$} - \tkzLabelCircle[left](O_5,C)(140){$(\epsilon)$} -\end{scope} + \tkzGetNodes + \tkzDrawPolygons(a,b,c ta,tb,tc) + \tkzDrawSegments(a,ta b,tb c,tc) + \tkzDrawPoints(a,b,c,i,ta,tb,tc) + \tkzLabelPoints(a,b,c,i) + \tkzDrawCircles(w,ta) \end{tikzpicture} -\hspace*{\fill} -% subsection bankoff_circle (end) +\end{Verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} +\directlua{% +init_elements () +scale = 1.5 +z.a = point: new (1,2) +z.b = point: new (5,1) +z.c = point: new (3,5) +T = triangle: new (z.a,z.b,z.c) +z.i = T.orthocenter +T.cevian = T : cevian (z.i) +z.ta,z.tb,z.tc = get_points (T.cevian) +C.cev = T : cevian_circle (z.i) +z.w = C.cev.center +} +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygons(a,b,c ta,tb,tc) + \tkzDrawSegments(a,ta b,tb c,tc) + \tkzDrawPoints(a,b,c,i,ta,tb,tc) + \tkzLabelPoints(a,b,c,i) + \tkzDrawCircles(w,ta) + \end{tikzpicture} +\end{center} +\end{minipage} + +% subsection example_cevian_with_orthocenter (end) \subsection{Excircles} % (fold) \label{sub:excircles} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = 0.7 z.A = point: new (0,0) z.B = point: new (6,0) @@ -656,7 +1092,7 @@ Same result using the function |T.ABC.ab : apollonius (k) | la = line: new ( z.A, z.T_a) lb = line: new ( z.B, z.T_b) z.G = intersection (la,lb) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPoints[new](J_a,J_b,J_c) @@ -679,7 +1115,8 @@ Same result using the function |T.ABC.ab : apollonius (k) | \end{tikzpicture} \end{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale=0.7 z.A = point: new (0,0) z.B = point: new (6,0) @@ -691,81 +1128,42 @@ Same result using the function |T.ABC.ab : apollonius (k) | la = line: new ( z.A, z.T_a) lb = line: new ( z.B, z.T_b) z.G = intersection (la,lb) -\end{tkzelements} +} -\hspace*{\fill} -\begin{tikzpicture} -\tkzGetNodes -\tkzDrawPoints[new](J_a,J_b,J_c) -\tkzClipBB -\tkzDrawCircles[gray](J_a,T_a J_b,T_b J_c,T_c) -\tkzDrawLines[add=1 and 1](A,B B,C C,A) -\tkzDrawSegments[new](A,T_a B,T_b C,T_c) -\tkzDrawSegments[new](J_a,T_a J_b,T_b J_c,T_c) -\tkzDrawPolygon(A,B,C) -\tkzDrawPolygon[new](T_a,T_b,T_c) -\tkzDrawPoints(A,B,C,K) -\tkzDrawPoints[new](T_a,T_b,T_c) -\tkzLabelPoints[below left](A) -\tkzLabelPoints[below](B) -\tkzLabelPoints[above](C) -\tkzLabelPoints[new,below left](T_b) -\tkzLabelPoints[new,below right](T_c) -\tkzLabelPoints[new,right=6pt](T_a) -\tkzMarkRightAngles[fill=gray!15](J_a,T_a,B J_b,T_b,C J_c,T_c,A) -\end{tikzpicture} -\hspace*{\fill} -% subsection excircles (end) +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawPoints[new](J_a,J_b,J_c) + \tkzClipBB + \tkzDrawCircles[gray](J_a,T_a J_b,T_b J_c,T_c) + \tkzDrawLines[add=1 and 1](A,B B,C C,A) + \tkzDrawSegments[new](A,T_a B,T_b C,T_c) + \tkzDrawSegments[new](J_a,T_a J_b,T_b J_c,T_c) + \tkzDrawPolygon(A,B,C) + \tkzDrawPolygon[new](T_a,T_b,T_c) + \tkzDrawPoints(A,B,C,K) + \tkzDrawPoints[new](T_a,T_b,T_c) + \tkzLabelPoints[below left](A) + \tkzLabelPoints[below](B) + \tkzLabelPoints[above](C) + \tkzLabelPoints[new,below left](T_b) + \tkzLabelPoints[new,below right](T_c) + \tkzLabelPoints[new,right=6pt](T_a) + \tkzMarkRightAngles[fill=gray!15](J_a,T_a,B J_b,T_b,C J_c,T_c,A) + \end{tikzpicture} +\end{center} + + +% subsection excircles (end) -\subsection{Orthogonal circle through} % (fold) -\label{sub:orthogonal_circle_through} -\begin{minipage}{.5\textwidth} -\begin{Verbatim} -\begin{tkzelements} - z.O = point: new (0,1) - z.A = point: new (1,0) - z.z1 = point: new (-1.5,-1.5) - z.z2 = point: new (2.5,-1.25) - C.OA = circle: new (z.O,z.A) - C = C.OA: orthogonal_through (z.z1,z.z2) - z.c = C.center -\end{tkzelements} -\begin{tikzpicture} - \tkzGetNodes - \tkzDrawCircle(O,A) - \tkzDrawCircle[new](c,z1) - \tkzDrawPoints[new](O,A,z1,z2,c) - \tkzLabelPoints[right](O,A,z1,z2,c) -\end{tikzpicture} -\end{Verbatim} -\end{minipage} -\begin{minipage}{.5\textwidth}\begin{tkzelements} - z.O = point: new (0,1) - z.A = point: new (1,0) - z.z1 = point: new (-1.5,-1.5) - z.z2 = point: new (2.5,-1.25) - C.OA = circle: new (z.O,z.A) - C = C.OA: orthogonal_through (z.z1,z.z2) - z.c = C.center -\end{tkzelements} -\hspace*{\fill} -\begin{tikzpicture} -\tkzGetNodes -\tkzDrawCircle(O,A) -\tkzDrawCircle[orange](c,z1) -\tkzDrawPoints[orange](O,A,z1,z2,c) -\tkzLabelPoints[right](O,A,z1,z2,c) -\end{tikzpicture} -\hspace*{\fill} -\end{minipage} -% subsection orthogonal_circle_through (end) \subsection{Divine ratio} % (fold) \label{sub:divine_ratio} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0 , 0) z.B = point: new (8 , 0) L.AB = line: new (z.A,z.B) @@ -789,7 +1187,7 @@ C1 = circle: new (z.O_1,z.C) _,z.T = intersection (L.AR,C1) L.BG = line: new (z.B,z.G) z.L = intersection (L.AR,L.BG) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygons(A,C,E,F A,B,G,H) @@ -800,7 +1198,8 @@ z.L = intersection (L.AR,L.BG) \end{tikzpicture} \end{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0 , 0) z.B = point: new (8 , 0) L.AB = line: new (z.A,z.B) @@ -824,18 +1223,21 @@ C1 = circle: new (z.O_1,z.C) _,z.T = intersection (L.AR,C1) L.BG = line: new (z.B,z.G) z.L = intersection (L.AR,L.BG) -\end{tkzelements} +} + + +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygons(A,C,E,F A,B,G,H) + \tkzDrawCircles(O_1,C O_2,B O_0,B) + \tkzDrawSegments(H,C B,K A,L) + \tkzDrawPoints(A,B,C,K,E,F,G,H,O_0,O_1,O_2,R,S,T,L) + \tkzLabelPoints(A,B,C,K,E,F,G,H,O_0,O_1,O_2,R,S,T,L) + \end{tikzpicture} +\end{center} + -\hspace*{\fill} -\begin{tikzpicture} -\tkzGetNodes -\tkzDrawPolygons(A,C,E,F A,B,G,H) -\tkzDrawCircles(O_1,C O_2,B O_0,B) -\tkzDrawSegments(H,C B,K A,L) -\tkzDrawPoints(A,B,C,K,E,F,G,H,O_0,O_1,O_2,R,S,T,L) -\tkzLabelPoints(A,B,C,K,E,F,G,H,O_0,O_1,O_2,R,S,T,L) -\end{tikzpicture} -\hspace*{\fill} % subsection divine_ratio (end) \subsection{Director circle} % (fold) @@ -843,7 +1245,8 @@ z.L = intersection (L.AR,L.BG) % modif C: point (0.25) instead of 2 \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .5 z.O = point: new (0 , 0) z.F1 = point: new (4 , 0) @@ -859,7 +1262,7 @@ z.L = intersection (L.AR,L.BG) L.J,L.K = E: tangent_from (z.L) z.J = L.J.pb z.K = L.K.pb -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPoints(F1,F2,O) @@ -875,7 +1278,8 @@ z.L = intersection (L.AR,L.BG) \end{Verbatim} \end{minipage} \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% -\begin{tkzelements} +\directlua{% +init_elements () scale = .5 z.O = point: new (0 , 0) z.F1 = point: new (4 , 0) @@ -891,21 +1295,24 @@ z.L = C: point (0.25) L.J,L.K = E: tangent_from (z.L) z.J = L.J.pb z.K = L.K.pb -\end{tkzelements} +} + + +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawPoints(F1,F2,O) + \tkzDrawCircles[teal](O,P) + \tkzDrawPolygon(H,O,A,P) + \tkzDrawEllipse[red](O,\tkzUseLua{a},\tkzUseLua{b},0) + \tkzDrawSegments[orange](O,P O,L L,J L,K) + \tkzDrawPoints(F1,F2,O,H,A,P,L,J,K) + \tkzLabelPoints(F1,F2,O,H,A,P,L,J,K) + \tkzLabelPoints[above](L) + \tkzMarkRightAngles(A,P,H J,L,K) + \end{tikzpicture} +\end{center} -\hspace*{\fill} -\begin{tikzpicture} -\tkzGetNodes -\tkzDrawPoints(F1,F2,O) -\tkzDrawCircles[teal](O,P) -\tkzDrawPolygon(H,O,A,P) -\tkzDrawEllipse[red](O,\tkzUseLua{a},\tkzUseLua{b},0) -\tkzDrawSegments[orange](O,P O,L L,J L,K) -\tkzDrawPoints(F1,F2,O,H,A,P,L,J,K) -\tkzLabelPoints(F1,F2,O,H,A,P,L,J,K) -\tkzLabelPoints[above](L) -\tkzMarkRightAngles(A,P,H J,L,K) -\end{tikzpicture} \end{minipage} % subsection director_circle (end) @@ -913,8 +1320,10 @@ z.K = L.K.pb \subsection{Gold division} % (fold) \label{sub:gold_division} +\begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0,0) z.B = point: new (2.5,0) L.AB = line: new (z.A,z.B) @@ -930,56 +1339,65 @@ z.G = intersection (L.mediator,C.BA) L.EG = line:new (z.E,z.G) z.C = intersection (L.EG,L.AB) z.O = C.AB: antipode (z.B) -\end{tkzelements} - \begin{tikzpicture} - \tkzGetNodes - \tkzDrawArc[delta=5](O,B)(G) - \tkzDrawCircles(A,B B,A) - \tkzDrawSegments(A,E B,E O,I) - \tkzDrawSegments[purple](J,E A,G G,I K,G E,G) - \tkzMarkSegments[mark=s||](A,E B,E O,A) - \tkzDrawPoints(A,B,C,E,I,J,G,O,K) - \tkzLabelPoints(A,B,C,E,I,J,G,O,K) - \end{tikzpicture} +} +\begin{tikzpicture} +\tkzGetNodes +\tkzDrawArc[delta=5](O,B)(G) +\tkzDrawCircles(A,B B,A) +\tkzDrawSegments(A,E B,E O,I) +\tkzDrawSegments[purple](J,E A,G G,I K,G E,G) +\tkzMarkSegments[mark=s||](A,E B,E O,A) +\tkzDrawPoints(A,B,C,E,I,J,G,O,K) +\tkzLabelPoints(A,B,C,E,I,J,G,O,K) +\end{tikzpicture} \end{Verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} + \directlua{% + init_elements () + scale = .75 + z.A = point: new (0,0) + z.B = point: new (2.5,0) + L.AB = line: new (z.A,z.B) + C.AB = circle: new (z.A,z.B) + C.BA = circle: new (z.B,z.A) + z.J = L.AB: midpoint () + L.JB = line:new (z.J,z.B) + z.F,z.E = intersection (C.AB , C.BA) + z.I,_ = intersection (L.AB , C.BA) + z.K = L.JB : midpoint () + L.mediator = L.JB: mediator () + z.G = intersection (L.mediator,C.BA) + L.EG = line:new (z.E,z.G) + z.C = intersection (L.EG,L.AB) + z.O = C.AB: antipode (z.B) + } + + + \begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawArc[delta=5](O,B)(G) + \tkzDrawCircles(A,B B,A) + \tkzDrawSegments(A,E B,E O,I) + \tkzDrawSegments[purple](J,E A,G G,I K,G E,G) + \tkzMarkSegments[mark=s||](A,E B,E O,A) + \tkzDrawPoints(A,B,C,E,I,J,G,O,K) + \tkzLabelPoints(A,B,C,E,I,J,G,O,K) + \end{tikzpicture} + \end{center} +\end{minipage} + -\begin{tkzelements} -z.A = point: new (0,0) -z.B = point: new (2.5,0) -L.AB = line: new (z.A,z.B) -C.AB = circle: new (z.A,z.B) -C.BA = circle: new (z.B,z.A) -z.J = L.AB: midpoint () -L.JB = line:new (z.J,z.B) -z.F,z.E = intersection (C.AB , C.BA) -z.I,_ = intersection (L.AB , C.BA) -z.K = L.JB : midpoint () -L.mediator = L.JB: mediator () -z.G = intersection (L.mediator,C.BA) -L.EG = line:new (z.E,z.G) -z.C = intersection (L.EG,L.AB) -z.O = C.AB: antipode (z.B) -\end{tkzelements} -\hspace*{\fill} -\begin{tikzpicture} - \tkzGetNodes - \tkzDrawArc[delta=5](O,B)(G) - \tkzDrawCircles(A,B B,A) - \tkzDrawSegments(A,E B,E O,I) - \tkzDrawSegments[purple](J,E A,G G,I K,G E,G) - \tkzMarkSegments[mark=s||](A,E B,E O,A) - \tkzDrawPoints(A,B,C,E,I,J,G,O,K) - \tkzLabelPoints(A,B,C,E,I,J,G,O,K) -\end{tikzpicture} - \hspace*{\fill} % subsection gold_division (end) \subsection{Ellipse} % (fold) \label{sub:ellipse} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.C = point: new (3 , 2) z.A = point: new (5 , 1) L.CA = line : new (z.C,z.A) @@ -990,7 +1408,7 @@ z.O = C.AB: antipode (z.B) a = E.Rx b = E.Ry slope = math.deg(E.slope) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles[teal](C,A) @@ -1001,7 +1419,8 @@ z.O = C.AB: antipode (z.B) \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.C = point: new (3 , 2) z.A = point: new (5 , 1) L.CA = line : new (z.C,z.A) @@ -1012,17 +1431,19 @@ E = ellipse: new (z.C,z.A,z.B) a = E.Rx b = E.Ry slope = math.deg(E.slope) -\end{tkzelements} +} + +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircles[teal](C,A) + \tkzDrawEllipse[red](C,\tkzUseLua{a},\tkzUseLua{b},\tkzUseLua{slope}) + \tkzDrawPoints(C,A,B,b) + \tkzLabelPoints(C,A,B) + \end{tikzpicture} +\end{center} + -\hspace*{\fill} -\begin{tikzpicture} -\tkzGetNodes -\tkzDrawCircles[teal](C,A) -\tkzDrawEllipse[red](C,\tkzUseLua{a},\tkzUseLua{b},\tkzUseLua{slope}) -\tkzDrawPoints(C,A,B,b) -\tkzLabelPoints(C,A,B) -\end{tikzpicture} -\hspace*{\fill} \end{minipage} % subsection ellipse (end) @@ -1030,7 +1451,8 @@ slope = math.deg(E.slope) \label{sub:ellipse_with_radii} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale=.5 z.C = point: new (0 , 4) b = value(math.sqrt(8)) @@ -1039,7 +1461,7 @@ ang = math.deg(math.pi/4) E = ellipse: radii (z.C,a,b,math.pi/4) z.V = E : point (0) z.CoV = E : point (math.pi/2) -\end{tkzelements} +} \begin{tikzpicture}[gridded] \tkzGetNodes \tkzDrawEllipse[blue](C,\tkzUseLua{a}, @@ -1049,7 +1471,8 @@ z.CoV = E : point (math.pi/2) \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () scale=.5 z.C = point: new (0 , 4) b = value(math.sqrt(8)) @@ -1058,14 +1481,17 @@ ang = math.deg(math.pi/4) E = ellipse: radii (z.C,a,b,math.pi/4) z.V = E : point (0) z.CoV = E : point (math.pi/2) -\end{tkzelements} +} + + +\begin{center} + \begin{tikzpicture}[gridded] + \tkzGetNodes + \tkzDrawEllipse[blue](C,\tkzUseLua{a},\tkzUseLua{b},\tkzUseLua{ang}) + \tkzDrawPoints(C,V,CoV) + \end{tikzpicture} +\end{center} -\hspace*{\fill} -\begin{tikzpicture}[gridded] -\tkzGetNodes -\tkzDrawEllipse[blue](C,\tkzUseLua{a},\tkzUseLua{b},\tkzUseLua{ang}) -\tkzDrawPoints(C,V,CoV) -\end{tikzpicture} \end{minipage} % subsection ellipse_with_radii (end) @@ -1073,7 +1499,8 @@ z.CoV = E : point (math.pi/2) \label{sub:ellipse_with_foci} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () local e e = .8 z.A = point: new (2 , 3) @@ -1091,7 +1518,7 @@ z.CoV = E : point (math.pi/2) L.ta,L.tb = E: tangent_from (z.K) z.F = L.ta.pb z.G = L.tb.pb -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPoints(A,B,C,K,F,G,V,cV) @@ -1102,7 +1529,8 @@ z.CoV = E : point (math.pi/2) \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () local e e = .8 z.A = point: new (2 , 3) @@ -1120,25 +1548,29 @@ ang = math.deg(E.slope) L.ta,L.tb = E: tangent_from (z.K) z.F = L.ta.pb z.G = L.tb.pb -\end{tkzelements} +} -\hspace*{\fill} -\begin{tikzpicture} - \tkzGetNodes - \tkzDrawPoints(A,B,C,K,F,G,V,cV) - \tkzLabelPoints(A,B,C,K,F,G,V,cV) + +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawPoints(A,B,C,K,F,G,V,cV) + \tkzLabelPoints(A,B,C,K,F,G,V,cV) \tkzDrawEllipse[teal](C,\tkzUseLua{a},\tkzUseLua{b},\tkzUseLua{ang}) - \tkzDrawLines(K,F K,G) -\end{tikzpicture} - \hspace*{\fill} + \tkzDrawLines(K,F K,G) + \end{tikzpicture} +\end{center} + + \end{minipage} % subsection ellipse_with_foci (end) \subsection{Euler relation} % (fold) \label{sub:euler_relation} -\begin{minipage}{.5\textwidth} + \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .75 z.A = point: new (0 , 0) z.B = point: new (5 , 0) @@ -1153,7 +1585,7 @@ z.G = L.tb.pb z.w = T.IBA.circumcenter L.Ow = line : new (z.O,z.w) _,z.E = intersection (L.Ow, C.OA) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawArc(J,X)(Y) @@ -1166,9 +1598,9 @@ z.G = L.tb.pb \tkzMarkRightAngles[fill=gray!20,opacity=.4](C,H,I A,K,J) \end{tikzpicture} \end{Verbatim} -\end{minipage} -\begin{minipage}{.5\textwidth} -\begin{tkzelements} + +\directlua{% +init_elements () z.A = point: new (0 , 0) z.B = point: new (5 , 0) z.C = point: new (-.4 , 4) @@ -1182,30 +1614,31 @@ T.IBA = triangle: new (z.I,z.B,z.A) z.w = T.IBA.circumcenter L.Ow = line : new (z.O,z.w) _,z.E = intersection (L.Ow, C.OA) -\end{tkzelements} +} + +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawArc(J,X)(Y) + \tkzDrawCircles(I,H O,A) + \tkzDrawCircle[red](w,I) + \tkzDrawLines(Y,C A,B X,C E,w E,B) + \tkzDrawSegments[blue](J,C J,K I,H I,O w,B) + \tkzDrawPoints(A,B,C,I,J,E,w,H,K,O) + \tkzLabelPoints(A,B,C,J,I,w,H,K,E,O) + \tkzMarkRightAngles[fill=gray!20,opacity=.4](C,H,I A,K,J) + \end{tikzpicture} +\end{center} -\hspace*{\fill} -\begin{tikzpicture} -\tkzGetNodes -\tkzDrawArc(J,X)(Y) -\tkzDrawCircles(I,H O,A) -\tkzDrawCircle[red](w,I) -\tkzDrawLines(Y,C A,B X,C E,w E,B) -\tkzDrawSegments[blue](J,C J,K I,H I,O w,B) -\tkzDrawPoints(A,B,C,I,J,E,w,H,K,O) -\tkzLabelPoints(A,B,C,J,I,w,H,K,E,O) -\tkzMarkRightAngles[fill=gray!20,opacity=.4](C,H,I A,K,J) -\end{tikzpicture} -\hspace*{\fill} -\end{minipage} % subsection euler_relation (end) \subsection{External angle} % (fold) \label{sub:external_angle} \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% \begin{Verbatim} -\begin{tkzelements} - scale = .75 +\directlua{% +init_elements () + scale = .5 z.A = point: new (0 , 0) z.B = point: new (5 , 0) z.C = point: new (-2 , 4) @@ -1214,7 +1647,7 @@ _,z.E = intersection (L.Ow, C.OA) z.O = T.ABC.circumcenter z.D = intersection (T.ext.ab,T.ABC.ab) z.E = z.C: symmetry (z.B) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygon(A,B,C) @@ -1230,7 +1663,8 @@ _,z.E = intersection (L.Ow, C.OA) \end{Verbatim} \end{minipage} \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% -\begin{tkzelements} +\directlua{% +init_elements () scale = .75 z.A = point: new (0 , 0) z.B = point: new (5 , 0) @@ -1240,22 +1674,23 @@ T.ext = T.ABC: excentral () z.O = T.ABC.circumcenter z.D = intersection (T.ext.ab,T.ABC.ab) z.E = z.C: symmetry (z.B) -\end{tkzelements} +} -\hspace*{\fill} -\begin{tikzpicture} -\tkzGetNodes -\tkzDrawPolygon(A,B,C) -\tkzDrawLine[purple,add=0 and .5](B,C) -\tkzDrawSegment[purple](A,D) -\tkzDrawSegment[orange](C,D) -\tkzFillAngles[purple!30,opacity=.2](D,C,A E,C,D) -\tkzMarkAngles[mark=|](D,C,A E,C,D) -\tkzDrawPoints(A,...,D) -\tkzLabelPoints[above](C) -\tkzLabelPoints(A,B,D) -\end{tikzpicture} -\hspace*{\fill} + +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygon(A,B,C) + \tkzDrawLine[purple,add=0 and .5](B,C) + \tkzDrawSegment[purple](A,D) + \tkzDrawSegment[orange](C,D) + \tkzFillAngles[purple!30,opacity=.2](D,C,A E,C,D) + \tkzMarkAngles[mark=|](D,C,A E,C,D) + \tkzDrawPoints(A,...,D) + \tkzLabelPoints[above](C) + \tkzLabelPoints(A,B,D) + \end{tikzpicture} +\end{center} \end{minipage} % subsection external_angle (end) @@ -1263,7 +1698,8 @@ z.E = z.C: symmetry (z.B) \label{sub:internal_angle} \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .8 z.A = point: new (0 , 0) z.B = point: new (6 , 0) @@ -1275,7 +1711,7 @@ z.E = z.C: symmetry (z.B) L.LL = T.ab: ll_from (z.C) L.AD = line: new (z.A,z.D) z.E = intersection (L.LL,L.AD) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygon(A,B,C) @@ -1291,7 +1727,8 @@ z.E = z.C: symmetry (z.B) \end{Verbatim} \end{minipage} \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% -\begin{tkzelements} +\directlua{% +init_elements () scale =.8 z.A = point: new (0 , 0) z.B = point: new (6 , 0) @@ -1303,54 +1740,59 @@ z.D = intersection (L.AI, T.bc) L.LL = T.ab: ll_from (z.C) L.AD = line: new (z.A,z.D) z.E = intersection (L.LL,L.AD) -\end{tkzelements} -\hspace*{\fill} -\begin{tikzpicture} -\tkzGetNodes -\tkzDrawPolygon(A,B,C) -\tkzDrawLine[purple](C,E) -\tkzDrawSegment[purple](A,E) -\tkzFillAngles[purple!30,opacity=.4](B,A,C C,E,D) -\tkzMarkAngles[mark=|](B,A,D D,A,C C,E,D) -\tkzDrawPoints(A,...,E) -\tkzLabelPoints(A,B) -\tkzLabelPoints[above](C,D,E) -\tkzMarkSegments(A,C C,E) -\end{tikzpicture} +} + +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygon(A,B,C) + \tkzDrawLine[purple](C,E) + \tkzDrawSegment[purple](A,E) + \tkzFillAngles[purple!30,opacity=.4](B,A,C C,E,D) + \tkzMarkAngles[mark=|](B,A,D D,A,C C,E,D) + \tkzDrawPoints(A,...,E) + \tkzLabelPoints(A,B) + \tkzLabelPoints[above](C,D,E) + \tkzMarkSegments(A,C C,E) + \end{tikzpicture} +\end{center} + \end{minipage} %subsection internal_angle (end) \subsection{Feuerbach theorem} % (fold) \label{sub:nine_points} -\begin{minipage}[t]{.5\textwidth}\vspace{0pt}% + + \begin{Verbatim} -\begin{tkzelements} - scale = 1.5 - z.A = point: new (0 , 0) - z.B = point: new (5 , -.5) - z.C = point: new (-.5 , 3) - T.ABC = triangle: new (z.A,z.B,z.C) - z.O = T.ABC.circumcenter - z.N = T.ABC.eulercenter - z.I,z.K = get_points(T.ABC: in_circle()) - z.H = T.ABC.ab : projection (z.I) - z.Ap, - z.Bp, - z.Cp = get_points (T.ABC : medial ()) - C.IH = circle:new (z.I,z.H) - C.NAp = circle:new (z.N,z.Ap) - C.OA = circle:new (z.O,z.A) - z.U = C.OA.south - z.L = C.NAp.south - z.M = C.NAp.north - z.X = T.ABC.ab: projection (z.C) - L.CU = line: new (z.C,z.U) - L.ML = line: new (z.M,z.L) - z.P = L.CU: projection (z.A) - z.Q = L.CU: projection (z.B) - L.LH = line: new (z.L,z.H) - z.F = intersection (L.LH,C.IH) -- feuerbach -\end{tkzelements} +\directlua{% +init_elements () +scale = .75 + z.A = point: new (0 , 0) + z.B = point: new (5 , -.5) + z.C = point: new (-.5 , 3) + T.ABC = triangle: new (z.A,z.B,z.C) + z.O = T.ABC.circumcenter + z.N = T.ABC.eulercenter + z.I,z.K = get_points(T.ABC: in_circle()) + z.H = T.ABC.ab : projection (z.I) + z.Ap, + z.Bp, + z.Cp = get_points (T.ABC : medial ()) + C.IH = circle:new (z.I,z.H) + C.NAp = circle:new (z.N,z.Ap) + C.OA = circle:new (z.O,z.A) + z.U = C.OA.south + z.L = C.NAp.south + z.M = C.NAp.north + z.X = T.ABC.ab: projection (z.C) + L.CU = line: new (z.C,z.U) + L.ML = line: new (z.M,z.L) + z.P = L.CU: projection (z.A) + z.Q = L.CU: projection (z.B) + L.LH = line: new (z.L,z.H) + z.F = intersection (L.LH,C.IH) % feuerbach +} \begin{tikzpicture} \tkzGetNodes @@ -1364,10 +1806,10 @@ z.E = intersection (L.LL,L.AD) \tkzLabelPoints(A,B,C,N,H,A',B',C',U,L,M,P,Q,F,I) \end{tikzpicture} \end{Verbatim} -\end{minipage} -\begin{minipage}[t]{.5\textwidth}\vspace{0pt}% -\begin{tkzelements} -scale = 1 + +\directlua{% +init_elements () +scale =1.25 z.A = point: new (0 , 0) z.B = point: new (5 , -.5) z.C = point: new (-.5 , 3) @@ -1389,29 +1831,32 @@ L.ML = line: new (z.M,z.L) z.P = L.CU: projection (z.A) z.Q = L.CU: projection (z.B) L.LH = line: new (z.L,z.H) -z.F = intersection (L.LH,C.IH) -- feuerbach -\end{tkzelements} +z.F = intersection (L.LH,C.IH) % feuerbach +} + +\begin{center} + \begin{tikzpicture}[rotate=90] + \tkzGetNodes + \tkzDrawLine(L,F) + \tkzDrawCircle[red](N,A') + \tkzDrawCircle[blue](I,H) + \tkzDrawCircles[teal](O,A L,C') + \tkzDrawSegments(M,L B,U Q,C C,X A,P B,Q) + \tkzDrawPolygons(A,B,C A',B',C') + \tkzDrawPoints(A,B,C,N,H,A',B',C',U,L,M,P,Q,F,I) + \tkzLabelPoints(A,B,C,N,H,A',B',C',U,L,M,P,Q,F,I) + \end{tikzpicture} +\end{center} + -\hspace*{\fill} -\begin{tikzpicture}[rotate=90] -\tkzGetNodes -\tkzDrawLine(L,F) -\tkzDrawCircle[red](N,A') -\tkzDrawCircle[blue](I,H) -\tkzDrawCircles[teal](O,A L,C') -\tkzDrawSegments(M,L B,U Q,C C,X A,P B,Q) -\tkzDrawPolygons(A,B,C A',B',C') -\tkzDrawPoints(A,B,C,N,H,A',B',C',U,L,M,P,Q,F,I) -\tkzLabelPoints(A,B,C,N,H,A',B',C',U,L,M,P,Q,F,I) -\end{tikzpicture} -\end{minipage} % subsection nine_points (end) \subsection{Gold ratio with segment} % (fold) \label{sub:gold_ratio_with_segment} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0 , 0) z.B = point: new (8 , 0) L.AB = line: new (z.A,z.B) @@ -1422,7 +1867,7 @@ z.F = intersection (L.LH,C.IH) -- feuerbach _,z.K = intersection (L.BX,C.MA) L.AK = line: new (z.Y,z.K) z.C = intersection (L.AK,L.AB) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawLines(A,B X,K) @@ -1434,7 +1879,8 @@ z.F = intersection (L.LH,C.IH) -- feuerbach \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () scale = .5 z.A = point: new (0 , 0) z.B = point: new (8 , 0) @@ -1446,17 +1892,19 @@ C.MA = circle: new (z.M,z.A) _,z.K = intersection (L.BX,C.MA) L.AK = line: new (z.Y,z.K) z.C = intersection (L.AK,L.AB) -\end{tkzelements} +} + +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawLines(A,B X,K) + \tkzDrawLine[teal](Y,K) + \tkzDrawPoints(A,B,C,X,Y,M,K) + \tkzDrawArc[delta=20](M,A)(K) + \tkzLabelPoints(A,B,C) + \end{tikzpicture} +\end{center} -\hspace*{\fill} -\begin{tikzpicture} -\tkzGetNodes -\tkzDrawLines(A,B X,K) -\tkzDrawLine[teal](Y,K) -\tkzDrawPoints(A,B,C,X,Y,M,K) -\tkzDrawArc[delta=20](M,A)(K) -\tkzLabelPoints(A,B,C) -\end{tikzpicture} \end{minipage} %subsection gold_ratio_with_segment (end) @@ -1464,7 +1912,8 @@ z.C = intersection (L.AK,L.AB) \label{sub:gold_arbelos} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .6 z.A = point: new (0 , 0) z.C = point: new (6 , 0) @@ -1477,7 +1926,7 @@ z.C = intersection (L.AK,L.AB) z.O_2 = L.CB.mid L.AB = line: new (z.A,z.B) z.O_0 = L.AB.mid -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles(O_1,C O_2,B O_0,B) @@ -1487,7 +1936,8 @@ z.C = intersection (L.AK,L.AB) \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () scale = .4 z.A = point: new (0 , 0) z.C = point: new (6 , 0) @@ -1500,15 +1950,17 @@ L.CB = line: new (z.C,z.B) z.O_2 = L.CB.mid L.AB = line: new (z.A,z.B) z.O_0 = L.AB.mid -\end{tkzelements} +} + +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircles(O_1,C O_2,B O_0,B O_1,x) + \tkzDrawPoints(A,C,B,O_1,O_2,O_0,x) + \tkzLabelPoints[below right](A,C,B) + \end{tikzpicture} +\end{center} -\hspace*{\fill} -\begin{tikzpicture} -\tkzGetNodes -\tkzDrawCircles(O_1,C O_2,B O_0,B O_1,x) -\tkzDrawPoints(A,C,B,O_1,O_2,O_0,x) -\tkzLabelPoints[below right](A,C,B) -\end{tikzpicture} \end{minipage} % subsection gold_arbelos (end) @@ -1516,7 +1968,8 @@ z.O_0 = L.AB.mid \label{sub:harmonic_division_v1} \begin{minipage}[t]{.4\textwidth}\vspace{0pt}% \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale=.75 z.A = point: new (0 , 0) z.B = point: new (4 , 0) @@ -1529,7 +1982,7 @@ z.O_0 = L.AB.mid z.F = z.B : symmetry (z.E) L.GF = line :new (z.G,z.F) z.C = intersection (L.GF,L.AB) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawLines(A,B A,G A,D A,G F,E G,F G,D) @@ -1540,7 +1993,8 @@ z.O_0 = L.AB.mid \end{Verbatim} \end{minipage} \begin{minipage}[t]{.6\textwidth}\vspace{0pt}% -\begin{tkzelements} +\directlua{% +init_elements () scale=.75 z.A = point: new (0 , 0) z.B = point: new (4 , 0) @@ -1553,16 +2007,17 @@ z.O_0 = L.AB.mid z.F = z.B : symmetry (z.E) L.GF = line :new (z.G,z.F) z.C = intersection (L.GF,L.AB) -\end{tkzelements} -\hspace*{\fill} -\begin{tikzpicture} - \tkzGetNodes - \tkzDrawLines(A,B A,G A,D A,G F,E G,F G,D) - \tkzDrawPoints(A,B,G,E,F,C,D) - \tkzLabelPoints(A,B,G,E,F,C,D) - \tkzMarkSegments(F,B B,E) -\end{tikzpicture} -\hspace*{\fill} +} + +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawLines(A,B A,G A,D A,G F,E G,F G,D) + \tkzDrawPoints(A,B,G,E,F,C,D) + \tkzLabelPoints(A,B,G,E,F,C,D) + \tkzMarkSegments(F,B B,E) + \end{tikzpicture} +\end{center} \end{minipage} % subsection harmonic_division_v1 (end) @@ -1570,7 +2025,8 @@ z.O_0 = L.AB.mid \label{sub:harmonic_division_v2} \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .5 z.A = point: new (0 , 0) z.B = point: new (6 , 0) @@ -1587,7 +2043,7 @@ L.BF = line: new (z.B,z.F) z.G = intersection (L.AE,L.BF) L.GX = line: new (z.G,z.X) z.C = intersection (L.GX,L.AB) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawLines(A,D A,E B,F D,F X,A X,B X,C) @@ -1597,7 +2053,8 @@ z.C = intersection (L.GX,L.AB) \end{Verbatim} \end{minipage} \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% -\begin{tkzelements} +\directlua{% +init_elements () scale = .5 z.A = point: new (0 , 0) z.B = point: new (6 , 0) @@ -1614,15 +2071,17 @@ L.BF = line: new (z.B,z.F) z.G = intersection (L.AE,L.BF) L.GX = line: new (z.G,z.X) z.C = intersection (L.GX,L.AB) -\end{tkzelements} +} + +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawLines(A,D A,E B,F D,F X,A X,B X,C) + \tkzDrawPoints(A,...,G,X) + \tkzLabelPoints(A,...,G,X) + \end{tikzpicture} +\end{center} -\hspace*{\fill} -\begin{tikzpicture} -\tkzGetNodes -\tkzDrawLines(A,D A,E B,F D,F X,A X,B X,C) -\tkzDrawPoints(A,...,G,X) -\tkzLabelPoints(A,...,G,X) -\end{tikzpicture} \end{minipage} % subsection harmonic_division_v2 (end) @@ -1630,7 +2089,8 @@ z.C = intersection (L.GX,L.AB) \label{sub:menelaus} \begin{minipage}{.4\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0 , 0) z.B = point: new (6 , 0) z.C = point: new (5 , 4) @@ -1641,7 +2101,7 @@ z.C = intersection (L.GX,L.AB) L.BC = line: new (z.B,z.C) z.Q = intersection (L.AC,L.PX) z.R = intersection (L.BC,L.PX) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygon(A,B,C) @@ -1653,7 +2113,8 @@ z.C = intersection (L.GX,L.AB) \end{Verbatim} \end{minipage} \begin{minipage}{.6\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0 , 0) z.B = point: new (6 , 0) z.C = point: new (5 , 4) @@ -1664,396 +2125,28 @@ L.PX = line: new (z.P,z.X) L.BC = line: new (z.B,z.C) z.Q = intersection (L.AC,L.PX) z.R = intersection (L.BC,L.PX) -\end{tkzelements} - -\hspace*{\fill} -\begin{tikzpicture} -\tkzGetNodes -\tkzDrawPolygon(A,B,C) -\tkzDrawLine[new](P,R) -\tkzDrawLines(P,B A,C B,C) -\tkzDrawPoints(P,Q,R,A,B,C) -\tkzLabelPoints(A,B,C,P,Q,R) -\end{tikzpicture} -\hspace*{\fill} -\end{minipage} -% subsection menelaus (end) - -\subsection{Radical axis v1} % (fold) -\label{sub:radical_axis_v1} - -\begin{Verbatim} -\begin{tkzelements} -scale = .75 -z.X = point : new (0,0) -z.B = point : new (2,2) -z.Y = point : new (7,1) -z.Ap = point : new (8,-1) -L.XY = line : new (z.X,z.Y) -C.XB = circle : new (z.X,z.B) -C.YAp = circle : new (z.Y,z.Ap) -z.E,z.F = get_points (C.XB : radical_axis (C.YAp)) -z.A = C.XB : point (0.4) -T.ABAp = triangle: new (z.A,z.B,z.Ap) -z.O = T.ABAp.circumcenter -C.OAp = circle : new (z.O,z.Ap) -_,z.Bp = intersection (C.OAp,C.YAp) -L.AB = line : new (z.A,z.B) -L.ApBp = line : new (z.Ap,z.Bp) -z.M = intersection (L.AB,L.ApBp) -z.H = L.XY : projection (z.M) -\end{tkzelements} -\begin{tikzpicture} - \tkzGetNodes - \tkzDrawCircles(X,B Y,A') - \tkzDrawArc[dashed,delta=30](O,A')(A) - \tkzDrawPoints(A,B,A',B',M,H,X,Y,O,E,F) - \tkzDrawLines[red](A,M A',M X,Y E,F) - \tkzDrawLines[red,add=1 and 3](M,H) -\end{tikzpicture} -\end{Verbatim} - -\begin{tkzelements} -scale = .75 -z.X = point : new (0,0) -z.B = point : new (2,2) -z.Y = point : new (7,1) -z.Ap = point : new (8,-1) -L.XY = line : new (z.X,z.Y) -C.XB = circle : new (z.X,z.B) -C.YAp = circle : new (z.Y,z.Ap) -z.E,z.F = get_points (C.XB : radical_axis (C.YAp)) -z.A = C.XB : point (0.4) -T.ABAp = triangle: new (z.A,z.B,z.Ap) -z.O = T.ABAp.circumcenter -C.OAp = circle : new (z.O,z.Ap) -_,z.Bp = intersection (C.OAp,C.YAp) -L.AB = line : new (z.A,z.B) -L.ApBp = line : new (z.Ap,z.Bp) -z.M = intersection (L.AB,L.ApBp) -z.H = L.XY : projection (z.M) -\end{tkzelements} -\hspace*{\fill} -\begin{tikzpicture} -\tkzGetNodes -\tkzDrawCircles(X,B Y,A') -\tkzDrawArc[dashed,delta=30](O,A')(A) -\tkzDrawPoints(A,B,A',B',M,H,X,Y,O,E,F) -\tkzDrawLines[red](A,M A',M X,Y E,F) -\tkzDrawLines[red,add=1 and 3](M,H) -\end{tikzpicture} -% subsection radical_axis_v1 (end) +} -\subsection{Radical axis v2} % (fold) -\label{sub:radical_axis_v2} - -\begin{Verbatim} -\begin{tkzelements} -scale = 1.25 -z.O = point : new (-1,0) -z.Op = point : new (4,-1) -z.B = point : new (0,2) -z.D = point : new (4,0) -C.OB = circle : new (z.O,z.B) -C.OpD = circle : new (z.Op,z.D) -L.EF = C.OB : radical_axis (C.OpD) -z.E,z.F = get_points (L.EF) -z.M = L.EF : point (.75) -L.MT,L.MTp = C.OB : tangent_from (z.M) -_,z.T = get_points (L.MT) -_,z.Tp = get_points (L.MTp) -L.MK,L.MKp = C.OpD : tangent_from (z.M) -_,z.K = get_points (L.MK) -_,z.Kp = get_points (L.MKp) -\end{tkzelements} -\begin{tikzpicture} - \tkzGetNodes - \tkzDrawCircles(O,B O',D) - \tkzDrawLine(E,F) - \tkzDrawLine[add=.5 and .5](O,O') - \tkzDrawLines[add = 0 and .5](M,T M,T' M,K M,K') - \tkzDrawCircle(M,T) - \tkzDrawPoints(O,O',T,M,T',K,K') - \tkzLabelPoints(O,O',T,T',K,K',M) -\end{tikzpicture} -\end{Verbatim} - -\begin{tkzelements} -scale =1.25 -z.O = point : new (-1,0) -z.Op = point : new (4,-1) -z.B = point : new (0,2) -z.D = point : new (4,0) -C.OB = circle : new (z.O,z.B) -C.OpD = circle : new (z.Op,z.D) -L.EF = C.OB : radical_axis (C.OpD) -z.E,z.F = get_points (L.EF) -z.M = L.EF : point (.75) -L.MT,L.MTp = C.OB : tangent_from (z.M) -_,z.T = get_points (L.MT) -_,z.Tp = get_points (L.MTp) -L.MK,L.MKp = C.OpD : tangent_from (z.M) -_,z.K = get_points (L.MK) -_,z.Kp = get_points (L.MKp) -\end{tkzelements} -\hspace*{\fill} -\begin{tikzpicture} -\tkzGetNodes -\tkzDrawCircles(O,B O',D) -\tkzDrawLine(E,F) -\tkzDrawLine[add=.5 and .5](O,O') -\tkzDrawLines[add = 0 and .5](M,T M,T' M,K M,K') -\tkzDrawCircle(M,T) -\tkzDrawPoints(O,O',T,M,T',K,K') -\tkzLabelPoints(O,O',T,T',K,K',M) -\end{tikzpicture} -\hspace*{\fill} -% subsection radical_axis_v2 (end) - -\subsection{Radical axis v3} % (fold) -\label{sub:radical_axis_v3} - -\begin{Verbatim} - \begin{tkzelements} - z.O = point : new (0,0) - z.B = point : new (4,0) - z.Op = point : new (6,0) - C.OB = circle : new (z.O,z.B) - C.OpB = circle : new (z.Op,z.B) - L.EF = C.OB : radical_axis (C.OpB) - z.E,z.F = get_points(L.EF) - z.M = L.EF : point (0.2) - L = C.OB : tangent_from (z.M) - _,z.T = get_points (L) - L = C.OpB : tangent_from (z.M) - _,z.Tp = get_points (L) -\end{tkzelements} -\begin{tikzpicture} - \tkzGetNodes - \tkzDrawCircles(O,B O',B) - \tkzDrawSegments(M,T M,T') - \tkzDrawSegments(E,F) - \tkzDrawLine[add=.5 and .5](O,O') - \tkzDrawPoints(O,B,O',E,F,M,T,T') - \tkzLabelPoints(O,O',B,E,F,T,T') - \tkzDrawArc(M,T')(T) -\end{tikzpicture} -\end{Verbatim} - -\begin{tkzelements} -z.O = point : new (0,0) -z.B = point : new (4,0) -z.Op = point : new (6,0) -C.OB = circle : new (z.O,z.B) -C.OpB = circle : new (z.Op,z.B) -L.EF = C.OB : radical_axis (C.OpB) -z.E,z.F = get_points(L.EF) -z.M = L.EF : point (0.2) -L = C.OB : tangent_from (z.M) -_,z.T = get_points (L) -L = C.OpB : tangent_from (z.M) -_,z.Tp = get_points (L) -\end{tkzelements} -\hspace*{\fill} -\begin{tikzpicture} -\tkzGetNodes -\tkzDrawCircles(O,B O',B) -\tkzDrawSegments(M,T M,T') -\tkzDrawSegments(E,F) -\tkzDrawLine[add=.5 and .5](O,O') -\tkzDrawPoints(O,B,O',E,F,M,T,T') -\tkzLabelPoints(O,O',B,E,F,T,T') -\tkzDrawArc(M,T')(T) -\end{tikzpicture} -\hspace*{\fill} -% subsection radical_axis_v3 (end) - -\subsection{Radical axis v4} % (fold) -\label{sub:radical_axis_v4} -\begin{Verbatim} -\begin{tkzelements} - z.O = point : new (0,0) - z.B = point : new (5,0) - z.Op = point : new (3,0) - C.OB = circle : new (z.O,z.B) - C.OpB = circle : new (z.Op,z.B) - L.EF = C.OB : radical_axis (C.OpB) - z.E,z.F = get_points(L.EF) - z.H = L.EF.mid - z.M = L.EF : point (.8) - _,L = C.OB : tangent_from (z.M) - _,z.T = get_points (L) - _,L = C.OpB : tangent_from (z.M) - _,z.Tp = get_points (L) -\end{tkzelements} -\begin{tikzpicture} - \tkzGetNodes - \tkzDrawCircles(O,B O',B) - \tkzDrawSegments(M,T M,T') - \tkzDrawSegments(E,F) - \tkzDrawLine[add=.3 and .3](O,H) - \tkzDrawPoints(O,O',B,E,H,M) - \tkzLabelPoints[below right](O,O',E,F,M,T,T') - \tkzDrawArc(M,B)(T) -\end{tikzpicture} -\end{Verbatim} - - -\begin{tkzelements} - z.O = point : new (0,0) - z.B = point : new (5,0) - z.Op = point : new (3,0) - C.OB = circle : new (z.O,z.B) - C.OpB = circle : new (z.Op,z.B) - L.EF = C.OB : radical_axis (C.OpB) - z.E,z.F = get_points(L.EF) - z.H = L.EF.mid - z.M = L.EF : point (.8) - _,L = C.OB : tangent_from (z.M) - _,z.T = get_points (L) - _,L = C.OpB : tangent_from (z.M) - _,z.Tp = get_points (L) -\end{tkzelements} -\hspace*{\fill} -\begin{tikzpicture} - \tkzGetNodes - \tkzDrawCircles(O,B O',B) - \tkzDrawSegments(M,T M,T') - \tkzDrawSegments(E,F) - \tkzDrawLine[add=.3 and .3](O,H) - \tkzDrawPoints(O,O',B,E,H,M) - \tkzLabelPoints[below right](O,O',E,F,M,T,T') - \tkzDrawArc(M,B)(T) -\end{tikzpicture} -\hspace*{\fill} -% subsection radical_axis_v4 (end) - -\subsection{Radical center} % (fold) -\label{sub:radical_center} -\begin{minipage}[t]{.5\textwidth}\vspace{0pt}% -\begin{Verbatim} -\begin{tkzelements} - z.O = point : new (0,0) - z.x = point : new (1,0) - z.y = point : new (4,0) - z.z = point : new (2,0) - z.Op = point : new (4,2) - z.P = point : new (2,2.5) - C.Ox = circle : new (z.O,z.x) - C.Pz = circle : new (z.P,z.z) - C.Opy = circle : new (z.Op,z.y) - z.ap,z.a = intersection (C.Ox,C.Pz) - z.bp,z.b = intersection (C.Opy,C.Pz) - L.aap = line : new (z.a,z.ap) - L.bbp = line : new (z.b,z.bp) - z.X = intersection (L.aap,L.bbp) --- or z.X = radical_center(C.Ox,C.Pz,C.Opy) - L.OOp = line : new (z.O,z.Op) - z.H = L.OOp : projection (z.X) -\end{tkzelements} -\begin{tikzpicture} - \tkzGetNodes - \tkzDrawCircles(O,a O',b P,z) - \tkzDrawLines[red](a,X b',X H,X O,O') - \tkzDrawPoints(O,O',P,a,a',b,b',X,H) - \tkzLabelPoints[below right](O,O',P,H) -\end{tikzpicture} -\end{Verbatim} -\end{minipage} -\begin{minipage}[t]{.5\textwidth}\vspace{0pt}% -\begin{tkzelements} -z.O = point : new (0,0) -z.x = point : new (1,0) -z.y = point : new (4,0) -z.z = point : new (2,0) -z.Op = point : new (4,2) -z.P = point : new (2,2.5) -C.Ox = circle : new (z.O,z.x) -C.Pz = circle : new (z.P,z.z) -C.Opy = circle : new (z.Op,z.y) -z.ap,z.a = intersection (C.Ox,C.Pz) -z.bp,z.b = intersection (C.Opy,C.Pz) -L.aap = line : new (z.a,z.ap) -L.bbp = line : new (z.b,z.bp) -z.X = intersection (L.aap,L.bbp) -L.OOp = line : new (z.O,z.Op) -z.H = L.OOp : projection (z.X) -\end{tkzelements} - -\hspace*{\fill} -\begin{tikzpicture} -\tkzGetNodes -\tkzDrawCircles(O,a O',b P,z) -\tkzDrawLines[red](a,X b',X H,X O,O') -\tkzDrawPoints(O,O',P,a,a',b,b',X,H) -\tkzLabelPoints[below right](O,O',P,H) -\end{tikzpicture} -\end{minipage} -% subsection radical_center (end) +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygon(A,B,C) + \tkzDrawLine[new](P,R) + \tkzDrawLines(P,B A,C B,C) + \tkzDrawPoints(P,Q,R,A,B,C) + \tkzLabelPoints(A,B,C,P,Q,R) + \end{tikzpicture} +\end{center} -\subsection{Radical circle} % (fold) -\label{sub:radical_circle} -\begin{minipage}[t]{.5\textwidth}\vspace{0pt}% -\begin{Verbatim} -\begin{tkzelements} - scale = .5 - z.A = point: new (0,0) - z.B = point: new (6,0) - z.C = point: new (0.8,4) - T.ABC = triangle : new ( z.A,z.B,z.C ) - C.exa = T.ABC : ex_circle () - z.I_a,z.Xa = get_points (C.exa) - C.exb = T.ABC : ex_circle (1) - z.I_b,z.Xb = get_points (C.exb) - C.exc = T.ABC : ex_circle (2) - z.I_c,z.Xc = get_points (C.exc) - C.ortho = C.exa : radical_circle (C.exb,C.exc) - z.w,z.a = get_points (C.ortho) -\end{tkzelements} -\begin{tikzpicture} - \tkzGetNodes - \tkzDrawPolygon(A,B,C) - \tkzDrawCircles(I_a,Xa I_b,Xb I_c,Xc) - \tkzDrawCircles[red,thick](w,a) - \tkzDrawPoints(A,B,C) - \tkzLabelPoints(A,B,C) -\end{tikzpicture} -\end{Verbatim} \end{minipage} +% subsection menelaus (end) -\begin{tkzelements} - scale = .5 - z.A = point: new (0,0) - z.B = point: new (6,0) - z.C = point: new (0.8,4) - T.ABC = triangle : new ( z.A,z.B,z.C ) - C.exa = T.ABC : ex_circle () - z.I_a,z.Xa = get_points (C.exa) - C.exb = T.ABC : ex_circle (1) - z.I_b,z.Xb = get_points (C.exb) - C.exc = T.ABC : ex_circle (2) - z.I_c,z.Xc = get_points (C.exc) - C.ortho = C.exa : radical_circle (C.exb,C.exc) - z.w,z.a = get_points (C.ortho) -\end{tkzelements} - -\hspace*{\fill} -\begin{tikzpicture} - \tkzGetNodes - \tkzDrawPolygon(A,B,C) - \tkzDrawCircles(I_a,Xa I_b,Xb I_c,Xc) - \tkzDrawCircles[red,thick](w,a) - \tkzDrawPoints(A,B,C) - \tkzLabelPoints(A,B,C) -\end{tikzpicture} -\hspace*{\fill} - -% subsection radical_circle (end) \subsection{Euler ellipse} % (fold) \label{sub:hexagram} -\begin{tkzelements} +\directlua{% +init_elements () scale =1.3 z.A = point: new (0 , 0) z.B = point: new (5 , 1) @@ -2089,11 +2182,12 @@ z.x = intersection (L.BC,L.XO) z.U = intersection (L.XO,E) _,z.V = intersection (L.YO,E) _,z.W = intersection (L.ZO,E) -\end{tkzelements} +} \begin{minipage}{.4\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = 1.3 z.A = point: new (0 , 0) z.B = point: new (5 , 1) @@ -2132,25 +2226,26 @@ _,z.W = intersection (L.ZO,E) z.U = intersection (L.XO,E) _,z.V = intersection (L.YO,E) _,z.W = intersection (L.ZO,E) -\end{tkzelements} +} \end{Verbatim} \end{minipage} \begin{minipage}{.6\textwidth} -\hspace*{\fill} -\begin{tikzpicture} -\tkzGetNodes -\tkzDrawPolygon(A,B,C) -\tkzDrawCircles[red](N,Ma O,A) -\tkzDrawSegments(A,X B,Y C,Z B,Hb C,Hc X,O Y,O Z,O) -\tkzDrawPolygon[red](U,V,W) -\tkzLabelPoints[red](U,V,W) -\tkzLabelPoints(A,B,C,X,Y,Z) -\tkzDrawLine[blue](I,J) -\tkzLabelPoints[blue,right](O,N,G,H,I,J) -\tkzDrawPoints(I,J,U,V,W) -\tkzDrawPoints(A,B,C,N,G,H,O,X,Y,Z,Ma,Mb,Mc,Ha,Hb,Hc) -\tkzDrawEllipse[blue](N,\tkzUseLua{a},\tkzUseLua{b},\tkzUseLua{ang}) -\end{tikzpicture} +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygon(A,B,C) + \tkzDrawCircles[red](N,Ma O,A) + \tkzDrawSegments(A,X B,Y C,Z B,Hb C,Hc X,O Y,O Z,O) + \tkzDrawPolygon[red](U,V,W) + \tkzLabelPoints[red](U,V,W) + \tkzLabelPoints(A,B,C,X,Y,Z) + \tkzDrawLine[blue](I,J) + \tkzLabelPoints[blue,right](O,N,G,H,I,J) + \tkzDrawPoints(I,J,U,V,W) + \tkzDrawPoints(A,B,C,N,G,H,O,X,Y,Z,Ma,Mb,Mc,Ha,Hb,Hc) + \tkzDrawEllipse[blue](N,\tkzUseLua{a},\tkzUseLua{b},\tkzUseLua{ang}) + \end{tikzpicture} +\end{center} \end{minipage} \begin{Verbatim} @@ -2165,8 +2260,8 @@ _,z.W = intersection (L.ZO,E) \tkzDrawLine[blue](I,J) \tkzLabelPoints[blue,right](O,N,G,H,I,J) \tkzDrawPoints(I,J,U,V,W) - \tkzDrawPoints(A,B,C,N,G,H,O,X,Y,Z,Ma,Mb,Mc,Ha,Hb,Hc) - \tkzDrawEllipse[blue](N,\tkzUseLua{a},\tkzUseLua{b},\tkzUseLua{ang}) + \tkzDrawPoints(A,B,C,N,G,H,O,X,Y,Z,Ma,Mb,Mc,Ha,Hb,Hc) + \tkzDrawEllipse[blue](N,\tkzUseLua{a},\tkzUseLua{b},\tkzUseLua{ang}) \end{tikzpicture} \end{Verbatim} @@ -2175,7 +2270,8 @@ _,z.W = intersection (L.ZO,E) \subsection{Gold Arbelos properties} % (fold) \label{sub:gold_arbelos_properties} -\begin{tkzelements} +\directlua{% +init_elements () scale = .7 z.A = point : new(0,0) z.B = point : new(10,0) @@ -2212,11 +2308,12 @@ z.R ,z.S = L.UV : projection (z.O_2,z.O_3) L.O1D = line : new (z.O_1,z.D) z.W = intersection (L.UV,L.O1D) z.O = C.DC : inversion (z.W) -\end{tkzelements} +} \begin{minipage}{.4\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new(0,0) z.B = point : new(10,0) z.C = gold_segment_ (z.A,z.B) @@ -2252,40 +2349,43 @@ z.O = C.DC : inversion (z.W) L.O1D = line : new (z.O_1,z.D) z.W = intersection (L.UV,L.O1D) z.O = C.DC : inversion (z.W) -\end{tkzelements} +} \end{Verbatim} \end{minipage} \begin{minipage}{.6\textwidth} -\hspace*{\fill} -\begin{tikzpicture} -\tkzGetNodes -\tkzDrawCircles[teal](O_1,B) -\tkzDrawSemiCircles[thin,teal](O_2,C O_3,B) -\tkzDrawArc[purple,delta=0](D,V)(U) -\tkzDrawCircle[new](O_7,C) -\tkzDrawSegments[thin,purple](A,D D,B C,R C,S C,D U,V) -\tkzDrawSegments[thin,red](O,D A,O O,B) -\tkzDrawPoints(A,B,C,D,O_7) %, -\tkzDrawPoints(O_1,O_2,O_3,U,V,R,S,W,O) -\tkzDrawSegments[cyan](O_3,S O_2,R) -\tkzDrawSegments[very thin](A,B) -\tkzDrawSegments[cyan,thin](C,U U,D) -\tkzMarkRightAngles[size=.2,fill=gray!40,opacity=.4](D,C,A A,D,B - D,S,C D,W,V O_3,S,U O_2,R,U) -\tkzFillAngles[cyan!40,opacity=.4](B,A,D A,D,O_1 - C,D,B D,C,R B,C,S A,R,O_2) -\tkzFillAngles[green!40,opacity=.4](S,C,D W,R,D - D,B,C R,C,A O_3,S,B) -\tkzLabelPoints[below](C,O_2,O_3,O_1) -\tkzLabelPoints[above](D) -\tkzLabelPoints[below](O) -\tkzLabelPoints[below left](A) -\tkzLabelPoints[above left](R) -\tkzLabelPoints[above right](S) -\tkzLabelPoints[left](V) -\tkzLabelPoints[below right](B,U,W,O_7) -\end{tikzpicture} -\hspace*{\fill} + +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircles[teal](O_1,B) + \tkzDrawSemiCircles[thin,teal](O_2,C O_3,B) + \tkzDrawArc[purple,delta=0](D,V)(U) + \tkzDrawCircle[new](O_7,C) + \tkzDrawSegments[thin,purple](A,D D,B C,R C,S C,D U,V) + \tkzDrawSegments[thin,red](O,D A,O O,B) + \tkzDrawPoints(A,B,C,D,O_7) %, + \tkzDrawPoints(O_1,O_2,O_3,U,V,R,S,W,O) + \tkzDrawSegments[cyan](O_3,S O_2,R) + \tkzDrawSegments[very thin](A,B) + \tkzDrawSegments[cyan,thin](C,U U,D) + \tkzMarkRightAngles[size=.2,fill=gray!40,opacity=.4](D,C,A A,D,B + D,S,C D,W,V O_3,S,U O_2,R,U) + \tkzFillAngles[cyan!40,opacity=.4](B,A,D A,D,O_1 + C,D,B D,C,R B,C,S A,R,O_2) + \tkzFillAngles[green!40,opacity=.4](S,C,D W,R,D + D,B,C R,C,A O_3,S,B) + \tkzLabelPoints[below](C,O_2,O_3,O_1) + \tkzLabelPoints[above](D) + \tkzLabelPoints[below](O) + \tkzLabelPoints[below left](A) + \tkzLabelPoints[above left](R) + \tkzLabelPoints[above right](S) + \tkzLabelPoints[left](V) + \tkzLabelPoints[below right](B,U,W,O_7) + \end{tikzpicture} +\end{center} + + \end{minipage} \begin{Verbatim} @@ -2323,7 +2423,8 @@ z.O = C.DC : inversion (z.W) \subsection{Apollonius circle v1 with inversion} % (fold) \label{sub:apollonius_circle_v1_with_inversion} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .7 z.A = point: new (0,0) z.B = point: new (6,0) @@ -2340,7 +2441,7 @@ z.O = C.DC : inversion (z.W) C.apo = C.ortho : inversion (C.euler) z.O = C.apo.center z.xa,z.xb,z.xc = C.ortho : inversion (z.Ea,z.Eb,z.Ec) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles[red](O,xa N,Ea) @@ -2360,7 +2461,8 @@ z.O = C.DC : inversion (z.W) \end{tikzpicture} \end{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .5 z.A = point: new (0,0) z.B = point: new (6,0) @@ -2377,33 +2479,36 @@ z.O = C.DC : inversion (z.W) C.apo = C.ortho : inversion (C.euler) z.O = C.apo.center z.xa,z.xb,z.xc = C.ortho : inversion (z.Ea,z.Eb,z.Ec) -\end{tkzelements} +} + +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircles[red](O,xa N,Ea) + \tkzFillCircles[green!30!black,opacity=.3](O,xa) + \tkzFillCircles[yellow!30,opacity=.7](Ja,Ea Jb,Eb Jc,Ec) + \tkzFillCircles[teal!30!black,opacity=.3](S,a) + \tkzFillCircles[green!30,opacity=.3](N,Ea) + \tkzDrawPoints[red](Ea,Eb,Ec,xa,xb,xc,N) + \tkzClipCircle(O,xa) + \tkzDrawLines[add=3 and 3](A,B A,C B,C) + \tkzDrawCircles(Ja,Ea Jb,Eb Jc,Ec) + \tkzFillCircles[lightgray!30,opacity=.7](Ja,Ea Jb,Eb Jc,Ec) + \tkzDrawCircles[teal](S,a) + \tkzDrawPoints(A,B,C,O) + \tkzDrawPoints[teal](S) + \tkzLabelPoints(A,B,C,O,S,N) + \end{tikzpicture} +\end{center} + -\hspace*{\fill} -\begin{tikzpicture} - \tkzGetNodes -\tkzDrawCircles[red](O,xa N,Ea) -\tkzFillCircles[green!30!black,opacity=.3](O,xa) -\tkzFillCircles[yellow!30,opacity=.7](Ja,Ea Jb,Eb Jc,Ec) -\tkzFillCircles[teal!30!black,opacity=.3](S,a) -\tkzFillCircles[green!30,opacity=.3](N,Ea) -\tkzDrawPoints[red](Ea,Eb,Ec,xa,xb,xc,N) -\tkzClipCircle(O,xa) -\tkzDrawLines[add=3 and 3](A,B A,C B,C) -\tkzDrawCircles(Ja,Ea Jb,Eb Jc,Ec) -\tkzFillCircles[lightgray!30,opacity=.7](Ja,Ea Jb,Eb Jc,Ec) -\tkzDrawCircles[teal](S,a) -\tkzDrawPoints(A,B,C,O) -\tkzDrawPoints[teal](S) -\tkzLabelPoints(A,B,C,O,S,N) -\end{tikzpicture} -\hspace*{\fill} % subsection apollonius_circle_v1_with_inversion (end) \subsection{Apollonius circle v2} % (fold) \label{sub:apollonius_circle_v2} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .5 z.A = point: new (0,0) z.B = point: new (6,0) @@ -2424,12 +2529,12 @@ z.O = C.DC : inversion (z.W) z.Jc,z.Xc = get_points (C.exC) L.OL = line: new (z.O,z.L) L.NS = line: new (z.N,z.S) - z.o = intersection (L.OL,L.NS) -- center of Apollonius circle + z.o = intersection (L.OL,L.NS) % center of Apollonius circle L.NMa = line: new (z.N,z.Ma) L.ox = L.NMa: ll_from (z.o) L.MaS = line: new (z.Ma,z.S) - z.t = intersection (L.ox,L.MaS) -- through -\end{tkzelements} + z.t = intersection (L.ox,L.MaS) % through +} \begin{tikzpicture} \tkzGetNodes @@ -2444,7 +2549,8 @@ z.O = C.DC : inversion (z.W) \end{tikzpicture} \end{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale =.5 z.A = point: new (0,0) z.B = point: new (6,0) @@ -2465,184 +2571,137 @@ C.exC = T.ABC : ex_circle (2) z.Jc,z.Xc = get_points (C.exC) L.OL = line: new (z.O,z.L) L.NS = line: new (z.N,z.S) -z.o = intersection (L.OL,L.NS) -- center of Apollonius circle +z.o = intersection (L.OL,L.NS) % center of Apollonius circle L.NMa = line: new (z.N,z.Ma) L.ox = L.NMa: ll_from (z.o) L.MaS = line: new (z.Ma,z.S) -z.t = intersection (L.ox,L.MaS) -- through -\end{tkzelements} - +z.t = intersection (L.ox,L.MaS) % through +} -\hspace*{\fill} -\begin{tikzpicture} -\tkzGetNodes -\tkzDrawLines[add=1 and 1](A,B A,C B,C) -\tkzDrawCircles(Ja,Xa Jb,Xb Jc,Xc o,t N,Ma) % -\tkzClipCircle(o,t) -\tkzDrawLines[red](o,L N,o Ma,t) -\tkzDrawLines[cyan,add=4 and 4](Ma,N o,t) -\tkzDrawPoints(A,B,C,Ma,Ja,Jb,Jc) -\tkzDrawPoints[red](N,O,L,S,o,t) -\tkzLabelPoints[right,font=\tiny](A,B,C,Ja,Jb,Jc,O,N,L,S,Ma,o) -\end{tikzpicture} -\hspace*{\fill} +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawLines[add=1 and 1](A,B A,C B,C) + \tkzDrawCircles(Ja,Xa Jb,Xb Jc,Xc o,t N,Ma) + \tkzClipCircle(o,t) + \tkzDrawLines[red](o,L N,o Ma,t) + \tkzDrawLines[cyan,add=4 and 4](Ma,N o,t) + \tkzDrawPoints(A,B,C,Ma,Ja,Jb,Jc) + \tkzDrawPoints[red](N,O,L,S,o,t) + \tkzLabelPoints[right,font=\tiny](A,B,C,Ja,Jb,Jc,O,N,L,S,Ma,o) + \end{tikzpicture} +\end{center} % subsection apollonius_circle_v2 (end) -\subsection{Orthogonal circles v1} % (fold) -\label{sub:orthogonal_circles_v1} -\begin{Verbatim} -\begin{tkzelements} - scale = .6 - z.C_1 = point: new (0,0) - z.C_2 = point: new (8,0) - z.A = point: new (5,0) - C = circle: new (z.C_1,z.A) - z.S,z.T = get_points (C: orthogonal_from (z.C_2)) -\end{tkzelements} -\begin{tikzpicture} - \tkzGetNodes - \tkzDrawCircles(C_1,T C_2,T) - \tkzDrawSegments(C_1,T C_2,T) - \tkzDrawLine(C_1,C_2) - \tkzMarkRightAngle[fill=teal,% - opacity=.2,size=1](C_1,T,C_2) - \tkzDrawPoints(C_1,C_2,T) - \tkzLabelPoints(C_1,C_2) - \tkzLabelPoints[above](T) - \tkzLabelSegment[left](C_1,T){r} - \tkzLabelSegments[right](C_2,T){$\gamma$} - \tkzLabelSegment[below](C_1,C_2){d} - \tkzLabelCircle[left=10pt](C_1,T)(180){Circle 1} - \tkzLabelCircle[right=10pt](C_2,T)(180){Circle 2} -\end{tikzpicture} -\end{Verbatim} +\subsection{Orthogonal circles} % (fold) +\label{sub:orthogonal_circles_v2} -\begin{tkzelements} -scale = .6 -z.C_1 = point: new (0,0) -z.C_2 = point: new (8,0) -z.A = point: new (5,0) -C = circle: new (z.C_1,z.A) -z.S,z.T = get_points (C: orthogonal_from (z.C_2)) -\end{tkzelements} +\begin{minipage}{.5\textwidth} + \begin{Verbatim} + \directlua{% + init_elements () + scale = .5 + z.O = point: new (2,2) + z.Op = point: new (-4,1) + z.P = point: polar (4,0) + C.OP = circle: new (z.O,z.P) + C.Oz1 = C.OP : orthogonal_from (z.Op) + z.z1 = C.Oz1.through + L.OP = line : new (z.O,z.P) + C.Opz1 = circle: new (z.Op,z.z1) + L.T,L.Tp = C.Opz1 : tangent_from (z.O) + z.T = L.T.pb + z.Tp = L.Tp.pb + L.OOp = line : new (z.O,z.Op) + z.M = L.OOp.mid + } + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircle[red](O,P) + \tkzDrawCircle[purple](O',z1) + \tkzDrawCircle[cyan](M,T) + \tkzDrawSegments(O',T O,T' O',T') + \tkzDrawSegment[purple](O',T) + \tkzDrawSegments[red](O,T O,O') + \tkzDrawPoints(O,O',T,T',M) + \tkzMarkRightAngle[fill=gray!10](O',T,O) + \tkzLabelPoint[below](O){$O$} + \tkzLabelPoint[above](T){$T$} + \tkzLabelPoint[above](M){$M$} + \tkzLabelPoint[below](T'){$T'$} + \tkzLabelPoint[above left](O'){$O'$} + \end{tikzpicture} + \end{Verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} + \directlua{% + init_elements () + scale = .5 + z.O = point: new (2,2) + z.Op = point: new (-4,1) + z.P = point: polar (4,0) + C.OP = circle: new (z.O,z.P) + C.Oz1 = C.OP : orthogonal_from (z.Op) + z.z1 = C.Oz1.through + L.OP = line : new (z.O,z.P) + C.Opz1 = circle: new (z.Op,z.z1) + L.T,L.Tp = C.Opz1 : tangent_from (z.O) + z.T = L.T.pb + z.Tp = L.Tp.pb + L.OOp = line : new (z.O,z.Op) + z.M = L.OOp.mid + } -\hspace*{\fill} -\begin{tikzpicture} -\tkzGetNodes -\tkzDrawCircles(C_1,T C_2,T) -\tkzDrawSegments(C_1,T C_2,T) -\tkzDrawLine(C_1,C_2) -\tkzMarkRightAngle[fill=teal,opacity=.2,size=.5](C_1,T,C_2) -\tkzDrawPoints(C_1,C_2,T) -\tkzLabelPoints(C_1,C_2) -\tkzLabelPoints[above](T) -\tkzLabelSegment[left](C_1,T){r} -\tkzLabelSegments[right](C_2,T){$\gamma$} -\tkzLabelSegment[below](C_1,C_2){d} -\tkzLabelCircle[left=10pt](C_1,T)(180){Circle 1} -\tkzLabelCircle[right=10pt](C_2,T)(180){Circle 2} -\end{tikzpicture} -\hspace*{\fill} -% subsection orthogonal_circles_v1 (end) + \begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircle[red](O,P) + \tkzDrawCircle[purple](O',z1) + \tkzDrawCircle[cyan](M,T) + \tkzDrawSegments(O',T O,T' O',T') + \tkzDrawSegment[purple](O',T) + \tkzDrawSegments[red](O,T O,O') + \tkzDrawPoints(O,O',T,T',M) + \tkzMarkRightAngle[fill=gray!10](O',T,O) + \tkzLabelPoint[below](O){$O$} + \tkzLabelPoint[above](T){$T$} + \tkzLabelPoint[above](M){$M$} + \tkzLabelPoint[below](T'){$T'$} + \tkzLabelPoint[above left](O'){$O'$} + \end{tikzpicture} + \end{center} +\end{minipage} -\subsection{Orthogonal circles v2} % (fold) -\label{sub:orthogonal_circles_v2} -\begin{Verbatim} -\begin{tkzelements} -scale = .75 -z.O = point: new (2,2) -z.Op = point: new (-4,1) -z.P = point: polar (4,0) -C.OP = circle: new (z.O,z.P) -C.Oz1 = C.OP : orthogonal_from (z.Op) -z.z1 = C.Oz1.through -L.OP = line : new (z.O,z.P) -C.Opz1 = circle: new (z.Op,z.z1) -L.T,L.Tp = C.Opz1 : tangent_from (z.O) -z.T = L.T.pb -z.Tp = L.Tp.pb -L.OOp = line : new (z.O,z.Op) -z.M = L.OOp.mid -\end{tkzelements} -\begin{tikzpicture} - \tkzGetNodes - \tkzDrawCircle[red](O,P) - \tkzDrawCircle[purple](O',z1) - \tkzDrawCircle[cyan](M,T) - \tkzDrawSegments(O',T O,T' O',T') - \tkzDrawSegment[purple](O',T) - \tkzDrawSegments[red](O,T O,O') - \tkzDrawPoints(O,O',T,T',M) - \tkzMarkRightAngle[fill=gray!10](O',T,O) - \tkzLabelPoint[below](O){$O$} - \tkzLabelPoint[above](T){$T$} - \tkzLabelPoint[above](M){$M$} - \tkzLabelPoint[below](T'){$T'$} - \tkzLabelPoint[above left](O'){$O'$} -\end{tikzpicture} -\end{Verbatim} -\begin{tkzelements} -scale = .75 -z.O = point: new (2,2) -z.Op = point: new (-4,1) -z.P = point: polar (4,0) -C.OP = circle: new (z.O,z.P) -C.Oz1 = C.OP : orthogonal_from (z.Op) -z.z1 = C.Oz1.through -L.OP = line : new (z.O,z.P) -C.Opz1 = circle: new (z.Op,z.z1) -L.T,L.Tp = C.Opz1 : tangent_from (z.O) -z.T = L.T.pb -z.Tp = L.Tp.pb -L.OOp = line : new (z.O,z.Op) -z.M = L.OOp.mid -\end{tkzelements} - -\hspace*{\fill} -\begin{tikzpicture} -\tkzGetNodes -\tkzDrawCircle[red](O,P) -\tkzDrawCircle[purple](O',z1) -\tkzDrawCircle[cyan](M,T) -\tkzDrawSegments(O',T O,T' O',T') -\tkzDrawSegment[purple](O',T) -\tkzDrawSegments[red](O,T O,O') -\tkzDrawPoints(O,O',T,T',M) -\tkzMarkRightAngle[fill=gray!10](O',T,O) -\tkzLabelPoint[below](O){$O$} -\tkzLabelPoint[above](T){$T$} -\tkzLabelPoint[above](M){$M$} -\tkzLabelPoint[below](T'){$T'$} -\tkzLabelPoint[above left](O'){$O'$} -\end{tikzpicture} -\hspace*{\fill} % subsection orthogonal_circles_v2 (end) % \subsection{Orthogonal circle to two circles} % (fold) \label{sub:orthogonal_circle_to_two_circles} +\begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} - z.O = point : new (-1,0) - z.B = point : new (0,2) - z.Op = point : new (4,-1) - z.D = point : new (4,0) - C.OB = circle : new (z.O,z.B) - C.OpD = circle : new (z.Op,z.D) - z.E,z.F = get_points (C.OB : radical_axis (C.OpD)) - L.EF = line : new (z.E,z.F) - z.M = L.EF : point (.25) - L.T,L.Tp = C.OB : tangent_from (z.M) - L.K,L.Kp = C.OpD : tangent_from (z.M) - z.T = L.T.pb - z.K = L.K.pb - z.Tp = L.Tp.pb - z.Kp = L.Kp.pb -\end{tkzelements} +\directlua{% +init_elements () +scale =.75 + z.O = point : new (-1,0) + z.B = point : new (0,2) + z.Op = point : new (4,-1) + z.D = point : new (4,0) + C.OB = circle : new (z.O,z.B) + C.OpD = circle : new (z.Op,z.D) + z.E,z.F = get_points (C.OB : radical_axis (C.OpD)) + L.EF = line : new (z.E,z.F) + z.M = L.EF : point (.25) + L.T,L.Tp = C.OB : tangent_from (z.M) + L.K,L.Kp = C.OpD : tangent_from (z.M) + z.T = L.T.pb + z.K = L.K.pb + z.Tp = L.Tp.pb + z.Kp = L.Kp.pb +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles(O,B O',D) @@ -2653,10 +2712,12 @@ z.M = L.OOp.mid \tkzDrawPoints(O,O',T,M,T',K,K') \tkzLabelPoints(O,O',T,T',M,K,K') \end{tikzpicture} -\end{Verbatim} - -\begin{tkzelements} - scale = 1.25 + \end{Verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} +\directlua{% +init_elements () + scale = .75 z.O = point : new (-1,0) z.B = point : new (0,2) z.Op = point : new (4,-1) @@ -2672,26 +2733,28 @@ z.T = L.T.pb z.K = L.K.pb z.Tp = L.Tp.pb z.Kp = L.Kp.pb -\end{tkzelements} +} +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircles(O,B O',D) + \tkzDrawLine[cyan](E,F) + \tkzDrawLines[add=.5 and .5,orange](O,O' O,T O,T') + \tkzDrawSegments[cyan](M,T M,T' M,K M,K') + \tkzDrawCircle(M,T) + \tkzDrawPoints(O,O',T,M,T',K,K') + \tkzLabelPoints(O,O',T,T',M,K,K') + \end{tikzpicture} +\end{center} +\end{minipage} -\hspace*{\fill} -\begin{tikzpicture} -\tkzGetNodes -\tkzDrawCircles(O,B O',D) -\tkzDrawLine[cyan](E,F) -\tkzDrawLines[add=.5 and .5,orange](O,O' O,T O,T') -\tkzDrawSegments[cyan](M,T M,T' M,K M,K') -\tkzDrawCircle(M,T) -\tkzDrawPoints(O,O',T,M,T',K,K') -\tkzLabelPoints(O,O',T,T',M,K,K') -\end{tikzpicture} -\hspace*{\fill} -% \subsection{Orthogonal to two circles} % (fold) +% subsection Orthogonal to two circles (fold) \subsection{Midcircles} % (fold) \label{sub:midcircles} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0 , 0) z.B = point: new (10 , 0) L.AB = line : new (z.A,z.B) @@ -2736,41 +2799,45 @@ _,z.G = intersection (L.AP0,C.O4P0) z.H = intersection (L.BP0,C.O4P0) z.Ap = z.M_1: symmetry (z.A) z.H_4,z.F,z.E,z.H_0 = L.AB : projection (z.O_4,z.G,z.H,z.P_0) -\end{tkzelements} +} + + +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircle[thin,fill=green!10](O_4,P_0) + \tkzDrawCircle[purple,fill=purple!10,opacity=.5](O_5,C) + \tkzDrawSemiCircles[teal](O_0,B) + \tkzDrawSemiCircles[thin,teal,fill=teal!20,opacity=.5](O_1,C O_2,B) + \tkzDrawSemiCircles[color = orange](M_2,B) + \tkzDrawSemiCircles[color = orange](M_1,A') + \tkzDrawArc[purple,delta=0](M_0,P_0)(C) + \tkzDrawSegments[very thin](A,B A,P B,Q) + \tkzDrawSegments[color=cyan](O_0,P_0 B,J G,J G,O_0 H,O_2) + \tkzDrawSegments[ultra thin,purple](M_1,P_0 M_2,P_0 M_1,M_0 M_0,P_1 M_0,P_0 M_1,J) + \tkzDrawPoints(A,B,C,P_0,P_2,P_1,M_0,M_1,M_2,J,P,Q,S) + \tkzDrawPoints(O_0,O_1,O_2,O_4,O_5,G,H) + \tkzMarkRightAngle[size=.2,fill=gray!20,opacity=.4](O_0,P_0,M_0) + \tkzLabelPoints[below](A,B,C,M_0,M_1,M_2,O_1,O_2,O_0) + \tkzLabelPoints[above](P_0,O_5,O_4) + \tkzLabelPoints[above](P_1,J) + \tkzLabelPoints[above](P_2,P,Q,S) + \tkzLabelPoints[above right](H,E) + \tkzLabelPoints[above left](F,G) + \tkzLabelPoints[below right](H_0) + \tkzLabelCircle[below=4pt,font=\scriptsize](O_1,C)(80){$(\beta)$} + \tkzLabelCircle[below=4pt,font=\scriptsize](O_2,B)(80){$(\gamma)$} + \tkzLabelCircle[below=4pt,font=\scriptsize](O_0,B)(110){$(\alpha)$} + \tkzLabelCircle[left,font=\scriptsize](O_4,P_2)(60){$(\delta)$} + \tkzLabelCircle[above left,font=\scriptsize](O_5,C)(40){$(\epsilon)$} + \end{tikzpicture} +\end{center} + -\hspace*{\fill} -\begin{tikzpicture} -\tkzGetNodes -\tkzDrawCircle[thin,fill=green!10](O_4,P_0) -\tkzDrawCircle[purple,fill=purple!10,opacity=.5](O_5,C) -\tkzDrawSemiCircles[teal](O_0,B) -\tkzDrawSemiCircles[thin,teal,fill=teal!20,opacity=.5](O_1,C O_2,B) -\tkzDrawSemiCircles[color = orange](M_2,B) -\tkzDrawSemiCircles[color = orange](M_1,A') -\tkzDrawArc[purple,delta=0](M_0,P_0)(C) -\tkzDrawSegments[very thin](A,B A,P B,Q) -\tkzDrawSegments[color=cyan](O_0,P_0 B,J G,J G,O_0 H,O_2) -\tkzDrawSegments[ultra thin,purple](M_1,P_0 M_2,P_0 M_1,M_0 M_0,P_1 M_0,P_0 M_1,J) -\tkzDrawPoints(A,B,C,P_0,P_2,P_1,M_0,M_1,M_2,J,P,Q,S) -\tkzDrawPoints(O_0,O_1,O_2,O_4,O_5,G,H) -\tkzMarkRightAngle[size=.2,fill=gray!20,opacity=.4](O_0,P_0,M_0) -\tkzLabelPoints[below](A,B,C,M_0,M_1,M_2,O_1,O_2,O_0) -\tkzLabelPoints[above](P_0,O_5,O_4) -\tkzLabelPoints[above](P_1,J) -\tkzLabelPoints[above](P_2,P,Q,S) -\tkzLabelPoints[above right](H,E) -\tkzLabelPoints[above left](F,G) -\tkzLabelPoints[below right](H_0) -\tkzLabelCircle[below=4pt,font=\scriptsize](O_1,C)(80){$(\beta)$} -\tkzLabelCircle[below=4pt,font=\scriptsize](O_2,B)(80){$(\gamma)$} -\tkzLabelCircle[below=4pt,font=\scriptsize](O_0,B)(110){$(\alpha)$} -\tkzLabelCircle[left,font=\scriptsize](O_4,P_2)(60){$(\delta)$} -\tkzLabelCircle[above left,font=\scriptsize](O_5,C)(40){$(\epsilon)$} -\end{tikzpicture} -\hspace*{\fill} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0 , 0) z.B = point: new (10 , 0) L.AB = line : new (z.A,z.B) @@ -2815,7 +2882,7 @@ z.H_4,z.F,z.E,z.H_0 = L.AB : projection (z.O_4,z.G,z.H,z.P_0) z.H = intersection (L.BP0,C.O4P0) z.Ap = z.M_1: symmetry (z.A) z.H_4,z.F,z.E,z.H_0 = L.AB : projection (z.O_4,z.G,z.H,z.P_0) -\end{tkzelements} +} \end{Verbatim} \begin{Verbatim} @@ -2855,7 +2922,8 @@ z.H_4,z.F,z.E,z.H_0 = L.AB : projection (z.O_4,z.G,z.H,z.P_0) \subsection{Pencil v1} % (fold) \label{sub:pencil_v1} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .75 z.A = point : new (0,2) z.B = point : new (0,-2) @@ -2870,20 +2938,11 @@ z.H_4,z.F,z.E,z.H_0 = L.AB : projection (z.O_4,z.G,z.H,z.P_0) z.x,z.y = get_points (C.C0A : orthogonal_from (z.M_0)) z.xp,z.yp = get_points (C.C0A : orthogonal_from (z.M_1)) z.O = L.BA.mid -\end{tkzelements} -\begin{tikzpicture} - \tkzGetNodes - \tkzDrawCircles(C_0,A C_1,A C_3,A C_5,A) - \tkzDrawCircles[thick,color=red](M_0,x M_1,x') - \tkzDrawCircles[thick,color=blue](O,A) - \tkzDrawLines(C_0,C_1 B,M_1) - \tkzDrawPoints(A,B,C_0,C_1,M_0,M_1,x,y) - \tkzLabelPoints[below right](A,B,C_0,C_1,M_0,M_1,x,y) - \tkzLabelLine[pos=1.25,right]( M_0,M_1){$(\Delta)$} -\end{tikzpicture} +} \end{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale=.75 z.A = point : new (0,2) z.B = point : new (0,-2) @@ -2898,26 +2957,41 @@ C.C0A = circle : new (z.C_0,z.A) z.x,z.y = get_points (C.C0A : orthogonal_from (z.M_0)) z.xp,z.yp = get_points (C.C0A : orthogonal_from (z.M_1)) z.O = L.BA.mid -\end{tkzelements} +} + +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircles(C_0,A C_1,A C_3,A C_5,A) + \tkzDrawCircles[thick,color=red](M_0,x M_1,x') + \tkzDrawCircles[thick,color=blue](O,A) + \tkzDrawLines(C_0,C_1 B,M_1) + \tkzDrawPoints(A,B,C_0,C_1,M_0,M_1,x,y) + \tkzLabelPoints[below right](A,B,C_0,C_1,M_0,M_1,x,y) + \tkzLabelLine[pos=1.25,right]( M_0,M_1){$(\Delta)$} + \end{tikzpicture} +\end{center} + +\begin{Verbatim} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircles(C_0,A C_1,A C_3,A C_5,A) + \tkzDrawCircles[thick,color=red](M_0,x M_1,x') + \tkzDrawCircles[thick,color=blue](O,A) + \tkzDrawLines(C_0,C_1 B,M_1) + \tkzDrawPoints(A,B,C_0,C_1,M_0,M_1,x,y) + \tkzLabelPoints[below right](A,B,C_0,C_1,M_0,M_1,x,y) + \tkzLabelLine[pos=1.25,right]( M_0,M_1){$(\Delta)$} + \end{tikzpicture} +\end{Verbatim} -\hspace*{\fill} -\begin{tikzpicture} -\tkzGetNodes -\tkzDrawCircles(C_0,A C_1,A C_3,A C_5,A) -\tkzDrawCircles[thick,color=red](M_0,x M_1,x') -\tkzDrawCircles[thick,color=blue](O,A) -\tkzDrawLines(C_0,C_1 B,M_1) -\tkzDrawPoints(A,B,C_0,C_1,M_0,M_1,x,y) -\tkzLabelPoints[below right](A,B,C_0,C_1,M_0,M_1,x,y) -\tkzLabelLine[pos=1.25,right]( M_0,M_1){$(\Delta)$} -\end{tikzpicture} -\hspace*{\fill} % subsection pencil_v1 (end) \subsection{Pencil v2} % (fold) \label{sub:pencil_v2} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale=.75 z.A = point : new (0,0) z.B = point : new (1,0) @@ -2935,19 +3009,11 @@ z.O = L.BA.mid z.u = C.orth0.through z.v = C.orth1.through z.t = C.orth2.through -\end{tkzelements} -\begin{tikzpicture} - \tkzGetNodes - \tkzDrawCircles(C_0,A C_1,B) - \tkzDrawCircles[thick,color=red](M_0,u M_1,v M_2,t) - \tkzDrawLines[add= .75 and .75](C_0,C_1 M_0,M_1) - \tkzDrawPoints(A,B,C_0,C_1,M_0,M_1,M_2) - \tkzLabelPoints[below right](A,B,C_0,C_1,M_0,M_1,M_2) - \tkzLabelLine[pos=2,right]( M_0,M_1){$(\Delta)$} -\end{tikzpicture} +} \end{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale=.75 z.A = point : new (0,0) z.B = point : new (1,0) @@ -2965,345 +3031,281 @@ z.O = L.BA.mid z.u = C.orth0.through z.v = C.orth1.through z.t = C.orth2.through -\end{tkzelements} +} -\hspace*{\fill} -\begin{tikzpicture} -\tkzGetNodes -\tkzDrawCircles(C_0,A C_1,B) -\tkzDrawCircles[thick,color=red](M_0,u M_1,v M_2,t) -\tkzDrawLines[add= .75 and .75](C_0,C_1 M_0,M_1) -\tkzDrawPoints(A,B,C_0,C_1,M_0,M_1,M_2) -\tkzLabelPoints[below right](A,B,C_0,C_1,M_0,M_1,M_2) -\tkzLabelLine[pos=2,right]( M_0,M_1){$(\Delta)$} -\end{tikzpicture} -\hspace*{\fill} -%subsection pencil_v2 (end) +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircles(C_0,A C_1,B) + \tkzDrawCircles[thick,color=red](M_0,u M_1,v M_2,t) + \tkzDrawLines[add= .75 and .75](C_0,C_1 M_0,M_1) + \tkzDrawPoints(A,B,C_0,C_1,M_0,M_1,M_2) + \tkzLabelPoints[below right](A,B,C_0,C_1,M_0,M_1,M_2) + \tkzLabelLine[pos=2,right]( M_0,M_1){$(\Delta)$} + \end{tikzpicture} +\end{center} -\subsection{Power v1} % (fold) -\label{sub:power_v1} -\begin{minipage}[t]{.5\textwidth}\vspace{0pt}% \begin{Verbatim} -\begin{tkzelements} - z.O = point : new (0,0) - z.A = point : new (2,-2) - z.M = point : new (-6,0) - L.AM = line : new (z.A,z.M) - C.OA = circle : new (z.O,z.A) - z.Ap = C.OA : antipode (z.A) - z.B = intersection (L.AM, C.OA) -\end{tkzelements} \begin{tikzpicture} \tkzGetNodes - \tkzDrawCircle(O,A) - \tkzMarkRightAngle[fill=gray!10](A',B,M) - \tkzDrawSegments(M,O A,A' A',B) - \tkzDrawPoints(O,A,A',M,B) - \tkzLabelPoints(O,A,A',M,B) - \tkzDrawSegments[-Triangle](M,A M,A') + \tkzDrawCircles(C_0,A C_1,B) + \tkzDrawCircles[thick,color=red](M_0,u M_1,v M_2,t) + \tkzDrawLines[add= .75 and .75](C_0,C_1 M_0,M_1) + \tkzDrawPoints(A,B,C_0,C_1,M_0,M_1,M_2) + \tkzLabelPoints[below right](A,B,C_0,C_1,M_0,M_1,M_2) + \tkzLabelLine[pos=2,right]( M_0,M_1){$(\Delta)$} \end{tikzpicture} \end{Verbatim} -\end{minipage} -\begin{minipage}[t]{.5\textwidth}\vspace{0pt}% -\begin{tkzelements} -scale = 1 -z.O = point : new (0,0) -z.A = point : new (2,-2) -z.M = point : new (-6,0) -L.AM = line : new (z.A,z.M) -C.OA = circle : new (z.O,z.A) -z.Ap = C.OA : antipode (z.A) -z.B = intersection (L.AM, C.OA) -\end{tkzelements} - -\hspace*{\fill} -\begin{tikzpicture} -\tkzGetNodes -\tkzDrawCircle(O,A) -\tkzMarkRightAngle[fill=gray!10](A',B,M) -\tkzDrawSegments(M,O A,A' A',B) -\tkzDrawPoints(O,A,A',M,B) -\tkzLabelPoints(O,A,A',M,B) -\tkzDrawSegments[-Triangle](M,A M,A') -\end{tikzpicture} -\end{minipage} -% subsection power_v1 (end) -\subsection{Power v2} % (fold) -\label{sub:power_v2} -\begin{minipage}[t]{.5\textwidth}\vspace{0pt}% -\begin{Verbatim} -\begin{tkzelements} - z.O = point : new (0,0) - z.A = point : new (2,2) - z.M = point : new (-1.5,0) - L.AM = line : new (z.A,z.M) - C.OA = circle : new (z.O,z.A) - z.Ap = C.OA : antipode (z.A) - _,z.B = intersection (L.AM, C.OA) - z.m = z.M : north(1) - L.mM = line : new (z.m,z.M) - z.U,z.V = intersection (L.mM,C.OA) -\end{tkzelements} -\begin{tikzpicture} - \tkzGetNodes - \tkzDrawCircle(O,A) - \tkzMarkRightAngle[fill=gray!10](A',B,M) - \tkzDrawSegments(M,O A,A' A',B A,B U,V) - \tkzDrawPoints(O,A,A',M,B,U,V,m) - \tkzLabelPoints(O,A,M,U,V,m) - \tkzLabelPoints[below left](A',B) - \tkzDrawSegments(M,A M,A') -\end{tikzpicture} -\end{Verbatim} -\end{minipage} -\begin{minipage}[t]{.5\textwidth}\vspace{0pt}% -\begin{tkzelements} -scale = 1 -z.O = point : new (0,0) -z.A = point : new (2,2) -z.M = point : new (-1.5,0) -L.AM = line : new (z.A,z.M) -C.OA = circle : new (z.O,z.A) -z.Ap = C.OA : antipode (z.A) -_,z.B = intersection (L.AM, C.OA) -z.m = z.M : north(1) -L.mM = line : new (z.m,z.M) -z.U,z.V = intersection (L.mM,C.OA) -\end{tkzelements} - -\hspace*{\fill}\begin{tikzpicture} -\tkzGetNodes -\tkzDrawCircle(O,A) -\tkzMarkRightAngle[fill=gray!10](A',B,M) -\tkzDrawSegments(M,O A,A' A',B A,B U,V) -\tkzDrawPoints(O,A,A',M,B,U,V,m) -\tkzLabelPoints(O,A,M,U,V,m) -\tkzLabelPoints[below left](A',B) -\tkzDrawSegments(M,A M,A') -\end{tikzpicture} -\end{minipage} -% subsection power_v2 (end) +%subsection pencil_v2 (end) + \subsection{Reim v1} % (fold) \label{sub:reim_v1} + +\begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} - z.A = point: new (0,0) - z.E = point: new (-2,2) - C.AE = circle : new (z.A,z.E) - z.C = C.AE : point (0.65) - z.D = C.AE : point (0.5) - z.F = C.AE : point (0.30) - L.EC = line: new (z.E,z.C) - z.H = L.EC : point (1.5) - T.CDH = triangle : new (z.C,z.D,z.H) - z.B = T.CDH.circumcenter - C.BD = circle : new (z.B,z.D) - L.FD = line: new (z.F,z.D) - z.G = intersection (L.FD,C.BD) - z.O = intersection (L.EC,L.FD) -\end{tkzelements} +\directlua{% +init_elements () + z.A = point: new (0,0) + z.E = point: new (-2,2) + C.AE = circle : new (z.A,z.E) + z.C = C.AE : point (0.65) + z.D = C.AE : point (0.5) + z.F = C.AE : point (0.30) + L.EC = line: new (z.E,z.C) + z.H = L.EC : point (1.5) + T.CDH = triangle : new (z.C,z.D,z.H) + z.B = T.CDH.circumcenter + C.BD = circle : new (z.B,z.D) + L.FD = line: new (z.F,z.D) + z.G = intersection (L.FD,C.BD) + z.O = intersection (L.EC,L.FD) +} \begin{tikzpicture} - \tkzGetNodes - \tkzDrawCircles(A,E B,H) - \tkzDrawSegments(E,D C,F) - \tkzDrawLines(E,O F,O) - \tkzDrawLines[red](E,F H,G) - \tkzDrawPoints(A,...,H,O) - \tkzLabelPoints(A,B,D,F,G,O) - \tkzLabelPoints[above](E,C,H) - \tkzMarkAngles[size=.5](E,C,F E,D,F) - \tkzFillAngles[green!40,opacity=.4,size=.5](E,C,F E,D,F) - \tkzMarkAngles[size=.5](F,C,H G,D,E) - \tkzFillAngles[red!40,opacity=.4,size=.5](F,C,H G,D,E) + \tkzGetNodes + \tkzDrawCircles(A,E B,H) + \tkzDrawSegments(E,D C,F) + \tkzDrawLines(E,O F,O) + \tkzDrawLines[red](E,F H,G) + \tkzDrawPoints(A,...,H,O) + \tkzLabelPoints(A,B,D,F,G,O) + \tkzLabelPoints[above](E,C,H) + \tkzMarkAngles[size=.5](E,C,F E,D,F) + \tkzFillAngles[green!40,opacity=.4,size=.5](E,C,F E,D,F) + \tkzMarkAngles[size=.5](F,C,H G,D,E) + \tkzFillAngles[red!40,opacity=.4,size=.5](F,C,H G,D,E) \end{tikzpicture} \end{Verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} + \directlua{% + init_elements () + scale = .5 + z.A = point: new (0,0) + z.E = point: new (-2,2) + C.AE = circle : new (z.A,z.E) + z.C = C.AE : point (0.65) + z.D = C.AE : point (0.5) + z.F = C.AE : point (0.30) + L.EC = line: new (z.E,z.C) + z.H = L.EC : point (1.5) + T.CDH = triangle : new (z.C,z.D,z.H) + z.B = T.CDH.circumcenter + C.BD = circle : new (z.B,z.D) + L.FD = line: new (z.F,z.D) + z.G = intersection (L.FD,C.BD) + z.O = intersection (L.EC,L.FD) + } + \begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircles(A,E B,H) + \tkzDrawSegments(E,D C,F) + \tkzDrawLines(E,O F,O) + \tkzDrawLines[red](E,F H,G) + \tkzDrawPoints(A,...,H,O) + \tkzLabelPoints(A,B,D,F,G,O) + \tkzLabelPoints[above](E,C,H) + \tkzMarkAngles[size=.5](E,C,F E,D,F) + \tkzFillAngles[green!40,opacity=.4,size=.5](E,C,F E,D,F) + \tkzMarkAngles[size=.5](F,C,H G,D,E) + \tkzFillAngles[red!40,opacity=.4,size=.5](F,C,H G,D,E) + \end{tikzpicture} + \end{center} +\end{minipage} + + -\begin{tkzelements} - z.A = point: new (0,0) - z.E = point: new (-2,2) - C.AE = circle : new (z.A,z.E) - z.C = C.AE : point (0.65) - z.D = C.AE : point (0.5) - z.F = C.AE : point (0.30) - L.EC = line: new (z.E,z.C) - z.H = L.EC : point (1.5) - T.CDH = triangle : new (z.C,z.D,z.H) - z.B = T.CDH.circumcenter - C.BD = circle : new (z.B,z.D) - L.FD = line: new (z.F,z.D) - z.G = intersection (L.FD,C.BD) - z.O = intersection (L.EC,L.FD) -\end{tkzelements} - -\hspace*{\fill} -\begin{tikzpicture} -\tkzGetNodes -\tkzDrawCircles(A,E B,H) -\tkzDrawSegments(E,D C,F) -\tkzDrawLines(E,O F,O) -\tkzDrawLines[red](E,F H,G) -\tkzDrawPoints(A,...,H,O) -\tkzLabelPoints(A,B,D,F,G,O) -\tkzLabelPoints[above](E,C,H) -\tkzMarkAngles[size=.5](E,C,F E,D,F) -\tkzFillAngles[green!40,opacity=.4,size=.5](E,C,F E,D,F) -\tkzMarkAngles[size=.5](F,C,H G,D,E) -\tkzFillAngles[red!40,opacity=.4,size=.5](F,C,H G,D,E) -\end{tikzpicture} -\hspace*{\fill} % subsection reim_v1 (end) \subsection{Reim v2} % (fold) \label{sub:reim_v2} + +\begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} - scale = .6 - z.A = point: new (0,0) - z.B = point: new (10,0) - z.C = point: new (4,0) - C.AC = circle: new (z.A,z.C) - z.c,z.cp = get_points (C.AC: tangent_at (z.C)) - z.M = C.AC: point (0.6) - L.MC = line: new (z.M,z.C) - C.BC = circle: new (z.B,z.C) - z.N = intersection (L.MC,C.BC) - z.m,z.mp = get_points (C.AC: tangent_at (z.M)) - z.n,z.np = get_points (C.BC: tangent_at (z.N)) -\end{tkzelements} -\begin{tikzpicture} - \tkzGetNodes - \tkzDrawCircles(A,C B,C) - \tkzDrawLines[new,add=1 and 1](M,m N,n C,c) - \tkzDrawSegment(M,N) - \tkzDrawPoints(A,B,C,M,N) - \tkzLabelPoints[below right](A,B,C,M,N) - \tkzFillAngles[blue!30,opacity=.3](m',M,C N,C,c' M,C,c n',N,C) - \tkzLabelCircle[below=4pt,font=\scriptsize](A,C)(90){$(\alpha)$} - \tkzLabelCircle[left=4pt,font=\scriptsize](B,C)(-90){$(\beta)$} -\end{tikzpicture} +\directlua{% +init_elements () + scale = .4 + z.A = point: new (0,0) + z.B = point: new (10,0) + z.C = point: new (4,0) + C.AC = circle: new (z.A,z.C) + z.c,z.cp = get_points (C.AC: tangent_at (z.C)) + z.M = C.AC: point (0.6) + L.MC = line: new (z.M,z.C) + C.BC = circle: new (z.B,z.C) + z.N = intersection (L.MC,C.BC) + z.m,z.mp = get_points (C.AC: tangent_at (z.M)) + z.n,z.np = get_points (C.BC: tangent_at (z.N)) +} + \end{Verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} + \directlua{% + init_elements () + scale = .25 + z.A = point: new (0,0) + z.B = point: new (10,0) + z.C = point: new (4,0) + C.AC = circle: new (z.A,z.C) + z.c,z.cp = get_points (C.AC: tangent_at (z.C)) + z.M = C.AC: point (0.6) + L.MC = line: new (z.M,z.C) + C.BC = circle: new (z.B,z.C) + z.N = intersection (L.MC,C.BC) + z.m,z.mp = get_points (C.AC: tangent_at (z.M)) + z.n,z.np = get_points (C.BC: tangent_at (z.N)) + } + + \begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircles(A,C B,C) + \tkzDrawLines[new,add=1 and 1](M,m N,n C,c) + \tkzDrawSegment(M,N) + \tkzDrawPoints(A,B,C,M,N) + \tkzLabelPoints[below right](A,B,C,M,N) + \tkzFillAngles[blue!30,opacity=.3](m',M,C N,C,c' M,C,c n',N,C) + \tkzLabelCircle[below=4pt,font=\scriptsize](A,C)(90){$(\alpha)$} + \tkzLabelCircle[left=4pt,font=\scriptsize](B,C)(-90){$(\beta)$} + \end{tikzpicture} + \end{center} +\end{minipage} + + +\begin{Verbatim} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircles(A,C B,C) + \tkzDrawLines[new,add=1 and 1](M,m N,n C,c) + \tkzDrawSegment(M,N) + \tkzDrawPoints(A,B,C,M,N) + \tkzLabelPoints[below right](A,B,C,M,N) + \tkzFillAngles[blue!30,opacity=.3](m',M,C N,C,c' M,C,c n',N,C) + \tkzLabelCircle[below=4pt,font=\scriptsize](A,C)(90){$(\alpha)$} + \tkzLabelCircle[left=4pt,font=\scriptsize](B,C)(-90){$(\beta)$} + \end{tikzpicture} \end{Verbatim} -\begin{tkzelements} -scale = .4 -z.A = point: new (0,0) -z.B = point: new (10,0) -z.C = point: new (4,0) -C.AC = circle: new (z.A,z.C) -z.c,z.cp = get_points (C.AC: tangent_at (z.C)) -z.M = C.AC: point (0.6) -L.MC = line: new (z.M,z.C) -C.BC = circle: new (z.B,z.C) -z.N = intersection (L.MC,C.BC) -z.m,z.mp = get_points (C.AC: tangent_at (z.M)) -z.n,z.np = get_points (C.BC: tangent_at (z.N)) -\end{tkzelements} - -\hspace*{\fill} -\begin{tikzpicture} -\tkzGetNodes -\tkzDrawCircles(A,C B,C) -\tkzDrawLines[new,add=1 and 1](M,m N,n C,c) -\tkzDrawSegment(M,N) -\tkzDrawPoints(A,B,C,M,N) -\tkzLabelPoints[below right](A,B,C,M,N) -\tkzFillAngles[blue!30,opacity=.3](m',M,C N,C,c' M,C,c n',N,C) -\tkzLabelCircle[below=4pt,font=\scriptsize](A,C)(90){$(\alpha)$} -\tkzLabelCircle[left=4pt,font=\scriptsize](B,C)(-90){$(\beta)$} -\end{tikzpicture} -\hspace*{\fill} % subsection reim_v2 (end) \subsection{Reim v3} % (fold) \label{sub:reim_v3} -\begin{Verbatim} -\begin{tkzelements} - z.A = point: new (0,0) - z.B = point: new (8,0) - z.C = point: new (2,6) - L.AB = line : new (z.A,z.B) - L.AC = line : new (z.A,z.C) - L.BC = line : new (z.B,z.C) - z.I = L.BC : point (0.75) - z.J = L.AC : point (0.4) - z.K = L.AB : point (0.5) - T.AKJ = triangle : new (z.A,z.K,z.J) - T.BIK = triangle : new (z.B,z.I,z.K) - T.CIJ = triangle : new (z.C,z.I,z.J) - z.x = T.AKJ.circumcenter - z.y = T.BIK.circumcenter - z.z = T.CIJ.circumcenter - C.xK = circle: new (z.x,z.K) - C.yK = circle: new (z.y,z.K) - z.O,_ = intersection (C.xK,C.yK) - C.zO = circle: new (z.z,z.O) - L.KO = line: new (z.K,z.O) - z.D = intersection (L.KO,C.zO) -\end{tkzelements} -\begin{tikzpicture} - \tkzGetNodes - \tkzDrawSegments(K,D D,C) - \tkzDrawPolygon[teal](A,B,C) - \tkzDrawCircles[orange](x,A y,B z,C) - \tkzDrawPoints[fill=white](A,B,C,I,J,K,D) - \tkzLabelPoints[below](A,B,J,K,O) - \tkzLabelPoints[above](C,D,I) - \tkzDrawPoints[fill=black](O) - \tkzLabelCircle[below=4pt,font=\scriptsize](x,A)(20){$(\alpha)$} - \tkzLabelCircle[left=4pt,font=\scriptsize](y,B)(60){$(\beta)$} - \tkzLabelCircle[below=4pt,font=\scriptsize](z,C)(60){$(\gamma)$} -\end{tikzpicture} -\end{Verbatim} +\begin{minipage}{.5\textwidth} + \begin{Verbatim} + \directlua{% + init_elements () + z.A = point: new (0,0) + z.B = point: new (8,0) + z.C = point: new (2,6) + L.AB = line : new (z.A,z.B) + L.AC = line : new (z.A,z.C) + L.BC = line : new (z.B,z.C) + z.I = L.BC : point (0.75) + z.J = L.AC : point (0.4) + z.K = L.AB : point (0.5) + T.AKJ = triangle : new (z.A,z.K,z.J) + T.BIK = triangle : new (z.B,z.I,z.K) + T.CIJ = triangle : new (z.C,z.I,z.J) + z.x = T.AKJ.circumcenter + z.y = T.BIK.circumcenter + z.z = T.CIJ.circumcenter + C.xK = circle: new (z.x,z.K) + C.yK = circle: new (z.y,z.K) + z.O,_ = intersection (C.xK,C.yK) + C.zO = circle: new (z.z,z.O) + L.KO = line: new (z.K,z.O) + z.D = intersection (L.KO,C.zO) + } + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawSegments(K,D D,C) + \tkzDrawPolygon[teal](A,B,C) + \tkzDrawCircles[orange](x,A y,B z,C) + \tkzDrawPoints[fill=white](A,B,C,I,J,K,D) + \tkzLabelPoints[below](A,B,J,K,O) + \tkzLabelPoints[above](C,D,I) + \tkzDrawPoints[fill=black](O) + \tkzLabelCircle[below=4pt,font=\scriptsize](x,A)(20){$(\alpha)$} + \tkzLabelCircle[left=4pt,font=\scriptsize](y,B)(60){$(\beta)$} + \tkzLabelCircle[below=4pt,font=\scriptsize](z,C)(60){$(\gamma)$} + \end{tikzpicture} + \end{Verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} + \directlua{% + init_elements () + scale = .75 + z.A = point: new (0,0) + z.B = point: new (8,0) + z.C = point: new (2,6) + L.AB = line : new (z.A,z.B) + L.AC = line : new (z.A,z.C) + L.BC = line : new (z.B,z.C) + z.I = L.BC : point (0.75) + z.J = L.AC : point (0.4) + z.K = L.AB : point (0.5) + T.AKJ = triangle : new (z.A,z.K,z.J) + T.BIK = triangle : new (z.B,z.I,z.K) + T.CIJ = triangle : new (z.C,z.I,z.J) + z.x = T.AKJ.circumcenter + z.y = T.BIK.circumcenter + z.z = T.CIJ.circumcenter + C.xK = circle: new (z.x,z.K) + C.yK = circle: new (z.y,z.K) + z.O,_ = intersection (C.xK,C.yK) + C.zO = circle: new (z.z,z.O) + L.KO = line: new (z.K,z.O) + z.D = intersection (L.KO,C.zO) + } + \begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawSegments(K,D D,C) + \tkzDrawPolygon[teal](A,B,C) + \tkzDrawCircles[orange](x,A y,B z,C) + \tkzDrawPoints[fill=white](A,B,C,I,J,K,D) + \tkzLabelPoints[below](A,B,J,K,O) + \tkzLabelPoints[above](C,D,I) + \tkzDrawPoints[fill=black](O) + \tkzLabelCircle[below=4pt,font=\scriptsize](x,A)(20){$(\alpha)$} + \tkzLabelCircle[left=4pt,font=\scriptsize](y,B)(60){$(\beta)$} + \tkzLabelCircle[below=4pt,font=\scriptsize](z,C)(60){$(\gamma)$} + \end{tikzpicture} + \end{center} +\end{minipage} -\begin{tkzelements} - scale = .75 - z.A = point: new (0,0) - z.B = point: new (8,0) - z.C = point: new (2,6) - L.AB = line : new (z.A,z.B) - L.AC = line : new (z.A,z.C) - L.BC = line : new (z.B,z.C) - z.I = L.BC : point (0.75) - z.J = L.AC : point (0.4) - z.K = L.AB : point (0.5) - T.AKJ = triangle : new (z.A,z.K,z.J) - T.BIK = triangle : new (z.B,z.I,z.K) - T.CIJ = triangle : new (z.C,z.I,z.J) - z.x = T.AKJ.circumcenter - z.y = T.BIK.circumcenter - z.z = T.CIJ.circumcenter - C.xK = circle: new (z.x,z.K) - C.yK = circle: new (z.y,z.K) - z.O,_ = intersection (C.xK,C.yK) - C.zO = circle: new (z.z,z.O) - L.KO = line: new (z.K,z.O) - z.D = intersection (L.KO,C.zO) -\end{tkzelements} - -\hspace*{\fill} -\begin{tikzpicture} -\tkzGetNodes -\tkzDrawSegments(K,D D,C) -\tkzDrawPolygon[teal](A,B,C) -\tkzDrawCircles[orange](x,A y,B z,C) -\tkzDrawPoints[fill=white](A,B,C,I,J,K,D) -\tkzLabelPoints[below](A,B,J,K,O) -\tkzLabelPoints[above](C,D,I) -\tkzDrawPoints[fill=black](O) -\tkzLabelCircle[below=4pt,font=\scriptsize](x,A)(20){$(\alpha)$} -\tkzLabelCircle[left=4pt,font=\scriptsize](y,B)(60){$(\beta)$} -\tkzLabelCircle[below=4pt,font=\scriptsize](z,C)(60){$(\gamma)$} -\end{tikzpicture} -\hspace*{\fill} % subsection reim_v3 (end) \subsection{Tangent and circle} % (fold) \label{sub:tangent_and_circle} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () +scale = .75 z.A = point: new (1,0) z.B = point: new (2,2) z.E = point: new (5,-4) @@ -3315,7 +3317,7 @@ z.n,z.np = get_points (C.BC: tangent_at (z.N)) z.i = L.Ti.pb z.j = L.Tj.pb z.k,z.l = get_points (C.AB: tangent_at (z.B)) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles(A,B M,A) @@ -3326,7 +3328,9 @@ z.n,z.np = get_points (C.BC: tangent_at (z.N)) \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () +scale = .75 z.A = point: new (1,0) z.B = point: new (2,2) z.E = point: new (5,-4) @@ -3338,15 +3342,18 @@ L.Ti,L.Tj = C.AB: tangent_from (z.E) z.i = L.Ti.pb z.j = L.Tj.pb z.k,z.l = get_points (C.AB: tangent_at (z.B)) -\end{tkzelements} -\hspace*{\fill} -\begin{tikzpicture} -\tkzGetNodes -\tkzDrawCircles(A,B M,A) -\tkzDrawPoints(A,B,E,i,j,M,S) -\tkzDrawLines(E,i E,j k,l) -\tkzLabelPoints[right,font=\small](A,B,E,S,M) -\end{tikzpicture} +} + +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircles(A,B M,A) + \tkzDrawPoints(A,B,E,i,j,M,S) + \tkzDrawLines(E,i E,j k,l) + \tkzLabelPoints[right,font=\small](A,B,E,S,M) + \end{tikzpicture} +\end{center} + \end{minipage} % subsection tangent_and_circle (end) @@ -3354,12 +3361,14 @@ z.k,z.l = get_points (C.AB: tangent_at (z.B)) \label{sub:homothety} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () +scale = .5 z.A = point: new (0,0) z.B = point: new (1,2) z.E = point: new (-3,2) z.C,z.D = z.E : homothety(2,z.A,z.B) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPoints(A,B,C,E,D) @@ -3370,20 +3379,24 @@ z.k,z.l = get_points (C.AB: tangent_at (z.B)) \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} -scale = .6 +\directlua{% +init_elements () +scale = .5 z.A = point: new (0,0) z.B = point: new (1,2) z.E = point: new (-3,2) z.C,z.D = z.E : homothety(2,z.A,z.B) -\end{tkzelements} -\hspace*{\fill}\begin{tikzpicture} -\tkzGetNodes -\tkzDrawPoints(A,B,C,E,D) -\tkzLabelPoints(A,B,C,E) -\tkzDrawCircles(A,B C,D) -\tkzDrawLines(E,C E,D) -\end{tikzpicture} +} +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawPoints(A,B,C,E,D) + \tkzLabelPoints(A,B,C,E) + \tkzDrawCircles(A,B C,D) + \tkzDrawLines(E,C E,D) + \end{tikzpicture} +\end{center} + \end{minipage} % subsection homothety (end) @@ -3391,21 +3404,22 @@ z.C,z.D = z.E : homothety(2,z.A,z.B) \label{sub:tangent_and_chord} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} - scale = .8 - z.A = point: new (0 , 0) - z.B = point: new (6 , 0) - z.C = point: new (1 , 5) - z.Bp = point: new (2 , 0) - T.ABC = triangle: new (z.A,z.B,z.C) - L.AB = line: new (z.A,z.B) - z.O = T.ABC.circumcenter - C.OA = circle: new (z.O,z.A) - z.D = C.OA: point (4.5) - L.AO = line: new (z.A,z.O) - z.b1,z.b2 = get_points (C.OA: tangent_at (z.B)) - z.H = L.AB: projection (z.O) -\end{tkzelements} +\directlua{% +init_elements () + scale = .75 + z.A = point: new (0 , 0) + z.B = point: new (6 , 0) + z.C = point: new (1 , 5) + z.Bp = point: new (2 , 0) + T.ABC = triangle: new (z.A,z.B,z.C) + L.AB = line: new (z.A,z.B) + z.O = T.ABC.circumcenter + C.OA = circle: new (z.O,z.A) + z.D = C.OA: point (4.5) + L.AO = line: new (z.A,z.O) + z.b1,z.b2 = get_points(C.OA: tangent_at(z.B)) + z.H = L.AB: projection (z.O) +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircle(O,A) @@ -3420,8 +3434,9 @@ z.C,z.D = z.E : homothety(2,z.A,z.B) \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} -scale = 0.75 +\directlua{% +init_elements () +scale = 0.75 z.A = point: new (0 , 0) z.B = point: new (6 , 0) z.C = point: new (1 , 5) @@ -3432,22 +3447,23 @@ z.O = T.ABC.circumcenter C.OA = circle: new (z.O,z.A) z.D = C.OA: point (4.5) L.AO = line: new (z.A,z.O) -z.b1,z.b2 = get_points (C.OA: tangent_at (z.B)) +z.b1,z.b2 = get_points (C.OA: tangent_at (z.B)) z.H = L.AB: projection (z.O) -\end{tkzelements} +} +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircle(O,A) + \tkzDrawPolygon(A,B,C) + \tkzDrawSegments[new](A,O B,O O,H A,D D,B) + \tkzDrawSegment(b1,b2) + \tkzDrawPoints(A,B,C,D,H,O) + \tkzFillAngles[green!20,opacity=.3](H,O,B A,C,B A,B,b1) + \tkzFillAngles[teal!20,opacity=.3](A,D,B b2,B,A) + \tkzLabelPoints(A,B,C,D,H,O) + \end{tikzpicture} +\end{center} -\hspace*{\fill} -\begin{tikzpicture} -\tkzGetNodes -\tkzDrawCircle(O,A) -\tkzDrawPolygon(A,B,C) -\tkzDrawSegments[new](A,O B,O O,H A,D D,B) -\tkzDrawLine(b1,b2) -\tkzDrawPoints(A,B,C,D,H,O) -\tkzFillAngles[green!20,opacity=.3](H,O,B A,C,B A,B,b1) -\tkzFillAngles[teal!20,opacity=.3](A,D,B b2,B,A) -\tkzLabelPoints(A,B,C,D,H,O) -\end{tikzpicture} \end{minipage} % subsection tangent_and_chord (end) @@ -3455,8 +3471,8 @@ z.H = L.AB: projection (z.O) \subsection{Three chords} % (fold) \label{sub:three_chords} -\begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.O = point: new (0 , 0) z.B = point: new (0 , 2) z.P = point: new (1 , -.5) @@ -3484,11 +3500,12 @@ C.xD = circle : new (z.x,z.D) z.Ap = intersection (L.GB,C.xB) z.Ep,_ = intersection (L.GE,C.xF) z.Cp,_ = intersection (L.GD,C.xD) -\end{tkzelements} -\end{Verbatim} +} - -\begin{tkzelements} +\begin{minipage}{.5\textwidth} +\begin{Verbatim} +\directlua{% +init_elements () z.O = point: new (0 , 0) z.B = point: new (0 , 2) z.P = point: new (1 , -.5) @@ -3516,9 +3533,32 @@ C.xD = circle : new (z.x,z.D) z.Ap = intersection (L.GB,C.xB) z.Ep,_ = intersection (L.GE,C.xF) z.Cp,_ = intersection (L.GD,C.xD) -\end{tkzelements} +} +\end{Verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} +\begin{center} + \begin{tikzpicture}[scale=.75] + \tkzGetNodes + \tkzDrawCircles(O,B) + \tkzDrawCircles[cyan](P,B) + \tkzDrawCircles[red](w,E) + \tkzDrawCircles[new](x,F) + \tkzDrawSegments(A,G E,G C,G) + \tkzDrawPolygons[new](A,E,C A',E',C') + \tkzDrawPoints(A,...,G,A',E',C',O,P) + \begin{scope}[font=\scriptsize] + \tkzLabelPoints(A,...,F) + \tkzLabelPoints[above left](G,A',E',C') + \tkzLabelCircle[left](O,B)(30){$(\beta)$} + \tkzLabelCircle[below](P,A)(40){$(\gamma)$} + \tkzLabelCircle[right](w,C)(90){$(\alpha)$} + \tkzLabelCircle[left](x,B)(-230){$((\delta))$} + \end{scope} + \end{tikzpicture} +\end{center} +\end{minipage} -\begin{minipage}[t]{.5\textwidth}\vspace{0pt}% \begin{Verbatim} \begin{tikzpicture} \tkzGetNodes @@ -3539,29 +3579,8 @@ z.Cp,_ = intersection (L.GD,C.xD) \end{scope} \end{tikzpicture} \end{Verbatim} -\end{minipage} -\begin{minipage}[t]{.5\textwidth}\vspace{0pt}% -\hspace*{\fill} -\begin{tikzpicture}[scale=.75] -\tkzGetNodes -\tkzDrawCircles(O,B) -\tkzDrawCircles[cyan](P,B) -\tkzDrawCircles[red](w,E) -\tkzDrawCircles[new](x,F) -\tkzDrawSegments(A,G E,G C,G) -\tkzDrawPolygons[new](A,E,C A',E',C') -\tkzDrawPoints(A,...,G,A',E',C',O,P) -\begin{scope}[font=\scriptsize] - \tkzLabelPoints(A,...,F) - \tkzLabelPoints[above left](G,A',E',C') - \tkzLabelCircle[left](O,B)(30){$(\beta)$} - \tkzLabelCircle[below](P,A)(40){$(\gamma)$} - \tkzLabelCircle[right](w,C)(90){$(\alpha)$} - \tkzLabelCircle[left](x,B)(-230){$((\delta))$} -\end{scope} -\end{tikzpicture} -\hspace*{\fill} -\end{minipage} + + % subsection three_chords (end) \subsection{Three tangents} % (fold) @@ -3569,7 +3588,8 @@ z.Cp,_ = intersection (L.GD,C.xD) \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (-1 , 0) z.C = point: new (4 , -1.5) z.E = point: new (1 , -1) @@ -3586,7 +3606,7 @@ z.Cp,_ = intersection (L.GD,C.xD) L.TA = C.wE : tangent_at (z.A) L.TC = C.xE : tangent_at (z.C) z.I = intersection (L.TA,L.TC) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles(w,E) @@ -3601,7 +3621,8 @@ z.Cp,_ = intersection (L.GD,C.xD) \end{Verbatim} \end{minipage} \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% -\begin{tkzelements} +\directlua{% +init_elements () scale = .75 z.A = point: new (-1 , 0) z.C = point: new (4 , -1.5) @@ -3619,20 +3640,21 @@ z.G = intersection (L.Aw,L.Cx) L.TA = C.wE : tangent_at (z.A) L.TC = C.xE : tangent_at (z.C) z.I = intersection (L.TA,L.TC) -\end{tkzelements} -\hspace*{\fill} -\begin{tikzpicture} -\tkzGetNodes -\tkzDrawCircles(w,E) -\tkzDrawCircles[cyan](x,E) -\tkzDrawCircles[red](G,A) -\tkzDrawLines(A,I C,I F,I) -\tkzDrawPoints(A,C,E,F) -\tkzLabelPoints[right](A) -\tkzLabelPoints[above right](E,F) -\tkzLabelPoints[below](C) -\end{tikzpicture} -\hspace*{\fill} +} + +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircles(w,E) + \tkzDrawCircles[cyan](x,E) + \tkzDrawCircles[red](G,A) + \tkzDrawLines(A,I C,I F,I) + \tkzDrawPoints(A,C,E,F) + \tkzLabelPoints[right](A) + \tkzLabelPoints[above right](E,F) + \tkzLabelPoints[below](C) + \end{tikzpicture} +\end{center} \end{minipage} % subsection three_tangents (end) @@ -3640,13 +3662,14 @@ z.I = intersection (L.TA,L.TC) \label{sub:midarc} \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (-1,0) z.B = point: new (2,4) C.AB = circle: new (z.A,z.B) z.C = z.A: rotation (math.pi/3,z.B) z.D = C.AB: midarc (z.B,z.C) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPoints(A,B,C) @@ -3657,23 +3680,25 @@ z.I = intersection (L.TA,L.TC) \end{Verbatim} \end{minipage} \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% -\begin{tkzelements} +\directlua{% +init_elements () scale = .5 z.A = point: new (-1,0) z.B = point: new (2,4) C.AB = circle: new (z.A,z.B) z.C = z.A: rotation (math.pi/3,z.B) z.D = C.AB: midarc (z.B,z.C) -\end{tkzelements} -\hspace*{\fill} -\begin{tikzpicture} -\tkzGetNodes -\tkzDrawPoints(A,B,C) -\tkzDrawCircles(A,B) -\tkzDrawPoints(A,...,D) -\tkzLabelPoints(A,...,D) -\end{tikzpicture} -\hspace*{\fill} +} + +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawPoints(A,B,C) + \tkzDrawCircles(A,B) + \tkzDrawPoints(A,...,D) + \tkzLabelPoints(A,...,D) + \end{tikzpicture} +\end{center} \end{minipage} % subsection midarc (end) @@ -3682,7 +3707,8 @@ z.D = C.AB: midarc (z.B,z.C) \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = 1.6 z.A = point: new (1,0) z.B = point: new (5,2) @@ -3702,7 +3728,7 @@ z.D = C.AB: midarc (z.B,z.C) z.P = intersection (L.tA,L.BC) z.Q = intersection (L.tB,L.AC) z.R = intersection (L.tC,L.AB) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygon[teal](A,B,C) @@ -3716,7 +3742,8 @@ z.D = C.AB: midarc (z.B,z.C) \end{Verbatim} \end{minipage} \begin{minipage}[t]{.5\textwidth}\vspace{0pt}% -\begin{tkzelements} +\directlua{% +init_elements () scale = 0.75 z.A = point: new (1,0) z.B = point: new (5,2) @@ -3736,72 +3763,98 @@ L.tC = line: new (z.Cr,z.Cl) z.P = intersection (L.tA,L.BC) z.Q = intersection (L.tB,L.AC) z.R = intersection (L.tC,L.AB) -\end{tkzelements} +} + +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygon[teal](A,B,C) + \tkzDrawCircle(O,A) + \tkzDrawPoints(A,B,C,P,Q,R) + \tkzLabelPoints(A,B,C,P,Q,R) + \tkzDrawLine[blue](Q,R) + \tkzDrawLines[red](Ar,Al Br,Q Cr,Cl) + \tkzDrawSegments(A,R C,P C,Q) + \end{tikzpicture} +\end{center} -\hspace*{\fill} -\begin{tikzpicture} -\tkzGetNodes -\tkzDrawPolygon[teal](A,B,C) -\tkzDrawCircle(O,A) -\tkzDrawPoints(A,B,C,P,Q,R) -\tkzLabelPoints(A,B,C,P,Q,R) -\tkzDrawLine[blue](Q,R) -\tkzDrawLines[red](Ar,Al Br,Q Cr,Cl) -\tkzDrawSegments(A,R C,P C,Q) -\end{tikzpicture} \end{minipage} % subsection lemoine_line_without_macro (end) \subsection{First Lemoine circle} % (fold) \label{sub:first_lemoine_circle} -\begin{minipage}[t]{.5\textwidth}\vspace{0pt}% -\begin{Verbatim} -\begin{tkzelements} +Draw lines through the symmedian point $L$ and parallel to the sides of the triangle. The points where the parallel lines intersect the sides of the triangle then lie on a circle known as the first Lemoine circle. It has center at the Brocard midpoint, i.e., the midpoint of $[OL]$, where $O$ is the circumcenter and $K$ is the symmedian point + +[\href{https://mathworld.wolfram.com/FirstLemoineCircle.html}{Weisstein, Eric W. "First Lemoine Circle." From MathWorld--A Wolfram Web Resource.}] + +\vspace{6pt} +\begin{minipage}[t]{.35\textwidth}\vspace{0pt}% +\directlua{% +init_elements () z.A = point: new (1,1) z.B = point: new (5,1) - z.C = point: new (2,3) - T = triangle: new (z.A,z.B,z.C) - z.O = T.circumcenter - z.o,z.w = get_points (T : first_lemoine_circle ()) + z.C = point: new (2.2,4) + T = triangle: new (z.A,z.B,z.C) + z.O = T.circumcenter + C.first_lemoine = T:first_lemoine_circle() + z.o,z.w = get_points( C.first_lemoine ) + z.y1,z.y2 = intersection (T.ab,C.first_lemoine) + z.y5,z.y6 = intersection (T.bc,C.first_lemoine) + z.y3,z.y4 = intersection (T.ca,C.first_lemoine) z.L = T : lemoine_point () -\end{tkzelements} +} +\begin{center} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygons(A,B,C) - \tkzDrawPoints(A,B,C,o,w,O,L) - \tkzLabelPoints(A,B,C,o,w,O,L) - \tkzDrawCircles(o,w O,A) + \tkzDrawPoints(A,B,C,o,O,L,y1,y2,y3,y4,y5,y6) + \tkzLabelPoints(A,B,C,o,O,L,y1,y2,y3,y4,y5,y6) + \tkzDrawCircles(o,w) + \tkzDrawLines(y1,y6 y5,y4 y2,y3 O,L) \end{tikzpicture} -\end{Verbatim} +\end{center} \end{minipage} -\begin{minipage}[t]{.5\textwidth}\vspace{0pt}% -\begin{tkzelements} -z.A = point: new (1,1) -z.B = point: new (5,1) -z.C = point: new (2,3) -T = triangle: new (z.A,z.B,z.C) -z.O = T.circumcenter -z.o,z.w = get_points(T:first_lemoine_circle()) -z.L = T : lemoine_point () -\end{tkzelements} -\hspace*{\fill} -\begin{tikzpicture}[scale = 1.25] -\tkzGetNodes -\tkzDrawPolygons(A,B,C) -\tkzDrawPoints(A,B,C,o,w,O,L) -\tkzLabelPoints(A,B,C,o,w,O,L) -\tkzDrawCircles(o,w O,A) +\begin{minipage}[t]{.65\textwidth}\vspace{0pt}% +\begin{Verbatim} +\directlua{% +init_elements () + z.A = point: new (1,1) + z.B = point: new (5,1) + z.C = point: new (2.2,4) + T = triangle:new(z.A,z.B,z.C) + z.O = T.circumcenter + C.first_lemoine = T:first_lemoine_circle() + z.o,z.w = get_points( C.first_lemoine ) + z.y1,z.y2= intersection (T.ab,C.first_lemoine) + z.y5,z.y6= intersection (T.bc,C.first_lemoine) + z.y3,z.y4= intersection (T.ca,C.first_lemoine) + z.L = T:lemoine_point () +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygons(A,B,C) + \tkzDrawPoints(A,B,C,o,O,L,y1,y2,y3,y4,y5,y6) + \tkzLabelPoints(A,B,C,o,O,L,y1,y2,y3,y4,y5,y6) + \tkzDrawCircles(o,w) + \tkzDrawLines(y1,y6 y5,y4 y2,y3 O,L) \end{tikzpicture} +\end{Verbatim} \end{minipage} + % subsection first_lemoine_circle (end) \subsection{First and second Lemoine circles} % (fold) \label{sub:first_and_second_lemoine_circles} +Draw antiparallels through the symmedian point $L$. The points where these lines intersect the sides then lie on a circle, known as the cosine circle (or sometimes the second Lemoine circle). Refer to [\ref{sub:antiparallel_through_lemoine_point}] + +[\href{https://mathworld.wolfram.com/CosineCircle.html}{Weisstein, Eric W. "Cosine Circle." From MathWorld--A Wolfram Web Resource.}] + + \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = 2 z.a = point: new (0,0) z.b = point: new (5,0) @@ -3824,7 +3877,7 @@ z.L = T : lemoine_point () L.y1y6 = line : new (z.y1,z.y6) L.y4y5 = line : new (z.y4,z.y5) L.y2y3 = line : new (z.y2,z.y3) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygons(a,b,c y1,y2,y3,y4,y5,y6) @@ -3838,7 +3891,8 @@ z.L = T : lemoine_point () \end{tikzpicture} \end{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = 2 z.a = point: new (0,0) z.b = point: new (5,0) @@ -3861,27 +3915,31 @@ z.x5,z.x6 = intersection (L.ca,C.second_lemoine) L.y1y6 = line : new (z.y1,z.y6) L.y4y5 = line : new (z.y4,z.y5) L.y2y3 = line : new (z.y2,z.y3) -\end{tkzelements} +} + + +\begin{center} + \begin{tikzpicture}[scale = .75] + \tkzGetNodes + \tkzDrawPolygons(a,b,c y1,y2,y3,y4,y5,y6) + \tkzDrawPoints(x1,x2,x3,x4,x5,x6,L) + \tkzDrawPoints(a,b,c,o,O,y1,y2,y3,y4,y5,y6) + \tkzLabelPoints[below right](a,b,c,o,O,y1,y2,y3,y4,y5,y6) + \tkzLabelPoints[below left](x1,x2,x3,x4,x5,x6) + \tkzLabelPoints[above](L) + \tkzDrawCircles(L,x o,p O,a) + \tkzDrawSegments(L,O x1,x4 x2,x5 x3,x6) + \end{tikzpicture} +\end{center} + -\hspace*{\fill} -\begin{tikzpicture}[scale = .75] -\tkzGetNodes -\tkzDrawPolygons(a,b,c y1,y2,y3,y4,y5,y6) -\tkzDrawPoints(x1,x2,x3,x4,x5,x6,L) -\tkzDrawPoints(a,b,c,o,O,y1,y2,y3,y4,y5,y6) -\tkzLabelPoints[below right](a,b,c,o,O,y1,y2,y3,y4,y5,y6) -\tkzLabelPoints[below left](x1,x2,x3,x4,x5,x6) -\tkzLabelPoints[above](L) -\tkzDrawCircles(L,x o,p O,a) -\tkzDrawSegments(L,O x1,x4 x2,x5 x3,x6) -\end{tikzpicture} -\hspace*{\fill} % subsection first_and_second_lemoine_circles (end) \subsection{Inversion} % (fold) \label{sub:inversion} -\begin{tkzelements} +\directlua{% +init_elements () scale = .75 z.A = point: new (-1,0) z.B = point: new (2,2) @@ -3896,12 +3954,13 @@ z.H = L.AE : projection (z.t1) z.Bp, z.Ep, z.Cp = C.AC: inversion ( z.B, z.E, z.C ) -\end{tkzelements} +} \begin{minipage}{.5\textwidth} \begin{Verbatim} - \begin{tkzelements} + \directlua{% +init_elements () z.A = point: new (-1,0) z.B = point: new (2,2) z.C = point: new (2,4) @@ -3916,7 +3975,7 @@ z.Cp = C.AC: inversion ( z.B, z.E, z.C ) z.Bp, z.Ep, z.Cp = C.AC: inversion ( z.B, z.E, z.C ) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes @@ -3942,52 +4001,6 @@ z.Cp = C.AC: inversion ( z.B, z.E, z.C ) \end{minipage} % subsection inversion (end) -\subsection{Gergonne point} % (fold) -\label{sub:gergonne_point} - -\begin{minipage}[t]{.5\textwidth}\vspace{0pt}% -\begin{Verbatim} -\begin{tkzelements} -z.a = point: new(1,0) -z.b = point: new(6,2) -z.c = point: new(2,5) -T = triangle : new (z.a,z.b,z.c) -z.g = T : gergonne_point () -z.i = T.incenter -z.ta,z.tb,z.tc = get_points (T : intouch ()) -\end{tkzelements} -\begin{tikzpicture} -\tkzGetNodes -\tkzDrawPolygons(a,b,c) -\tkzDrawPoints(a,b,c,g) -\tkzLabelPoints(a,b,c) -\tkzDrawSegments (a,ta b,tb c,tc) -\tkzDrawCircle(i,ta) -\end{tikzpicture} -\end{Verbatim} -\end{minipage} -\begin{minipage}[t]{.5\textwidth}\vspace{0pt}% -\begin{tkzelements} -z.a = point: new(1,0) -z.b = point: new(6,2) -z.c = point: new(2,5) -T = triangle : new (z.a,z.b,z.c) -z.g = T : gergonne_point () -z.i = T.incenter -z.ta,z.tb,z.tc = get_points (T : intouch ()) -\end{tkzelements} - -\hspace*{\fill} -\begin{tikzpicture} -\tkzGetNodes -\tkzDrawPolygons(a,b,c) -\tkzDrawPoints(a,b,c,g) -\tkzLabelPoints(a,b,c) -\tkzDrawSegments (a,ta b,tb c,tc) -\tkzDrawCircle(i,ta) -\end{tikzpicture} -\end{minipage} -% subsection gergonne_point (end) \subsection{Antiparallel through Lemoine point} % (fold) \label{sub:antiparallel_through_lemoine_point} @@ -3995,7 +4008,8 @@ z.ta,z.tb,z.tc = get_points (T : intouch ()) \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.a = point: new (0,0) z.b = point: new (5,0) z.c = point: new (1,4) @@ -4007,7 +4021,7 @@ z.ta,z.tb,z.tc = get_points (T : intouch ()) z.y_0,z.y_1 = get_points (L.anti) L.anti = T : antiparallel (z.L,2) z.z_0,z.z_1 = get_points (L.anti) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes @@ -4021,7 +4035,8 @@ z.ta,z.tb,z.tc = get_points (T : intouch ()) \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.a = point: new (0,0) z.b = point: new (5,0) z.c = point: new (1,4) @@ -4033,192 +4048,28 @@ L.anti = T : antiparallel (z.L,1) z.y_0,z.y_1 = get_points (L.anti) L.anti = T : antiparallel (z.L,2) z.z_0,z.z_1 = get_points (L.anti) -\end{tkzelements} - -\hspace*{\fill} -\begin{tikzpicture} -\tkzGetNodes -\tkzDrawPolygons(a,b,c) -\tkzDrawPoints(a,b,c,L,x_0,x_1,y_0,y_1,z_0,z_1) -\tkzLabelPoints(a,b) -\tkzLabelPoints[above](L,c) -\tkzDrawSegments(x_0,x_1 y_0,y_1 z_0,z_1) -\tkzDrawCircle(L,x_0) -\end{tikzpicture} -\end{minipage} -% subsection antiparallel_through_lemoine_point (end) - -\subsection{Soddy circle without function} % (fold) -\label{sub:soddy} - -\begin{Verbatim} -\begin{tkzelements} -z.A = point : new ( 0 , 0 ) -z.B = point : new ( 5 , 0 ) -z.C = point : new ( 0.5 , 4 ) -T.ABC = triangle : new ( z.A,z.B,z.C ) -z.I = T.ABC.incenter -z.E,z.F,z.G = T.ABC : projection (z.I) -C.ins = circle : new (z.I,z.E) -T.orthic = T.ABC : orthic () -z.Ha,z.Hb,z.Hc = get_points (T.orthic) -C.CF = circle : new ( z.C , z.F ) -C.AG = circle : new ( z.A , z.G ) -C.BE = circle : new ( z.B , z.E ) -L.Ah = line : new ( z.A , z.Ha ) -L.Bh = line : new ( z.B , z.Hb ) -L.Ch = line : new ( z.C , z.Hc ) -z.X,z.Xp = intersection (L.Ah,C.AG) -z.Y,z.Yp = intersection (L.Bh,C.BE) -z.Z,z.Zp = intersection (L.Ch,C.CF) -L.XpE = line : new (z.Xp,z.E) -L.YpF = line : new (z.Yp,z.F) -L.ZpG = line : new (z.Zp,z.G) -z.S = intersection (L.XpE,L.YpF) -z.Xi = intersection(L.XpE,C.AG) -z.Yi = intersection(L.YpF,C.BE) -_,z.Zi = intersection(L.ZpG,C.CF) -z.S = triangle : new (z.Xi,z.Yi,z.Zi).circumcenter -C.soddy_int = circle : new (z.S,z.Xi) -C.soddy_ext = C.ins : inversion (C.soddy_int) -z.w = C.soddy_ext.center -z.s = C.soddy_ext.through -z.Xip,z.Yip,z.Zip = C.ins : inversion (z.Xi,z.Yi,z.Zi) -\end{tkzelements} - -\begin{tikzpicture} -\tkzGetNodes -\tkzDrawPolygon(A,B,C) -\tkzDrawPoints(A,B,C,E,F,G,Ha,Hb,Hc,X,Y,Z,X',Y',Z',Xi,Yi,Zi,I) -\tkzDrawPoints(Xi',Yi',Zi',S) -\tkzLabelPoints(A,B,C,E,F,G,X,Y,Z,X',Y',Z') -\tkzDrawCircles(A,G B,E C,F I,E S,Xi w,s) -\tkzDrawLines(X',Ha Y',Hb Z',Hc) -\tkzDrawLines(X',E Y',F Z',G) -\end{tikzpicture} -\end{Verbatim} +} -\begin{tkzelements} -z.A = point : new ( 0 , 0 ) -z.B = point : new ( 5 , 0 ) -z.C = point : new ( 0.5 , 4 ) -T.ABC = triangle : new ( z.A,z.B,z.C ) -z.I = T.ABC.incenter -z.E,z.F,z.G = T.ABC : projection (z.I) -C.ins = circle : new (z.I,z.E) -T.orthic = T.ABC : orthic () -z.Ha,z.Hb,z.Hc = get_points (T.orthic) -C.CF = circle : new ( z.C , z.F ) -C.AG = circle : new ( z.A , z.G ) -C.BE = circle : new ( z.B , z.E ) -L.Ah = line : new ( z.A , z.Ha ) -L.Bh = line : new ( z.B , z.Hb ) -L.Ch = line : new ( z.C , z.Hc ) -z.X,z.Xp = intersection (L.Ah,C.AG) -z.Y,z.Yp = intersection (L.Bh,C.BE) -z.Z,z.Zp = intersection (L.Ch,C.CF) -L.XpE = line : new (z.Xp,z.E) -L.YpF = line : new (z.Yp,z.F) -L.ZpG = line : new (z.Zp,z.G) -z.S = intersection (L.XpE,L.YpF) -z.Xi = intersection(L.XpE,C.AG) -z.Yi = intersection(L.YpF,C.BE) -_,z.Zi = intersection(L.ZpG,C.CF) -z.S = triangle : new (z.Xi,z.Yi,z.Zi).circumcenter -C.soddy_int = circle : new (z.S,z.Xi) -C.soddy_ext = C.ins : inversion (C.soddy_int) -z.w = C.soddy_ext.center -z.s = C.soddy_ext.through -z.Xip,z.Yip,z.Zip = C.ins : inversion (z.Xi,z.Yi,z.Zi) -\end{tkzelements} - -\begin{tikzpicture} -\tkzGetNodes -\tkzDrawPolygon(A,B,C) -\tkzDrawPoints(A,B,C,E,F,G,Ha,Hb,Hc,X,Y,Z,X',Y',Z',Xi,Yi,Zi,I) -\tkzDrawPoints(Xi',Yi',Zi',S) -\tkzLabelPoints(A,B,C,E,F,G,X,Y,Z,X',Y',Z') -\tkzDrawCircles(A,G B,E C,F I,E S,Xi w,s) -\tkzDrawLines(X',Ha Y',Hb Z',Hc) -\tkzDrawLines(X',E Y',F Z',G) -\end{tikzpicture} -% subsection soddy (end) - -\subsection{Soddy circle with function} % (fold) -\label{sub:soddy_circle_with_function} - -\begin{tkzelements} -z.A = point : new ( 0 , 0 ) -z.B = point : new ( 5 , 0 ) -z.C = point : new (4 , 4 ) -T.ABC = triangle : new ( z.A,z.B,z.C ) -z.I = T.ABC.incenter -z.E,z.F,z.G = T.ABC : projection (z.I) -T.orthic = T.ABC : orthic () -z.Ha,z.Hb,z.Hc = get_points (T.orthic) -C.ins = circle : new (z.I,z.E) -z.s,z.xi,z.yi,z.zi = T.ABC : soddy_center () -C.soddy_int = circle : new (z.s,z.xi) -C.soddy_ext = C.ins : inversion (C.soddy_int) -z.w = C.soddy_ext.center -z.t = C.soddy_ext.through -z.Xip,z.Yip,z.Zip = C.ins : inversion (z.xi,z.yi,z.zi) -\end{tkzelements} +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygons(a,b,c) + \tkzDrawPoints(a,b,c,L,x_0,x_1,y_0,y_1,z_0,z_1) + \tkzLabelPoints(a,b) + \tkzLabelPoints[above](L,c) + \tkzDrawSegments(x_0,x_1 y_0,y_1 z_0,z_1) + \tkzDrawCircle(L,x_0) + \end{tikzpicture} +\end{center} -\begin{minipage}{.5\textwidth} - \begin{Verbatim} - \begin{tkzelements} - z.A = point : new ( 0 , 0 ) - z.B = point : new ( 5 , 0 ) - z.C = point : new (4 , 4 ) - T.ABC = triangle : new ( z.A,z.B,z.C ) - z.I = T.ABC.incenter - z.E,z.F,z.G = T.ABC : projection (z.I) - T.orthic = T.ABC : orthic () - z.Ha,z.Hb,z.Hc = get_points (T.orthic) - C.ins = circle : new (z.I,z.E) - z.s,z.xi,z.yi, - z.zi = T.ABC : soddy_center () - C.soddy_int = circle : new (z.s,z.xi) - C.soddy_ext = C.ins : inversion (C.soddy_int) - z.w = C.soddy_ext.center - z.t = C.soddy_ext.through - z.Xip,z.Yip, - z.Zip = C.ins : inversion (z.xi,z.yi,z.zi) - \end{tkzelements} -\end{Verbatim} -\end{minipage} -\begin{minipage}{.5\textwidth} -\begin{tikzpicture}[scale=.6] -\tkzGetNodes -\tkzDrawPolygon(A,B,C) -\tkzDrawCircles(A,G B,E C,F I,E s,xi w,t) -\tkzDrawPoints(A,B,C,E,F,G,s,w,xi,t) -\tkzLabelPoints(A,B,C) -\tkzDrawPoints(A,B,C,E,F,G,Ha,Hb,Hc,xi,yi,zi,I) -\tkzDrawPoints(Xi',Yi',Zi') -\tkzLabelPoints(A,B,C,E,F,G) -\end{tikzpicture} \end{minipage} - -\begin{Verbatim} -\begin{tikzpicture} -\tkzGetNodes -\tkzDrawPolygon(A,B,C) -\tkzDrawCircles(A,G B,E C,F I,E s,xi w,t) -\tkzDrawPoints(A,B,C,E,F,G,s,w,xi,t) -\tkzLabelPoints(A,B,C) -\tkzDrawPoints(A,B,C,E,F,G,Ha,Hb,Hc,xi,yi,zi,I) -\tkzDrawPoints(Xi',Yi',Zi') -\tkzLabelPoints(A,B,C,E,F,G) -\end{tikzpicture} -\end{Verbatim} -% subsection soddy_circle_with_function (end) +% subsection antiparallel_through_lemoine_point (end) \subsection{Pappus chain} % (fold) \label{sub:pappus_chain} -\begin{tkzelements} +\directlua{% +init_elements () scale =.75 xC,nc = 10,16 xB = xC/tkzphi @@ -4245,10 +4096,11 @@ z.Xip,z.Yip,z.Zip = C.ins : inversion (z.xi,z.yi,z.zi) L.SpTp = line:new ( z["S"..i.."p"], z["T"..i.."p"]) z["I"..i] = L.SpTp.mid end -\end{tkzelements} +} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () xC,nc = 10,16 xB = xC/tkzphi xD = (xC*xC)/xB @@ -4274,7 +4126,7 @@ z.Xip,z.Yip,z.Zip = C.ins : inversion (z.xi,z.yi,z.zi) L.SpTp = line:new ( z["S"..i.."p"], z["T"..i.."p"]) z["I"..i] = L.SpTp.mid end -\end{tkzelements} +} \end{Verbatim} \begin{minipage}{.5\textwidth} @@ -4308,7 +4160,8 @@ z.Xip,z.Yip,z.Zip = C.ins : inversion (z.xi,z.yi,z.zi) \subsection{Three Circles} % (fold) \label{sub:three_circles} -\begin{tkzelements} +\directlua{% +init_elements () function threecircles(c1,r1,c2,r2,c3,h1,h3,h2) local xk = math.sqrt (r1*r2) local cx = (2*r1*math.sqrt(r2))/(math.sqrt(r1)+math.sqrt(r2)) @@ -4322,11 +4175,12 @@ function threecircles(c1,r1,c2,r2,c3,h1,h3,h2) z[h3] = L.h1h2: projection (z[c3]) end threecircles("A",4,"B",3,"C","E","G","F") -\end{tkzelements} +} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () function threecircles(c1,r1,c2,r2,c3,h1,h3,h2) local xk = math.sqrt (r1*r2) local cx = (2*r1*math.sqrt(r2))/(math.sqrt(r1)+math.sqrt(r2)) @@ -4340,7 +4194,7 @@ function threecircles(c1,r1,c2,r2,c3,h1,h3,h2) z[h3] = L.h1h2: projection (z[c3]) end threecircles("A",4,"B",3,"C","E","G","F") -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes @@ -4362,10 +4216,11 @@ end \end{minipage} % subsection three_circles (end) -\subsection{pentagons in a golden arbelos} % (fold) +\subsection{Pentagons in a golden arbelos} % (fold) \label{sub:golden_arbelos} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0 , 0) z.B = point: new (10 , 0) L.AB = line: new ( z.A, z.B) @@ -4400,11 +4255,12 @@ k = 1/tkzphi^2 kk = tkzphi z.D_1,z.E_1,z.F_1,z.G_1 = z.B : homothety (k, z.D,z.E,z.F,z.G) z.D_2,z.E_2,z.F_2,z.G_2 = z.M_0 : homothety (kk,z.D_1,z.E_1,z.F_1,z.G_1) -\end{tkzelements} +} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0 , 0) z.B = point: new (10 , 0) L.AB = line: new ( z.A, z.B) @@ -4439,7 +4295,7 @@ z.D_2,z.E_2,z.F_2,z.G_2 = z.M_0 : homothety (kk,z.D_1,z.E_1,z.F_1,z.G_1) kk = tkzphi z.D_1,z.E_1,z.F_1,z.G_1 = z.B : homothety (k, z.D,z.E,z.F,z.G) z.D_2,z.E_2,z.F_2,z.G_2 = z.M_0 : homothety (kk,z.D_1,z.E_1,z.F_1,z.G_1) -\end{tkzelements} +} \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} @@ -4499,6 +4355,5 @@ z.D_2,z.E_2,z.F_2,z.G_2 = z.M_0 : homothety (kk,z.D_1,z.E_1,z.F_1,z.G_1) \end{tikzpicture} \end{Verbatim} - - -% subsection golden_arbelos (end)
\ No newline at end of file +% subsection golden_arbelos (end) +% section examples (end)
\ No newline at end of file diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-indepthstudy.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-indepthstudy.tex index 6f58cbec5c..e40f88e431 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-indepthstudy.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-indepthstudy.tex @@ -247,13 +247,14 @@ Then |z.B = z.A * za| describes a rotation of point A by an angle |a|. \begin{minipage}{.6\textwidth} \begin{Verbatim} - \begin{tkzelements} + \directlua{% +init_elements () z.O = point : new (0,0) z.A = point : new (1,2) a = math.pi/6 za = point(math.cos(a),math.sin(a)) z.B = z.A * za - \end{tkzelements} + } \begin{tikzpicture} \tkzGetNodes \tkzDrawPoints(O,A,B) @@ -264,14 +265,15 @@ Then |z.B = z.A * za| describes a rotation of point A by an angle |a|. \end{Verbatim} \end{minipage} \begin{minipage}{.6\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () scale=2 z.O = point : new (0,0) z.A = point : new (1,2) a = math.pi/6 za = point(math.cos(a),math.sin(a)) z.B = z.A * za -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPoints(O,A,B) @@ -282,12 +284,13 @@ Then |z.B = z.A * za| describes a rotation of point A by an angle |a|. \end{minipage} % subsubsection example_of_complex_use (end) -\subsubsection{Point operations(complex)} % (fold) +\subsubsection{Point operations (complex)} % (fold) \label{ssub:point_operations_complex} \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.o = point: new(0,0) z.a = point: new(1,-1) z.b = point: new(2,1) @@ -297,10 +300,10 @@ Then |z.B = z.A * za| describes a rotation of point A by an angle |a|. z.e = z.a * z.b z.f = z.a / z.b z.ap = point.conj (z.a) - -- = z.a : conj () + % = z.a : conj () z.g = z.b* point(math.cos(math.pi/2), math.sin(math.pi/2)) -\end{tkzelements} +} \hspace*{\fill} \begin{tikzpicture} @@ -315,7 +318,8 @@ Then |z.B = z.A * za| describes a rotation of point A by an angle |a|. \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () z.o = point: new(0,0) z.a = point: new(1,-1) z.b = point: new(2,1) @@ -325,9 +329,9 @@ Then |z.B = z.A * za| describes a rotation of point A by an angle |a|. z.e = z.a * z.b z.f = z.a / z.b z.ap = point.conj (z.a) - -- = z.a : conj () + % = z.a : conj () z.g = z.b* point(math.cos(math.pi/2),math.sin(math.pi/2)) -\end{tkzelements} +} \hspace*{\fill} \begin{tikzpicture} @@ -374,12 +378,13 @@ Then |z.B = z.A * za| describes a rotation of point A by an angle |a|. \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (1,0) z.B = point: new (5,-1) z.C = point: new (2,5) z.G = barycenter ({z.A,3},{z.B,1},{z.C,1}) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes @@ -388,12 +393,13 @@ Then |z.B = z.A * za| describes a rotation of point A by an angle |a|. \end{tikzpicture} \end{Verbatim} \end{minipage} -\begin{minipage}{.5\textwidth}\begin{tkzelements} +\begin{minipage}{.5\textwidth}\directlua{% +init_elements () z.A = point: new (1,0) z.B = point: new (5,-1) z.C = point: new (2,5) z.G = barycenter ({z.A,3},{z.B,1},{z.C,1}) -\end{tkzelements} +} \hspace{\fill} \begin{tikzpicture} \tkzGetNodes @@ -427,7 +433,8 @@ The problem encountered in this example stems from the notation of the point nam \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () local r = 3 z.O = point : new (0,0) max = 100 @@ -436,11 +443,12 @@ The problem encountered in this example stems from the notation of the point nam z["A_"..i] = point : polar(r,2*i*math.pi/max) end a = math.deg(get_angle (z.O,z.A_1,z.A_2)) -\end{tkzelements} +} \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () local r = 3 z.O = point : new (0,0) max = 100 @@ -449,7 +457,7 @@ The problem encountered in this example stems from the notation of the point nam z["A_"..i] = point : polar(r,2*i*math.pi/max) end a = math.deg(get_angle (z.O,z.A_1,z.A_2)) -\end{tkzelements} +} \hspace{\fill} \begin{tikzpicture} \pgfkeys{/pgf/number format/.cd,use comma} @@ -464,8 +472,235 @@ The problem encountered in this example stems from the notation of the point nam \end{tikzpicture} \end{minipage} +\begin{Verbatim} + \begin{tikzpicture} + \pgfkeys{/pgf/number format/.cd,use comma} + \let\pmpn\pgfmathprintnumber + \tkzGetNodes + \tkzDrawPolygon[cyan](A_1,A_...,A_\tkzUseLua{max}) + \tkzDrawCircle[red](O,A_1) + \tkzDrawPoints[color=black](A_1,A_...,A_\tkzUseLua{max},O) + \tkzDrawSegments(O,A_1 O,A_2) + \tkzMarkAngle[size=2](A_1,O,A_2) + \tkzLabelAngle[pos=3.4](A_1,O,A_2){$\pmpn{\tkzUseLua{a}}^\circ$} + \end{tikzpicture} +\end{Verbatim} + + + % subsection loop_and_table_notation (end) +\subsection{Use of tables} % (fold) +\label{sub:use_of_tables} + +\subsubsection{Working with tables} % (fold) +\label{ssub:working_with_tables} +In this example, we search for circles that are tangent to both a given circle and a line, demonstrating that their centers lie on a parabola. + +The \code{points} table contains the coordinates of the centers of the identified circles. \TIKZ only requires a list of coordinate pairs enclosed in brackets. +The table that defines the circles is slightly more complex. It contains the centers and the tangency points between the circles and the given elements. These are sequences of four coordinates, stored in the table. Finally, the sequences are concatenated into a string using a comma (",") as the separator. Coordinates are read with the \tkzcname{foreach} macro, utilizing the |expand list| option. + + +\begin{Verbatim} +\makeatletter +\def\tkzPlotCoordinates{\pgfutil@ifnextchar[{\tkz@PlotCoordinates}{\tkz@PlotCoordinates[]}} +\def\tkz@PlotCoordinates[#1]#2{% +\draw[#1] plot coordinates {\directlua{tex.print(#2)}};} +\makeatother + + +\directlua{ +scale =.5 +z.O = point : new (0,0) +z.P = point : new (0,6) +z.M = point : new (0,3) +z.I = point : new (1,0) +C.PM = circle : new (z.P,z.M) +list = {} +points = {} + for t = -0.24, 0.24, 0.004 do + if (t> - 0.002 and t< 0.002) then else + z.A = C.PM : point (t) + L.OI = line : new (z.O,z.I) + L.PA = line : new (z.P,z.A) + z.C = intersection (L.OI,L.PA) + L.tgt = C.PM : tangent_at (z.A) + z.X = intersection (L.tgt,L.OI) + z.o = bisector (z.X,z.A,z.C).pb + table.insert (points, "("..z.o.re..","..z.o.im..")") + table.insert (list,z.o.re.."/"..z.o.im.."/"..z.A.re.."/"..z.A.im) + end + end + list = table.concat(list,",") + } + +\begin{tikzpicture} +\tkzGetNodes +\tkzPlotCoordinates[smooth,blue]{points} + \foreach[expand list] \r/\s/\u/\v in {\tkzUseLua{list}} +{ + \tkzDefPoint(\u,\v){A} + \tkzDefPoint(\r,\s){o} + \tkzDrawCircle(o,A) + \tkzDrawPoints[red,size=.2pt](o,A) +} +\tkzDrawCircles(P,M) +\tkzDrawPoints(P,M) +\end{tikzpicture} +\end{Verbatim} + +\makeatletter +\def\tkzPlotCoordinates{\pgfutil@ifnextchar[{\tkz@PlotCoordinates}{\tkz@PlotCoordinates[]}} +\def\tkz@PlotCoordinates[#1]#2{% +\draw[#1] plot coordinates {\directlua{tex.print(#2)}};} +\makeatother + + +\directlua{ +scale =.5 +z.O = point : new (0,0) +z.P = point : new (0,6) +z.M = point : new (0,3) +z.I = point : new (1,0) +C.PM = circle : new (z.P,z.M) +list = {} +points = {} + for t = -0.24, 0.24, 0.004 do + if (t> - 0.002 and t< 0.002) then else + z.A = C.PM : point (t) + L.OI = line : new (z.O,z.I) + L.PA = line : new (z.P,z.A) + z.C = intersection (L.OI,L.PA) + L.tgt = C.PM : tangent_at (z.A) + z.X = intersection (L.tgt,L.OI) + z.o = bisector (z.X,z.A,z.C).pb + table.insert (points, "("..z.o.re..","..z.o.im..")") + table.insert (list,z.o.re.."/"..z.o.im.."/"..z.A.re.."/"..z.A.im) + end + end + list = table.concat(list,",") + } + +\begin{tikzpicture} +\tkzGetNodes +\tkzPlotCoordinates[smooth,blue]{points} + \foreach[expand list] \r/\s/\u/\v in {\tkzUseLua{list}} +{ + \tkzDefPoint(\u,\v){A} + \tkzDefPoint(\r,\s){o} + \tkzDrawCircle(o,A) + \tkzDrawPoints[red,size=.2pt](o,A) +} +\tkzDrawCircles(P,M) +\tkzDrawPoints(P,M) +\end{tikzpicture} + +% subsubsection working_with_tables (end) + + +\subsubsection{Plotting a curve} % (fold) +\label{ssub:plotting_a_curve} +In this example, we'll use lua to plot the representative curve of the function +\[ y = f(x) = x*exp(-x^2)+1\]. + +We'll use a table called “points” to store the coordinates of the points on the curve. + + +\makeatletter\let\percentchar\@percentchar\makeatother +\directlua{ +function checknumber(x) + if string.find(x, "e") then + return string.format("\percentchar.12f",x) + else + return x + end +end +} + +\def\val#1{% +\directlua{% + local expr = [[\tkzfct]] + local f = load ((" + return function (x) + return (\percentchar s) + end"):format (expr), nil, 't', math) () +tex.print(f(#1)) +}} + +\def\calcval(#1,#2,#3,#4){% +\directlua{ +local min, max, nb = #2, #3, #4 +local expr = [[#1]] +local points = {} + +local f = load (("return function (x) return (\percentchar s) end"):format (expr), nil, 't', math) () + +for t = min,max,(max-min)/nb do +local x = checknumber(t) +local y = checknumber(f(t)) + table.insert (points, "("..x..","..y..")") + end + tex.print(points) + } +} + +\def\tkzfct{x*exp(-x^2)+1} + +\begin{tikzpicture}[scale = 2] + \tkzInit[xmin=-3,xmax=3,ymin=-2,ymax=2] + \tkzDrawX\tkzDrawY + \draw[smooth] plot coordinates {\calcval(\tkzfct,-3,2,100)}; + \tkzDrawPoint(-3,\val{-3}) + \tkzDrawPoint(1,\val{1}) + \tkzDrawPoint(2,\val{2}) +\end{tikzpicture} + +\begin{Verbatim} +\makeatletter\let\percentchar\@percentchar\makeatother +\directlua{ +function checknumber(x) + if string.find(x, "e") then + return string.format("\percentchar.12f",x) + else + return x + end +end} +\def\val#1{\directlua{% + local expr = [[\tkzfct]] + local f = load (("return function (x) + return (\percentchar s) end"):format (expr), nil, 't', math) () +tex.print(f(#1)) +}} +\def\calcval(#1,#2,#3,#4){% +\directlua{% + local min, max, nb = #2, #3, #4 + local expr = [[#1]] + local points = {} + local f = load (("return function (x) + return (\percentchar s) end"):format (expr), nil, 't', math) () +for t = min,max,(max-min)/nb do + local x = checknumber(t) + local y = checknumber(f(t)) + if (y==math.huge or y==-math.huge ) then tex.print("problem") end + table.insert (points, "("..x..","..y..")") + end + tex.print(points) +}} +\def\tkzfct{x*exp(-x^2)+1} +\begin{tikzpicture} + \tkzInit[xmin=-3,xmax=3,ymin=-2,ymax=2] + \tkzDrawX\tkzDrawY + \draw[smooth] plot coordinates {\calcval(\tkzfct,-3,2,100)}; + \tkzDrawPoint(-3,\val{-3}) + \tkzDrawPoint(1,\val{1}) + \tkzDrawPoint(2,\val{2}) +\end{tikzpicture} +\end{Verbatim} + +% subsubsection plotting_a_curve (end) + +% ssubsection use_of_tables (end) + \subsection{In\_out method} % (fold) \label{sub:in_out_method} @@ -501,7 +736,8 @@ The \tkzNamePack{ifthen} package is required for the code below. \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point: new (0,0) z.B = point: new (1,2) z.X = point: new (2,4.000) @@ -514,7 +750,7 @@ if L.AB : in_out (z.X) inline = false end inline_bis = L.AB : in_out (z.Y) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes @@ -531,7 +767,8 @@ if L.AB : in_out (z.X) \end{Verbatim} \end{minipage} \begin{minipage}{.5\textwidth} - \begin{tkzelements} + \directlua{% +init_elements () z.A = point: new (0,0) z.B = point: new (1,2) z.X = point: new (2,4.000) @@ -544,7 +781,7 @@ if L.AB : in_out (z.X) inline = false end inline_bis = L.AB : in_out (z.Y) -\end{tkzelements} +} \hspace{\fill} \begin{tikzpicture} \tkzGetNodes @@ -576,10 +813,10 @@ We've just seen how to use |^| to obtain the determinant associated with two vec Here's the definition and transformation of the power of a complex number. \begin{Verbatim} - -- determinant is '^' ad - bc + % determinant is '^' ad - bc function point.__pow(z1,z2) local z - z = point.conj(z1) * z2 -- (a-ib) (c+id) = ac+bd + i(ad - bc) + z = point.conj(z1) * z2 % (a-ib) (c+id) = ac+bd + i(ad - bc) return z.im end \end{Verbatim} @@ -592,10 +829,10 @@ Here's the definition and transformation of the power of a complex number. Here's the definition of the dot product between two affixes and the concatenation transformation. \begin{Verbatim} --- dot product is '..' result ac + bd +% dot product is '..' result ac + bd function point.__concat(z1,z2) local z - z = z1 * point.conj(z2) -- (a+ib) (c-id) = ac+bd + i(bc-ad) + z = z1 * point.conj(z2) % (a+ib) (c-id) = ac+bd + i(bc-ad) return z.re end \end{Verbatim} @@ -664,7 +901,8 @@ You obtain a point on the object by entering a real number between 0 and 1. \begin{minipage}{.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new ( 0 , 0 ) z.B = point : new ( 4 , 2 ) z.C = point : new ( 1 , 3 ) @@ -674,7 +912,7 @@ You obtain a point on the object by entering a real number between 0 and 1. z.I = L.AB : point (0.5) z.J = C.AB : point (0.5) z.K = T.ABC : point (0.5) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawLine(A,B) @@ -686,7 +924,8 @@ You obtain a point on the object by entering a real number between 0 and 1. \end{minipage} \hspace{\fill} \begin{minipage}{.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () scale =.75 z.A = point : new ( 0 , 0 ) z.B = point : new ( 4 , 2 ) @@ -697,7 +936,7 @@ You obtain a point on the object by entering a real number between 0 and 1. z.I = L.AB : point (0.5) z.J = C.AB : point (0.5) z.K = T.ABC : point (0.5) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawLine(A,B) diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-intersection.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-intersection.tex index cc842aba53..acf50a22a1 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-intersection.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-intersection.tex @@ -12,7 +12,8 @@ The result is of the form: |point| or |false|. \begin{minipage}{0.6\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new (1,-1) z.B = point : new (4,1) z.C = point : new (2,1) @@ -26,7 +27,7 @@ The result is of the form: |point| or |false|. else z.I = x end -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes @@ -37,7 +38,8 @@ The result is of the form: |point| or |false|. \end{Verbatim} \end{minipage} \begin{minipage}{0.4\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new (1,-1) z.B = point : new (4,1) z.C = point : new (2,1) @@ -51,7 +53,7 @@ tex.print('error') else z.I = x end -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes @@ -61,7 +63,7 @@ end \end{tikzpicture} \end{minipage} -Other examples: \ref{ssub:altshiller}, \ref{ssub:lemoine}, \ref{sub:alternate} +Other examples: \ref{sub:altshiller}, \ref{sub:lemoine}, \ref{sub:alternate} % subsection line_line (end) \newpage @@ -71,7 +73,8 @@ The result is of the form : |point,point| or |false,false|. If the line is tange \begin{minipage}{0.6\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new (1,-1) z.B = point : new (1,2) L.AB = line : new (z.A,z.B) @@ -82,7 +85,7 @@ The result is of the form : |point,point| or |false,false|. If the line is tange C.OD = circle : new (z.O,z.D) z.I,_ = intersection (L.AB,C.OD) _,z.K = intersection (C.OD,L.AE) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes @@ -94,7 +97,8 @@ The result is of the form : |point,point| or |false,false|. If the line is tange \end{Verbatim} \end{minipage} \begin{minipage}{0.4\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () scale = 2 z.A = point : new (1,-1) z.B = point : new (1,2) @@ -106,18 +110,19 @@ L.AE = line : new (z.A,z.E) C.OD = circle : new (z.O,z.D) z.I,_ = intersection (L.AB,C.OD) _,z.K = intersection (C.OD,L.AE) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes -\tkzDrawLines(A,B A,E) +\tkzDrawLines[add=.1 and .1](A,B A,E) \tkzDrawCircle(O,D) \tkzDrawPoints(A,B,O,D,I,K) \tkzLabelPoints[left](A,B,O,D,I,K) \end{tikzpicture} +\hfill \end{minipage} -Other examples: \ref{ssub:altshiller} +Other examples: \ref{sub:altshiller} % subsection line_circle (end) \newpage @@ -128,7 +133,8 @@ The result is of the form : |point,point| or |false,false|. If the circles are \begin{minipage}{0.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new (1,1) z.B = point : new (2,2) z.C = point : new (3,3) @@ -138,7 +144,7 @@ The result is of the form : |point,point| or |false,false|. If the circles are z.I,_ = intersection (C.AB,C.CB) C.DC = circle : new (z.D,z.C) z.J,z.K = intersection (C.DC,C.CB) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircles(A,B C,B D,C) @@ -148,7 +154,8 @@ The result is of the form : |point,point| or |false,false|. If the circles are \end{Verbatim} \end{minipage} \begin{minipage}{0.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () z.A = point : new (1,1) z.B = point : new (2,2) z.C = point : new (3,3) @@ -158,7 +165,7 @@ C.CB = circle : new (z.C,z.B) z.I,_ = intersection (C.AB,C.CB) C.DC = circle : new (z.D,z.C) z.J,z.K = intersection (C.DC,C.CB) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes @@ -168,7 +175,7 @@ C.DC = circle : new (z.D,z.C) \end{tikzpicture} \end{minipage} -Other examples: \ref{ssub:altshiller}, \ref{sub:the_figure_pappus_circle} +Other examples: \ref{sub:altshiller}, \ref{sub:the_figure_pappus_circle} % subsection circle_circle (end) \newpage @@ -180,7 +187,8 @@ The designation of intersection points is a little more complicated than the pre \begin{minipage}{0.5\textwidth} \begin{Verbatim} -\begin{tkzelements} +\directlua{% +init_elements () scale = .5 z.a = point: new (5 , 2) z.b = point: new (-4 , 0) @@ -192,11 +200,11 @@ The designation of intersection points is a little more complicated than the pre z.e = L.ab: point (-.2) E = ellipse: foci (z.a,z.b,z.e) z.u,z.v = intersection (E,L.mn) - -- transfer to tex + % transfer to tex a = E.Rx b = E.Ry ang = math.deg(E.slope) -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawLines[red](a,b u,v) % p,s p,t @@ -210,23 +218,24 @@ The designation of intersection points is a little more complicated than the pre \end{Verbatim} \end{minipage} \begin{minipage}{0.5\textwidth} -\begin{tkzelements} +\directlua{% +init_elements () scale =.5 z.a = point: new (5 , 2) z.b = point: new (-4 , 0) z.m = point: new (2 , 4) z.n = point: new (4 , 4) - L.ab = line : new (z.a,z.b) - L.mn = line : new (z.m,z.n) + L.ab = line : new (z.a,z.b) + L.mn = line : new (z.m,z.n) z.c = L.ab. mid z.e = L.ab: point (-.2) E = ellipse: foci (z.a,z.b,z.e) z.u,z.v = intersection (E,L.mn) - -- transfer to tex + % transfer to tex a = E.Rx b = E.Ry ang = math.deg(E.slope) -\end{tkzelements} +} \hspace*{\fill} \begin{tikzpicture} \tkzGetNodes diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-inversion.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-inversion.tex index bb067244d4..bba30de71a 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-inversion.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-inversion.tex @@ -1,4 +1,4 @@ \section{Inversion} % (fold) \label{sec:inversion} -midcircless +midcircles % section inversion (end)
\ No newline at end of file diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-main.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-main.tex index 55608bb26b..b520f6d058 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-main.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-main.tex @@ -1,6 +1,6 @@ % !TEX TS-program = lualatex % encoding : utf8 -% Documentation of tkz-elements v2.25c +% Documentation of tkz-elements v3.10c % Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 @@ -21,10 +21,10 @@ headings = small ]{tkz-doc} \gdef\tkznameofpack{tkz-elements} -\gdef\tkzversionofpack{2.25c} +\gdef\tkzversionofpack{3.10c} \gdef\tkzdateofpack{\today} \gdef\tkznameofdoc{tkz-elements.pdf} -\gdef\tkzversionofdoc{2.25c} +\gdef\tkzversionofdoc{3.10c} \gdef\tkzdateofdoc{\today} \gdef\tkzauthorofpack{Alain Matthes} \gdef\tkzadressofauthor{} @@ -66,6 +66,8 @@ \usepackage{fontspec} \setmainfont{texgyrepagella}[ + UprightFont = texgyrepagella-regular.otf, + SmallCapsFeatures={FakeSmallCaps}, Extension = .otf, UprightFont = *-regular , ItalicFont = *-italic , @@ -78,7 +80,8 @@ ItalicFont = *-italic , BoldFont = *-bold , BoldItalicFont = *-bolditalic , -] + BoldItalicFeatures = {RawFeature=-smcp} % Désactiver smcp + ] \setmonofont{lmmono10-regular.otf}[ Numbers={Lining,SlashedZero}, @@ -139,6 +142,8 @@ sharp corners \newcommand*{\Immeth}[2]{\texttt{#2}\index{#1_3@\texttt{#1: metamethod}!\_\_\texttt{#2}}} \newcommand*{\Igfct}[2]{\texttt{#2}\index{#1_3@\texttt{#1: function}!\texttt{#2}}} \newcommand*{\Iclass}[1]{\texttt{#1}\index{Class !#1@\texttt{#1}}} +\newcommand*{\Iengine}[1]{\texttt{#1}\index{Engine !#1@\texttt{#1}}} +\newcommand*{\Iprimitive}[1]{\textbackslash\texttt{#1}\index{Lua\TeX\ primitive !#1@\texttt{\textbackslash#1}}} \newcommand*{\tkzNameObj}[1]{\tkzname{#1}\Iobj{#1}} \newcommand*{\Iobj}[1]{\index{Object_1@\texttt{Object}!\texttt{#1}}} \newcommand*{\tkzRBomb}{\textcolor{red}{\bomb}} @@ -170,19 +175,17 @@ sharp corners \AtBeginDocument{\MakeShortVerb{\|}} % link to shortvrb - - \begin{document} -\LuaCodeDebugOn \parindent=0pt \tkzTitleFrame{tkz-elements \tkzversionofpack\\Euclidean Geometry} \clearpage -\defoffile{\lefthand\ + +\defoffile{\lefthand\ \\ This document compiles some notes about \tkzname{\tkznameofpack}, the initial version of a \code{Lua} library designed to perform all the necessary calculations for defining objects in Euclidean geometry figures. Your document must be compiled using Lua\LaTeX.\\ With \pkg{tkz-elements}, definitions and calculations are exclusively conducted using \pkg{Lua}. \\ - The primary programming approach offered is oriented towards \code{object programming}, utilizing object classes such as point, line, triangle, circle, and ellipse. Currently, after the calculations are completed, \pkg{tkz-euclide} or \pkg{TikZ} is used for drawing purposes.\\ + The primary programming approach offered is oriented towards object programming, utilizing object classes such as point, line, triangle, circle, and ellipse. Currently, after the calculations are completed, \pkg{tkz-euclide} is used for drawing purposes. (but you can use \TIKZ)\\ I discovered Lua and object-oriented programming while developing this package, so it's highly likely that I've made a few mistakes. If you'd like to contribute to the development of this package or provide advice on how to proceed, please contact me via email. } @@ -214,6 +217,7 @@ Project Public License Distributed from \href{http://www.ctan.org/}{CTAN}\ arch \clearpage \newpage +\input{TKZdoc-elements-news.tex} \input{TKZdoc-elements-structure.tex} \input{TKZdoc-elements-why.tex} \input{TKZdoc-elements-presentation.tex} @@ -236,6 +240,7 @@ Project Public License Distributed from \href{http://www.ctan.org/}{CTAN}\ arch \input{TKZdoc-elements-classes-misc.tex} \input{TKZdoc-elements-intersection.tex} \input{TKZdoc-elements-indepthstudy.tex} +\input{TKZdoc-elements-theorems.tex} \input{TKZdoc-elements-examples.tex} \clearpage\newpage @@ -246,7 +251,7 @@ Project Public License Distributed from \href{http://www.ctan.org/}{CTAN}\ arch \label{sec:cheat_sheet} % section cheat_sheet (end) -|r| denotes a real number, |cx| complex number, |d| a positive real number, |n| an integer, |an| an angle, |b| a boolean, |s| a character string, |pt| a point, |t| a table, |m| a matrix, |v| variable, |L| a straight line, |C| a circle, |T| a triangle, |E| an ellipse, |V| a vector,|Q| a quadrilateral, |P| a parallelogram, |R| a rectangle, |S| a square, |RP| a regular polygon, |M| a matrix, |O| an object (pt, L,C,T), . . a list of points or an object, < > optional argument. +|r| denotes a real number, |cx| complex number, |d| a positive real number, |n| an integer, |an| an angle, |b| a boolean, |s| a character string, |p| a point, |t| a table, |m| a matrix, |v| variable, |L| a straight line, |C| a circle, |T| a triangle, |E| an ellipse, |V| a vector,|Q| a quadrilateral, |P| a parallelogram, |R| a rectangle, |S| a square, |RP| a regular polygon, |M| a matrix, |O| an object (p, L,C,T), . . a list of points or an object, < > optional argument. \begin{multicols}{3} \fbox{\textbf{point}}\\ @@ -257,82 +262,87 @@ Project Public License Distributed from \href{http://www.ctan.org/}{CTAN}\ arch |argument -> r| \\ |modulus -> d| \\ \textbf{Functions} table(\ref{point:att}) \\ -|new -> pt| \\ -|polar -> pt| \\ -|polar_deg -> pt| \\ +|new -> p| \\ +|polar -> p| \\ +|polar_deg -> p| \\ \textbf{Methods} table(\ref{complex:meta}) \\ -|+ - * / (pt,pt) -> pt| \\ -|.. (pt,pt) -> r| \\ -|^ (pt,pt) -> r| \\ +|+ - * / (p,p) -> p| \\ +|.. (p,p) -> r| \\ +|^ (p,p) -> r| \\ |= -> b| \\ |tostring -> s| \\ \textbf{Methods} table(\ref{point:met}) table(\ref{complex:met}) \\ -|conj -> pt| \\ +|conj -> p| \\ |abs -> r| \\ |mod -> d| \\ |norm -> d| \\ |arg -> d| \\ |get -> r,r| \\ -|sqrt -> pt| \\ -|north(d) -> pt| \\ -|south(d) -> pt| \\ -|east(d) -> pt| \\ -|west(d) -> pt| \\ -|normalize(pt) -> pt| \\ +|sqrt -> p| \\ +|north(d) -> p| \\ +|south(d) -> p| \\ +|east(d) -> p| \\ +|west(d) -> p| \\ +|normalize(p) -> p| \\ |symmetry (...) -> O| \\ |rotation (an , ...) -> O| \\ |homothety (r , ...) -> O| \\ -|orthogonal(d) -> pt| \\ -|at() -> pt| \\ +|orthogonal(d) -> p| \\ +|at() -> p| \\ |print() -> s| \\ \\ \fbox{\textbf{line}} \\ \textbf{Attributes} table(\ref{line:att}) \\ -|pa,pb -> pt| \\ +|pa,pb -> p| \\ |type -> s| \\ -|mid -> pt| \\ -|north_pa -> pt| \\ -|north_pb -> pt| \\ -|south_pa -> pt| \\ -|south_pb -> pt| \\ -|east -> pt| \\ -|west -> pt| \\ +|mid -> p| \\ +|north_pa -> p| \\ +|north_pb -> p| \\ +|south_pa -> p| \\ +|south_pb -> p| \\ +|east -> p| \\ +|west -> p| \\ |slope -> r| \\ |length -> d| \\ |vec -> V| \\ \textbf{Methods} table(\ref{line:met}) \\ -|new (pt,pt) -> d| \\ -|distance (pt) -> d| \\ +|new (p,p) -> d| \\ +|distance (p) -> d| \\ |slope () -> r| \\ -|in_out (pt) -> b| \\ -|in_out_segment (pt) -> b| \\ -|barycenter (r,r) -> pt| \\ -|point (t) -> pt| \\ -|midpoint () -> pt| \\ -|harmonic_int (pt) -> pt| \\ -|harmonic_ext (pt) -> pt| \\ -|harmonic_both (d) -> pt| \\ -|gold_ratio() -> pt| \\ -|normalize () -> pt| \\ -|normalize_inv () -> pt| \\ -|_north_pa (d) -> pt| \\ -|_north_pb (d) -> pt| \\ -|_south_pa (d) -> pt| \\ -|_south_pb (d) -> pt| \\ -|_east (d) -> pt| \\ -|_west (d) -> pt| \\ -|report (r,pt) -> pt| \\ -|colinear_at (pt,k) -> pt| \\ +|in_out (p) -> b| \\ +|in_out_segment (p) -> b| \\ +|is_parallel (l) -> b| \\ +|is_orthogonal (l) -> b| \\ +|is_equidistant (p) -> b| \\ +|barycenter (r,r) -> p| \\ +|point (t) -> p| \\ +|midpoint () -> p| \\ +|harmonic_int (p) -> p| \\ +|harmonic_ext (p) -> p| \\ +|harmonic_both (d) -> p| \\ +|gold_ratio() -> p| \\ +|normalize () -> p| \\ +|normalize_inv () -> p| \\ +|_north_pa (d) -> p| \\ +|_north_pb (d) -> p| \\ +|_south_pa (d) -> p| \\ +|_south_pb (d) -> p| \\ +|_east (d) -> p| \\ +|_west (d) -> p| \\ +|report (r,p) -> p| \\ +|colinear_at (p,k) -> p| \\ |translation (...) -> O| \\ |projection (...) -> O| \\ |reflection (...) -> O| \\ -|ll_from ( pt ) -> L| \\ -|ortho_from ( pt ) -> L| \\ +|ll_from ( p ) -> L| \\ +|ortho_from ( p ) -> L| \\ |mediator () -> L| \\ |circle () -> C| \\ |circle_swap () -> C| \\ |diameter () -> C| \\ -|apollonius (r) -> C| \\ +|apollonius (r) -> C| \\ +|c_ll_p (p,p) -> C| \\ +|c_l_pp (p,p) -> C| \\ |equilateral (<swap>) -> T| \\ |isosceles (an,<swap>) -> T| \\ |school () -> T| \\ @@ -353,13 +363,13 @@ Project Public License Distributed from \href{http://www.ctan.org/}{CTAN}\ arch \\ \fbox{\textbf{triangle}} \\ \textbf{Attributes} table(\ref{triangle:att}) \\ -|pa,pb,pc -> pt| \\ -|circumcenter -> pt| \\ -|centroid -> pt| \\ -|incenter -> pt| \\ -|eulercenter -> pt| \\ -|orthocenter -> pt| \\ -|spiekercenter -> pt| \\ +|pa,pb,pc -> p| \\ +|circumcenter -> p| \\ +|centroid -> p| \\ +|incenter -> p| \\ +|eulercenter -> p| \\ +|orthocenter -> p| \\ +|spiekercenter -> p| \\ |type -> s| \\ |a -> d| \\ |b -> d| \\ @@ -371,30 +381,30 @@ Project Public License Distributed from \href{http://www.ctan.org/}{CTAN}\ arch |beta -> r| \\ |gamma -> r| \\ \textbf{Methods} table(\ref{triangle:met}) \\ -|new (pt,pt,pt) -> pt| \\ -|trilinear (r,r,r) -> pt| \\ -|barycentric (r,r,r) -> pt| \\ -|bevan_point () -> pt| \\ -|mittenpunkt_point () -> pt| \\ -|gergonne_point () -> pt| \\ -|nagel_point () -> pt| \\ -|feuerbach_point () -> pt| \\ -|lemoine_point() -> pt| \\ -|symmedian_point() -> pt| \\ -|spieker_center() -> pt| \\ -|barycenter (r,r,r) -> pt| \\ -|base (u,v) -> pt| \\ -|euler_points () -> pt| \\ -|nine_points () -> pt| \\ -|point (t) -> pt| \\ -|soddy_center () -> pt| \\ -|conway_points () -> pts| \\ +|new (p,p,p) -> p| \\ +|trilinear (r,r,r) -> p| \\ +|barycentric (r,r,r) -> p| \\ +|bevan_point () -> p| \\ +|mittenpunkt_point () -> p| \\ +|gergonne_point () -> p| \\ +|nagel_point () -> p| \\ +|feuerbach_point () -> p| \\ +|lemoine_point() -> p| \\ +|symmedian_point() -> p| \\ +|spieker_center() -> p| \\ +|barycenter (r,r,r) -> p| \\ +|base (u,v) -> p| \\ +|euler_points () -> p| \\ +|nine_points () -> p| \\ +|point (t) -> p| \\ +|soddy_center () -> p| \\ +|conway_points () -> pts| \\ |euler_line () -> L| \\ |symmedian_line (n) -> L| \\ |altitude (n) -> L| \\ |bisector (n) -> L| \\ |bisector_ext(n) -> L| \\ -|antiparallel(pt,n) -> L| \\ +|antiparallel(p,n) -> L| \\ |euler_circle () -> C| \\ |circum_circle() -> C| \\ |in_circle () -> C| \\ @@ -406,6 +416,7 @@ Project Public License Distributed from \href{http://www.ctan.org/}{CTAN}\ arch |conway_circle () -> C| \\ |pedal_circle () -> C| \\ |cevian_circle () -> C| \\ +|c_ll_p (p) -> C| \\ |orthic() -> T| \\ |medial() -> T| \\ |incentral() -> T| \\ @@ -416,155 +427,160 @@ Project Public License Distributed from \href{http://www.ctan.org/}{CTAN}\ arch |feuerbach() -> T| \\ |anti () -> T| \\ |tangential () -> T| \\ -|cevian (pt) -> T| \\ +|cevian (p) -> T| \\ |symmedian () -> T| \\ |euler () -> T| \\ -|pedal (pt) -> T| \\ -|projection (pt) -> pt,pt,pt| \\ -|parallelogram () -> pt| \\ +|pedal (p) -> T| \\ +|projection (p) -> p,p,p| \\ +|parallelogram () -> p| \\ |area () -> d| \\ -|barycentric_coordinates(pt)| \\ +|barycentric_coordinates(p)| \\ |-> r,r,r| \\ -|in_out (pt) -> pt| \\ +|in_out (p) -> p| \\ |check_equilateral () -> b| \\ \\ \fbox{\textbf{circle}} \\ \textbf{Attributes} table(\ref{circle:att}) \\ -|center -> pt| \\ -|through -> pt| \\ -|north -> pt| \\ -|south -> pt| \\ -|east -> pt| \\ -|west -> pt| \\ -|opp -> pt| \\ +|center -> p| \\ +|through -> p| \\ +|north -> p| \\ +|south -> p| \\ +|east -> p| \\ +|west -> p| \\ +|opp -> p| \\ |type -> s| \\ |radius -> d| \\ |ct -> L| \\ +|perimeter -> r| \\ +|area -> r| \\ \textbf{Methods} table(\ref{circle:met}) \\ -|new (pt,pt) -> C| \\ -|radius (pt, r) -> C| \\ -|diameter (pt,pt) -> C| \\ -|in_out (pt) -> b| \\ -|in_out_disk (pt) -> b| \\ -|circles_position (C) -> s| \\ -|power (pt) -> r| \\ -|antipode (pt) -> pt| \\ -|midarc (pt,pt) -> pt| \\ -|point (r) -> pt| \\ -|random_pt (lower, upper) -> pt| \\ -|internal_similitude (C) -> pt| \\ -|external_similitude (C) -> pt| \\ -|radical_center(C,<C>) -> pt| \\ -|tangent_at (pt) -> L| \\ -|radical_axis (C) -> L| \\ -|radical_circle(C,<C>) -> C| \\ -|orthogonal_from (pt) -> C| \\ -|orthogonal_through(pt,pt) -> C| \\ +|new (p,p) -> C| \\ +|radius (p, r) -> C| \\ +|diameter (p,p) -> C| \\ +|in_out (p) -> b| \\ +|in_out_disk (p) -> b| \\ +|circles_position (C) -> s| \\ +|power (p) -> r| \\ +|antipode (p) -> p| \\ +|midarc (p,p) -> p| \\ +|point (r) -> p| \\ +|random_pt (lower, upper) -> p| \\ +|internal_similitude (C) -> p| \\ +|external_similitude (C) -> p| \\ +|radical_center(C,<C>) -> p| \\ +|tangent_at (p) -> L| \\ +|radical_axis (C) -> L| \\ +|radical_circle(C,<C>) -> C| \\ +|orthogonal_from (p) -> C| \\ +|orthogonal_through(p,p) -> C| \\ +|c_lc_p (L,p,inside) -> C| \\ +|c_c_pp(a,b)(p,p) -> C| \\ +|c_cc_p (C,p) -> C| \\ |midcircle(C) -> C| \\ |external_tangent(C) -> L,L| \\ |internal_tangent(C) -> L,L| \\ |common_tangent(C) -> L,L| \\ -|tangent_from (pt) -> L,L| \\ +|tangent_from (p) -> L,L| \\ |inversion (...) -> O | \\ \\ \fbox{\textbf{ellipse}} \\ -\textbf{Attributes} table(\ref{ellipse:met}) \\ -|center -> pt| \\ -|vertex -> pt| \\ -|covertex -> pt| \\ -|Fa -> pt| \\ -|Fb -> pt| \\ -|north -> pt| \\ -|south -> pt| \\ -|east -> pt| \\ -|west -> pt| \\ +\textbf{Attributes} table(\ref{ellipse:met}) \\ +|center -> p| \\ +|vertex -> p| \\ +|covertex -> p| \\ +|Fa -> p| \\ +|Fb -> p| \\ +|north -> p| \\ +|south -> p| \\ +|east -> p| \\ +|west -> p| \\ |Rx -> d| \\ |Ry -> d| \\ |slope -> r| \\ |type -> s| \\ \textbf{Methods} table(\ref{ellipse:met}) \\ -|new (pt,pt,pt) -> E| \\ -|foci (pt,pt,pt) -> E| \\ -|radii (pt,r,r,an) -> E| \\ -|in_out (pt) -> b| \\ -|tangent_at (pt) -> L| \\ -|tangent_from (pt) -> L| \\ -|point (r) -> pt| \\ +|new (p,p,p) -> E| \\ +|foci (p,p,p) -> E| \\ +|radii (p,r,r,an) -> E| \\ +|in_out (p) -> b| \\ +|tangent_at (p) -> L| \\ +|tangent_from (p) -> L| \\ +|point (r) -> p| \\ \\ -\fbox{\textbf{square}} \\ - \textbf{Attributes} table(\ref{square:att}) \\ -|pa,pb,pc,pd -> pt| \\ +\fbox{\textbf{square}} \\ + \textbf{Attributes} table(\ref{square:att}) \\ +|pa,pb,pc,pd -> p| \\ |type -> s| \\ |side -> d| \\ -|center -> pt| \\ -|exradius -> d| \\ +|center -> p| \\ +|circumradius -> d| \\ |inradius -> d| \\ |diagonal -> d| \\ -|proj -> pt| \\ +|proj -> p| \\ |ab bc cd da -> L| \\ |ac bd -> L| \\ - \textbf{Methods} table(\ref{square:met}) \\ -|new (pt,pt,pt,pt) -> S| \\ -|rotation (pt,pt) -> S| \\ -|side (pt,pt,<swap>) -> S| \\ + \textbf{Methods} table(\ref{square:met}) \\ +|new (p,p,p,p) -> S| \\ +|rotation (p,p) -> S| \\ +|side (p,p,<swap>) -> S| \\ \\ \fbox{\textbf{rectangle}} \\ \textbf{Attributes} table(\ref{rectangle:att}) \\ -|pa,pb,pc,pd -> pt| \\ +|pa,pb,pc,pd -> p| \\ |type -> s| \\ -|center -> pt| \\ -|exradius -> d| \\ +|center -> p| \\ +|circumradius -> d| \\ |length -> r| \\ |width -> r| \\ |diagonal -> d| \\ |ab bc cd da -> L| \\ |ac bd -> L| \\ \textbf{Methods} table(\ref{rectangle:met}) \\ -|new (pt,pt,pt,pt) -> R| \\ -|angle (pt,pt,an) -> R| \\ -|gold (pt,pt,<swap>) -> R| \\ -|diagonal (pt,pt,<swap>) -> R| \\ -|side (pt,pt,r,<swap>) -> R| \\ +|new (p,p,p,p) -> R| \\ +|angle (p,p,an) -> R| \\ +|gold (p,p,<swap>) -> R| \\ +|diagonal (p,p,<swap>) -> R| \\ +|side (p,p,r,<swap>) -> R| \\ |get_lengths () ->r,r| \\ \\ \fbox{\textbf{quadrilateral} } \\ \textbf{Attributes} table(\ref{quadrilateral:att}) \\ -|pa,pb,pc,pd -> pt| \\ +|pa,pb,pc,pd -> p| \\ |ab bc cd da -> L | \\ |ac bd -> L | \\ |type -> s | \\ -|i -> pt| \\ -|g -> pt| \\ +|i -> p| \\ +|g -> p| \\ |a b c d -> r| \\ \textbf{Methods} table(\ref{quadrilateral:met}) \\ -|new (pt,pt,pt,pt) -> Q| \\ +|new (p,p,p,p) -> Q| \\ |iscyclic () -> b| \\ \\ \fbox{\textbf{parallelogram}} \\ \textbf{Attributes} table(\ref{parallelogram:att}) \\ -|pa,pb,pc,pd -> pt| \\ +|pa,pb,pc,pd -> p| \\ |ab bc cd da -> L | \\ |ac bd -> L | \\ |type -> s | \\ -|center -> pt| \\ +|center -> p| \\ \textbf{Methods} table(\ref{parallelogram:met}) \\ -|new (pt,pt,pt,pt) ->| \\ -|fourth (pt,pt,pt) ->| \\ +|new (p,p,p,p) ->| \\ +|fourth (p,p,p) ->| \\ \\ \fbox{\textbf{Regular\_polygon}} \\ \textbf{Attributes} table(\ref{regular:att}) \\ -|center -> pt| \\ -|through -> pt | \\ +|center -> p| \\ +|through -> p | \\ |circle -> C | \\ |type -> s | \\ |side -> d| \\ -|exradius -> d| \\ +|circumradius -> d| \\ |inradius -> d| \\ -|proj -> pt| \\ +|proj -> p| \\ |nb -> i| \\ |angle -> an| \\ \textbf{Methods} table(\ref{regular:met}) \\ -|new (pt,pt,n) -> PR| \\ +|new (p,p,n) -> PR| \\ |incircle () -> C| \\ |name (s) -> ?| \\ \\ @@ -575,12 +591,12 @@ Project Public License Distributed from \href{http://www.ctan.org/}{CTAN}\ arch |slope -> r| \\ |mtx -> M| \\ \textbf{Methods} table(\ref{vector:met}) \\ -|new (pt,pt) -> V| \\ -|+ - * -> pt| \\ +|new (p,p) -> V| \\ +|+ - * -> p| \\ |normalize (V) -> V| \\ |orthogonal (d) -> V| \\ |scale (r) -> V| \\ -|at (pt) -> V| \\ +|at (p) -> V| \\ \fbox{\textbf{matrix}} \\ \textbf{Attributes} table(\ref{matrix:att}) \\ |set -> t| \\ @@ -617,23 +633,24 @@ Project Public License Distributed from \href{http://www.ctan.org/}{CTAN}\ arch |tkzsqrtphi -> r| \\ |tkz_epsilon (default=1e-8)-> r| \\ |length -> d| \\ -|islinear(pt,pt,pt) -> b| \\ -|isortho(pt,pt,pt) -> b| \\ +|islinear(p,p,p) -> b| \\ +|isortho(p,p,p) -> b| \\ |value{r} -> r| \\ |real -> r| \\ |angle_normalize (an) -> an| \\ -|barycenter (...) -> pt| \\ -|bisector (pt,pt,pt) -> L| \\ -|bisector_ext (pt,pt,pt) -> L| \\ -|altitude (pt,pt,pt) -> L| \\ -|midpoint (pt,pt) -> pt| \\ -|equilateral (pt,pt) -> T| \\ +|barycenter (...) -> p| \\ +|bisector (p,p,p) -> L| \\ +|bisector_ext (p,p,p) -> L| \\ +|altitude (p,p,p) -> L| \\ +|midpoint (p,p) -> p| \\ +|midpoints (...) -> list of pts| \\ +|equilateral (p,p) -> T| \\ |format_number(r,n) -> r| \\ -|solve_quadratic(cx,cx,cx) -> cx,cx| \\ +|solve_quadratic(cx,cx,cx)-> cx,cx|\\ |\tkzUseLua{v} -> s| \\ \\ \fbox{\textbf{Macros}} \\ |\tkzDN[n]{r} -> r| \\ -|\tkzDrawLuaEllipse((pt,pt,pt))| \\ +|\tkzDrawLuaEllipse((p,p,p))| \\ \end{multicols} \end{document}
\ No newline at end of file diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-news.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-news.tex new file mode 100644 index 0000000000..c84a94b397 --- /dev/null +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-news.tex @@ -0,0 +1,11 @@ +\section{News} % (fold) +\label{sec:news} + +The documentation you are reading corresponds to the latest version (3.10c) of \tkzNamePack{tkz-elements}. +One significant feature introduced in version 3.0 was the use of the \Iprimitive{directlua} macro, replacing the \tkzNameEnv{tkzelements} environment. +In this new version , most functions have been optimized and quelques méthodes apparaissent. In particular, methods for determining a circle tangent to different objects. (see \ref{ssub:c_l_pp}; \ref{ssub:method_c__ll__p}; \ref{ssub:method_c__c__pp}; \ref{ssub:method_c_cc_p}; \ref{ssub:method_c_lc_p}; and \ref{ssub:tr_method_c__ll__p}) + + +% section news (end) +\endinput + diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-organization.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-organization.tex index 1778a7c8fb..480b9d834d 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-organization.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-organization.tex @@ -9,9 +9,7 @@ You can load \tkzname{tkz-euclide} in three different ways. The simplest is |\us The package \pkg{ifthen} is useful if you need to use some Boolean. -The macro \tkzcname{LuaCodeDebugOn} allows you to try and find errors in Lua code. - -While it's possible to leave the Lua code in the \tkzNameEnv{tkzelements} environment, externalizing this code has its advantages. +While it's possible to leave the Lua code in the macro |directlua|, externalizing this code has its advantages. The first advantage is that, if you use a good editor, you have a better presentation of the code. Styles differ between \code{Lua} and \LATEX{}, making the code clearer. This is how I proceeded, then reintegrated the code into the main code. @@ -20,22 +18,19 @@ Another advantage is that you don't have to incorrectly comment the code. For Lu A third advantage is that the code can be reused. - +\begin{minipage}{.5\textwidth} \begin{Verbatim} % !TEX TS-program = lualatex % Created by Alain Matthes on 2024-01-09. - \documentclass[margin = 12pt]{standalone} \usepackage[mini]{tkz-euclide} \usepackage{tkz-elements,ifthen} -\begin{document} -\LuaCodeDebugOn -\begin{tkzelements} +\begin{document} +\directlua{ scale = 1.25 dofile ("sangaku.lua") -\end{tkzelements} - +} \begin{tikzpicture} \tkzGetNodes \tkzDrawCircle(I,F) @@ -45,36 +40,45 @@ A third advantage is that the code can be reused. \end{tikzpicture} \end{document} \end{Verbatim} - -And here is the code for the \code{Lua} part: the file |ex_sangaku.lua| - -\begin{Verbatim} -z.A = point : new ( 0,0 ) -z.B = point : new ( 8,0 ) -L.AB = line : new ( z.A , z.B ) -S = L.AB : square () -_,_,z.C,z.D = get_points (S) -z.F = S.ac : projection (z.B) -L.BF = line : new (z.B,z.F) -T.ABC = triangle : new ( z.A , z.B , z.C ) -L.bi = T.ABC : bisector (2) -z.c = L.bi.pb -L.Cc = line : new (z.C,z.c) -z.I = intersection (L.Cc,L.BF) -\end{Verbatim} - -\begin{tkzelements} - scale = 1.25 +\end{minipage} +\begin{minipage}{.5\textwidth} +\directlua{ + init_elements () + scale = .75 dofile ("sangaku.lua") -\end{tkzelements} +} + +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawCircle(I,F) + \tkzFillPolygon[color = purple](A,C,D)% + \tkzFillPolygon[color = blue!50!black](A,B,C)% + \tkzFillCircle[color = orange](I,F)% + \end{tikzpicture} +\end{center} + +\end{minipage} +And here is the code for the \code{Lua} part: the file |ex_sangaku.lua| -\begin{tikzpicture} - \tkzGetNodes - \tkzDrawCircle(I,F) - \tkzFillPolygon[color = purple](A,C,D)% - \tkzFillPolygon[color = blue!50!black](A,B,C)% - \tkzFillCircle[color = orange](I,F)% -\end{tikzpicture} +\begin{minipage}{.5\textwidth} +\begin{mybox} + \begin{Verbatim} + z.A = point : new ( 0,0 ) + z.B = point : new ( 8,0 ) + L.AB = line : new ( z.A , z.B ) + S = L.AB : square () + _,_,z.C,z.D = get_points (S) + z.F = S.ac : projection (z.B) + L.BF = line : new (z.B,z.F) + T.ABC = triangle : new ( z.A , z.B , z.C ) + L.bi = T.ABC : bisector (2) + z.c = L.bi.pb + L.Cc = line : new (z.C,z.c) + z.I = intersection (L.Cc,L.BF) + \end{Verbatim} +\end{mybox} +\end{minipage} \subsection{Scale problem} % (fold) \label{sub:scale_problem} @@ -82,15 +86,24 @@ z.I = intersection (L.Cc,L.BF) If necessary, it's better to perform scaling in the \code{Lua} section. This approach tends to be more accurate. However, there is a caveat to be aware of. I've made it a point to avoid using numerical values in my codes whenever possible. Generally, these values only appear in the definition of fixed points. If the \code{scale} option is used, scaling is applied when points are created. Let's imagine you want to organize your code as follows: -|scale = 1.5|\\ -|xB = 8|\\ -|z.B = point : new ( xB,0 )| +\begin{mybox}{} + \begin{verbatim} + scale = 1.5 + xB = 8 + z.B = point : new ( xB,0 ) + \end{verbatim} +\end{mybox} + Scaling would then be ineffective, as the numerical values are not modified, only the point coordinates. To account for scaling, use the function \Igfct{math}{value (v) }. -|scale = 1.5|\\ -|xB = value (8)|\\ -|z.B = point : new ( xB,0 )| +\begin{mybox}{} +\begin{verbatim} + scale = 1.5 + xB = value (8) + z.B = point : new ( xB,0 ) +\end{verbatim} +\end{mybox} \subsection{Code presentation} % (fold) \label{sub:code_presentation} diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-presentation.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-presentation.tex index f0689fcc74..3a6a66bf51 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-presentation.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-presentation.tex @@ -4,8 +4,7 @@ \subsection{With Lua} % (fold) \label{sub:with_lua} -The primary function of tkz-elements is to calculate dimensions and define points, which is achieved using Lua. You can view tkz-elements as a kernel that is utilized either by tkz-euclide or by TikZ, -Definitions and calculations take place within the environment \tkzNameEnv{tkzelements}, which is based on \tkzNameEnv{luacode}. +The primary function of tkz-elements is to calculate dimensions and define points, which is achieved using Lua. You can view tkz-elements as a kernel that is utilized either by tkz-euclide or by TikZ. The lua code can be implemented immediately using the \tkzcname{directlua} primitive, or it can take place within a \tkzNameEnv{tkzelements} environment which is based on \tkzNameEnv{luacode}. In the latter case, you need to load the \pkg{luacode} package. In the first case, if you create a complex document, you'll be able to reset the tables and scale with the \Igfct{package}{init\_elements} function. \begin{minipage}[t]{.52\textwidth}\vspace{0pt}% The key points are: @@ -13,12 +12,12 @@ Definitions and calculations take place within the environment \tkzNameEnv{tkze \item The source file must be \tkzEHand\ {\color{red}\uline{ \color{black}UTF8}} encoded. \item Compilation is done with \tkzEHand\ {\color{red}\uline{ \color{black}Lua\LATEX{}}}. \item You need to load \tkzimp{\TIKZ}{} or \tkzimp{tkz-euclide} and \tkzimp{tkz-elements}. - \item Definitions and calculations are performed in an (orthonormal) Cartesian coordinate system, using Luawithin the \tkzimp{tkzelements} environment. + \item Definitions and calculations are performed in an (orthonormal) Cartesian coordinate system, using Lua with the macro \tkzcname{directlua} or within the \tkzimp{tkzelements} environment. \end{itemize} On the right, you can see the minimum template. -The code is divided into two parts, represented by two environments \tkzNameEnv{tkzelements} and \tkzNameEnv{tikzpicture}. In the first environment, you place your Lua code, while in the second, you use tkz-euclide commands. +The code is divided into two parts, represented by lua code, argument to the primitive |\directlua| and the environment \tkzNameEnv{tikzpicture}. In the first part, you place your Lua code, while in the second, you use tkz-euclide commands. \vspace*{4.1 cm}% \end{minipage}\hspace*{\fill} @@ -33,14 +32,14 @@ The code is divided into two parts, represented by two environments \tkzNameEnv \usepackage{tkz-elements} begin{document} -\begin{tkzelements} +\directlua{ scale = 1 % definition of some points z.A = point : new ( , ) z.B = point : new ( , ) ...code... -\end{tkzelements} +} \begin{tikzpicture} % point transfer to Nodes @@ -77,7 +76,7 @@ After obtaining all the necessary points for the drawing, they must be transform \subsubsection{The figure} -\begin{tkzelements} +\directlua{ scale = 1.2 z.A = point: new (0 , 0) z.B = point: new (10 , 0) @@ -102,7 +101,7 @@ After obtaining all the necessary points for the drawing, they must be transform z.P_1 = intersection (C.PC,C.AC) _,z.P_2 = intersection (C.QA,C.CB) z.O_3 = triangle: new ( z.P_0, z.P_1, z.P_2).circumcenter -\end{tkzelements} +} \hspace*{\fill} \begin{tikzpicture} \tkzGetNodes @@ -128,29 +127,29 @@ After obtaining all the necessary points for the drawing, they must be transform \usepackage{tkz-elements} \begin{document} -\begin{tkzelements} +\directlua{ z.A = point: new (0 , 0) -z.B = point: new (10 , 0) -- creation of two fixed points $A$ and $B$ +z.B = point: new (10 , 0) % creation of two fixed points $A$ and $B$ L.AB = line: new ( z.A, z.B) -z.C = L.AB: gold_ratio () -- use of a method linked to “line” -z.O_0 = line: new ( z.A, z.B).mid -- midpoint of segment with an attribute of “line” -z.O_1 = line: new ( z.A, z.C).mid -- objects are not stored and cannot be reused. +z.C = L.AB: gold_ratio () % use of a method linked to “line” +z.O_0 = line: new ( z.A, z.B).mid % midpoint of segment with an attribute of “line” +z.O_1 = line: new ( z.A, z.C).mid % objects are not stored and cannot be reused. z.O_2 = line: new ( z.C, z.B).mid -C.AB = circle: new ( z.O_0, z.B) -- new object “circle” stored and reused +C.AB = circle: new ( z.O_0, z.B) % new object “circle” stored and reused C.AC = circle: new ( z.O_1, z.C) C.CB = circle: new ( z.O_2, z.B) -z.P = C.CB.north -- “north” atrributes of a circle +z.P = C.CB.north % “north” atrributes of a circle z.Q = C.AC.north z.O = C.AB.south -z.c = z.C : north (2) -- “north” method of a point (needs a parameter) -C.PC = circle: new ( z.P, z.C) -C.QA = circle: new ( z.Q, z.A) -z.P_0 = intersection (C.PC,C.AB) -- search for intersections of two circles. -z.P_1 = intersection (C.PC,C.AC) -- idem -_,z.P_2 = intersection (C.QA,C.CB) -- idem -z.O_3 = triangle: new ( z.P_0, z.P_1, z.P_2).circumcenter - -- circumcenter attribute of “triangle” -\end{tkzelements} +z.c = z.C : north (2) % “north” method of a point (needs a parameter) +C.PC = circle: new ( z.P, z.C) +C.QA = circle: new ( z.Q, z.A) +z.P_0 = intersection (C.PC,C.AB) % search for intersections of two circles. +z.P_1 = intersection (C.PC,C.AC) % idem +_,z.P_2 = intersection (C.QA,C.CB) % idem +z.O_3 = triangle: new ( z.P_0, z.P_1, z.P_2).circumcenter + % circumcenter attribute of “triangle” +} \end{Verbatim} \begin{Verbatim} @@ -179,24 +178,25 @@ Here's another example with comments \documentclass{standalone} \usepackage{tkz-euclide,tkz-elements} \begin{document} -\begin{tkzelements} - z.A = point: new (2 , 4) -- we create environment tkzelements - z.B = point: new (0 , 0) -- three fixed points are used +\directlua{ + z.A = point: new (2 , 4) + z.B = point: new (0 , 0) % three fixed points are used z.C = point: new (8 , 0) - T.ABC = triangle: new (z.A,z.B,z.C) -- we create a new triangle object - C.ins = T.ABC: in_circle () -- we get the incircle of this triangle - z.I = C.ins.center -- center is an attribute of the circle - z.T = C.ins.through -- through is also an attribute - -- z.I,z.T = get_points (C.ins) -- get_points is a shortcut - C.cir = T.ABC : circum_circle () -- we get the circumscribed circle - z.W = C.cir.center -- we get the center of this circle - z.O = C.cir.south -- now we get the south pole of this circle - L.AO = line: new (z.A,z.O) -- we create an object "line" - L.BC = T.ABC.bc -- we get the line (BC) - z.I_A = intersection (L.AO,L.BC) -- we search the intersection of the last lines -\end{tkzelements} + T.ABC = triangle: new (z.A,z.B,z.C) % we create a new triangle object + C.ins = T.ABC: in_circle () % we get the incircle of this triangle + z.I = C.ins.center % center is an attribute of the circle + z.T = C.ins.through % through is also an attribute + % z.I,z.T = get_points (C.ins) % get_points is a shortcut + C.cir = T.ABC : circum_circle () % we get the circumscribed circle + z.W = C.cir.center % we get the center of this circle + z.O = C.cir.south % now we get the south pole of this circle + L.AO = line: new (z.A,z.O) % we create an object "line" + L.BC = T.ABC.bc % we get the line (BC) + z.I_A = intersection (L.AO,L.BC) % we search the intersection of the last lines +} \end{Verbatim} -\begin{tkzelements} +\directlua{ + init_elements () scale = 1.2 z.A = point: new (2 , 4) z.B = point: new (0 , 0) @@ -205,14 +205,13 @@ Here's another example with comments C.ins = T.ABC: in_circle () z.I = C.ins.center z.T = C.ins.through --- z.I,z.T = get_points (C.ins) C.cir = T.ABC : circum_circle () z.W = C.cir.center z.O = C.cir.south L.AO = line: new (z.A,z.O) L.BC = T.ABC.bc z.I_A = intersection (L.AO,L.BC) -\end{tkzelements} +} \hspace*{\fill} \begin{tikzpicture} @@ -230,6 +229,7 @@ Here's another example with comments \end{tikzpicture} \hspace*{\fill} +\vspace{12pt} Here's the tikzpicture environment to obtain the drawing: \begin{Verbatim} \begin{tikzpicture} diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-structure.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-structure.tex index d1958d4763..510b43df37 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-structure.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-structure.tex @@ -1,12 +1,10 @@ \section{Structure} % (fold) \label{sec:structure} -\tkzNamePack{tkz-elements} loads the \tkzNamePack{luacode} package to create the \tkzNameEnv{tkzelements} environment, which is based on the \tkzNameEnv{luacode} environment. - -Within the \tkzNameEnv{tkzelements} environment, the scale is initialized to 1, and then all values in various tables are cleared. +After loading the package, the scale is initialized to 1, and then all values in various tables are cleared. The package defines two macros |\tkzGetNodes| and |\tkzUseLua|. -Additionally, the package loads the file |tkz_elements_main.lua|. This file initializes all the tables that will be used by the modules in which the classes are defined. +Additionally, the package loads the file |tkz_elements_main.lua|. This file initializes all the tables that will be used by the modules in which the classes are defined. In this file, a function is defined to reset all tables and the scale. This is the function \Igfct{tkz-elements}{init\_elements}. \begin{tikzpicture}[scale=.75] \begin{scope} @@ -22,9 +20,7 @@ Additionally, the package loads the file |tkz_elements_main.lua|. This file ini L2/.style={level distance=65mm,minimum size=2cm}] node[concept,circular drop shadow] {|tkz-elements.sty|} [clockwise from=10] - child[concept color=MidnightBlue!40,minimum size=16mm] { - node[concept,circular drop shadow] {|luacode|} -} + child[concept color= MidnightBlue!80,minimum size=4cm,text width=38mm, clockwise from=27] { node[concept,circular drop shadow] {|tkz\_elements\_main|} @@ -45,13 +41,11 @@ clockwise from=27] { \end{scope} \end{tikzpicture} -The current classes are (some are still inactive): -\begin{itemize} - \item active : \Iclass{point} (z) ; \Iclass{line} (L) ; \Iclass{circle} (C) ; \Iclass{triangle} (T) ; \Iclass{ellipse} (E) ; \Iclass{quadrilateral} (Q) ; \Iclass{square} (S) ; \Iclass{rectangle} (R) ; \Iclass{parallelogram} (P) ; \Iclass{regular\_polygon} (RP); \Iclass{vector} (V). +The current classes are : + + \Iclass{point} (z) ; \Iclass{line} (L) ; \Iclass{circle} (C) ; \Iclass{triangle} (T) ; \Iclass{ellipse} (E) ; \Iclass{quadrilateral} (Q) ; \Iclass{square} (S) ; \Iclass{rectangle} (R) ; \Iclass{parallelogram} (P) ; \Iclass{regular\_polygon} (RP); \Iclass{vector} (V) and \Iclass{matrix} (M). - \item inactive : matrix (M) ; vector (V). -\end{itemize} If |name| is name of a class, you can find its definition in the file |tkz_elements_name.lua|. diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-theorems.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-theorems.tex new file mode 100644 index 0000000000..681bae5392 --- /dev/null +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-theorems.tex @@ -0,0 +1,747 @@ +\newpage + +\section{Some theorems} % (fold) +\label{sec:some_theorems} + +\subsection{Viviani's Theorem} % (fold) +\label{sub:viviani_s_theorem} +Viviani's theorem, named after Vincenzo Viviani, states that the sum of the shortest distances from any interior point to the sides of an equilateral triangle equals the length of the triangle's altitude. +[Wikipedia]. + +Here's the visual demonstration I gave at the CAPES oral exam in 1989 to become a teacher. + +\vspace{6pt} +\begin{minipage}{0.5\textwidth} +\begin{Verbatim} +\directlua{ +z.A = point: new (0 , 0) +z.B = point: new (8 , 0) +L.AB = line: new (z.A,z.B) +T.equ = L.AB:equilateral () +z.C = T.equ.pc +z.I = point:new (3,2) +L.IAB = T.equ.ab:ll_from(z.I) +L.IBC = T.equ.bc:ll_from(z.I) +L.ICA = T.equ.ca:ll_from(z.I) +z.b = intersection(L.IAB,T.equ.ca) +z.a = intersection(L.IAB,T.equ.bc) +z.c = intersection(L.IBC,T.equ.ab) +z.d = intersection(L.IBC,T.equ.ca) +z.e = intersection(L.ICA,T.equ.ab) +z.f = intersection(L.ICA,T.equ.bc) +L.last = T.equ.ab:ll_from(z.f) +z.g = intersection(L.last,T.equ.ca) +z.pC = L.last:projection(z.C) +z.pIca = T.equ.ca:projection(z.I) +z.pIbc = T.equ.bc:projection(z.I) +z.pIAB = L.IAB:projection(z.f) +z.pIab = T.equ.ab:projection(z.I) +} +\begin{tikzpicture} +\tkzGetNodes +\tkzDrawPolygons(A,B,C) +\tkzDrawSegments(a,b c,d e,f f,g) +\tkzDrawSegments[red,thick](C,pC I,pIab f,pIAB) +\tkzDrawSegments[red, dashed](I,pIbc I,pIca) +\end{tikzpicture} +\end{Verbatim} +\end{minipage} +\begin{minipage}{0.5\textwidth} +\directlua{ +z.A = point: new (0 , 0) +z.B = point: new (8 , 0) +L.AB = line: new (z.A,z.B) +T.equ = L.AB:equilateral () +z.C = T.equ.pc +z.I = point:new (3,2) +L.IAB = T.equ.ab:ll_from(z.I) +L.IBC = T.equ.bc:ll_from(z.I) +L.ICA = T.equ.ca:ll_from(z.I) +z.b = intersection(L.IAB,T.equ.ca) +z.a = intersection(L.IAB,T.equ.bc) +z.c = intersection(L.IBC,T.equ.ab) +z.d = intersection(L.IBC,T.equ.ca) +z.e = intersection(L.ICA,T.equ.ab) +z.f = intersection(L.ICA,T.equ.bc) +L.last = T.equ.ab:ll_from(z.f) +z.g = intersection(L.last,T.equ.ca) +z.pC = L.last:projection(z.C) +z.pIca = T.equ.ca:projection(z.I) +z.pIbc = T.equ.bc:projection(z.I) +z.pIAB = L.IAB:projection(z.f) +z.pIab = T.equ.ab:projection(z.I) +} +\begin{tikzpicture} +\tkzGetNodes +\tkzDrawPolygons(A,B,C) +\tkzDrawSegments(a,b c,d e,f f,g) +\tkzDrawSegments[red,thick](C,pC I,pIab f,pIAB) +\tkzDrawSegments[red, dashed](I,pIbc I,pIca) +\end{tikzpicture} +\end{minipage} + +% subsection viviani_s_theorem (end) + + +\subsection{Reuschle's theorem} % (fold) +\label{sub:reuschle_s_theorem} +In elementary geometry, Reuschle's theorem describes a property of the cevians of a triangle intersecting in a common point and is named after the German mathematician Karl Gustav Reuschle (1812–1875). It is also known as Terquem's theorem after the French mathematician Olry Terquem (1782–1862), who published it in 1842. + +\vspace{6pt} + +\begin{minipage}{0.5\textwidth} +\begin{Verbatim} +\directlua{ +init_elements () +z.A = point:new(0, 0) +z.B = point:new(8, 0) +z.C = point:new(5, 5) +z.P = point:new(4, 2) +T.ABC = triangle:new(z.A,z.B,z.C) +T.cev = T.ABC:cevian (z.P) +z.D, +z.E, +z.F = get_points(T.cev) +C.cev = T.ABC :cevian_circle (z.P) +z.O = C.cev.center +z.T = C.cev.through +z.G = intersection(C.cev,T.ABC.ca) +_,z.H = intersection(C.cev,T.ABC.ab) +z.I = intersection(C.cev,T.ABC.bc) +L.AI = line:new(z.A,z.I) +L.BG = line:new(z.B,z.G) +z.K = intersection(L.AI,L.BG) +} +\begin{tikzpicture} +\tkzGetNodes +\tkzDrawPolygons(A,B,C) +\tkzDrawPoints(A,...,I,P,K) +\tkzDrawSegments(A,D B,E C,F A,I B,G C,H) +\tkzDrawCircle(O,T) +\tkzLabelPoints[below](A,B) +\tkzLabelPoints[above](C,I,E,D,G,K) +\tkzLabelPoints[below](F,P,H) +\end{tikzpicture} +\end{Verbatim} +\end{minipage} +\begin{minipage}{0.5\textwidth} +\directlua{ +init_elements () +z.A = point : new ( 0 , 0 ) +z.B = point : new ( 8 , 0 ) +z.C = point : new ( 5 , 5 ) +z.P = point : new ( 4 , 2 ) +T.ABC = triangle : new (z.A,z.B,z.C) +T.cev = T.ABC : cevian (z.P) +z.D, +z.E, +z.F = get_points(T.cev) +C.cev = T.ABC :cevian_circle (z.P) +z.O = C.cev.center +z.T = C.cev.through +z.G = intersection(C.cev,T.ABC.ca) +_,z.H = intersection(C.cev,T.ABC.ab) +z.I = intersection(C.cev,T.ABC.bc) +L.AI = line:new(z.A,z.I) +L.BG = line:new(z.B,z.G) +z.K = intersection(L.AI,L.BG) +} +\begin{tikzpicture} +\tkzGetNodes +\tkzDrawPolygons(A,B,C) +\tkzDrawPoints(A,...,I,P,K) +\tkzDrawSegments(A,D B,E C,F A,I B,G C,H) +\tkzDrawCircle(O,T) +\tkzLabelPoints[below](A,B) +\tkzLabelPoints[above](C,I,E,D,G,K) +\tkzLabelPoints[below](F,P,H) +\end{tikzpicture} +\end{minipage} + +% subsection reuschle_s_theorem (end) + +\subsection{Thébault's problem III} % (fold) +\label{sub:thebault_s_problemIII} +Given any triangle ABC, and any point M on BC, construct the incircle and circumcircle of the triangle. Then construct two additional circles, each tangent to AM, BC, and to the circumcircle. Then their centers and the center of the incircle are collinear.[wikipedia] +\vspace{6pt} + +\begin{minipage}{0.5\textwidth} +\begin{Verbatim} +\directlua{ +init_elements() +scale = .75 +z.A = point : new(0, 0) +z.B = point : new(8, 0) +z.C = point : new(1, 6) +z.M = point : new(5, 0) +L.CM = line:new(z.C,z.M) +T.ABC = triangle:new(z.A,z.B,z.C) +C.circ = T.ABC:circum_circle() +z.O = C.circ.center +C.ins = T.ABC:in_circle() +z.I = C.ins.center +z.T = C.ins.through +L.ll = T.ABC.ab: ll_from(z.I) +z.Q = intersection(L.ll,L.CM) +C.QI = circle:new(z.Q,z.I) +z.R,z.S= intersection(C.QI,L.CM) +L.BMC = bisector(z.M,z.B,z.C) +z.x = L.BMC.pb +L.CMA = bisector(z.M,z.C,z.A) +z.y = L.CMA.pb +L.pS = L.CM:ortho_from(z.S) +L.pR = L.CM:ortho_from(z.R) +z.J = intersection(L.pS,L.CMA) +z.K = intersection(L.pR,L.BMC) +} +\begin{tikzpicture} +\tkzGetNodes +\tkzDrawPolygon(A,B,C) +\tkzDrawSegments(C,M) +\tkzDrawLines(J,K I,Q) +\tkzDrawCircles(O,A I,T Q,I J,S K,R) +\tkzDrawPoints(A,B,C,M,Q,I,R,S,J,K) +\tkzLabelPoints(A,B,C,M,Q,I,R,S,J,K) +\end{tikzpicture} +\end{Verbatim} +\end{minipage} +\begin{minipage}{0.5\textwidth} +\directlua{ +init_elements() +scale = .75 +z.A = point : new ( 0 , 0 ) +z.B = point : new ( 8 , 0 ) +z.C = point : new (1 , 6 ) +z.M = point : new (5 , 0 ) +L.CM = line:new(z.C,z.M) +T.ABC = triangle:new(z.A,z.B,z.C) +C.circ = T.ABC:circum_circle() +z.O = C.circ.center +C.ins = T.ABC:in_circle() +z.I = C.ins.center +z.T = C.ins.through +L.ll = T.ABC.ab: ll_from(z.I) +z.Q =intersection(L.ll,L.CM) +C.QI = circle:new(z.Q,z.I) +z.R,z.S = intersection(C.QI,L.CM) +L.BMC = bisector(z.M,z.B,z.C) +z.x = L.BMC.pb +L.CMA = bisector(z.M,z.C,z.A) +z.y = L.CMA.pb +L.pS = L.CM:ortho_from(z.S) +L.pR = L.CM:ortho_from(z.R) +z.J = intersection(L.pS,L.CMA) +z.K = intersection(L.pR,L.BMC) +} +\begin{tikzpicture} +\tkzGetNodes +\tkzDrawPolygon(A,B,C) +\tkzDrawSegments(C,M) +\tkzDrawLines(J,K I,Q) +\tkzDrawCircles(O,A I,T Q,I J,S K,R) +\tkzDrawPoints(A,B,C,M,Q,I,R,S,J,K) +\tkzLabelPoints(A,B,C,M,Q,I,R,S,J,K) +\end{tikzpicture} +\end{minipage} + +% subsection thebault_s_problemIII (end) + +\subsection{Thebault's problem II} % (fold) +\label{sub:thebault_s_problemII} + +Given a square, construct equilateral triangles on two adjacent edges, either both inside or both outside the square. Then the triangle formed by joining the vertex of the square distant from both triangles and the vertices of the triangles distant from the square is equilateral.[wikipedia] + +\vspace{6pt} +\begin{minipage}{0.5\textwidth} +\begin{Verbatim} +\directlua{ +init_elements() +scale = .75 +z.A = point : new ( 0 , 0 ) +z.B = point : new ( 8 , 0 ) +L.AB = line:new (z.A,z.B) +S.ABCD = L.AB:square() +z.C = S.ABCD.pc +z.D = S.ABCD.pd +z.E = S.ABCD.ab:equilateral().pc +z.F = S.ABCD.bc:equilateral().pc +} +\begin{tikzpicture} +\tkzGetNodes +\tkzDrawPolygon(A,B,C,D) +\tkzDrawPolygons[cyan](A,B,E B,C,F) +\tkzFillPolygon[fill=orange!20](D,E,F) +\tkzDrawPolygons[orange,thick](D,E,F) +\end{tikzpicture} +\end{Verbatim} +\end{minipage} +\begin{minipage}{0.5\textwidth} +\directlua{ +init_elements() +scale = .75 +z.A = point : new ( 0 , 0 ) +z.B = point : new ( 8 , 0 ) +L.AB = line:new (z.A,z.B) +S.ABCD = L.AB:square() +z.C = S.ABCD.pc +z.D = S.ABCD.pd +z.E = S.ABCD.ab:equilateral().pc +z.F = S.ABCD.bc:equilateral().pc +} +\begin{tikzpicture} +\tkzGetNodes +\tkzDrawPolygon(A,B,C,D) +\tkzDrawPolygons[cyan](A,B,E B,C,F) +\tkzFillPolygon[fill=orange!20](D,E,F) +\tkzDrawPolygons[orange,thick](D,E,F) +\end{tikzpicture} +\end{minipage} + + +% subsection thebault_s_problemII (end) + +\subsection{Varignon's Theorem} % (fold) +\label{sub:varignon_s_theorem} +In Euclidean geometry, Varignon's theorem holds that the midpoints of the sides of an arbitrary quadrilateral form a parallelogram, called the Varignon parallelogram. It is named after Pierre Varignon, whose proof was published posthumously in 1731. [Wikipedia] + +\vspace{6pt} +\begin{minipage}{0.5\textwidth} +\begin{Verbatim} +\directlua{ +init_elements() +scale = .75 +z.A = point : new ( 0 , 0 ) +z.B = point : new ( 0 , 8 ) +z.C = point : new ( 5 , 3 ) +z.D = point : new ( -1 , 6 ) +Q.ABCD = quadrilateral:new(z.A, z.B, z.C, z.D) +z.E,z.F,z.G,z.H = midpoints(z.A,z.B,z.C,z.D) + } +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygon(A,B,C,D) + \tkzDrawPolygon[red](E,F,G,H) + \tkzDrawPoints(A,B,C,D) + \tkzDrawPoints[red](E,F,G,H) + \tkzLabelPoints(A,C) + \tkzLabelPoints[above right](B,D) + \tkzLabelPoints[red](G,H) + \tkzLabelPoints[red,above right](E,F) +\end{tikzpicture} +\end{Verbatim} +\end{minipage} +\begin{minipage}{0.5\textwidth} +\directlua{ +init_elements() +scale = .75 +z.A = point : new ( 0 , 0 ) +z.B = point : new ( 0 , 8 ) +z.C = point : new ( 5 , 3 ) +z.D = point : new ( -1 , 6 ) +Q.ABCD = quadrilateral:new(z.A, z.B, z.C, z.D) +z.E,z.F,z.G,z.H = midpoints(z.A,z.B,z.C,z.D) +} +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygon(A,B,C,D) + \tkzDrawPolygon[red](E,F,G,H) + \tkzDrawPoints(A,B,C,D) + \tkzDrawPoints[red](E,F,G,H) + \tkzLabelPoints(A,C) + \tkzLabelPoints[above right](B,D) + \tkzLabelPoints[red](G,H) + \tkzLabelPoints[red,above right](E,F) + \end{tikzpicture} +\end{center} + +\end{minipage} + +% subsection varignon_s_theorem (end) + + +\subsection{Wittenbauer's Parallelogram} % (fold) +\label{sub:wittenbauer_s_parallelogram} + +Divide the sides of a quadrilateral into three equal parts. The figure formed by connecting and extending adjacent points on either side of a polygon vertex is a parallelogram known as Wittenbauer's parallelogram. +[\href{https://mathworld.wolfram.com/WittenbauersParallelogram.html}{Weisstein, Eric W. "Wittenbauer's Parallelogram." From MathWorld--A Wolfram Web Resource.}] + +\vspace{6pt} + +\begin{minipage}{0.5\textwidth} +\begin{Verbatim} +\directlua{ +init_elements() +scale = .75 +z.A = point : new ( 0 , 0 ) +z.B = point : new ( 4 , 0 ) +z.C = point : new ( 5 , 3 ) +z.D = point : new ( -1 , 4 ) +Q.ABCD = quadrilateral:new (z.A, z.B, z.C, z.D) +z.P_1 = Q.ABCD.ab:point(1/3) +z.P_2 = Q.ABCD.ab:point(2/3) +z.P_3 = Q.ABCD.bc:point(1/3) +z.P_4 = Q.ABCD.bc:point(2/3) +z.P_5 = Q.ABCD.cd:point(1/3) +z.P_6 = Q.ABCD.cd:point(2/3) +z.P_7 = Q.ABCD.da:point(1/3) +z.P_8 = Q.ABCD.da:point(2/3) +L.P18 = line:new(z.P_1,z.P_8) +L.P23 = line:new(z.P_2,z.P_3) +L.P45 = line:new(z.P_4,z.P_5) +L.P67 = line:new(z.P_6,z.P_7) +z.K = intersection(L.P18,L.P23) +z.L = intersection(L.P23,L.P45) +z.M = intersection(L.P45,L.P67) +z.N = intersection(L.P67,L.P18) +} +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawPolygon(A,B,C,D) + \tkzDrawPolygon[red](K,L,M,N) + \tkzDrawSegments(A,C B,D) + \tkzDrawPoints(A,B,C,D) +\end{tikzpicture} +\end{Verbatim} +\end{minipage} +\begin{minipage}{0.5\textwidth} +\directlua{ +init_elements() +scale = .75 +z.A = point : new ( 0 , 0 ) +z.B = point : new ( 4 , 0 ) +z.C = point : new ( 5 , 3 ) +z.D = point : new ( -1 , 4 ) +Q.ABCD = quadrilateral : new ( z.A , z.B , z.C , z.D ) +z.P_1 = Q.ABCD.ab:point(1/3) +z.P_2 = Q.ABCD.ab:point(2/3) +z.P_3 = Q.ABCD.bc:point(1/3) +z.P_4 = Q.ABCD.bc:point(2/3) +z.P_5 = Q.ABCD.cd:point(1/3) +z.P_6 = Q.ABCD.cd:point(2/3) +z.P_7 = Q.ABCD.da:point(1/3) +z.P_8 = Q.ABCD.da:point(2/3) +L.P18 = line:new(z.P_1,z.P_8) +L.P23 = line:new(z.P_2,z.P_3) +L.P45 = line:new(z.P_4,z.P_5) +L.P67 = line:new(z.P_6,z.P_7) +z.K = intersection(L.P18,L.P23) +z.L = intersection(L.P23,L.P45) +z.M = intersection(L.P45,L.P67) +z.N = intersection(L.P67,L.P18) +} + +\begin{tikzpicture} +\tkzGetNodes +\tkzDrawPolygon(A,B,C,D) +\tkzDrawPolygon[red](K,L,M,N) +\tkzDrawSegments(A,C B,D) +\tkzDrawPoints(A,B,C,D) +\end{tikzpicture} +\end{minipage} +% subsection wittenbauer_s_parallelogram (end) + +\subsection{Soddy circles of a triangle} % (fold) +\label{sub:soddy_circles_of_a_triangle} + +In geometry, the Soddy circles of a triangle are two circles associated with any triangle in the plane.[wikipedia] + + Given three noncollinear points, construct three tangent circles such that one is centered at each point and the circles are pairwise tangent to one another. Then there exist exactly two nonintersecting circles that are tangent to all three circles. These are called the inner and outer Soddy circles, and their centers are called the inner and outer Soddy centers, respectively. + +[\href{https://mathworld.wolfram.com/SoddyCircles.html}{ Weisstein, Eric W. "Soddy Circles." From MathWorld--A Wolfram Web Resource}] + + +\subsubsection{Soddy circle without function} % (fold) +\label{ssub:soddy} + +\begin{Verbatim} +\directlua{% +init_elements () +z.A = point : new ( 0 , 0 ) +z.B = point : new ( 5 , 0 ) +z.C = point : new ( 0.5 , 4 ) +T.ABC = triangle : new ( z.A,z.B,z.C ) +z.I = T.ABC.incenter +z.E,z.F,z.G = T.ABC : projection (z.I) +C.ins = circle : new (z.I,z.E) +T.orthic = T.ABC : orthic () +z.Ha,z.Hb,z.Hc = get_points (T.orthic) +C.CF = circle : new ( z.C , z.F ) +C.AG = circle : new ( z.A , z.G ) +C.BE = circle : new ( z.B , z.E ) +L.Ah = line : new ( z.A , z.Ha ) +L.Bh = line : new ( z.B , z.Hb ) +L.Ch = line : new ( z.C , z.Hc ) +z.X,z.Xp = intersection (L.Ah,C.AG) +z.Y,z.Yp = intersection (L.Bh,C.BE) +z.Z,z.Zp = intersection (L.Ch,C.CF) +L.XpE = line : new (z.Xp,z.E) +L.YpF = line : new (z.Yp,z.F) +L.ZpG = line : new (z.Zp,z.G) +z.S = intersection (L.XpE,L.YpF) +z.Xi = intersection(L.XpE,C.AG) +z.Yi = intersection(L.YpF,C.BE) +_,z.Zi = intersection(L.ZpG,C.CF) +z.S = triangle : new (z.Xi,z.Yi,z.Zi).circumcenter +C.soddy_int = circle : new (z.S,z.Xi) +C.soddy_ext = C.ins : inversion (C.soddy_int) +z.w = C.soddy_ext.center +z.s = C.soddy_ext.through +z.Xip,z.Yip,z.Zip = C.ins : inversion (z.Xi,z.Yi,z.Zi) +} + +\begin{tikzpicture} +\tkzGetNodes +\tkzDrawPolygon(A,B,C) +\tkzDrawPoints(A,B,C,E,F,G,Ha,Hb,Hc,X,Y,Z,X',Y',Z',Xi,Yi,Zi,I) +\tkzDrawPoints(Xi',Yi',Zi',S) +\tkzLabelPoints(A,B,C,E,F,G,X,Y,Z,X',Y',Z') +\tkzDrawCircles(A,G B,E C,F I,E S,Xi w,s) +\tkzDrawLines(X',Ha Y',Hb Z',Hc) +\tkzDrawLines(X',E Y',F Z',G) +\end{tikzpicture} +\end{Verbatim} + +\directlua{% +init_elements () +z.A = point : new ( 0 , 0 ) +z.B = point : new ( 5 , 0 ) +z.C = point : new ( 0.5 , 4 ) +T.ABC = triangle : new ( z.A,z.B,z.C ) +z.I = T.ABC.incenter +z.E,z.F,z.G = T.ABC : projection (z.I) +C.ins = circle : new (z.I,z.E) +T.orthic = T.ABC : orthic () +z.Ha,z.Hb,z.Hc = get_points (T.orthic) +C.CF = circle : new ( z.C , z.F ) +C.AG = circle : new ( z.A , z.G ) +C.BE = circle : new ( z.B , z.E ) +L.Ah = line : new ( z.A , z.Ha ) +L.Bh = line : new ( z.B , z.Hb ) +L.Ch = line : new ( z.C , z.Hc ) +z.X,z.Xp = intersection (L.Ah,C.AG) +z.Y,z.Yp = intersection (L.Bh,C.BE) +z.Z,z.Zp = intersection (L.Ch,C.CF) +L.XpE = line : new (z.Xp,z.E) +L.YpF = line : new (z.Yp,z.F) +L.ZpG = line : new (z.Zp,z.G) +z.S = intersection (L.XpE,L.YpF) +z.Xi = intersection(L.XpE,C.AG) +z.Yi = intersection(L.YpF,C.BE) +_,z.Zi = intersection(L.ZpG,C.CF) +z.S = triangle : new (z.Xi,z.Yi,z.Zi).circumcenter +C.soddy_int = circle : new (z.S,z.Xi) +C.soddy_ext = C.ins : inversion (C.soddy_int) +z.w = C.soddy_ext.center +z.s = C.soddy_ext.through +z.Xip,z.Yip,z.Zip = C.ins : inversion (z.Xi,z.Yi,z.Zi) +} + +\begin{tikzpicture} +\tkzGetNodes +\tkzDrawPolygon(A,B,C) +\tkzDrawPoints(A,B,C,E,F,G,Ha,Hb,Hc,X,Y,Z,X',Y',Z',Xi,Yi,Zi,I) +\tkzDrawPoints(Xi',Yi',Zi',S) +\tkzLabelPoints(A,B,C,E,F,G,X,Y,Z,X',Y',Z') +\tkzDrawCircles(A,G B,E C,F I,E S,Xi w,s) +\tkzDrawLines(X',Ha Y',Hb Z',Hc) +\tkzDrawLines(X',E Y',F Z',G) +\end{tikzpicture} +% subsubsection soddy (end) + +\subsubsection{Soddy circle with function} % (fold) +\label{ssub:soddy_circle_with_function} + +\directlua{% +init_elements () +z.A = point : new ( 0 , 0 ) +z.B = point : new ( 5 , 0 ) +z.C = point : new (4 , 4 ) +T.ABC = triangle : new ( z.A,z.B,z.C ) +z.I = T.ABC.incenter +z.E,z.F,z.G = T.ABC : projection (z.I) +T.orthic = T.ABC : orthic () +z.Ha,z.Hb,z.Hc = get_points (T.orthic) +C.ins = circle : new (z.I,z.E) +z.s,z.xi,z.yi,z.zi = T.ABC : soddy_center () +C.soddy_int = circle : new (z.s,z.xi) +C.soddy_ext = C.ins : inversion (C.soddy_int) +z.w = C.soddy_ext.center +z.t = C.soddy_ext.through +z.Xip,z.Yip,z.Zip = C.ins : inversion (z.xi,z.yi,z.zi) +} + +\begin{minipage}{.5\textwidth} + \begin{Verbatim} + \directlua{% +init_elements () + z.A = point : new ( 0 , 0 ) + z.B = point : new ( 5 , 0 ) + z.C = point : new (4 , 4 ) + T.ABC = triangle : new ( z.A,z.B,z.C ) + z.I = T.ABC.incenter + z.E,z.F,z.G = T.ABC : projection (z.I) + T.orthic = T.ABC : orthic () + z.Ha,z.Hb,z.Hc = get_points (T.orthic) + C.ins = circle : new (z.I,z.E) + z.s,z.xi,z.yi, + z.zi = T.ABC : soddy_center () + C.soddy_int = circle : new (z.s,z.xi) + C.soddy_ext = C.ins : inversion (C.soddy_int) + z.w = C.soddy_ext.center + z.t = C.soddy_ext.through + z.Xip,z.Yip, + z.Zip = C.ins : inversion (z.xi,z.yi,z.zi) + } +\end{Verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} +\begin{tikzpicture}[scale=.6] +\tkzGetNodes +\tkzDrawPolygon(A,B,C) +\tkzDrawCircles(A,G B,E C,F I,E s,xi w,t) +\tkzDrawPoints(A,B,C,E,F,G,s,w,xi,t) +\tkzLabelPoints(A,B,C) +\tkzDrawPoints(A,B,C,E,F,G,Ha,Hb,Hc,xi,yi,zi,I) +\tkzDrawPoints(Xi',Yi',Zi') +\tkzLabelPoints(A,B,C,E,F,G) +\end{tikzpicture} +\end{minipage} + +\begin{Verbatim} +\begin{tikzpicture} +\tkzGetNodes +\tkzDrawPolygon(A,B,C) +\tkzDrawCircles(A,G B,E C,F I,E s,xi w,t) +\tkzDrawPoints(A,B,C,E,F,G,s,w,xi,t) +\tkzLabelPoints(A,B,C) +\tkzDrawPoints(A,B,C,E,F,G,Ha,Hb,Hc,xi,yi,zi,I) +\tkzDrawPoints(Xi',Yi',Zi') +\tkzLabelPoints(A,B,C,E,F,G) +\end{tikzpicture} +\end{Verbatim} +% subsubsection soddy_circle_with_function (end) + + +% subsection soddy_circles_of_a_triangle (end) + +\subsection{Six circles in a triangle} % (fold) +\label{sub:six_circles_in_a_triangle} +In geometry, the six circles theorem relates to a chain of six circles together with a triangle, such that each circle is tangent to two sides of the triangle and also to the preceding circle in the chain. The chain closes, in the sense that the sixth circle is always tangent to the first circle.[1][2] It is assumed in this construction that all circles lie within the triangle, and all points of tangency lie on the sides of the triangle. [Wikipedia] + +\vspace{6pt} +The file \code{search\_circle.lua} used in this example: + +\begin{mybox} + \begin{Verbatim} + local r =... + + function newcircle (T,C) + local NT,L,NC,c,t + NT = T.incenter : homothety ((1+C.radius/T.inradius),T) + L = line : new (NT.pb,NT.pa) + _,NC = L : c_ll_p(NT.pc,C.center) + return NC.center,T.bc:projection(NC.center) + end + + z.A = point : new ( 0 , 0 ) + z.B = point : new ( 8 , 0 ) + z.C = point : new ( 2 , 6 ) + T.ABC = triangle : new (z.A,z.B,z.C) + L.bA = T.ABC : bisector () + z.c1 = L.bA : report(r) + z.t1 = T.ABC.ab : projection(z.c1) + C.last = circle : new(z.c1,z.t1) + + local vertices = {"A", "B", "C"} + for i = 2, 6 do + T.used = triangle : new( + z[vertices[math.fmod(i - 2, 3) + 1]], + z[vertices[math.fmod(i - 1, 3) + 1]], + z[vertices[math.fmod(i, 3) + 1]] ) + z["c" .. i], z["t" .. i] = newcircle(T.used, C.last) + C.last = circle : new(z["c" .. i], z["t" .. i]) + end + \end{Verbatim} +\end{mybox} + + +\vspace{6pt} +\begin{minipage}{.5\textwidth} +\begin{Verbatim} +\directlua{ +init_elements () +z.A = point : new ( 0 , 0 ) +z.B = point : new ( 8 , 0 ) +z.C = point : new ( 2 , 6 ) +loadfile ("search_circle.lua")(1.4) +} +\begin{tikzpicture} +\tkzGetNodes +\tkzFillPolygon[lightgray!30](A,B,C) +\foreach \n/\c in {1/red,2/orange,% +3/yellow,4/green,5/blue,6/violet} + {\tkzFillCircle[\c!30,opacity=.4](c\n,t\n) + \tkzDrawCircle[thick,\c](c\n,t\n)} +\tkzDrawPolygon[thick](A,B,C) +\tkzDrawPoints(A,B,C) +\end{tikzpicture} +\end{Verbatim} +\end{minipage} +\begin{minipage}{.5\textwidth} +\directlua{ +init_elements () +z.A = point : new ( 0 , 0 ) +z.B = point : new ( 8 , 0 ) +z.C = point : new ( 2 , 6 ) +loadfile ("search_circle.lua")(1.4) +} +\begin{tikzpicture} +\tkzGetNodes +\tkzFillPolygon[lightgray!30](A,B,C) +\foreach \n/\c in {1/red,2/orange,3/yellow,4/green,5/blue,6/violet} + {\tkzFillCircle[\c!30,opacity=.4](c\n,t\n) + \tkzDrawCircle[thick,\c](c\n,t\n) } +\tkzDrawPolygon[thick](A,B,C) +\tkzDrawPoints(A,B,C) +\end{tikzpicture} +\end{minipage} + +\vspace{12pt} +When the first circle is the incircle then you get only 4 circles. + +\begin{minipage}{.5\textwidth} +\begin{mybox} + \begin{Verbatim} + T.ABC = triangle : new (z.A,z.B,z.C) + R = T.ABC.inradius/math.sin((T.ABC.alpha)/2) + loadfile ("search_circle.lua")(R) + } + \end{Verbatim} +\end{mybox} +\end{minipage} +\begin{minipage}{.5\textwidth} +\directlua{ +scale =1.5 +init_elements () +z.A = point : new ( 0 , 0 ) +z.B = point : new ( 8 , 0 ) +z.C = point : new ( 2 , 6 ) +T.ABC = triangle : new (z.A,z.B,z.C) +R = T.ABC.inradius/math.sin((T.ABC.alpha)/2) + loadfile ("search_circle.lua")(R) + } +\begin{tikzpicture} +\tkzGetNodes +\tkzFillPolygon[lightgray!30](A,B,C) +\foreach \n/\c in {1/red,2/orange,3/yellow,4/green,5/blue,6/violet} + {\tkzFillCircle[\c!30,opacity=.4](c\n,t\n) + \tkzDrawCircle[thick,\c](c\n,t\n) } +\tkzDrawPolygon[thick](A,B,C) +\tkzDrawPoints(A,B,C) +\end{tikzpicture} +\end{minipage} + + +% subsection six_circles_in_a_triangle (end) +% section some_theorems (end)
\ No newline at end of file diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-transfers.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-transfers.tex index 264097e9b8..1459bdfb42 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-transfers.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-transfers.tex @@ -5,11 +5,11 @@ \subsection{From Lua to tkz-euclide or TikZ} % (fold) \label{sub:fom_lua_to_tkz_euclide_or_tikz} -In this section, we'll explore how to transfer points, Booleans, and numerical values. +In this section, we'll explore how to transfer points, booleans, and numerical values. \subsubsection{Points transfer} % (fold) \label{ssub:points_transfer} -We utilize an environment \tkzname{tkzelements} outside an \tkzname{tikzpicture} environment which allows us to perform all the necessary calculations. Then, we execute the macro \Imacro{tkzGetNodes} which transforms the affixes of the table |z| into \tkzname{Nodes}. Finally, we proceed with the drawing. +The necessary definitions and calculations are performed with the primitive \tkzcname{directlua} or inside the environment \tkzNameEnv{tkzelements}. Then, we execute the macro \Imacro{tkzGetNodes} which transforms the affixes of the table |z| into \tkzname{Nodes}. Finally, we proceed with the drawing. At present, the drawing program is either \TIKZ\ or \pkg{tkz-euclide}. However, you have the option to use another package for plotting. To do so, you'll need to create a macro similar to \tkzcname{tkzGetNodes}. Of course, this package must be capable of storing points like \TIKZ\ or \pkg{tkz-euclide}. @@ -34,18 +34,20 @@ end} \end{mybox} See the section In-depth Study \ref{sec:in_depth_study} for an explanation of the previous code. -The environment \tkzNameEnv{tkzelements} allows to use the underscore |_| and the macro \tkzcname{tkzGetNodes} allows to obtain names of nodes containing \tkzname{prime} or \tkzname{double prime}. (Refer to the next example) +Point names can contain the underscore |_| and the macro \tkzcname{tkzGetNodes} allows to obtain names of nodes containing \tkzname{prime} or \tkzname{double prime}. (Refer to the next example) +\vspace{6pt} \begin{minipage}{0.5\textwidth} \begin{Verbatim} -\begin{tkzelements} - scale = 1.2 +\directlua{ + init_elements () + scale = 1.5 z.o = point: new (0,0) z.a_1 = point: new (2,1) z.a_2 = point: new (1,2) z.ap = z.a_1 + z.a_2 z.app = z.a_1 - z.a_2 -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawSegments(o,a_1 o,a_2 o,a' o,a'') @@ -57,14 +59,15 @@ The environment \tkzNameEnv{tkzelements} allows to use the underscore |_| and th \end{Verbatim} \end{minipage} \begin{minipage}{0.5\textwidth} -\begin{tkzelements} - scale = 1.2 +\directlua{ + init_elements () + scale = 1.5 z.o = point: new (0,0) z.a_1 = point: new (2,1) z.a_2 = point: new (1,2) z.ap = z.a_1 + z.a_2 z.app = z.a_1 - z.a_2 -\end{tkzelements} +} \hspace{\fill} \begin{tikzpicture} \tkzGetNodes @@ -78,44 +81,22 @@ The environment \tkzNameEnv{tkzelements} allows to use the underscore |_| and th \end{minipage}% \newpage +% subsubsection points_transfer (end) % subsection fom_lua_to_tkz_euclide_or_tikz (end) + \subsubsection{Other transfers} % (fold) \label{ssub:other_transfers} Sometimes it's useful to transfer angle, length measurements or boolean. For this purpose, I have created the macro (refer to \ref{sub:transfer_from_lua_to_tex}) \IEmacro{tkzUseLua(value)} -\begin{Verbatim} -\begin{tkzelements} - z.b = point: new (1,1) - z.a = point: new (4,2) - z.c = point: new (2,2) - z.d = point: new (5,1) - L.ab = line : new (z.a,z.b) - L.cd = line : new (z.c,z.d) - det = (z.b-z.a)^(z.d-z.c) - if det == 0 then bool = true - else bool = false - end - x = intersection (L.ab,L.cd) -\end{tkzelements} - -The intersection of the two lines lies at - a point whose affix is:\tkzUseLua{x} - -\begin{tikzpicture} - \tkzGetNodes - \tkzInit[xmin =-1,ymin=-1,xmax=6,ymax=3] - \tkzGrid\tkzAxeX\tkzAxeY - \tkzDrawPoints(a,...,d) - \ifthenelse{\equal{\tkzUseLua{bool}}{true}}{ - \tkzDrawSegments[red](a,b c,d)}{% - \tkzDrawSegments[blue](a,b c,d)} - \tkzLabelPoints(a,...,d) -\end{tikzpicture} +\begin{mybox} + \begin{Verbatim} + \def\tkzUseLua#1{\directlua{tex.print(tostring(#1))}} \end{Verbatim} - -\begin{tkzelements} +\end{mybox} +\directlua{ +init_elements () z.b = point: new (1,1) z.a = point: new (4,2) z.c = point: new (2,2) @@ -127,16 +108,46 @@ if det == 0 then bool = true else bool = false end x = intersection (L.ab,L.cd) -\end{tkzelements} +} The intersection of the two lines lies at a point whose affix is: \tkzUseLua{x} -\vspace{1em} +\begin{minipage}{0.5\textwidth} +\begin{Verbatim} +\directlua{ + init_elements () + z.b = point: new (1,1) + z.a = point: new (4,2) + z.c = point: new (2,2) + z.d = point: new (5,1) + L.ab = line : new (z.a,z.b) + L.cd = line : new (z.c,z.d) + det = (z.b-z.a)^(z.d-z.c) + if det == 0 then bool = true + else bool = false + end + x = intersection (L.ab,L.cd) +} +The intersection of the two lines lies at + a point whose affix is:\tkzUseLua{x} +\begin{tikzpicture} + \tkzGetNodes + \tkzInit[xmin =0,ymin=0,xmax=5,ymax=3] + \tkzGrid\tkzAxeX\tkzAxeY + \tkzDrawPoints(a,...,d) + \ifthenelse{\equal{\tkzUseLua{bool}}{true}}{ + \tkzDrawSegments[red](a,b c,d)}{% + \tkzDrawSegments[blue](a,b c,d)} + \tkzLabelPoints(a,...,d) +\end{tikzpicture} +\end{Verbatim} +\end{minipage} +\begin{minipage}{0.5\textwidth} \hspace{\fill} \begin{tikzpicture} \tkzGetNodes - \tkzInit[xmin =-1,ymin=-1,xmax=6,ymax=3] + \tkzInit[xmin =0,ymin=0,xmax=5,ymax=3] \tkzGrid\tkzAxeX\tkzAxeY \tkzDrawPoints(a,...,d) \ifthenelse{\equal{\tkzUseLua{bool}}{true}}{ @@ -144,9 +155,311 @@ a point whose affix is: \tkzUseLua{x} \tkzDrawSegments[blue](a,b c,d)} \tkzLabelPoints(a,...,d) \end{tikzpicture} - \hspace{\fill} + \hspace{\fill} + \end{minipage} + % subsubsection other_transfers (end) -% subsubsection points_transfer (end) +\subsubsection{Example 1} % (fold) +\label{ssub:example_1} + +In this example, it's necessary to transfer the function to the Lua part, then retrieve the curve point coordinates from \TeX. + +The main tools used are a table and its methods (\Imeth{table}{insert},\Imeth{table}{concat}) and the \Igfct{lua}{load} function. + +\begin{Verbatim} +\makeatletter\let\percentchar\@percentchar\makeatother +\directlua{ + function list (f,min,max,nb) + local tbl = {} + for x = min, max, (max - min) / nb do + table.insert (tbl, ('(\percentchar f,\percentchar f)'):format (x, f (x))) + end + return table.concat (tbl) + end +} +\def\plotcoords#1#2#3#4{% +\directlua{% + f = load (([[ + return function (x) + return (\percentchar s) + end + ]]):format ([[#1]]), nil, 't', math) () +tex.print(list(f,#2,#3,#4))} +} +\begin{tikzpicture} +\tkzInit[xmin=1,xmax=3,ymin=0,ymax=2] +\tkzGrid +\tkzDrawX[right=3pt,label={$x$}] +\tkzDrawY[above=3pt,label={$f(x) = \dfrac{1-\mathrm{e}^{-x^2}}{1+\mathrm{e}^{-x^2}}$}] +\draw[cyan,thick] plot coordinates {\plotcoords{(1-exp(-x^2))/(exp(-x^2)+1)}{-3}{3}{100}}; +\end{tikzpicture} +\end{Verbatim} + + +\makeatletter\let\percentchar\@percentchar\makeatother +\directlua{ + function list (f,min,max,nb) + local tbl = {} + for x = min, max, (max - min) / nb do + table.insert (tbl, ('(\percentchar f,\percentchar f)'):format (x, f (x))) + end + return table.concat (tbl) + end +} + +\def\plotcoords#1#2#3#4{% +\directlua{% + f = load (([[ + return function (x) + return (\percentchar s) + end + ]]):format ([[#1]]), nil, 't', math) () +tex.print(list(f,#2,#3,#4))} +} + +\begin{tikzpicture} +\tkzInit[xmin=1,xmax=3,ymin=0,ymax=2] +\tkzGrid +\tkzDrawX[right=3pt,label={$x$}] +\tkzDrawY[above=3pt,label={$f(x) = \dfrac{1-\mathrm{e}^{-x^2}}{1+\mathrm{e}^{-x^2}}$}] +\draw[cyan,thick] plot coordinates {\plotcoords{(1-exp(-x^2))/(exp(-x^2)+1)}{-3}{3}{100}}; + +\end{tikzpicture} + +% subsubsection example_1 (end) + +\subsubsection{Example 2} % (fold) +\label{ssub:example_2} + +This consists in passing a number (the number of sides) from \TeX\ to \code{Lua}. This is made easier by using the \Iprimitive{directlua} primitive. This example is based on a answer from egreg [\href{https://tex.stackexchange.com/questions/729009/how-can-these-regular-polygons-be-arranged-within-a-page/731503#731503}{egreg--tex.stackexchange.com}] + +\begin{Verbatim} +\directlua{ + z.I = point: new (0,0) + z.A = point: new (2,0) +} +\def\drawPolygon#1{ +\directlua{ + RP.six = regular_polygon : new (z.I,z.A,#1) + RP.six : name ("P_") + } +\begin{tikzpicture}[scale=.5] + \def\nb{\tkzUseLua{RP.six.nb}} + \tkzGetNodes + \tkzDrawCircles(I,A) + \tkzDrawPolygon(P_1,P_...,P_\nb) + \tkzDrawPoints[red](P_1,P_...,P_\nb) +\end{tikzpicture} +} +\foreach [count=\i] \n in {3, 4, ..., 10} { + \makebox[0.2\textwidth]{% + \begin{tabular}[t]{@{}c@{}} + $n=\n$ \\[1ex] + \drawPolygon{\n} + \end{tabular}% + }\ifnum\i=4 \\[2ex]\fi +} +\end{Verbatim} + +\directlua{ + z.I = point: new (0,0) + z.A = point: new (2,0) +} +\def\drawPolygon#1{ +\directlua{ + RP.six = regular_polygon : new (z.I,z.A,#1) + RP.six : name ("P_") + } +\begin{tikzpicture}[scale=.5] + \def\nb{\tkzUseLua{RP.six.nb}} + \tkzGetNodes + \tkzDrawCircles(I,A) + \tkzDrawPolygon(P_1,P_...,P_\nb) + \tkzDrawPoints[red](P_1,P_...,P_\nb) +\end{tikzpicture} +} +\foreach [count=\i] \n in {3, 4, ..., 10} { + \makebox[0.2\textwidth]{% + \begin{tabular}[t]{@{}c@{}} + $n=\n$ \\[1ex] + \drawPolygon{\n} + \end{tabular}% + }\ifnum\i=4 \\[2ex]\fi +} + +% subsubsection example_2 (end) + +\subsubsection{Example 3} % (fold) +\label{ssub:example_3} + +This time, the transfer will be carried out using an external file. The following example is based on this one, but using a table. + +\directlua{ +init_elements() + z.a = point: new (1,0) + z.b = point: new (3,2) + z.c = point: new (0,2) + A,B,C = parabola (z.a,z.b,z.c) + + function f(t0, t1, n) + local out=assert(io.open("tmp.table","w")) + local y + for t = t0,t1,(t1-t0)/n do + y = A*t^2+B*t +C + out:write(t, " ", y, " i\string\n") + end + out:close() + end + } + +\begin{minipage}{0.5\textwidth} +\begin{Verbatim} +\directlua{ + init_elements() + z.a = point: new (1,0) + z.b = point: new (3,2) + z.c = point: new (0,2) + A,B,C = parabola (z.a,z.b,z.c) + + function f(t0, t1, n) + local out=assert(io.open("tmp.table","w")) + local y + for t = t0,t1,(t1-t0)/n do + y = A*t^2+B*t +C + out:write(t, " ", y, " i\string\n") + end + out:close() + end + } +\begin{tikzpicture} + \tkzGetNodes + \tkzInit[xmin=-1,xmax=5,ymin=0,ymax=5] + \tkzDrawX\tkzDrawY + \tkzDrawPoints[red,size=2](a,b,c) + \directlua{f(-1,3,100)}% + \draw[domain=-1:3] plot[smooth] file {tmp.table}; +\end{tikzpicture} +\end{Verbatim} +\end{minipage} +\begin{minipage}{0.5\textwidth} +\begin{center} + \begin{tikzpicture} + \tkzGetNodes + \tkzInit[xmin=-1,xmax=5,ymin=0,ymax=5] + \tkzDrawX\tkzDrawY + \tkzDrawPoints[red,size=2](a,b,c) + \directlua{f(-1,3,100)}% + \draw[domain=-1:3] plot[smooth] file {tmp.table}; + \end{tikzpicture} +\end{center} + +\end{minipage} +% subsubsection example_3 (end) + +\subsubsection{Example 4} % (fold) +\label{ssub:example_4} + +The result is identical to the previous one. +\begin{Verbatim} +\directlua{ + z.a = point: new (1,0) + z.b = point: new (3,2) + z.c = point: new (0,2) + A,B,C = parabola (z.a,z.b,z.c) + + function f(t0, t1, n) + local tbl = {} + for t = t0,t1,(t1-t0)/n do + y = A*t^2+B*t +C + table.insert (tbl, "("..t..","..y..")") + end + return table.concat (tbl) +end +} +\begin{tikzpicture} + \tkzGetNodes + \tkzDrawX\tkzDrawY + \tkzDrawPoints[red,size=2pt](a,b,c) + \draw[domain=-2:3,smooth] plot coordinates {\directlua{tex.print(f(-2,3,100))}}; +\end{tikzpicture} +\end{Verbatim} +% subsubsection example_4 (end) + +\subsubsection{Example 5} % (fold) +\label{ssub:example_5} + +\begin{Verbatim} +\makeatletter\let\percentchar\@percentchar\makeatother +\directlua{ +function cellx (start,step,n) +return start+step*(n-1) +end +} +\def\calcval#1#2{% +\directlua{ + f = load (([[ + return function (x) + return (\percentchar s) + end + ]]):format ([[#1]]), nil, 't', math) () +x = #2 +tex.print(string.format("\percentchar.2f",f(x)))} +} +\def\fvalues(#1,#2,#3,#4) {% +\def\firstline{$x$} + \foreach \i in {1,2,...,#4}{% + \xdef\firstline{\firstline & \tkzUseLua{cellx(#2,#3,\i)}}} +\def\secondline{$f(x)=#1$} + \foreach \i in {1,2,...,#4}{% + \xdef\secondline{\secondline & + \calcval{#1}{\tkzUseLua{cellx(#2,#3,\i)}}}} +\begin{tabular}{l*{#4}c} + \toprule + \firstline \\ + \secondline \\ + \bottomrule + \end{tabular} +} +\fvalues(x^2-3*x+1,-2,.25,8) +\vspace{12pt} + +\end{Verbatim} + +\makeatletter\let\percentchar\@percentchar\makeatother +\directlua{ +function cellx (start,step,n) +return start+step*(n-1) +end +} +\def\calcval#1#2{% +\directlua{ + f = load (([[ + return function (x) + return (\percentchar s) + end + ]]):format ([[#1]]), nil, 't', math) () +x = #2 +tex.print(string.format("\percentchar.2f",f(x)))} +} +\def\fvalues(#1,#2,#3,#4) {% +\def\firstline{$x$} + \foreach \i in {1,2,...,#4}{% + \xdef\firstline{\firstline & \tkzUseLua{cellx(#2,#3,\i)}}} +\def\secondline{$f(x)=#1$} + \foreach \i in {1,2,...,#4}{% + \xdef\secondline{\secondline & + \calcval{#1}{\tkzUseLua{cellx(#2,#3,\i)}}}} +\begin{tabular}{l*{#4}c} + \toprule + \firstline \\ + \secondline \\ + \bottomrule + \end{tabular} +} +\fvalues(x^2-3*x+1,-2,.25,8) +\vspace{12pt} + +% subsubsection example_5 (end) % section transfers (end) \endinput
\ No newline at end of file diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-why.tex b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-why.tex index 6ab030ee2f..4b28826391 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-why.tex +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/TKZdoc-elements-why.tex @@ -76,7 +76,7 @@ This version utilizes the simplest construction method made possible by Lua. \begin{mybox} \begin{Verbatim} -\begin{tkzelements} +\directlua{ scale = .4 z.A = point: new (0,0) z.B = point: new (6,0) @@ -95,7 +95,7 @@ This version utilizes the simplest construction method made possible by Lua. C.apo = C.ortho : inversion (C.euler) z.O = C.apo.center z.xa,z.xb,z.xc = C.ortho : inversion (z.Ea,z.Eb,z.Ec) -\end{tkzelements} +} \end{Verbatim} \end{mybox} @@ -160,7 +160,7 @@ The subsequent section exclusively deals with drawings, and is managed by \pkg{t \end{Verbatim} \vspace{1em} -\begin{tkzelements} +\directlua{ scale = .4 z.A = point: new (0,0) z.B = point: new (6,0) @@ -179,7 +179,7 @@ The subsequent section exclusively deals with drawings, and is managed by \pkg{t C.apo = C.ortho : inversion (C.euler) z.O = C.apo.center z.xa,z.xb,z.xc = C.ortho : inversion (z.Ea,z.Eb,z.Ec) -\end{tkzelements} +} \begin{minipage}{\textwidth} \hspace*{\fill} \begin{tikzpicture} diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/search_circle.lua b/macros/latex/contrib/tkz/tkz-elements/doc/latex/search_circle.lua new file mode 100644 index 0000000000..6ca5eff6b9 --- /dev/null +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/search_circle.lua @@ -0,0 +1,29 @@ +-- search_circle.lua +local r =... + +function newcircle (T,C) + local NT,L,NC,c,t + NT = T.incenter : homothety ((1+C.radius/T.inradius),T) + L = line : new (NT.pb,NT.pa) + _,NC = L : c_ll_p(NT.pc,C.center) + return NC.center,T.bc:projection(NC.center) +end + +z.A = point : new ( 0 , 0 ) +z.B = point : new ( 8 , 0 ) +z.C = point : new ( 2 , 6 ) +T.ABC = triangle : new (z.A,z.B,z.C) +L.bA = T.ABC : bisector () +z.c1 = L.bA : report(r) +z.t1 = T.ABC.ab : projection(z.c1) +C.last = circle : new(z.c1,z.t1) + +local vertices = {"A", "B", "C"} + for i = 2, 6 do + T.used = triangle : new( + z[vertices[math.fmod(i - 2, 3) + 1]], + z[vertices[math.fmod(i - 1, 3) + 1]], + z[vertices[math.fmod(i, 3) + 1]] ) + z["c" .. i], z["t" .. i] = newcircle(T.used, C.last) + C.last = circle : new(z["c" .. i], z["t" .. i]) + end diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/latex/tmp.table b/macros/latex/contrib/tkz/tkz-elements/doc/latex/tmp.table new file mode 100644 index 0000000000..2d2b1e66d4 --- /dev/null +++ b/macros/latex/contrib/tkz/tkz-elements/doc/latex/tmp.table @@ -0,0 +1,100 @@ +-1 6 i +-0.96 5.8016 i +-0.92 5.6064 i +-0.88 5.4144 i +-0.84 5.2256 i +-0.8 5.04 i +-0.76 4.8576 i +-0.72 4.6784 i +-0.68 4.5024 i +-0.64 4.3296 i +-0.6 4.16 i +-0.56 3.9936 i +-0.52 3.8304 i +-0.48 3.6704 i +-0.44 3.5136 i +-0.4 3.36 i +-0.36 3.2096 i +-0.32 3.0624 i +-0.28 2.9184 i +-0.24 2.7776 i +-0.2 2.64 i +-0.16 2.5056 i +-0.12 2.3744 i +-0.08 2.2464 i +-0.04 2.1216 i +3.4694469519536e-16 2 i +0.04 1.8816 i +0.08 1.7664 i +0.12 1.6544 i +0.16 1.5456 i +0.2 1.44 i +0.24 1.3376 i +0.28 1.2384 i +0.32 1.1424 i +0.36 1.0496 i +0.4 0.96 i +0.44 0.8736 i +0.48 0.7904 i +0.52 0.7104 i +0.56 0.6336 i +0.6 0.56 i +0.64 0.4896 i +0.68 0.4224 i +0.72 0.3584 i +0.76 0.2976 i +0.8 0.24 i +0.84 0.1856 i +0.88 0.1344 i +0.92 0.086399999999999 i +0.96 0.041599999999999 i +1 -4.4408920985006e-16 i +1.04 -0.0384 i +1.08 -0.0736 i +1.12 -0.1056 i +1.16 -0.1344 i +1.2 -0.16 i +1.24 -0.1824 i +1.28 -0.2016 i +1.32 -0.2176 i +1.36 -0.2304 i +1.4 -0.24 i +1.44 -0.2464 i +1.48 -0.2496 i +1.52 -0.2496 i +1.56 -0.2464 i +1.6 -0.24 i +1.64 -0.2304 i +1.68 -0.2176 i +1.72 -0.2016 i +1.76 -0.1824 i +1.8 -0.16 i +1.84 -0.1344 i +1.88 -0.1056 i +1.92 -0.073599999999999 i +1.96 -0.038399999999998 i +2 1.7763568394003e-15 i +2.04 0.041600000000001 i +2.08 0.086400000000002 i +2.12 0.1344 i +2.16 0.1856 i +2.2 0.24 i +2.24 0.2976 i +2.28 0.3584 i +2.32 0.4224 i +2.36 0.4896 i +2.4 0.56 i +2.44 0.6336 i +2.48 0.7104 i +2.52 0.7904 i +2.56 0.8736 i +2.6 0.96 i +2.64 1.0496 i +2.68 1.1424 i +2.72 1.2384 i +2.76 1.3376 i +2.8 1.44 i +2.84 1.5456 i +2.88 1.6544 i +2.92 1.7664 i +2.96 1.8816 i diff --git a/macros/latex/contrib/tkz/tkz-elements/doc/tkz-elements.pdf b/macros/latex/contrib/tkz/tkz-elements/doc/tkz-elements.pdf Binary files differindex d42a3a109b..940aba4ce3 100644 --- a/macros/latex/contrib/tkz/tkz-elements/doc/tkz-elements.pdf +++ b/macros/latex/contrib/tkz/tkz-elements/doc/tkz-elements.pdf diff --git a/macros/latex/contrib/tkz/tkz-elements/examples/search_circle.lua b/macros/latex/contrib/tkz/tkz-elements/examples/search_circle.lua new file mode 100644 index 0000000000..6ca5eff6b9 --- /dev/null +++ b/macros/latex/contrib/tkz/tkz-elements/examples/search_circle.lua @@ -0,0 +1,29 @@ +-- search_circle.lua +local r =... + +function newcircle (T,C) + local NT,L,NC,c,t + NT = T.incenter : homothety ((1+C.radius/T.inradius),T) + L = line : new (NT.pb,NT.pa) + _,NC = L : c_ll_p(NT.pc,C.center) + return NC.center,T.bc:projection(NC.center) +end + +z.A = point : new ( 0 , 0 ) +z.B = point : new ( 8 , 0 ) +z.C = point : new ( 2 , 6 ) +T.ABC = triangle : new (z.A,z.B,z.C) +L.bA = T.ABC : bisector () +z.c1 = L.bA : report(r) +z.t1 = T.ABC.ab : projection(z.c1) +C.last = circle : new(z.c1,z.t1) + +local vertices = {"A", "B", "C"} + for i = 2, 6 do + T.used = triangle : new( + z[vertices[math.fmod(i - 2, 3) + 1]], + z[vertices[math.fmod(i - 1, 3) + 1]], + z[vertices[math.fmod(i, 3) + 1]] ) + z["c" .. i], z["t" .. i] = newcircle(T.used, C.last) + C.last = circle : new(z["c" .. i], z["t" .. i]) + end diff --git a/macros/latex/contrib/tkz/tkz-elements/examples/tkz-elements-demo_1.pdf b/macros/latex/contrib/tkz/tkz-elements/examples/tkz-elements-demo_1.pdf Binary files differindex 6b1998eb80..8263a89b79 100644 --- a/macros/latex/contrib/tkz/tkz-elements/examples/tkz-elements-demo_1.pdf +++ b/macros/latex/contrib/tkz/tkz-elements/examples/tkz-elements-demo_1.pdf diff --git a/macros/latex/contrib/tkz/tkz-elements/examples/tkz-elements-demo_1.tex b/macros/latex/contrib/tkz/tkz-elements/examples/tkz-elements-demo_1.tex index 15046d83a3..5f4fec8415 100644 --- a/macros/latex/contrib/tkz/tkz-elements/examples/tkz-elements-demo_1.tex +++ b/macros/latex/contrib/tkz/tkz-elements/examples/tkz-elements-demo_1.tex @@ -5,7 +5,7 @@ \usepackage{tkz-elements} \begin{document} -\begin{tkzelements} +\directlua{ z.A = point: new (0 , 0) z.B = point: new (10 , 0) L.AB = line: new ( z.A, z.B) @@ -30,7 +30,7 @@ _,z.P_2 = intersection (C.QA,C.CB) T = triangle: new ( z.P_0, z.P_1, z.P_2) z.O_3 = T.circumcenter -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes diff --git a/macros/latex/contrib/tkz/tkz-elements/examples/tkz-elements-demo_2.pdf b/macros/latex/contrib/tkz/tkz-elements/examples/tkz-elements-demo_2.pdf Binary files differindex 6ff5f444c8..5a56a13dfa 100644 --- a/macros/latex/contrib/tkz/tkz-elements/examples/tkz-elements-demo_2.pdf +++ b/macros/latex/contrib/tkz/tkz-elements/examples/tkz-elements-demo_2.pdf diff --git a/macros/latex/contrib/tkz/tkz-elements/examples/tkz-elements-demo_2.tex b/macros/latex/contrib/tkz/tkz-elements/examples/tkz-elements-demo_2.tex index 2ee7b4c4d9..a9cf6032e2 100644 --- a/macros/latex/contrib/tkz/tkz-elements/examples/tkz-elements-demo_2.tex +++ b/macros/latex/contrib/tkz/tkz-elements/examples/tkz-elements-demo_2.tex @@ -7,7 +7,7 @@ The Feuerbach triangle is the triangle formed by the three points of tangency of the nine-point circle with the excircles -\begin{tkzelements} +\directlua{ scale = .6 z.A = point: new (0,0) z.B = point: new (6,0) @@ -26,7 +26,7 @@ C.apo = C.ortho : inversion (C.euler) z.O = C.apo.center z.xa,z.xb,z.xc = C.ortho : inversion (z.Ea,z.Eb,z.Ec) -\end{tkzelements} +} \vspace*{2em} \hfill diff --git a/macros/latex/contrib/tkz/tkz-elements/examples/tkz-elements-demo_3.pdf b/macros/latex/contrib/tkz/tkz-elements/examples/tkz-elements-demo_3.pdf Binary files differindex 5f1ded6e31..7762c969a3 100644 --- a/macros/latex/contrib/tkz/tkz-elements/examples/tkz-elements-demo_3.pdf +++ b/macros/latex/contrib/tkz/tkz-elements/examples/tkz-elements-demo_3.pdf diff --git a/macros/latex/contrib/tkz/tkz-elements/examples/tkz-elements-demo_3.tex b/macros/latex/contrib/tkz/tkz-elements/examples/tkz-elements-demo_3.tex index a95ae05b08..0e9fe3de97 100644 --- a/macros/latex/contrib/tkz/tkz-elements/examples/tkz-elements-demo_3.tex +++ b/macros/latex/contrib/tkz/tkz-elements/examples/tkz-elements-demo_3.tex @@ -5,7 +5,7 @@ \usepackage{tkz-elements} \begin{document} -\begin{tkzelements} +\directlua{ scale = 2 z.A = point: new (0 , 0) z.B = point: new (5 , 1) @@ -42,7 +42,7 @@ _,z.V = intersection (L.YO,E) _,z.W = intersection (L.ZO,E) set_lua_to_tex {'a','b','ang'} - \end{tkzelements} + } \begin{tikzpicture} \tkzGetNodes @@ -50,13 +50,14 @@ \tkzDrawCircles[red](N,Ma O,A) \tkzDrawSegments(A,X B,Y C,Z B,Hb C,Hc X,O Y,O Z,O) \tkzDrawPolygon[red](U,V,W) - \tkzLabelPoints[red](U,V,W) - \tkzLabelPoints(A,B,C,X,Y,Z) \tkzDrawLine[blue](I,J) - \tkzLabelPoints[blue,right](O,N,G,H,I,J) \tkzDrawPoints(I,J,U,V,W) \tkzDrawPoints(A,B,C,N,G,H,O,X,Y,Z,Ma,Mb,Mc,Ha,Hb,Hc) \tkzDrawEllipse[blue](N,\a,\b,\ang) + \tkzLabelPoints[blue,right](O,N,G,H,I,J) + \tkzLabelPoints[red](U,V,W) + \tkzLabelPoints(A,B,Z) + \tkzLabelPoints[above](C,X,Y) \end{tikzpicture} \end{document} diff --git a/macros/latex/contrib/tkz/tkz-elements/examples/tkz-elements-demo_4.pdf b/macros/latex/contrib/tkz/tkz-elements/examples/tkz-elements-demo_4.pdf Binary files differindex 1428fd1d4f..c84806e978 100644 --- a/macros/latex/contrib/tkz/tkz-elements/examples/tkz-elements-demo_4.pdf +++ b/macros/latex/contrib/tkz/tkz-elements/examples/tkz-elements-demo_4.pdf diff --git a/macros/latex/contrib/tkz/tkz-elements/examples/tkz-elements-demo_4.tex b/macros/latex/contrib/tkz/tkz-elements/examples/tkz-elements-demo_4.tex index 5dcf23e1ba..de8e4d335d 100644 --- a/macros/latex/contrib/tkz/tkz-elements/examples/tkz-elements-demo_4.tex +++ b/macros/latex/contrib/tkz/tkz-elements/examples/tkz-elements-demo_4.tex @@ -7,7 +7,7 @@ \usepackage{tkz-elements} \begin{document} -\begin{tkzelements} +\directlua{ scale = 2 z.A = point: new(0,0) z.B = point: new(5,0) @@ -17,13 +17,14 @@ z.E,z.F,z.G = get_points (T.EFG) z.S = T.ABC: medial (): circum_circle ().south z.O = T.ABC: medial ().circumcenter -\end{tkzelements} +} \begin{tikzpicture} \tkzGetNodes \tkzDrawPolygons(A,B,C E,F,G) \tkzDrawCircle(O,E) \tkzDrawPoints(A,B,C,O,S,E,F,G) - \tkzLabelPoints(A,B,O,S,E,F,G) + \tkzLabelPoints(A,B,O,S,G) + \tkzLabelPoints[above](E,F) \tkzLabelPoints[above](C) \end{tikzpicture} diff --git a/macros/latex/contrib/tkz/tkz-elements/examples/tkz-elements-demo_5.pdf b/macros/latex/contrib/tkz/tkz-elements/examples/tkz-elements-demo_5.pdf Binary files differnew file mode 100644 index 0000000000..15a9a28b6c --- /dev/null +++ b/macros/latex/contrib/tkz/tkz-elements/examples/tkz-elements-demo_5.pdf diff --git a/macros/latex/contrib/tkz/tkz-elements/examples/tkz-elements-demo_5.tex b/macros/latex/contrib/tkz/tkz-elements/examples/tkz-elements-demo_5.tex new file mode 100644 index 0000000000..3356bf311f --- /dev/null +++ b/macros/latex/contrib/tkz/tkz-elements/examples/tkz-elements-demo_5.tex @@ -0,0 +1,28 @@ +% !TEX TS-program = lualatex +% Created by Alain Matthes on 2024-12-25. +% Copyright (c) 2024 AlterMundus. +\documentclass[margin = 12pt]{standalone} +\usepackage{tkz-euclide} +\usepackage{tkz-elements} + +\begin{document} + +\directlua{ +init_elements () +z.A = point : new ( 0 , 0 ) +z.B = point : new ( 8 , 0 ) +z.C = point : new ( 2 , 6 ) +loadfile ("search_circle.lua")(1.4) +} + +\begin{tikzpicture} +\tkzGetNodes +\tkzFillPolygon[lightgray!30](A,B,C) +\foreach \n/\c in {1/red,2/orange,3/yellow,4/green,5/blue,6/violet} + {\tkzFillCircle[\c!30,opacity=.4](c\n,t\n) + \tkzDrawCircle[thick,\c](c\n,t\n) } +\tkzDrawPolygon[thick](A,B,C) +\tkzDrawPoints(A,B,C) +\end{tikzpicture} +\end{document} + diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz-elements.sty b/macros/latex/contrib/tkz/tkz-elements/latex/tkz-elements.sty index 0a11787d21..f0b32574e1 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz-elements.sty +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz-elements.sty @@ -1,5 +1,5 @@ % encoding : utf8 -% tkz-elements.sty v2.25c +% tkz-elements.sty v3.0c % Copyright 2024 Alain Matthes % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 @@ -11,45 +11,49 @@ % This work has the LPPL maintenance status “maintained”. % The Current Maintainer of this work is Alain Matthes. -\ProvidesPackage{tkz-elements}[2024/04/27 v2.25c Graphic Object Library] -\RequirePackage{luacode} -\directlua{require "tkz_elements_main"} +\ProvidesPackage{tkz-elements}[2025/01/06 version 3.10 Graphic Object Library] +%\RequirePackage{luacode} + \directlua{ + require "tkz_elements_main" + tkz_epsilon = 1e-8 + tkz_dc = 2 + indirect = true + inside = true + init_elements()}% + \newenvironment{tkzelements} { \directlua{scale=1} - \directlua{tkz_epsilon=1e-8} - \directlua{tkz_dc=2} - \directlua{indirect = true} - \directlua{z={} - C={} - E={} - L={} - M={} - P={} - Q={} - R={} - RP={} - S={} - T={} - V={}} + \directlua{z = {} + C = {} + E = {} + L = {} + M = {} + P = {} + Q = {} + R = {} + RP= {} + S = {} + T = {} + V = {}} \luacode} - {\endluacode} - + {\endluacode}% + + % new version of the next macro proposed by Sanskar Singh \def\tkzGetNodes{\directlua{% - for K,V in pairs(z) do - local n,sd,ft - n = string.len(K) - if n >1 then - _,_,ft, sd = string.find( K , "(.+)(.)" ) - if sd == "p" then K=ft.."'" end - _,_,xft, xsd = string.find( ft , "(.+)(.)" ) - if xsd == "p" then K=xft.."'".."'" end - end - tex.print("\\coordinate ("..K..") at ("..V.re..","..V.im..") ;\\\\") -end} -} + for K,V in pairs(z) do + local n,sd,ft + n = string.len(K) + if n >1 then + _,_,ft, sd = string.find( K , "(.+)(.)" ) + if sd == "p" then K=ft.."'" end + _,_,xft, xsd = string.find( ft , "(.+)(.)" ) + if xsd == "p" then K=xft.."'".."'" end + end + tex.sprint("\string\\coordinate ("..K..") at ("..V.re..","..V.im..") ; \string\r") +end}} -\def\tkzUseLua#1{\directlua{tex.print(tostring(#1))}} +\def\tkzUseLua#1{\directlua{tex.print(#1)}} \makeatletter \def\tkzDrawLuaEllipse{\pgfutil@ifnextchar[{\tkz@DrawLuaEllipse}{\tkz@DrawLuaEllipse[]}} \def\tkz@DrawLuaEllipse[#1](#2,#3,#4){% @@ -64,6 +68,7 @@ end} \pgfmathprintnumber{#2} \endgroup } +\let\percentchar\@percentchar \makeatother \endinput diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_circle.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_circle.lua index 1999b8a073..7ed5e1839f 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_circle.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_circle.lua @@ -1,6 +1,6 @@ -- tkz_elements-circles.lua --- date 2024/04/27 --- version 2.25c +-- date 2025/01/06 +-- version 3.10 -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 @@ -24,6 +24,8 @@ function circle: new (c, t) -- c --> center t --> through local east = c + point (radius,0) local north = c + point (0,radius) local west = c - point (radius,0) + local perimeter = 2*math.pi*radius + local area = 4*math.pi*radius*radius local o = { center = c, through = t, ct = ct, @@ -33,7 +35,9 @@ function circle: new (c, t) -- c --> center t --> through east = east, north = north, west = west, - type = type} + type = type, + perimeter = perimeter, + area = area} setmetatable(o, self) self.__index = self return o @@ -51,26 +55,12 @@ end ----------------------- -- boolean -- ----------------------- -function circle: in_out (pt) - local d - d = point.abs (pt - self.center) - if math.abs(d-self.radius) < tkz_epsilon - then - return true - else - return false - end +function circle:in_out(pt) + return math.abs(point.abs(pt - self.center) - self.radius) < tkz_epsilon end -function circle: in_out_disk (pt) - local d - d = point.abs (pt - self.center) - if d <= self.radius - then - return true - else - return false - end +function circle:in_out_disk(pt) + return point.abs(pt - self.center) <= self.radius end -- new version 1.80 added @@ -78,6 +68,16 @@ function circle : circles_position (C) return circles_position_ (self.center,self.radius,C.center,C.radius) end +function circle:is_tangent(l) + local a, b = intersection(self, l) + -- Checks whether the intersection produces valid points + if not a or not b then + return false + end + -- Checks whether the distance between the two intersection points is less than a given tolerance + return (point.abs(b - a) < tkz_epsilon) +end + ----------------------- -- real -- ----------------------- @@ -131,59 +131,64 @@ end ----------------------- -- lines -- ----------------------- -function circle: tangent_at (pt) - return line : new ( rotation_ (pt,math.pi/2,self.center),rotation_ (pt,-math.pi/2,self.center)) +function circle:tangent_at(pt) + return line:new( + rotation_(pt, math.pi / 2, self.center), + rotation_(pt, -math.pi / 2, self.center) + ) +end + + + function circle:tangent_from(pt) + local t1, t2 = tangent_from_(self.center, self.through, pt) + return line:new(pt, t1), line:new(pt, t2) end -function circle: tangent_from (pt) - local t1,t2 - t1,t2 = tangent_from_ (self.center,self.through,pt) - return line :new (pt,t1),line : new (pt,t2) + function circle:radical_axis(C) + local t1, t2 + if self.radius > C.radius then + t1, t2 = radical_axis_(self.center, self.through, C.center, C.through) + else + t1, t2 = radical_axis_(C.center, C.through, self.center, self.through) + end + return line:new(t1, t2) end - function circle: radical_axis (C) - local t1,t2 - if self.radius > C.radius then - t1,t2 = radical_axis_ (self.center,self.through,C.center,C.through) - else - t1,t2 = radical_axis_ (C.center,C.through,self.center,self.through) - end - return line :new (t1,t2) - end -function circle: radical_center (C1,C2) -if C2 == nil then - if self.radius > C1.radius then - return radical_center_ (self.center,self.through,C1.center,C1.through) - else - return radical_center_ (C1.center,C1.through,self.center,self.through) - end -else - return radical_center3 (self,C1,C2) -end -end + function circle:radical_center(C1, C2) + if C2 == nil then + if self.radius > C1.radius then + return radical_center_(self.center, self.through, C1.center, C1.through) + else + return radical_center_(C1.center, C1.through, self.center, self.through) + end + else + return radical_center3(self, C1, C2) + end + end -function circle : radical_circle (C1,C2) - local rc - if C2 == nil then - rc = self : radical_center (C1) - return self : orthogonal_from (rc) - else - rc = self : radical_center (C1,C2) - return C1 : orthogonal_from (rc) - end -end + function circle : radical_circle (C1,C2) + local rc + if C2 == nil then + rc = self : radical_center (C1) + return self : orthogonal_from (rc) + else + rc = self : radical_center (C1,C2) + return C1 : orthogonal_from (rc) + end + end - function circle : external_tangent(C) - local i,t1,t2,k,T1,T2 - i = barycenter_ ({C.center,self.radius},{self.center,-C.radius}) - t1,t2 = tangent_from_ (self.center,self.through,i) - k = point.mod((C.center-i)/(self.center-i)) - T1 = homothety_(i,k,t1) - T2 = homothety_(i,k,t2) - return line : new (t1,T1),line : new (t2,T2) + function circle:external_tangent(C) + local i, t1, t2, k, T1, T2 + i = barycenter_({C.center, self.radius}, {self.center, -C.radius}) + t1, t2 = tangent_from_(self.center, self.through, i) + k = point.mod((C.center - i) / (self.center - i)) + T1 = homothety_(i, k, t1) + T2 = homothety_(i, k, t2) + return line:new(t1, T1), line:new(t2, T2) end + function circle : internal_tangent(C) local i,t1,t2,k,T1,T2 i = barycenter_ ({C.center,self.radius},{self.center,C.radius}) @@ -221,54 +226,52 @@ function circle: orthogonal_through (pta,ptb) return circle : new (orthogonal_through_ (self.center,self.through,pta,ptb),pta) end - function circle: inversion_L (L) - local p,q - if L: in_out (self.center) then - return L - else - p = L: projection (self.center) - q = inversion_ (self.center,self.through,p) - return circle: new (midpoint_(self.center,q),q) - end + function circle:inversion_L(L) + if L:in_out(self.center) then + return L + else + local p = L:projection(self.center) + local q = inversion_(self.center, self.through, p) + return circle:new(midpoint_(self.center, q), q) + end end - - function circle: inversion_C (C) - local p,q,x,y - if C: in_out (self.center) then - p = C : antipode (self.center) - q = inversion_ (self.center,self.through,p) - x = ortho_from_ ( q , self.center , p ) - y = ortho_from_ ( q , p, self.center) - return line : new (x,y) - else - x,y = intersection_lc_ (self.center,C.center,C.center,C.through) - X = inversion_ (self.center,self.through,x) - Y = inversion_ (self.center,self.through,y) - return circle : new (midpoint_(X,Y),X) - end + + function circle:inversion_C(C) + local p, q, x, y, X, Y + if C:in_out(self.center) then + p = C:antipode(self.center) + q = inversion_(self.center, self.through, p) + x = ortho_from_(q, self.center, p) + y = ortho_from_(q, p, self.center) + return line:new(x, y) + else + x, y = intersection_lc_(self.center, C.center, C.center, C.through) + X = inversion_(self.center, self.through, x) + Y = inversion_(self.center, self.through, y) + return circle:new(midpoint_(X, Y), X) + end end -function circle: inversion (...) - local obj,nb,t - local tp = table.pack(...) - obj = tp[1] - nb = tp.n - if nb == 1 then - if obj.type == "point" then - return inversion_ (self.center,self.through,obj) - elseif obj.type == "line" then - return self: inversion_L (obj) - else - return self: inversion_C (obj) - end - else - t = {} - for i=1,tp.n do - table.insert( t , inversion_ (self.center,self.through , tp[i]) ) + function circle:inversion(...) + local tp = table.pack(...) + local obj = tp[1] + local nb = tp.n + if nb == 1 then + if obj.type == "point" then + return inversion_(self.center, self.through, obj) + elseif obj.type == "line" then + return self:inversion_L(obj) + else + return self:inversion_C(obj) end - return table.unpack ( t ) - end -end + else + local t = {} + for i = 1, nb do + table.insert(t, inversion_(self.center, self.through, tp[i])) + end + return table.unpack(t) + end + end function circle: draw () local x,y @@ -282,4 +285,111 @@ function circle: midcircle(C) return midcircle_ (self,C) end +-- ----------------------------------------------------------- +-- Circle tangent to a circle passing through two points +function circle : c_c_pp(a,b) + + -- test If one point is inside the disk and the other is outside, there is no solution. + if (self:in_out_disk(a) and not self:in_out_disk(b)) or ( self:in_out_disk(b) and not self:in_out_disk(a)) then + tex.error("An error has occurred", {"Bad configuration. Only one point is in the disk"}) +return end + +-- Find the mediator of the current line +local lab = line : new (a,b) +local lmed = lab : mediator() + +if self : is_tangent (lab) then + local c = intersection (self,lab) + local d = self : antipode (c) + + return circle:new (circum_circle_(a, b, d),a), + circle:new (circum_circle_(a, b, d),a) +end + +-- pb are (AB) tgt to circle A and B equidistant of O tgt and equidistant +if lab : is_equidistant (self.center) then + local t1,t2 = intersection (lmed,self) + return circle:new (circum_circle_(a, b, t1),t1), + circle:new (circum_circle_(a, b, t2),t2) +else + -- Create a circumcircle passing through a, b, and a point on C + local Cc = circle:new(circum_circle_(a, b, self.center), a) + -- Find the intersection points of C and Cc + local c, d = intersection(self, Cc) + -- Create a line passing through the two intersection points + local lcd = line:new(c, d) + -- Find the intersection of the current line (self) with the line lcd + local i = intersection(lab, lcd) + -- Create tangents from the intersection point to C + local lt, ltp = self:tangent_from(i) + -- Get the tangent points + local t, tp = lt.pb, ltp.pb + -- Return two new circles tangent to C and passing through the tangent points + return circle:new(intersection(lmed, line:new(self.center, t)), t), + circle:new(intersection(lmed, line:new(self.center, tp)), tp) +end +end + + +-- Circle tangent to two circles passing through a point +function circle : c_cc_p (C,p) + local i = self: external_similitude (C) + local lofcenters = line : new (self.center,C.center) + local u1,u2 = intersection (lofcenters,self) + local v1,v2 = intersection (lofcenters,C) + local u1,v1 = self : common_tangent (C) + local o = circum_circle_(u1,v1,p) + local a,b = intersection_lc_(i,p,o,p) + if (point.abs(a - b) < tkz_epsilon) then + local li = line:new (i,p) + return C : c_lc_p (li,a) + else + local q + -- problem if p == q ? + if (point.abs(a - p) < tkz_epsilon) then q = b else q=a end + return C : c_c_pp (p,q) + end +end + +-- Circle tangent to one circle, on line and passing through a point +function circle : c_lc_p (l,p,inside) + inside = inside or false + if self : in_out (p) then + local t1 = intersection_ll_( self.north,p,l.pa,l.pb) + local t2 = intersection_ll_( self.south,p,l.pa,l.pb) + local l1 = l : ortho_from (t1) + local l2 = l : ortho_from (t2) + local o1 = intersection_ll_( self.center,p,l1.pa,l1.pb) + local o2 = intersection_ll_( self.center,p,l2.pa,l2.pb) + return circle:new(o1,t1),circle:new(o2,t2) + else + if l : in_out (p) then + local i = l : projection (self.center) + local lortho = l : ortho_from (p) + local u = lortho : report (self.radius,p) + local v = lortho : report (-self.radius,p) + local ux,uy = mediator_ (self.center,u) + local vx,vy = mediator_ (self.center,v) + -- pb if c tgt l + local o1= intersection_ll_(u,v,ux,uy) + local o2 = intersection_ll_(u,v,vx,vy) + return circle:new(o1,p),circle:new(o2,p) + else -- genral case + local u = self.north + local v = self.south + local h = intersection_ll_(u,v,l.pa,l.pb) + if inside then + local o = circum_circle_(p,u,h) + local q = intersection_lc_(p,v,o,p) + return self : c_c_pp (p,q) + else + local o = circum_circle_(p,v,h) + local q = intersection_lc_(u,p,o,v) + return self : c_c_pp (p,q) + end + end + end +end + + return circle
\ No newline at end of file diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_class.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_class.lua index b6a1bf7a5a..3469a89c41 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_class.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_class.lua @@ -1,6 +1,6 @@ -- tkz_elements_class.lua --- date 2024/04/27 --- version 2.25c +-- date 2025/01/06 +-- version 3.10 -- from class.lua (Simple Lua Classes from Lua-users wiki) -- Compatible with Lua 5.1 (not 5.0). -- http://lua-users.org/wiki/SimpleLuaClasses DavidManura diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_ellipse.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_ellipse.lua index a98cf40a63..9983ae3391 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_ellipse.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_ellipse.lua @@ -1,6 +1,6 @@ -- tkz_elements-ellipses.lua --- date 2024/04/27 --- version 2.25c +-- date 2025/01/06 +-- version 3.10 -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_circles.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_circles.lua index 40f2a4ebbf..5dfece2eb3 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_circles.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_circles.lua @@ -1,6 +1,6 @@ -- tkz_elements_functions_circles.lua --- date 2024/04/27 --- version 2.25c +-- date 2025/01/06 +-- version 3.10 -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 @@ -37,45 +37,52 @@ function orthogonal_from_ (a,b,p) return tangent_from_ (a,b,p) end -function orthogonal_through_ (a,b,x,y) - local d,z - d = 1/point.mod(x-a) - z = a +(b-a)*d - return circum_center_ (x,y,z) +function orthogonal_through_(a, b, x, y) + local d = 1 / point.mod(x - a) + local z = a + (b - a) * d + return circum_center_(x, y, z) end -function inversion_ (c,p,pt) - local ry = point.abs(c-p) - local d = point.abs(c-pt) - local r = (ry*ry)/d - return c+polar_ (r,point.arg(pt-c)) +function inversion_(c, p, pt) + local ry = point.abs(c - p) + local d = point.abs(c - pt) + local r = (ry * ry) / d + return c + polar_(r, point.arg(pt - c)) end -function circles_position_ (c1,r1,c2,r2) - local d,max,min - d = point.mod(c1-c2) - max = r1+r2 - min = math.abs ( r1 - r2) - if d > max then return "outside" - elseif math.abs(d - max) < tkz_epsilon then return "outside tangent" -- epsilon - elseif math.abs(d - min) < tkz_epsilon then return "inside tangent" -- epsilon - elseif d < min then return "inside" - else return "intersect" - end +function circles_position_(c1, r1, c2, r2) + local d = point.mod(c1 - c2) + local max = r1 + r2 + local min = math.abs(r1 - r2) + + if d > max then + return "outside" + elseif math.abs(d - max) < tkz_epsilon then + return "outside tangent" + elseif math.abs(d - min) < tkz_epsilon then + return "inside tangent" + elseif d < min then + return "inside" + else + return "intersect" + end end + -function radical_axis_ (c1,p1,c2,p2) - local ci,cj - r1 = point.abs(c1-p1) - r2 = point.abs(c2-p2) - d = point.abs(c1-c2) - h = (r1*r1-r2*r2+d*d)/(2*d) - ck = radical_center_ (c1,p1,c2,p2) - cj = rotation_ (ck,-math.pi/2,c1) - ci = symmetry_ (ck,cj) - return cj,ci +function radical_axis_(c1, p1, c2, p2) + local r1 = point.abs(c1 - p1) + local r2 = point.abs(c2 - p2) + local d = point.abs(c1 - c2) + local h = (r1 * r1 - r2 * r2 + d * d) / (2 * d) + + local ck = radical_center_(c1, p1, c2, p2) + local cj = rotation_(ck, -math.pi / 2, c1) + local ci = symmetry_(ck, cj) + + return cj, ci end + function radical_center_ (c1,p1,c2,p2) local d,r1,r2,h r1 = point.abs(c1-p1) @@ -96,18 +103,16 @@ return intersection_ll_ (t1,t2,t3,t4) end end -function south_pole_ (c,p) - local r - r = point.abs (c-p) - return c - point (0,r) - end +function south_pole_(c, p) + return c - point(0, point.abs(c - p)) +end + -function north_pole_ (c,p) - local r - r = point.abs (c-p) - return c + point (0,r) +function north_pole_(c, p) + return c + point(0, point.abs(c - p)) end + function antipode_ (c,pt) return 2 * c - pt end @@ -126,42 +131,46 @@ function circlepoint_ (c,t,k) end function midcircle_(C1,C2) - local state,r,s,t1,t2,T1,T2,p,a,b,c,d,Cx,Cy,i,j - state = circles_position_(C1.center,C1.radius,C2.center,C2.radius) - i = barycenter_ ({C2.center,C1.radius},{C1.center,-C2.radius}) - j = barycenter_ ({C2.center,C1.radius},{C1.center,C2.radius}) - t1,t2 = tangent_from_ (C1.center,C1.through,i) - T1,T2 = tangent_from_ (C2.center,C2.through,i) + local state, r, s, t1, t2, T1, T2, p, a, b, c, d, Cx, Cy, i, j + state = circles_position_(C1.center, C1.radius, C2.center, C2.radius) + i = barycenter_({C2.center, C1.radius}, {C1.center, -C2.radius}) + j = barycenter_({C2.center, C1.radius}, {C1.center, C2.radius}) + t1, t2 = tangent_from_(C1.center, C1.through, i) + T1, T2 = tangent_from_(C2.center, C2.through, i) - if (state == 'outside') or (state == 'outside tangent')then - p = math.sqrt(point.mod(i-t1)*point.mod(i-T1)) - return circle : radius (i,p) - elseif state == 'intersect' then - r,s = intersection (C1,C2) - return circle : radius (i,point.mod(r-i)) , circle : radius (j,point.mod(r-j)) - elseif (state == 'inside') or (state == 'inside tangent') then - a,b = intersection_lc_ (C1.center,C2.center,C1.center,C1.through) - c,d = intersection_lc_ (C1.center,C2.center,C2.center,C2.through) - + if (state == 'outside') or (state == 'outside tangent') then + p = math.sqrt(point.mod(i - t1) * point.mod(i - T1)) + return circle:radius(i, p) + elseif state == 'intersect' then + r, s = intersection(C1, C2) + return circle:radius(i, point.mod(r - i)), circle:radius(j, point.mod(r - j)) + elseif (state == 'inside') or (state == 'inside tangent') then + a, b = intersection_lc_(C1.center, C2.center, C1.center, C1.through) + c, d = intersection_lc_(C1.center, C2.center, C2.center, C2.through) + + -- Ensure the smaller radius circle is used first if C1.radius < C2.radius then z.u, z.v, z.r, z.s = a, b, c, d else z.u, z.v, z.r, z.s = c, d, a, b end - if (in_segment_ (z.s,z.v,z.u) == true) - then - Cx = circle : diameter (z.r,z.v) - Cy = circle : diameter (z.u,z.s) - else - Cx = circle : diameter (z.s,z.v) - Cy = circle : diameter (z.u,z.r) - end - if (Cx.radius) < (Cy.radius) then - return Cy : orthogonal_from (j) - else - return Cx : orthogonal_from (j) - end - end + -- Determine circle orientation and return orthogonal from j + if in_segment_(z.s, z.v, z.u) then + Cx = circle:diameter(z.r, z.v) + Cy = circle:diameter(z.u, z.s) + else + Cx = circle:diameter(z.s, z.v) + Cy = circle:diameter(z.u, z.r) + end + + -- Return the circle with the smaller radius orthogonal from j + if Cx.radius < Cy.radius then + return Cy:orthogonal_from(j) + else + return Cx:orthogonal_from(j) + end + end end +
\ No newline at end of file diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_intersections.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_intersections.lua index 69dcd6ace3..cb318bb6d0 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_intersections.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_intersections.lua @@ -1,6 +1,6 @@ -- tkz_elements_intersections.lua --- date 2024/04/27 --- version 2.25c +-- date 2025/01/06 +-- version 3.10 -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 @@ -72,133 +72,142 @@ function intersection_le (L,E) end end -function intersection_ll_ (a,b,c,d) - local x1,x2,x3,x4,y1,y2,y3,y4,DN,NX,NY - x1 = a.re - y1 = a.im - x2 = b.re - y2 = b.im - x3 = c.re - y3 = c.im - x4 = d.re - y4 = d.im - DN = (x1-x2)*(y3-y4) - (y1-y2)*(x3-x4) - if math.abs ( DN ) < tkz_epsilon then - return false - else - NX = (x1*y2-y1*x2)*(x3-x4) - (x1-x2)*(x3*y4-y3*x4) - NY = (x1*y2-y1*x2)*(y3-y4) - (y1-y2)*(x3*y4-y3*x4) - return point (NX/DN,NY/DN) +function intersection_ll_(a, b, c, d) + local x1, y1, x2, y2, x3, y3, x4, y4 + local DN, NX, NY + + x1, y1 = a.re, a.im + x2, y2 = b.re, b.im + x3, y3 = c.re, c.im + x4, y4 = d.re, d.im + + DN = (x1 - x2) * (y3 - y4) - (y1 - y2) * (x3 - x4) + + if math.abs(DN) < tkz_epsilon then + return false end + + NX = (x1 * y2 - y1 * x2) * (x3 - x4) - (x1 - x2) * (x3 * y4 - y3 * x4) + NY = (x1 * y2 - y1 * x2) * (y3 - y4) - (y1 - y2) * (x3 * y4 - y3 * x4) + + return point(NX / DN, NY / DN) end -function intersection_lc_ (pa,pb,c,p) - local zh, dh, arg_ab, test, phi,c1,c2,r - r = point.mod (c-p) - zh = projection_ (pa,pb,c) - dh = point.abs (c - zh) - arg_ab = point.arg (pa - pb) - if dh < tkz_epsilon - then - return - c + polar_ (r , math.pi + arg_ab), -- through center - c + polar_ (r , arg_ab) - elseif math.abs (r - dh) < tkz_epsilon - then - return zh , zh -- tangent - elseif dh > r - then return false , false -- no intersection - else - phi = math.asin (dh / r) - -- phi = angle_normalize(phi) - test = (pa-pb) * point.conj (c-zh) - if test.im < 0 - then phi = math.pi + phi - end - c1 = angle_normalize (arg_ab + phi ) - c2 = angle_normalize (math.pi + arg_ab - phi ) - if c2 < c1 then - return - c + polar_ (r, c2) , - c + polar_ (r, c1) - else - return - c + polar_ (r, c1) , - c + polar_ (r, c2) - end -- if - end -- if +function intersection_lc_(pa, pb, c, p) + local zh, dh, arg_ab, phi, c1, c2, r, test -end -- function + r = point.mod(c - p) + zh = projection_(pa, pb, c) + dh = point.abs(c - zh) + arg_ab = point.arg(pa - pb) + + if dh < tkz_epsilon then + -- Le centre du cercle est sur la droite + return c + polar_(r, math.pi + arg_ab), c + polar_(r, arg_ab) + elseif math.abs(r - dh) < tkz_epsilon then + -- La droite est tangente au cercle + return zh, zh + elseif dh > r then + -- Aucune intersection + return false, false + else + -- Il y a une intersection, calcul de l'angle + phi = math.asin(dh / r) + test = (pa - pb) * point.conj(c - zh) + if test.im < 0 then + phi = math.pi + phi + end + + c1 = angle_normalize(arg_ab + phi) + c2 = angle_normalize(math.pi + arg_ab - phi) + + -- Retourner les deux points d'intersection + if c2 < c1 then + return c + polar_(r, c2), c + polar_(r, c1) + else + return c + polar_(r, c1), c + polar_(r, c2) + end + end +end -function intersection_cc_ (ca,pa,cb,pb ) - local d, cosphi, phi,ra,rb,c1,c2,epsilon +function intersection_cc_(ca, pa, cb, pb) + local d, cosphi, phi, ra, rb, c1, c2, epsilon + + -- Précision pour arrondir les résultats epsilon = 12 - d = point.abs (ca - cb) - ra = point.abs (ca - pa) - rb = point.abs (cb - pb) - cosphi = tkzround(((ra * ra + d * d - rb * rb) - /( 2 * ra * d )) , epsilon) - phi = tkzround (math.acos(cosphi),epsilon) - if not phi then - return false , false - elseif phi == 0 then - return ca + polar_ (ra, phi + point.arg (cb - ca)) , - ca + polar_ (ra, phi + point.arg (cb - ca)) - else - c1 = angle_normalize ( phi + point.arg(cb - ca)) - c2 = angle_normalize (-phi + point.arg(cb - ca)) - if c1 < c2 then - return - ca + polar_(ra, c1), - ca + polar_(ra, c2) -else - return - ca + polar_(ra, c2), - ca + polar_(ra, c1) - end -- if - end -- if - end -- function - -function intersection ( X , Y ) - local i,z1,z2 - local t = {} - - if X.type == 'circle' - then - if Y.type == 'circle' - then - z1,z2 = intersection_cc ( X , Y ) - table.insert (t , z1 ) - table.insert (t , z2 ) - else -- Y[i] est une droite - z1,z2 = intersection_lc ( Y , X ) - table.insert (t , z1 ) - table.insert (t , z2 ) - end -- if - else - if X.type == 'line' then - if Y.type == 'circle' - then - z1,z2 = intersection_lc ( X , Y ) - table.insert ( t , z1 ) - table.insert ( t , z2 ) - else - if Y.type == 'line' then - z1 = intersection_ll ( X , Y ) - table.insert (t , z1 ) - else -- ellipse - z1,z2 = intersection_le ( X , Y ) - table.insert ( t , z1 ) - table.insert ( t , z2 ) - end - end -- if - else - if X.type == 'ellipse' then - z1,z2 = intersection_le ( Y,X) - table.insert ( t , z1 ) - table.insert ( t , z2 ) - end + -- Distance entre les centres des cercles + d = point.abs(ca - cb) + -- Rayons des cercles + ra = point.abs(ca - pa) + rb = point.abs(cb - pb) + + -- Calcul du cosinus de l'angle phi entre les centres et les points sur les cercles + cosphi = tkzround((ra * ra + d * d - rb * rb) / (2 * ra * d), epsilon) + + -- Calcul de l'angle phi + phi = tkzround(math.acos(cosphi), epsilon) + + -- Si phi est invalide (par exemple, cosphi > 1 ou < -1), aucune intersection + if not phi then + return false, false + elseif phi == 0 then + -- Les cercles sont tangents l'un à l'autre, retourne le même point pour les deux intersections + return ca + polar_(ra, point.arg(cb - ca)), ca + polar_(ra, point.arg(cb - ca)) + else + -- Calcul des angles des points d'intersection + c1 = angle_normalize(phi + point.arg(cb - ca)) + c2 = angle_normalize(-phi + point.arg(cb - ca)) + + -- Retourner les points d'intersection dans l'ordre croissant des angles + if c1 < c2 then + return ca + polar_(ra, c1), ca + polar_(ra, c2) + else + return ca + polar_(ra, c2), ca + polar_(ra, c1) + end + end +end + +function intersection(X, Y) + local t = {} -- Tableau pour stocker les points d'intersection + + -- Cas où X est un cercle + if X.type == 'circle' then + if Y.type == 'circle' then + -- Intersection entre deux cercles + local z1, z2 = intersection_cc(X, Y) + table.insert(t, z1) + table.insert(t, z2) + else -- Y est une droite + local z1, z2 = intersection_lc(Y, X) -- Intersection entre un cercle et une droite + table.insert(t, z1) + table.insert(t, z2) + end + + -- Cas où X est une droite + elseif X.type == 'line' then + if Y.type == 'circle' then + -- Intersection entre une droite et un cercle + local z1, z2 = intersection_lc(X, Y) + table.insert(t, z1) + table.insert(t, z2) + elseif Y.type == 'line' then + -- Intersection entre deux droites + local z1 = intersection_ll(X, Y) + table.insert(t, z1) + else -- Y est une ellipse + local z1, z2 = intersection_le(X, Y) -- Intersection entre une droite et une ellipse + table.insert(t, z1) + table.insert(t, z2) end - end -- if - return table.unpack ( t ) -end -- function
\ No newline at end of file + + -- Cas où X est une ellipse + elseif X.type == 'ellipse' then + -- Intersection entre une ellipse et l'autre objet (cercle, droite ou ellipse) + local z1, z2 = intersection_le(Y, X) + table.insert(t, z1) + table.insert(t, z2) + end + + -- Retourner les résultats sous forme de valeurs distinctes + return table.unpack(t) +end diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_lines.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_lines.lua index 401ad46dda..dfea7c4d3c 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_lines.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_lines.lua @@ -1,6 +1,6 @@ -- tkz_elements_functions_lines.lua --- date 2024/04/27 --- version 2.25c +-- date 2025/01/06 +-- version 3.10 -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 @@ -15,16 +15,17 @@ --------------------------------------------------------------------------- -- Lines --------------------------------------------------------------------------- -function normalize_ (a,b) - return a+(b-a)/point.mod(b-a) +function normalize_(a, b) + return a + (b - a) / point.mod(b - a) end -function ortho_from_ ( p , a , b ) - return p+(b-a)*point(0,1) + +function ortho_from_(p, a, b) + return p + (b - a) * point(0, 1) end function ll_from_ ( p , a , b ) - return p+b-a + return p + b - a end function slope_ (a,b) @@ -32,7 +33,7 @@ function slope_ (a,b) end function gold_segment_ (a,b) - return a + (b-a)*tkzinvphi + return a + (b - a) * tkzinvphi end function online_ (a,b,t) @@ -52,26 +53,25 @@ function equilateral_tr_ (a,b) return rotation_ (a,math.pi/3,b) end -function isosceles_right_tr (a,b) - local pt - pt = rotation_ (a,math.pi/4,b) - return a + (pt-a) * math.sin(math.pi/4) +function isosceles_right_tr(a, b) + local pt = rotation_(a, math.pi / 4, b) + return a + (pt - a) * math.sin(math.pi / 4) end -function gold_tr (a,b) - local pt - pt = rotation_ (a,math.pi/2,b) - return a + (pt-a) * tkzinvphi + +function gold_tr(a, b) + local pt = rotation_(a, math.pi / 2, b) + return a + (pt - a) * tkzinvphi end + function euclide_tr (a,b) return rotation_ (a,math.pi/5,b) end function golden_tr (a,b) - local pt - pt = rotation_ (a,2*math.pi/5,b) - return a + (pt-a) * tkzphi + local pt = rotation_ (a,2*math.pi/5,b) + return a + (pt-a) * tkzphi end function div_harmonic_int_(a,b,n) @@ -97,66 +97,56 @@ function projection ( Dt,pt ) return projection_ ( Dt.pa,Dt.pb,pt ) end -function projection_ ( pa,pb,pt ) - local v - local z - if aligned ( pa,pb,pt ) then - return pt - else - v = pb - pa - z = ((pt - pa)..v)/(point.norm(v)) -- .. dot product - return pa + z * v - end +function projection_(pa, pb, pt) + if aligned(pa, pb, pt) then + return pt + else + local v = pb - pa + local z = ((pt - pa) .. v) / point.norm(v) -- .. dot product + return pa + z * v + end end + function symmetry_axial_(pa,pb,pt) - local p - p = projection_ (pa,pb,pt) + local p = projection_ (pa,pb,pt) return symmetry_(p,pt) end -function set_symmetry_axial_ (u,v,...) - local tp = table.pack(...) - local i +function set_symmetry_axial_(u, v, ...) local t = {} - for i=1,tp.n do - table.insert( t , symmetry_axial_ (u,v , tp[i]) ) - end - return table.unpack ( t ) + for _, value in ipairs({...}) do + table.insert(t, symmetry_axial_(u, v, value)) + end + return table.unpack(t) end + function square_ (a,b) return rotation_ (b,-math.pi/2,a), rotation_ (a,math.pi/2,b) end -function in_segment_ (a,b,pt) - local sc - sc = point.mod (pt-a) + point.mod (pt-b) - point.mod(b-a) - if sc <= tkz_epsilon - then - return true +function in_segment_(a, b, pt) + return point.mod(pt - a) + point.mod(pt - b) - point.mod(b - a) <= tkz_epsilon +end + +function report_(za, zb, d, pt) + local len = point.mod(zb - za) + local t = d / len + local result = barycenter_({za, 1 - t}, {zb, t}) + + if pt then + return result + pt - za else - return false + return result end end -function report_ (za,zb,d,pt) - local t,len - len = point.mod(zb-za) - t = d/len - if pt == nil - then - return barycenter_({za,1-t},{zb,(t)}) -else - return barycenter_({za,1-t},{zb,(t)}) +pt-za -end +function colinear_at_(za, zb, pt, k) + if k then + return pt + k * (zb - za) + else + return pt + (zb - za) + end end -function colinear_at_ (za,zb,pt,k) - if k == nil - then - return pt+zb-za -else - return pt+k*(zb-za) -end -end diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_maths.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_maths.lua index a71c0f7c27..8b66689768 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_maths.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_maths.lua @@ -1,6 +1,6 @@ -- tkz_elements_functions_maths.lua --- date 2024/04/27 --- version 2.25c +-- date 2025/01/06 +-- version 3.10 -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 @@ -38,27 +38,26 @@ function Cramer22(a1,a2,b1,b2) return a1*b2-a2*b1 end -function aligned ( m,a,b ) +function aligned(m, a, b) local z - z = (b-a)/(m-b) - if math.abs(z.im) < tkz_epsilon - then - return true - else - return false - end -end + z = (b - a) / (m - b) + if math.abs(z.im) < tkz_epsilon then + return true + else + return false + end +end -function islinear (z1,z2,z3) - local dp - dp = (z2-z1) ^ (z3-z1) - if math.abs(dp) < tkz_epsilon - then +function islinear(z1, z2, z3) + local dp + dp = (z2 - z1) ^ (z3 - z1) + if math.abs(dp) < tkz_epsilon then return true - else + else return false end end +is_linear = islinear function isortho (z1,z2,z3) local dp @@ -71,6 +70,8 @@ function isortho (z1,z2,z3) end end +is_ortho = isortho + function parabola (a,b,c) local xa,xb,xc,ya,yb,yc xa = a.re diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_matrices.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_matrices.lua index 4371214047..47d3ce9967 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_matrices.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_matrices.lua @@ -1,6 +1,6 @@ -- tkz_elements_functions_matrices.lua --- date 2024/04/27 --- version 2.25c +-- date 2025/01/06 +-- version 3.10 -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_points.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_points.lua index f1c4dc5d41..9937c0589d 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_points.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_points.lua @@ -1,6 +1,6 @@ -- tkz_elements_functions_points.lua --- date 2024/04/27 --- version 2.25c +-- date 2025/01/06 +-- version 3.10 -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 @@ -23,30 +23,29 @@ function polar_ (radius, phi) end function barycenter_ (...) -local cp = table.pack(...) -local i -local sum = 0 -local weight=0 -for i=1,cp.n do - sum = sum + cp[i][1]*cp[i][2] - weight = weight + cp[i][2] -end -return sum/weight + local cp = table.pack(...) + local sum = 0 + local weight = 0 + for i = 1, cp.n do + sum = sum + cp[i][1] * cp[i][2] + weight = weight + cp[i][2] + end + return sum / weight end -function rotation_ (c,a,pt) - local z = point( math.cos(a) , math.sin(a) ) - return z*(pt-c)+c +function rotation_ (c, a, pt) + local z = point(math.cos(a), math.sin(a)) + return z * (pt - c) + c end -function set_rotation_ (c,angle,...) +-- Define the set_rotation_ function +function set_rotation_ (c, angle, ...) local tp = table.pack(...) - local i local t = {} for i=1,tp.n do - table.insert( t , rotation_(c , angle , tp[i] )) + table.insert(t, rotation_(c, angle, tp[i])) end - return table.unpack ( t ) + return table.unpack(t) end function symmetry_(c,pt) @@ -55,8 +54,7 @@ end function set_symmetry_ (c,...) local tp = table.pack(...) - local i - local t = {} + local t = {} for i=1,tp.n do table.insert( t , symmetry_ (c , tp[i]) ) end @@ -69,8 +67,7 @@ end function set_homothety_ (c,coeff,...) local tp = table.pack(...) - local i - local t = {} + local t = {} for i=1,tp.n do table.insert( t , homothety_ (c, coeff , tp[i]) ) end @@ -83,7 +80,6 @@ end function set_translation_ (u,...) local tp = table.pack(...) - local i local t = {} for i=1,tp.n do table.insert( t , (u + tp[i]) ) @@ -101,7 +97,6 @@ end function midpoints_ (...) local arg = table.pack(...) local n = arg.n - local i local t = {} for i=1, n-1 do table.insert( t , (arg[i]+arg[i+1])/2 ) diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_regular.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_regular.lua index 5e92b4d598..01d98ad29a 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_regular.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_regular.lua @@ -1,6 +1,6 @@ -- tkz_elements_functions_regular.lua --- date 2024/04/27 --- version 2.25c +-- date 2025/01/06 +-- version 3.10 -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_triangles.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_triangles.lua index d4523d1826..b27353f2dc 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_triangles.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_functions_triangles.lua @@ -1,6 +1,6 @@ -- tkz_elements_functions_triangles.lua --- date 2024/04/27 --- version 2.25c +-- date 2025/01/06 +-- version 3.10 -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 @@ -70,20 +70,32 @@ w = point.abs(b-a) return barycenter_ ({a,u*u},{b,v*v},{c,w*w}) end -function nagel_point_ (a,b,c) - local u,v,w - u,v,w = extouch_tr_ ( a,b,c ) -return intersection_ll_ (a,u,b,v) +function nagel_point_ (a, b, c) + -- Calculate the excircle tangency points (u, v, w) + local u, v, w = extouch_tr_ (a, b, c) + + -- Find the intersection of lines through a and u, and through b and v + return intersection_ll_ (a, u, b, v) end -function feuerbach_point_ (a,b,c) - local i,h,e,ma - i,h = in_circle_ (a,b,c) - e = euler_center_ (a,b,c) - ma = (b+c)/2 -return intersection_cc_ (i,h,e,ma) + +function feuerbach_point_ (a, b, c) + local i, h, e, ma + + -- Calculate the incenter and some related point (likely the orthocenter or another center) + i, h = in_circle_ (a, b, c) + + -- Calculate the Euler center (center of the nine-point circle) + e = euler_center_ (a, b, c) + + -- Calculate the midpoint of side BC + ma = (b + c) / 2 + + -- Find the intersection of the circles at (i, h) and (e, ma), which gives the Feuerbach point + return intersection_cc_ (i, h, e, ma) end + function spieker_center_ (a,b,c) return in_center_ (medial_tr_ ( a,b,c)) end @@ -160,18 +172,28 @@ function ex_circle_ ( a,b,c ) projection_ (b,a,o) end -function euler_circle_ (a,b,c) - local o,ma,mb,mc,H,ha,hb,hc - o = euler_center_ (a,b,c) - ma,mb,mc = medial_tr_ ( a,b,c) - ha,hb,hc = orthic_tr_ ( a,b,c) - local _,_,H,_ = euler_line_ (a,b,c) - return - o,ma,mb,mc,ha,hb,hc, - midpoint_ ( H,a ), - midpoint_ ( H,b ), - midpoint_ ( H,c ) +function euler_circle_ (a, b, c) + local o, ma, mb, mc, H, ha, hb, hc + -- Compute the Euler center (center of the nine-point circle) + o = euler_center_ (a, b, c) + + -- Calculate the medial triangle (midpoints of the sides) + ma, mb, mc = medial_tr_ (a, b, c) + + -- Calculate the orthic triangle (feet of the altitudes) + ha, hb, hc = orthic_tr_ (a, b, c) + + -- Get the Euler line and midpoint (H) on the Euler line + _, _, H, _ = euler_line_ (a, b, c) + + -- Return all relevant geometric elements + return + o, ma, mb, mc, ha, hb, hc, + midpoint_ (H, a), -- Midpoint between H and vertex a + midpoint_ (H, b), -- Midpoint between H and vertex b + midpoint_ (H, c) -- Midpoint between H and vertex c end + -------------------- -- triangles -- -------------------- @@ -194,15 +216,21 @@ function anti_tr_(a,b,c) barycenter_ ( {a,1} , {b,1} , {c,-1} ) end -function incentral_tr_ (a,b,c) - local i,r,s,t - i = in_center_ (a , b , c) - r = intersection_ll_ ( a,i , b,c) - s = intersection_ll_ ( b,i , a,c) - t = intersection_ll_ ( c,i , a,b) -return r,s,t +function incentral_tr_ (a, b, c) + local i, r, s, t + -- Compute the incenter (center of the incircle) + i = in_center_ (a, b, c) + + -- Calculate the points of tangency where the incircle touches the sides + r = intersection_ll_ (a, i, b, c) -- Intersection of lines a-i and b-c + s = intersection_ll_ (b, i, a, c) -- Intersection of lines b-i and a-c + t = intersection_ll_ (c, i, a, b) -- Intersection of lines c-i and a-b + + -- Return the points of tangency that form the incentral triangle + return r, s, t end + function excentral_tr_ (a,b,c) local r,s,t,ka,kb,kc ka = point.abs (b-c) @@ -259,6 +287,15 @@ function feuerbach_tr_ (a,b,c) intersection_cc_ (e,m,jb,hb), intersection_cc_ (e,m,jc,hc) end + +function similar_ (a,b,c) + local x,y,z,g + g = centroid_ (a,b,c) + x = homothety_ (g,-2,a) + y = homothety_ (g,-2,b) + z = homothety_ (g,-2,c) + return x,y,z +end -------------------- -- ellipse -- -------------------- @@ -281,19 +318,22 @@ function area_ (a,b,c) return point.mod(a - projection_(b,c,a))*point.mod (b - c)/2 end -function check_equilateral_ (a,b,c) - local A,B,C - A = b - c - B = a - c - C = a - b - if (point.abs(A)-point.abs(B) < tkz_epsilon) and (point.abs(B)-point.abs(C) < tkz_epsilon) - then - return true - else - return false +function check_equilateral_ (a, b, c) + local A, B, C + -- Compute the vectors representing the sides of the triangle + A = b - c -- Side from b to c + B = a - c -- Side from a to c + C = a - b -- Side from a to b + + -- Check if all sides have approximately equal lengths + if (point.abs(A) - point.abs(B) < tkz_epsilon) and (point.abs(B) - point.abs(C) < tkz_epsilon) then + return true -- The triangle is equilateral + else + return false -- The triangle is not equilateral end end + function parallelogram_ (a,b,c) local x = c + a - b return x @@ -328,22 +368,34 @@ function in_out_ (a,b,c,pt) end end -function soddy_center_ (a,b,c) - local i,ha,hb,hc,e,f,g,x,y,z,xp,yp,zp - i,e,f,g = in_circle_ (a,b,c) - ha,hb,hc = orthic_tr_ (a,b,c) - x,xp = intersection_lc_ (a,ha,a,g) - if (point.mod(ha-x)<point.mod(ha-xp)) then else x,xp=swap(x,xp) end - y,yp = intersection_lc_ (b,hb,b,e) - if (point.mod(hb-y)<point.mod(hb-yp)) then else y,yp=swap(y,yp) end - z,zp = intersection_lc_ (c,hc,c,f) - if (point.mod(hc-z)<point.mod(hc-zp)) then else z,zp=swap(z,zp) end - xi,t = intersection_lc_ (xp,e,a,g) - if in_out_ (a,b,c,xi) then else xi,t = swap(xi,t) end - yi,t = intersection_lc_ (yp,f,b,e) - if in_out_ (a,b,c,yi) then else yi,t = swap(yi,t) end - zi,t = intersection_lc_ (zp,g,c,f) - if in_out_ (a,b,c,zi) then else zi,t = swap(zi,t) end - s = circum_center_ (xi,yi,zi) - return s,xi,yi,zi +function soddy_center_ (a,b,c) + -- Step 1: Compute the incenter and excircle centers + local i,e,f,g = in_circle_ (a,b,c) + local ha,hb,hc = orthic_tr_ (a,b,c) + + -- Step 2: Find the intersection points for the tangent lines + local x,xp = intersection_lc_ (a,ha,a,g) + if (point.mod(ha-x) < point.mod(ha-xp)) then else x,xp = swap(x,xp) end + + local y,yp = intersection_lc_ (b,hb,b,e) + if (point.mod(hb-y) < point.mod(hb-yp)) then else y,yp = swap(y,yp) end + + local z,zp = intersection_lc_ (c,hc,c,f) + if (point.mod(hc-z) < point.mod(hc-zp)) then else z,zp = swap(z,zp) end + + -- Step 3: Calculate the intersections with the opposite triangle sides + local xi,t = intersection_lc_ (xp,e,a,g) + if in_out_ (a,b,c,xi) then else xi,t = swap(xi,t) end + + local yi,t = intersection_lc_ (yp,f,b,e) + if in_out_ (a,b,c,yi) then else yi,t = swap(yi,t) end + + local zi,t = intersection_lc_ (zp,g,c,f) + if in_out_ (a,b,c,zi) then else zi,t = swap(zi,t) end + + -- Step 4: Calculate the circumcenter of the triangle formed by the tangent points + local s = circum_center_ (xi,yi,zi) + + return s,xi,yi,zi -- Return the Soddy center and the tangent points end + diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_line.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_line.lua index 9304768f31..2b4b320e19 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_line.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_line.lua @@ -1,6 +1,6 @@ -- tkz_elements_lines.lua --- date 2024/04/27 --- version 2.25c +-- date 2025/01/06 +-- version 3.10 -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 @@ -16,7 +16,7 @@ -- Lines -- ------------------------------------------------------------------------- line = {} -function line: new(za, zb) +function line:new(za, zb) local type = 'line' local mid = (za+zb)/2 local north_pa = rotation_ (za,math.pi/2,zb) @@ -49,122 +49,119 @@ end ------------------- -- Result -> real ------------------- -function line: distance (pt) +function line:distance(pt) return point.mod(projection(self,pt)-pt) end -function length(a,b) - return point.abs (a-b) -end - -function line: slope () +function line:slope() return slope_(self.pa,self.pb) end ------------------- -- Result -> boolean ------------------- -function line: in_out (pt) - local sc - sc = math.abs ((pt-self.pa)^(pt-self.pb)) - if sc <= tkz_epsilon - then - return true - else - return false - end +function line:in_out(pt) + return math.abs((pt - self.pa) ^ (pt - self.pb)) <= tkz_epsilon end -function line: in_out_segment (pt) - local sc - sc = point.mod (pt-self.pa) + point.mod (pt-self.pb) - point.mod(self.pb-self.pa) - if sc <= tkz_epsilon - then - return true - else - return false - end +function line:in_out_segment(pt) + return point.mod(pt - self.pa) + point.mod(pt - self.pb) - point.mod(self.pb - self.pa) <= tkz_epsilon +end + +function line:is_parallel(L) + return math.abs(self.slope - L.slope) < tkz_epsilon +end + +function line:is_orthogonal(L) + return math.abs(self.slope * L.slope + 1) < tkz_epsilon +end + +function line:is_equidistant(p) + return math.abs( (point.mod(self.pa-p)-(point.mod(self.pb-p)))) < tkz_epsilon end ------------------- -- Result -> point ------------------- -function line: barycenter (ka,kb) +function line:barycenter(ka,kb) return barycenter_({self.pa,ka},{self.pb,kb}) end -function line: point (t) -- t=o A t=1 B t = AM / AB +function line:point(t) -- t=o A t=1 B t = AM / AB return barycenter_({self.pa,1-t},{self.pb,(t)}) end -function line: midpoint () +function line:midpoint() return (self.pa+self.pb)/2 end -function line: harmonic_int (pt) +function line:harmonic_int(pt) return div_harmonic_int_(self.pa,self.pb,pt) end -function line: harmonic_ext (pt) +function line:harmonic_ext(pt) return div_harmonic_ext_(self.pa,self.pb,pt) end -function line: harmonic_both (k) +function line:harmonic_both(k) return div_harmonic_both_(self.pa,self.pb,k) end -function line: gold_ratio() +function line:gold_ratio() return self.pa + (self.pb-self.pa)*tkzinvphi end -function line: normalize () +function line:normalize() return self.pa+(self.pb-self.pa)/point.mod(self.pb-self.pa) end -function line: normalize_inv () +function line:normalize_inv() return normalize_ (self.pb,self.pa) end -function line: _east (d) +function line:_east(d) local d = d or 1 return self.pb+ d/self.length * (self.pb-self.pa) end -function line: _west (d) +function line:_west(d) local d = d or 1 return self.pa+ d/self.length * (self.pa-self.pb) end -function line: _north_pa (d) +function line:_north_pa(d) local d = d or 1 return d/self.length * ( self.north_pa - self.pa ) + self.pa end -function line: _south_pa (d) +function line:_south_pa(d) local d = d or 1 return d/self.length *( self.south_pa - self.pa ) + self.pa end -function line: _south_pb (d) +function line:_south_pb(d) local d = d or 1 return d/self.length *( self.south_pb - self.pb ) + self.pb end -function line: _north_pb (d) +function line:_north_pb(d) local d = d or 1 return d/self.length *( self.north_pb - self.pb ) + self.pb end -function line : report (d,pt) - local t - t = d/self.length - if pt == nil - then - return barycenter_({self.pa,1-t},{self.pb,(t)}) - else - return barycenter_({self.pa,1-t},{self.pb,(t)}) +pt-self.pa - end +function line:report(d, pt) + if not self.length or self.length == 0 then + error("self.length must be non-zero") + end + local t = d / self.length + local result = barycenter_({self.pa, 1 - t}, {self.pb, t}) + if pt then + return result + pt - self.pa + else + return result + end end -function line : colinear_at (pt,k) + +function line:colinear_at (pt,k) if k == nil then return colinear_at_ (self.pa,self.pb,pt,1) @@ -173,28 +170,28 @@ function line : colinear_at (pt,k) end end -------------- transformations ------------- -function line: translation_pt ( pt ) +function line:translation_pt( pt ) return translation_ ( self.pb-self.pa,pt ) end -function line: translation_C ( obj ) +function line:translation_C( obj ) local pa,pb,x,y pa = obj.center pb = obj.through - x,y = set_translation_ ( self.pb-self.pa,pa,pb ) + x,y = set_translation_( self.pb-self.pa,pa,pb ) return circle : new (x,y) end -function line: translation_T ( obj ) +function line: translation_T( obj ) local pa,pb,pc,x,y,z pa = obj.pa pb = obj.pb pc = obj.pc - x,y,z = set_translation_ ( self.pb-self.pa,pa,pb,pc ) + x,y,z = set_translation_( self.pb-self.pa,pa,pb,pc ) return triangle : new (x,y,z) end -function line: translation_L ( obj ) +function line: translation_L( obj ) local pa,pb,x,y pa = obj.pa pb = obj.pb @@ -202,35 +199,42 @@ function line: translation_L ( obj ) return line : new (x,y) end -function line: translation (...) - local obj,nb,t +function line:translation(...) + local obj, nb, t local tp = table.pack(...) obj = tp[1] nb = tp.n - if nb == 1 then - if obj.type == "point" then - return translation_ ( self.pb-self.pa,obj ) - elseif obj.type == "line" then - return self: translation_L (obj) - elseif obj.type == "triangle" then - return self: translation_T (obj) - else - return self: translation_C (obj) - end - else + + -- If only one object is passed + if nb == 1 then + if obj.type == "point" then + return translation_(self.pb - self.pa, obj) -- Translate point + elseif obj.type == "line" then + return self:translation_L(obj) -- Translate line + elseif obj.type == "triangle" then + return self:translation_T(obj) -- Translate triangle + elseif obj.type == "circle" then + return self:translation_C(obj) -- Translate circle + else + error("Unsupported object type for translation") + end + else + -- If multiple objects are passed, translate each one t = {} - for i=1,tp.n do - table.insert(t , translation_ ( self.pb-self.pa , tp[i])) - end - return table.unpack ( t ) - end + for i = 1, nb do + -- Translate each object using the translation vector + table.insert(t, translation_(self.pb - self.pa, tp[i])) + end + return table.unpack(t) -- Return the translated objects + end end + function line: set_translation ( ...) return set_translation_ ( self.pb-self.pa,... ) end -function line: projection (...) +function line:projection(...) local obj,nb,t local tp = table.pack(...) obj = tp[1] @@ -246,7 +250,7 @@ function line: projection (...) end end -function line: set_projection (...) +function line:set_projection(...) local tp = table.pack(...) local i local t = {} @@ -256,31 +260,31 @@ function line: set_projection (...) return table.unpack ( t ) end -function line: symmetry_axial_L ( obj ) +function line:symmetry_axial_L( obj ) local pa,pb,x,y pa = obj.pa pb = obj.pb - x,y = self:set_reflection ( pa,pb ) + x,y = self:set_reflection(pa, pb) return line : new (x,y) end -function line: symmetry_axial_T ( obj ) +function line:symmetry_axial_T( obj ) local pa,pb,pc,x,y,z pa = obj.pa pb = obj.pb pc = obj.pc - x,y,z = self:set_reflection ( pa,pb,pc ) + x,y,z = self:set_reflection (pa, pb, pc) return triangle : new (x,y,z) end -function line: symmetry_axial_C ( obj ) +function line:symmetry_axial_C( obj ) local pa,pb,x,y pa = obj.center pb = obj.through - x,y = self:set_reflection ( pa,pb ) + x,y = self:set_reflection( pa,pb ) return circle : new (x,y) end -function line: reflection (...) +function line:reflection(...) local obj,nb,t local tp = table.pack(...) obj = tp[1] @@ -304,181 +308,379 @@ function line: reflection (...) end end -function line: set_reflection (...) +function line:set_reflection (...) return set_symmetry_axial_ ( self.pb,self.pa,... ) end ------------------- -- Result -> line ------------------- -function line: ll_from ( pt ) +function line:ll_from( pt ) return line : new (pt,pt+self.pb-self.pa) end -function line: ortho_from ( pt ) +function line:ortho_from( pt ) return line : new (pt+(self.pb-self.pa)*point(0,-1),pt+(self.pb-self.pa)*point(0,1)) end -function line: mediator () - local m - m = midpoint_ (self.pa,self.pb) +function line:mediator() + local m = midpoint_ (self.pa,self.pb) return line : new (rotation_ (m,-math.pi/2,self.pb),rotation_ (m,math.pi/2,self.pb)) end + +function line:perpendicular_bisector () + local m = midpoint_ (self.pa,self.pb) + return line : new (rotation_ (m,-math.pi/2,self.pb),rotation_ (m,math.pi/2,self.pb)) +end + ------------------- -- Result -> circle ------------------- -function line: circle () - return circle : new (self.pa,self.pb) +function line:circle(swap) + swap = swap or false + if swap then + return circle:new(self.pb,self.pa) + else + return circle:new(self.pa,self.pb) + end end -function line: circle_swap () +function line:circle_swap() return circle : new (self.pb,self.pa) end -function line : diameter () - local c = midpoint_ (self.pa,self.pb) - return circle : new (c,self.pb) +function line:diameter() + local c = midpoint_(self.pa,self.pb) + return circle:new (c,self.pb) end -function line : apollonius (k) +function line:apollonius(k) local z1,z2,c - z1 = barycenter_ ({self.pa,1},{self.pb,k}) - z2 = barycenter_ ({self.pa,1},{self.pb,-k}) - c = midpoint_ (z1,z2) + z1 = barycenter_({self.pa,1},{self.pb,k}) + z2 = barycenter_({self.pa,1},{self.pb,-k}) + c = midpoint_ (z1,z2) return circle : new (c,z2) end +function line:test(x,y) + +end + + +-- Circle tangent to a line passing through two points +-- In general, there are two solutions +function line:c_l_pp(a, b) -- a and b on the same side + -- Initialisation + local lab = line:new(a, b) -- Line through a and b + local Cab = circle:diameter(a, b) -- Circle with a and b diameters + local i = intersection(lab, self) -- Intersection with current line + + -- One point on the line (a) + if self : in_out(a) and not self:in_out(b) then + local lmed = lab : mediator() + local laperp = self:ortho_from(a) + local o = intersection(lmed,laperp) + return circle:new(o,a), + circle:new(o,a) + end + -- One point on the line (b) + if self:in_out(b) and not self:in_out(a) then + local lmed = lab:mediator() + local laperp = self:ortho_from(b) + local o = intersection(lmed,laperp) + return circle:new(o,b), + circle:new(o,b) + end + -- Check: if the intersection exists and lies on the segment [a, b]. + if i and lab:in_out_segment(i) then + return nil, nil -- No circle is possible + end + + -- If the current line is orthogonal to lab + if self:is_orthogonal(lab) then + local lmed = lab:mediator() + local m = midpoint(a, b) + local r = length(m, i) + local pt1 = lab:isosceles_s(r) + local pt2 = lab:isosceles_s(r, true) + return circle:new(pt1, a), + circle:new(pt2, a) + end + + -- If the two lines are parallel + if lab:is_parallel(self) then + local mid = midpoint(a, b) -- Midpoint of segment [a, b] + local proj = self:projection(mid) -- Mid projection on the running line + + return circle:new(circum_center_(a, b, proj), proj), + circle:new(circum_center_(a, b, proj), proj) + end + + -- General case + local t = Cab:tangent_from(i).pb + local x, y = intersection(self, circle:new(i, t)) + return circle:new(intersection(self:ortho_from(x), lab:mediator()), x), + circle:new(intersection(self:ortho_from(y), lab:mediator()), y) +end + + +-- Circle tangent to two straight lines passing through a given point +function line:c_ll_p(a, p) + + -- Compute the bisector of the triangle formed by self.pa, self.pb, and a + local lbi = bisector(self.pa, self.pb, a) + + if lbi:in_out(p) then + -- Orthogonal projection of p onto the bisector + local lp = lbi:ortho_from(p) + + -- Intersection of line from p to its projection with self.pa and self.pb + local i = intersection_ll_(p, lp.pb, self.pa, self.pb) + + -- Intersection points of the line with the circle defined by (i, p) + local t1, t2 = intersection_lc_(self.pa, self.pb, i, p) + + -- Create the main line and find orthogonal projections from t1 and t2 + local lab = line:new(self.pa, self.pb) + local x = lab:ortho_from(t1).pb + local y = lab:ortho_from(t2).pb + + -- Return two circles based on the orthogonal projections and points t1, t2 + return circle:new(intersection_ll_(x, t1, self.pa, p), t1), + circle:new(intersection_ll_(y, t2, self.pa, p), t2) + else + -- Reflection of p across the bisector + local q = lbi : reflection (p) + + -- Compute circles from the Wallis construction + local c1, c2 = self:c_l_pp(p, q) + + -- Return two circles with centers and points on their circumference + return c1,c2 + end +end + + + ---------------------- -- Result -> triangle ---------------------- -function line: equilateral (swap) - if swap == nil then - swap = false - end - if swap then - return triangle : new (self.pa,self.pb,rotation_ (self.pa,-math.pi/3,self.pb)) +function line:equilateral(swap) + swap = swap or false + if swap then + return triangle:new(self.pa, self.pb, rotation_(self.pa, -math.pi / 3, self.pb)) else - return triangle : new (self.pa,self.pb,rotation_ (self.pa,math.pi/3,self.pb)) -end + return triangle:new(self.pa, self.pb, rotation_(self.pa, math.pi / 3, self.pb)) + end end -function line: isosceles (phi,swap) - local pta,ptb - if swap == nil then - swap = false - end +function line:isosceles(phi,swap) + local pta,ptb + swap = swap or false if swap then - pta = rotation_ (self.pa,-phi,self.pb) - ptb = rotation_ (self.pb,phi,self.pa) - return triangle : new (self.pa,self.pb, intersection_ll_ (self.pa,pta,self.pb,ptb )) + pta = rotation_(self.pa,-phi,self.pb) + ptb = rotation_(self.pb,phi,self.pa) + return triangle : new (self.pa,self.pb, intersection_ll_(self.pa,pta,self.pb,ptb )) else - pta = rotation_ (self.pa,phi,self.pb) - ptb = rotation_ (self.pb,-phi,self.pa) + pta = rotation_(self.pa,phi,self.pb) + ptb = rotation_(self.pb,-phi,self.pa) return triangle : new (self.pa,self.pb, intersection_ll_ (self.pa,pta,self.pb,ptb )) end end +line.isosceles_a = line.isosceles + +function line:isosceles_s(a,swap) + local c1,c2,pta,ptb,pt1,pt2 + c1 = circle : radius (self.pa,a) + c2 = circle : radius (self.pb,a) + pta,ptb = intersection_cc (c1,c2) + if get_angle(self.pa,self.pb,pta) < get_angle(self.pa,self.pb,ptb) then + pt1=pta pt2=ptb + else pt1=ptb pt2=pta end + swap = swap or false + if swap then + return triangle : new (self.pa,self.pb,pt2 ) + else + return triangle : new (self.pa,self.pb,pt1) +end +end -function line: two_angles (alpha,beta) +function line:two_angles(alpha,beta,swap) local pta,ptb,pt - pta = rotation_ (self.pa,alpha,self.pb) - ptb = rotation_ (self.pb,-beta,self.pa) - pt = intersection_ll_ (self.pa,pta,self.pb,ptb) - return triangle : new (self.pa,self.pb,pt) + swap = swap or false + if swap then + pta = rotation_(self.pa,-alpha,self.pb) + ptb = rotation_(self.pb,beta,self.pa) + else + pta = rotation_(self.pa,alpha,self.pb) + ptb = rotation_(self.pb,-beta,self.pa) + end + pt = intersection_ll_(self.pa,pta,self.pb,ptb) + return triangle:new(self.pa,self.pb,pt) end -function line: school () +function line:school(swap) local pta,ptb,pt - pta = rotation_ (self.pa,math.pi/6,self.pb) - ptb = rotation_ (self.pb,-math.pi/3,self.pa) - pt = intersection_ll_ (self.pa,pta,self.pb,ptb) - return triangle : new (self.pa,self.pb,pt) + swap = swap or false + if swap then + pta = rotation_(self.pa,-math.pi/6,self.pb) + ptb = rotation_(self.pb,math.pi/3,self.pa) + else + pta = rotation_(self.pa,math.pi/6,self.pb) + ptb = rotation_(self.pb,-math.pi/3,self.pa) + end + pt = intersection_ll_(self.pa,pta,self.pb,ptb) + return triangle:new(self.pa,self.pb,pt) end -function line: half () +function line:half(swap) local x,pt x = midpoint_(self.pa,self.pb) - pt = rotation_ (self.pb,-math.pi/2,x) - return triangle : new (self.pa,self.pb,pt) + swap = swap or false + if swap then + pt = rotation_(self.pb,math.pi/2,x) + else + pt = rotation_(self.pb,-math.pi/2,x) + end + return triangle:new(self.pa,self.pb,pt) end -function line: sss (a,b) +function line:sss(a,b,swap) local pta,ptb,i,j + swap = swap or false pta = self.pa + point ( a, 0 ) ptb = self.pb + point ( -b , 0) i,j = intersection_cc_ (self.pa,pta,self.pb,ptb) - return triangle : new (self.pa,self.pb,i),triangle : new (self.pa,self.pb,j) + if swap then + return triangle : new (self.pa,self.pb,j) + else + return triangle : new (self.pa,self.pb,i) + end end -function line: ssa (a,phi) - local x,y,pt - x = rotation_ (self.pb,-phi,self.pa) - y = self.pa + polar_ ( a , self.slope) - i,j = intersection_lc_ (self.pb,x,self.pa,y) - return triangle : new (self.pa,self.pb,i),triangle : new (self.pa,self.pb,j) +function line:ssa(a, phi,swap) + local x, y, i, j + swap = swap or false + x = rotation_(self.pb, -phi, self.pa) + y = self.pa + polar_(a, self.slope) + i, j = intersection_lc_(self.pb, x, self.pa, y) + if swap then + return triangle:new(self.pa, self.pb, j) + else + return triangle:new(self.pa, self.pb, i) + end end -function line: sas (a,phi) - local x,pt - x = self.pa + polar_ ( a , self.slope) - pt = rotation_ (self.pa,phi,x) +function line:sas(a, phi,swap) + local x, pt + swap = swap or false + x = self.pa + polar_(a, self.slope) + if swap then + pt = rotation_(self.pa, -phi, x) + else + pt = rotation_(self.pa, phi, x) + end + return triangle:new(self.pa, self.pb, pt) +end + +function line:asa(alpha,beta,swap) + local pta,ptb,pt + swap = swap or false + if swap then + pta = rotation_ (self.pa,-alpha,self.pb) + ptb = rotation_ (self.pb,beta,self.pa) + else + pta = rotation_ (self.pa,alpha,self.pb) + ptb = rotation_ (self.pb,-beta,self.pa) + end + pt = intersection_ll_ (self.pa,pta,self.pb,ptb) return triangle : new (self.pa,self.pb,pt) end ---- sacred triangles ---- -function line: gold (swap) +function line:gold(swap) local pt - if swap == nil then - swap = false - end -if swap then - pt = rotation_ (self.pa,-math.pi/2,self.pb) - return triangle : new (self.pa,self.pb, self.pa + (pt-self.pa) * tkzinvphi) -else - pt = rotation_ (self.pa,math.pi/2,self.pb) - return triangle : new (self.pa,self.pb, self.pa + (pt-self.pa) * tkzinvphi) -end + swap = swap or false + if swap then + pt = rotation_ (self.pa,-math.pi/2,self.pb) + return triangle : new (self.pa,self.pb, self.pa + (pt-self.pa) * tkzinvphi) + else + pt = rotation_ (self.pa,math.pi/2,self.pb) + return triangle : new (self.pa,self.pb, self.pa + (pt-self.pa) * tkzinvphi) + end end -function line: sublime () +function line:sublime(swap) local pta,ptb,pt - pta = rotation_ (self.pa,2*math.pi/5,self.pb) - ptb = rotation_ (self.pb,-2*math.pi/5,self.pa) - pt = intersection_ll_ (self.pa,pta,self.pb,ptb) - return triangle : new (self.pa,self.pb,pt) + swap = swap or false + if swap then + pta = rotation_(self.pa,-2*math.pi/5,self.pb) + ptb = rotation_(self.pb,2*math.pi/5,self.pa) + pt = intersection_ll_(self.pa,pta,self.pb,ptb) + return triangle:new(self.pa,self.pb,pt) + else + pta = rotation_(self.pa,2*math.pi/5,self.pb) + ptb = rotation_(self.pb,-2*math.pi/5,self.pa) + pt = intersection_ll_(self.pa,pta,self.pb,ptb) + return triangle:new(self.pa,self.pb,pt) +end end line.euclid = line.sublime -function line: euclide (swap) - if swap == nil then - return triangle : new (self.pa,self.pb, rotation_ (self.pa,math.pi/5,self.pb)) - else - return triangle : new (self.pa,self.pb, rotation_ (self.pa,-math.pi/5,self.pb)) - end +function line:euclide (swap) + swap = swap or false + if swap then + return triangle : new (self.pa,self.pb, rotation_(self.pa,-math.pi/5,self.pb)) + else + return triangle : new (self.pa,self.pb, rotation_(self.pa,math.pi/5,self.pb)) + end end -function line: divine () - local pta,ptb,pt,h - pta = rotation_ (self.pa,math.pi/5,self.pb) - ptb = rotation_ (self.pb,-math.pi/5,self.pa) - pt = intersection_ll_ (self.pa,pta,self.pb,ptb) - return triangle : new (self.pa,self.pb,pt) -end + function line:divine(swap) + local pta, ptb, pt + swap = swap or false + if swap then + pta = rotation_(self.pa, -math.pi / 5, self.pb) + ptb = rotation_(self.pb, math.pi / 5, self.pa) + pt = intersection_ll_(self.pa, pta, self.pb, ptb) + return triangle:new(self.pa, self.pb, pt) + else + pta = rotation_(self.pa, math.pi / 5, self.pb) + ptb = rotation_(self.pb, -math.pi / 5, self.pa) + pt = intersection_ll_(self.pa, pta, self.pb, ptb) + return triangle:new(self.pa, self.pb, pt) + end + end -function line: cheops () - local m,n,pt - m = midpoint_ (self.pa,self.pb) - n = rotation_ (m,- math.pi/2,self.pa) - pt = m + (n-m)* tkzsqrtphi - return triangle : new (self.pa,self.pb,pt) +function line:cheops(swap) + local m, n, pt + m = midpoint_(self.pa, self.pb) + swap = swap or false + if swap then + n = rotation_(m, math.pi / 2, self.pa) + pt = m + (n - m) * tkzsqrtphi +else + n = rotation_(m, -math.pi / 2, self.pa) + pt = m + (n - m) * tkzsqrtphi + end + return triangle:new(self.pa, self.pb, pt) end -function line: egyptian () - local n,pt - n = rotation_ (self.pb,- math.pi/2,self.pa) - pt = self.pb + (n-self.pb)/point.mod(n-self.pb)*self.length* 0.75 - return triangle : new (self.pa,self.pb,pt) + +function line:egyptian(swap) + local n, pt + swap = swap or false + if swap then + n = rotation_(self.pb, math.pi / 2, self.pa) + pt = self.pb + (n - self.pb) / point.mod(n - self.pb) * self.length * 0.75 + else + n = rotation_(self.pb, -math.pi / 2, self.pa) + pt = self.pb + (n - self.pb) / point.mod(n - self.pb) * self.length * 0.75 + end + return triangle:new(self.pa, self.pb, pt) end + line.pythagoras = line.egyptian line.isis = line.egyptian line.golden = line.sublime @@ -487,12 +689,14 @@ line.golden_gnomon = line.divine ------------------------------ -- Result -> square ------------------------------ -function line: square (swap) - if swap == nil +function line:square (swap) + swap = swap or false + if swap then - return square : side (self.pa,self.pb) - else return square : side (self.pa,self.pb,indirect) + else + return square : side (self.pa,self.pb) + end end diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_main.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_main.lua index 10ee219519..e5843dae1a 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_main.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_main.lua @@ -1,6 +1,6 @@ -- tkz_elements-main.lua --- date 2024/04/27 --- version 2.25c +-- date 2025/01/06 +-- version 3.10 -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 @@ -12,20 +12,7 @@ -- This work has the LPPL maintenance status “maintained”. -- The Current Maintainer of this work is Alain Matthes. - z = {} - C = {} - E = {} - L = {} - P = {} - M = {} - Q = {} - R = {} - RP = {} - S = {} - T = {} - V = {} - - -- loads module +-- loads module require "tkz_elements_point.lua" require "tkz_elements_line.lua" require "tkz_elements_circle.lua" @@ -48,4 +35,20 @@ require "tkz_elements_functions_circles.lua" require "tkz_elements_functions_triangles.lua" require "tkz_elements_functions_regular.lua" require "tkz_elements_functions_matrices.lua" -require "tkz_elements_matrices.lua"
\ No newline at end of file +require "tkz_elements_matrices.lua" + +function init_elements () + scale=1 + z={} + C={} + E={} + L={} + M={} + P={} + Q={} + R={} + RP={} + S={} + T={} + V={} +end
\ No newline at end of file diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_matrices.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_matrices.lua index 981ac68094..07048af557 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_matrices.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_matrices.lua @@ -1,6 +1,6 @@ -- tkz_elements_matrices.lua --- date 2024/04/27 --- version 2.25c +-- date 2025/01/06 +-- version 3.10 -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 @@ -44,26 +44,37 @@ function matrix.__sub(m1,m2) return add_matrix(m1,k_mul_matrix(-1, m2)) end -function matrix.__pow( m, num ) - if num =='T' then - return transposeMatrix(m) - else - if num == 0 then - return matrix:new( #m,"I" ) - end - if num < 0 then - local i; m,i = inv_matrix ( m ) - if not m then return m, i end - num = -num - end - local mt = m - for i = 2,num do - mt = mul_matrix(mt,m) - end - return mt -end +function matrix.__pow(m, num) + -- Handle transpose (when num is 'T') + if num == 'T' then + return transposeMatrix(m) + end + + -- Handle exponentiation by 0 (returns the identity matrix) + if num == 0 then + return matrix:new(#m, "I") -- Identity matrix + end + + -- Handle negative exponents (invert the matrix) + if num < 0 then + local inv_matrix, err = inv_matrix(m) + if not inv_matrix then + return nil, err -- Return nil and the error if matrix is non-invertible + end + num = -num -- Make exponent positive for easier handling + m = inv_matrix -- Now use the inverted matrix + end + + -- Now handle the positive exponentiation + local result = m + for i = 2, num do + result = mul_matrix(result, m) -- Repeated multiplication + end + + return result end + function matrix.__tostring( A ) local mt = (A.type=='matrix' and A.set or A) local k = {} diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_misc.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_misc.lua index 94c9c555c0..5f01756b5a 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_misc.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_misc.lua @@ -1,6 +1,6 @@ -- tkz_elements_functions_maths.lua --- date 2024/04/27 --- version 2.25c +-- date 2025/01/06 +-- version 3.10 -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 @@ -14,19 +14,31 @@ -- ---------------------------------------------------------------- -- -- ---------------------------------------------------------------- -function get_points (obj) -if obj.type == 'line' then return obj.pa,obj.pb - elseif - obj.type == 'triangle' then return obj.pa,obj.pb,obj.pc - elseif - obj.type == 'circle' then return obj.center,obj.through - elseif - obj.type == 'ellipse' then return obj.pc,obj.pa,obj.pb - elseif - obj.type == 'square' or obj.type == 'rectangle' or obj.type == 'quadrilateral' or obj.type == 'parallelogram' - then return obj.pa,obj.pb,obj.pc,obj.pd -end -end +function get_points(obj) + -- Map of object types to their respective point keys + local point_map = { + line = {"pa", "pb"}, -- Line has two points + triangle = {"pa", "pb", "pc"}, -- Triangle has three points + circle = {"center", "through"}, -- Circle has center and a point through its circumference + ellipse = {"pc", "pa", "pb"}, -- Ellipse has three key points + square = {"pa", "pb", "pc", "pd"}, -- Square has four vertices + rectangle = {"pa", "pb", "pc", "pd"}, -- Rectangle has four vertices + quadrilateral = {"pa", "pb", "pc", "pd"}, -- Quadrilateral has four vertices + parallelogram = {"pa", "pb", "pc", "pd"} -- Parallelogram has four vertices + } + + -- Check if the object's type is recognized + if point_map[obj.type] then + local points = {} + -- Iterate over the keys for the given type and extract the corresponding values + for _, key in ipairs(point_map[obj.type]) do + table.insert(points, obj[key]) + end + -- Return all points as multiple return values + return table.unpack(points) + end + end + function set_lua_to_tex (t) for k,v in pairs(t) do @@ -35,29 +47,49 @@ function set_lua_to_tex (t) end function bisector (a,b,c) - local i - i = in_center_ (a,b,c) + local i = in_center_ (a,b,c) return line : new (a,intersection_ll_ (a,i,b,c)) end -function altitude (a,b,c) - local o,p - o = ortho_center_ (a,b,c) - p = projection_ (b,c,a) - return line : new (a,p) +function altitude(a, b, c) + local o, p + -- Get the orthocenter (which is the point of concurrency of the altitudes) + o = ortho_center_(a, b, c) + + -- Get the perpendicular projection of point 'a' onto the line defined by 'b' and 'c' + p = projection_(b, c, a) + + -- Return the altitude, which is the line from point 'a' to the point 'p' + return line:new(a, p) end -function bisector_ext(a,b,c) -- n =1 swap n=2 2 swap - local i,p - i = in_center_ (a,b,c) - p = rotation_ (a,math.pi/2,i) - return line : new (a,p) + +function bisector_ext(a, b, c) -- n=1 swap n=2 swap 2 + local i, p + -- Get the incenter of the triangle + i = in_center_(a, b, c) + + -- Rotate the incenter by 90 degrees around point 'a' to compute the external bisector + p = rotation_(a, math.pi / 2, i) + + -- Return the external bisector as the line passing through points 'a' and 'p' + return line:new(a, p) end + function equilateral (a,b) return equilateral_tr_ (a,b) end function midpoint (a,b) return (a+b)/2 +end + +function midpoints (...) + return midpoints_(...) +end + + +function length(a,b) + return point.abs (a-b) end
\ No newline at end of file diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_parallelogram.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_parallelogram.lua index fd0a3533a3..8cd02bf73e 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_parallelogram.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_parallelogram.lua @@ -1,6 +1,6 @@ -- tkz_elements_parallelogram.lua --- date 2024/04/27 --- version 2.25c +-- date 2025/01/06 +-- version 3.10 -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_point.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_point.lua index 4eb4b549d1..be28002328 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_point.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_point.lua @@ -1,6 +1,6 @@ -- tkz_elements_point.lua --- date 2024/04/27 --- version 2.25c +-- date 2025/01/06 +-- version 3.10 -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 @@ -252,28 +252,28 @@ function point: west(d) -- return symmetry_ (self ,pt) -- end -function point: symmetry (...) - local obj,nb,t - local tp = table.pack(...) - obj = tp[1] - nb = tp.n - if nb == 1 then - if obj.type == "point" then - return symmetry_ (self,obj) - elseif obj.type == "line" then - return line: new (set_symmetry_ (self,obj.pa,obj.pb)) - elseif obj.type == "circle" then - return circle: new (set_symmetry_ (self,obj.center,obj.through)) - else - return triangle: new (set_symmetry (self,obj.pa,obj.pb,obj.pc)) - end - else - local t = {} - for i=1,tp.n do - table.insert( t , symmetry_ (self , tp[i]) ) - end - return table.unpack ( t ) - end +function point:symmetry(...) + local tp = table.pack(...) -- Pack arguments into a table + local nb = tp.n -- Number of arguments + local obj = tp[1] -- The first object in the arguments + + if nb == 1 then -- If there's only one argument + if obj.type == "point" then + return symmetry_(self, obj) -- Apply symmetry on the point + elseif obj.type == "line" then + return line:new(set_symmetry_(self, obj.pa, obj.pb)) -- Create a new line + elseif obj.type == "circle" then + return circle:new(set_symmetry_(self, obj.center, obj.through)) -- Create a new circle + else + return triangle:new(set_symmetry(self, obj.pa, obj.pb, obj.pc)) -- Create a new triangle + end + else -- If there are multiple arguments + local results = {} -- Initialize a table to store results + for i = 1, nb do + table.insert(results, symmetry_(self, tp[i])) -- Apply symmetry on each object + end + return table.unpack(results) -- Return the results as separate values + end end function point: set_symmetry (...) @@ -288,56 +288,56 @@ function point:set_rotation (angle,...) return set_rotation_ ( self,angle,... ) end -function point : rotation (angle,...) - local obj,nb,t - local tp = table.pack(...) - obj = tp[1] - nb = tp.n - if nb == 1 then - if obj.type == "point" then - return rotation_ (self,angle,obj ) - elseif obj.type == "line" then - return line : new (set_rotation_ (self, angle,obj.pa,obj.pb )) - elseif obj.type == "triangle" then - return triangle: new (set_rotation_ (self, angle,obj.pa,obj.pb,obj.pc)) - elseif obj.type == "circle" then -return circle : new (set_rotation_ (self,angle,obj.center,obj.through)) - else -return square: new (set_rotation_(self,angle,obj.pa,obj.pb,obj.pc,obj.pd)) - end - else - t = {} - for i=1,tp.n do - table.insert( t , rotation_ ( self,angle,tp[i])) - end - return table.unpack ( t ) - end +function point:rotation(angle, ...) + local tp = table.pack(...) -- Pack arguments into a table + local nb = tp.n -- Number of arguments + local obj = tp[1] -- The first object in the arguments + + if nb == 1 then -- If there's only one argument + if obj.type == "point" then + return rotation_(self, angle, obj) -- Rotate the point + elseif obj.type == "line" then + return line:new(set_rotation_(self, angle, obj.pa, obj.pb)) -- Rotate the line + elseif obj.type == "triangle" then + return triangle:new(set_rotation_(self, angle, obj.pa, obj.pb, obj.pc)) -- Rotate the triangle + elseif obj.type == "circle" then + return circle:new(set_rotation_(self, angle, obj.center, obj.through)) -- Rotate the circle + else -- For other shapes like square + return square:new(set_rotation_(self, angle, obj.pa, obj.pb, obj.pc, obj.pd)) -- Rotate the square + end + else -- If there are multiple arguments + local results = {} -- Initialize a table to store results + for i = 1, nb do + table.insert(results, rotation_(self, angle, tp[i])) -- Rotate each object + end + return table.unpack(results) -- Return the results as separate values + end end -function point : homothety (coeff,...) -local obj,nb,t -local tp = table.pack(...) -obj = tp[1] -nb = tp.n - if nb == 1 then - if obj.type == "point" then - return homothety_ (self,coeff,obj ) - elseif obj.type == "line" then - return line : new (set_homothety_ (self, coeff,obj.pa,obj.pb )) - elseif obj.type == "triangle" then - return triangle: new (set_homothety_(self,coeff,obj.pa,obj.pb,obj.pc)) - elseif obj.type == "circle" then - return circle: new (set_homothety_(self,coeff,obj.center,obj.through)) - else -return square: new (set_homothety_(self,coeff,obj.pa,obj.pb)) - end - else - t = {} - for i=1,tp.n do - table.insert( t , homothety_ ( self,coeff,tp[i])) - end - return table.unpack ( t ) - end +function point:homothety(coeff, ...) + local tp = table.pack(...) -- Pack arguments into a table + local nb = tp.n -- Number of arguments + local obj = tp[1] -- The first object in the arguments + local t = {} -- Initialize a table to store results + + if nb == 1 then -- If there's only one argument + if obj.type == "point" then + return homothety_(self, coeff, obj) -- Apply homothety to the point + elseif obj.type == "line" then + return line:new(set_homothety_(self, coeff, obj.pa, obj.pb)) -- Apply homothety to the line + elseif obj.type == "triangle" then + return triangle:new(set_homothety_(self, coeff, obj.pa, obj.pb, obj.pc)) -- Apply homothety to the triangle + elseif obj.type == "circle" then + return circle:new(set_homothety_(self, coeff, obj.center, obj.through)) -- Apply homothety to the circle + else -- For other shapes like square + return square:new(set_homothety_(self, coeff, obj.pa, obj.pb, obj.pc, obj.pd)) -- Apply homothety to the square + end + else -- If there are multiple arguments + for i = 1, nb do + table.insert(t, homothety_(self, coeff, tp[i])) -- Apply homothety to each object + end + return table.unpack(t) -- Return the results as separate values + end end function point: normalize() @@ -345,16 +345,19 @@ function point: normalize() return point(self.re/d,self.im/d) end -function point: orthogonal(d) +function point:orthogonal(d) local m - if d==nil then - return point(-self.im,self.re) -else - m = point.mod(self) - return point(-self.im*d/m,self.re*d/m) -end + if d == nil then + -- If no scaling factor d is provided, return the point rotated 90 degrees counterclockwise + return point(-self.im, self.re) + else + -- If a scaling factor d is provided, scale the orthogonal point + m = point.mod(self) -- Get the modulus (magnitude) of the current point + return point(-self.im * d / m, self.re * d / m) -- Return the scaled orthogonal point + end end + function point : at (z) return point(self.re+z.re,self.im+z.im) end diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_quadrilateral.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_quadrilateral.lua index e77e0af561..0cc6ca30a6 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_quadrilateral.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_quadrilateral.lua @@ -1,6 +1,6 @@ -- tkz_elements_quadrilateral.lua --- date 2024/04/27 --- version 2.25c +-- date 2025/01/06 +-- version 3.10 -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_rectangle.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_rectangle.lua index 2c07f78399..5247d48e1b 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_rectangle.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_rectangle.lua @@ -1,6 +1,6 @@ -- tkz_elements-rectangle.lua --- date 2024/04/27 --- version 2.25c +-- date 2025/01/06 +-- version 3.10 -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 @@ -24,34 +24,34 @@ function rectangle: new (za, zb,zc,zd) end if math.abs(point.abs (zc-za)-point.abs (zd-zb)) < tkz_epsilon then else error ("it's not a rectangle") end - local type = 'rectangle' - local center = midpoint_ (za,zc) - local exradius = point.abs (center-za) - local ab = line : new (za,zb) - local bc = line : new (zb,zc) - local cd = line : new (zc,zd) - local da = line : new (zd,za) - local ac = line : new (za,zc) - local bd = line : new (zb,zd) - local length = point.mod (zb-za) - local width = point.mod (zd-za) - local diagonal = point.abs (zc-za) - local o = { pa = za, - pb = zb, - pc = zc, - pd = zd, - ab = ab, - ac = ac, - bc = bc, - da = da, - cd = cd, - bd = bd, - diagonal = diagonal, - exradius = exradius, - center = center, - length = length, - width = width, - type = type } + local type = 'rectangle' + local center = midpoint_ (za,zc) + local circumradius = point.abs (center-za) + local ab = line : new (za,zb) + local bc = line : new (zb,zc) + local cd = line : new (zc,zd) + local da = line : new (zd,za) + local ac = line : new (za,zc) + local bd = line : new (zb,zd) + local length = point.mod (zb-za) + local width = point.mod (zd-za) + local diagonal = point.abs (zc-za) + local o = { pa = za, + pb = zb, + pc = zc, + pd = zd, + ab = ab, + ac = ac, + bc = bc, + da = da, + cd = cd, + bd = bd, + diagonal = diagonal, + circumradius = circumradius, + center = center, + length = length, + width = width, + type = type } setmetatable(o, self) self.__index = self return o @@ -69,7 +69,7 @@ function rectangle : gold (za,zb,swap) local zc,zd local a = point.arg (zb-za) local d = point.abs(zb-za)/tkzphi - if swap == nil then swap = false end + swap = swap or false if swap then zc = zb : south (d/scale) zc = rotation_ (zb,a,zc) @@ -87,7 +87,7 @@ end function rectangle : diagonal (za,zc,swap) local zb,zd - if swap == nil then swap = false end + swap = swap or false if swap then zd = point (zc.re,za.im) zb = point (za.re,zc.im) @@ -102,7 +102,7 @@ end function rectangle : side (za,zb,d,swap) local a,zc,zd a = point.arg (zb-za) - if swap == nil then swap = false end + swap = swap or false if swap then zc = zb : south (d/scale) zc = rotation_ (zb,a,zc) diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_regular.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_regular.lua index 0641a858de..65c197d315 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_regular.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_regular.lua @@ -1,6 +1,6 @@ -- tkz_elements_regular.lua --- date 2024/04/27 --- version 2.25c +-- date 2025/01/06 +-- version 3.10 -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 @@ -11,32 +11,36 @@ -- version 2005/12/01 or later. -- This work has the LPPL maintenance status “maintained”. -- The Current Maintainer of this work is Alain Matthes. - +-- za = center zb a vertex regular_polygon = {} function regular_polygon: new (za, zb ,nb) local type = 'regular_polygon' - local table = regular_ (za , zb , nb) + local table = regular_ (za , zb , nb) local center = za local through = zb local angle = 2 * math.pi/nb - local exradius = point.abs (zb-za) + local circumradius = point.abs (zb-za) local circle = circle : new (za,zb) - local inradius = exradius * math.cos(math.pi/nb) - local side = exradius * math.sin(math.pi/nb) + local inradius = circumradius * math.cos(math.pi/nb) + local side = circumradius * math.sin(math.pi/nb) local next = table[2] local first = table[1] local proj = projection_ (first,next,za) + local perimeter = nb * side + local area = (perimeter * inradius)/2 local o = { type = type, center = center, through = through, - exradius = exradius, + circumradius= circumradius, inradius = inradius, table = table, circle = circle, nb = nb, angle = angle, side = side, - proj = proj } + proj = proj, + perimeter = perimeter, + area = area} setmetatable(o, self) self.__index = self return o @@ -52,7 +56,7 @@ end ----------------------- function regular_polygon : incircle () local next,first - next = self.table[2] + next = self.table[2] first = self.table[1] return circle : new ( self.center , projection_ (first,next,self.center) ) end diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_square.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_square.lua index 1852c0ded4..d968feacde 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_square.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_square.lua @@ -1,6 +1,6 @@ -- tkz_elements-square.lua --- date 2024/04/27 --- version 2.25c +-- date 2025/01/06 +-- version 3.10 -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 @@ -27,38 +27,42 @@ function square: new (za, zb,zc,zd) if math.abs(point.abs (zb-za) - point.abs (zd-za)) < tkz_epsilon then else error ("it's not a square (side)") end - local type = 'square' - local side = point.abs ( zb - za ) - local pc = rotation_ (zb,-math.pi/2,za) - local pd = rotation_ (za,math.pi/2,zb) - local center = midpoint_ (za,zc) - local exradius = point.abs (center-za) - local inradius = exradius * math.cos(math.pi/4) - local diagonal = math.sqrt(2) * side - local proj = projection_ (za,zb,center) - local ab = line : new (za,zb) - local bc = line : new (zb,zc) - local cd = line : new (zc,zd) - local da = line : new (zd,za) - local bd = line : new (zb,zd) - local ac = line : new (za,zc) - local o = { pa = za, - pb = zb, - pc = zc, - pd = zd, - side = side, - center = center, - exradius = exradius, - inradius = inradius, - diagonal = diagonal, - proj = proj, - ab = ab, - ac = ac, - bc = bc, - da = da, - cd = cd, - bd = bd, - type = type } + local type = 'square' + local side = point.abs ( zb - za ) + local pc = rotation_ (zb,-math.pi/2,za) + local pd = rotation_ (za,math.pi/2,zb) + local center = midpoint_ (za,zc) + local circumradius = point.abs (center-za) + local inradius = circumradius * math.cos(math.pi/4) + local diagonal = math.sqrt(2) * side + local proj = projection_ (za,zb,center) + local ab = line : new (za,zb) + local bc = line : new (zb,zc) + local cd = line : new (zc,zd) + local da = line : new (zd,za) + local bd = line : new (zb,zd) + local ac = line : new (za,zc) + local area = side * side + local perimeter = 4 * side + local o = { pa = za, + pb = zb, + pc = zc, + pd = zd, + side = side, + center = center, + circumradius = circumradius, + inradius = inradius, + diagonal = diagonal, + proj = proj, + ab = ab, + ac = ac, + bc = bc, + da = da, + cd = cd, + bd = bd, + type = type, + area = area, + perimeter = perimeter } setmetatable(o, self) self.__index = self return o @@ -71,16 +75,20 @@ function square : rotation (zi,za) return square : new (za,zb,zc,zd) end -function square : side (za,zb,swap) - if swap == nil - then - local zc = rotation_ (zb,-math.pi/2,za) - local zd = rotation_ (za,math.pi/2,zb) - return square : new (za,zb,zc,zd) +function square:side(za, zb, swap) + swap = swap or false + if swap then + -- Rotate zb clockwise around za to get zc + local zc = rotation_(zb, math.pi / 2, za) + -- Rotate za counterclockwise around zb to get zd + local zd = rotation_(za, -math.pi / 2, zb) + return square:new(za, zb, zc, zd) else - local zc = rotation_ (zb,math.pi/2,za) - local zd = rotation_ (za,-math.pi/2,zb) - return square : new (za,zb,zc,zd) + -- Rotate zb counterclockwise around za to get zc + local zc = rotation_(zb, -math.pi / 2, za) + -- Rotate za clockwise around zb to get zd + local zd = rotation_(za, math.pi / 2, zb) + return square:new(za, zb, zc, zd) end end diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_triangle.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_triangle.lua index c6dd2c3757..5267740033 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_triangle.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_triangle.lua @@ -1,6 +1,6 @@ -- tkz_elements_triangles.lua --- date 2024/04/27 --- version 2.25c +-- date 2025/01/06 +-- version 3.10 -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 @@ -30,6 +30,10 @@ function triangle: new (za, zb ,zc) local ab = line : new (za,zb) local ca = line : new (zc,za) local bc = line : new (zb,zc) + local semiperimeter = (a+b+c)/2 + local area = math.sqrt((semiperimeter)*(semiperimeter-a)*(semiperimeter-b)*(semiperimeter-c)) + local inradius = area / semiperimeter + local circumradius = (a*b*c)/(4*inradius*semiperimeter) local o = { pa = za, pb = zb, pc = zc, @@ -48,7 +52,11 @@ function triangle: new (za, zb ,zc) bc = bc, alpha = alpha, beta = beta, - gamma = gamma} + gamma = gamma, + semiperimeter = semiperimeter, + area = area, + inradius = inradius, + circumradius = circumradius} setmetatable(o, self) self.__index = self return o @@ -57,19 +65,19 @@ end -- points -- ----------------------- function triangle: trilinear (a,b,c) - return barycenter_ ( {self.pa,a*self.a },{self.pb,b*self.b},{self.pc,c*self.c} ) + return barycenter_ ({self.pa,a*self.a},{self.pb,b*self.b},{self.pc,c*self.c}) end function triangle: barycentric (a,b,c) - return barycenter_ ( {self.pa,a },{self.pb,b},{self.pc,c} ) + return barycenter_ ({self.pa,a},{self.pb,b},{self.pc,c}) end function triangle: bevan_point () - return circum_center_ ( self : excentral_tr()) + return circum_center_ ( excentral_tr_ ( self.pa , self.pb , self.pc)) end function triangle: mittenpunkt_point () - return lemoine_point_ ( self : excentral_tr()) + return lemoine_point_ ( excentral_tr_ ( self.pa , self.pb , self.pc)) end function triangle: gergonne_point () @@ -110,24 +118,25 @@ function triangle: euler_points () return midpoint_ ( H,self.pa ), midpoint_ ( H,self.pb ), midpoint_ ( H,self.pc ) end -function triangle: nine_points () - local H,ma,mb,mc,H,ha,hb,hc - ma,mb,mc = medial_tr_ ( self.pa , self.pb , self.pc) - ha,hb,hc = orthic_tr_ ( self.pa , self.pb , self.pc) - H = ortho_center_ ( self.pa , self.pb , self.pc ) - return - ma,mb,mc, - ha,hb,hc, - midpoint_ ( H,self.pa ), - midpoint_ ( H,self.pb ), - midpoint_ ( H,self.pc ) +function triangle:nine_points() + local ma, mb, mc, ha, hb, hc, H + -- Calculate the medial triangle + ma, mb, mc = medial_tr_(self.pa, self.pb, self.pc) + -- Calculate the orthic triangle + ha, hb, hc = orthic_tr_(self.pa, self.pb, self.pc) + -- Calculate the orthocenter + H = ortho_center_(self.pa, self.pb, self.pc) + + -- Return the points of the nine-point circle + return ma, mb, mc, ha, hb, hc, + midpoint_(H, self.pa), midpoint_(H, self.pb), midpoint_(H, self.pc) end + function triangle : point (t) - local t1,t2,p - p = (self.a + self.b + self.c) - t1 = self.a / p - t2 = (self.a + self.b) / p + local p = (self.a + self.b + self.c) + local t1 = self.a / p + local t2 = (self.a + self.b) / p if t<= t1 then return self.ab : point (t/t1) elseif t <= t2 then @@ -163,11 +172,10 @@ function triangle: euler_line () end function triangle: symmedian_line (n) - local a,b,c,l - a = self.pa - b = self.pb - c = self.pc - l = self : lemoine_point () + local a = self.pa + local b = self.pb + local c = self.pc + local l = self : lemoine_point () if n==1 then return line : new (b,intersection_ll_ (b,l,a,c)) elseif n==2 then @@ -184,23 +192,22 @@ function triangle: altitude (n) c = self.pc o = ortho_center_ (a,b,c) if n==1 then - p = projection_ (a,c,b) + p = projection_ (a,c,b) return line : new (b,p) elseif n==2 then p = projection_ (a,b,c) return line : new (c,p) else - p = projection_ (b,c,a) + p = projection_ (b,c,a) return line : new (a,p) end end function triangle: bisector (n) - local a,b,c,i - a = self.pa - b = self.pb - c = self.pc - i = in_center_ (a,b,c) + local a = self.pa + local b = self.pb + local c = self.pc + local i = in_center_ (a,b,c) if n==1 then return line : new (b,intersection_ll_ (b,i,a,c)) elseif n==2 then @@ -211,10 +218,9 @@ function triangle: bisector (n) end function triangle: bisector_ext(n) -- n =1 swap n=2 2 swap -local a,b,c - a = self.pa - b = self.pb - c = self.pc + local a = self.pa + local b = self.pb + local c = self.pc if n==1 then -- ac return line : new (b,bisector_ext_ (b,c,a)) elseif n==2 then -- ab @@ -254,21 +260,21 @@ end ----------------------- --- Result -> circles -- ----------------------- -function triangle: euler_circle () +function triangle:euler_circle() return circle : new (euler_center_ ( self.pa , self.pb , self.pc),midpoint_( self.pb , self.pc)) end -function triangle: circum_circle() +function triangle:circum_circle() return circle : new (circum_circle_ ( self.pa , self.pb , self.pc), self.pa ) end -function triangle: in_circle () +function triangle:in_circle() local o o = in_center_ ( self.pa , self.pb , self.pc) return circle : new (o, projection_ (self.pb , self.pc,o) ) end -function triangle: ex_circle (n) -- n =1 swap n=2 2 swap +function triangle:ex_circle (n) -- n =1 swap n=2 2 swap local a,b,c,o a = self.pa b = self.pb @@ -322,13 +328,20 @@ function triangle : cevian_circle (p) pta,ptb,ptc = cevian_ (self.pa,self.pb,self.pc,p) return circle : new (circum_circle_ (pta,ptb,ptc),pta) end + +function triangle : symmedial_circle () + local pta,ptb,ptc,p + p = lemoine_point_ ( self.pa , self.pb , self.pc) + pta,ptb,ptc = cevian_ (self.pa,self.pb,self.pc,p) + return circle : new (circum_circle_ (pta,ptb,ptc),pta) +end - function triangle : conway_circle () - local i,t - i = in_center_ (self.pa,self.pb,self.pc) - t = report_ (self.pb,self.pa,length(self.pb,self.pc),self.pa) - return circle : new (i,t) - end +function triangle : conway_circle () + local i,t + i = in_center_ (self.pa,self.pb,self.pc) + t = report_ (self.pb,self.pa,length(self.pb,self.pc),self.pa) + return circle : new (i,t) +end function triangle : pedal_circle (pt) local x,y,z,c @@ -338,7 +351,13 @@ function triangle : pedal_circle (pt) c = circum_center_ (x,y,z) return circle : new (c,x) end - + +function triangle: bevan_circle () + local o,r,s,t + o = circum_center_ ( excentral_tr_ ( self.pa , self.pb , self.pc)) + r,s,t = excentral_tr_ ( self.pa , self.pb , self.pc) +return circle : new (o, r) +end ------------------- -- Result -> triangle ------------------- @@ -392,6 +411,12 @@ function triangle: symmedian () return triangle : new (cevian_ (self.pa,self.pb,self.pc,p)) end +function triangle: symmedial () + local p + p = lemoine_point_ ( self.pa , self.pb , self.pc) + return triangle : new (cevian_ (self.pa,self.pb,self.pc,p)) +end + function triangle: euler () return triangle : new (euler_points_ (self.pa,self.pb,self.pc) ) end @@ -403,6 +428,10 @@ function triangle: pedal (pt) z = projection_ (self.pa,self.pb,pt) return triangle : new (x,y,z) end + +function triangle: similar () + return triangle : new (similar_ (self.pa,self.pb,self.pc) ) +end ------------------- -- Result -> ellipse ------------------- @@ -482,5 +511,42 @@ function triangle: check_acutangle() end end +-- Circle tangent to two straight lines passing through a given point +function triangle:c_ll_p(p) + + -- Compute the bisector of the triangle + local lbi = bisector(self.pa, self.pb,self.pc) + + if lbi:in_out(p) then + -- Orthogonal projection of p onto the bisector + local lp = lbi:ortho_from(p) + + -- Intersection of line from p to its projection with self.pa and self.pb + local i = intersection_ll_(p, lp.pb, self.pa, self.pb) + + -- Intersection points of the line with the circle defined by (i, p) + local t1, t2 = intersection_lc_(self.pa, self.pb, i, p) + + -- Create the main line and find orthogonal projections from t1 and t2 + local lab = line:new(self.pa, self.pb) + local x = lab:ortho_from(t1).pb + local y = lab:ortho_from(t2).pb + + -- Return two circles based on the orthogonal projections and points t1, t2 + return circle:new(intersection_ll_(x, t1, self.pa, p), t1), + circle:new(intersection_ll_(y, t2, self.pa, p), t2) + else + local lab = line:new(self.pa, self.pb) + -- Reflection of p across the bisector + local q = lbi : reflection (p) + + -- Compute circles from the Wallis construction + local c1, c2 = lab:c_l_pp(p, q) + + -- Return two circles with centers and points on their circumference + return c1,c2 + end +end + return triangle
\ No newline at end of file diff --git a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_vector.lua b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_vector.lua index 8b26fe4bd3..7e9f0ff94f 100644 --- a/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_vector.lua +++ b/macros/latex/contrib/tkz/tkz-elements/latex/tkz_elements_vector.lua @@ -1,6 +1,6 @@ -- tkz_elements_vectors.lua --- date 2024/04/27 --- version 2.25c +-- date 2025/01/06 +-- version 3.10 -- Copyright 2024 Alain Matthes -- This work may be distributed and/or modified under the -- conditions of the LaTeX Project Public License, either version 1.3 |