Debian Codegraph @

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

raw
1 \subsection{Coloring a disc}
2 This was possible with the macro \tkzcname{tkzDrawCircle}, but disk tracing was mandatory, this is no longer the case.
3
4 \begin{NewMacroBox}{tkzFillCircle}{\oarg{local options}\parg{A,B}}%
5 \begin{tabular}{lll}%
6 options & default & definition \\
7 \midrule
8 \TOline{radius} {radius}{two points define a radius}
9 \TOline{R} {radius}{a point and the measurement of a radius }
10 \bottomrule
11 \end{tabular}
12
13 \medskip
14 You don't need to put \tkzname{radius} because that's the default option. Of course, you have to add all the styles of \TIKZ\ for the plots.
15 \end{NewMacroBox}
16
17
18 \subsubsection{Yin and Yang}
19 \begin{tkzexample}[latex=8cm,small]
20 \begin{tikzpicture}[scale=.75]
21 \tkzDefPoint(0,0){O}
22 \tkzDefPoint(-4,0){A}
23 \tkzDefPoint(4,0){B}
24 \tkzDefPoint(-2,0){I}
25 \tkzDefPoint(2,0){J}
26 \tkzDrawSector[fill=teal](O,A)(B)
27 \tkzFillCircle[fill=white](J,B)
28 \tkzFillCircle[fill=teal](I,A)
29 \tkzDrawCircle(O,A)
30 \end{tikzpicture}
31 \end{tkzexample}
32
33
34 \subsubsection{From a sangaku}
35
36 \begin{tkzexample}[latex=7cm,small]
37 \begin{tikzpicture}
38 \tkzDefPoint(0,0){B} \tkzDefPoint(6,0){C}%
39 \tkzDefSquare(B,C) \tkzGetPoints{D}{A}
40 \tkzClipPolygon(B,C,D,A)
41 \tkzDefMidPoint(A,D) \tkzGetPoint{F}
42 \tkzDefMidPoint(B,C) \tkzGetPoint{E}
43 \tkzDefMidPoint(B,D) \tkzGetPoint{Q}
44 \tkzDefLine[tangent from = B](F,A)
45 \tkzGetPoints{H}{G}
46 \tkzInterLL(F,G)(C,D) \tkzGetPoint{J}
47 \tkzInterLL(A,J)(F,E) \tkzGetPoint{K}
48 \tkzDefPointBy[projection=onto B--A](K)
49 \tkzGetPoint{M}
50 \tkzDrawPolygon(A,B,C,D)
51 \tkzFillCircle[red!20](E,B)
52 \tkzFillCircle[blue!20](M,A)
53 \tkzFillCircle[green!20](K,Q)
54 \tkzDrawCircles(B,A M,A E,B K,Q)
55 \end{tikzpicture}
56 \end{tkzexample}
57
58 \subsubsection{Clipping and filling part I}
59 \begin{tkzexample}[latex=7cm,small]
60 \begin{tikzpicture}
61 \tkzDefPoints{0/0/A,4/0/B,2/2/O,3/4/X,4/1/Y,1/0/Z,
62 0/3/W,3/0/R,4/3/S,1/4/T,0/1/U}
63 \tkzDefSquare(A,B)\tkzGetPoints{C}{D}
64 \tkzDefPointWith[colinear normed=at X,K=1](O,X)
65 \tkzGetPoint{F}
66 \begin{scope}
67 \tkzFillCircle[fill=teal!20](O,F)
68 \tkzFillPolygon[white](A,...,D)
69 \tkzClipPolygon(A,...,D)
70 \foreach \c/\t in {S/C,R/B,U/A,T/D}
71 {\tkzFillCircle[teal!20](\c,\t)}
72 \end{scope}
73 \foreach \c/\t in {X/C,Y/B,Z/A,W/D}
74 {\tkzFillCircle[white](\c,\t)}
75 \foreach \c/\t in {S/C,R/B,U/A,T/D}
76 {\tkzFillCircle[teal!20](\c,\t)}
77 \end{tikzpicture}
78 \end{tkzexample}
79
80 \subsubsection{Clipping and filling part II}
81 \begin{tkzexample}[latex=7cm, small]
82 \begin{tikzpicture}[scale=.75]
83 \tkzDefPoints{0/0/A,8/0/B,8/8/C,0/8/D}
84 \tkzDefMidPoint(A,B) \tkzGetPoint{F}
85 \tkzDefMidPoint(B,C) \tkzGetPoint{E}
86 \tkzDefMidPoint(D,B) \tkzGetPoint{I}
87 \tkzDefMidPoint(I,B) \tkzGetPoint{a}
88 \tkzInterLC(B,I)(B,C) \tkzGetSecondPoint{K}
89 \tkzDefMidPoint(I,K) \tkzGetPoint{b}
90 \begin{scope}
91 \tkzFillSector[fill=blue!10](B,C)(A)
92 \tkzDefMidPoint(A,B) \tkzGetPoint{x}
93 \tkzDrawSemiCircle[fill=white](x,B)
94 \tkzDefMidPoint(B,C) \tkzGetPoint{y}
95 \tkzDrawSemiCircle[fill=white](y,C)
96 \tkzClipCircle(E,B)
97 \tkzClipCircle(F,B)
98 \tkzFillCircle[fill=blue!10](B,A)
99 \end{scope}
100 \tkzDrawSemiCircle[thick](F,B)
101 \tkzDrawSemiCircle[thick](E,C)
102 \tkzDrawArc[thick](B,C)(A)
103 \tkzDrawSegments[thick](A,B B,C)
104 \tkzDrawPoints(A,B,C,E,F)
105 \tkzLabelPoints[centered](a,b)
106 \tkzLabelPoints(A,B,C,E,F)
107 \end{tikzpicture}
108 \end{tkzexample}
109
110 \subsubsection{Clipping and filling part III}
111
112 \begin{tkzexample}[latex=7cm, small]
113 \begin{tikzpicture}
114 \tkzDefPoint(0,0){A} \tkzDefPoint(1,0){B}
115 \tkzDefPoint(2,0){C} \tkzDefPoint(-3,0){a}
116 \tkzDefPoint(3,0){b} \tkzDefPoint(0,3){c}
117 \tkzDefPoint(0,-3){d}
118 \begin{scope}
119 \tkzClipPolygon(a,b,c,d)
120 \tkzFillCircle[teal!20](A,C)
121 \end{scope}
122 \tkzFillCircle[white](A,B)
123 \tkzDrawCircle[color=red](A,C)
124 \tkzDrawCircle[color=red](A,B)
125 \end{tikzpicture}
126 \end{tkzexample}
127
128 \subsection{Coloring a polygon}
129 \begin{NewMacroBox}{tkzFillPolygon}{\oarg{local options}\parg{points list}}%
130 You can color by drawing the polygon, but in this case you color the inside of the polygon without drawing it.
131
132 \medskip
133 \begin{tabular}{lll}%
134 \toprule
135 arguments & example & explanation \\
136 \midrule
137 \TAline{\parg{pt1,pt2,\dots}}{\parg{A,B,\dots}}{}
138 %\bottomrule
139 \end{tabular}
140 \end{NewMacroBox}
141
142 \subsubsection{\tkzcname{tkzFillPolygon}}
143 \begin{tkzexample}[latex=7cm, small]
144 \begin{tikzpicture}[scale=.5]
145 \tkzDefPoint(0,0){C} \tkzDefPoint(4,0){A}
146 \tkzDefPoint(0,3){B}
147 \tkzDefSquare(B,A) \tkzGetPoints{E}{F}
148 \tkzDefSquare(A,C) \tkzGetPoints{G}{H}
149 \tkzDefSquare(C,B) \tkzGetPoints{I}{J}
150 \tkzFillPolygon[color = orange!30 ](A,C,G,H)
151 \tkzFillPolygon[color = teal!40 ](C,B,I,J)
152 \tkzFillPolygon[color = purple!20](B,A,E,F)
153 \tkzDrawPolygon[line width = 1pt](A,B,C)
154 \tkzDrawPolygon[line width = 1pt](A,C,G,H)
155 \tkzDrawPolygon[line width = 1pt](C,B,I,J)
156 \tkzDrawPolygon[line width = 1pt](B,A,E,F)
157 \tkzLabelSegment[above](C,A){$a$}
158 \tkzLabelSegment[right](B,C){$b$}
159 \tkzLabelSegment[below left](B,A){$c$}
160 \end{tikzpicture}
161 \end{tkzexample}
162
163 \subsection{\tkzcname{tkzFillSector}}
164 \tkzHandBomb\ Attention the arguments vary according to the options.
165 \begin{NewMacroBox}{tkzFillSector}{\oarg{local options}\parg{O,\dots}\parg{\dots}}%
166 \begin{tabular}{lll}%
167 options & default & definition \\
168 \midrule
169 \TOline{towards}{towards}{$O$ is the center and the arc from $A$ to $(OB)$}
170 \TOline{rotate} {towards}{the arc starts from A and the angle determines its length }
171 \TOline{R}{towards}{We give the radius and two angles}
172 \TOline{R with nodes}{towards}{We give the radius and two points}
173 \bottomrule
174 \end{tabular}
175
176 \medskip
177 Of course, you have to add all the styles of \TIKZ\ for the tracings...
178
179 \medskip
180 \begin{tabular}{lll}%
181 \toprule
182 options & arguments & example \\
183 \midrule
184 \TOline{towards}{\parg{pt,pt}\parg{pt}}{\tkzcname{tkzFillSector(O,A)(B)}}
185 \TOline{rotate} {\parg{pt,pt}\parg{an}}{\tkzcname{tkzFillSector[rotate,color=red](O,A)(90)}}
186 \TOline{R}{\parg{pt,$r$}\parg{an,an}}{\tkzcname{tkzFillSector[R,color=blue](O,2)(30,90)}}
187 \TOline{R with nodes}{\parg{pt,$r$}\parg{pt,pt}}{\tkzcname{tkzFillSector[R with nodes](O,2)(A,B)}}
188 \end{tabular}
189 \end{NewMacroBox}
190
191 \subsubsection{\tkzcname{tkzFillSector} and \tkzname{towards}}
192 It is useless to put \tkzname{towards} and you will notice that the contours are not drawn, only the surface is colored.
193 \begin{tkzexample}[latex=5.75cm,small]
194 \begin{tikzpicture}[scale=.6]
195 \tkzDefPoint(0,0){O}
196 \tkzDefPoint(-30:3){A}
197 \tkzDefPointBy[rotation = center O angle -60](A)
198 \tkzFillSector[fill=purple!20](O,A)(tkzPointResult)
199 \begin{scope}[shift={(-60:1)}]
200 \tkzDefPoint(0,0){O}
201 \tkzDefPoint(-30:3){A}
202 \tkzDefPointBy[rotation = center O angle -60](A)
203 \tkzGetPoint{A'}
204 \tkzFillSector[color=teal!40](O,A')(A)
205 \end{scope}
206 \end{tikzpicture}
207 \end{tkzexample}
208
209
210 \subsubsection{\tkzcname{tkzFillSector} and \tkzname{rotate}}
211 \begin{tkzexample}[latex=5.75cm,small]
212 \begin{tikzpicture}[scale=1.5]
213 \tkzDefPoint(0,0){O} \tkzDefPoint(2,2){A}
214 \tkzFillSector[rotate,color=purple!20](O,A)(30)
215 \tkzFillSector[rotate,color=teal!40](O,A)(-30)
216 \end{tikzpicture}
217 \end{tkzexample}
218
219 \subsection{Colour an angle: \tkzcname{tkzFillAngle}}
220
221 The simplest operation
222 \begin{NewMacroBox}{tkzFillAngle}{\oarg{local options}\parg{A,O,B}}%
223 $O$ is the vertex of the angle. $OA$ and $OB$ are the sides. Attention the angle is determined by the order of the points.
224
225 \medskip
226
227 \begin{tabular}{lll}%
228 \toprule
229 options & default & definition \\
230 \midrule
231 \TOline{size}{1}{this option determines the radius of the coloured angular sector.}
232
233 \bottomrule
234 \end{tabular}
235
236 \medskip
237 Of course, you have to add all the styles of \TIKZ, like the use of fill and shade...
238 \end{NewMacroBox}
239
240 \subsubsection{Example with \tkzname{size}}
241 \begin{tkzexample}[latex=7cm,small]
242 \begin{tikzpicture}
243 \tkzInit
244 \tkzDefPoints{0/0/O,2.5/0/A,1.5/2/B}
245 \tkzFillAngle[size=2, fill=gray!10](A,O,B)
246 \tkzDrawLines(O,A O,B)
247 \tkzDrawPoints(O,A,B)
248 \end{tikzpicture}
249 \end{tkzexample}
250
251
252 \subsubsection{Changing the order of items}
253 \begin{tkzexample}[latex=7cm,small]
254 \begin{tikzpicture}
255 \tkzInit
256 \tkzDefPoints{0/0/O,2.5/0/A,1.5/2/B}
257 \tkzFillAngle[size=2,fill=gray!10](B,O,A)
258 \tkzDrawLines(O,A O,B)
259 \tkzDrawPoints(O,A,B)
260 \end{tikzpicture}
261 \end{tkzexample}
262
263 \begin{tkzexample}[latex=7cm,small]
264 \begin{tikzpicture}
265 \tkzInit
266 \tkzDefPoints{0/0/O,5/0/A,3/4/B}
267 % Don't forget {} to get, () to use
268 \tkzFillAngle[size=4,left color=white,
269 right color=red!50](A,O,B)
270 \tkzDrawLines(O,A O,B)
271 \tkzDrawPoints(O,A,B)
272 \end{tikzpicture}
273 \end{tkzexample}
274
275 \begin{NewMacroBox}{tkzFillAngles}{\oarg{local options}\parg{A,O,B}\parg{A',O',B'}etc.}%
276 With common options, there is a macro for multiple angles.
277 \end{NewMacroBox}
278
279 \subsubsection{Multiples angles}
280 \begin{tkzexample}[latex=5cm,small]
281 \begin{tikzpicture}[scale=0.5]
282 \tkzDefPoints{0/0/B,8/0/C,0/8/A,8/8/D}
283 \tkzDrawPolygon(B,C,D,A)
284 \tkzDefTriangle[equilateral](B,C) \tkzGetPoint{M}
285 \tkzInterLL(D,M)(A,B) \tkzGetPoint{N}
286 \tkzDefPointBy[rotation=center N angle -60](D)
287 \tkzGetPoint{L}
288 \tkzInterLL(N,L)(M,B) \tkzGetPoint{P}
289 \tkzInterLL(M,C)(D,L) \tkzGetPoint{Q}
290 \tkzDrawSegments(D,N N,L L,D B,M M,C)
291 \tkzDrawPoints(L,N,P,Q,M,A,D)
292 \tkzLabelPoints[left](N,P,Q)
293 \tkzLabelPoints[above](M,A,D)
294 \tkzLabelPoints(L,B,C)
295 \tkzMarkAngles(C,B,M B,M,C M,C,B D,L,N L,N,D N,D,L)
296 \tkzFillAngles[fill=red!20,opacity=.2](C,B,M%
297 B,M,C M,C,B D,L,N L,N,D N,D,L)
298 \end{tikzpicture}
299 \end{tkzexample}
300 \endinput