|
|
1.1 root 1: .EQ
2: delim $$
3: .EN
4: .TH IDEAL 1
5: .CT 1 writing_troff graphics
6: .SH NAME
7: ideal \(mi troff preprocessor for drawing pictures
8: .SH SYNOPSIS
9: .B ideal
10: [
11: .BI -p
12: ]
13: [
14: .BI -4
15: ]
16: [
17: .BI -n
18: ]
19: [
20: .I file ...
21: ]
22: .SH DESCRIPTION
23: .I Ideal
24: is a constraint-based
25: .IR troff (1)
26: preprocessor for typesetting figures in the complex plane.
27: A line beginning
28: .L .IS
29: marks the start of an
30: .I ideal
31: program,
32: .B .IE
33: or
34: .BR .IF
35: marks the end.
36: .B .IE
37: leaves the typesetting baseline below the bottom of the picture;
38: .B .IF
39: (flyback) leaves it at the top.
40: .PP
41: Under option
42: .BR -p ,
43: .I ideal
44: produces
45: .IR plot (1)
46: instructions.
47: Erases come unbidden at every
48: .BR .IS ,
49: so you might prefer using the
50: .B -4
51: option, which produces instructions for a Tektronix
52: 4014, and waits at each
53: .B .IE
54: for an input character
55: before erasing and starting the next picture.
56: The
57: .B -n
58: option produces raw
59: .IR ideal
60: output, which passes unharmed through
61: .I nroff.
62: .PP
63: .I Ideal
64: programs are built of
65: `boxes';
66: boxes look like C functions,
67: in that they are named and delimited by braces.
68: They may include the following kinds of statements,
69: each terminated by a semicolon:
70: .TF spline
71: .TP
72: .B var
73: declares one or more complex variables local to the box.
74: Variable names are made up of letters and digits, and
75: start with a letter; do not use any of the following
76: keywords as variable names:
77: .LR at ,
78: .LR bdlist ,
79: .LR boundary ,
80: .LR box ,
81: .LR conn ,
82: .LR construct ,
83: .LR draw ,
84: .LR exterior ,
85: .LR interior ,
86: .LR left ,
87: .LR opaque ,
88: .LR put ,
89: .LR right ,
90: .LR spline ,
91: .LR text ,
92: .LR to ,
93: .LR using ,
94: .L var
95: .TP
96: .I equation
97: declares relative positions of significant points of the box
98: .TP
99: .B conn
100: asks for a straight-line path through named points
101: .TP
102: .B pen
103: asks for a box to be replicated along a line between two points
104: .TP
105: .B left
106: left-justifies text with respect to a point
107: .TP
108: .B text
109: centers text with respect to a point
110: .TP
111: .B right
112: right-justifies text with respect to a point
113: .TP
114: .B spline
115: draws a spline guided by the named points
116: .TP
117: .B put
118: asks for an instance of a box to be drawn
119: .TP
120: .B opaque
121: asks for a box to erase lines already in the picture that
122: are covered by its bounding polygon
123: .TP
124: .B boundary
125: specifies the bounding polygon for an opaque box
126: .TP
127: .B construct
128: builds a partial picture on a separate `sheet of paper'
129: .TP
130: .B draw
131: adds the contents of the named constructed box to the current picture
132: .PD
133: .PP
134: .I Ideal
135: expects all components of a picture to be specified as boxes;
136: instructions to draw the entire picture should comprise a box called
137: .LR main .
138: Boxes are remembered across
139: .BR .IS / .IE
140: boundaries;
141: if you won't need a box again, you can reclaim the
142: space it requires by including the command
143: .BI ...forget " boxname"
144: on a line between any
145: .BR .IS / .IE
146: pair after the last use of
147: .I boxname.
148: Box
149: .L main
150: is an exception to this rule:
151: it is always forgotten at
152: .BR .IE .
153: .PP
154: During its first pass,
155: .I ideal
156: solves all the equations to determine the locations of all points
157: it needs to know.
158: These equations must be linear equations in complex variables,
159: although they may include non-linear operators:
160: .I ideal
161: plugs in for as many variables, and does as much function evaluation,
162: as it can before solving the linear equation.
163: It waits until it has absolutely no hope of reducing an equation
164: to a linear equation before complaining.
165: .I Ideal
166: knows about the following functions:
167: .TF f[z,w]
168: .TP
169: .IB f [ z , w ]
170: $==~z+ (w-z)f $,
171: fraction $f$ of the way from $z$ to $w$
172: .TP
173: .BI re( z )
174: real part of complex number
175: .TP
176: .BI im( z )
177: imaginary part of complex number
178: .TP
179: .BI conj( z )
180: complex conjugate of complex number
181: .TP
182: .BI abs( z )
183: absolute value (modulus) of complex number
184: .TP
185: .BI cis( z )
186: the unit vector $cos^x~+~i^sin^x$, where
187: $x~=~roman re (z)$ and $x$ is measured in degrees
188: (radians if the line
189: .B ...radians
190: appeared more
191: recently in the file than the line
192: .BR ...degrees )
193: .TP
194: .BI E( x )
195: $==~roman cis (360x)$ if $x$ is measured in degrees
196: .TP
197: .BI angle( z )
198: angle of complex number,
199: $ roman arctan ( roman im (z)/ roman re(z))$
200: .PD
201: .PP
202: During the second pass,
203: .I ideal
204: draws the picture.
205: .PP
206: To draw a circle,
207: include the line
208: .B ...libfile circle
209: between the
210: .B .IS
211: and
212: .B .IE
213: lines,
214: and
215: .B put
216: the box named
217: .LR circle ,
218: giving enough information that
219: the circle can be determined;
220: for instance, give the center and the radius,
221: or give three points through which the circle passes,
222: or give the center and a point on the circle.
223: The circle has center
224: .LR center ,
225: radius
226: .LR radius ,
227: and passes through
228: .BR z1 ,
229: .BR z2 ,
230: and
231: .B z3.
232: .PP
233: To draw an arc,
234: include the line
235: .B ...libfile arc
236: between the
237: .B .IS
238: and
239: .B .IE
240: lines,
241: and
242: .B put
243: the box named
244: .LR arc ,
245: again giving enough information to determine the arc;
246: for instance, give the center, radius, and starting and ending angles,
247: or give three points on the arc--where to start, where to end, and somewhere
248: in between.
249: The arc has center
250: .LR center ,
251: radius
252: .LR radius ,
253: starts at point
254: .LR start ,
255: passes through point
256: .L midway
257: at angle
258: .LR midang ,
259: and
260: ends at point
261: .L end
262: at angle
263: .LR endang .
264: If no
265: .L midway
266: is specified, the arc is drawn counterclockwise from
267: .L start
268: to
269: .LR end .
270: .PP
271: The picture will be scaled to a default width of four inches
272: and centered in a column of six inches.
273: The default width can be changed by a
274: .B ...width
275: command,
276: which includes a number in inches.
277: The default column width can be changed by a
278: .B ...colwid
279: command.
280: To defeat
281: .I ideal's
282: notion of the size of the picture, you can include lines of
283: the form
284: .BR ...minx ,
285: .BR ...miny ,
286: .BR ...maxx ,
287: or
288: .BR ...maxy ;
289: these give the various coordinates of the bounding box of the
290: picture in the coordinate system used by the picture.
291: .PP
292: .I Ideal
293: supports both C-style comments (between
294: .L /*
295: and
296: .L */
297: brackets \(em which nest),
298: and shell-style comments (between
299: .L #
300: and newline).
301: .SH EXAMPLES
302: .EX
303: .mk
304: \&...libfile circle
305: triangle {
306: var z1, z2, z3;
307: conn z1 to z2 to z3 to z1;
308: }
309: main {
310: put T: triangle {
311: z1 = 0; z2 = 1; z3 = (2,2);
312: }
313: put circle {
314: z1 = T.z1; z2 = T.z2; z3 = T.z3;
315: }
316: }
317: .EE
318: .de xx
319: ..
320: .if n .ig xx
321: .rt
322: .IS
323: ...width 6
324: ...libfile circle
325: ...minx -8
326: triangle {
327: var z1, z2, z3;
328: conn z1 to z2 to z3 to z1;
329: }
330: main {
331: put T: triangle {
332: z1 = 0; z2 = 1; z3 = (2,2);
333: }
334: put circle {
335: z1 = T.z1; z2 = T.z2; z3 = T.z3;
336: }
337: }
338: .IE
339: .xx
340: .SH "SEE ALSO"
341: .IR troff (1),
342: .IR pic (1),
343: .IR ped (9.1),
344: .IR doctype (1)
345: .br
346: C. J. Van Wyk,
347: `IDEAL User's Manual',
348: this manual, Volume 2
349: .SH BUGS
350: .I Ideal
351: is relatively unforgiving about syntax errors.
352: .br
353: Bounding box computation is naive for arcs and text strings.
354: .EQ
355: delim off
356: .EN
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.