% tkz-tools-lua-base.tex
% Copyright 2011-2026  Alain Matthes
% SPDX-License-Identifier: LPPL-1.3c
% Maintainer: Alain Matthes

\typeout{2026/01/25 5.13c tkz-tools-lua-base.tex}
\makeatletter
%<--------------------------------------------------------------------------–>
\global\let\tkz@tmp@xa\tkz@init@xmin% modif  2016
\global\let\tkz@tmp@xb\tkz@init@xmax% modif  2016
\global\let\tkz@tmp@ya\tkz@init@ymin% modif  2016
\global\let\tkz@tmp@yb\tkz@init@ymax% modif  2016
%<--------------------------------------------------------------------------–>
\pgfkeys{
         /tkzInit/.cd,
         xmin/.store in     = \tkz@init@xmin,
         xmax/.store in     = \tkz@init@xmax,
         xstep/.store in    = \tkz@init@xstep,
         ymin/.store in     = \tkz@init@ymin,
         ymax/.store in     = \tkz@init@ymax,
         ystep/.store in    = \tkz@init@ystep,
         NO/.is if          = tkz@init@NO,
         NO/.default        = true,
         xmin               = 0,
         xmax               = 10,
         xstep              = 1,
         ymin               = 0,
         ymax               = 10,
         ystep              = 1,
         NO                 = false
         }

\def\tkzInit{\pgfutil@ifnextchar[{\tkz@Init}{\tkz@Init[]}}
\def\tkz@Init[#1]{%
    \pgfqkeys{/tkzInit}{#1}
  \ifx\tkzfctloaded\undefined
    \else
      \tkz@tkzf@fct=0 %  only if tkz-fct loaded
   \fi
  \xdef\tkz@init@xorigine{0}
  \xdef\tkz@init@yorigine{0}
  \edef\@xsgmin{\fpeval{sign(\tkz@init@xmin)}}
  \edef\@xsgmax{\fpeval{sign(\tkz@init@xmax)}}
  \edef\@ysgmin{\fpeval{sign(\tkz@init@ymin)}}
  \edef\@ysgmax{\fpeval{sign(\tkz@init@ymax)}}
  \let\tkz@tmp@xa\tkz@init@xmin %modif 2016
  \let\tkz@tmp@xb\tkz@init@xmax %modif 2016
  \let\tkz@tmp@ya\tkz@init@ymin %modif 2016
  \let\tkz@tmp@yb\tkz@init@ymax %modif 2016
  \tkz@init@NOfalse
  \ifx\@xsgmin\@xsgmax \tkz@init@NOtrue \fi
  \ifx\@ysgmin\@ysgmax \tkz@init@NOtrue \fi
  \iftkz@init@NO%
  \ifx\@xsgmin\@xsgmax
      \edef\tkz@init@xmax{\tkz@Dec{\tkz@init@xmax-(\tkz@init@xmin)}}
      \edef\tkz@init@xorigine{\tkz@init@xmin}
      \edef\tkz@init@xmin{0}
  \fi
  \ifx\@ysgmin\@ysgmax
      \edef\tkz@init@ymax{\tkz@Dec{\tkz@init@ymax-(\tkz@init@ymin)}}
      \edef\tkz@init@yorigine{\tkz@init@ymin}
      \edef\tkz@init@ymin{0}
  \fi
  \fi
  \edef\tkz@xa{\tkz@Dec{\tkz@init@xmin/\tkz@init@xstep}}
  \edef\tkz@xb{\tkz@Dec{\tkz@init@xmax/\tkz@init@xstep}}
  \edef\tkz@ya{\tkz@Dec{\tkz@init@ymin/\tkz@init@ystep}}
  \edef\tkz@yb{\tkz@Dec{\tkz@init@ymax/\tkz@init@ystep}}
  \tkz@getdecimal{\tkz@init@xstep} % amélioration nb dec et integer
  \xdef\tkz@init@xdec{\number\c@pgfmath@countb}
  \tkz@getdecimal{\tkz@init@ystep}
  \xdef\tkz@init@ydec{\number\c@pgfmath@countb}
}%
\def\tkzAddName{\pgfutil@ifnextchar[{\tkz@AddName}{\tkz@AddName[]}}
\def\tkz@AddName[#1]#2{%
\node[above left,#1] at (\pgf@path@lastx,\pgf@path@lasty){#2};
}%
%<--------------------------------------------------------------------------–>
\makeatother
\endinput