% tkz-tool-eu-angles.tex
% Copyright 2011-2026  Alain Matthes
% 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.11c}
\def\filedate{2026/01/22} 
\typeout{2026/01/22 5.12c tkz-tool-eu-angles.tex} 
\makeatletter
%<--------------------------------------------------------------------------->
%       Mark an angle modi 3.03 suppression de \tkz@mksize,
%<--------------------------------------------------------------------------->
%                \tkzMarkAngle(B, A, C)
%
% Marque d'angle
% arc de cercle (simple/double/triple) et marque d'églité.
%
% Par défaut: 
%                 arc       = simple
%                 size     = 1 (rayon de l'arc)
%                 style traits pleins
%                 mkpos ?  position: 0.5 (position de la marque)
%                 mark rien du tout (ignoré si type est utilisé)
%
% Paramètres (optionnels)
%             arc     : l, ll, lll
%             mksize  : 1
%             gap     : 3pt
%             dist ?
%             style   : type de traits
%             position: 0.5
%             mark    : none  , |, ||,|||, z, s, x, o, oo mais tous les 
%  % symboles de tikz sont permis
%<------------------------- Label on angle -------------------------------->
\def\tkz@arcsimple{l} 
\def\tkz@arcdouble{ll}
\def\tkz@arctriple{lll} 

%\tikzset{lbstyle/.style = {color=\tkz@mainlinecolor}}

\pgfkeys{/tkzmkangle/.cd,
      arc/.code               = \def\tkz@arc{#1},
      size/.code              = \def\tkz@size{#1},
      mark/.code              = \def\tkz@markang{#1},
      mkpos/.code             = \def\tkz@mkpos{#1},
      mksize/.code            = \def\tkz@mksize{#1},
      mkcolor/.code           = \def\tkz@mkcolor{#1},
      arc                     = l,
      size                    = 1,
      mark                    = none,
      mksize                  = 4pt,
      mkcolor                 = black,
      mkpos                   = 0.5,
  /tkzmkangle/.search also={/tikz}   
} 
% utils

%-----------------------------------------------------------------------

\def\tkzMarkAngle{\pgfutil@ifnextchar[{\tkz@MarkAngle}{\tkz@MarkAngle[]}}   
\def\tkz@MarkAngle[#1](#2,#3,#4){%
\begingroup
\pgfqkeys{/tkzmkangle}{#1}
\tkzFindSlopeAngle(#3,#2)\tkzGetAngle{tkz@dirOne}
\tkzFindSlopeAngle(#3,#4)\tkzGetAngle{tkz@dirTwo}
\tkzNormalizeAngle(\tkz@dirOne,\tkz@dirTwo)

\def\tkz@mymark{\pgfsetplotmarksize{\tkz@mksize}\pgfuseplotmark{\tkz@markang}}
% draw the arcs
\begin{scope}[veclen]
  \begin{scope}[decoration = {markings, mark=at position \tkz@mkpos with {\tkz@mymark}}]
    \ifx\tkz@arc\tkz@arcsimple
      \tkzDrawArcRAN[#1,fill=none]%
      (#3,\tkz@size)(\tkz@FirstAngle,\tkz@SecondAngle)%
      \tkzPathArcRAN[\tkz@mkcolor,postaction={decorate}]%
      (#3,\tkz@size)(\tkz@FirstAngle,\tkz@SecondAngle)
    \else
      \ifx\tkz@arc\tkz@arcdouble     
       \tkzDrawArcRAN[#1,fill=none](#3,\tkz@size cm-2.5\pgflinewidth)%
              (\tkz@FirstAngle,\tkz@SecondAngle) 
       \tkzPathArcRAN[\tkz@mkcolor,postaction={decorate}]%
             (#3,\tkz@size)(\tkz@FirstAngle,\tkz@SecondAngle)%
       \tkzDrawArcRAN[#1,fill=none](#3,\tkz@size cm+2.5\pgflinewidth)%
                       (\tkz@FirstAngle,\tkz@SecondAngle)% 
      \else 
         \ifx\tkz@arc\tkz@arctriple
            \tkzDrawArcRAN[#1,fill=none]%
            (#3,\tkz@size)(\tkz@FirstAngle,\tkz@SecondAngle)% 
            \tkzPathArcRAN[\tkz@mkcolor,postaction={decorate}]%
            (#3,\tkz@size)(\tkz@FirstAngle,\tkz@SecondAngle)%             
            \tkzDrawArcRAN[#1,fill=none](#3,\tkz@size cm-2.5\pgflinewidth)%
                      (\tkz@FirstAngle,\tkz@SecondAngle)%
            \tkzDrawArcRAN[#1,fill=none](#3,\tkz@size cm+2.5\pgflinewidth)%
                      (\tkz@FirstAngle,\tkz@SecondAngle)%   
         \fi
       \fi
    \fi
  \end{scope}
\end{scope}

\endgroup
}
%<--------------------------------------------------------------------------->
% multiple
\def\tkz@multiMA#1 #2\@nil{%
 \protected@edef\tkz@temp{
   \noexpand \tkzMarkAngle[\tkz@optma](#1)}\tkz@temp%    
   \def\tkz@nextArg{#2}%
   \ifx\tkzutil@empty\tkz@nextArg
     \let\next\@gobble
   \fi
   \next#2\@nil
}
%<--------------------------------------------------------------------------->
\def\tkzMarkAngles{\pgfutil@ifnextchar[{\tkz@MarkAngles}{\tkz@MarkAngles[]}}   
\def\tkz@MarkAngles[#1](#2){% 
\xdef\tkz@optma{#1} 
  \begingroup
   \let\next\tkz@multiMA
   \next#2 \@nil %    
\endgroup 
} 
% fin de \tkzMarkAngle
%<--------------------------------------------------------------------------->
%                        Pic Angle
%<--------------------------------------------------------------------------->
\def\tkzPicAngle{\pgfutil@ifnextchar[{\tkz@PicAngle}{\tkz@PicAngle[]}}   
\def\tkz@PicAngle[#1](#2,#3,#4){% 
\begingroup  
\draw pic [#1]{angle=#2--#3--#4};
\endgroup 
}
\def\tkzPicRightAngle{\pgfutil@ifnextchar[{\tkz@PicRightAngle}{\tkz@PicRightAngle[]}}   
\def\tkz@PicRightAngle[#1](#2,#3,#4){% 
\begingroup  
\draw pic [#1]{right angle=#2--#3--#4};
\endgroup 
}
%<--------------------------------------------------------------------------->
%                        FillAngle
%<--------------------------------------------------------------------------->
\pgfkeys{/tkzFill/.cd,
    size/.store in        = \tkz@size,
    size                  = 1,
    /tkzFill/.search also = {/tikz}
  } 

\def\tkzFillAngle{\pgfutil@ifnextchar[{\tkz@FillAngle}{\tkz@FillAngle[]}}   
\def\tkz@FillAngle[#1](#2,#3,#4){% 
\begingroup
\pgfqkeys{/tkzFill}{#1}   
  \tkzFindSlopeAngle(#3,#2)\tkzGetAngle{tkz@dirOne}   
  \tkzFindSlopeAngle(#3,#4)\tkzGetAngle{tkz@dirTwo}   
  \tkzNormalizeAngle(\tkz@dirOne,\tkz@dirTwo)
    \path[shift  = {(#3)},fill=\tkz@euc@linecolor!10,/tkzFill/.cd,#1]%
          (#3) -- (\tkz@FirstAngle:\tkz@size) arc%
          (\tkz@FirstAngle:\tkz@SecondAngle:\tkz@size)--cycle;
\endgroup 
}
%<--------------------------------------------------------------------------->
% multiple
\def\tkz@multiFA#1 #2\@nil{\protected@edef\tkz@temp{%
   \noexpand \tkzFillAngle[\tkz@optfa](#1)}%
   \tkz@temp%    
   \def\tkz@nextArg{#2}%
   \ifx\tkzutil@empty\tkz@nextArg
     \let\next\@gobble
   \fi
   \next#2\@nil
}
%<--------------------------------------------------------------------------->
\def\tkzFillAngles{\pgfutil@ifnextchar[{\tkz@MFillAngles}{\tkz@MFillAngles[]}}   
\def\tkz@MFillAngles[#1](#2){% 
\xdef\tkz@optfa{#1} 
\begingroup
   \let\next\tkz@multiFA
   \next#2 \@nil %    
\endgroup 
} 
%<------------------------- Label on angle -------------------------------->
\pgfkeys{/tkzlabelangle/.cd,
    dist/.store in                  = \tkzlabeldist, 
    angle/.store in                 = \tkzlabelangle, 
    dist                            = 1,
    angle                           = {},
  /tkzlabelangle/.search also={/tikz}   
}  
\def\tkzLabelAngle{\pgfutil@ifnextchar[{\tkz@LabelAngle}{\tkz@LabelAngle[]}}
\def\tkz@LabelAngle[#1](#2,#3,#4)#5{%2016 added normalize from karu's code
\begingroup
  \pgfqkeys{/tkzlabelangle}{#1}
  \ifx\tkzutil@empty\tkzlabelangle% no value so calc angle of bisector
      \tkzFindSlopeAngle(#3,#2)\tkzGetAngle{tkz@dirOne}
      \tkzFindSlopeAngle(#3,#4)\tkzGetAngle{tkz@dirTwo}
      \tkzNormalizeAngle(\tkz@dirOne,\tkz@dirTwo)
      \edef\tkzlabelangle{\fpeval{(\tkz@SecondAngle+\tkz@FirstAngle)/2}}
  \fi
  \path  (#3) --+(\tkzlabelangle:\tkzlabeldist) node[label angle style,%
  /tkzlabelangle/.cd,#1] {#5};
\endgroup
}
%<--------------------------------------------------------------------------->
%<--------------------------------------------------------------------------->
% multiple labels
\def\tkz@multiLBA#1 #2\@nil{%
 \protected@edef\tkz@temp{
   \noexpand \tkzLabelAngle[\tkz@optlba](#1){\tkz@labelangle}}\tkz@temp%
   \def\tkz@nextArg{#2}%
   \ifx\tkzutil@empty\tkz@nextArg
     \let\next\@gobble
   \fi
   \next#2\@nil
}
% %<---------------------------------------------------------------------
\def\tkzLabelAngles{\pgfutil@ifnextchar[{\tkz@LabelAngles}{%
                                         \tkz@LabelAngles[]}}
\def\tkz@LabelAngles[#1](#2)#3{% 
 \def\tkz@optlba{#1}
 \def\tkz@labelangle{#3} 
   \begingroup
      \let\next\tkz@multiLBA
      \next#2 \@nil %
 \endgroup
}
%<-----------------------------------------------------------------------
%                     Symbole droites perpendiculaires      
%<---------------------------------------------------------------------- 
\pgfkeys{/tkzrightangle/.cd,
         norm tkz code/.is if            = normtkzcode@execute,
         german/.code                    = \normtkzcode@executefalse,
         size/.store in                  = \tkz@ra@size,
         dotsize/.store in               = \tkz@dotsize,
         size                            = .25,
         dotsize                         = 3 pt,
  /tkzrightangle/.search also={/tikz},
}
\newcommand*{\tkzMarkRightAngle}[1][]{\tkz@MarkRightAngle[#1]}
\def\tkz@MarkRightAngle[#1](#2,#3,#4){% 
\begingroup
\normtkzcode@executetrue
\pgfqkeys{/tkzrightangle}{#1} 
    \tkzpointnormalised{\pgfpointdiff{\pgfpointanchor{#3}{center}}{%
                                      \pgfpointanchor{#2}{center}}}
    \tkz@ax=\pgf@x\relax%
    \tkz@ay=\pgf@y\relax%
    \tkzpointnormalised{\pgfpointdiff{\pgfpointanchor{#3}{center}}{%
                                      \pgfpointanchor{#4}{center}}}
    \tkz@bx=\pgf@x\relax%
    \tkz@by=\pgf@y\relax%
  \ifnormtkzcode@execute%
      \draw[/tkzrightangle/.cd,#1]
    (#3) --++( 28.45274*\tkz@ra@size\tkz@ax , 28.45274*\tkz@ra@size\tkz@ay)
         --++( 28.45274*\tkz@ra@size\tkz@bx , 28.45274*\tkz@ra@size\tkz@by)
         --++(-28.45274*\tkz@ra@size\tkz@ax ,-28.45274*\tkz@ra@size\tkz@ay)
         -- (#3);
  \else%
    % find angles
      \tkzFindSlopeAngle(#3,#2)\tkzGetAngle{tkz@dirOne}
      \tkzFindSlopeAngle(#3,#4)\tkzGetAngle{tkz@dirTwo}
      \tkzNormalizeAngle(\tkz@dirOne,\tkz@dirTwo)
      \edef\tkzCircleAngle{\fpeval{(\tkz@SecondAngle+\tkz@FirstAngle)/2}}
      \tkzDrawArcRAN[/tkzrightangle/.cd,#1](#3,\tkz@ra@size)%
            (\tkz@FirstAngle,\tkz@SecondAngle)
      \path (#3) --+ (\tkzCircleAngle:\tkz@ra@size/2)
      node[fill,circle,minimum size=\tkz@dotsize,
           inner sep=0 pt,/tkzrightangle/.cd,#1] {};
\fi%
\endgroup
}
%<--------------------------------------------------------------------------->
\def\tkz@multiRA#1 #2\@nil{% 
\protected@edef\tkz@temp{
  \noexpand \tkzMarkRightAngle[\tkz@optRA](#1)}\tkz@temp% 
\def\tkz@nextArg{#2}%
   \ifx\tkzutil@empty\tkz@nextArg
      \let\next\@gobble
   \fi
\next#2\@nil
}
%<--------------------------------------------------------------------------->
\def\tkzMarkRightAngles{\pgfutil@ifnextchar[{\tkz@RightAngles}{%
                                         \tkz@RightAngles[]}} 
\def\tkz@RightAngles[#1](#2){% 
\xdef\tkz@optRA{#1} 
\begingroup
    \let\next\tkz@multiRA
    \next#2 \@nil %    
\endgroup 
}    
%<--------------------------------------------------------------------------->
\makeatother

\endinput