This file is indexed.

/usr/share/doc/sketch-doc/sketch/A-technical-drawing.html is in sketch-doc 1:0.3.7-6.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Copyright (C) 2005 to 2012 Eugene K. Ressler.

This manual is for sketch, version 0.3 (build 7),
Wednesday, August 23, 2017, a program that converts descriptions of simple
three-dimensional scenes into line drawings. This version generates
PSTricks or PGF/TikZ code suitable for use with the
TeX document processing system.

Sketch is free software. You can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.

Sketch is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with sketch; see the file COPYING.txt.  If not, see
http://www.gnu.org/copyleft.
 -->
<!-- Created by GNU Texinfo 6.4.90, http://www.gnu.org/software/texinfo/ -->
<head>
<title>A technical drawing (Sketch)</title>

<meta name="description" content="A technical drawing (Sketch)">
<meta name="keywords" content="A technical drawing (Sketch)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Index-of-syntax.html#Index-of-syntax" rel="index" title="Index of syntax">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Building-a-drawing.html#Building-a-drawing" rel="up" title="Building a drawing">
<link href="A-hierarchical-model.html#A-hierarchical-model" rel="next" title="A hierarchical model">
<link href="Overview.html#Overview" rel="prev" title="Overview">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>


</head>

<body lang="en">
<a name="A-technical-drawing"></a>
<div class="header">
<p>
Next: <a href="A-hierarchical-model.html#A-hierarchical-model" accesskey="n" rel="next">A hierarchical model</a>, Previous: <a href="Overview.html#Overview" accesskey="p" rel="prev">Overview</a>, Up: <a href="Building-a-drawing.html#Building-a-drawing" accesskey="u" rel="up">Building a drawing</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Index-of-syntax.html#Index-of-syntax" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="A-technical-drawing-1"></a>
<h3 class="section">4.2 A technical drawing</h3>
<p>Let&rsquo;s look at a drawing that represents the kind of problem
<code>sketch</code> was meant to solve&mdash;a pair of textbook figures
regarding a polygonal approximation of a truncated cone.  Here are the
pictures we will produce.
</p>
<div align="center"><img src="ex250.png" alt="ex250">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src="ex260.png" alt="ex260">
</div>
<p>The cone shape is just a swept line with no closure tag and culling
turned off.  Begin by setting up some useful constants.
<a name="index-def-11"></a>
<a name="index-rotate-11"></a>
</p><pre class="verbatim">  def O (0,0,0) def I [1,0,0] def J [0,1,0] def K [0,0,1]
  def p0 (1,2) def p1 (1.5,0) def N 8
  def seg_rot rotate(360 / N, [J])
</pre><p>The points <code>p0</code> and <code>p1</code> are the end points of the line to
be swept.  The definition <code>seg_rot</code> is the sweep transformation.
With these, the cone itself is simple.
<a name="index-sweep-8"></a>
<a name="index-cull-3"></a>
<a name="index-line-7"></a>
<a name="index-swept-line-2"></a>
<a name="index-line-sweep-2"></a>
</p><pre class="verbatim">  sweep[cull=false] { N, [[seg_rot]] } line(p0)(p1)
</pre>
<p>The axes are next and include an interesing trick that shows the
hidden parts as dotted lines.  The secret is draw the axes
twice&mdash;solid lines with the normal
<a name="index-hidden-surface-algorithm-3"></a>
hidden surface algorithm in effect, and then dotted with the
option
<a name="index-lay-2"></a>
<code>lay=over</code> so that no polygons can hide them.
<a name="index-def-12"></a>
<a name="index-line-8"></a>
<a name="index-arrows-3"></a>
<a name="index-linewidth-3"></a>
<a name="index-lay-3"></a>
<a name="index-linestyle-2"></a>
<a name="index-special-3"></a>
</p><pre class="verbatim">  def ax (dx,0,0) % tips of the axes
  def ay (0,dy,0)
  def az (0,0,dz)
  line[arrows=&lt;-&gt;,linewidth=.4pt](ax)(O)(ay)
  line[arrows=-&gt;,linewidth=.4pt](O)(az)
  % repeat dotted as an overlay to hint at the hidden lines
  line[lay=over,linestyle=dotted,linewidth=.4pt](ax)(O)(ay)
  line[lay=over,linestyle=dotted,linewidth=.4pt](O)(az)
  special|\footnotesize
          \uput[d]#1{$x$}\uput[u]#2{$y$}\uput[l]#3{$z$}|
    (ax)(ay)(az)
