summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/proflycee/tex/proflycee-tools-geom.tex
blob: 5b041fcd0f6da61cf908f53b4dd69321b43baca8 (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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
% proflycee-tools-geom.tex
% Copyright 2023  Cédric Pierquet
% 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.

%%------PaveDroitTikZ
\defKV[paramspave]{%
	Largeur=\xdef\PFPaveLg{#1},%
	Profondeur=\xdef\PFPavePf{#1},%
	Hauteur=\xdef\PFPaveHt{#1},%
	Angle=\xdef\PFPaveAngl{#1},%
	Fuite=\xdef\PFPaveFuite{#1},%
	Sommets=\def\PFPaveSommets{#1},%
	Epaisseur=\xdef\PFPaveThick{#1}
}
\setKVdefault[paramspave]{%
	Aff=false,%
	Plein=false,%
	Largeur=2,%
	Profondeur=1,%
	Hauteur=1.25,%
	Angle=30,%
	Fuite=0.5,%
	Epaisseur=thick,%
	Sommets=A§B§C§D§E§F§G§H,%
	Cube=false,%
	Math=false
}

\newcommand\PaveTikz[1][]{%
	\useKVdefault[paramspave]%
	\setKV[paramspave]{#1}%
	\ifboolKV[paramspave]{Cube}
	{\xdef\PFPavePf{\PFPaveLg}%
		\xdef\PFPaveHt{\PFPaveLg}}
	{}
	\setsepchar{§}%
	\readlist*\PFListeSommets\PFPaveSommets
	\itemtomacro\PFListeSommets[1]\PaveA
	\itemtomacro\PFListeSommets[2]\PaveB
	\itemtomacro\PFListeSommets[3]\PaveC
	\itemtomacro\PFListeSommets[4]\PaveD
	\itemtomacro\PFListeSommets[5]\PaveE
	\itemtomacro\PFListeSommets[6]\PaveF
	\itemtomacro\PFListeSommets[7]\PaveG
	\itemtomacro\PFListeSommets[8]\PaveH
	%les nœuds du pave
	\coordinate (\PaveA) at (0,0) ;
	\coordinate (\PaveB) at ({\PFPaveLg},0) ;
	\coordinate (\PaveC) at ($(\PaveB) + ({\PFPaveAngl}:{\PFPaveFuite*\PFPavePf})$) ;
	\coordinate (\PaveD) at ($(\PaveA) + ({\PFPaveAngl}:{\PFPaveFuite*\PFPavePf})$) ;
	\coordinate (\PaveE) at ($(\PaveA) + (0,{\PFPaveHt})$) ;
	\coordinate (\PaveF) at ($(\PaveB) + (0,{\PFPaveHt})$) ;
	\coordinate (\PaveG) at ($(\PaveC) + (0,{\PFPaveHt})$) ;
	\coordinate (\PaveH) at ($(\PaveD) + (0,{\PFPaveHt})$) ;
	\ifboolKV[paramspave]{Aff}
		{\draw (\PaveA) node[below left] {\ifboolKV[paramspave]{Math}{$\PaveA$}{\PaveA}} ;
			\draw (\PaveB) node[below right] {\ifboolKV[paramspave]{Math}{$\PaveB$}{\PaveB}} ;
			\draw (\PaveC) node[above right] {\ifboolKV[paramspave]{Math}{$\PaveC$}{\PaveC}} ;
			\ifboolKV[paramspave]{Plein}
				{}
				{\draw (\PaveD) node[above left] {\ifboolKV[paramspave]{Math}{$\PaveD$}{\PaveD}} ;}
				\draw (\PaveE) node[below left] {\ifboolKV[paramspave]{Math}{$\PaveE$}{\PaveE}} ;
				\draw (\PaveF) node[below right] {\ifboolKV[paramspave]{Math}{$\PaveF$}{\PaveF}} ;
				\draw (\PaveG) node[above right] {\ifboolKV[paramspave]{Math}{$\PaveG$}{\PaveG}} ;
				\draw (\PaveH) node[above left] {\ifboolKV[paramspave]{Math}{$\PaveH$}{\PaveH}} ;}
		{}%on affiche rien
	\draw[\PFPaveThick] (\PaveA)--(\PaveB)--(\PaveF)--(\PaveE)--cycle
	                    (\PaveB)--(\PaveC)--(\PaveG)--(\PaveF)--cycle
	                    (\PaveG)--(\PaveH)--(\PaveE) ;
	\ifboolKV[paramspave]{Plein}
		{}
		{\draw[dashed,\PFPaveThick] (\PaveA)--(\PaveD)--(\PaveC)
		                            (\PaveD)--(\PaveH) ;}
}

%%------TétraèdreTikZ
\defKV[paramstetra]{%
	Largeur=\xdef\PFTetraLg{#1},%
	Profondeur=\xdef\PFTetraPf{#1},%
	Hauteur=\xdef\PFTetraHt{#1},%
	Alpha=\xdef\PFTetraAlpha{#1},%
	Beta=\xdef\PFTetraBeta{#1},%
	Sommets=\def\PFTetraSommets{#1},%
	Epaisseur=\xdef\PFTetraThick{#1}
}
\setKVdefault[paramstetra]{%
	Aff=false,%
	Plein=false,%
	Largeur=4,%
	Profondeur=1.25,%
	Hauteur=3,%
	Alpha=40,%
	Beta=60,%
	Epaisseur=thick,%
	Sommets=A§B§C§D,%
	Math=false
}

\newcommand\TetraedreTikz[1][]{%
	\useKVdefault[paramstetra]%
	\setKV[paramstetra]{#1}%
	\setsepchar{§}%
	\readlist*\PFListeSommets\PFTetraSommets
	\itemtomacro\PFListeSommets[1]\TetraA
	\itemtomacro\PFListeSommets[2]\TetraB
	\itemtomacro\PFListeSommets[3]\TetraC
	\itemtomacro\PFListeSommets[4]\TetraD
	%les nœuds du tétraèdre
	\coordinate (\TetraA) at (0,0) ;
	\coordinate (\TetraB) at ($(\TetraA) + ({-\PFTetraAlpha}:{\PFTetraPf})$) ;
	\coordinate (\TetraC) at ({\PFTetraLg},0) ;
	\coordinate (\TetraD) at ($(\TetraA) + ({\PFTetraBeta}:{\PFTetraHt})$) ;
	\ifboolKV[paramstetra]{Aff}
	{\draw (\TetraA) node[left] {\ifboolKV[paramstetra]{Math}{$\TetraA$}{\TetraA}} ;
		\draw (\TetraB) node[below] {\ifboolKV[paramstetra]{Math}{$\TetraB$}{\TetraB}} ;
		\draw (\TetraC) node[right] {\ifboolKV[paramstetra]{Math}{$\TetraC$}{\TetraC}} ;
		\draw (\TetraD) node[above] {\ifboolKV[paramstetra]{Math}{$\TetraD$}{\TetraD}} ;}
		{}%on affiche rien
	\draw[\PFTetraThick] (\TetraA)--(\TetraD)--(\TetraC)--(\TetraB)--cycle
						(\TetraD)--(\TetraB) ;
	\ifboolKV[paramstetra]{Plein}
		{}
		{\draw[dashed,\PFTetraThick] (\TetraA)--(\TetraC) ;}
}

%%------MainLevée TikZ
\tikzset{%
	mainlevee/.style args={#1et#2}{decorate,decoration={random steps,segment length=#1,amplitude=#2}},
	mainlevee/.default={5mm et 0.6pt}
}


\endinput