Debian Codegraph @

texmf-dist/doc/latex/polyhedra/polyhedra-doc.tex

raw
1 \documentclass[a4paper]{article}
2 \usepackage{listings}
3
4 \usepackage{polyhedra}
5
6 \begin{document}
7
8 \lstset{language=[LaTeX]{TeX}}
9
10 \lstset{
11 basicstyle=\small\sffamily,
12 backgroundcolor=\color{gray!20},
13 %numbers=left,
14 numberstyle=\tiny,
15 breaklines=true,
16 %frame=l,
17 xleftmargin=\parindent,
18 columns=fullflexible,
19 showstringspaces=false,
20 keywordstyle=\bfseries\color{solarized-green},
21 commentstyle=\color{black!50},
22 identifierstyle=\color{solarized-blue},
23 stringstyle=,
24 escapeinside={(*}{*)}
25 }
26
27
28 \title{Polyhedra \LaTeX\ package - v. 0.3}
29 \author{Zafeirakis zafeirakopoulos}
30 \maketitle
31 \begin{abstract}
32 This package provides macros for creating polyhedral objects in 2D and 3D.
33 It requires tikz and tikz-3dplot.
34 The macros provided can be used for drawing vertices, edges, rays, polygons and
35 cones.
36 \end{abstract}
37
38 \section{Introduction}
39
40
41 All the drawing commands work with keyword arguments and are the same in
42 2d and 3D.
43
44
45
46 \section{Functionality}
47
48 \subsection{The \emph{polyhedron} environment}
49
50 The \emph{polyhedron} environment is essentially a wrapper for a tikzpicture
51 environment.
52 It accepts as extra arguments the dimension of the picture (either $2$ or $3$)
53 and if the dimension is $3$, then the arguments for the three angles defining
54 the rotated coordinate system are given.
55 For the 3D coordinate system, we use tikz-plot3d.
56
57 \begin{center}
58 \begin{minipage}{0.6\textwidth}
59 \begin{lstlisting}
60 \begin{polyhedron}{dim=2}
61 \axes{x={1,3},y={1,3}}
62 \end{polyhedron}
63 \end{lstlisting}
64 \end{minipage}
65 \qquad\qquad
66 \begin{minipage}{0.2\textwidth}
67 \begin{polyhedron}{dim=2}
68 \axes{x={1,3},y={1,3}}
69 \end{polyhedron}
70 \end{minipage}
71 \end{center}
72
73
74 The dimension argument defaults to $2$.
75
76
77 \begin{center}
78 \begin{minipage}{0.6\textwidth}
79 \begin{lstlisting}
80 \begin{polyhedron}{}
81 \axes{x={1,3},y={1,3}}
82 \end{polyhedron}
83 \end{lstlisting}
84 \end{minipage}
85 \qquad\qquad
86 \begin{minipage}{0.2\textwidth}
87 \begin{polyhedron}{}
88 \axes{x={1,3},y={1,3}}
89 \end{polyhedron}
90 \end{minipage}
91 \end{center}
92
93
94 Let us define a 3D polyhedron.
95
96 \begin{center}
97 \begin{minipage}{0.6\textwidth}
98 \begin{lstlisting}
99 \begin{polyhedron}{dim=3}
100 \axes{x={1,3},y={1,3},z={1,3}}
101 \end{polyhedron}
102 \end{lstlisting}
103 \end{minipage}
104 \qquad\qquad
105 \begin{minipage}{0.2\textwidth}
106 \begin{polyhedron}{dim=3}
107 \axes{x={1,3},y={1,3},z={1,3}}
108 \end{polyhedron}
109 \end{minipage}
110 \end{center}
111
112 Since we did not give the angles for the main coordinate system, we get the
113 default tikz $xy$-plane.
114
115 Now lets rotate the coordinate system by 60 degrees around the $x$-axis and
116 120 degrees around the $z$-axis.
117
118 \begin{center}
119 \begin{minipage}{0.6\textwidth}
120 \begin{lstlisting}
121 \begin{polyhedron}{dim=3,phi=60,theta=120}
122 \axes{x={1,3},y={1,3},z={1,3}}
123 \end{polyhedron}
124 \end{lstlisting}
125 \end{minipage}
126 \qquad\qquad
127 \begin{minipage}{0.2\textwidth}
128 \begin{polyhedron}{dim=3,phi=60,theta=120}
129 \axes{x={1,3},y={1,3},z={1,3}}
130 \end{polyhedron}
131 \end{minipage}
132 \end{center}
133
134
135 \subsection{Input}
136
137 The following macros work within the \texttt{polyhedron} environment.
138
139 \subsubsection{Point.} To let A be a point (x,y) or (x,y,z)
140 \begin{lstlisting}
141 \point{(x,y,z)}{A}
142 \end{lstlisting}
143 After defining a point, we can use the handle (variable name) A, instead of
144 writing down the coordinates in the macros that follow.
145
146
147 \subsubsection{Axes.}
148
149 We saw already some examples using the \emph{axes} command.
150
151 \begin{center}
152 \begin{minipage}{0.6\textwidth}
153 \begin{lstlisting}
154 \begin{polyhedron}{dim=3,phi=60,theta=120}
155 \axes{x={1,3},y={1,3},z={1,3}}
156 \end{polyhedron}
157 \end{lstlisting}
158 \end{minipage}
159 \qquad\qquad
160 \begin{minipage}{0.2\textwidth}
161 \begin{polyhedron}{dim=3,phi=60,theta=120}
162 \axes{x={1,3},y={1,3},z={1,3}}
163 \end{polyhedron}
164 \end{minipage}
165 \end{center}
166
167 The command takes the following (self-explanatory) arguments.
168 All arguments are optional, defaulting to the ones shown here.
169
170 \begin{lstlisting}
171 x={0,1},y={0,1},z={},xlabel={x},ylabel={y},zlabel={z},labels={true}
172 \end{lstlisting}
173
174
175
176 \begin{center}
177 \begin{minipage}{0.6\textwidth}
178 \begin{lstlisting}
179 \begin{polyhedron}{dim=3,phi=60,theta=120}
180 \axes{x={1,3},z={1,3},zlabel={not z}}
181 \end{polyhedron}
182 \end{lstlisting}
183 \end{minipage}
184 \qquad\qquad
185 \begin{minipage}{0.2\textwidth}
186 \begin{polyhedron}{dim=3,phi=60,theta=120}
187 \axes{x={1,3},z={1,3},zlabel={not z}}
188 \end{polyhedron}
189 \end{minipage}
190 \end{center}
191
192
193
194 \subsection{Drawing commands}
195
196 All drawing commands accept the following options:
197 \begin{description}
198 \item[color] The color of the polyhedral object to draw.
199 \item[status] The status of the object. The possible values are:
200 \begin{itemize}
201 \item normal
202 \item focus
203 \item alert
204 \item open
205 \end{itemize}
206 \item[opacity] The opacity of the object.
207 \item[thickness] The width of the lines
208 \item[pattern] The draw pattern
209 \end{description}
210
211 \subsubsection{Vertex}
212
213 The \emph{vertex} command is used to draw a vertex at a point (x,y,z) or A.
214 The standard options of color, status, opacity, thickness and pattern apply.
215 The extra options for vertex are:
216 \begin{description}
217 \item[point] sets the coordinates of the vertex and it can be either a tikz
218 coordinate tuple or a point already defined.
219 \item[text] The text of the vertex label.
220 \item[textcolor] The color of the label's text.
221 \item[anchora] The label anchor relative to the vertex: north, south, east,
222 west
223 \item[anchorb] The text's anchor relative to the label: above, below, right,
224 left
225 \end{description}
226
227
228 \begin{center}
229 \begin{minipage}{0.7\textwidth}
230 \begin{lstlisting}
231 \begin{polyhedron}{}
232 \vertex{point={0,0},status=normal}
233 \vertex{point={1,0},status=alert}
234 \vertex{point={2,0},status=open}
235 \vertex{point={3,0},color=red,pattern={north west lines}}
236 \vertex{point={4,0},color=orange,text={A}}
237 \end{polyhedron}
238 \end{lstlisting}
239 \end{minipage}
240 \hskip 2em
241 \begin{minipage}{0.2\textwidth}
242 \begin{polyhedron}{}
243 \vertex{point={0,0},status=normal}
244 \vertex{point={1,0},status=alert}
245 \vertex{point={2,0},status=open}
246 \vertex{point={3,0},color=red,pattern={north west lines}}
247 \vertex{point={4,0},color=orange,text={A}}
248 \end{polyhedron}
249 \end{minipage}
250 \end{center}
251
252
253
254 \subsubsection{Edges and Rays} The command \emph{edge} is used to draw an
255 edge from point A to point B.
256 The extra arguments are:
257 \begin{description}
258 \item[points] sets the coordinates of the vertices of the edge. It is a list
259 of (two) points in \{\}.
260 \end{description}
261
262
263 \begin{center}
264 \begin{minipage}{0.7\textwidth}
265 \begin{lstlisting}
266 \begin{polyhedron}{}
267 \edge{points={(0,0),(2,2)},status=alert}
268 \edge{points={(0,0),(2,3)},status=focus}
269 \edge{points={(0,0),(2,4)},status=open}
270 \edge{points={(0,0),(2,5)},color=orange}
271 \edge{points={(0,0),(2,6)},status=normal}
272 \edge{points={(2,1),(3,3)},thickness=3}
273 \edge{points={(4,1),(3,3)},pattern={dotted}}
274 \end{polyhedron}
275 \end{lstlisting}
276 \end{minipage}
277 \hskip 2em
278 \begin{minipage}{0.2\textwidth}
279 \begin{polyhedron}{}
280 \edge{points={(0,0),(2,2)},status=alert}
281 \edge{points={(0,0),(2,3)},status=focus}
282 \edge{points={(0,0),(2,4)},status=open}
283 \edge{points={(0,0),(2,5)},color=orange}
284 \edge{points={(0,0),(2,6)},status=normal}
285 \edge{points={(2,1),(3,3)},thickness=3}
286 \edge{points={(4,1),(3,3)},pattern={dotted}}
287 \end{polyhedron}
288 \end{minipage}
289 \end{center}
290
291 Similarly, the command \emph{ray} draw a ray.
292 The options are exactly the same as for edge.
293 Note that the sequence in which the points are given matters.
294 \begin{center}
295 \begin{minipage}{0.7\textwidth}
296 \begin{lstlisting}
297 \begin{polyhedron}{}
298 \ray{points={(0,0),(2,2)},status=alert}
299 \ray{points={(0,0),(2,3)},status=focus}
300 \ray{points={(0,0),(2,4)},status=open}
301 \ray{points={(0,0),(2,5)},color=orange}
302 \ray{points={(0,0),(2,6)},status=normal}
303 \ray{points={(2,1),(3,3)},thickness=3}
304 \ray{points={(4,1),(3,3)},pattern={dotted}}
305 \end{polyhedron}
306 \end{lstlisting}
307 \end{minipage}
308 \hskip 2em
309 \begin{minipage}{0.2\textwidth}
310 \begin{polyhedron}{}
311 \ray{points={(0,0),(2,2)},status=alert}
312 \ray{points={(0,0),(2,3)},status=focus}
313 \ray{points={(0,0),(2,4)},status=open}
314 \ray{points={(0,0),(2,5)},color=orange}
315 \ray{points={(0,0),(2,6)},status=normal}
316 \ray{points={(2,1),(3,3)},thickness=3}
317 \ray{points={(4,1),(3,3)},pattern={dotted}}
318 \end{polyhedron}
319 \end{minipage}
320 \end{center}
321
322 \subsubsection{Cone}
323
324 The command \emph{cone} is used to draw a polyhedral cone.
325 The extra arguments are:
326 \begin{description}
327 \item[vertex] Sets the apex of the cone.
328 \item[generators] A list of points
329 \item[openeness] A list of boolean values declaring the openness of a
330 simplicial cone.
331 \end{description}
332
333
334 \begin{center}
335 \begin{minipage}{0.7\textwidth}
336 \begin{lstlisting}
337 \begin{polyhedron}{}
338 \cone{vertex={(0,0)}, generators={(0,2),(2,2)},
339 status=alert}
340 \cone{vertex={(0,0)}, generators={(2,0),(2,-2)},
341 status=focus}
342 \end{polyhedron}
343 \end{lstlisting}
344 \end{minipage}
345 \hskip 2em
346 \begin{minipage}{0.2\textwidth}
347 \begin{polyhedron}{}
348 \cone{vertex={(0,0)}, generators={(0,2),(2,2)},status=alert}
349 \cone{vertex={(0,0)}, generators={(2,0),(2,-2)},status=focus}
350 \end{polyhedron}
351 \end{minipage}
352 \end{center}
353
354
355 \begin{center}
356 \begin{minipage}{0.7\textwidth}
357 \begin{lstlisting}
358 \begin{polyhedron}{}
359 \cone{vertex={(0,0)}, generators={(2,0),(2,-2)},
360 status=focus}
361 \cone{vertex={(3,2)},generators={(0,0),(2,-1)},
362 pattern={north east lines}}
363 \end{polyhedron}
364 \end{lstlisting}
365 \end{minipage}
366 \hskip 2em
367 \begin{minipage}{0.2\textwidth}
368 \begin{polyhedron}{}
369 \cone{vertex={(0,0)}, generators={(2,0),(2,-2)},status=focus}
370 \cone{vertex={(3,2)},generators={(0,0),(2,-1)},pattern={north east lines}}
371 \end{polyhedron}
372 \end{minipage}
373 \end{center}
374
375
376
377 \subsubsection{Polygon}
378
379 The command \emph{polygon} is used to draw a 2-dimensional polytope in 2D or 3D.
380 Attention must be paid in the sequence of the points given.
381 The command does not take the convex hull, but rather draws the polygonal
382 line defined by the sequence of points.
383
384 The extra arguments are:
385 \begin{description}
386 \item[points] The vertices of the cone.
387 \item[boundary] True or False, for drawing or not the boundary of the polygon.
388 \end{description}
389
390
391 \begin{center}
392 \begin{minipage}{0.7\textwidth}
393 \begin{lstlisting}
394 \begin{polyhedron}{}
395 \polygon{points={(0,2),(2,2),(2,0)},status=alert}
396 \polygon{points={(0,-2),(-2,-2),(-2,0)},status=open}
397 \polygon{points={(0,1),(0,0),(1,0),(1,1)},status=open,
398 boundary=false,color=orange}
399 \end{polyhedron}
400 \end{lstlisting}
401 \end{minipage}
402 \hskip 2em
403 \begin{minipage}{0.2\textwidth}
404 \begin{polyhedron}{}
405 \polygon{points={(0,2),(2,2),(2,0)},status=alert}
406 \polygon{points={(0,-2),(-2,-2),(-2,0)},status=open}
407 \polygon{points={(0,1),(0,0),(1,0),(1,1)},status=open,boundary=false,
408 color=orange}
409 \end{polyhedron}
410 \end{minipage}
411 \end{center}
412
413
414
415 \section{Known limitations and errors}
416
417
418 \end{document}