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
|
% tkz-obj-eu-grids.tex
% Copyright 2022 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{4.25c}
\def\filedate{2022/09/23}
\typeout{2022/09/23 4.25c tkz-obj-eu-grids.tex}
\makeatletter
%<--------------------------------------------------------------------------–>
% Setup Grid
%<--------------------------------------------------------------------------–>
\pgfkeys{/tkzsugrid/.cd,
line width/.store in = \tkz@sug@lw,
color/.store in = \tkz@sug@color,
line width = \tkz@grid@lw,
color = \tkz@grid@color
}
\def\tkzSetUpGrid{\pgfutil@ifnextchar[{\tkz@SetUpGrid}{\tkz@SetUpGrid[]}}
\def\tkz@SetUpGrid[#1]{%
\begingroup
\pgfqkeys{/tkzsugrid}{#1}
\global\let\tkz@grid@lw\tkz@sug@lw
\global\let\tkz@grid@color\tkz@sug@color
\endgroup
}
%<--------------------------------------------------------------------------–>
% tkzGrid
%<--------------------------------------------------------------------------–>
\pgfkeys{/tkzGrid/.cd,
color/.code = {\def\tkz@gd@color{#1}%
\edef\tkz@gd@subcolor{%
\tkz@gd@color!\tkzCoeffSubColor}},
subxstep/.store in = {\tkz@gd@subxstep},
subystep/.store in = {\tkz@gd@subystep},
ratio/.store in = {\tkz@gd@ratio},
line width/.code = {\edef\tkz@gd@lw{#1}
\edef\tkz@gd@sublw{\tkz@gd@ratio\tkz@gd@lw}},
sub/.is if = tkz@gd@sub,
sub/.default = true ,
sub = false,
color = \tkz@grid@color,
ratio = 0.75,
subxstep = \tkz@grid@xstep,
subystep = \tkz@grid@ystep,
line width = \tkz@grid@lw,
/tkzGrid/.search also= {/tikz},
}
%<--------------------------------------------------------------------------–>
\def\tkzGrid{\pgfutil@ifnextchar[{\tkz@Grid}{\tkz@Grid[]}}
\def\tkz@Grid[#1]{\@ifnextchar({\tkz@@Grid[#1]}%
{\tkz@@Grid[#1](\tkz@tmp@xa,\tkz@tmp@ya)(\tkz@tmp@xb,\tkz@tmp@yb)}}
\def\tkz@@Grid[#1](#2,#3)(#4,#5){%
\pgfqkeys{/tkzGrid}{#1}
\begingroup
\edef\tkz@gxa{\fpeval{(#2-\tkz@init@xorigine)/\tkz@init@xstep}}
\edef\tkz@gxb{\fpeval{(#4-\tkz@init@xorigine)/\tkz@init@xstep}}
\edef\tkz@gya{\fpeval{(#3-\tkz@init@yorigine)/\tkz@init@ystep}}
\edef\tkz@gyb{\fpeval{(#5-\tkz@init@yorigine)/\tkz@init@ystep}}
\iftkz@gd@sub%
\edef\@subxstep{\fpeval{\tkz@gd@subxstep/\tkz@init@xstep}}%
\edef\@subystep{\fpeval{\tkz@gd@subystep/\tkz@init@ystep}}%
\draw [xstep = \@subxstep cm,%
ystep = \@subystep cm,%
color = \tkz@gd@subcolor,%
line width = \tkzRatioLineGrid]%
(\tkz@gxa,\tkz@gya) grid (\tkz@gxb,\tkz@gyb);%
\fi
\draw [color = \tkz@gd@color,%
line width = \tkz@gd@lw]%
(\tkz@gxa,\tkz@gya) grid (\tkz@gxb,\tkz@gyb);%
\endgroup
}%
\makeatother
\endinput
|