Debian Codegraph @

texmf-dist/doc/latex/tkz-euclide/TKZdoc-euclide-presentation.tex

raw
1 \section{Presentation and Overview}
2
3 \begin{tkzexample}[latex=5cm,small]
4 \begin{tikzpicture}[scale=.25]
5 \tkzDefPoints{0/0/A,12/0/B,6/12*sind(60)/C}
6 \foreach \density in {20,30,...,240}{%
7 \tkzDrawPolygon[fill=teal!\density](A,B,C)
8 \pgfnodealias{X}{A}
9 \tkzDefPointWith[linear,K=.15](A,B) \tkzGetPoint{A}
10 \tkzDefPointWith[linear,K=.15](B,C) \tkzGetPoint{B}
11 \tkzDefPointWith[linear,K=.15](C,X) \tkzGetPoint{C}}
12 \end{tikzpicture}
13 \end{tkzexample}
14
15 \vspace*{12pt}
16
17 \subsection{Why \tkzname{\tkznameofpack}? }
18 My initial goal was to provide other mathematics teachers and myself with a tool to quickly create Euclidean geometry figures without investing too much effort in learning a new programming language.
19 Of course, \tkzname{\tkznameofpack} is for math teachers who use \LATEX\ and makes it possible to easily create correct drawings by means of \LATEX.
20
21 It appeared that the simplest method was to reproduce the one used to obtain construction by hand.
22 To describe a construction, you must, of course, define the objects but also the actions that you perform. It seemed to me that syntax close to the language of mathematicians and their students would be more easily understandable; moreover, it also seemed to me that this syntax should be close to that of \LaTeX.
23 The objects, of course, are points, segments, lines, triangles, polygons and circles. As for actions, I considered five to be sufficient, namely: define, create, draw, mark and label.
24
25 The syntax is perhaps too verbose but it is, I believe, easily accessible.
26 As a result, the students like teachers were able to easily access this tool.
27
28 \subsection{ \tkzname{\TIKZ } vs \tkzname{\tkznameofpack} }
29
30 I love programming with \TIKZ, and without \TIKZ\ I would never have had the idea to create \tkzname{\tkznameofpack} but never forget that behind it there is \TIKZ\ and that it is always possible to insert code from \TIKZ. \tkzname{\tkznameofpack} doesn't prevent you from using \TIKZ.
31 That said, I don't think mixing syntax is a good thing.
32
33 There is no need to compare \TIKZ\ and \tkzname{\tkznameofpack}. The latter is not addressed to the same audience as \TIKZ. The first one allows you to do a lot of things, the second one only does geometry drawings. The first one can do everything the second one does, but the second one will more easily do what you want.
34
35 The main purpose is to define points to create geometrical figures. \tkzname{\tkznameofpack} allows you to draw the essential objects of Euclidean geometry from these points but it may be insufficient for some actions like coloring surfaces. In this case you will have to use \TIKZ\ which is always possible.
36
37 Here are some comparisons between \tkzname{\TIKZ } and \tkzname{\tkznameofpack} 4. For this I will use the geometry examples from the PGFManual.
38 The two most important Euclidean tools used by early Greeks to construct different geometrical shapes and angles were a compass and a straightedge. My idea is to allow you to follow step by step a construction that would be done by hand (with compass and straightedge) as naturally as possible.
39
40 \subsubsection{Book I, proposition I \_Euclid's Elements\_ }
41
42 \begin{tikzpicture}
43 \node [mybox,title={Book I, proposition I \_Euclid's Elements\_}] (box){%
44 \begin{minipage}{0.90\textwidth}
45 {\emph{To construct an equilateral triangle on a given finite straight line.}
46 }
47 \end{minipage}
48 };
49 \end{tikzpicture}%
50
51
52 Explanation :
53
54 The fourth tutorial of the \emph{PgfManual} is about geometric constructions. \emph{T. Tantau} proposes to get the drawing with its beautiful tool Ti\emph{k}Z. Here I propose the same construction with \emph{tkz-elements}. The color of the Ti\emph{k}Z code is green!50!black and that of \emph{tkz-elements} is red.
55
56 \medskip
57
58 \vbox{\color{green!50!black} |\usepackage{tikz}|\\
59 |\usetikzlibrary{calc,intersections,through,backgrounds}|}
60
61 \medskip
62 \vbox{\color{red} |\usepackage{tkz-euclide}|}
63
64 \medskip
65 How to get the line AB ? To get this line, we use two fixed points.\\
66
67 \medskip
68 \vbox{\color{green!50!black}
69 |\coordinate [label=left:$A$] (A) at (0,0);|\\
70 |\coordinate [label=right:$B$] (B) at (1.25,0.25);|\\
71 |\draw (A) -- (B);|}
72
73 \medskip
74 \vbox{\color{red}
75 |\tkzDefPoint(0,0){A}|\\
76 |\tkzDefPoint(1.25,0.25){B}|\\
77 |\tkzDrawSegment(A,B)|\\
78 |\tkzLabelPoint[left](A){$A$}|\\
79 |\tkzLabelPoint[right](B){$B$}|}
80
81 We want to draw a circle around the points $A$ and $B$ whose radius is given by the length of the line AB.
82 \medskip
83
84 \vbox{\color{green!50!black}
85 |\draw let \p1 = ($ (B) - (A) $),|\\
86 |\n2 = {veclen(\x1,\y1)} in|\\
87 | (A) circle (\n2)|\\
88 | (B) circle (\n2);|}
89
90 \medskip
91 \vbox{\color{red}
92 |\tkzDrawCircles(A,B B,A)|
93 }
94
95 The intersection of the circles $\mathcal{D}$ and $\mathcal{E}$
96
97 \medskip
98
99 \vbox{\color{green!50!black}
100 |draw [name path=A--B] (A) -- (B);|\\
101 |node (D) [name path=D,draw,circle through=(B),label=left:$D$] at (A) {}; |\\
102 |node (E) [name path=E,draw,circle through=(A),label=right:$E$] at (B) {};|\\
103 |path [name intersections={of=D and E, by={[label=above:$C$]C,[label=below:$C'$]C'}}]; |\\
104 |draw [name path=C--C',red] (C) -- (C');|\\
105 |path [name intersections={of=A--B and C--C',by=F}];|\\
106 |node [fill=red,inner sep=1pt,label=-45:$F$] at (F) {};|\\}
107
108 \medskip
109 \vbox{\color{red} |\tkzInterCC(A,B)(B,A) \tkzGetPoints{C}{X}|\\}
110
111
112 How to draw points :
113
114 \medskip
115 \vbox{\color{green!50!black} |\foreach \point in {A,B,C}|\\
116 |\fill [black,opacity=.5] (\point) circle (2pt);|\\}
117
118 \medskip
119 \vbox{\color{red}| \tkzDrawPoints[fill=gray,opacity=.5](A,B,C)|\\}
120
121 \subsubsection{Complete code with \pkg{tkz-euclide}}
122
123 We need to define colors
124
125 |\colorlet{input}{red!80!black} |\\
126 |\colorlet{output}{red!70!black}|\\
127 |\colorlet{triangle}{green!50!black!40} |
128
129 \begin{tkzexample}[vbox,small]
130 \colorlet{input}{red!80!black}
131 \colorlet{output}{red!70!black}
132 \colorlet{triangle}{green!50!black!40}
133 \begin{tikzpicture}[scale=1.25,thick,help lines/.style={thin,draw=black!50}]
134 \tkzDefPoint(0,0){A}
135 \tkzDefPoint(1.25+rand(),0.25+rand()){B}
136 \tkzInterCC(A,B)(B,A) \tkzGetPoints{C}{X}
137
138 \tkzFillPolygon[triangle,opacity=.5](A,B,C)
139 \tkzDrawSegment[input](A,B)
140 \tkzDrawSegments[red](A,C B,C)
141 \tkzDrawCircles[help lines](A,B B,A)
142 \tkzDrawPoints[fill=gray,opacity=.5](A,B,C)
143
144 \tkzLabelPoints(A,B)
145 \tkzLabelCircle[below=12pt](A,B)(180){$\mathcal{D}$}
146 \tkzLabelCircle[above=12pt](B,A)(180){$\mathcal{E}$}
147 \tkzLabelPoint[above,red](C){$C$}
148
149 \end{tikzpicture}
150 \end{tkzexample}
151
152 \subsubsection{Book I, Proposition II \_Euclid's Elements\_}
153
154 \begin{tikzpicture}
155 \node [mybox,title={Book I, Proposition II \_Euclid's Elements\_}] (box){%
156 \begin{minipage}{0.90\textwidth}
157 {\emph{To place a straight line equal to a given straight line with one end at a given point.}}
158 \end{minipage}
159 };
160 \end{tikzpicture}%
161
162 Explanation
163
164 In the first part, we need to find the midpoint of the straight line $AB$. With \TIKZ\ we can use the calc library
165
166 \medskip
167 \vbox{\color{green!50!black} |\coordinate [label=left:$A$] (A) at (0,0);|\\
168 |\coordinate [label=right:$B$] (B) at (1.25,0.25);|\\
169 |\draw (A) -- (B);|\\
170 |\node [fill=red,inner sep=1pt,label=below:$X$] (X) at ($ (A)!.5!(B) $) {};|\\}
171
172 With \pkg{tkz-euclide} we have a macro \tkzcname{tkzDefMidPoint}, we get the point X with \tkzcname{tkzGetPoint} but we don't need this point to get the next step.
173
174
175 \medskip
176 \vbox{\red |\tkzDefPoints{0/0/A,0.75/0.25/B,1/1.5/C}|\\
177 |\tkzDefMidPoint(A,B) \tkzGetPoint{X}|}
178
179 \medskip
180 Then we need to construct a triangle equilateral. It's easy with \pkg{tkz-euclide} . With TikZ you need some effort because you need to use the midpoint $X$ to get the point $D$ with trigonometry calculation.
181
182 \medskip
183 \vbox{\color{green!50!black}
184 |\node [fill=red,inner sep=1pt,label=below:$X$] (X) at ($ (A)!.5!(B) $) {}; | \\
185 |\node [fill=red,inner sep=1pt,label=above:$D$] (D) at | \\
186 |($ (X) ! {sin(60)*2} ! 90:(B) $) {}; | \\
187 |\draw (A) -- (D) -- (B); | \\
188 }
189
190 \medskip
191 \vbox{\color{red} |\tkzDefTriangle[equilateral](A,B) \tkzGetPoint{D}|}
192
193 We can draw the triangle at the end of the picture with
194
195 \medskip
196 \vbox{\color{red} |\tkzDrawPolygon{A,B,C}|}
197
198 \medskip
199 We know how to draw the circle $\mathcal{H}$ around $B$ through $C$ and how to place the points $E$ and $F$
200
201 \medskip
202 \vbox{\color{green!50!black}
203 |\node (H) [label=135:$H$,draw,circle through=(C)] at (B) {};| \\
204 |\draw (D) -- ($ (D) ! 3.5 ! (B) $) coordinate [label=below:$F$] (F);| \\
205 |\draw (D) -- ($ (D) ! 2.5 ! (A) $) coordinate [label=below:$E$] (E);|}
206
207 \medskip
208
209 \vbox{\color{red} |\tkzDrawCircle(B,C)|\\
210 |\tkzDrawLines[add=0 and 2](D,A D,B)|}
211
212 \medskip
213 We can place the points $E$ and $F$ at the end of the picture. We don't need them now.
214
215 Intersecting a Line and a Circle : here we search the intersection of the circle around $B$ through $C$ and the line $DB$.
216 The infinite straight line $DB$ intercepts the circle but with \TIKZ\ we need to extend the lines $DB$ and that can be done using partway calculations. We get the point $F$ and $BF$ or $DF$ intercepts the circle
217
218 \medskip
219 \vbox{\color{green!50!black}| \node (H) [label=135:$H$,draw,circle through=(C)] at (B) {}; | \\
220 |\path let \p1 = ($ (B) - (C) $) in| \\
221 | coordinate [label=left:$G$] (G) at ($ (B) ! veclen(\x1,\y1) ! (F) $); | \\
222 |\fill[red,opacity=.5] (G) circle (2pt);|}
223
224 \medskip
225 Like the intersection of two circles, it's easy to find the intersection of a line and a circle with \pkg{tkz-euclide}. We don't need $F$
226
227 \medskip
228 \vbox{\color{red} | \tkzInterLC(B,D)(B,C)\tkzGetFirstPoint{G}|}
229
230 \medskip
231 There are no more difficulties. Here the final code with some simplications.
232 We draw the circle $\mathcal{K}$ with center $D$ and passing through $G$. It intersects the line $AD$ at point $L$. $AL = BC$.
233
234 \vbox{\color{red} | \tkzDrawCircle(D,G)|}
235 \vbox{\color{red} | \tkzInterLC(D,A)(D,G)\tkzGetSecondPoint{L}|}
236
237 \begin{tkzexample}[latex=7cm,small]
238 \begin{tikzpicture}[scale=1.5]
239 \tkzDefPoint(0,0){A}
240 \tkzDefPoint(0.75,0.25){B}
241 \tkzDefPoint(1,1.5){C}
242 \tkzDefTriangle[equilateral](A,B)\tkzGetPoint{D}
243 \tkzInterLC[near](D,B)(B,C) \tkzGetSecondPoint{G}
244 \tkzInterLC[near](A,D)(D,G) \tkzGetFirstPoint{L}
245 \tkzDrawCircles(B,C D,G)
246 \tkzDrawLines[add=0 and 2](D,A D,B)
247 \tkzDrawSegment(A,B)
248 \tkzDrawSegments[red](A,L B,C)
249 \tkzDrawPoints[red](D,L,G)
250 \tkzDrawPoints[fill=gray](A,B,C)
251 \tkzLabelPoints[left,red](A)
252 \tkzLabelPoints[below right,red](L)
253 \tkzLabelCircle[above](B,C)(20){$\mathcal{(H)}$}
254 \tkzLabelPoints[above left](D)
255 \tkzLabelPoints[above](G)
256 \tkzLabelPoints[above,red](C)
257 \tkzLabelPoints[right,red](B)
258 \tkzLabelCircle[below](D,G)(-90){$\mathcal{(K)}$}
259 \end{tikzpicture}
260 \end{tkzexample}
261
262 \subsection{\tkzname{\tkznameofpack\ 4} vs \tkzname{\tkznameofpack\ 3}}
263
264 Now I am no longer a Mathematics teacher, and I only spend a few hours studying geometry. I wanted to avoid multiple complications by trying to make \tkzname{tkz-euclide} independent of \tkzname{tkz-base}. Thus was born \tkzname{\tkznameofpack} 4. The latter is a simplified version of its predecessor. The macros of \tkzname{tkz-euclide 3} have been retained. The unit is now \tkzname{cm}. If you need some macros from \tkzname{tkz-base}, you may need to use the \tkzcname{tkzInit}.
265
266 \subsection{\tkzname{\tkznameofpack\ 5} vs \tkzname{\tkznameofpack\ 4}}
267
268 Nothing changes for the user. Compilation must be carried out using the LuaLaTeX engine, and the results are more precise and obtained more quickly. Simply load \tkzname{\tkznameofpack} like this |\usepackage[lua]{tkz-euclide}|.
269
270 \subsection{How to use the \tkzname{\tkznameofpack} package ?}
271 \subsubsection{Let's look at a classic example}
272 In order to show the right way, we will see how to build an equilateral triangle. Several possibilities are open to us, we are going to follow the steps of Euclid.
273
274 \begin{itemize}
275 \item First of all, you have to use a document class. The best choice to test your code is to create a single figure with the class \tkzname{standalone}\index{standalone}.
276 \begin{verbatim}
277 \documentclass{standalone}
278 \end{verbatim}
279 \item Then load the \tkzname{\tkznameofpack} package:
280 \begin{verbatim}
281 \usepackage{tkz-euclide} or \usepackage[lua]{tkz-euclide}
282 \end{verbatim}
283
284 You don't need to load \TIKZ\ because the \tkzname{\tkznameofpack} package works on top of TikZ and loads it.
285
286 \item Start the document and open a TikZ picture environment:
287 \begin{verbatim}
288 \begin{document}
289 \begin{tikzpicture}
290 \end{verbatim}
291
292 \item Now we define two fixed points:
293 \begin{verbatim}
294 \tkzDefPoint(0,0){A}
295 \tkzDefPoint(5,2){B}
296 \end{verbatim}
297
298 \item Two points define two circles, let's use these circles:
299
300 circle with center $A$ through $B$ and circle with center $B$ through $A$. These two circles have two points in common.
301 \begin{verbatim}
302 \tkzInterCC(A,B)(B,A)
303 \end{verbatim}
304 We can get the points of intersection with
305 \begin{verbatim}
306 \tkzGetPoints{C}{D}
307 \end{verbatim}
308
309 \item All the necessary points are obtained, we can move on to the final steps including the plots.
310 \begin{verbatim}
311 \tkzDrawCircles[gray,dashed](A,B B,A)
312 \tkzDrawPolygon(A,B,C)% The triangle
313 \end{verbatim}
314 \item Draw all points $A$, $B$, $C$ and $D$:
315 \begin{verbatim}
316 \tkzDrawPoints(A,...,D)
317 \end{verbatim}
318
319 \item The final step, we print labels to the points and use options for positioning:\\
320 \begin{verbatim}
321 \tkzLabelSegments[swap](A,B){$c$}
322 \tkzLabelPoints(A,B,D)
323 \tkzLabelPoints[above](C)
324 \end{verbatim}
325 \item We finally close both environments
326 \begin{verbatim}
327 \end{tikzpicture}
328 \end{document}
329 \end{verbatim}
330
331 \item The complete code
332
333 \begin{tkzexample}[latex=8cm,small]
334 \begin{tikzpicture}[scale=.5]
335 % fixed points
336 \tkzDefPoint(0,0){A}
337 \tkzDefPoint(5,2){B}
338 % calculus
339 \tkzInterCC(A,B)(B,A)
340 \tkzGetPoints{C}{D}
341 % drawings
342 \tkzDrawCircles(A,B B,A)
343 \tkzDrawPolygon(A,B,C)
344 \tkzDrawPoints(A,...,D)
345 % marking
346 \tkzMarkSegments[mark=s||](A,B B,C C,A)
347 % labelling
348 \tkzLabelSegments[swap](A,B){$c$}
349 \tkzLabelPoints(A,B,D)
350 \tkzLabelPoints[above](C)
351 \end{tikzpicture}
352 \end{tkzexample}
353
354 \end{itemize}
355
356 \subsubsection{ Part I: golden triangle}
357 \begin{center}
358 \begin{tikzpicture}
359
360 \tkzDefPoint(0,0){C} % possible \tkzDefPoint[label=below:$C$](0,0){C} but don't do this
361 \tkzDefPoint(2,6){B}
362 % We get D and E with a rotation
363 \tkzDefPointBy[rotation= center B angle 36](C) \tkzGetPoint{D}
364 \tkzDefPointBy[rotation= center B angle 72](C) \tkzGetPoint{E}
365 % Toget A we use an intersection of lines
366 \tkzInterLL(B,E)(C,D) \tkzGetPoint{A}
367 \tkzInterLL(C,E)(B,D) \tkzGetPoint{H}
368
369 % angles
370 \tkzMarkAngles[size=2](C,B,D E,A,D) %this is to draw the arcs
371 \tkzLabelAngles[pos=1.5](C,B,D E,A,D){$\alpha$}
372 \tkzMarkRightAngle(B,H,C)
373 \tkzDrawPoints(A,...,E)
374
375 % drawing
376 \tkzDrawArc[delta=10](B,C)(E)
377 \tkzDrawPolygon(C,B,D)
378 \tkzDrawSegments(D,A B,A C,E)
379
380 % Label only now
381 \tkzLabelPoints[below left](C,A)
382 \tkzLabelPoints[below right](D)
383 \tkzLabelPoints[above](B,E)
384 \end{tikzpicture}
385 \end{center}
386
387 Let's analyze the figure
388 \begin{enumerate}
389 \item $CBD$ and $DBE$ are isosceles triangles;
390
391 \item $BC=BE$ and $(BD)$ is a bisector of the angle $CBE$;
392
393 \item From this we deduce that the $CBD$ and $DBE$ angles are equal and have the same measure $\alpha$
394 \[\widehat{BAC} +\widehat{ABC} + \widehat{BCA}=180^\circ \ \text{in the triangle}\ BAC \]
395 \[3\alpha + \widehat{BCA}=180^\circ\ \text{in the triangle}\ CBD\]
396 then
397 \[\alpha + 2\widehat{BCA}=180^\circ \]
398 or
399 \[\widehat{BCA}=90^\circ -\alpha/2 \]
400
401 \item Finally \[\widehat{CBD}=\alpha=36^\circ \]
402 the triangle $CBD$ is a \code{golden} triangle.
403 \end{enumerate}
404
405 \vspace*{24pt}
406 How construct a golden triangle or an angle of $36^\circ$?
407
408 \begin{enumerate}
409 \item We place the fixed points $C$ and $D$. |\tkzDefPoint(0,0){C}| and |\tkzDefPoint(4,0){D}|;
410 \item We construct a square $CDef$ and we construct the midpoint $m$ of $[Cf]$;
411
412 We can do all of this with a compass and a rule;
413 \item Then we trace an arc with center $m$ through $e$. This arc cross the line $(Cf)$ at $n$;
414 \item Now the two arcs with center $C$ and $D$ and radius $Cn$ define the point $B$.
415 \end{enumerate}
416
417 \begin{tkzexample}[latex=7cm,small]
418 \begin{tikzpicture}
419 \tkzDefPoint(0,0){C}
420 \tkzDefPoint(4,0){D}
421 \tkzDefSquare(C,D)
422 \tkzGetPoints{e}{f}
423 \tkzDefMidPoint(C,f)
424 \tkzGetPoint{m}
425 \tkzInterLC(C,f)(m,e)
426 \tkzGetSecondPoint{n}
427 \tkzInterCC[with nodes](C,C,n)(D,C,n)
428 \tkzGetFirstPoint{B}
429 \tkzDrawSegment[brown,dashed](f,n)
430 \pgfinterruptboundingbox% from tikz
431 \tkzDrawPolygon[brown,dashed](C,D,e,f)
432 \tkzDrawArc[brown,dashed](m,e)(n)
433 \tkzCompass[brown,dashed,delta=20](C,B)
434 \tkzCompass[brown,dashed,delta=20](D,B)
435 \endpgfinterruptboundingbox
436 \tkzDrawPolygon(B,...,D)
437 \tkzDrawPoints(B,C,D,e,f,m,n)
438 \tkzLabelPoints[above](B)
439 \tkzLabelPoints[left](f,m,n)
440 \tkzLabelPoints(C,D)
441 \tkzLabelPoints[right](e)
442 \end{tikzpicture}
443 \end{tkzexample}
444
445
446 After building the golden triangle $BCD$, we build the point $A$ by noticing that $BD=DA$. Then we get the point $E$ and finally the point $F$. This is done with already intersections of defined objects (line and circle).
447
448
449 \subsubsection{Part II: two others methods with golden and euclid triangle}
450
451 \tkzname{\tkznameofpack} knows how to define a \code{golden} or \code{euclide} triangle. We can define $BCD$ and $BCA$ like gold triangles.
452
453
454 \begin{center}
455 \begin{tkzexample}[code only,small]
456 \begin{tikzpicture}
457 \tkzDefPoint(0,0){C}
458 \tkzDefPoint(4,0){D}
459 \tkzDefTriangle[golden](C,D)
460 \tkzGetPoint{B}
461 \tkzDefTriangle[golden](B,C)
462 \tkzGetPoint{A}
463 \tkzInterLC[near](A,B)(B,D) \tkzGetFirstPoint{E}
464 \tkzInterLL(B,D)(C,E) \tkzGetPoint{F}
465 \tkzDrawPoints(C,D,B)
466 \tkzDrawPolygon(B,...,D)
467 \tkzDrawPolygon(B,C,D)
468 \tkzDrawSegments(D,A A,B C,E)
469 \tkzDrawArc[delta=10](B,C)(E)
470 \tkzDrawPoints(A,...,F)
471 \tkzMarkRightAngle(B,F,C)
472 \tkzMarkAngles(C,B,D E,A,D)
473 \tkzLabelAngles[pos=1.5](C,B,D E,A,D){$\alpha$}
474 \tkzLabelPoints[below](A,C,D,E)
475 \tkzLabelPoints[above right](B,F)
476 \end{tikzpicture}
477 \end{tkzexample}
478 \end{center}
479
480 Here is a final method that uses rotations:
481
482 \begin{center}
483 \begin{tkzexample}[code only,small]
484 \begin{tikzpicture}
485 \tkzDefPoint(0,0){C} % possible
486 % \tkzDefPoint[label=below:$C$](0,0){C}
487 % but don't do this
488 \tkzDefPoint(2,6){B}
489 % We get D and E with a rotation
490 \tkzDefPointBy[rotation= center B angle 36](C) \tkzGetPoint{D}
491 \tkzDefPointBy[rotation= center B angle 72](C) \tkzGetPoint{E}
492 % To get A we use an intersection of lines
493 \tkzInterLL(B,E)(C,D) \tkzGetPoint{A}
494 \tkzInterLL(C,E)(B,D) \tkzGetPoint{H}
495 % drawing
496 \tkzDrawArc[delta=10](B,C)(E)
497 \tkzDrawPolygon(C,B,D)
498 \tkzDrawSegments(D,A B,A C,E)
499 % angles
500 \tkzMarkAngles(C,B,D E,A,D) %this is to draw the arcs
501 \tkzLabelAngles[pos=1.5](C,B,D E,A,D){$\alpha$}
502 \tkzMarkRightAngle(B,H,C)
503 \tkzDrawPoints(A,...,E)
504 % Label only now
505 \tkzLabelPoints[below left](C,A)
506 \tkzLabelPoints[below right](D)
507 \tkzLabelPoints[above](B,E)
508 \end{tikzpicture}
509 \end{tkzexample}
510 \end{center}
511
512
513 \subsubsection{Complete but minimal example}
514
515
516 A unit of length being chosen, the example shows how to obtain a segment of length $\sqrt{a}$ from a segment of length $a$, using a ruler and a compass.
517
518 $IB=a$, $AI=1$
519
520 \vspace{12pt}
521 \hypertarget{firstex}{}
522 \begin{tkzexample}[vbox,small]
523 \begin{tikzpicture}[scale=1,ra/.style={fill=gray!20}]
524 % fixed points
525 \tkzDefPoint(0,0){A}
526 \tkzDefPoint(1,0){I}
527 % calculation
528 \tkzDefPointBy[homothety=center A ratio 10 ](I) \tkzGetPoint{B}
529 \tkzDefMidPoint(A,B) \tkzGetPoint{M}
530 \tkzDefPointWith[orthogonal](I,M) \tkzGetPoint{H}
531 \tkzInterLC(I,H)(M,B) \tkzGetFirstPoint{C}
532 \tkzDrawSegment[style=purple](I,C)
533 \tkzDrawArc(M,B)(A)
534 \tkzDrawSegment[dim={$1$,-16pt,}](A,I)
535 \tkzDrawSegment[dim={$(a-1)/2$,-10pt,}](I,M)
536 \tkzDrawSegment[dim={$(a+1)/2$,-16pt,}](M,B)
537 \tkzMarkRightAngle[ra](A,I,C)
538 \tkzDrawPoints(I,A,B,C,M)
539 \tkzLabelPoint[left](A){$A(0,0)$}
540 \tkzLabelPoints[above right](I,M)
541 \tkzLabelPoints[above left](C)
542 \tkzLabelPoint[right](B){$B(10,0)$}
543 \tkzLabelSegment[right=4pt](I,C){$\sqrt{a^2}=a \ (a>0)$}
544 \end{tikzpicture}
545 \end{tkzexample}
546
547 \emph{Comments}
548
549 \begin{itemize}
550 \item The Preamble
551
552
553 Let us first look at the preamble. If you need it, you have to load \tkzname{xcolor} before \tkzname{tkz-euclide}, that is, before \TIKZ. \TIKZ\ may cause problems with the active characters, but...
554 provides a library in its latest version that's supposed to solve these problems \NameLib{babel}.
555
556 \begin{tkzltxexample}[]
557 \documentclass{standalone} % or another class
558 % \usepackage{xcolor} % before tikz or tkz-euclide if necessary
559 \usepackage{tkz-euclide} % no need to load TikZ
560 % \usetkzobj{all} is no longer necessary
561 % \usetikzlibrary{babel} if there are problems with the active characters
562 \end{tkzltxexample}
563
564 The following code consists of several parts:
565
566 \item Definition of fixed points: the first part includes the definitions of the points necessary for the construction, these are the fixed points. The macros \tkzcname{tkzInit} and \tkzcname{tkzClip} in most cases are not necessary.
567
568 \begin{tkzltxexample}[]
569 \tkzDefPoint(0,0){A}
570 \tkzDefPoint(1,0){I}
571 \end{tkzltxexample}
572
573 \item The second part is dedicated to the creation of new points from the fixed points;
574 a $B$ point is placed at $10$~cm from $A$. The middle of $[AB]$ is defined by $M$ and then the orthogonal line to the $(AB)$ line is searched for at the $I$ point. Then we look for the intersection of this line with the semi-circle of center $M$ passing through $A$.
575
576 \begin{tkzltxexample}[]
577 \tkzDefPointBy[homothety=center A ratio 10 ](I)
578 \tkzGetPoint{B}
579 \tkzDefMidPoint(A,B)
580 \tkzGetPoint{M}
581 \tkzDefPointWith[orthogonal](I,M)
582 \tkzGetPoint{H}
583 \tkzInterLC(I,H)(M,B)
584 \tkzGetSecondPoint{C}
585 \end{tkzltxexample}
586
587
588 \item The third one includes the different drawings;
589 \begin{tkzltxexample}[]
590 \tkzDrawSegment[style=purple](I,H)
591 \tkzDrawPoints(O,I,A,B,M)
592 \tkzDrawArc(M,A)(O)
593 \tkzDrawSegment[dim={$1$,-16pt,}](A,I)
594 \tkzDrawSegment[dim={$a/2$,-10pt,}](I,M)
595 \tkzDrawSegment[dim={$a/2$,-16pt,}](M,B)
596 \end{tkzltxexample}
597
598 \item Marking: the fourth is devoted to marking;
599
600
601 \begin{tkzltxexample}[]
602 \tkzMarkRightAngle[ra](A,I,C)
603 \end{tkzltxexample}
604
605 \item Labelling: the latter only deals with the placement of labels.
606 \begin{tkzltxexample}[]
607 \tkzLabelPoint[left](A){$A(0,0)$}
608 \tkzLabelPoint[right](B){$B(10,0)$}
609 \tkzLabelSegment[right=4pt](I,C){$\sqrt{a^2}=a \ (a>0)$}
610 \end{tkzltxexample}
611
612 \end{itemize}
613
614 \endinput