Annotation of researchv10dc/man/man1/ideal.1, revision 1.1.1.1

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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.