3 <title>Special objects - Sketch
</title>
4 <meta http-equiv=
"Content-Type" content=
"text/html">
5 <meta name=
"description" content=
"Sketch">
6 <meta name=
"generator" content=
"makeinfo 4.7">
7 <link title=
"Top" rel=
"start" href=
"index.html#Top">
8 <link rel=
"up" href=
"Introduction-by-example.html#Introduction-by-example" title=
"Introduction by example">
9 <link rel=
"prev" href=
"Drawing-a-solid.html#Drawing-a-solid" title=
"Drawing a solid">
10 <link rel=
"next" href=
"Object-transforms.html#Object-transforms" title=
"Object transforms">
11 <link href=
"http://www.gnu.org/software/texinfo/" rel=
"generator-home" title=
"Texinfo Homepage">
13 Copyright (C) 2005, 2006, 2007, 2008 Eugene K. Ressler.
15 This manual is for `sketch', version 0.2 (build 161),
16 Tuesday, September 08, 2009, a program that converts descriptions of simple
17 three-dimensional scenes into static drawings. This version generates
18 `PSTricks' or `PGF/TikZ' code suitable for use with the
19 TeX document processing system.
21 `Sketch' is free software; you can redistribute it and/or modify
22 it under the terms of the GNU General Public License as published by
23 the Free Software Foundation; either version 3, or (at your option)
26 Sketch is distributed in the hope that it will be useful,
27 but WITHOUT ANY WARRANTY; without even the implied warranty of
28 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 GNU General Public License for more details.
31 You should have received a copy of the GNU General Public License
32 along with `sketch'; see the file COPYING.txt. If not, see
33 http://www.gnu.org/copyleft.-->
34 <meta http-equiv=
"Content-Style-Type" content=
"text/css">
35 <style type=
"text/css"><!--
36 pre
.display
{ font-family:inherit
}
37 pre
.format
{ font-family:inherit
}
38 pre
.smalldisplay
{ font-family:inherit
; font-size:smaller
}
39 pre
.smallformat
{ font-family:inherit
; font-size:smaller
}
40 pre
.smallexample
{ font-size:smaller
}
41 pre
.smalllisp
{ font-size:smaller
}
42 span
.sc
{ font-variant:small-caps
}
43 span
.roman
{ font-family: serif
; font-weight: normal
; }
49 <a name=
"Special-objects"></a>Next:
<a rel=
"next" accesskey=
"n" href=
"Object-transforms.html#Object-transforms">Object transforms
</a>,
50 Previous:
<a rel=
"previous" accesskey=
"p" href=
"Drawing-a-solid.html#Drawing-a-solid">Drawing a solid
</a>,
51 Up:
<a rel=
"up" accesskey=
"u" href=
"Introduction-by-example.html#Introduction-by-example">Introduction by example
</a>
55 <!-- node-name, next, previous, up -->
56 <h3 class=
"section">2.4 Special objects
</h3>
59 <a name=
"index-labels-47"></a>to a drawing by using
<tt>special
</tt>
60 <a name=
"index-special-48"></a><a name=
"index-special-object-49"></a>objects, which provide a way to embed raw LaTeX and
<code>PSTricks
</code>
61 code. Adding this to the tetrahedron does the trick.
62 <pre class=
"verbatim">
63 special |\footnotesize
64 \uput{
2pt}[ur]#
1{$P1$}
72 <div align=
"center"><img src=
"ex042.png" alt=
"ex042.png"></div>
74 <p>There are several details to note here. First, the quoting convention
75 <a name=
"index-quoting_002c-special-50"></a>for the raw code is similar to the LaTeX
<tt>\verb
</tt> command. The
76 first non-white space character following
<tt>special
</tt> is
77 understood to be the quote character,
78 in this case
<span class=
"samp">|
</span>. The raw
79 text continues until this character recurs.
81 <p>Second, the argument references
82 <a name=
"index-argument_002c-special-51"></a><tt>#
1</tt>,
<tt>#
2</tt>,
<tt>#
3</tt>,
83 and
<tt>#
4</tt> refer to points in the list that follow. This is
84 similar to TeX macro syntax. The transformed and two-dimensional
85 projections of these three-dimensional points are substituted
86 <a name=
"index-substitution_002c-special-52"></a><a name=
"index-special-argument-substitution-53"></a>in the final output. An argument reference of the form
<tt>#
1-
2</tt>
87 is replaced with the angle in degrees of the two-dimensional vector
88 that connects the projections of the two respective argument points,
89 here
<tt>#
1</tt> and
<tt>#
2</tt>. The substituted angle is enclosed
90 in curly braces
<code>{ }
</code>
92 <p>By default,
<code>special
</code> objects are printed last, overlaying all
93 other objects in the scene. If you specify the internal option
94 <a name=
"index-internal-option-54"></a><a name=
"index-option_002c-internal-55"></a><code>lay=in
</code>, the hidden surface algorithm
95 <a name=
"index-lay-56"></a><a name=
"index-hidden-surface-algorithm-57"></a>considers the entire special object to be the first point
96 (
<tt>#
1</tt>) in the argument list. If that point is behind (of
97 smaller z-component than) any drawable, then the entire special
98 object is drawn before that drawable, so the drawable obscures parts of
99 the special object that overlaps it. In our example,
<tt>p1
</tt> is
100 the front-most point in the scene (has the largest
101 z-component), so adding
<code>lay=in
</code> has no effect.
103 <p>With option
<code>lay=under
</code>, a special is drawn
<em>before
</em>, hence
104 appears
<em>under
</em> any of the objects handled by the hidden surface
105 algorithm. This is how the light gray axes were added to the
“hello
106 world
” example
<a href=
"Hello-world.html#Hello-world">Hello world
</a>.
108 <p><tt>Special
</tt> objects are powerful, with many possible uses.