| 1 |
% tkz-obj-eu-draw-circles.tex |
| 2 |
% Copyright 2011-2026 Alain Matthes |
| 3 |
% SPDX-License-Identifier: LPPL-1.3c |
| 4 |
% Maintainer: Alain Matthes |
| 5 |
|
| 6 |
\typeout{2026/01/25 5.13c tkz-obj-eu-draw-circles.tex} |
| 7 |
\makeatletter |
| 8 |
%<--------------------------------------------------------------------------–> |
| 9 |
% tkzSetUpCircle |
| 10 |
%<--------------------------------------------------------------------------–> |
| 11 |
\pgfkeys{% |
| 12 |
/tkzsetupcirc/.cd, |
| 13 |
color/.code = \def\tkz@circle@color{#1}, |
| 14 |
line width/.code = \def\tkz@circle@linewidth{#1}, |
| 15 |
style/.code = \def\tkz@circle@style{#1}, |
| 16 |
/tkzsetupcirc/.search also = {/tikz} |
| 17 |
} |
| 18 |
%<--------------------------------------------------------------------------–> |
| 19 |
|
| 20 |
\def\tkzSetUpCircle{\pgfutil@ifnextchar[{\tkz@SetUpCircle}{\tkz@SetUpCircle[]}} |
| 21 |
\def\tkz@SetUpCircle[#1]{% |
| 22 |
\pgfkeys{% |
| 23 |
tkzsetupcirc/.cd, |
| 24 |
line width = \tkz@euc@circlelw, |
| 25 |
color = \tkz@euc@circlecolor, |
| 26 |
style = \tkz@euc@circlestyle |
| 27 |
} |
| 28 |
\pgfqkeys{/tkzsetupcirc}{#1} |
| 29 |
\tikzset{% |
| 30 |
circle style/.append style = { % |
| 31 |
color = \tkz@circle@color, |
| 32 |
line width = \tkz@circle@linewidth, |
| 33 |
style = \tkz@circle@style, |
| 34 |
#1} |
| 35 |
} |
| 36 |
}% end setup |
| 37 |
%<--------------------------------------------------------------------------–> |
| 38 |
|
| 39 |
\def\tkzDrawCircle{\pgfutil@ifnextchar[{\tkz@DrawCircle}{\tkz@DrawCircle[]}} |
| 40 |
\def\tkz@DrawCircle[#1](#2,#3){% |
| 41 |
\begingroup |
| 42 |
\node [draw,circle through=(#3), circle style,#1] at (#2) {}; |
| 43 |
%perhaps I need to use the last method |
| 44 |
% \tkzCalcLength(#2,#3) \tkzGetLength{tkz@ncradius} |
| 45 |
% \draw[circle style,#1](#2) circle (\tkz@ncradius); |
| 46 |
\endgroup |
| 47 |
} |
| 48 |
%<--------------------------------------------------------------------------–> |
| 49 |
\def\tkz@multicircles#1 #2\@nil{% |
| 50 |
\protected@edef\tkz@temp{ |
| 51 |
\noexpand \tkzDrawCircle[\tkz@optcircle](#1)}\tkz@temp% |
| 52 |
\def\tkz@nextArg{#2}% |
| 53 |
\ifx\tkzutil@empty\tkz@nextArg |
| 54 |
\let\next\@gobble |
| 55 |
\fi |
| 56 |
\next#2\@nil |
| 57 |
}% |
| 58 |
%<--------------------------------------------------------------------------–> |
| 59 |
\def\tkzDrawCircles{\pgfutil@ifnextchar[{\tkz@DrawCircles}{\tkz@DrawCircles[]}} |
| 60 |
\def\tkz@DrawCircles[#1](#2){% |
| 61 |
\xdef\tkz@optcircle{#1} |
| 62 |
\begingroup |
| 63 |
\let\next\tkz@multicircles |
| 64 |
\next#2 \@nil % |
| 65 |
\endgroup |
| 66 |
}% |
| 67 |
%<--------------------------------------------------------------------------–> |
| 68 |
% #2 #3 rayon |
| 69 |
|
| 70 |
\def\tkzDrawSemiCircle{\pgfutil@ifnextchar[{\tkz@DrawSemiCircle}{% |
| 71 |
\tkz@DrawSemiCircle[]}} |
| 72 |
\def\tkz@DrawSemiCircle[#1](#2,#3){% |
| 73 |
\begingroup |
| 74 |
\pgfpointdiff{\pgfpointanchor{#2}{center}}% |
| 75 |
{\pgfpointanchor{#3}{center}}% |
| 76 |
\tkz@ax=\pgf@x% |
| 77 |
\tkz@ay=\pgf@y% |
| 78 |
\path(#2)--++(-\tkz@ax,-\tkz@ay) coordinate (tkz@pt); |
| 79 |
\tkzDrawArc[#1,delta=0](#2,#3)(tkz@pt) |
| 80 |
\endgroup |
| 81 |
}% |
| 82 |
%<--------------------------------------------------------------------------–> |
| 83 |
\def\tkz@multisemicircles#1 #2\@nil{% |
| 84 |
\protected@edef\tkz@temp{ |
| 85 |
\noexpand \tkzDrawSemiCircle[\tkz@optsemicircle](#1)}\tkz@temp% |
| 86 |
\def\tkz@nextArg{#2}% |
| 87 |
\ifx\tkzutil@empty\tkz@nextArg |
| 88 |
\let\next\@gobble |
| 89 |
\fi |
| 90 |
\next#2\@nil |
| 91 |
}% |
| 92 |
%<--------------------------------------------------------------------------–> |
| 93 |
\def\tkzDrawSemiCircles{\pgfutil@ifnextchar[{\tkz@DrawSemiCircles}{% |
| 94 |
\tkz@DrawSemiCircles[]}} |
| 95 |
\def\tkz@DrawSemiCircles[#1](#2){% |
| 96 |
\xdef\tkz@optsemicircle{#1} |
| 97 |
\begingroup |
| 98 |
\let\next\tkz@multisemicircles |
| 99 |
\next#2 \@nil % |
| 100 |
\endgroup |
| 101 |
}% |
| 102 |
%<---------------------------- Fill Circle --------------------------------–> |
| 103 |
\def\tkzFillCircle{\pgfutil@ifnextchar[{\tkz@FillCircle}{\tkz@FillCircle[]}} |
| 104 |
\def\tkz@FillCircle[#1](#2,#3){% |
| 105 |
\begingroup |
| 106 |
\node [fill,circle through=(#3),#1] at (#2) {}; |
| 107 |
\endgroup |
| 108 |
}% |
| 109 |
\def\tkz@multifillcircles#1 #2\@nil{% |
| 110 |
\protected@edef\tkz@temp{ |
| 111 |
\noexpand \tkzFillCircle[\tkz@optfillcircle](#1)}\tkz@temp% |
| 112 |
\def\tkz@nextArg{#2}% |
| 113 |
\ifx\tkzutil@empty\tkz@nextArg |
| 114 |
\let\next\@gobble |
| 115 |
\fi |
| 116 |
\next#2\@nil |
| 117 |
}% |
| 118 |
\def\tkzFillCircles{\pgfutil@ifnextchar[{\tkz@FillCircles}{% |
| 119 |
\tkz@FillCircles[]}} |
| 120 |
\def\tkz@FillCircles[#1](#2){% |
| 121 |
\xdef\tkz@optfillcircle{#1} |
| 122 |
\begingroup |
| 123 |
\let\next\tkz@multifillcircles |
| 124 |
\next#2 \@nil % |
| 125 |
\endgroup |
| 126 |
}% |
| 127 |
|
| 128 |
%<--------------------------- Clip Circle ---------------------------------–> |
| 129 |
\pgfkeys{/tkzclipc/.cd, |
| 130 |
out code/.is if = tkzClipOutCircle, |
| 131 |
out/.code = \tkzClipOutCirclefalse |
| 132 |
}% |
| 133 |
%<--------------------------------------------------------------------------–> |
| 134 |
\def\tkzClipCircle{\pgfutil@ifnextchar[{\tkz@ClipCircle}{\tkz@ClipCircle[]}} |
| 135 |
\def\tkz@ClipCircle[#1](#2,#3){% |
| 136 |
\tkzClipOutCircletrue |
| 137 |
\pgfqkeys{/tkzclipc}{#1} |
| 138 |
\tkz@@CalcLength(#2,#3){tkzLengthResult} |
| 139 |
\iftkzClipOutCircle |
| 140 |
\clip (#2) circle (\tkzLengthResult pt); |
| 141 |
\else |
| 142 |
\clip (#2) circle (\tkzLengthResult pt) [tkzreverseclip] ; |
| 143 |
\fi |
| 144 |
} |
| 145 |
%<--------------------------- Label Circle --------------------------------–> |
| 146 |
\def\tkzLabelCircle{\pgfutil@ifnextchar[{\tkz@LabelCircle}{% |
| 147 |
\tkz@LabelCircle[]}} |
| 148 |
% [option] (#2,#3) #2 center #3 un point du cercle #4 angle #5 the label |
| 149 |
\def\tkz@LabelCircle[#1](#2,#3)(#4)#5{% |
| 150 |
\begingroup |
| 151 |
\tkzURotateAngle(#2,#4)(#3) |
| 152 |
\node[label style,#1] at (tkzPointResult) {#5}; |
| 153 |
\endgroup |
| 154 |
} |
| 155 |
\makeatother |
| 156 |
\endinput |