</pre><p>The labels are applied with <code>PSTricks</code> special objects 
<a name="index-special-objects"></a>
as usual.
</p>
<p>For the height dimension mark, the power of affine 
<a name="index-affine-arithmetic-1"></a>
arithetic is very helpful.
<a name="index-def-13"></a>
<a name="index-unit-1"></a>
<a name="index-scale-2"></a>
<a name="index-line-9"></a>
<a name="index-special-4"></a>
</p><pre class="verbatim">  def hdim_ref unit((p1) - (O)) then [[seg_rot]]^2
  def c0 (p0) then scale([J])
  def h00 (c0) + 1.1 * [hdim_ref]
  def h01 (c0) + 1.9 * [hdim_ref]
  def h02 (c0) + 1.8 * [hdim_ref]
  line(h00)(h01)
  def h10 (O) + 1.6 * [hdim_ref]
  def h11 (O) + 1.9 * [hdim_ref]
  def h12 (O) + 1.8 * [hdim_ref]
  line(h10)(h11)
  line[arrows=&lt;-&gt;](h02)(h12)
  def hm2 ((h02) - (O) + (h12) - (O)) / 2 + (O)
  special|\footnotesize\rput*#1{$h$}|(hm2)
</pre><p>The general idea employed here is to compute a unit &ldquo;reference
vector&rdquo; parallel to the <em>xz</em>-plane in the desired direction of
the dimension from the origin.  The transformation
<code>[[seg_rot]]^2</code> rotates two segments about the <em>y</em>-axis.
When applied to <code>(p1) - (O)</code>, the resulting vector points to the
right as shown.  In this manner, we can pick any vertex as the
location of the height dimension lines by varying the exponent of
<code>[[seg_rot]]</code>.  This is only one of many possible strategies.
</p>
<p>The computation of <code>hm2</code> is a useful idiom for finding the
<a name="index-centroid"></a>
centroid of a set of points.
</p>
<p>The two radius marks are done similarly, so we present the code
without comment.
<a name="index-def-14"></a>
<a name="index-line-10"></a>
<a name="index-special-5"></a>
<a name="index-scale-3"></a>
<a name="index-arrows-4"></a>
</p><pre class="verbatim">  % radius measurement marks
  def gap [0,.2,0]  % used to create small vertical gaps

  % first r1
  def up1 [0,3.1,0] % tick rises above dimension a little
  def r1 ((p1) then [[seg_rot]]^-2) + [up1]
  def r1c (r1) then scale([J])
  def r1t (r1) + [gap]
  def r1b ((r1t) then scale([1,0,1])) + [gap]
  line[arrows=&lt;-&gt;](r1c)(r1)  % dimension line
  line(r1b)(r1t)             % tick
  def r1m ((r1) - (O) + (r1c) - (O)) / 2 + (O) % label position
  special |\footnotesize\rput*#1{$r_1$}|(r1m)  % label

  % same drill for r0, but must project down first
  def up0 [0,2.7,0]
  def r0 ((p0) then scale([1,0,1]) then [[seg_rot]]^-2) + [up0]
  def r0c (r0) then scale([J])
  def r0t (r0) + [gap]
  def r0b ((p0) then [[seg_rot]]^-2) + [gap]
  line[arrows=&lt;-&gt;](r0c)(r0)
  line(r0b)(r0t)
  def r0m ((r0) - (O) + (r0c) - (O)) / 2 + (O)
  special |\footnotesize\rput*#1{$r_0$}|(r0m)
</pre>
<p>The second drawing uses the same techniques.  Only the method for
drawing the elliptical arc is new.  Here is the code.
<a name="index-def-15"></a>
<a name="index-special-6"></a>
<a name="index-lay-4"></a>
</p><pre class="verbatim">  def mid ((p00)-(O)+(p10)-(O)+(p11)-(O)+(p01)-(O))/4+(O)
  special|\rput#1{\pscustom{
    \scale{1 1.3}
    \psarc[arrowlength=.5]{-&gt;}{.25}{-60}{240}}}|
    [lay=over](mid)
</pre><p>We could have swept a point to make the arc with <code>sketch</code>, but
using a <code>PSTricks</code> custom graphic was simpler.  Again we computed
the 
<a name="index-centroid-1"></a>
centroid of the quadrilateral by averaging points.  Note that scaling
in Postscript distorts the arrowhead, but in this case the distortion
actually looks better in the projection of the slanted face.  A
<code>sketch</code> arrowhead would not have been distorted.
</p>
<p>The complete code for this example, which draws either figure
depending on the definition of the tag <code>&lt;labeled&gt;</code>, is included
in the <code>sketch</code> distribution in the file <samp>truncatedcone.sk</samp>.
</p>
<hr>
<div class="header">
<p>
Next: <a href="A-hierarchical-model.html#A-hierarchical-model" accesskey="n" rel="next">A hierarchical model</a>, Previous: <a href="Overview.html#Overview" accesskey="p" rel="prev">Overview</a>, Up: <a href="Building-a-drawing.html#Building-a-drawing" accesskey="u" rel="up">Building a drawing</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Index-of-syntax.html#Index-of-syntax" title="Index" rel="index">Index</a>]</p>
</div>



</body>
</html>