Debian Codegraph @

texmf-dist/doc/latex/tzplot/tzplot-doc-C2-v2.2.tex

raw
1 %!TEX root = tzplot-doc.tex
2 %\begin{document}
3
4 %%%%%=====CNONTINUED============
5 %%%%%%==========================
6 %%%\part{Points, Lines, and Curves}
7 %%%%%%==========================
8 %%%\label{p:linesandcurves}
9
10
11 %%==================================
12 \chapter{Polygons and Circles}
13 \label{c:polygons}
14
15 %%------------------------------------------------------------
16 \section{Polygons: \protect\cmd{\tzpolygon}: Semicolon versions}
17 \label{s:polygons}
18
19 \subsection{\protect\cmd{\tzpolygon}}
20 \label{ss:tzpolygon}
21
22 \icmd{\tzpolygon} connects an arbitrary number of coordinates to draw a polygon, a closed figure. |\tzpolygon| is equivalent to a \xem{closed} |\tzlines|. Since |\tzpolygon| is a \xem{semicolon version}, you need to enter a \xem{semicolon} to indicate when the coordinate repetition ends.
23
24
25 \begin{tzdef}
26 % syntax: minimum
27 \tzpolygon(<coor>)(<coor>)..repeated..(<coor>) ;
28 % syntax: medium
29 \tzpolygon (<coor>){<text>}[<node opt>]..repeated..(<coor>){<text>}[<node opt>] ;
30 % syntax: full
31 \tzpolygon[<opt>]<shift coor>"<path name>"
32 (<coor>){<text>}[<node opt>]
33 ..repeated.. (){}[] ; <code.append>
34 % defaults
35 []<>""(<m>){}[] ..repeated.. (){}[] ; <>
36 \end{tzdef}
37
38 \begin{tztikz}
39 \tzpolygon(1,1)(2,2)(3,1)(4,3); % works like:
40 \draw (1,1) -- (2,2) -- (3,1) -- (4,3) -- cycle;
41 \end{tztikz}
42
43 You can add text next to lines by specifying the options |{<text>}| and |[<node opt>]| \xem{in-between} coordinates.
44
45 \begin{tzcode}{.3}
46 % \tzpolygon
47 \begin{tikzpicture}
48 \tzhelplines(4,3)
49 \tzpolygon[fill,blue,auto]
50 (0,1){Side A}[sloped,red]
51 (1,3){B}
52 (2,3)
53 (3,2){Side D}[swap,sloped]
54 (1,0);
55 \end{tikzpicture}
56 \end{tzcode}
57
58 You can also move the polygon by specifying the option |<shift coor>| before the first coordinate.
59 The \xem{empty} shift option |<>| is \xem{not allowed}.
60
61 \begin{tzcode}{.3}
62 % \tzpolygon: shift
63 \begin{tikzpicture}
64 \tzhelplines(4,3)
65 \tzpolygon[blue,auto]
66 (0,1){Side A}[sloped,red]
67 (1,3){B}
68 (2,3)
69 (3,2){Side D}[swap,sloped]
70 (1,0);
71 \tzpolygon[auto,dashed]<1,-.5>
72 (0,1)(1,3)(2,3){C}(3,2)(1,0);
73 \end{tikzpicture}
74 \end{tzcode}
75
76
77
78 \subsection{\protect\cmd{\tzpolygon*}}
79 \label{ss:tzpolygon*}
80
81 The starred version \icmd{\tzpolygon*} paints the interior of the polygon with the default options |fill=black!50| with |fill opacity=.3| and |text opacity=1|.
82
83 \begin{tzdef}
84 % syntax: minimum
85 \tzpolygon*(<coor>)(<coor>)..repeated..(<coor>) ;
86 % syntax: medium
87 \tzpolygon*(<coor>){<text>}[<node opt>]..repeated..(<coor>){<text>}[<node opt] ;
88 % syntax: full
89 \tzpolygon*[<opt>]<shift coor>"<path name>"
90 (<coor>){<text>}[<node opt>]
91 ..repeated.. (){}[] ; {<fill opacity>} <code.append>
92 % defaults
93 *[fill=black!50,fill opacity=.3,text opacity=1]<>""
94 (<m>){}[] .. repeated.. (){}[] ; {.3} <>
95 \end{tzdef}
96
97 You can change the fill opacity by specifying the the last curly brace option |{<fill opacity>}| immediately \xem{after the semicolon}.
98
99 \begin{tzcode}{.3}
100 % \tzpolygon: shift
101 \begin{tikzpicture}
102 \tzhelplines(4,3)
103 \tzpolygon*[draw=blue,auto]
104 (0,1){Side A}[sloped,red]
105 (1,3){B}
106 (2,3)
107 (3,2){Side D}[swap,sloped]
108 (1,0);
109 \tzpolygon*[green,auto,dashed,text=black]<1,-.5>
110 (0,1)(1,3)(2,3){C}(3,2)(1,0); {.7}
111 \end{tikzpicture}
112 \end{tzcode}
113
114 You can also change the defaults using |\settzfillcolor| and |\settzfillopacity|.
115
116
117 \subsection{\protect\cmd{\tzpolygon+}, \protect\cmd{\tzpolygon*+}: Relative coordinates: Semicolon versions}
118 \label{ss:tzpolygon+}
119
120 The plus version \icmd{\tzpolygon+} uses each coordinate (except the first one) relative (with |++|) to the previous coordinate.
121
122 \xem{Everything else is the same as in} |\tzpolygon|.
123
124 \icmd{\tzpolygon*+} is just a plus version of |\tzpolygon*|.
125
126 \begin{tztikz}
127 \tzpolygon+(1,1)(2,2)(3,1)(4,3); % works like:
128 \draw (1,1) -- ++(2,2) -- ++(3,1) -- ++(4,3) -- cycle;
129 \end{tztikz}
130
131 \begin{tztikz}
132 \tzpolygon+[dashed]"AA"(1,1)(2,2){A}(3,1){B}[below]; % works like:
133 \draw [dashed,name path=AA] (1,1)
134 -- ++(2,2)
135 -- ++(3,1) node {A}
136 -- ++(4,3) node [below] {B}
137 -- cycle;
138 \end{tztikz}
139
140 \begin{tzcode}{.3}
141 % \tzpolygon: shift
142 \begin{tikzpicture}
143 \tzhelplines(4,3)
144 \tzpolygon*+[blue,auto]
145 (0,1){Side A}[sloped,red]
146 (1,2){B}
147 (1,0)
148 (1,-1){Side D}[swap,sloped]
149 (-2,-2);
150 \tzpolygon*+[green,auto,dashed,text=black]<1,-.5>
151 (0,1)(1,2)(1,0){C}(1,-1)(-2,-2); {.7}
152 \end{tikzpicture}
153 \end{tzcode}
154
155
156
157 %%------------------------------------------------------------
158 \section{Rectangles}
159 \label{s:rectangles}
160
161 \subsection{\protect\cmd{\tzframe} and its variants}
162 \label{ss:tzframe}
163
164 \icmd{\tzframe} accepts two coordinates draws a rectangle.
165
166
167 \begin{tzdef}
168 % syntax: minimum
169 \tzframe(<coor>)(<coor>)
170 % syntax: full
171 \tzframe[<opt>]<shift coor>"<path name>"(<coor1>)(<coor2>)<code.append>
172 % defaults
173 []<>""(<m>)(<m>)<>
174 \end{tzdef}
175
176 \icmd{\tzrectangle} and \icmd{\tzbox} are aliases of |\tzframe|.
177
178 \begin{tztikz}
179 \tzframe(0,1)(3,2) % works like:
180 \draw (0,1) rectangle (3,2);
181 \end{tztikz}
182
183
184 The plus version \icmd{\tzframe+} uses the second coordinate as the coordinate relative (with |++|) to the first. \icmd{\tzrectangle+} and \icmd{\tzbox+} are aliases of |\tzframe+|.
185
186 \begin{tztikz}
187 \tzframe+(0,1)(3,2) % works like:
188 \draw (0,1) rectangle ++(3,2);
189 \end{tztikz}
190
191 \begin{tzcode}{.3}
192 % \tzframe, \tzframe+
193 \begin{tikzpicture}
194 \tzhelplines(4,3)
195 \tzframe(0,0)(3,2)
196 \tzframe+[blue,rounded corners=2mm](1,3)(1,-2)
197 \end{tikzpicture}
198 \end{tzcode}
199
200 The starred version \icmd{\tzframe*} fills the interior
201 with |black!50| with |fill opacity=.3| and |text opacity=1|, by default.
202 (\icmd{\tzrectangle*} and \icmd{\tzbox*} are aliases of |\tzframe*|.)
203
204 |\tzframe+| has also its starred version \icmd{\tzframe*+}.
205 (\icmd{\tzrectangle*+} and \icmd{\tzbox*+} are aliases of |\tzframe*+|.)
206
207 \begin{tzdef}
208 % syntax
209 \tzframe*[<opt>]<shift coor>"<path name>"
210 (<coor1>)(<coor2>){<fill opacity>}<code.append>
211 % defaults
212 *[fill=black!50,fill opacity=.3,text opacity=1]<>""(<m>)(<m>){.3}<>
213 \end{tzdef}
214
215 With the starred versions, you can change the fill opacity using the last option |{<fill opacity>}|.
216
217 \begin{tzcode}{.3}
218 % \tzframe*(+)
219 \begin{tikzpicture}
220 \tzhelplines(4,3)
221 \tzframe[fill](0,0)(3,2)
222 \tzframe*+[green,rounded corners=2mm](1,3)(1,-2){.7} %%
223 \end{tikzpicture}
224 \end{tzcode}
225
226 You can move |\tzframe| and its variants by specifying the option |<shift coor>| immediately before the first mandatory coordinate.
227 The empty shift option |<>| is not allowed.
228
229 \begin{tzcode}{.3}
230 % \tzframe(*)(+): shift
231 \begin{tikzpicture}
232 \tzhelplines*(4,4)
233 \tzframe(0,0)(3,2)
234 \tzframe[blue,dashed]<1,1>(0,0)(3,2)
235 \tzcoors(1,3)(A)(1,-2)(B);
236 \tzframe*+[blue,rounded corners=2mm](A)(B)
237 \tzframe*+[red,rounded corners=2mm]<-.5,-.5>(A)(B)
238 \tzframe*+[green,rounded corners=2mm]<1,1>(A)(B)
239 \end{tikzpicture}
240 \end{tzcode}
241
242 You can use the last option |<code.append>| to add more \Tikz\ code.
243
244 \begin{tzcode}{.3}
245 % \tzframe(*), \tzrectangle(*): <code.append>
246 \begin{tikzpicture}
247 \tzhelplines(4,4)
248 \tzframe*[blue,even odd rule](0,0)(3,2)
249 <(.5,.5) rectangle (2.5,1.5)>
250 \tzframe[fill=green,even odd rule](2,1)(4,4)
251 <(2.3,1.2) rectangle (3.5,3.6)>
252 \end{tikzpicture}
253 \end{tzcode}
254
255
256
257 \subsection{\protect\cmd{\tzrectanglering(*)}}
258
259 \icmd{\tzrectanglering*} draws two rectangles and draws a rectangle ring by filling the interior with the default options \ixxw{even odd rule}, |fill=black!50|, |fill opacity=.3|, and |text opacity=1|.
260
261 \begin{tzdef}
262 % syntax: minimal
263 \tzrectanglering*(<coorA1>)(<coorA2>)(<coorB1>)(<coorB2>)
264 % syntax: full
265 \tzrectanglering*[<opt>]<shift coor>
266 (<coorA1>)(<coorA2>)(<coorB1>)(<coorB2>)
267 {<fill opacity>}<code.append>
268 % defaults:
269 *[even odd rule,fill=black!50,fill opacity=.3,text opacity=1]
270 <>(<m>)(<m>)()(){.3}<>
271 \end{tzdef}
272
273 \begin{tztikz}
274 \tzrectanglering*(A1)(A2)(B1)(B2) % works like:
275 \draw [fill=black!50,fill opacity=.3,text opacity=1, even odd rule]
276 (A1) rectangle (A2)
277 (B1) rectangle (B2) ;
278 \end{tztikz}
279
280 \begin{tzcode}{.3}
281 % \tzrectanglering*
282 \begin{tikzpicture}
283 \tzhelplines(4,2)
284 \tzrectanglering*[blue](0,0)(3,2)(.5,.5)(2.5,1.5)
285 \end{tikzpicture}
286 \end{tzcode}
287
288 \begin{tzcode}{.3}
289 % \tzrectanglering*: shift
290 \begin{tikzpicture}
291 \tzhelplines(4,3)
292 \tzrectanglering*[blue](0,0)(3,2)(.5,.5)(2.5,1.5)
293 \tzrectanglering*[red]<.9,.9>(0,0)(3,2)(.5,.5)(2.5,1.5)
294 \end{tikzpicture}
295 \end{tzcode}
296
297
298
299
300 \icmd{\tzrectanglering} draws two rectangles with the default option |even odd rule|.
301
302
303 \begin{tzdef}
304 % syntax: minimal
305 \tzrectanglering(<coorA1>)(<coorA2>)(<coorB1>)(<coorB2>)
306 % syntax: full
307 \tzrectanglering[<opt>]<shift coor>(<coorA1>)(<coorA2>)
308 (<coorB1>)(<coorB2>)<code.append>
309 % defaults
310 [even odd rule]<>(<m>)(<m>)()()<>
311 \end{tzdef}
312
313 \begin{tztikz}
314 \tzrectanglering(0,0)(2,2)(.5,.5)(1.5,1.5) % works like:
315 \draw (0,0) rectangle (2,2)
316 (.5,.5) rectangle (1.5 and 1.5);
317 \end{tztikz}
318
319 \begin{tzcode}{.3}
320 % \tzrectanglering: shift
321 \begin{tikzpicture}
322 \tzhelplines(4,3)
323 \tzrectanglering[blue](0,0)(3,2)(.5,.5)(2.5,1.5)
324 \tzrectanglering[red,fill=green]<.9,.9>
325 (0,0)(3,2)(.5,.5)(2.5,1.5)
326 \end{tikzpicture}
327 \end{tzcode}
328
329
330
331 \begin{tzcode}{.3}
332 % \tzrectanglering*
333 \begin{tikzpicture}
334 \tzhelplines(4,3)
335 \tzrectanglering*[blue](0,0)(3,2)(1.5,1.5)(4,3)
336 \end{tikzpicture}
337 \end{tzcode}
338
339
340 \begin{tzcode}{.3}
341 % \tzrectanglering(*): nonzero rule, fill opacity
342 \begin{tikzpicture}
343 \tzhelplines(4,3)
344 \tzrectanglering*[red,draw=none,nonzero rule]
345 (0,0)(3,2)(1.5,1.5)(4,3){1}
346 \tzrectanglering[fill=white](0,0)(3,2)(1.5,1.5)(4,3)
347 \end{tikzpicture}
348 \end{tzcode}
349
350 With the last option |<code.append>| you can add some more \Tikz\ code.
351
352 \begin{tzcode}{.3}
353 % \tzframering(*), \tzboxring(*)
354 \begin{tikzpicture}
355 \tzhelplines(4,4)
356 \tzframering*[blue](0,0)(3,4)
357 < (1.3,1.3) circle (1cm) (2,3) circle (.5) >
358 \tzboxring[pattern=bricks](1,1)(4,3)
359 < (2.5,2) ellipse (1 and .7) >
360 \end{tikzpicture}
361 \end{tzcode}
362
363 \icmd{\tzframering} and \icmd{\tzboxring} are aliases of |\tzrectaglering|.
364
365 \icmd{\tzframering*} and \icmd{\tzboxring*} are aliases of |\tzrectaglering*|.
366
367 %%------------------------------------------------------------
368 \section{Circles and rings}
369 \label{s:circleandring}
370
371 \subsection{\protect\cmd{\tzcircle(*)}}
372 \label{ss:tzcircle}
373
374 \icmd{\tzcircle} draws a circle around a specified coordinate with a specified radius.
375 The coordinate and the radius are mandatory.
376
377 \begin{tzdef}
378 % syntax
379 \tzcircle[<opt>]<shift coor>"<path name>"(<coor>)(<radius>)<code.append>
380 % defaults
381 []<>""(<m>)(<m>)<>
382 \end{tzdef}
383
384 \begin{tztikz}
385 \tzcircle(0,0)(1cm) % works like:
386 \draw (0,0) circle (1cm);
387 \end{tztikz}
388
389 \begin{tzcode}{.3}
390 % \tzcircle: "name path" and intersections
391 \begin{tikzpicture}
392 \tzhelplines(4,3)
393 \tzcircle(1,1)(1cm)
394 \tzcircle[blue,dashed]"AA"(2,2)(1cm)
395 \tzvXpointat{AA}{2.5}(A) % intersections
396 \tzdots*(A-1){$A_1$}[r](A-2){$A_2$}[r];
397 \end{tikzpicture}
398 \end{tzcode}
399
400
401 The starred version \icmd{\tzcircle*} fills the interior
402 with |fill=black!50| with |fill opacity=.3| and |text opacity=1|, by default.
403 You can change the fill opacity using the curly brace option |{<fill opacity>}| \xem{right after} the option |(<radius>)|.
404
405 \begin{tzdef}
406 % syntax
407 \tzcircle*[<opt>]<shift coor>"<path name>"
408 (<coor>)(<radius>){<fill opacity>}<code.append>
409 % defaults
410 *[fill=black!50,fill opacity=.3,text opacity=1]<>""(<m>)(<m>){.3}<>
411 \end{tzdef}
412
413
414 You can move the circles by specifying the option |<shift coor>| \xem{before} the center coordinate or \xem{immediately before} the option |"<path name>"| if it exists.
415 The \xem{empty} shift option |<>| is \xem{not allowed}.
416
417 \begin{tzcode}{.3}
418 % \tzcircle(*): shift
419 \begin{tikzpicture}
420 \tzhelplines(4,4)
421 \tzcoors(2,2)(A)(3,1)(B);
422 \tzcircle(2,2)(1)
423 \tzcircle[blue,dashed]<-.5,0>(A)(1)
424 \tzcircle*(3,1)(.5cm)
425 \tzcircle*[blue]<.5,0>(B)(.5cm)
426 \end{tikzpicture}
427 \end{tzcode}
428
429 With the last option |<code.append>|, you can add some \Tikz\ code.
430
431 \begin{tzcode}{.3}
432 % \tzcircle(*): <code.append>
433 \begin{tikzpicture}
434 \tzhelplines(4,4)
435 \tzcoors(2,2)(A)(3,1)(B);
436 \tzcircle*[blue,even odd rule](A)(1cm)
437 <(2,2) circle (1.5)>
438 \tzcircle[fill=green,even odd rule](B)(1cm)
439 <(3,1) circle (.7)>
440 \end{tikzpicture}
441 \end{tzcode}
442
443
444 \subsection{\protect\cmd{\tzring(*)}}
445
446 \icmd{\tzring*} draws two circles and draws a circle ring by filling the interior with the default options \ixxw{even odd rule}, |fill=black!50|, |fill opacity=.3|, and |text opacity=1|.
447
448 \begin{tzdef}
449 % syntax: minimal
450 \tzring*(<coor>)(<radius>)(<coor>)(<radius>)
451 % syntax: full
452 \tzring*[<opt>]<shift coor>
453 (<coor>)(<radius>)(<coor>)(<radius>){<fill opacity>}<code.append>
454 % defaults:
455 *[even odd rule,fill=black!50,fill opacity=.3,text opacity=1]
456 <>(<m>)(<m>)()(){.3}<>
457 \end{tzdef}
458
459 \begin{tztikz}
460 \tzring*(0,0)(1cm)(0,0)(1.5cm) % works like:
461 \draw [fill=black!50,fill opacity=.3,text opacity=1, even odd rule]
462 (0,0) circle (1cm) (0,0) circle (1.5cm);
463 \end{tztikz}
464
465 \begin{tzcode}{.3}
466 % \tzring*: fill opacity
467 \begin{tikzpicture}
468 \tzhelplines(4,4)
469 \tzring*[green](2,2)(1)(2,2)(1.5)
470 \tzring*[fill=blue](3,1)(1)(3,1)(.7){1} %
471 \end{tikzpicture}
472 \end{tzcode}
473
474
475 \begin{tzcode}{.3}
476 % \tzring*: nonzero rule
477 \begin{tikzpicture}
478 \tzhelplines(4,2)
479 \tzring*[fill=red,nonzero rule](1,1)(1)(2,1)(1)
480 \end{tikzpicture}
481 \end{tzcode}
482
483
484 \begin{tzcode}{.3}
485 % \tzring*: nonzero rule
486 \begin{tikzpicture}
487 \tzhelplines(4,2)
488 \tzring*[fill=red,nonzero rule](1,1)(1)(2,1)(1){1}
489 \tzring*[fill=white](1,1)(1)(2,1)(1){1}
490 \end{tikzpicture}
491 \end{tzcode}
492
493 \begin{tzcode}{.3}
494 % \tzring*: nonzero rule
495 \begin{tikzpicture}
496 %\tzhelplines(4,3)
497 \tzframe(0,0)(4,3)
498 \tzring*[blue](1.5,1.5)(1)(2.5,1.5)(1)
499 \end{tikzpicture}
500 \end{tzcode}
501
502
503 \icmd{\tzring} draws two circles with the default option \ixxw{even odd rule}.
504
505
506 \begin{tzdef}
507 % syntax: minimal
508 \tzring*(<coor>)(<radius>)(<coor>)(<radius>)
509 % syntax: full
510 \tzring*[<opt>]<shift coor>
511 (<coor>)(<radius>)(<coor>)(<radius>)<code.append>
512 % defaults:
513 [even odd rule]<>(<m>)(<m>)()()<>
514 \end{tzdef}
515
516 \begin{tzcode}{.3}
517 % \tzring: shift
518 \begin{tikzpicture}
519 \tzhelplines(4,4)
520 \tzcoors(2,2)(A)(3,1)(B);
521 \tzring[blue](2,2)(1)(2,2)(1.5)
522 \tzring[fill=green]<-1,0>(3,1)(1)(3,1)(.7) % shift
523 \end{tikzpicture}
524 \end{tzcode}
525
526 You can add some \Tikz\ code with the last option |<code.append>|.
527
528
529 \begin{tzcode}{.3}
530 % \tzring(*): <code.append>
531 \begin{tikzpicture}
532 \tzhelplines(4,3)
533 \tzring*[blue](2,2)(1)< (1.5,2) circle (.3 and .5) >
534 \tzring*[pattern=bricks](3,1)(1)
535 < (2.5,.5) rectangle ++(1,1) >
536 \end{tikzpicture}
537 \end{tzcode}
538
539
540 \begin{tzcode}{.3}
541 % \tzring(*): nonzero rule, fill opacity
542 \begin{tikzpicture}
543 \tzhelplines(4,3)
544 \tzring*[fill=red,draw=none,nonzero rule](1,1)(1){1}
545 <(3,.5) rectangle (1.5,3)>
546 \tzcirclering[fill=white](1,1)(1)
547 <(3,.5) rectangle (1.5,3)>
548 \end{tikzpicture}
549 \end{tzcode}
550
551
552
553 \icmd{\tzcirclering} and \icmd{\tzcirclering*} are aliases of |\tzring| and |\tzring*|, respectively.
554
555
556
557
558 %%------------------------------------------------------------
559 \section{Ellipses}
560 \label{s:ellipses}
561
562 \subsection{\protect\cmd{\tzellipse(*)}}
563 \label{ss:tzellipse}
564
565
566 \icmd{\tzellipse} draws an ellipse around a specified coordinate with the specified x-radius and y-radius.
567
568 The starred version \icmd{\tzellipse*} fills the interior
569 with |fill=black!50| with |fill opacity=.3| and |text opacity=1|, by default.
570
571 |\tzellise(*)| is basically the same as |\tzcircle(*)|.
572
573 \begin{tzdef}
574 % syntax
575 \tzellipse*[<opt>]<shift coor>"<path name>"
576 (<coor>)(<x and y radius>){<fill opacity>}<code.append>
577 % defaults: \tzellipse*
578 *[fill=black!50,fill opacity=.3,text opacity=1]<>""(<m>)(<m>){.3}<>
579 % defaults: \tzellipse
580 *[]<>""(<m>)(<m>)<>
581 \end{tzdef}
582
583
584
585 \begin{tztikz}
586 \tzellipse(0,0)(1 and .5) % works like:
587 \draw (0,0) ellipse (1 and .5);
588 \end{tztikz}
589
590
591 \begin{tzcode}{.3}
592 % \tzellipse: "name path" and intersections
593 \begin{tikzpicture}
594 \tzhelplines(4,3)
595 \tzellipse(1,1)(1cm and 7mm)
596 \tzellipse[blue,dashed]"AA"(2,2)(1cm and 7mm)
597 \tzvXpointat{AA}{2.5}(A) % intersections
598 \tzdots*(A-1){$A_1$}[r](A-2){$A_2$}[r];
599 \end{tikzpicture}
600 \end{tzcode}
601
602
603 You can move the ellipse by specifying the option |<shift coor>| immediately before the mandatory coordinate.
604 The \xem{empty} shift option |<>| is \xem{not allowed}.
605
606 Using the last option |{<fill opacity>}|, you can change the fill opacity.
607
608 \begin{tzcode}{.3}
609 % \tzellipse(*)
610 \begin{tikzpicture}
611 \tzhelplines(4,3)
612 \tzellipse(2,2)(1.5 and 1)
613 \tzellipse*[blue](2,1)(1 and 1.5){.5} % fill opacity
614 \tzellipse[fill=green](3,1)(1cm and .5cm)
615 \tzellipse*[red]<0,-.5>(3,1)(1cm and .5cm) % shift
616 \end{tikzpicture}
617 \end{tzcode}
618
619
620
621 You can add some \Tikz\ code with the option |<code.append>|.
622
623 \begin{tzcode}{.3}
624 % \tzellipse(*), \tzoval(*): <code.append>
625 \begin{tikzpicture}
626 \tzhelplines(4,4)
627 \tzoval*[blue,even odd rule](2,2)(1.5 and 1)
628 <(2,2) ellipse (2 and 1.5)>
629 \tzellipse[fill=green,even odd rule](3,1)(1 and 1)
630 <(3,1) ellipse (.5 and .8)>
631 \end{tikzpicture}
632 \end{tzcode}
633
634 \icmd{\tzoval} is an alias of |\tzellipse| and \icmd{\tzoval*} is an alias of |\tzellipse*|.
635
636
637 \subsection{\protect\cmd{\tzellipsering(*)}}
638
639 \icmd{\tzellipse*} draws two ellipses and draws an ellipse ring by filling the interior with the default options \ixxw{even odd rule}, |fill=black!50|, |fill opacity=.3|, and |text opacity=1|.
640
641 \icmd{\tzellipse} draws two ellipses with the default option |even odd rule|.
642
643 |\tzellipsering(*)| is basically the same as |\tzring(*)|.
644
645 \begin{tzdef}
646 % syntax: minimal
647 \tzellipse*(<coor>)(<x and y radius>)(<coor>)(<x and y radius>)
648 % syntax: full
649 \tzellipsering*[<opt>]<shift coor>
650 (<coor>)(<x and y radius>)(<coor>)(<x and y radius>)
651 {<fill opacity>}<code.append>
652 % defaults: \tzellipse*
653 *[even odd rule,fill=black!50,fill opacity=.3,text opacity=1]
654 <>(<m>)(<m>)()(){.3}<>
655 % defaults: \tzellipse
656 *[even odd rule]<>(<m>)(<m>)()()<>
657 \end{tzdef}
658
659 \begin{tztikz}
660 \tzellipsering*(2,1)(1cm and 1.5cm)(2,2)(1.5cm and 1.5cm) % works like:
661 \draw [fill=black!50,fill opacity=.3,text opacity=1, even odd rule]
662 (2,1) ellipse (1cm and 1.5cm) (2,2) ellipse (1.5cm and 1.5cm);
663 \end{tztikz}
664
665 \begin{tzcode}{.3}
666 % \tzring*: fill opacity
667 \begin{tikzpicture}
668 \tzhelplines(4,4)
669 \tzellipsering*[blue](2,2)(1 and 1)(2,2)(1.5cm)
670 \tzring*[fill=green](2,1)(1 and 1.5)(2,1)(.7 and 1){1}
671 \end{tikzpicture}
672 \end{tzcode}
673
674
675
676
677
678
679 \begin{tzcode}{.3}
680 % \tzellipsering(*)
681 \begin{tikzpicture}
682 \tzhelplines(4,4)
683 \tzcoors(2,2)(A)(3,1)(B);
684 \tzellipsering*[blue](2,2)(1 and 1.5)
685 < (1.5,2.5) circle (3mm) >
686 \tzellipsering[pattern=bricks]<1,0>(2,1)(1 and 1.5)
687 < (2.5,.5) rectangle ++(1,1) >
688 \end{tikzpicture}
689 \end{tzcode}
690
691 \begin{tzcode}{.3}
692 % \tzellipsering(*)
693 \begin{tikzpicture}
694 \tzhelplines(4,4)
695 \tzcoors(2,2)(A)(3,1)(B);
696 \tzovalring*[fill=red,draw=none,nonzero rule]
697 (2,2)(1 and 1.5)(3,1)(1 and 1.5){1}
698 \tzovalring[fill=white]
699 (2,2)(1 and 1.5)(3,1)(1 and 1.5)
700 \end{tikzpicture}
701 \end{tzcode}
702
703 \icmd{\tzovalring} is an alias of |\tzellipsering| and \icmd{\tzovalring*} is an alias |\tzellipsering*|.
704
705
706
707 %%==================================
708 \chapter{Arcs, Wedges, and Angle Marks}
709 \label{c:arcs}
710
711 %%------------------------------------------------------------
712 \section{\protect\cmd{\tzarc(')}: Centered arcs}
713 \label{s:tzarc}
714
715 \subsection{Arcs}
716 \label{ss:tzarc}
717
718 \icmd{\tzarc} draws an arc around a specified \xem{center coordinate}.
719
720 \begin{tzdef}
721 % syntax: minimum
722 \tzarc(<coor>)(<angA:angB:radius>)
723 % syntax: full
724 \tzarc[<opt>]<shift coor>"<path name>"
725 (<coor>)(<angA:angB:radius>){<text>}[<node opt>]<code.append>
726 % defaults
727 []<>""(<m>)(<m>){}[]<>
728 \end{tzdef}
729
730
731 \begin{tztikz}
732 \tzarc(1,1)(30:120:1) % works like:
733 \draw (1,1) ++(30:1) arc (30:120:1);
734 \end{tztikz}
735
736 The \iisw{swap version} \icmd{\tzarc'} switches its drawing direction from \ixxw{counterclockwise} to \ixxw{clockwise} and vice versa.
737
738 \begin{tztikz}
739 \tzarc'(1,1)(30:120:1) % works like:
740 \draw (1,1) ++(30:1) arc (30:120-360:1);
741 \end{tztikz}
742
743
744 \begin{tzcode}{.3}
745 % \tzarc, \tzarc'
746 \begin{tikzpicture}
747 \tzhelplines(4,3)
748 \tzdots*(1,1)(3,2);
749 \tzarc [blue,->] (1,1)(-45:180:1)
750 \tzarc'[dashed,->] (1,1)(-45:180:1)
751 \draw [->](3,2) ++(-45:1) arc (-45:180:1);
752 \draw [dashed,->](3,2) ++(-45:1) arc (-45:180-360:1);
753 \end{tikzpicture}
754 \end{tzcode}
755
756 You can add text along the arc by specifying the options |{<text>}| and |[<node opt>]| immediately after the two mandatory arguments.
757
758
759 \begin{tzcode}{.3}
760 % \tzarc('): adding text
761 \begin{tikzpicture}
762 \tzhelplines(4,3)
763 \tzarc [blue,->] (1,1)(-45:180:1){A}[r]
764 \tzarc'[dashed,->](1,1)(-45:180:1)
765 \tzarc[->] (3,2)(-45:180:1){arc}[midway,sloped]
766 \tzarc'[dashed,->](3,2)(-45:180:1)
767 \end{tikzpicture}
768 \end{tzcode}
769
770 You can move arcs by specifying the option |<shift coor>| before the center coordinate or immediately before the option |"<path name>"| if it exists.
771 The \xem{empty} shift option |<>| is \xem{not allowed}.
772
773 \begin{tzcode}{.3}
774 % \tzarc('): shift, name path, intersection
775 \begin{tikzpicture}
776 \tzhelplines(4,3)
777 \tzarc [blue,->] (1,1)(-45:180:1){A}[r]
778 \tzarc'[dashed,->] (1,1)(-45:180:1)
779 \tzarc [blue,->] <2,1>(1,1)(-45:180:1){A-shifted}[r]
780 \tzarc'[dashed,->]<2,1>"AA"(1,1)(-45:180:1) %%
781 \tzvXpointat*{AA}{2.5}
782 \end{tikzpicture}
783 \end{tzcode}
784
785 You can also extend the path of |\tzarc| by specifying the last option |<code.append>| with \Tikz\ code written in it. For example, |<--cycle>| makes the path closed.
786
787
788 \begin{tzcode}{.3}
789 % \tzarc('): <code.append>
790 \begin{tikzpicture}
791 \tzhelplines(4,3)
792 \tzarc [blue,->](1,1)(-45:180:1)
793 < to[bend left] ++(1,-1) >
794 \tzarc [red,->] <2,1>(1,1)(-45:180:1)<--cycle>
795 \end{tikzpicture}
796 \end{tzcode}
797
798
799
800 \subsection{Elliptical arcs}
801 \label{ss:ellipticalarc}
802
803 |\tzarc| draws an \iisw{elliptical arc} if you specify |x-radius| and |y-radius|.
804
805 \begin{tzcode}{.3}
806 % \tzarc: elliptical
807 \begin{tikzpicture}
808 \tzhelplines(4,4)
809 \tzarc[->,red](1,1)(30:270:1.5 and 0.5)
810 \tzarc'[->,dotted](1,1)(30:270:1.5 and 0.5)
811 \tzdots*(1,1)(2,2);
812 \tzarc[->,blue,dashed](2,2)(0:-270:1 and 2)
813 \tzarc'[->](2,2)(0:-270:1 and 2)
814 \end{tikzpicture}
815 \end{tzcode}
816
817
818 \begin{tzcode}{.3}
819 % \tzarc: elliptical
820 \begin{tikzpicture}
821 \tzhelplines(4,4)
822 \tzarc[->,red](1,1)(30:270:1.5 and 0.5)
823 \tzdots*(1,1)(2,2);
824 \tzarc[blue,fill=green,fill opacity=.3]
825 (2,2)(0:-270:1 and 2)<--(2,2)--cycle> % code.append
826 \tzarc[->,blue,dashed]
827 <1,0>(2,2)(0:-270:1 and 2) % shift
828 \end{tikzpicture}
829 \end{tzcode}
830
831
832
833
834 %%------------------------------------------------------------
835 \section{\protect\cmd{\tzarcfrom(')}: Arcs as in \Tikz}
836 \label{s:tzarcfrom}
837
838 \icmd{\tzarcfrom} draws an arc starting from a specified point, like \Tikz\ does.
839
840 \begin{tzdef}
841 % syntax: minimum
842 \tzarcfrom(<coor>)(<angA:angB:radius>)
843 % syntax: full
844 \tzarcfrom[<opt>]<shift coor>"<path name>"
845 (<coor>)(<angA:angB:radius>){<text>}[<node opt>]<code.append>
846 % defaults
847 []<>""(<m>)(<m>){}[]<>
848 \end{tzdef}
849
850
851 \begin{tztikz}
852 \tzarcfrom(1,1)(30:120:1) % works like:
853 \draw (1,1) arc (30:120:1);
854 \end{tztikz}
855
856 \xem{Everything else is the same as in }|\tzarc|.
857
858 \icmd{\tzarcfrom'} is the \iisw{swap version} of |\tzarcfrom|.
859
860
861 \begin{tzcode}{.3}
862 % \tzarcfrom
863 \begin{tikzpicture}
864 \tzhelplines(4,3)
865 \tzdots*(1,1)(3,2);
866 \tzarcfrom [blue,->] (1,1)(-45:180:1){A}[r]
867 \tzarcfrom'[dashed,->](1,1)(-45:180:1)
868 \tzarcfrom[->](3,2)(-45:180:1){arc}[midway,sloped]
869 \tzarcfrom'[dashed,->](3,2)(-45:180:1)
870 \end{tikzpicture}
871 \end{tzcode}
872
873
874
875 %%------------------------------------------------------------
876 \section{\protect\cmd{\tzarcsfrom}: Connected arcs: Semicolon version}
877 \label{s:tzarcsfrom}
878
879 The macro \icmd{\tzarcsfrom} (i.e. |\tzarcs + from|) accepts an arbitrary number of parenthesis arguments in the form of |(<angA:AngB:radius>)| following the start coordinate. Since |tzarcsfrom| is a semicolon version, you need to enter a \xem{semicolon} to indicate when the repetition ends.
880
881 \begin{tzdef}
882 % syntax: minimum
883 \tzarcsfrom(<start coor>)
884 (<angA:angB:radius>)..repeated..(<angA:angB:radius>) ;
885 % syntax: full
886 \tzarcsfrom[<opt>]<shift coor>"<path name>"
887 (<start coor>)(<angA:angB:radius>){<text>}[<node opt>]
888 ..repeated..(){}[] ; <code.append>
889 % defaults
890 []<>""(<m>) (<m>){}[]..repeated..(){}[] ; <>
891 \end{tzdef}
892
893
894 \begin{tzcode}{.4}
895 % \tzarcfrom: adding text, <code.append>
896 \begin{tikzpicture}
897 \tzhelplines(4,4)
898 \tzcoor*(3,2)(A)
899 \tzarcsfrom[->,auto](A)
900 (0:180:1){1}[midway]
901 (180:360:1.2){2}[midway]
902 (0:180:1.4){3}[midway,swap]
903 (180:360:1.6){4}[midway,swap];
904 < node [right,blue] {End!} >
905 \end{tikzpicture}
906 \end{tzcode}
907
908
909
910 \begin{tzcode}{.4}
911 % \tzarcfrom: shift
912 % flag: step 1
913 \begin{tikzpicture}
914 \tzhelplines(-2,-2)(2,2)
915 \tzdot*(0,0)
916 \edef\x{atan(2/3)}
917 \tzarcsfrom[red,->](0,0)
918 (-\x:-\x-180:1){red 1}[midway];
919 \tzarcsfrom[blue,->](0,0)
920 (180-\x:-\x:1){blue 1}[midway];
921 \tzarcsfrom[dashed,->]<.5,.5>(0,0)
922 (180-\x:-\x:1){blue 1}[midway];
923 \end{tikzpicture}
924 \end{tzcode}
925
926
927 \begin{tzcode}{.4}
928 % flag: step 2
929 \begin{tikzpicture}
930 \edef\x{atan(2/3)}
931 \tzarcsfrom[red](0,0)
932 (-\x:-\x-180:1){1}[midway]
933 (-\x+180:-\x:2){2}[midway];
934 \tzarcsfrom[blue](0,0)
935 (180-\x:-\x:1){1}[midway]
936 (-\x:-\x-180:2){2}[midway];
937 \end{tikzpicture}
938 \end{tzcode}
939
940
941 \begin{tzcode}{.4}
942 % flag: step 3
943 \definecolor{flagred}{RGB}{205,48,57}
944 \definecolor{flagblue}{RGB}{17,73,156}
945 \begin{tikzpicture}[scale=1]
946 \edef\x{atan(2/3)}
947 \tzarcsfrom[draw=none,fill=flagred](0,0)
948 (-\x:-\x-180:1)
949 (-\x+180:-\x:2)
950 (-\x:-\x+180:1);<-- cycle>
951 \tzarcsfrom[draw=none,fill=flagblue](0,0)
952 (180-\x:-\x:1)
953 (-\x:-\x-180:2)
954 (-\x+180:-\x+360:1);<-- cycle>
955 \end{tikzpicture}
956 \end{tzcode}
957
958
959 \begin{tzcode}{.4}
960 % flag: shift
961 \definecolor{flagred}{RGB}{205,48,57}
962 \definecolor{flagblue}{RGB}{17,73,156}
963 \begin{tikzpicture}[scale=1]
964 \edef\x{atan(2/3)}
965 \tzarcsfrom[draw=none,fill=flagred]<.1,.3>(0,0)
966 (-\x:-\x-180:1)
967 (-\x+180:-\x:2)
968 (-\x:-\x+180:1);<-- cycle>
969 \tzarcsfrom[draw=none,fill=flagblue](0,0)
970 (180-\x:-\x:1)
971 (-\x:-\x-180:2)
972 (-\x+180:-\x+360:1);<-- cycle>
973 \end{tikzpicture}
974 \end{tzcode}
975
976
977
978 %%------------------------------------------------------------
979 \section{Wedges}
980 \label{s:wedges}
981
982 \subsection{\protect\cmd{\tzwedge(')}}
983 \label{ss:tzwedge}
984
985 \icmd{\tzwedge} draws a wedge around a specified \xem{center} coordinate.
986
987 |\tzwedge| works similarly to |\tzarc|, but it forms a closed path from the center coordinate. |\tzwedge| does not have the option |<code.append>|.
988
989 \begin{tzdef}
990 % syntax
991 \tzwedge[<opt>]<shift coor>"<path name>"
992 (<coor>)(<angA:angB:radius>){<text>}[<node opt>]
993 % defaults
994 []<>""(<m>)(<m>){}[midway]
995 \end{tzdef}
996
997
998 \begin{tztikz}
999 \tzwedge(1,1)(30:120:1) % works like:
1000 \draw (1,1) -- ++(30:1) arc (30:120:1) -- cycle;
1001 \end{tztikz}
1002
1003 The swap version \icmd{\tzwedge'} is the \iisw{swap version} of \icmd{\tzwedge}.
1004 It switches the drawing direction from \ixxw{counterclockwise} to \ixxw{clockwise} and vice versa.
1005
1006
1007 \begin{tztikz}
1008 \tzwedge'(1,1)(30:120:1) % works like:
1009 \draw (1,1) -- ++(30:1) arc (30:120-360:1) -- cycle;
1010 \end{tztikz}
1011
1012 \begin{tzcode}{.3}
1013 % \tzwedge, \tzwedge'
1014 \begin{tikzpicture}
1015 \tzcoor*(2,1)(A)(3pt)
1016 \tzhelplines(4,3)
1017 \tzwedge[blue,very thick](A)(30:120:1.5)
1018 \tzarc[->,green] (A)(30:120:1.3)
1019 \tzwedge'[dashed](A)(0:135:1.5){clockwise}[sloped,red]
1020 \tzarc'[->,green](A)(0:135:1.3)
1021 \tzwedge'[fill](A)(-60:240:1)
1022 \end{tikzpicture}
1023 \end{tzcode}
1024
1025 \begin{tzcode}{.3}
1026 % \tzwedge('): shift
1027 \begin{tikzpicture}
1028 \tzcoor*(2,1)(A)
1029 \tzhelplines(4,3)
1030 \tzwedge[blue,very thick]<.1,.1>(A)(30:120:1.5) % shift
1031 \tzarc[->,lightgray]<.1,.1>(A)(30:120:1.3) % shift
1032 \tzwedge'[dashed](A)(0:135:1.5){clockwise}[sloped,red]
1033 \tzarc'[->,lightgray](A)(0:135:1.3)
1034 \tzwedge'[fill]<2,0>(A)(-60:240:1) % shift
1035 \end{tikzpicture}
1036 \end{tzcode}
1037
1038
1039
1040
1041
1042 \subsection{\protect\cmd{\tzwedge*(')}}
1043 \label{ss:tzwedge*}
1044
1045 The starred version \icmd{\tzwedge*} fills the wedges with |fill=black!50| with |fill opacity=.3| and |text opacity=1|, by default.
1046 With |\settzfillcolor| and |\settzfillopacity|, you can change the default values.
1047 You can also change the fill opacity by specifying the last optional argument |{<fill opacity>}|.
1048
1049 \begin{tzdef}
1050 % syntax:
1051 \tzwedge*[<opt>]<shift coor>"<path name>"
1052 (<coor>)(<angA:angB:radius>){<text>}[<node opt>]{<fill opacity>}
1053 % defaults:
1054 *[fill=black!50,fill opacity=.3,text opacity=1]<>""(<m>)(<m>){}[midway]{.3}
1055 \end{tzdef}
1056
1057 \icmd{\tzwedge*'} is the \iisw{swap version} of |\tzwedge*|.
1058
1059 \begin{tzcode}{.3}
1060 % \tzwedge*, \tzwedge*'
1061 \begin{tikzpicture}[->,>=stealth]
1062 \tzhelplines(3,3)
1063 \tzwedge[very thick,blue](1,1)(30:120:1.5)
1064 \tzwedge*[-,very thick,blue,fill=red](1,1)(30:120:1)
1065 \tzwedge'[dashed](1,1)(30:120:1.5){clockwise}[pos=.45]
1066 \tzwedge*'[dashed,fill=green](1,1)(-90:180:1)
1067 \tzdot*(1,1)
1068 \end{tikzpicture}
1069 \end{tzcode}
1070
1071 \begin{tzcode}{.3}
1072 % \tzwedge*('): shift, fill opacity
1073 \begin{tikzpicture}
1074 \tzdot*(1,1)
1075 \tzhelplines(3,3)
1076 \tzwedge[blue,very thick](1,1)(30:120:1.5)
1077 \tzwedge[red,very thick]<.5,.5>(1,1)(30:120:1.5)
1078 \tzwedge'[dashed](1,1)(0:135:1.5)
1079 \tzwedge*[fill=blue](1,1)(300:240:1){B}[b]
1080 \tzwedge*[blue]<2,0>(1,1)(300:240:1){B}[b]{.7}
1081 \end{tikzpicture}
1082 \end{tzcode}
1083
1084 \begin{tzcode}{.3}
1085 % \tzwedge*('): name path, intersections
1086 \begin{tikzpicture}
1087 \tzhelplines(3,3)
1088 \tzwedge'[blue]"AA"(0,1)(45:330:2)
1089 \tzvXpointat{AA}{1}(A)
1090 \tzdots*(A){A}[al](A-2);
1091 \tzwedge*'[blue,fill=red]
1092 (0,1)(45:330:2mm){$\theta$}[midway,r]
1093 \end{tikzpicture}
1094 \end{tzcode}
1095
1096
1097
1098
1099 %%------------------------------------------------------------
1100 \section{Angle marks}
1101 \label{s:anglemarks}
1102
1103
1104 %%------------------------------------------------------------
1105 \subsection{\protect\cmd{\tzpointangle}: Angles between points}
1106 \label{ss:tzpointangle}
1107
1108 \icmd{\tzpointangle}|(<coor1>)(<coor2>)(<\mymacro>)| computes the angle between two points and allows you to use, where |(coor1)| serves as the coordinate of the center.
1109
1110 \begin{tzcode}{.3}
1111 \begin{tikzpicture}[font=\scriptsize]
1112 \tzhelplines(5,4)
1113 \tzcoors*(4,2)(A){A}(1,1)(B){B}[135];
1114 \tzline[red,dashed](0,1)(5,1)
1115 \tzline[tzextend={1cm}{1cm}](B)(A) % (B): center
1116 \tzpointangle(B)(A){\myAngA}
1117 \tznode(3,1){\myAngA\textdegree}[ar=2mm,absolute]
1118 \tzarc(1,1)(0:\myAngA:2cm)
1119 \end{tikzpicture}
1120 \end{tzcode}
1121
1122
1123
1124 \begin{tzcode}{.3}
1125 \begin{tikzpicture}[font=\scriptsize]
1126 \tzhelplines(5,4)
1127 \tzcoors*(4,2)(A){A}(1,1)(B){B}[135](2,3)(C){C} ;
1128 \tzline[red,dashed](0,1)(5,1)
1129 \tzline[tzextend={1cm}{1cm}](B)(A)
1130 \tzline[tzextend={1cm}{1cm}](B)(C)
1131 \tzpointangle(B)(A){\myAngA}
1132 \tznode(3,1){\myAngA\textdegree}[ar=2mm,absolute]
1133 \tzarc(1,1)(0:\myAngA:2cm)
1134 \tzpointangle(B)(C){\myAngC}
1135 \tznode(2,2){\myAngC\textdegree}[r=3mm]
1136 \tzarc(1,1)(0:\myAngC:1.5cm)
1137 \tzarc(1,1)(\myAngA:\myAngC:10pt){$\theta$}[ar,midway]
1138 \tzarc(1,1)(\myAngA:\myAngC:11pt)
1139 \end{tikzpicture}
1140 \end{tzcode}
1141
1142
1143 \begin{tzcode}{.3}
1144 \begin{tikzpicture}[font=\scriptsize]
1145 \tzhelplines(5,4)
1146 \tzcoors*(4,2)(A){A}(1,1)(B){B}[135](2,3)(C){C} ;
1147 \tzline[tzextend={1cm}{1cm}](B)(A)
1148 \tzline[tzextend={1cm}{1cm}](B)(C)
1149 \tzpointangle(B)(A){\myAngA}
1150 \tzpointangle(B)(C){\myAngC}
1151 \tzarc(1,1)(\myAngA:\myAngC:10pt){$\theta$}[ar,midway]
1152 \tzarc(1,1)(\myAngA:\myAngC:11pt)
1153 \end{tikzpicture}
1154 \end{tzcode}
1155
1156
1157 %%------------------------------------------------------------
1158 \subsection{\protect\cmd{\tzanglemark(')}: Angle marks}
1159 \label{ss:tzanglemark}
1160
1161 \icmd{\tzanglemark} accepts three mandatory coordinates to display an angle mark by an arc (of radius |10pt|, by default) for the second coordinate, on the |behind| layer by default.
1162 You can change the angle arc radius by \icmd{\settzAAradius}.
1163 You can change the layer by \icmd{\settzanglelayer}. Its alias is |\settzanglemarklayer|.
1164
1165 The default line width of angle marks is |very thin|. You can change the default line with with \icmd{\settzAAlinestyle}.
1166
1167 \begin{tzdef}
1168 % syntax: minimum
1169 \tzanglemark(<coorA>)(<coorB>)(<coorC>)
1170 % syntax: full
1171 \tzanglemark[<opt>](<coorA>)(<coorB>)(<coorC>){<text>}[<node opt>](<arc radius>)
1172 % defaults
1173 [very thin](<m>)(<m>)(<m>){}[pos=1.5](10pt)
1174 \end{tzdef}
1175
1176 You can add angle text by the options |{<text>}| and |[<node opt>]|.
1177
1178 \begin{tzcode}{.3}
1179 % simple example
1180 \begin{tikzpicture}
1181 \tzcoors*(4,2)(A){A}(1,1)(B){B}[180](2,3)(C){C} ;
1182 \tzlines(A)(B)(C);
1183 \tzanglemark(A)(B)(C){$\theta$} % angle mark
1184 \end{tikzpicture}
1185 \end{tzcode}
1186
1187 \begin{tzcode}{.3}
1188 % \settzAAradius
1189 \begin{tikzpicture}
1190 \tzcoors(4,2)(A){A}(1,1)(B){B}[180](2,3)(C){C} ;
1191 \tzlines(A)(B)(C);
1192 \tzlines[thick,blue](A)(2.5,0)(C);
1193 \tzanglemark(A)(B)(C){$\theta$} %%
1194 \settzAAradius{20pt} %%
1195 \tzanglemark(C)(2.5,0)(A){$\alpha$}[pos=.7] %%
1196 \end{tikzpicture}
1197 \end{tzcode}
1198
1199
1200 \paragraph{How it works} Every |\tzanglemark| calculates angles (from 0\textdegree to 360\textdegree) and stores the values under the names \icmd{\tzangleONE} and \icmd{\tzangleTWO}. The difference of the two numbers is stored as an absolute value under the name \icmd{\tzangleresult}.
1201 Of course, you can use these values \xem{only after} running |\tzanglemark|.
1202 \begin{itemize}\firmlist
1203 \item |\tzanglemark| draws an angle mark between two angles, |counterclockwise|, from small two large.
1204 \item |\tzanglemark'| draws an angle mark between two angles, |clockwise|, from small to large.
1205 \end{itemize}
1206
1207 \begin{tzcode}{.3}
1208 \begin{tikzpicture}
1209 \tzhelplines(4,3)
1210 \tzcoors*(4,2)(A){A}(1,1)(B){B}[180](2,3)(C){C} ;
1211 \tzlines(A)(B)(C);
1212 \tzanglemark[->](A)(B)(C){$\theta$}
1213 \tznode[scale=.7](3,1){ONE: \tzangleONE}[r]
1214 \tznode[scale=.7](3,.5){TWO: \tzangleTWO}[r]
1215 \tznode[scale=.7](3,0){$\theta$: \tzangleresult}[r]
1216 \end{tikzpicture}
1217 \end{tzcode}
1218
1219
1220 \remark Simple to use:
1221 \begin{itemize}\firmlist
1222 \item
1223 |\tzmarkanlge(A)(B)(C)| draws an angle mark by an arc from |(A)| to |(C)| about |(B)|.
1224 \item
1225 |\tzmarkanlge(C)(B)(A)| draws an angle mark by an arc from |(C)| to |(A)| about |(B)|.
1226 \item Ignoring the direction, |\tzanglemark(A)(B)(C)| and |\tzanglemark(C)(B)(A)| give the same result.
1227 \end{itemize}
1228
1229 \begin{tzcode}{.3}
1230 \begin{tikzpicture}
1231 \tzhelplines(4,3)
1232 \tzcoors*(4,2)(A){A}(1,1)(B){B}[180](2,3)(C){C} ;
1233 \tzlines(A)(B)(C);
1234 \tzanglemark[->](C)(B)(A){$\theta$}
1235 \tznode[scale=.7](3,1){ONE: \tzangleONE}[r]
1236 \tznode[scale=.7](3,.5){TWO: \tzangleTWO}[r]
1237 \tznode[scale=.7](3,0){$\theta$: \tzangleresult}[r]
1238 \end{tikzpicture}
1239 \end{tzcode}
1240
1241 \paragraph{Swap version}
1242 The \iisw{swap version} \icmd{\tzanglemark'} draws an angle mark for an angle in $360\text{\textdegree}-\theta$.
1243 In other words, |\tzanglemark'| \xem{switches the direction} of drawing an angle arc from |counterclockwise| to |clockwise|, and vice versa.
1244
1245 \begin{tzcode}{.3}
1246 \begin{tikzpicture}
1247 \tzhelplines(4,3)
1248 \tzcoors*(4,3)(A){A}(1,2)(B)(3,0)(C){C}[0] ;
1249 \tzlines[thick](A)(B)(C);
1250 \tzanglemark[->](A)(B)(C){$\theta$}
1251 \tznode[scale=.7](3,2){ONE: \tzangleONE}[r]
1252 \tznode[scale=.7](3,1.5){TWO: \tzangleTWO}[r]
1253 \tznode[scale=.7](3,1){$\theta$: \tzangleresult}[r]
1254 \tzanglemark'[->](A)(B)(C){$\theta'$}(15pt) % swap
1255 \end{tikzpicture}
1256 \end{tzcode}
1257
1258
1259
1260 \paragraph{Angle mark text position}
1261 The midpoint of an angle arc is stored under the coordinate name |tzAAmid|.
1262 The angle mark text is put on the line that goes through the middle point and \icmd{(tzAAmid)}. The default |(<arc radius>)| is |10pt| and the default position of angle text is |pos=1.5| in |[<node opt>]|.
1263
1264 \begin{tzcode}{.3}
1265 % angle marc text position
1266 \begin{tikzpicture}
1267 \tzhelplines(4,3)
1268 \tzcoors*(4,2)(A){A}(1,1)(B){B}[180](2,3)(C){C} ;
1269 \tzlines(A)(B)(C);
1270 \tzanglemark(C)(B)(A){$\theta$}[pos=.65](20pt) %%
1271 \tzdot*(tzAAmid)
1272 \tzline[red,dashed,tzextend={1cm}{2cm}](B)(tzAAmid)
1273 \end{tikzpicture}
1274 \end{tzcode}
1275
1276 \remark Instead of using the options |{<text>}| and |[<node opt>]|, you can also use the coordinate |(tzAAmid)| to place the angle text wherever you want, without using |\tzanglemark(')|. Of course, you can use the correct |(tzAAmid)| only after running |\tzanglemark|.
1277
1278
1279
1280 %%------------------------------------------------------------
1281 \subsection{\protect\cmd{\tzanglemark*(')}: Fill angle marks}
1282 \label{ss:tzanglemark*}
1283
1284 \icmd{\tzanglemark*} fills (in the |behind| layer, by default) the angle mark area with |fill=black!50| and with the options |fill opacity=.3| and |text opacity=1| by default. It does not draw any lines: |[draw=none]| by default.
1285
1286 Using the macros such as |\settzfillcolor|, |\settzfillopacity|, and \icmd{\settzanglelayer}, you can change the default values.
1287
1288
1289
1290 \begin{tzdef}
1291 % syntax: minimum
1292 \tzanglemark*(<coorA>)(<coorB>)(<coorC>)
1293 % syntax: full
1294 \tzanglemark[<opt>](<coorA>)(<coorB>)(<coorC>){<text>}[<node opt>](<arc radius>)
1295 % defaults
1296 [very thin](<m>)(<m>)(<m>){}[pos=1.5](10pt)
1297 % syntax
1298 \tzanglemark*[<opt>](<coor1>)(<coor2>)(<coor3>)
1299 {<text>}[<node opt>](<arc radius>){<fill opacity>}
1300 % defaults
1301 *[very thin,draw=none,fill=black!50,fill opacity=.3,text opacity=1]
1302 (<m>)(<m>)(<m>){}[pos=1.5](10pt){.3}
1303 \end{tzdef}
1304
1305
1306 \begin{tzcode}{.3}
1307 % \tzanglemark*
1308 \begin{tikzpicture}
1309 \tzhelplines(4,3)
1310 \tzcoors*(4,2)(A){A}(1,1)(B){B}[180](2,3)(C){C} ;
1311 \tzlines(A)(B)(C);
1312 \tzanglemark*[red](C)(B)(A){$\theta$}
1313 \end{tikzpicture}
1314 \end{tzcode}
1315
1316
1317 \icmd{\tzanglemark*'} is the \iisw{swap version} of |\tzanglemark*|.
1318
1319 \begin{tzcode}{.3}
1320 % \tzanglemark*(')
1321 \begin{tikzpicture}
1322 \tzhelplines(4,3)
1323 \tzcoors*(4,3)(A){A}(1,2)(B)(3,0)(C){C}[0] ;
1324 \tzlines(A)(B)(C);
1325 \tzanglemark*[red](A)(B)(C){$\theta$}
1326 \tzanglemark*'[blue](A)(B)(C){$\theta'$}(15pt) % swap
1327 \end{tikzpicture}
1328 \end{tzcode}
1329
1330 \begin{tzcode}{.3}
1331 % \tzanglemark*('): \settzAAlinestyle
1332 \begin{tikzpicture}
1333 \settzAAlinestyle{thick}
1334 \tzhelplines(4,3)
1335 \tzcoors*(4,3)(A){A}(1,2)(B)(3,0)(C){C}[0] ;
1336 \tzlines[thick,blue](A)(B)(C);
1337 \tzanglemark*[red](A)(B)(C){$\theta$}
1338 \tzanglemark(A)(B)(C)
1339 \settzAAlinestyle{very thin} % default
1340 \tzanglemark'(A)(B)(C)(14pt)
1341 \tzanglemark'(C)(B)(A)(15pt){$\theta'$}
1342 \end{tikzpicture}
1343 \end{tzcode}
1344
1345
1346
1347 %%%% (REMOVED!!!)
1348 %%%%%------------------------------------------------------------
1349 %%%\section{\protect\cmd{\tzpicangle}: angle marks}
1350 %%%\label{s:tzpicangle}
1351 %%%
1352 %%%\begin{tzdef}
1353 %%%% syntax: angle ABC or angle CBA
1354 %%%\tzpicangle(')[<angle pic opt>][<path/draw opt>](<coor1>)(<coor2>)(<coor3>)
1355 %%% {<angle pic text>}[<text eccentricity>](<angle pic arc radius>)
1356 %%%% defaults:(')[][]()()(){}[1.5](10pt)
1357 %%%\end{tzdef}
1358 %%%
1359 %%%When |(coor1) -- (coor2) -- (coor3)| is arranged naturally (counterclockwise),
1360 %%%|\tzarc| draws an arc naturally (counterclockwise), while |tzarc'| draws an arc clockwise.
1361 %%%
1362 %%%When |(coor1) -- (coor2) -- (coor3)| is arranged clockwise,
1363 %%%|\tzarc| draws an arc counterclockwise, while |tzarc'| draws an arc counterclockwise.
1364 %%%
1365 %%%\remark
1366 %%%Internally, |\tzpicangle| is defined to draw an arc by a |pic| operation of \TikZ, so it is not affected by scaling, unless |transform shape| is not used.
1367 %%%
1368 %%%\begin{tzcode}{.3}
1369 %%%\begin{tikzpicture}
1370 %%%\tzhelplines(4,2)
1371 %%%\tzlines(2,2)(1,1)(3,0);
1372 %%%\tzpicangle[->,draw=red,fill=red!30](2,2)(1,1)(3,0){a}
1373 %%%\tzlines [xshift=1cm](2,2)(1,1)(3,0);
1374 %%%\tzpicangle'[->][xshift=1cm](2,2)(1,1)(3,0){a}
1375 %%%\end{tikzpicture}
1376 %%%\end{tzcode}
1377 %%%
1378 %%%
1379 %%%\begin{tzcode}{.3}
1380 %%%\begin{tikzpicture}
1381 %%%\tzhelplines(4,2)
1382 %%%\tzlines(3,0)(1,1)(2,2);
1383 %%%\tzpicangle[->,fill=red!30](3,0)(1,1)(2,2){a}
1384 %%%\tzlines [xshift=1cm](3,0)(1,1)(2,2);
1385 %%%\tzpicangle'[->][xshift=1cm](2,2)(1,1)(3,0){a}[.5](1cm)
1386 %%%\end{tikzpicture}
1387 %%%\end{tzcode}
1388 %%%
1389 %%%
1390 %%%\begin{tzcode}{.3}
1391 %%%\begin{tikzpicture}
1392 %%%\tzhelplines(4,2)
1393 %%%\tzlines(2,0)(0,0)(0,2);
1394 %%%\tzpicangle[fill=red!30](2,0)(0,0)(0,2){a}
1395 %%%\tzlines [xshift=1cm](2,2)(1,1)(3,0);
1396 %%%\tzpicangle'[->][xshift=1cm](2,2)(1,1)(3,0){a}[.5](1cm)
1397 %%%\end{tikzpicture}
1398 %%%\end{tzcode}
1399 %%%
1400 %%%
1401 %%%\begin{tzcode}{.3}
1402 %%%\begin{tikzpicture}
1403 %%%\tzhelplines(4,2)
1404 %%%\tzpicangle [fill=red!30](2,2)(1,1)(3,0){a}
1405 %%%\tzpicangle'[][xshift=1cm](2,2)(1,1)(3,0){a}
1406 %%%\end{tikzpicture}
1407 %%%\end{tzcode}
1408 %%%
1409 %%%
1410 %%%\begin{tzcode}{.3}
1411 %%%\begin{tikzpicture}
1412 %%%\tzhelplines(4,2)
1413 %%%\tzpicangle [fill=red!30](3,0)(1,1)(2,2){a}
1414 %%%\tzpicangle'[->][xshift=1cm](2,2)(1,1)(3,0){a}[.5](1cm)
1415 %%%\end{tikzpicture}
1416 %%%\end{tzcode}
1417 %%%
1418 %%%
1419 %%%\begin{tzcode}{.3}
1420 %%%\begin{tikzpicture}
1421 %%%\tzhelplines(4,2)
1422 %%%\tzpicangle [fill=red!30](2,0)(0,0)(0,2){a}
1423 %%%\tzpicangle'[->][xshift=1cm](2,2)(1,1)(3,0){a}[.5](1cm)
1424 %%%\end{tikzpicture}
1425 %%%\end{tzcode}
1426 %%%
1427 %%%\begin{tzcode}{.3}
1428 %%%\begin{tikzpicture}[scale=.5]
1429 %%%\tzhelplines(4,2)
1430 %%%\tzpicangle [fill=red!30](2,0)(0,0)(0,2){a}
1431 %%%\tzpicangle'[->][xshift=1cm](2,2)(1,1)(3,0){a}[.5](1cm)
1432 %%%\end{tikzpicture}
1433 %%%\end{tzcode}
1434
1435
1436
1437
1438 \subsection{\protect\cmd{\tzrightanglemark}: Right angle marks}
1439 \label{ss:tzrightangle}
1440
1441 \icmd{\tzrightanglemark} takes three coordinates as mandatory arguments to display a right angle mark for the second coordinate. The mark is drawn on the |behind| layer by default, which can be changed by \icmd{\settzanglelayer}.
1442
1443 The default line with is |very thin|, which can be changed by the option |[<opt>]|. You can also change the line width using \icmd{\settzRAlinestyle}, which is valid until the end of |tikzpicture| environment.
1444 |\settzRAlinestyle| is an alias of |\settzAAlinestyle|.
1445 The length of the side is |5pt| by default, and it can be changed by the last option |(<size>)|.
1446 You can also change the size with \icmd{\settzRAsize}, which is valid until the end of the |tikzpicture| environment.
1447
1448 \begin{tzdef}
1449 % syntax: minimum
1450 \tzrightanglemark(<coorA>)(<coorB>)(<coorC>)
1451 % syntax: full
1452 \tzrightanglemark[<opt>](<coorA>)(<coorB>)(<coorC>){<text>}[<node opt>](<size>)
1453 % defaults
1454 [very thin](<m>)(<m>)(<m>){}[](5pt)
1455 \end{tzdef}
1456
1457 \begin{tzcode}{.3}
1458 % simple example (with angle text)
1459 \begin{tikzpicture}[font=\scriptsize]
1460 \tzhelplines(4,3)
1461 \tzcoors(1,2)(A){A}(1,0)(B){B}[180](4,0)(C){C}[0];
1462 \tzlines(A)(B)(C);
1463 \tzrightanglemark(A)(B)(C){90\textdegree}
1464 \end{tikzpicture}
1465 \end{tzcode}
1466
1467 \remark
1468 \begin{itemize}\firmlist
1469 \item |\tzrightanglemark(A)(B)(C)| and |\tzrightanglemark(C)(B)(A)| give the same result.
1470 \item |\tzrightanglemark'| is redundant, but it is provided to avoid frequent coding errors.
1471 \end{itemize}
1472
1473 Each |\tzrightanglemark| defines \icmd{(tzRAvertex)} as the coordinate of the right angle mark vertex.
1474 The angle text is placed on the line going through the second coordinate and |(tzRAvertex)|. The default position is |pos=2| in |[<node opt>]|.
1475
1476 \begin{tzcode}{.3}
1477 % \settzRAsize
1478 \begin{tikzpicture}
1479 \tzhelplines(4,3)
1480 \tzcoors(2,3)(A){A}(1,1)(B){B}[180](3,0)(C){C}[0];
1481 \tzlines(A)(B)(C);
1482 \settzRAsize{15pt}
1483 \tzrightanglemark(A)(B)(C){90\textdegree}[pos=1.7]
1484 \tzdot*(tzRAvertex)
1485 \tzline[red,dashed,tzextend={2mm}{2cm}](B)(tzRAvertex)
1486 \end{tikzpicture}
1487 \end{tzcode}
1488
1489 \remark You can also use the coordinate |(tzRAvertex)| to place angle text wherever you want, after |\tzrightanglemark|.
1490
1491
1492
1493
1494 \subsection{\protect\cmd{\tzrightanglemark*}: Fill right angle marks}
1495 \label{ss:tzrightangle*}
1496
1497 The starred version \icmd{\tzrightanglemark*} fills the interior of right angle marks with |fill=black!50|, with |fill opacity=.3| and |text opacity=1|. It does not draw any line: |[draw=none]| by default. The filled mark is drawn on the |behind| layer by default, which can be changed by \icmd{\settzanglelayer}.
1498 Its alias is \icmd{\settzanglemarklayer}.
1499
1500 \begin{tzdef}
1501 % syntax: minimum
1502 \tzrightanglemark*(<coorA>)(<coorB>)(<coorC>)
1503 % syntax: full
1504 \tzrightanglemark*[<opt>](<coorA>)(<coorB>)(<coorC>)
1505 {<text>}[<node opt>](<size>){<fill opacity>}
1506 % defaults
1507 *[draw=none,very thin,fill=black!50,fill opacity=.3,text opacity=1]
1508 (<m>)(<m>)(<m>){}[](5pt){.3}
1509 \end{tzdef}
1510
1511 With \icmd{\settzfillcolor} and \icmd{\settzfillopacity}, you can also change the default fill color and fill opacity.
1512
1513
1514 \begin{tzcode}{.3}
1515 % \rightanglemark*
1516 \begin{tikzpicture}[scale=.8,font=\scriptsize]
1517 \tzhelplines(5,5)
1518 \tzcoorsquick(0,5)(A)(4,0)(B)(0,1)(C)(5,5)(D);
1519 \tzline"AB"(A)(B)
1520 \tzline"CD"(C)(D)
1521 \tzXpoint{AB}{CD}(E)
1522 \tzrightanglemark*(A)(E)(D){90\textdegree}
1523 \tzrightanglemark*[red](A)(E)(C)(20pt)
1524 \tzrightanglemark*[draw=blue,fill=green](B)(E)(C)(20pt)
1525 \end{tikzpicture}
1526 \end{tzcode}
1527
1528
1529 \begin{tzcode}{.3}
1530 % \settzRAsize
1531 \begin{tikzpicture}[scale=.8,font=\scriptsize]
1532 \tzhelplines(5,5)
1533 \tzcoorsquick(0,5)(A)(4,0)(B)(0,1)(C)(5,5)(D);
1534 \tzline[dotted]"AB"(A)(B)
1535 \tzline[dotted]"CD"(C)(D)
1536 \tzXpoint{AB}{CD}(E)
1537 \settzRAsize{20pt} %%
1538 \tzrightanglemark*[red](A)(E)(D){$\rho$}[pos=1.3]
1539 \tzrightanglemark[blue,thin](A)(E)(D)
1540 \tzrightanglemark*[draw=blue,thin,fill=green](B)(E)(C)
1541 \end{tikzpicture}
1542 \end{tzcode}
1543
1544
1545 \section{\protect\cmd{\tzdistance}: Distances and changes}
1546 \label{s:tzdistance}
1547
1548 \icmd{\tzdistance}|(<coor1>)(<coor2>){<\mylength>}| calculates the Cartesian distance \xem{from} |(<coor1>)| \xem{to} |(<coor2>)| and stores the (absolute) value to the user-specified macro |\mylength| in centimeters.
1549 And |\tzdistance| also stores the changes in |x| and |y| to |{<\Deltax>}| and |{<\Deltay>}|, respectively.
1550 Note that the calculated distance is \xem{approximate}.
1551
1552 \begin{tzdef}
1553 % syntax: minimum
1554 \tzdistance(<coorA>)(<coorB>){<\mylength>}
1555 % syntax: full
1556 \tzdistance(<coorA>)(<coorB>){<\mylength>}{<\Deltax>}{<\Deltay>}
1557 % defaults:
1558 (<m>)(<m>){<m>}{}{}
1559 \end{tzdef}
1560
1561 \begin{tzcode}{.3}
1562 % \tzdistance
1563 \begin{tikzpicture}
1564 \tzhelplines(4,3)
1565 \tzcoors*(0,0)(A)(4,0)(B)(0,3)(C);
1566 \tzdistance(A)(B){\lenA}
1567 \tzdistance(B)(C){\lenB}
1568 \tzpolygon(A){\lenA}[b](B){\lenB}[sloped,a](C);
1569 \end{tikzpicture}
1570 \end{tzcode}
1571
1572 \begin{tzcode}{.3}
1573 % \tzdistance, \tzpointangle
1574 \begin{tikzpicture}
1575 \tzhelplines(4,3)
1576 \tzcoors*(1,0)(A){A}[180](3,1)(B){B}[0];
1577 \tzdistance(A)(B){\lenA}{\xdist}{\ydist}
1578 \tzpointangle(A)(B){\angA}
1579 \tzline[red](A)(B)
1580 \tzarc[blue](A)(\angA:90:\lenA)
1581 \tzline+[<->]<0,-.5>(A)(\xdist,0)
1582 \tzline+[<->]<1,0>(A-|B)(0,\ydist)
1583 \end{tikzpicture}
1584 \end{tzcode}
1585
1586 \begin{tzcode}{.3}
1587 % \Deltax: (+), \Deltay: (-)
1588 \begin{tikzpicture}
1589 \tzhelplines(4,3)
1590 \tzcoors*(1,2)(A){A}[180](3,1)(B){B}[0];
1591 \tzdistance(A)(B){\lenA}{\xdist}{\ydist} % A to B
1592 \tzpointangle(A)(B){\angA}
1593 \tzline[red](A)(B)
1594 \tzarc[->,blue](A)(\angA:90:\lenA)
1595 \tzline+[|->|]<0,-.5>(A|-B)
1596 {$\Delta\,x=\xdist$}[b]
1597 (\xdist,0)
1598 \tzline+[|->|]<-1,0>(A)(0,\ydist)
1599 \end{tikzpicture}
1600 \end{tzcode}
1601
1602
1603 \begin{tzcode}{.3}
1604 % \Deltax: (-), \Deltay: (+)
1605 \begin{tikzpicture}
1606 \tzhelplines(4,3)
1607 \tzcoors*(1,2)(A){A}[180](3,1)(B){B}[0];
1608 \tzdistance(B)(A){\lenA}{\xdist}{\ydist} % B to A
1609 \tzpointangle(B)(A){\angA}
1610 \tzline[red](B)(A)
1611 \tzarc'[->,blue](A)(\angA-180:90:\lenA)
1612 \tzline+[|->|]<0,-.5>(B)
1613 {$\Delta\,x=\xdist$}[b]
1614 (\xdist,0)
1615 \tzline+[|->|]<-1,0>(B-|A)(0,\ydist)
1616 \end{tikzpicture}
1617 \end{tzcode}
1618
1619