3 <title>Swept 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=
"Repeated-objects.html#Repeated-objects" title=
"Repeated objects">
10 <link href=
"http://www.gnu.org/software/texinfo/" rel=
"generator-home" title=
"Texinfo Homepage">
12 Copyright (C) 2005, 2006, 2007, 2008 Eugene K. Ressler.
14 This manual is for `sketch', version 0.2 (build 161),
15 Tuesday, September 08, 2009, a program that converts descriptions of simple
16 three-dimensional scenes into static drawings. This version generates
17 `PSTricks' or `PGF/TikZ' code suitable for use with the
18 TeX document processing system.
20 `Sketch' is free software; you can redistribute it and/or modify
21 it under the terms of the GNU General Public License as published by
22 the Free Software Foundation; either version 3, or (at your option)
25 Sketch is distributed in the hope that it will be useful,
26 but WITHOUT ANY WARRANTY; without even the implied warranty of
27 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 GNU General Public License for more details.
30 You should have received a copy of the GNU General Public License
31 along with `sketch'; see the file COPYING.txt. If not, see
32 http://www.gnu.org/copyleft.-->
33 <meta http-equiv=
"Content-Style-Type" content=
"text/css">
34 <style type=
"text/css"><!--
35 pre
.display
{ font-family:inherit
}
36 pre
.format
{ font-family:inherit
}
37 pre
.smalldisplay
{ font-family:inherit
; font-size:smaller
}
38 pre
.smallformat
{ font-family:inherit
; font-size:smaller
}
39 pre
.smallexample
{ font-size:smaller
}
40 pre
.smalllisp
{ font-size:smaller
}
41 span
.sc
{ font-variant:small-caps
}
42 span
.roman
{ font-family: serif
; font-weight: normal
; }
48 <a name=
"Swept-objects"></a>Previous:
<a rel=
"previous" accesskey=
"p" href=
"Repeated-objects.html#Repeated-objects">Repeated objects
</a>,
49 Up:
<a rel=
"up" accesskey=
"u" href=
"Introduction-by-example.html#Introduction-by-example">Introduction by example
</a>
53 <!-- node-name, next, previous, up -->
54 <h3 class=
"section">2.7 Swept objects
</h3>
56 <p><a name=
"index-swept-object-91"></a><a name=
"index-sweep-92"></a>Many familiar shapes can be generated by sweeping simpler ones through
57 space and considering the resulting path, surface, or volume.
58 <code>Sketch
</code> implements this idea in the
<tt>sweep
</tt> command.
59 <a name=
"index-sweep-93"></a><a name=
"index-rotate-94"></a>
60 <pre class=
"verbatim">
62 sweep { n_segs, rotate(
180 / n_segs, (
0,
0,
0), [
0,
0,
1]) } (
1,
0,
0)
64 This code sweeps the point (
1,
0,
0)
65 <a name=
"index-point-sweep-95"></a><a name=
"index-swept-point-96"></a>eight times by rotating it
66 180/
8 =
22.5 degrees each time and connecting the resulting
67 points with line segments. The
<tt>def
</tt> used here is a
68 <dfn>scalar
</dfn> definition.
69 <a name=
"index-definition_002c-scalar-97"></a><a name=
"index-scalar-definition-98"></a>References to
70 <a name=
"index-reference_002c-scalar-99"></a>scalars have no enclosing brackets at all.
73 <li><a accesskey=
"1" href=
"Point-sweeps.html#Point-sweeps">Point sweeps
</a>: Swept points make lines and polygons.
74 <li><a accesskey=
"2" href=
"Polyline-sweeps.html#Polyline-sweeps">Polyline sweeps
</a>: Swept lines make surfaces.
75 <li><a accesskey=
"3" href=
"Nested-sweeps.html#Nested-sweeps">Nested sweeps
</a>: Swept sweeps are useful!
76 <li><a accesskey=
"4" href=
"Polygon-sweeps.html#Polygon-sweeps">Polygon sweeps
</a>: Swept polygons make solids...
77 <li><a accesskey=
"5" href=
"Polyline-sweeps-with-closure.html#Polyline-sweeps-with-closure">Polyline sweeps with closure
</a>: and so do closed polyline sweeps.
78 <li><a accesskey=
"6" href=
"Affine-arithmetic.html#Affine-arithmetic">Affine arithmetic
</a>: Sketch useful math expression.
79 <li><a accesskey=
"7" href=
"More-to-learn.html#More-to-learn">More to learn
</a>: Check out the Mobius strip!