| 1 |
\newpage |
| 2 |
\section{Class \tkzClass{quadrilateral}} |
| 3 |
|
| 4 |
\vspace{1em} |
| 5 |
The variable \tkzVar{quadrilateral}{Q} holds a table used to store quadrilaterals. It is optional, and you are free to choose the variable name. However, using \code{Q} is a recommended convention for clarity and consistency. If you use a custom variable (e.g., Quad), you must initialize it manually. The \tkzFct{tkz-elements}{init\_elements()} function reinitializes the \code{Q} table if used. |
| 6 |
|
| 7 |
|
| 8 |
\subsection{Creating a quadrilateral} |
| 9 |
\label{sub:creating_a_quadrilateral} |
| 10 |
The \tkzClass{quadrilateral} class requires four points. The order defines the sides of the quadrilateral. |
| 11 |
|
| 12 |
\medskip |
| 13 |
The object is usually stored in \tkzVar{quadrilateral}{Q}, which is the recommended variable name. |
| 14 |
|
| 15 |
\begin{mybox} |
| 16 |
\begin{verbatim} |
| 17 |
Q.ABCD = quadrilateral:new(z.A, z.B, z.C, z.D) |
| 18 |
\end{verbatim} |
| 19 |
\end{mybox} |
| 20 |
|
| 21 |
\textbf{Short form.} |
| 22 |
|
| 23 |
A shorthand constructor is also available: |
| 24 |
|
| 25 |
\begin{mybox} |
| 26 |
\begin{verbatim} |
| 27 |
Q.ABCD = quadrilateral(z.A, z.B, z.C, z.D) |
| 28 |
\end{verbatim} |
| 29 |
\end{mybox} |
| 30 |
|
| 31 |
\subsection{Quadrilateral Attributes} |
| 32 |
Points are created in the direct direction. A test is performed to check whether the points form a rectangle, otherwise compilation is blocked. |
| 33 |
|
| 34 |
\begin{center} |
| 35 |
\code{ Creation: Q.new = rectangle:new(z.A,z.B,z.C,z.D)} |
| 36 |
\end{center} |
| 37 |
|
| 38 |
|
| 39 |
\bgroup |
| 40 |
\catcode`_=12 |
| 41 |
\small |
| 42 |
\captionof{table}{rectangle attributes.}\label{quadrilateral:attributes} |
| 43 |
\begin{tabular}{lll} |
| 44 |
\toprule |
| 45 |
\textbf{Attributes} & \textbf{Application} & \\ |
| 46 |
\tkzAttr{quadrilateral}{pa} & |z.A = Q.new.pa| & \\ |
| 47 |
\tkzAttr{quadrilateral}{pb} & |z.B = Q.new.pb| & \\ |
| 48 |
\tkzAttr{quadrilateral}{pc} & |z.C = Q.new.pc| & \\ |
| 49 |
\tkzAttr{quadrilateral}{pd} & |z.D = Q.new.pd| & \\ |
| 50 |
\tkzAttr{quadrilateral}{type} & |Q.new.type= 'quadrilateral'| &\\ |
| 51 |
\tkzAttr{quadrilateral}{center} & |z.I = Q.new.center| & intersection of diagonals\\ |
| 52 |
\tkzAttr{quadrilateral}{g} & |z.G = Q.new.g| & barycenter\\ |
| 53 |
\tkzAttr{quadrilateral}{a} & |AB = Q.new.a| & barycenter\\ |
| 54 |
\tkzAttr{quadrilateral}{b} & |BC = Q.new.b| & barycenter\\ |
| 55 |
\tkzAttr{quadrilateral}{c} & |CD = Q.new.c| & barycenter\\ |
| 56 |
\tkzAttr{quadrilateral}{d} & |DA = Q.new.d| & barycenter\\ |
| 57 |
\tkzAttr{quadrilateral}{ab} & |Q.new.ab| & line passing through two vertices \\ |
| 58 |
\tkzAttr{quadrilateral}{ac} & |Q.new.ca| & idem. \\ |
| 59 |
\tkzAttr{quadrilateral}{ad} & |Q.new.ad| & idem. \\ |
| 60 |
\tkzAttr{quadrilateral}{bc} & |Q.new.bc| & idem. \\ |
| 61 |
\tkzAttr{quadrilateral}{bd} & |Q.new.bd| & idem. \\ |
| 62 |
\tkzAttr{quadrilateral}{cd} & |Q.new.cd| & idem. \\ |
| 63 |
\bottomrule |
| 64 |
\end{tabular} |
| 65 |
\egroup |
| 66 |
|
| 67 |
|
| 68 |
\subsubsection{Quadrilateral attributes} |
| 69 |
|
| 70 |
\vspace{1em} |
| 71 |
\begin{minipage}{.5\textwidth} |
| 72 |
\begin{verbatim} |
| 73 |
\directlua{ |
| 74 |
init_elements() |
| 75 |
z.A = point(0, 0) |
| 76 |
z.B = point(4, 0) |
| 77 |
z.C = point(5, 1) |
| 78 |
z.D = point(0, 3) |
| 79 |
Q.ABCD = quadrilateral(z.A, z.B, z.C, z.D) |
| 80 |
z.I = Q.ABCD.i |
| 81 |
z.G = Q.ABCD.g} |
| 82 |
|
| 83 |
\begin{tikzpicture} |
| 84 |
\tkzGetNodes |
| 85 |
\tkzDrawPolygon(A,B,C,D) |
| 86 |
\tkzDrawSegments(A,C B,D) |
| 87 |
\tkzDrawPoints(A,B,C,D,I,G) |
| 88 |
\end{tikzpicture} |
| 89 |
\end{verbatim} |
| 90 |
\end{minipage} |
| 91 |
\begin{minipage}{.5\textwidth} |
| 92 |
\directlua{ |
| 93 |
init_elements() |
| 94 |
z.A = point(0, 0) |
| 95 |
z.B = point(4, 0) |
| 96 |
z.C = point(5, 1) |
| 97 |
z.D = point(0, 3) |
| 98 |
Q.ABCD = quadrilateral(z.A, z.B, z.C, z.D) |
| 99 |
z.I = Q.ABCD.center |
| 100 |
z.G = Q.ABCD.g} |
| 101 |
|
| 102 |
\begin{center} |
| 103 |
\begin{tikzpicture} |
| 104 |
\tkzGetNodes |
| 105 |
\tkzDrawPolygon(A,B,C,D) |
| 106 |
\tkzDrawSegments(A,C B,D) |
| 107 |
\tkzDrawPoints(A,B,C,D,I,G) |
| 108 |
\end{tikzpicture} |
| 109 |
\end{center} |
| 110 |
\end{minipage} |
| 111 |
|
| 112 |
\subsubsection{Quadrilateral examples} |
| 113 |
Advanced Euclidean Geometry 2013 Supplement June 26\\ |
| 114 |
|
| 115 |
\texttt{Construction of geometric mean: } |
| 116 |
|
| 117 |
|
| 118 |
\directlua{ |
| 119 |
init_elements() |
| 120 |
z.A = point(0, 0) |
| 121 |
z.B = point(1, 4) |
| 122 |
z.C = point(3.5, 4) |
| 123 |
z.D = point(5, 0 ) |
| 124 |
Q.ABCD = quadrilateral(z.A, z.B, z.C, z.D) |
| 125 |
z.I = Q.ABCD.center |
| 126 |
L.ll = Q.ABCD.da:ll_from(z.I) |
| 127 |
z.H = intersection(L.ll, Q.ABCD.ab) |
| 128 |
z.Hp = intersection(L.ll, Q.ABCD.cd) |
| 129 |
z.M = Q.ABCD.ab.mid |
| 130 |
C.MA = circle(z.M, z.A) |
| 131 |
L.perp = Q.ABCD.ab:ortho_from(z.H) |
| 132 |
_,z.P = intersection (C.MA, L.perp) |
| 133 |
T.PAB = triangle (z.P, z.A, z.B) |
| 134 |
L.bis = T.PAB:bisector () |
| 135 |
z.G = L.bis.pb |
| 136 |
L.llg = Q.ABCD.da:ll_from(z.G) |
| 137 |
L.llm = Q.ABCD.da:ll_from(z.M) |
| 138 |
z.Gp = intersection(L.llg, Q.ABCD.cd)} |
| 139 |
\begin{center} |
| 140 |
\begin{tikzpicture} |
| 141 |
\tkzGetNodes |
| 142 |
\tkzDrawPolygon(A,B,C,D) |
| 143 |
\tkzDrawCircle(M,A) |
| 144 |
\tkzDrawSegments[red](H,H') |
| 145 |
\tkzDrawSegments[blue](G,G') |
| 146 |
\tkzDrawSegments[dashed](P,H P,B P,A P,G A,C B,D) |
| 147 |
\tkzDrawPoints(A,B,C,D,H,I,M,P,G,G',H') |
| 148 |
\tkzLabelPoints(A,D,I) |
| 149 |
\tkzLabelPoints[above](B,C,P) |
| 150 |
\tkzLabelPoints[above right=-3pt](H,G) |
| 151 |
\tkzLabelPoints[right](G',H') |
| 152 |
\tkzLabelSegment[above](B,C){$b$} |
| 153 |
\tkzLabelSegment[below](A,D){$a$} |
| 154 |
\end{tikzpicture} |
| 155 |
\end{center} |
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
\begin{proof} |
| 160 |
A trapezoid with parallel sides $AD$ and $BC$ is given. |
| 161 |
|
| 162 |
Let H be the endpoint of the parallel through $I$ |
| 163 |
to the side $AD$. $HH' = \dfrac{2ab}{a+b}$ . |
| 164 |
|
| 165 |
$PH$ is perpendicular to $AB$ |
| 166 |
|
| 167 |
$(PG)$ is the bisector of $\widehat{APB}$ |
| 168 |
|
| 169 |
$GG' = \dfrac{a \cdot \sqrt{b} + b \cdot \sqrt{a}}{\sqrt{a}+\sqrt{b}} |
| 170 |
= \dfrac{\sqrt{ab}(\sqrt{a}+\sqrt{b})}{\sqrt{a}+\sqrt{b}} = \sqrt{ab} $ |
| 171 |
\end{proof} |
| 172 |
|
| 173 |
\texttt{Code: } |
| 174 |
|
| 175 |
\begin{verbatim} |
| 176 |
\directlua{ |
| 177 |
init_elements() |
| 178 |
z.A = point(0, 0) |
| 179 |
z.B = point(1, 4) |
| 180 |
z.C = point(3.5, 4) |
| 181 |
z.D = point(5, 0 ) |
| 182 |
Q.ABCD = quadrilateral(z.A, z.B, z.C, z.D) |
| 183 |
z.I = Q.ABCD.center |
| 184 |
L.ll = Q.ABCD.da:ll_from (z.I) |
| 185 |
z.H = intersection(L.ll, Q.ABCD.ab) |
| 186 |
z.Hp = intersection(L.ll, Q.ABCD.cd) |
| 187 |
z.M = Q.ABCD.ab.mid |
| 188 |
C.MA = circle(z.M,z.A) |
| 189 |
L.perp = Q.ABCD.ab:ortho_from(z.H) |
| 190 |
_,z.P = intersection(C.MA, L.perp) |
| 191 |
T.PAB = triangle(z.P, z.A, z.B) |
| 192 |
L.bis = T.PAB:bisector() |
| 193 |
z.G = L.bis.pb |
| 194 |
L.llg = Q.ABCD.da:ll_from(z.G) |
| 195 |
L.llm = Q.ABCD.da:ll_from(z.M) |
| 196 |
z.Gp = intersection(L.llg, Q.ABCD.cd)} |
| 197 |
\end{verbatim} |
| 198 |
|
| 199 |
\subsection{Quadrilateral methods} |
| 200 |
|
| 201 |
\vspace{1em} |
| 202 |
|
| 203 |
\bgroup |
| 204 |
\catcode`_=12 |
| 205 |
\small |
| 206 |
\captionof{table}{Quadrilateral methods.}\label{quadrilateral:methods} |
| 207 |
\begin{tabular}{ll} |
| 208 |
\toprule |
| 209 |
\textbf{Methods} & \texttt{Reference} \\ |
| 210 |
\midrule |
| 211 |
\tkzMeth{quadrilateral}{new()}& [\ref{sub:creating_a_quadrilateral}]\\ |
| 212 |
|
| 213 |
\tkzMeth{quadrilateral}{is\_cyclic ()} & [\ref{ssub:iscyclic}]\\ |
| 214 |
\tkzMeth{quadrilateral}{is\_convex ()} & [\ref{ssub:isconvex}]\\ |
| 215 |
\tkzMeth{quadrilateral}{poncelet\_point()} & [\ref{ssub:poncelet_point}]\\ |
| 216 |
\bottomrule % |
| 217 |
\end{tabular} |
| 218 |
\egroup |
| 219 |
|
| 220 |
|
| 221 |
|
| 222 |
\subsubsection{Method \tkzMeth{quadrilateral}{is\_cyclic()}} |
| 223 |
\label{ssub:iscyclic} |
| 224 |
|
| 225 |
\textbf{Inscribed quadrilateral} |
| 226 |
|
| 227 |
\vspace{1em} |
| 228 |
\begin{minipage}{.5\textwidth} |
| 229 |
\begin{verbatim} |
| 230 |
\directlua{ |
| 231 |
init_elements() |
| 232 |
z.A = point(0, 0) |
| 233 |
z.B = point(4, 0) |
| 234 |
z.D = point:polar(4, tkz.tau / 3) |
| 235 |
L.DB = line(z.D, z.B) |
| 236 |
T.equ = L.DB:equilateral() |
| 237 |
z.C = T.equ.pc |
| 238 |
Q.new = quadrilateral(z.A, z.B, z.C, z.D) |
| 239 |
bool = Q.new:is_cyclic() |
| 240 |
if bool == true then |
| 241 |
C.cir = triangle(z.A, z.B, z.C): |
| 242 |
circum_circle() |
| 243 |
z.O = C.cir.center |
| 244 |
end} |
| 245 |
\begin{tikzpicture} |
| 246 |
\tkzGetNodes |
| 247 |
\tkzDrawPolygon(A,B,C,D) |
| 248 |
\tkzDrawPoints(A,B,C,D) |
| 249 |
\tkzDrawCircle(O,A) |
| 250 |
\ifthenelse{\equal{\tkzUseLua{bool}}{ |
| 251 |
true}}{\tkzDrawCircle(O,A)}{} |
| 252 |
\tkzLabelPoints(A,B) |
| 253 |
\tkzLabelPoints[above](C,D) |
| 254 |
\end{tikzpicture} |
| 255 |
\end{verbatim} |
| 256 |
\end{minipage} |
| 257 |
\begin{minipage}{.5\textwidth} |
| 258 |
\directlua{ |
| 259 |
init_elements() |
| 260 |
z.A = point(0, 0) |
| 261 |
z.B = point(4, 0) |
| 262 |
z.D = point:polar(4, tkz.tau / 3) |
| 263 |
L.DB = line(z.D, z.B) |
| 264 |
T.equ = L.DB:equilateral() |
| 265 |
z.C = T.equ.pc |
| 266 |
Q.new = quadrilateral(z.A, z.B, z.C, z.D) |
| 267 |
bool = Q.new:is_cyclic() |
| 268 |
if bool == true then |
| 269 |
C.cir = triangle(z.A, z.B, z.C):circum_circle() |
| 270 |
z.O = C.cir.center |
| 271 |
end |
| 272 |
} |
| 273 |
\begin{center} |
| 274 |
\begin{tikzpicture}[scale = .75] |
| 275 |
\tkzGetNodes |
| 276 |
\tkzDrawPolygon(A,B,C,D) |
| 277 |
\tkzDrawPoints(A,B,C,D) |
| 278 |
\tkzDrawCircle(O,A) |
| 279 |
\ifthenelse{\equal{\tkzUseLua{bool}}{ |
| 280 |
true}}{\tkzDrawCircle(O,A)}{} |
| 281 |
\tkzLabelPoints(A,B) |
| 282 |
\tkzLabelPoints[above](C,D) |
| 283 |
\end{tikzpicture} |
| 284 |
\end{center} |
| 285 |
\end{minipage} |
| 286 |
|
| 287 |
\subsubsection{Method \tkzMeth{quadrilateral}{is\_convex()}} |
| 288 |
\label{ssub:isconvex} |
| 289 |
|
| 290 |
|
| 291 |
|
| 292 |
|
| 293 |
|
| 294 |
|
| 295 |
|
| 296 |
\subsubsection{Method \tkzMeth{quadrilateral}{poncelet\_point}} |
| 297 |
\label{ssub:poncelet_point} |
| 298 |
|
| 299 |
See [\ref{ssub:method_triangle_poncelet_point}] for the definition. |
| 300 |
|
| 301 |
\begin{tkzexample}[latex=.5\textwidth] |
| 302 |
\directlua{ |
| 303 |
init_elements() |
| 304 |
z.A = point(1, 1) |
| 305 |
z.B = point(6, 0) |
| 306 |
z.D = point(0, 5) |
| 307 |
z.C = point(6, 2) |
| 308 |
Q.ABCD = quadrilateral(z.A, z.B, z.C, z.D) |
| 309 |
z.P = Q.ABCD:poncelet_point() |
| 310 |
T.ABC = triangle(z.A,z.B,z.C) |
| 311 |
z.I = T.ABC.eulercenter |
| 312 |
z.Mc = tkz.midpoint(z.A, z.B) |
| 313 |
T.ABD = triangle(z.A, z.B, z.D) |
| 314 |
z.I1 = T.ABD.eulercenter} |
| 315 |
\begin{center} |
| 316 |
\begin{tikzpicture} |
| 317 |
\tkzGetNodes |
| 318 |
\tkzDrawPolygons(A,B,C,D) |
| 319 |
\tkzDrawPoints(A,B,C,D,P,Mc) |
| 320 |
\tkzDrawCircles[red](I,Mc I1,Mc) |
| 321 |
\tkzLabelPoints(A,B) |
| 322 |
\tkzLabelPoints[above](C,D,P) |
| 323 |
\end{tikzpicture} |
| 324 |
\end{center} |
| 325 |
\end{tkzexample} |
| 326 |
\endinput |