Debian Codegraph @

texmf-dist/doc/latex/tkz-elements/TKZdoc-elements-classes-parallelogram.tex

raw
1 \newpage
2 \section{Class \tkzClass{parallelogram}}
3 The variable \tkzVar{parallelogram}{P} holds a table used to store parallelograms. It is optional, and you are free to choose the variable name. However, using \code{P} is a recommended convention for clarity and consistency. If you use a custom variable (e.g., parall), you must initialize it manually. The \code{init\_elements()} function reinitializes the \code{P} table if used.
4
5
6 \subsection{Creating a parallelogram}
7 \label{sub:creating_a_parallelogram}
8
9 The \tkzClass{parallelogram} class creates a parallelogram using three points. The fourth vertex is computed automatically.
10
11 \medskip
12 The resulting object is stored in \tkzVar{parallelogram}{P}. You are free to use another name, but \tkzVar{parallelogram}{P} is preferred for consistency.
13
14 \begin{mybox}
15 \begin{verbatim}
16 P.ABCD = parallelogram:new(z.A, z.B, z.C)
17 \end{verbatim}
18 \end{mybox}
19
20 \textbf{Short form.}
21
22 You may also use the short form:
23
24 \begin{mybox}
25 \begin{verbatim}
26 P.ABCD = parallelogram(z.A, z.B, z.C)
27 \end{verbatim}
28 \end{mybox}
29
30 \subsection{Parallelogram attributes}
31
32 Points are created in the direct direction. A test is performed to check whether the points form a parallelogram, otherwise compilation is blocked.
33
34 \begin{mybox}
35 Creation | P.new = parallelogram(z.A,z.B,z.C,z.D)|
36 \end{mybox}
37
38
39 \bgroup
40 \catcode`_=12
41 \small
42 \captionof{table}{Parallelogram attributes.}\label{parallelogram:attributes}
43 \begin{tabular}{lll}
44 \toprule
45 \textbf{Attributes} & \textbf{Application} & \\
46 \midrule
47 \tkzAttr{parallelogram}{pa} & |z.A = P.new.pa| & \\
48 \tkzAttr{parallelogram}{pb} & |z.B = P.new.pb| & \\
49 \tkzAttr{parallelogram}{pc} & |z.C = P.new.pc| & \\
50 \tkzAttr{parallelogram}{pd} & |z.D = P.new.pd| & \\
51 \tkzAttr{parallelogram}{type} & |P.new.type= 'parallelogram'|& \\
52 \tkzAttr{parallelogram}{center} & |z.I = P.new.center| & intersection of diagonals \\
53 \tkzAttr{parallelogram}{ab} & |P.new.ab| & line passing through two vertices \\
54 \tkzAttr{parallelogram}{ac} & |P.new.ca| & idem. \\
55 \tkzAttr{parallelogram}{ad} & |P.new.ad| & idem. \\
56 \tkzAttr{parallelogram}{bc} & |P.new.bc| & idem. \\
57 \tkzAttr{parallelogram}{bd} & |P.new.bd| & idem. \\
58 \tkzAttr{parallelogram}{cd} & |P.new.cd| & idem. \\
59 \bottomrule %
60 \end{tabular}
61 \egroup
62
63
64 \subsubsection{Example: attributes }
65 \label{ssub:example_attributes}
66 \begin{minipage}{.5\textwidth}
67 \begin{verbatim}
68 \directlua{
69 init_elements()
70 z.A = point(0, 0)
71 z.B = point(4, 1)
72 z.C = point(7, 5)
73 z.D = point(3, 4)
74 P.new = parallelogram(z.A, z.B, z.C, z.D)
75 z.B = P.new.pb
76 z.C = P.new.pc
77 z.D = P.new.pd
78 z.I = P.new.center}
79 \begin{tikzpicture}
80 \tkzGetNodes
81 \tkzDrawPolygon(A,B,C,D)
82 \tkzDrawPoints(A,B,C,D)
83 \tkzLabelPoints(A,B)
84 \tkzLabelPoints[above](C,D)
85 \tkzDrawPoints[red](I)
86 \end{tikzpicture}
87 \end{verbatim}
88 \end{minipage}
89 \begin{minipage}{.5\textwidth}
90 \directlua{
91 init_elements()
92 z.A = point(0, 0)
93 z.B = point(4, 1)
94 z.C = point(7, 5)
95 z.D = point(3, 4)
96 P.new = parallelogram(z.A, z.B, z.C, z.D)
97 z.B = P.new.pb
98 z.C = P.new.pc
99 z.D = P.new.pd
100 z.I = P.new.center}
101
102 \begin{center}
103 \begin{tikzpicture}
104 \tkzGetNodes
105 \tkzDrawPolygon(A,B,C,D)
106 \tkzDrawPoints(A,B,C,D)
107 \tkzLabelPoints(A,B)
108 \tkzLabelPoints[above](C,D)
109 \tkzDrawPoints[red](I)
110 \end{tikzpicture}
111 \end{center}
112 \end{minipage}
113
114 \newpage
115 \subsection{Parallelogram functions}
116
117 \begin{center}
118 \bgroup
119 \catcode`_=12
120 \small
121 \captionof{table}{Parallelogram functions.}\label{parallelogram:methods}
122 \begin{tabular}{ll}
123 \toprule
124 \textbf{Functions} & \texttt{Reference} \\
125 \midrule
126 \tkzMeth{parallelogram}{new (za, zb, zc, zd)} & \ref{ssub:example_attributes}\\
127 \tkzFct{parallelogram}{parallelogram.fourth (za,zb,zc)} & \ref{ssub:parallelogram_with_fourth_method} \\
128 \bottomrule %
129 \end{tabular}
130 \egroup
131 \end{center}
132
133 \subsubsection{Method \tkzMeth{parallelogram}{new(pt,pt,pt,pt)}}
134 \label{ssub:function_parallelogram_new}
135
136 \begin{tkzexample}[latex=.5\textwidth]
137 \directlua{
138 z.A = point(0, 0)
139 z.B = point(4, 1)
140 z.C = point(7, 5)
141 z.D = point(3, 4)
142 P.ABCD = parallelogram(z.A, z.B, z.C, z.D)
143 z.B = P.ABCD.pb
144 z.C = P.ABCD.pc
145 z.D = P.ABCD.pd
146 z.I = P.ABCD.center}
147 \begin{tikzpicture}
148 \tkzGetNodes
149 \tkzDrawPolygon(A,B,C,D)
150 \tkzDrawPoints(A,B,C,D)
151 \tkzLabelPoints(A,B)
152 \tkzLabelPoints[above](C,D)
153 \tkzDrawPoints[red](I)
154 \end{tikzpicture}
155 \end{tkzexample}
156
157 \subsubsection{Method \tkzMeth{parallelogram}{fourth(pt,pt,pt)}}
158 \label{ssub:parallelogram_with_fourth_method}
159 completes a triangle by parallelogram (See next example)
160
161 \begin{minipage}{.5\textwidth}
162 \begin{verbatim}
163 \directlua{
164 init_elements()
165 z.A = point(0, 0)
166 z.B = point(3, 1)
167 z.C = point(4, 3)
168 P.four= parallelogram.fourth(z.A, z.B, z.C)
169 z.D = P.four.pd
170 z.I = P.four.center}
171 \begin{tikzpicture}[ scale = .75]
172 \tkzGetNodes
173 \tkzDrawPolygon(A,B,C,D)
174 \tkzDrawPoints(A,B,C,D)
175 \tkzLabelPoints(A,B)
176 \tkzLabelPoints[above](C,D)
177 \tkzDrawPoints[red](I)
178 \end{tikzpicture}
179 \end{verbatim}
180 \end{minipage}
181 \begin{minipage}{.5\textwidth}
182 \directlua{
183 init_elements()
184 z.A = point(0, 0)
185 z.B = point(3, 1)
186 z.C = point(4, 3)
187 P.four= parallelogram.fourth(z.A, z.B, z.C)
188 z.D = P.four.pd
189 z.I = P.four.center}
190 \begin{center}
191 \begin{tikzpicture}[scale = .75]
192 \tkzGetNodes
193 \tkzDrawPolygon(A,B,C,D)
194 \tkzDrawPoints(A,B,C,D)
195 \tkzLabelPoints(A,B)
196 \tkzLabelPoints[above](C,D)
197 \tkzDrawPoints[red](I)
198 \end{tikzpicture}
199 \end{center}
200 \end{minipage}
201 \endinput