214 lines
7.7 KiB
HTML
214 lines
7.7 KiB
HTML
<!-- Creator : groff version 1.24.1 -->
|
|
<!-- CreationDate: Mon Mar 16 21:28:01 2026 -->
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
|
"http://www.w3.org/TR/html4/loose.dtd">
|
|
<html>
|
|
<head>
|
|
<meta name="generator" content="groff -Thtml, see www.gnu.org">
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
|
<meta name="Content-Style" content="text/css">
|
|
<style type="text/css">
|
|
p { margin-top: 0; margin-bottom: 0; vertical-align: top }
|
|
pre { margin-top: 0; margin-bottom: 0; vertical-align: top }
|
|
table { margin-top: 0; margin-bottom: 0; vertical-align: top }
|
|
h1 { text-align: center }
|
|
</style>
|
|
<title>pic-3.html</title>
|
|
|
|
</head>
|
|
<hr>
|
|
[ <a href="pic-2.html">prev</a> | <a href="pic-4.html">next</a> | <a href="pic.html">top</a> ]
|
|
<hr>
|
|
|
|
|
|
<h2>3. Basic PIC Concepts
|
|
<a name="3. Basic PIC Concepts"></a>
|
|
</h2>
|
|
|
|
|
|
<p style="margin-top: 1em">Pictures are described
|
|
procedurally, as collections of objects connected by
|
|
motions. Normally, <b>pic</b> tries to string together
|
|
objects left-to-right in the sequence they are described,
|
|
joining them at visually natural points. Here is an example
|
|
illustrating the flow of data in <b>pic</b> processing:</p>
|
|
|
|
|
|
<p align="center" style="margin-top: 1em"><img src="img/pic-1.png" alt="Image img/pic-1.png"></p>
|
|
|
|
<p align="center" style="margin-top: 1em">Figure 3-1: Flow
|
|
of <b>pic</b> data</p>
|
|
|
|
<p style="margin-top: 1em">This was produced from the
|
|
following <b>pic</b> program:</p>
|
|
|
|
<p style="margin-left:9%; margin-top: 1em">.PS <br>
|
|
ellipse "document"; <br>
|
|
arrow; <br>
|
|
box width 0.6 "\fIgpic\/\fP(1)" <br>
|
|
arrow; <br>
|
|
box width 1.1 "\fIgtbl\/\fP(1) or \fIgeqn\/\fP(1)"
|
|
"(optional)" dashed; <br>
|
|
arrow; <br>
|
|
box width 0.6 "\fIgtroff\/\fP(1)"; <br>
|
|
arrow; <br>
|
|
ellipse "PostScript" <br>
|
|
.PE</p>
|
|
|
|
<p style="margin-top: 1em">This little program illustrates
|
|
several <b>pic</b> basics. Firstly, we see how to invoke
|
|
three object types; ellipses, arrows, and boxes. We see how
|
|
to declare text lines to go within an object (and that text
|
|
can have font changes in it). We see how to change the line
|
|
style of an object from solid (the default) to dashed. And
|
|
we see that a box can be made wider than its default size to
|
|
accommodate more text (we’ll discuss this facility in
|
|
detail in the next section).</p>
|
|
|
|
<p style="margin-top: 1em">We also get to see
|
|
<b>pic</b>’s simple syntax. Statements are ended by
|
|
newlines or semicolons. String quotes are required around
|
|
all text arguments, whether or not they contain spaces. In
|
|
general, the order of command arguments and modifiers like
|
|
“width 1.2” or “dashed”
|
|
doesn’t matter, except that the order of text
|
|
arguments is significant.</p>
|
|
|
|
<p style="margin-top: 1em">Here are all but two of the
|
|
basic <b>pic</b> objects at their default sizes:</p>
|
|
|
|
|
|
<p align="center" style="margin-top: 1em"><img src="img/pic-2.png" alt="Image img/pic-2.png"></p>
|
|
|
|
<p align="center" style="margin-top: 1em">Figure 3-2: Basic
|
|
<b>pic</b> objects</p>
|
|
|
|
<p style="margin-top: 1em">The missing simple object types
|
|
are <i>spline</i> and <i>polygon</i>. There is also a way to
|
|
collect objects into <i>block composites</i> which allows
|
|
you to treat the whole group as a single object (resembling
|
|
a box) for many purposes. We’ll describe all of these
|
|
later on.</p>
|
|
|
|
<p style="margin-top: 1em">The box, ellipse, circle, and
|
|
block composite objects are <i>closed</i>; lines, arrows,
|
|
arcs and splines are <i>open</i>. Polygons are a special
|
|
case drawn using the syntax of open objects, but with most
|
|
of the attributes of closed objects. This distinction is
|
|
often important in explaining command modifiers.</p>
|
|
|
|
<p style="margin-top: 1em">Figure 3-2 was produced by the
|
|
following <b>pic</b> program, which introduces some more
|
|
basic concepts:</p>
|
|
|
|
<p style="margin-left:9%; margin-top: 1em">.PS <br>
|
|
box "box"; <br>
|
|
move; <br>
|
|
line "line" ""; <br>
|
|
move; <br>
|
|
arrow "arrow" ""; <br>
|
|
move; <br>
|
|
circle "circle"; <br>
|
|
move; <br>
|
|
ellipse "ellipse"; <br>
|
|
move; <br>
|
|
arc; down; move; "arc" <br>
|
|
.PE</p>
|
|
|
|
<p style="margin-top: 1em">The first thing to notice is the
|
|
<i>move</i> command, which moves a default distance (1/2
|
|
inch) in the current movement direction.</p>
|
|
|
|
<p style="margin-top: 1em">Secondly, see how we can also
|
|
decorate lines and arrows with text. The line and arrow
|
|
commands each take two arguments here, specifying text to go
|
|
above and below the object. If you wonder why one argument
|
|
would not do, contemplate the output of <b>arrow
|
|
"ow!"</b>:</p>
|
|
|
|
|
|
<p align="center" style="margin-top: 1em"><img src="img/pic-3.png" alt="Image img/pic-3.png"></p>
|
|
|
|
<p align="center" style="margin-top: 1em">Figure 3-3: Text
|
|
centered on an arrow</p>
|
|
|
|
<p style="margin-top: 1em">When a command takes one text
|
|
string, <b>pic</b> tries to place it at the object’s
|
|
geometric center. As you add more strings, <b>pic</b> treats
|
|
them as a vertical block to be centered. The program</p>
|
|
|
|
<p style="margin-left:9%; margin-top: 1em">line
|
|
"1"; <br>
|
|
line "1" "2"; <br>
|
|
line "1" "2" "3"; <br>
|
|
line "1" "2" "3"
|
|
"4"; <br>
|
|
line "1" "2" "3" "4"
|
|
"5";</p>
|
|
|
|
<p style="margin-top: 1em">for example, gives you this:</p>
|
|
|
|
|
|
<p align="center" style="margin-top: 1em"><img src="img/pic-4.png" alt="Image img/pic-4.png"></p>
|
|
|
|
<p align="center" style="margin-top: 1em">Figure 3-4:
|
|
Effects of multiple text arguments</p>
|
|
|
|
<p style="margin-top: 1em">The last line of Figure
|
|
3-2’s program, ‘<b>arc; down; move;
|
|
"arc"</b>’, describing the captioned arc,
|
|
introduces several new ideas. Firstly, we see how to change
|
|
the direction in which objects are joined. Had we written
|
|
<b>arc; move; "arc"</b>, omitting <b>down</b> the
|
|
caption would have been joined to the top of the arc, like
|
|
this:</p>
|
|
|
|
|
|
<p align="center" style="margin-top: 1em"><img src="img/pic-5.png" alt="Image img/pic-5.png"></p>
|
|
|
|
<p align="center" style="margin-top: 1em">Figure 3-5:
|
|
Result of <b>arc; move; "arc"</b></p>
|
|
|
|
<p style="margin-top: 1em">This is because drawing an arc
|
|
changes the default direction to the one its exit end points
|
|
at. To reinforce this point, consider:</p>
|
|
|
|
|
|
<p align="center" style="margin-top: 1em"><img src="img/pic-6.png" alt="Image img/pic-6.png"></p>
|
|
|
|
<p align="center" style="margin-top: 1em">Figure 3-6:
|
|
Result of <b>arc cw; move; "arc"</b></p>
|
|
|
|
<p style="margin-top: 1em">All we’ve done differently
|
|
here is specify “cw” for a clockwise arc
|
|
(“ccw” specifies counter-clockwise direction).
|
|
Observe how it changes the default direction to down, rather
|
|
than up.</p>
|
|
|
|
<p style="margin-top: 1em">Another good way to see this via
|
|
with the following program:</p>
|
|
|
|
<p style="margin-left:9%; margin-top: 1em">line; arc; arc
|
|
cw; line</p>
|
|
|
|
<p style="margin-top: 1em">which yields:</p>
|
|
|
|
|
|
<p align="center" style="margin-top: 1em"><img src="img/pic-7.png" alt="Image img/pic-7.png"></p>
|
|
|
|
<p align="center" style="margin-top: 1em">Figure 3-7:
|
|
Result of <b>line; arc; arc cw; line</b></p>
|
|
|
|
<p style="margin-top: 1em">Notice that we did not have to
|
|
specify “up” for the second arc to be joined to
|
|
the end of the first.</p>
|
|
|
|
<p style="margin-top: 1em">Finally, observe that a string,
|
|
alone, is treated as text to be surrounded by an invisible
|
|
box of a size either specified by width and height
|
|
attributes or by the defaults <b>textwid</b> and
|
|
<b>textht</b>. Both are initially zero (because we
|
|
don’t know the default font size).</p>
|
|
<hr>
|
|
[ <a href="pic-2.html">prev</a> | <a href="pic-4.html">next</a> | <a href="pic.html">top</a> ]
|
|
<hr>
|