summaryrefslogtreecommitdiff
path: root/static/unix-v10/man1/ideal.1
blob: 38f6740ac12449b3a993f0f4c45324f277d79c58 (plain)
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
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
.TH IDEAL 1
.CT 1 writing_troff graphics
.SH NAME
ideal \(mi troff preprocessor for drawing pictures
.SH SYNOPSIS
.B ideal
[
.I option ...
]
[
.I file ...
]
.SH DESCRIPTION
.I Ideal
is a constraint-based
.IR troff (1)
preprocessor for typesetting figures in the complex plane.
A line beginning 
.L .IS
marks the start of an
.I ideal
program,
.B .IE
or
.BR .IF 
marks the end.
.B .IE
leaves the typesetting baseline below the bottom of the picture;
.B .IF
(flyback) leaves it at the top.
The options are
.TP
.BI -T dev
Produce instructions for
.IR troff (1)
device
.I dev.
.B -a
is a synonym for
.BR -Taps ;
.B -t
for
.BR -T202 .
.TP
.B -tex
Produce output for
.IR tex (1).
.TP
.B -p
Produce
.IR plot (1)
instructions.
Erases come unbidden at every
.BR .IS .
.TP
.B -4
Produce instructions for a Tektronix
4014 and wait at each
.B .IE
for an input character
before erasing and starting the next picture.
.TP
.B -n
Produce raw
.IR ideal
output, which passes unharmed through
.I nroff.
.TP
.B -v
Print calculated values of variables on standard error.
.PP
.I Ideal
programs are built of
`boxes';
boxes look like C functions,
in that they are named and delimited by braces.
They may include the following kinds of statements,
each terminated by a semicolon:
.TF spline
.TP
.B var
declares one or more complex variables local to the box.
Variable names are made up of letters and digits, and
start with a letter; do not use any of the following
keywords as variable names:
.LR at ,
.LR bdlist ,
.LR boundary ,
.LR box ,
.LR conn ,
.LR construct ,
.LR draw ,
.LR exterior ,
.LR interior ,
.LR left ,
.LR opaque ,
.LR put ,
.LR right ,
.LR spline ,
.LR text ,
.LR to ,
.LR using ,
.L var
.TP
.I equation
declares relative positions of significant points of the box
.TP
.B conn
asks for a straight-line path through named points
.TP
.B pen
asks for a box to be replicated along a line between two points
.TP
.B left
left-justifies text with respect to a point
.TP
.B text
centers text with respect to a point
.TP
.B right
right-justifies text with respect to a point
.TP
.B spline
draws a spline guided by the named points
.TP
.B put
asks for an instance of a box to be drawn
.TP
.B opaque
asks for a box to erase lines already in the picture that
are covered by its bounding polygon
.TP
.B boundary
specifies the bounding polygon for an opaque box
.TP
.B construct
builds a partial picture on a separate `sheet of paper'
.TP
.B draw
adds the contents of the named constructed box to the current picture
.PD
.PP
.I Ideal
expects all components of a picture to be specified as boxes;
instructions to draw the entire picture should comprise a box called
.LR main .
Boxes are remembered across
.BR .IS / .IE
boundaries;
if you won't need a box again, you can reclaim the
space it requires by including the command
.BI ...forget " boxname"
on a line between any
.BR .IS / .IE
pair after the last use of
.I boxname.
Box
.L main
is an exception to this rule:
it is always forgotten at
.BR .IE .
.PP
During its first pass,
.I ideal
solves all the equations to determine the locations of all points
it needs to know.
These equations must be linear equations in complex variables,
although they may include non-linear operators:
.I ideal
plugs in for as many variables, and does as much function evaluation,
as it can before solving the linear equation.
It waits until it has absolutely no hope of reducing an equation
to a linear equation before complaining.
.I Ideal
knows about the following functions:
.TF f[z,w]
.TP
.IB f [ z , w ]
.I == z+(w-z)f,
fraction
.I f
of the way from
.I z
to 
.I w
.TP
.BI re( z )
real part of complex number
.TP
.BI im( z )
imaginary part of complex number
.TP
.BI conj( z )
complex conjugate of complex number
.TP
.BI abs( z )
absolute value (modulus) of complex number
.TP
.BI cis( z )
the unit vector 
.if n .ig
$cos^x~+~i^sin^x$,
..
.if t .ig
cos(x) + i*sin(x)
..
where
.IR x " = re(" z )
and
.I x
is measured in degrees
(radians if the line
.B ...radians
appeared more
recently in the file than the line
.BR ...degrees )
.TP
.BI E( x )
.RI "== cis(360 x )
if
.I x
is measured in degrees
.TP
.BI angle( z )
angle of complex number,
.RI arctan(im( z )/re( z ))
.PD
.PP
During the second pass,
.I ideal
draws the picture.
.PP
To draw a circle,
include the line
.B ...libfile circle
between the
.B .IS
and
.B .IE
lines,
and
.B put
the box named
.LR circle ,
giving enough information that
the circle can be determined;
for instance, give the center and the radius,
or give three points through which the circle passes,
or give the center and a point on the circle.
The circle has center
.LR center ,
radius
.LR radius ,
and passes through
.BR z1 ,
.BR z2 ,
and
.B z3.
.PP
To draw an arc,
include the line
.B ...libfile arc
between the
.B .IS
and
.B .IE
lines,
and
.B put
the box named
.LR arc ,
again giving enough information to determine the arc;
for instance, give the center, radius, and starting and ending angles,
or give three points on the arc--where to start, where to end, and somewhere
in between.
The arc has center
.LR center ,
radius
.LR radius ,
starts at point
.LR start ,
passes through point
.L midway
at angle
.LR midang ,
and
ends at point
.L end
at angle
.LR endang .
If no
.L midway
is specified, the arc is drawn counterclockwise from
.L start
to
.LR end .
.PP
The picture will be scaled to a default width of four inches
and centered in a column of six inches.
The default width can be changed by a
.B ...width
command,
which includes a number in inches.
The default column width can be changed by a
.B ...colwid
command.
To defeat
.I ideal's
notion of the size of the picture, you can include lines of
the form
.BR ...minx ,
.BR ...miny ,
.BR ...maxx ,
or
.BR ...maxy ;
these give the various coordinates of the bounding box of the
picture in the coordinate system used by the picture.
.PP
.I Ideal
supports both C-style comments (between
.L /*
and
.L */
brackets \(em which nest),
and shell-style comments (between
.L #
and newline).
.SH EXAMPLES
.EX
.mk
\&...libfile circle
triangle {
	var z1, z2, z3;
	conn z1 to z2 to z3 to z1;
}
main {
	put T: triangle { 
		z1 = 0; z2 = 1; z3 = (2,2);
	}
	put circle {
		z1 = T.z1; z2 = T.z2; z3 = T.z3;
	}
}
.EE
.de xx
..
.if n .ig xx
.rt
.IS
...width 6
...libfile circle
...minx -8
triangle {
	var z1, z2, z3;
	conn z1 to z2 to z3 to z1;
}
main {
	put T: triangle { 
		z1 = 0; z2 = 1; z3 = (2,2);
	}
	put circle {
		z1 = T.z1; z2 = T.z2; z3 = T.z3;
	}
}
.IE
.xx
.SH "SEE ALSO"
.IR troff (1),
.IR pic (1), 
.IR ped (9.1), 
.IR doctype (1)
.br
C. J. Van Wyk,
`IDEAL User's Manual',
this manual, Volume 2
.SH BUGS
.I Ideal
is relatively unforgiving about syntax errors.
.br
Bounding box computation is naive for arcs and text strings.