| 1 |
% tkz-obj-eu-protractor.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-protractor.tex} |
| 7 |
\makeatletter |
| 8 |
%<--------------------------------------------------------------------------–> |
| 9 |
% !!! idea from Y. Combe !!! |
| 10 |
%<--------------------------------------------------------------------------–> |
| 11 |
% \tkzProtractor Protractor |
| 12 |
% |
| 13 |
% Rapporteur ajustable et positionable |
| 14 |
% |
| 15 |
% Par défaut: |
| 16 |
% centre en (0,0) |
| 17 |
% rayon de 5 cm |
| 18 |
% ligne de base horizontale. |
| 19 |
% épaisseur de ligne 0.4 pt |
| 20 |
% |
| 21 |
% Paramètres (optionnels, gérés par xkeyval) |
| 22 |
% shift : coordonées (n'importe quelle forme |
| 23 |
% acceptée par tikz). |
| 24 |
% scale : facteur d'échelle |
| 25 |
% rotate : rotation |
| 26 |
% lw : line width (épaisseur des lignes) |
| 27 |
% ce paramètre subit le facteur d'échelle. |
| 28 |
%<--------------------------------------------------------------------------–> |
| 29 |
\def\FullProtractor{% |
| 30 |
\draw[fill=black!50!yellow!20!,even odd rule,semitransparent]% |
| 31 |
(0,0) circle (4cm); |
| 32 |
\draw (0,0) circle (3.3cm); |
| 33 |
\draw (0,0) circle (4cm); |
| 34 |
\draw[fill=black] (0,0) circle (.08mm); |
| 35 |
\node[draw, circle, inner sep=.2mm] (a) at (0,0) {}; |
| 36 |
\foreach \x in {0, 90, ..., 360}{% |
| 37 |
\draw[very thin, gray!40] (a) -- (\x:4cm);} |
| 38 |
\foreach \x in {0,...,359} {\draw (\x:3.8cm) -- (\x:4cm);} |
| 39 |
\foreach \x in {0,5,...,355} {\draw (\x:3.725cm) -- (\x:4cm);} |
| 40 |
\foreach \x in {0,10,...,350}{% |
| 41 |
\node[rotate=(\x-90)] at (\x:3.6cm) {\tiny\x}; |
| 42 |
} |
| 43 |
\draw [>=stealth',->, thick,black] (0:2.5) arc(0:32:2.5); |
| 44 |
\draw [>=stealth',->, thick,black] (0:2) arc(0:32:2); |
| 45 |
\draw [>=stealth',->, thick,black] (0:1.5) arc(0:32:1.5); |
| 46 |
} |
| 47 |
|
| 48 |
\def\FullProtractorReturn{% |
| 49 |
\draw[fill=black!50!yellow!20!,even odd rule,semitransparent] (0,0) circle (4cm); |
| 50 |
\draw (0,0) circle (3.3cm); |
| 51 |
\draw (0,0) circle (4cm); |
| 52 |
\draw[fill=black] (0,0) circle (.08mm); |
| 53 |
\node[draw, circle, inner sep=.2mm] (a) at (0,0) {}; |
| 54 |
\foreach \x in {0, 90, ..., 360}{% |
| 55 |
\draw[very thin, gray!40] (a) -- (\x:4cm);} |
| 56 |
\foreach \x in {0,...,359} {\draw (\x:3.8cm) -- (\x:4cm);} |
| 57 |
\foreach \x in {0,5,...,355} {\draw (\x:3.725cm) -- (\x:4cm);} |
| 58 |
\begin{scope} |
| 59 |
\foreach \x in {0,10,...,350}{% |
| 60 |
\node[rotate=(-\x-90)] at (-\x:3.6cm) {\tiny\x}; |
| 61 |
} |
| 62 |
\end{scope} |
| 63 |
\draw [>=stealth',->, thick,black] (0:2.5) arc(0:-32:2.5); |
| 64 |
\draw [>=stealth',->, thick,black] (0:2) arc(0:-32:2); |
| 65 |
\draw [>=stealth',->, thick,black] (0:1.5) arc(0:-32:1.5); |
| 66 |
} |
| 67 |
|
| 68 |
\pgfkeys{ |
| 69 |
protractor/.cd, |
| 70 |
lw/.code = {\def\cmdMO@Rap@lw{#1}}, |
| 71 |
shift/.code = {\def\cmdMO@Rap@shift{#1}}, |
| 72 |
rotate/.code = {\def\cmdMO@Rap@rotate{#1}}, |
| 73 |
scale/.code = {\def\cmdMO@Rap@scale{#1}}, |
| 74 |
return/.is if = tkz@RappReturn, |
| 75 |
return/.code = \tkz@RappReturnfalse, |
| 76 |
/protractor/.search also={/tikz}, |
| 77 |
lw = 0.4pt, |
| 78 |
scale=1, |
| 79 |
shift={(0,0)}, |
| 80 |
rotate=0 |
| 81 |
} |
| 82 |
|
| 83 |
\def\tkzProtractor{\pgfutil@ifnextchar[{\tkz@Protractor}{\tkz@Protractor[]}} |
| 84 |
\def\tkz@Protractor[#1](#2,#3){% |
| 85 |
\tkz@RappReturnfalse |
| 86 |
\pgfqkeys{/protractor}{#1} |
| 87 |
\tkz@@extractxy{#2} |
| 88 |
\global\tkz@ax\pgf@x |
| 89 |
\global\tkz@ay\pgf@y |
| 90 |
\tkzFindSlopeAngle(#2,#3) |
| 91 |
\tkzGetAngle{cmdMO@Rap@rotate}% |
| 92 |
\global\let\tkz@@Protractor\FullProtractor% |
| 93 |
\iftkz@RappReturn |
| 94 |
\global\let\tkz@@Protractor\FullProtractorReturn |
| 95 |
\else |
| 96 |
\global\let\tkz@@Protractor\FullProtractor |
| 97 |
\fi |
| 98 |
\pgfmathsetlengthmacro{\MO@lw}{\cmdMO@Rap@lw * \cmdMO@Rap@scale} |
| 99 |
\begin{scope}[shift = {(\tkz@ax,\tkz@ay)},% |
| 100 |
scale = \cmdMO@Rap@scale,% |
| 101 |
rotate = \cmdMO@Rap@rotate,% |
| 102 |
every node/.style = {scale =\cmdMO@Rap@scale, |
| 103 |
rotate =\cmdMO@Rap@rotate},% |
| 104 |
line width=\MO@lw]% |
| 105 |
\tkz@@Protractor |
| 106 |
\end{scope} |
| 107 |
} |
| 108 |
%<--------------------------------------------------------------------------–> |
| 109 |
% fin de \tkzProtractor |
| 110 |
%<--------------------------------------------------------------------------–> |
| 111 |
\makeatother |
| 112 |
\endinput |