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
|
% tkz-obj-eu-draw-triangles.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.00}
\def\filedate{2022/01/04}
\typeout{2022/01/04 4.00 tkz-obj-eu-draw-triangles.tex}
\makeatletter
%<--------------------------------------------------------------------------–>
% Draw Triangles
%<--------------------------------------------------------------------------–>
\def\tkz@numdtr{0}
\pgfkeys{/drawtriangle/.cd,
equilateral/.code = {\def\tkz@numdtr{0}},
half/.code = {\def\tkz@numdtr{1}},
pythagore/.code = {\def\tkz@numdtr{2}},
school/.code = {\def\tkz@numdtr{3}},
golden/.code = {\def\tkz@numdtr{4}},
sublime/.code = {\def\tkz@numdtr{4}},
euclid/.code = {\def\tkz@numdtr{5}},
gold/.code = {\def\tkz@numdtr{6}},
cheops/.code = {\def\tkz@numdtr{7}},
two angles/.code args = {#1 and #2}{\def\tkz@numdtr{8}%
\def\tkz@alpha{#1}%
\def\tkz@beta{#2}},
isosceles right/.code = {\def\tkz@numdtr{9}},
equilateral,
/drawtriangle/.search also={/tikz}
}
\def\tkzDrawTriangle{\pgfutil@ifnextchar[{\tkz@DrawTriangle}{%
\tkz@DrawTriangle[]}}
\def\tkz@DrawTriangle[#1](#2,#3){%
\begingroup
\pgfkeys{/drawtriangle/.cd,equilateral}
\pgfqkeys{/drawtriangle}{#1}
\ifcase\tkz@numdtr%
\tkzDefEquilateral(#2,#3)
\or% 1
\tkzDefTwoOne(#2,#3)
\or% 2
\tkzDefPythagore(#2,#3)
\or% 3
\tkzDefSchoolTriangle(#2,#3)
\or% 4
\tkzDefGoldenTriangle(#2,#3)
\or% 5
\tkzDefEuclideTriangle(#2,#3)
\or% 6
\tkzDefGoldTriangle(#2,#3)
\or% 7
\tkzDefCheopsTriangle(#2,#3)
\or% 8
\tkzDefTwoAnglesTriangle(#2,#3)
\or% 9
\tkzDefIsoscelesRightTriangle(#2,#3)
\fi
\draw[/drawtriangle/.cd,line style,#1] (#2)--(#3)--(tkzPointResult)--cycle;
\endgroup
}
%<--------------------------------------------------------------------------–>
\def\tkz@multitriangles#1 #2\@nil{%
\protected@edef\tkz@temp{
\noexpand \tkzDrawPolygon[\tkz@opttrianle](#1)}\tkz@temp%
\def\tkz@nextArg{#2}%
\ifx\tkzutil@empty\tkz@nextArg
\let\next\@gobble
\fi
\next#2\@nil
}
%<--------------------------------------------------------------------------–>
\def\tkzDrawTriangles{\pgfutil@ifnextchar[{\tkz@DrawTriangles}{\tkz@DrawTriangles[]}}
\def\tkz@DrawTriangles[#1](#2){%
\xdef\tkz@opttrianle{#1}
\begingroup
\let\next\tkz@multitriangles
\next#2 \@nil %
\endgroup
}%
\makeatother
\endinput
|