%tkz-obj-eu-show.tex
% Copyright 2024  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.10c}
\def\filedate{2024/04/19} 
\typeout{2024/04/19 5.10c tkz-obj-eu-show.tex} 
\makeatletter  
%<--------------------------------------------------------------------------–>
% finding specific points in a triangle
%<--------------------------------------------------------------------------–>
%                            equi points
%<--------------------------------------------------------------------------–>
% draw  ? show ?   
\pgfkeys{/tkzEquiPt/.cd,
    from/.store in      = {\tkz@frompoint},
    dist/.store in      = {\tkz@equ@dist},
    show/.is if         = tkz@equi@show,
    dist                = 2,
    show                = false,
     /tkzEquiPt/.search also={/tikz}
}

\def\tkzDefEquiPoints{\pgfutil@ifnextchar[{\tkz@DefEquiPoints}{%
                                          \tkz@DefEquiPoints[]}}
\def\tkz@DefEquiPoints[#1](#2,#3){%
\pgfqkeys{/tkzEquiPt}{#1}
\begingroup
   \tkzUProjection(#2,#3)(\tkz@frompoint)
   \pgfnodealias{tkzEQpoint}{tkzPointResult}
   \tkzVecKNorm[\tkz@equ@dist](tkzEQpoint,#2)
   \pgfnodealias{tkzFirstPointResult}{tkzPointResult}
   \tkzVecKNorm[-\tkz@equ@dist](tkzEQpoint,#2)
   \pgfnodealias{tkzSecondPointResult}{tkzPointResult}
   \iftkz@equi@show
      \tkzCompass[compass style,#1](\tkz@frompoint,tkzFirstPointResult)
      \tkzCompass[compass style,#1](\tkz@frompoint,tkzSecondPointResult)
   \fi
\endgroup
}

%<---------------------------    The SHOW   --------------------------------–>
%<--------------------------------------------------------------------------–>
\global\def\tkz@numsh{0}
\pgfkeys{/show/.cd,
    mediator/.code             =          \def\tkz@numsh{0},
    perpendicular/.code args   =  {through #1} {\global\def\tkz@numsh{1}%
                                              \def\tkz@through{#1}}, 
    orthogonal/.code args      =  {through #1} {\global\def\tkz@numsh{1}%
                                                \global\def\tkz@through{#1}},
    parallel/.code args        = {through #1} {\global\def\tkz@numsh{2}%
                                            \global\def\tkz@through{#1}},    
    bisector/.code             =           \global\def\tkz@numsh{3},
    K/.code                    =   \def\tkz@koeff{#1}, 
    length/.code               =   \def\tkz@show@length{#1},
    ratio/.code                =   \def\tkz@show@ratio{#1},
    gap/.code                  =   \def\tkz@show@gap{#1},
    size/.code                 =   \def\tkz@show@size{#1},
    /show/.unknown/.code       =   {\let\searchname=\pgfkeyscurrentname
                                   \pgfkeysalso{\searchname/.try=#1,
                                   /tkzcompass/\searchname/.retry=#1,
                                   /tikz/\searchname/.retry=#1}%
                   }
         }    
\def\tkzShowLine{\pgfutil@ifnextchar[{\tkz@ShowLine}{\tkz@ShowLine[]}}
\def\tkz@ShowLine[#1](#2){% 
\begingroup
\pgfqkeys{/show}{ K   = 1,
          gap         = 2,
          ratio       = .5,
          length      = 1,
          size        = 1
          }  
\pgfqkeys{/show}{#1}  
\ifcase\tkz@numsh%
 % first case 0
  \tkzShowMediatorLine[#1](#2)  
 \or% 1
  \tkzShowOrthLine[#1](#2)(\tkz@through)  
 \or% 2
   \tkzShowLLLine[#1](#2)(\tkz@through)
 \or% 3
  \tkzShowBisectorLine[#1](#2)
\fi
\endgroup
}

\def\tkzShowMediatorLine{%
  \pgfutil@ifnextchar[{\tkz@ShowMediatorLine}{\tkz@ShowMediatorLine[]}}  
\def\tkz@ShowMediatorLine[#1](#2,#3){%
\begingroup
\pgfkeys{show/.cd,  gap    =  2,
          ratio            =  .5,
          length           =  1
    }
\pgfkeys{show/.cd,#1}  
  \path (#2) -- (#3) coordinate[pos=.5](tkzmidpoint);
  \tkzURotateAngle(#2,60)(#3)       
  \pgfnodealias{tkzFirstPointResult}{tkzPointResult} 
  \tkzURotateAngle(#3,60)(#2)      
  \pgfnodealias{tkzSecondPointResult}{tkzPointResult} 
  \tkz@VecKOrthNorm[1](tkzmidpoint,#2)     
   \pgfnodealias{MED@tmp1}{tkzPointResult} 
  \tkz@VecKOrthNorm[1](tkzmidpoint,#3)      
  \pgfnodealias{MED@tmp2}{tkzPointResult} 
  \tkz@VecKNorm[\tkz@show@gap](tkzmidpoint,MED@tmp1)  
  \pgfnodealias{MED@1}{tkzPointResult} 
  \tkz@VecKNorm[\tkz@show@gap](tkzmidpoint,MED@tmp2) 
   \pgfnodealias{MED@2}{tkzPointResult} 
  \tkzCompass[compass style,#1,length=\tkz@show@ratio*\tkz@show@length](#2,MED@1)
  \tkzCompass[compass style,#1](#3,MED@1)
  \tkzCompass[compass style,#1,length=\tkz@show@ratio*\tkz@show@length](#2,MED@2)
  \tkzCompass[compass style,#1](#3,MED@2)
\endgroup
}

\def\tkzShowLLLine{\pgfutil@ifnextchar[{\tkz@ShowLLLine}{\tkz@ShowLLLine[]}}  
\def\tkz@ShowLLLine[#1](#2,#3)(#4){%
\begingroup
\pgfkeys{show/.cd,gap=2,ratio=.75,length=1}
\pgfkeys{show/.cd,#1}   
    \tkz@VecKCoLinear[1](#2,#3,#4)
     \pgfnodealias{tkz@lltmp}{tkzPointResult}
    \tkzCompass[compass style,#1](#4,tkz@lltmp)
    \tkzCompass[compass style,#1,length=\tkz@show@ratio*\tkz@show@length](#3,tkz@lltmp)
\endgroup
} 

%<--------------------------------------------------------------------------–>
%                        tkzLineOrth 
%<--------------------------------------------------------------------------–>
% pas de projection ortho car le point peut être sur la droite.
% manque les tests . Il faudrait voir si on peut projeter et choisir
\def\tkzShowOrthLine{\pgfutil@ifnextchar[{\tkz@ShowOrthLine}{\tkz@ShowOrthLine[]}} 
\def\tkz@ShowOrthLine[#1](#2,#3)(#4){% 
\begingroup
\pgfkeys{show/.cd,  
          ratio   = .75,
          length  = 1,
          gap     = -1,
          size    = 1} 
\pgfkeys{show/.cd,#1}
    \tkzDefPointWith(#2,#3)               
    \pgfnodealias{tkz@OLtmp}{tkzPointResult}
    \tkz@VecKCoLinear[1](#2,tkz@OLtmp,#4)      
    \pgfnodealias{tkzPointCo}{tkzPointResult}
    \tkzInterLL(#2,#3)(#4,tkzPointCo)
    \pgfnodealias{tkzPOpoint}{tkzPointResult}
    \tkz@@CalcLength(#4,tkzPOpoint){tkz@mathLen}
    \tkz@VecKNorm[1](#2,#3)
    \pgfnodealias{PO@tmp}{tkzPointResult}
    \tkz@VecKCoLinear[1](#2,PO@tmp,tkzPOpoint)  
    \pgfnodealias{PO@tmp2}{tkzPointResult}
    \tkz@VecKCoLinear[-1](#2,PO@tmp,tkzPOpoint)
    \pgfnodealias{PO@tmp1}{tkzPointResult}
    \tkz@VecKCoLinear[\tkz@show@size](tkzPOpoint,PO@tmp1,tkzPOpoint) 
    \pgfnodealias{PO@1}{tkzPointResult}
    \tkz@VecKCoLinear[\tkz@show@size](tkzPOpoint,PO@tmp2,tkzPOpoint)
    \pgfnodealias{PO@2}{tkzPointResult}
    \ifdim\tkz@mathLen pt>10 pt\relax
        \tkz@VecKNorm[1](#4,tkzPOpoint)
        \pgfnodealias{PO@tmp1}{tkzPointResult}
      \else
        \tkz@VecKOrthNorm[1](tkzPOpoint,PO@2)
        \pgfnodealias{PO@tmp1}{tkzPointResult}
     \fi
    \tkz@VecKCoLinear[-\tkz@show@gap](PO@tmp1,tkzPOpoint,tkzPOpoint)
    \pgfnodealias{PO@3}{tkzPointResult}
    \tkzCompass[compass style,#1,length=\tkz@show@ratio *\tkz@show@length](#4,PO@1)
    \tkzCompass[compass style,#1,length=\tkz@show@ratio *\tkz@show@length](#4,PO@2)
    \tkzCompass[compass style,#1,length=\tkz@show@ratio *\tkz@show@length](PO@1,PO@3)
    \tkzCompass[compass style,#1,length=\tkz@show@length](PO@2,PO@3) 
\endgroup
}    
%<-------------------------------------------------------------------------–> 
%    bisector Line
%<-------------------------------------------------------------------------–> 
\def\tkzShowBisectorLine{%
    \pgfutil@ifnextchar[{\tkz@ShowBisectorLine}{\tkz@ShowBisectorLine[]}}   
\def\tkz@ShowBisectorLine[#1](#2,#3,#4){% 
\begingroup
\pgfkeys{show/.cd,  gap   = 2,
          ratio           =.  5,
          length          = 1,
          size            = 1
          }
\pgfkeys{show/.cd,#1}    
  \tkzVecKNorm(#3,#2)           
    \pgfnodealias{tkz@pt1}{tkzPointResult}  
  \tkzVecKNorm(#3,#4)           
    \pgfnodealias{tkz@pt2}{tkzPointResult}
  \tkzDefMidPoint(tkz@pt1,tkz@pt2)    
    \pgfnodealias{tkz@pt3}{tkzPointResult}
  \tkzDefEquilateral(tkz@pt2,tkz@pt1)   
    \pgfnodealias{tkz@pt4}{tkzPointResult}
  \tkzDefMidPoint(tkz@pt3,tkz@pt4)    
    \pgfnodealias{tkz@ptm}{tkzPointResult}
  \tkzVecKNorm(#3,tkz@ptm)        
    \pgfnodealias{tkzBisPoint}{tkzPointResult}
  \tkzVecKNorm[\tkz@show@size](#3,#2)   
    \pgfnodealias{BI@1}{tkzPointResult}
  \tkzVecKNorm[\tkz@show@size](#3,#4)   
    \pgfnodealias{BI@2}{tkzPointResult}  
  \tkzVecK[\tkz@show@gap](#3,tkzBisPoint) 
    \pgfnodealias{tkzBisPoint}{tkzPointResult}
  \tkzCompass[compass style,#1,length=\tkz@show@ratio *\tkz@show@length](#3,BI@1)
  \tkzCompass[compass style,#1,length=\tkz@show@ratio *\tkz@show@length](#3,BI@2)
  \tkzCompass[compass style,#1,length=\tkz@show@length](BI@1,tkzBisPoint)
  \tkzCompass[compass style,#1,length=\tkz@show@ratio *\tkz@show@length](BI@2,tkzBisPoint)  
\endgroup    
}
%<--------------------------------------------------------------------------–>
%                        Transformations Géométriques
%<--------------------------------------------------------------------------–>
%<--------------------------------------------------------------------------–>
%                   The SHOW
%<--------------------------------------------------------------------------–>
\def\tkz@numst{0}
\pgfkeys{/showtsf/.cd,
 reflection/.code args={over #1--#2}{%
                  \def\tkzdeb{#1}
                  \def\tkzfin{#2}
                  \def\tkz@numst{0}},  
 symmetry/.code args={center #1}{%
                  \def\tkzcenter{#1} 
                  \def\tkz@numst{1}},
 projection/.code args={onto #1--#2}{%
                  \def\tkzdeb{#1}
                  \def\tkzfin{#2}  
                  \def\tkz@numst{2}},
translation/.code args={from #1 to #2}{%
                  \def\tkzfrom{#1}%
                  \def\tkzto{#2}%
                  \def\tkz@numst{3}},  
  K/.code                = \def\tkz@koeff{#1}, 
  length/.code           = \def\tkz@show@length{#1},
  ratio/.code            = \def\tkz@show@ratio{#1},
  gap/.code              = \def\tkz@show@gap{#1},
  size/.code             = \def\tkz@show@size{#1},
/showtsf/.unknown/.code  = {\let\searchname=\pgfkeyscurrentname
                            \pgfkeysalso{\searchname/.try=#1,
                                /tkzcompass/\searchname/.retry=#1,
                                /tikz/\searchname/.retry=#1}}
}  
%<--------------------------------------------------------------------------–>
\def\tkzShowTransformation{\pgfutil@ifnextchar[{\tkz@ShowTransformation}{%
                                                 \tkz@ShowTransformation[]}}
\def\tkz@ShowTransformation[#1](#2){% 
\begingroup
 \pgfqkeys{/showtsf}{K=1,gap=2,size=1,ratio=.5,length=1}  
 \pgfqkeys{/showtsf}{#1} 
 \pgfinterruptboundingbox  
\ifcase\tkz@numst%
 % first case 0
  \tkzShowSymOrth[#1](\tkzdeb,\tkzfin)(#2)   
  \or% 1
  \tkzShowCSym[#1](\tkzcenter)(#2)
  \or% 2
  \tkzShowProjection[#1](\tkzdeb,\tkzfin)(#2) 
  \or% 3
  \tkzShowTranslation[#1](\tkzfrom,\tkzto)(#2) 
  \fi  
  \endpgfinterruptboundingbox   
\endgroup
}
%<--------------------------------------------------------------------------–>
\def\tkzShowTranslation{\pgfutil@ifnextchar[{\tkz@ShowTranslation}{%
                                          \tkz@ShowTranslation[]}}  

\def\tkz@ShowTranslation[#1](#2,#3)(#4){%
\begingroup
\tkz@VecKCoLinear[1](#2,#3,#4) \pgfnodealias{tkz@lltmp}{tkzPointResult}
\tkzCompass[compass style,#1](#4,tkz@lltmp)
\tkzCompass[compass style,#1,length=\tkz@show@ratio*\tkz@show@length](#3,tkz@lltmp)
\endgroup}
%<--------------------------------------------------------------------------–>
\def\tkzShowSymOrth{\pgfutil@ifnextchar[{\tkz@ShowSymOrth}{%
                                          \tkz@ShowSymOrth[]}}  
\def\tkz@ShowSymOrth[#1](#2,#3)(#4){%
\begingroup
  \pgfpointdiff{\pgfpointanchor{#2}{center}}%
               {\pgfpointanchor{#3}{center}}%
  \tkz@ax =\pgf@y%
  \tkz@ay =\pgf@x%
  \path[coordinate](#4)--++(-\tkz@ax,\tkz@ay) coordinate (tkz@point);
  \tkzInterLL(#2,#3)(#4,tkz@point)  
  \pgfnodealias{tkzPointofSym}{tkzPointResult}
  \tkz@VecK[2](#4,tkzPointofSym) 
  \pgfnodealias{tkz@pointtsf}{tkzPointResult}  
  \tkzCompass[compass style,#1](#2,#4)
  \tkzCompass[compass style,#1,length=\tkz@show@ratio*\tkz@show@length](#3,#4)
  \tkzCompass[compass style,#1](#2,tkz@pointtsf)
  \tkzCompass[compass style,#1,length=\tkz@show@ratio*\tkz@show@length](#3,tkz@pointtsf)   
\endgroup
} 
%<--------------------------------------------------------------------------–>
\def\tkzShowCSym{\pgfutil@ifnextchar[{\tkz@ShowCSym}{\tkz@ShowCSym[]}}
 
\def\tkz@ShowCSym[#1](#2)(#3){%
\begingroup
 \pgfpointdiff{\pgfpointanchor{#2}{center}}%
              {\pgfpointanchor{#3}{center}}%
 \tkz@ax=\pgf@x%
 \tkz@ay=\pgf@y%
\path[coordinate](#2)--++(-\tkz@ax,-\tkz@ay) coordinate (tkz@pointtsf); 
       \tkzCompass[compass style,#1](#2,tkz@pointtsf)
       \tkzCompass[compass style,#1](#2,#3)
\endgroup
}
%<--------------------------------------------------------------------------–>
\def\tkzShowProjection{\pgfutil@ifnextchar[{\tkz@ShowProjection}{%
                                          \tkz@ShowProjection[]}}  
\def\tkz@ShowProjection[#1](#2,#3)(#4){%
\begingroup 
  \pgfpointdiff{\pgfpointanchor{#2}{center}}%
               {\pgfpointanchor{#3}{center}}%
  \tkz@ax =\pgf@y%
  \tkz@ay =\pgf@x%     
  \path[coordinate](#4)--++(-\tkz@ax,\tkz@ay) coordinate (tkz@point);
  \tkzInterLL(#2,#3)(#4,tkz@point)          
  \pgfnodealias{tkz@pointtsf}{tkzPointResult}
  \tkz@VecKCoLinear[1](#2,#3,tkz@pointtsf)        
  \pgfnodealias{SO@tmp1}{tkzPointResult}
  \tkz@VecKCoLinear[-1](#2,#3,tkz@pointtsf)
  \pgfnodealias{SO@tmp2}{tkzPointResult}
  \tkz@VecKNorm[\tkz@show@size](tkz@pointtsf,SO@tmp1)
  \pgfnodealias{SO@1}{tkzPointResult}
  \tkz@VecKNorm[\tkz@show@size](tkz@pointtsf,SO@tmp2)
  \pgfnodealias{SO@2}{tkzPointResult}
  \tkz@VecKNorm[-\tkz@show@gap](tkz@pointtsf,#4)
  \pgfnodealias{SO@3}{tkzPointResult}
  \tkzCompass[compass style,#1](#4,SO@1)
  \tkzCompass[compass style,#1](#4,SO@2)
  \tkzCompass[compass style,#1](SO@1,SO@3)
  \tkzCompass[compass style,#1,length=\tkz@show@ratio*\tkz@show@length](SO@2,SO@3)
\endgroup
}   
\makeatother  
\endinput