summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/tkz-euclide/tkz-draw-eu-compass.tex
blob: aeb9341da2597fa18bcab8d19abedbf4f46871d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
% tkz-obj-eu-compass.tex
% Copyright 2024  Alain Matthesz
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
% This work has the LPPL maintenance status “maintained”.
% The Current Maintainer of this work is Alain Matthes.

\def\fileversion{5.06c}
\def\filedate{2024/02/04} 
\typeout{2024/02/04 5.06c tkz-obj-eu-compass.tex}  
\makeatletter
%<--------------------------------------------------------------------------–>
%  Author Alain Matthes  
%   idea from Y. Combe   
%<--------------------------------------------------------------------------–>
%<--------------------------------------------------------------------------–>
%                Utilisation du Compas : Compass   
%<--------------------------------------------------------------------------–>
%                                Setup   Compass
%<--------------------------------------------------------------------------–>
\pgfkeys{tkzsucompass/.cd,
  line width/.store in          =   \tkz@compass@lw,
  color/.store in               =   \tkz@compass@color,
  style/.store in               =   \tkz@compass@style,
  line width                    =   \tkz@euc@compasswidth,
  color                         =   \tkz@euc@compasscolor,
  style                         =   \tkz@euc@compassstyle,
   /tkzsucompass/.search also   =   {/tikz,/tkzcompass}
  } 
%<--------------------------------------------------------------------------–>
\def\tkzSetUpCompass{\pgfutil@ifnextchar[{\tkz@SetUpCompass}{\tkz@SetUpCompass[]}}
%<--------------------------------------------------------------------------–>
\def\tkz@SetUpCompass[#1]{% 
\pgfqkeys{/tkzsucompass}{#1}
\tikzset{compass style/.style={%
    color       = \tkz@compass@color,
    line width  = \tkz@compass@lw,
    style       = \tkz@compass@style
                            }}
}
%<--------------------------------------------------------------------------–> 
%                \tkzCompass(A, B)
%
% Marque de compas auto-ajustée en longueur
%               #2 center #3 le point
% Par défaut: 
%                 longueur : 1cm, mais avec un maximum d'un angle de 180°
%                 angle calculé pour la longueur
%                 style traits pleins

%<--------------------------------------------------------------------------–> 
 \pgfkeys{/tkzcompass/.cd,
    delta/.store in      = \tkz@delta,
    length/.store in     = \tkz@length,
    length = 1,
    delta  = 0,
    /tkzcompass/.unknown/.code   = {\let\searchname=\pgfkeyscurrentname
    \pgfkeysalso{\searchname/.try=#1, /tikz/\searchname/.retry=#1}}
}
                                        
\def\tkzCompass{\pgfutil@ifnextchar[{\tkz@Compass}{\tkz@Compass[]}}
\def\tkz@Compass[#1](#2,#3){%   
\begingroup
\pgfkeys{tkzcompass/.cd,#1}  
\tkz@@CalcLength(#2,#3){tkz@tempLen}  
\ifnum\tkz@delta=0 %
   \pgfmathsetmacro{\tkz@delta}{min(deg(\tkz@length cm/ \tkz@tempLen pt),180)/2}
\fi 
\tkzFindSlopeAngle(#2,#3)\tkzGetAngle{tkz@angle}%
\draw[shift ={(#2)},compass style,/tkzcompass/.cd,#1]%
    (\tkz@angle-\tkz@delta:\tkz@tempLen pt)%
  arc (\tkz@angle-\tkz@delta:\tkz@angle+\tkz@delta:\tkz@tempLen pt);
\endgroup}
%<--------------------------------------------------------------------------–> 
\def\tkz@multiCompass#1 #2\@nil{% 
 \protected@edef\tkz@temp{
   \noexpand \tkzCompass[\tkz@optcompass](#1)}\tkz@temp% 
   \def\tkz@nextArg{#2}%
   \ifx\tkzutil@empty\tkz@nextArg
     \let\next\@gobble
   \fi
   \next#2\@nil
}
\def\tkzCompasss{\pgfutil@ifnextchar[{\tkz@Compasss}{\tkz@Compasss[]}}   

\def\tkz@Compasss[#1](#2){%
\global\edef\tkz@optcompass{#1} 
\begingroup
   \let\next\tkz@multiCompass
   \next#2 \@nil %    
\endgroup
}%

\makeatother
\endinput