1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> |
---|
2 | <HTML> |
---|
3 | <HEAD> |
---|
4 | <TITLE>main</TITLE> |
---|
5 | <META NAME="description" CONTENT="draw"> |
---|
6 | <META NAME="keywords" CONTENT="draw"> |
---|
7 | <META NAME="resource-type" CONTENT="document"> |
---|
8 | <META NAME="distribution" CONTENT="global"> |
---|
9 | <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> |
---|
10 | </HEAD> |
---|
11 | <BODY BGCOLOR="#ccffff"> |
---|
12 | <DIV ALIGN=RIGHT> |
---|
13 | version 3.6 |
---|
14 | </DIV> |
---|
15 | <P> |
---|
16 | <DIV ALIGN=CENTER> |
---|
17 | <H1>DRAWTREE and DRAWGRAM</H1> |
---|
18 | </DIV> |
---|
19 | <P> |
---|
20 | © Copyright 1986-2002 by The University of |
---|
21 | Washington. Written by Joseph Felsenstein. Permission is granted to copy |
---|
22 | this document provided that no fee is charged for it and that this copyright |
---|
23 | notice is not removed. |
---|
24 | <P> |
---|
25 | DRAWTREE and DRAWGRAM are interactive tree-plotting programs that take a |
---|
26 | tree description in a file and read it, and then let you interactively make |
---|
27 | various settings and then plot the tree on a laser printer, plotter, |
---|
28 | or dot matrix printer. In many cases (with Macintosh or PC graphics, |
---|
29 | with X windows, or with a Tektronix-compatible graphics terminal) |
---|
30 | you can preview the resulting tree. This allows you to modify the tree |
---|
31 | until you like the result, then plot the result. DRAWTREE plots |
---|
32 | unrooted trees and DRAWGRAM plots rooted cladograms and phenograms. On |
---|
33 | good laser printers or as files for good drawing programs both can produce |
---|
34 | fully publishable |
---|
35 | results. On dot matrix printers the results look grainy but are good |
---|
36 | enough for overhead transparencies or slides for presentations. |
---|
37 | <P> |
---|
38 | These programs are descended from PLOTGRAM and PLOTREE written by |
---|
39 | Christopher Meacham. I have incorporated his code for fonts and his |
---|
40 | plotter drivers, and in DRAWTREE have used some of his code for drawing |
---|
41 | unrooted trees. In both programs I have also included some plotter driver |
---|
42 | code by David Swofford, Julian Humphries and George D.F. "Buz" Wilson, |
---|
43 | to all of whom I am very grateful. Mostly, however, they consist of my own |
---|
44 | code and that of my programmers. The font files are printable-character |
---|
45 | recodings of the public-domain Hershey fonts, recoded by Christopher Meacham. |
---|
46 | <P> |
---|
47 | This document will describe the features common to both programs. The |
---|
48 | documents for DRAWTREE and DRAWGRAM describe the particular choices you |
---|
49 | can make in each of those programs. The Appendix to this documentation file |
---|
50 | contains some pieces of C code that can be inserted to make the program |
---|
51 | handle another plotting device -- the plotters by Calcomp. |
---|
52 | <P> |
---|
53 | <H2>A Short Introduction</H2> |
---|
54 | <P> |
---|
55 | To use DRAWTREE and DRAWGRAM, you must have |
---|
56 | <P> |
---|
57 | <DL COMPACT> |
---|
58 | <DT>(1)</DT> <DD>The compiled version of the program. If you have not obtained a |
---|
59 | version of PHYLIP precompiled for your machine, you will have to take |
---|
60 | the source code given here and modify it for your C |
---|
61 | compiler and then compile it. This is not too hard: it is discussed below.</DD> |
---|
62 | <P> |
---|
63 | <DT>(2)</DT> <DD>A tree file. Trees are described in the nested-parenthesis notation |
---|
64 | used throughout PHYLIP and standardized in an informal meeting of |
---|
65 | program authors in Durham, New Hampshire in June, 1986. Trees for |
---|
66 | both programs may be either bifurcating or multifurcating, and may |
---|
67 | either have or not have branch lengths. Tree files produced by |
---|
68 | the PHYLIP programs are in this form. There is further description of the |
---|
69 | tree file format later in this document.</DD> |
---|
70 | <P> |
---|
71 | <DT>(3)</DT> <DD>A font file. There are six font files distributed with PHYLIP: |
---|
72 | these consist of three Roman, two Italic, and one Russian Cyrillic font, |
---|
73 | all from the public-domain |
---|
74 | Hershey Fonts, in ASCII readable form. The details of font |
---|
75 | representation need not concern you; all you need to do is to copy the |
---|
76 | font file corresponding to the font you want into the appropriate |
---|
77 | directory under the appropriate file name, and let the program use it. |
---|
78 | Or you can let the program ask you for the name of the font file, which |
---|
79 | it will do if it does not find one itself. |
---|
80 | The six fonts are, respectively, a one- and a two-stroke sans-serif |
---|
81 | Roman font, a three-stroke serifed Roman font, a two- and a three- |
---|
82 | stroke serifed Italic font, and a two-stroke Cyrillic font for the Russian |
---|
83 | language. If this is not clear just try them all. Note that for some |
---|
84 | printers several built-in fonts such as Times-Roman and Courier can be used |
---|
85 | too.</DD> |
---|
86 | <P> |
---|
87 | <DT>(4)</DT> <DD>A plotting device, and if possible a screen on which you can preview |
---|
88 | the plot. The programs work with Postscript-compatible laser printers, |
---|
89 | laser printers compatible with the PCL printer language of the Hewlett-Packard |
---|
90 | Laserjet series, |
---|
91 | IBM PC graphics screens, |
---|
92 | the PICT format for the MacDraw drawing program, |
---|
93 | the PCX file format for the PC Paintbrush painting program, |
---|
94 | the file format for the freeware X-windows drawing programs <TT>xfig</TT> and |
---|
95 | <TT>idraw</TT>, |
---|
96 | the X Bitmap format for X-windows, |
---|
97 | plotters including Hewlett-Packard models, dot matrix printers including |
---|
98 | models by Epson and Apple, graphics terminals from DEC and Tektronix, |
---|
99 | the input format for the freeware ray-tracing (3-dimensional rendering) |
---|
100 | programs <TT>POV</TT> and <TT>rayshade</TT>, |
---|
101 | and, strangest and most wonderful of all, |
---|
102 | the Virtual Reality Markup Language (VRML) which is a file format that is |
---|
103 | used by freely-available virtual reality programs like Cosmo Player. |
---|
104 | You can choose the plotting and previewing |
---|
105 | devices from a menu at run time, and these can be different. There are |
---|
106 | places in the source code for the program where you can insert code for |
---|
107 | a new plotter, should you want to do that.</DD> |
---|
108 | </DL> |
---|
109 | <P> |
---|
110 | Once you have all these, the programs should be fairly self explanatory, |
---|
111 | particular if you can preview your plots so that you can discover the |
---|
112 | meaning of the different options by trying them out. |
---|
113 | <P> |
---|
114 | Once you have a compiled version of the appropriate program, say |
---|
115 | DRAWGRAM, and a file called (say) <TT>treefile</TT> with the tree in it, and |
---|
116 | a font file (say <TT>font2</TT> which you have copied as a file called |
---|
117 | <TT>fontfile</TT>), |
---|
118 | all you do is run the program DRAWGRAM. It should automatically read the |
---|
119 | font and tree files, and will allow you to change the graphics devices. Then |
---|
120 | it will let you see the options it has chosen, and ask you if you |
---|
121 | want to change these. Once you have modified those that you want to, |
---|
122 | you can tell it to accept those. The program will then allow you to |
---|
123 | preview the tree on your screen, if you have told it that you have |
---|
124 | an appropriate graphics screen. After |
---|
125 | previewing the tree, the program will want to know whether you are ready to |
---|
126 | plot the tree. In Windows you answer this using the File menu of the preview |
---|
127 | window. In X Windows and Macintosh systems you can close the preview |
---|
128 | window by clicking on its corner. Whether or not you close it, if you |
---|
129 | get back to the text window that had the menus, and it accepts typing in |
---|
130 | that window, you will be asked whether you want to accept the plot as is. |
---|
131 | If you say no, it will once again allow you to change options and |
---|
132 | will the allow you to preview the tree again, and so on as many times |
---|
133 | as you want. If you say yes, then it will write a file called (say) |
---|
134 | <TT>plotfile</TT>. If you then copy this file to your printer or plotter, |
---|
135 | it should result in a beautifully plotted tree. If the final plotting |
---|
136 | device is a Macintosh or PC graphics screen, it may not write a plot file |
---|
137 | but will plot directly on the screen. |
---|
138 | <P> |
---|
139 | Having read the above, you may be ready to run the program. Below you |
---|
140 | Will find more information about representation of trees in the tree |
---|
141 | file, on the different kinds of graphics devices supported by this |
---|
142 | program, and on how to recompile these programs. |
---|
143 | <P> |
---|
144 | <H2>Trees</H2> |
---|
145 | <P> |
---|
146 | The Newick Standard for representing trees in computer-readable |
---|
147 | form makes use of the correspondence between trees and nested |
---|
148 | parentheses, noticed in 1857 by the famous English mathematician Arthur |
---|
149 | Cayley. If we have this rooted tree: |
---|
150 | <P> |
---|
151 | <PRE> |
---|
152 | A D |
---|
153 | \ E / |
---|
154 | \ C / / |
---|
155 | \ ! / / |
---|
156 | \ ! / / |
---|
157 | B \!/ / |
---|
158 | \ o / |
---|
159 | \ ! / |
---|
160 | \ ! / |
---|
161 | \ ! / |
---|
162 | \ ! / |
---|
163 | \!/ |
---|
164 | o |
---|
165 | ! |
---|
166 | ! |
---|
167 | </PRE> |
---|
168 | <P> |
---|
169 | then in the tree file it is represented by the following sequence of printable |
---|
170 | characters, starting at the beginning of the file: |
---|
171 | <P> |
---|
172 | (B,(A,C,E),D); |
---|
173 | <P> |
---|
174 | The tree ends with a semicolon. Everything after the semicolon in the |
---|
175 | input file is ignored, including any other trees. The bottommost node |
---|
176 | in the tree is an interior node, not a tip. Interior nodes are |
---|
177 | represented by a pair of matched parentheses. Between them are |
---|
178 | representations of the nodes that are immediately descended from that |
---|
179 | node, separated by commas. In the above tree, the immediate |
---|
180 | descendants are B, another interior node, and D. The other interior |
---|
181 | node is represented by a pair of parentheses, enclosing representations |
---|
182 | of its immediate descendants, A, C, and E. |
---|
183 | <P> |
---|
184 | Tips are represented by their names. A name can be any string of |
---|
185 | printable characters except blanks, colons, semcolons, parentheses, and |
---|
186 | square brackets. In the programs a maximum of 20 characters are allowed |
---|
187 | for names: this limit can easily be increased by recompiling the program |
---|
188 | and changing the constant |
---|
189 | declaration for "MAXNCH" in <TT>phylip.h</TT>. |
---|
190 | <P> |
---|
191 | Because you may want to include a blank in a name, it is assumed that |
---|
192 | an underscore character ("_") stands for a blank; any of these in a |
---|
193 | name will be converted to a blank when it is read in. Any name may also |
---|
194 | be empty: a tree like |
---|
195 | <P> |
---|
196 | (,(,,),); |
---|
197 | <P> |
---|
198 | is allowed. Trees can be multifurcating at any level (while in many |
---|
199 | of the programs multifurcations of user-defined trees are not allowed |
---|
200 | or restricted to a trifurcation at the bottommost level, these programs |
---|
201 | do make any such restriction). |
---|
202 | <P> |
---|
203 | Branch lengths can be incorporated into a tree by putting a real |
---|
204 | number, with or without decimal point, after a node and preceded by |
---|
205 | a colon. This represents the length of the branch immediately |
---|
206 | below that node. Thus the above tree might have lengths |
---|
207 | represented as: |
---|
208 | <P> |
---|
209 | (B:6.0,(A:5.0,C:3.0,E:4.0):5.0,D:11.0); |
---|
210 | <P> |
---|
211 | These programs will be able to make use of this information only if |
---|
212 | lengths exist for every branch, except the one at the bottom of |
---|
213 | the tree. |
---|
214 | <P> |
---|
215 | The tree starts on the first line of the file, and can continue to |
---|
216 | subsequent lines. It is best to proceed to a new line, if at all, |
---|
217 | immediately after a comma. Blanks can be inserted at any point except |
---|
218 | in the middle of a species name or a branch length. |
---|
219 | <P> |
---|
220 | The above description is of a subset of the Newick Standard. For |
---|
221 | example, interior nodes can have names in that standard, but if |
---|
222 | any are included the present programs will omit them. |
---|
223 | <P> |
---|
224 | To help you understand this tree representation, here are some trees |
---|
225 | in the above form: |
---|
226 | <P> |
---|
227 | <PRE> |
---|
228 | ((raccoon:19.19959,bear:6.80041):0.84600,((sea_lion:11.99700, |
---|
229 | seal:12.00300):7.52973,((monkey:100.85930,cat:47.14069):20.59201, |
---|
230 | weasel:18.87953):2.09460):3.87382,dog:25.46154); |
---|
231 | <P> |
---|
232 | (Bovine:0.69395,(Gibbon:0.36079,(Orang:0.33636,(Gorilla:0.17147,(Chimp:0.19268, |
---|
233 | Human:0.11927):0.08386):0.06124):0.15057):0.54939,Mouse:1.21460); |
---|
234 | <P> |
---|
235 | (Bovine:0.69395,(Hylobates:0.36079,(Pongo:0.33636,(G._Gorilla:0.17147, |
---|
236 | (P._paniscus:0.19268,H._sapiens:0.11927):0.08386):0.06124):0.15057):0.54939, |
---|
237 | Rodent:1.21460); |
---|
238 | <P> |
---|
239 | (); |
---|
240 | <P> |
---|
241 | ((A,B),(C,D)); |
---|
242 | <P> |
---|
243 | (Alpha,Beta,Gamma,Delta,,Epsilon,,,); |
---|
244 | </PRE> |
---|
245 | <P> |
---|
246 | The Newick Standard was adopted June 26, 1986 by an informal |
---|
247 | committee meeting during the Society for the Study of Evolution |
---|
248 | meetings in Durham, New Hampshire and consisting of James Archie, |
---|
249 | William H.E. Day, Wayne Maddison, Christopher Meacham, F. James Rohlf, |
---|
250 | David Swofford, and myself. A web page describing it will be found |
---|
251 | at <A HREF="http://evolution.gs.washington.edu/phylip/newicktree.html"> |
---|
252 | http://evolution.gs.washington.edu/phylip/newicktree.html</A>. |
---|
253 | <P> |
---|
254 | <H2>Plotter file formats</H2> |
---|
255 | <P> |
---|
256 | When the programs run they have a menu which allows you to set (on its |
---|
257 | option P) the final plotting device, and another menu which allows you |
---|
258 | to set the type of preview screen. The |
---|
259 | choices for previewing are a subset of those available for plotting, |
---|
260 | and they can be different (the most useful combination will usually be a |
---|
261 | previewing graphics screen with a hard-copy plotter or a drawing program |
---|
262 | graphics file format). |
---|
263 | <P> |
---|
264 | The plotting device menu looks like this: |
---|
265 | <P> |
---|
266 | <TABLE><TR><TD BGCOLOR=white> |
---|
267 | <PRE> |
---|
268 | type: to choose one compatible with: |
---|
269 | |
---|
270 | L Postscript printer file format |
---|
271 | M PICT format (for drawing programs) |
---|
272 | J HP Laserjet PCL file format |
---|
273 | W MS-Windows Bitmap |
---|
274 | F FIG 2.0 drawing program format |
---|
275 | A Idraw drawing program format |
---|
276 | Z VRML Virtual Reality Markup Language file |
---|
277 | P PCX file format (for drawing programs) |
---|
278 | K TeKtronix 4010 graphics terminal |
---|
279 | X X Bitmap format |
---|
280 | V POVRAY 3D rendering program file |
---|
281 | R Rayshade 3D rendering program file |
---|
282 | H Hewlett-Packard pen plotter (HPGL file format) |
---|
283 | D DEC ReGIS graphics (VT240 terminal) |
---|
284 | E Epson MX-80 dot-matrix printer |
---|
285 | C Prowriter/Imagewriter dot-matrix printer |
---|
286 | T Toshiba 24-pin dot-matrix printer |
---|
287 | O Okidata dot-matrix printer |
---|
288 | B Houston Instruments plotter |
---|
289 | U other: one you have inserted code for |
---|
290 | Choose one: |
---|
291 | </PRE> |
---|
292 | </TD></TR></TABLE> |
---|
293 | <P> |
---|
294 | Here are the choices, with some comments on each: |
---|
295 | <P> |
---|
296 | <B>Postscript printer file format.</B> This means that the program will |
---|
297 | generate a file containing Postscript commands as its plot file. This |
---|
298 | can be printed on any Postscript-compatible laser printer. The page |
---|
299 | size is assumed to be 8.5 by 11 inches, but as plotting is within this |
---|
300 | limit A4 metric paper should work well too. This is the best |
---|
301 | quality output option. For this printer the menu options in DRAWGRAM |
---|
302 | and DRAWTREE that allow you to select one of the built-in fonts will |
---|
303 | work. The programs default to Times-Roman when this plotting option |
---|
304 | is in effect. I have been able to use fonts Courier, Times-Roman, and |
---|
305 | Helvetica. The others have eluded me for some reason known only to those |
---|
306 | who really understand Postscript. |
---|
307 | <P> |
---|
308 | If your laser printer, supposedly |
---|
309 | Postcript-compatible, refuses to print the plot file, you might |
---|
310 | consider whether the first line of the plot file, which starts with <TT>%!</TT> |
---|
311 | needs to be altered somehow or eliminated. If your Laserwriter is hooked to |
---|
312 | a Macintosh it will be necessary |
---|
313 | to persuade it to print the plot file. |
---|
314 | In recent versions of the Macintosh operating systems this can supposedly |
---|
315 | be done by dragging the file icon onto the printer icon on the desktop. |
---|
316 | In earlier versions of the MacOS operating system you might have to use |
---|
317 | a utility called the Laserwriter Font Utility, which was distributed with the |
---|
318 | operating system. |
---|
319 | <P> |
---|
320 | <B>PICT format (for drawing programs).</B> This file format is read by |
---|
321 | many drawing programs (an early example was MacDraw). It has support for |
---|
322 | some fonts, though if fonts are used the species names can only be drawn |
---|
323 | horizontally or vertically, not at other angles in between. The control over |
---|
324 | line widths is a bit rough also, so that some lines at different angles |
---|
325 | may turn out to be different widths when you do not want them to be. |
---|
326 | If you are working on a Macintosh system and have not been able to persuade |
---|
327 | it to print a Postscript file, this option may be the best solution, as you |
---|
328 | could then read the file into a drawing program and then order it to print |
---|
329 | the resulting screen. The PICT file format has font support, and the |
---|
330 | default font for this plotting option is set to Times. You can also |
---|
331 | choose font attributes for the labels such as Bold, Italic, Outline, and |
---|
332 | Shadowed. |
---|
333 | <P> |
---|
334 | <B>HP Laserjet PCL file format.</B> Hewlett-Packard's extremely popular line |
---|
335 | of laser printers has been emulated by many other brands of laser printer, |
---|
336 | so that this format is compatible with more printers than any other. |
---|
337 | One limitation of the PCL4 |
---|
338 | command language for these printers is that it does not have primitive |
---|
339 | operations for drawing arbitrary diagonal lines. This means that they must |
---|
340 | be treated by these programs as if they were dot matrix printers with a |
---|
341 | great many dots. This makes output files large, and output can be slow. |
---|
342 | The user will be asked to choose |
---|
343 | the dot resoluton (75, 150, or 300 dots per inch). The 300 dot per inch |
---|
344 | setting should not be used if the laser printer's memory is less than |
---|
345 | 512k bytes. The quality of output is also not as good as it might |
---|
346 | be so that the Postscript file format will usually produce better results even |
---|
347 | at the same resolution. I am |
---|
348 | grateful to Kevin Nixon for inadvertently pointing out that on Laserjets one |
---|
349 | does not have to dump the complete bitmap of a page to plot a tree. |
---|
350 | <P> |
---|
351 | <B>MS-Windows Bitmap.</B> This file format is used by most Windows |
---|
352 | drawing and paint programs, including Windows Paint which comes with the |
---|
353 | Windows operating system. It asks you to choose the height and width |
---|
354 | of the graphic image in pixels. For the moment, the image is set to be |
---|
355 | a monochrome image which can only be black or white. We hope to change |
---|
356 | that soon, but note that by pasting the image into a copy of Paint that |
---|
357 | is set to have a color image of the appropriate size, one can get a version |
---|
358 | whose color can be changed. Note also that Windows Bitmap files can be |
---|
359 | used as "wallpaper" images for the background of a desktop. |
---|
360 | <P> |
---|
361 | <B>IBM PC graphics screens.</B> The code for this in the programs is available |
---|
362 | in the precompiled PC executables or if you compile the programs |
---|
363 | yourself in C. The graphics modes supported are CGA, EGA, VGA, |
---|
364 | Hercules, and AT&T (Olivetti). |
---|
365 | This option is also available for previewing plots, and |
---|
366 | in either previewing or final plotting it draws directly on the screen |
---|
367 | and does not make a plot file. |
---|
368 | <P> |
---|
369 | <B>FIG 2.0 drawing program format.</B> This is the file format of the |
---|
370 | free drawing program Xfig, available for X-windows systems on Unix or |
---|
371 | Linux systems. Xfig |
---|
372 | can be <A HREF="http://duke.usask.ca/~macphed/soft/fig/">obtained from</A> |
---|
373 | <TT>http://duke.usask.ca/~macphed/soft/fig/</TT> |
---|
374 | <P> |
---|
375 | You should also get transfig, which contains the fig2dev program which converts |
---|
376 | xfig output to the various printer languages. Transfig is on the same machine |
---|
377 | in |
---|
378 | <P> |
---|
379 | <PRE> |
---|
380 | /contrib/R5fixes/transfig-patches/transfig.2.1.6.tar.Z. |
---|
381 | </PRE> |
---|
382 | <P> |
---|
383 | The present format |
---|
384 | does not write the species labels in fonts recognized by |
---|
385 | Xfig but draws them with lines. This often makes the names look rather |
---|
386 | bumpy. We hope to change this soon. |
---|
387 | <P> |
---|
388 | <B>Idraw drawing program format.</B> Idraw is a free drawing program for |
---|
389 | X windows systems (such as Unix and Linux systems). Its interface is |
---|
390 | loosely based on MacDraw, and I find it much more useable than Xfig. |
---|
391 | Though it was unsupported for a number of years, it has more recently |
---|
392 | been actively supported by Scott Johnston, of |
---|
393 | <A HREF="http://www.vectaport.com/index.html">Vectaport, Inc.</A> (<TT>http://www.vectaport.com</TT>). He has produced, in his <TT>ivtools</TT> package, a number |
---|
394 | of specialized versions of Idraw, and he also distributes the original |
---|
395 | Idraw as part of it. Linux executables for all these are available from |
---|
396 | Vectaport, or from various archive machines. |
---|
397 | <P> |
---|
398 | The Idraw file format that our programs produce can be read into Idraw, or |
---|
399 | can be imported into the other Ivtools programs. The file format saved |
---|
400 | from Idraw (or which can be exported from the other Ivtools programs) |
---|
401 | is Postscript, and if one does not print directly from Idraw one can |
---|
402 | simply send the file to the printer. But the format we produce is missing |
---|
403 | some of the header information and will not work directly as a Postscript |
---|
404 | file. However if you read it into Idraw and then save it (or import it into |
---|
405 | one of the other Ivtools programs and then export it) you will get a Postscript |
---|
406 | version that is fully useable. |
---|
407 | <P> |
---|
408 | DRAWGRAM and DRAWTREE have font support in their Idraw file format options. |
---|
409 | The default font is Times-Bold but you can also enter the name of any |
---|
410 | other font that is supported by your Postscript printer. Idraw labels |
---|
411 | can be rotated to any angle. |
---|
412 | <P> |
---|
413 | <B>VRML Virtual Reality Markup Language file.</B> This is by far the most |
---|
414 | interesting plotting file format. VRML files describe objects in 3-dimensional |
---|
415 | space with lighting on them. A number of freely available "virtual reality |
---|
416 | browsers" such as Cosmo Player can read VRML files. |
---|
417 | <A HREF="http://www.web3d.org/vrml/browpi.htm">A list of available virtual reality browsers and browser plugins</A> |
---|
418 | can be found at <TT>http://www.web3d.org/vrml/browpi.htm</TT>. |
---|
419 | These allow you to |
---|
420 | wander around looking at the tree from various angles, including from |
---|
421 | behind! At the moment our VRML output is primitive, with labels that |
---|
422 | always look the same no matter what angle you look at them from, and |
---|
423 | with a "sun" that is always behind you. The tree is made of three-dimensional |
---|
424 | tubes but is basically flat. We hope to change these soon. What's |
---|
425 | next? Trees whose branches stick out in three dimensions? Animated trees |
---|
426 | whose forks rotate slowly? |
---|
427 | A video game involving combat among schools of systematists? |
---|
428 | <P> |
---|
429 | <B>PCX file format (for drawing programs).</B> A bitmap format that was |
---|
430 | formerly much used on the PC platform, this has been largely superseded by |
---|
431 | the Windows Bitmap (BMP) format, but it is still useful. This file format |
---|
432 | is simple and is read by many other programs as well. The user must |
---|
433 | choose one of three resolutions for the file, 640x480, 800x600, or 1024x768. |
---|
434 | The file is a monochrome paint file. Our PCX format is correct but is not |
---|
435 | read correctly by versions of Microsoft Paint (PBrush) that are running on |
---|
436 | systems that have loaded Word97. |
---|
437 | <P> |
---|
438 | <B>Tektronix 4010 graphics terminal.</B> The plot file will contain commands |
---|
439 | for driving the Tektronix series of graphics terminals. Other |
---|
440 | graphics terminals were compatible with the Tektronix 4010 and its |
---|
441 | immediate descendants. The PCDOS version of the public domain communications |
---|
442 | program Kermit, versions 2.30 and later, can emulate a Tektronix |
---|
443 | graphics terminal if the command "set terminal tek" is given. Of course |
---|
444 | that assumes that you are communicating with another computer. There are |
---|
445 | also similar terminal emulation programs for Macintoshes that emulate |
---|
446 | Tektronix graphics. On workstations with X windows you can use one option of |
---|
447 | the "xterm" utility to create a Tektronix-compatible window. On Sun |
---|
448 | workstations there used to be a |
---|
449 | Tektronix emulator you can run called "tektool" which can be used to |
---|
450 | view the trees. The Tektronix option is also available in our programs |
---|
451 | for previewing the plots, in which case the plotting commands will be not be |
---|
452 | written into a file but will be sent directly to your terminal. |
---|
453 | <P> |
---|
454 | <B>X Bitmap format.</B> This produces an X-bitmap for the X Windows system |
---|
455 | on Unix or Linux systems, |
---|
456 | which can be displayed on X screens. You will be asked for the |
---|
457 | size of the bitmap (e.g., 16x16, or 256x256, etc.). This format |
---|
458 | cannot be printed out without further format conversion but is |
---|
459 | usable for backgrounds of windows ("wallpaper"). This can be a very |
---|
460 | bulky format if you choose a large bitmap. The bitmap is a structure |
---|
461 | that can actually be compiled into a C program (and thus built in to it), |
---|
462 | if you should have some reason for doing that. |
---|
463 | <P> |
---|
464 | <B>POVRAY 3D rendering program file.</B> This produces a file for the |
---|
465 | free ray-tracing program POVRay (Persistence of Vision Raytracer), |
---|
466 | which is <A HREF="http://www.povray.org/">available at</A> |
---|
467 | <TT>http://www.povray.org/</TT>. |
---|
468 | It shows a tree floating above a flat landscape. The tree is flat but |
---|
469 | made out of tubes (as are the letters of the species names). It |
---|
470 | casts a realistic shadow across the landscape. lit from over the left |
---|
471 | shoulder of the viewer. You will be asked to confirm the colors of the |
---|
472 | tree branches, the species names, the background, and the bottom plane. |
---|
473 | These default to Blue, Yellow, White, and White respectively. |
---|
474 | <P> |
---|
475 | <B>Rayshade 3D rendering program file.</B> The input format for the |
---|
476 | free ray-tracing program "rayshade" which is |
---|
477 | <A HREF="http://www-graphics.stanford.edu/~cek/rayshade/rayshade.html">available</A> |
---|
478 | at <TT>http://www-graphics.stanford.edu/~cek/rayshade/rayshade.html</TT> |
---|
479 | for many kinds of systems. Rayshade |
---|
480 | takes files of this format and turns them into color scenes in "raw" |
---|
481 | raster format (also called "MTV" format after a raytracing |
---|
482 | program of that name). If you get the pbmplus package |
---|
483 | (<A HREF="http://sourceforge.net/projects/netpbm/">available from</A> |
---|
484 | <TT>http://sourceforge.net/projects/netpbm/</TT>). |
---|
485 | and compile it on your system |
---|
486 | you can use the "mtvtoppm" and "ppmtogif" programs to convert this |
---|
487 | into the widely-used GIF raster format. (the pbmplus package will also |
---|
488 | allow you to convert into tiff, pcx and many other formats) The |
---|
489 | resultant image will show a tree floating above a landscape, rendered |
---|
490 | in a real-looking 3-dimensional scene with shadows and illumination. |
---|
491 | It is possible to use Rayshade to |
---|
492 | make two scenes that together are a stereo pair. When producing |
---|
493 | output for Rayshade you will be asked by the DRAWGRAM or DRAWTREE |
---|
494 | whether you want to reset the values for the colors you want for the |
---|
495 | tree, the species names, the background, and the desired resolution. |
---|
496 | <P> |
---|
497 | <B>Hewlett-Packard pen plotter (HPGL file format).</B> |
---|
498 | This means that the program will generate a |
---|
499 | file as its plot file which uses the HPGL graphics language. Hewlett-Packard |
---|
500 | 7470, 7475, and many other plotters are compatible with this. The |
---|
501 | paper size is again assumed to be 8.5 by 11 inches (again, A4 should |
---|
502 | work well too). It is assumed that there are two pens, a finer one for |
---|
503 | drawing names, and the HPGL commands will call for switching between |
---|
504 | these. The Hewlett-Packard Laserjet III printer can emulate an HP plotter, |
---|
505 | and this feature is included in its PCL5 command language (but not in the |
---|
506 | PCL4 command languages of earlier Hewlett-Packard models). As plotters |
---|
507 | are now rare the main use of HPGL will be when they are emulated by |
---|
508 | laser printers, but other file formats such as PCL and Postscript will be |
---|
509 | better choices in those cases. |
---|
510 | <P> |
---|
511 | <B>DEC ReGIS graphics (VT240 terminal).</B> The DEC ReGIS standard is |
---|
512 | used by the VT240 and VT340 series terminals by DEC (Digital Equipment |
---|
513 | Corporation). There used to be many graphics terminals that emulate the |
---|
514 | VT240 or VT340 as well. The DECTerm windows in many versions |
---|
515 | of Digital's (now Compaq's) DECWindows windowing system do so. |
---|
516 | This option is available in our programs for |
---|
517 | previewing trees as well. In preview mode it does not write a plot file |
---|
518 | but sends the commands directly to the screen; in final mode it writes a |
---|
519 | plot file. In DEC's version of Unix, Ultrix version 4.1 and later, |
---|
520 | the windowing system allows DEC ReGIS graphics as a default. |
---|
521 | <P> |
---|
522 | <B>Epson MX-80 dot-matrix printer.</B> This file format is for the dot-matrix |
---|
523 | printers by Epson (starting with the MX80 and continuing on to many other |
---|
524 | models), as well as the IBM Graphics printers. The code here plots in |
---|
525 | double-density graphics mode. Many of the later models are capable of |
---|
526 | higher-density graphics but not with every dot printed. This |
---|
527 | density was chosen for reasonably wide compatibility. Many other dot-matrix |
---|
528 | printers on the market have graphics modes compatible with the |
---|
529 | Epson printers. I cannot guarantee that the plot files generated by |
---|
530 | these programs will be compatible with all of these, but they do work on |
---|
531 | Epsons. They have also worked, in our hands, on IBM Graphics Printers. There |
---|
532 | used to be many printers that claimed compatibility with these too, but I |
---|
533 | do not know whether it will work on all of them. If you have trouble |
---|
534 | with any of these you might consider trying in the epson option of |
---|
535 | procedure initplotter to put in a fprintf statement |
---|
536 | that writes to plotfile an escape sequence that changes line spacing. |
---|
537 | As dot matrix printers are rare these days, I suspect this option will |
---|
538 | not get much testing. |
---|
539 | <P> |
---|
540 | <B>Prowriter/Imagewriter dot-matrix printer.</B> |
---|
541 | The trading firm C. Itoh distributed this line of |
---|
542 | dot-matrix printers, which was made by Tokyo Electric (TEC) and also was |
---|
543 | sold by NEC under the product number PC8023. These were 9-pin dot matrix |
---|
544 | printers. In a slightly modified form they were also the Imagewriter |
---|
545 | printer sold by Apple for their Macintosh line. The same escape codes |
---|
546 | seem to work on both machines, the Apple version being a serial |
---|
547 | interface version. They are not related to the IBM Proprinter, despite |
---|
548 | the name. |
---|
549 | <P> |
---|
550 | <B>Toshiba 24-pin dot-matrix printer.</B> |
---|
551 | The 24-pin printers from Toshiba were covered |
---|
552 | by this option. These included the P1340, P1350, P1351, P351, 321, and |
---|
553 | later models. For a 24-pin printer the plot file can get fairly large |
---|
554 | as it contains a bit map of the image and there are more bits with a |
---|
555 | 24-pin image. Printing was usually slow. |
---|
556 | <P> |
---|
557 | <B>Okidata dot-matrix printer.</B> |
---|
558 | The ML81, 82, 83 and ML181, 182, 183 line of dot-matrix |
---|
559 | printers from Okidata had their own graphics codes and those are dealt |
---|
560 | with by this option. The later Okidata ML190 series emulated IBM Graphics |
---|
561 | Printers so that you would not want to use this option for them but the option |
---|
562 | for that printer. |
---|
563 | <P> |
---|
564 | <B>Houston Instruments plotter.</B> The Houston Instruments line of plotters |
---|
565 | were also known as Bausch and Lomb plotters. The code in the |
---|
566 | programs for these has not been tested recently; I would appreciate |
---|
567 | anyone who tries it out telling me whether it works. I do not have |
---|
568 | access to such a plotter myself, and doubt most users will come across one. |
---|
569 | <P> |
---|
570 | Conversion from these formats to others is also possible. |
---|
571 | There is a free program by Jef Poskanzer called "PBMPLUS" that interconverts |
---|
572 | many bitmap formats (see above under Rayshade). |
---|
573 | <P> |
---|
574 | <H2>Drivers for Preview of Plots</H2> |
---|
575 | <P> |
---|
576 | Plots may be previewed in a number of formats which are chosen using the |
---|
577 | menu option. Previewing defaults to different drivers depending on which |
---|
578 | kind of system you are running the programs on. For Unix or Linux systems |
---|
579 | it defaults to X Windows, for Windows systems to Windows graphics, and |
---|
580 | for Macintosh systems to macintosh graphics screens. |
---|
581 | <P> |
---|
582 | We have already mentioned (above) some of the options that are also used |
---|
583 | for previewing. These include: |
---|
584 | <P> |
---|
585 | <B>MSDOS Graphics Screens.</B> These were mentioned |
---|
586 | above as possible output images. |
---|
587 | <P> |
---|
588 | <B>Macintosh graphics screens.</B> Using the windowing features of |
---|
589 | Codewarrior C from Metrowerks, our Macintosh executables |
---|
590 | open a graphics window and draw preview trees in it. We have |
---|
591 | not provided this option for final plotting of the tree. |
---|
592 | The window is about 2/3 the height of the desktop screen and has the tree drawn |
---|
593 | in black on a white background. |
---|
594 | After the preview appears, you can dismiss the window by closing it |
---|
595 | using the usual little box in its corner, or by typing Command-Q. |
---|
596 | <P> |
---|
597 | <B>X Windows display.</B> Our Unix and Linux code tries to do previews |
---|
598 | in X Windows. We hope that the Unix/Linux Makefle will find the correct |
---|
599 | libraries to link from. An X window appears with the preview of the tree |
---|
600 | in it. To dismiss this window one needs to put the mouse over the |
---|
601 | text window that had the menus in it (or click on them) and then type Y |
---|
602 | or N to plot the tree or return to the menu. |
---|
603 | <P> |
---|
604 | <B>MS Windows display.</B> The executables produced using the Cygwin |
---|
605 | Gnu C++ compiler should produce this graphics preview window. The preview |
---|
606 | window can be dismissed using its File menu. In its menu the Change |
---|
607 | Parameters otion will lead you back to the text menu to make more |
---|
608 | changes, and the Plot option will cause the final plot file to be written. |
---|
609 | The Quit option will interrupt the program, causing no plot file to b produced. |
---|
610 | Normally you will not want to use that option. |
---|
611 | <P> |
---|
612 | <B>Tektronix 4010 graphics terminal.</B> This previewing option was |
---|
613 | described above as a final plot option. |
---|
614 | <P> |
---|
615 | <B>DEC ReGIS graphics (VT240 terminal).</B> This previewing option was |
---|
616 | described above as a final plot option. |
---|
617 | <P> |
---|
618 | <H2>Problems Copying Files to Printers</H2> |
---|
619 | <P> |
---|
620 | A problem may arose in how to get the plot files to the plotting device |
---|
621 | or printer. One has to copy them directly, but one should be careful to |
---|
622 | not let your serial or parallel port strip off the high-order bits in the |
---|
623 | bytes if you are using one of the options that generate nonprintable |
---|
624 | characters. This will be true for most of the dot matrix printers and |
---|
625 | for bitmaps dumped to an HP Laserjet-compatible printer. This can be |
---|
626 | a problem under Unix or MSDOS. If, for example, you have a dot-matrix |
---|
627 | printer connected to a parallel port under PCDOS, to copy the file |
---|
628 | PLOTFILE to the printer without losing the high-order bits, you must use |
---|
629 | the /B switch on the COPY command: |
---|
630 | <P> |
---|
631 | <PRE> |
---|
632 | COPY/B PLOTFILE PRN: |
---|
633 | </PRE> |
---|
634 | <P> |
---|
635 | <H2>The VAX VMS Line Length Problem</H2> |
---|
636 | <P> |
---|
637 | A problem that may occur under some operating systems, particularly the |
---|
638 | VMS operating system for Digital VAXes, is having a plot file with lines |
---|
639 | that exceed some operating system limit such as 255 characters. This can |
---|
640 | happen if you are using the Tektronix option. |
---|
641 | You should set your terminal type with the |
---|
642 | command |
---|
643 | <P> |
---|
644 | <PRE> |
---|
645 | $ SET TERM/NOWRAP/ESCAPE |
---|
646 | </PRE> |
---|
647 | <BR> |
---|
648 | which will allow Tektronix and DEC ReGIS |
---|
649 | plots to successfully appear on your terminal. That way, if you have a |
---|
650 | terminal capable of plotting one of these kinds of plots, the operating |
---|
651 | system will not interfere with the process. It will not be possible to |
---|
652 | use files of Tektronix commands as final plot files, however, as the TYPE |
---|
653 | command usually used to get them to appear on the screen does not allow |
---|
654 | lines longer than 2048 bytes, and Tektronix plots are single lines longer |
---|
655 | than that. |
---|
656 | <P> |
---|
657 | <H2>Other problems and opportunities</H2> |
---|
658 | <P> |
---|
659 | Another problem is adding labels (such as vertical scales and branch |
---|
660 | lengths) to the plots produced by this program. This may require you to |
---|
661 | use the BMP, PICT, Idrawm, Xfig, PCX or Postscript file format and use a draw |
---|
662 | or paint program to add them. |
---|
663 | <P> |
---|
664 | I would like to add more fonts. The present fonts are recoded versions of |
---|
665 | the Hershey fonts. They are legally publicly distributable. Most other font |
---|
666 | families on the market are not public domain and I cannot |
---|
667 | afford to license them for distribution. Some people have noticed that the |
---|
668 | Hershey fonts, which are drawn by a series of straight lines, have noticeable |
---|
669 | angles in what are supposed to be curves, when they are printed on modern |
---|
670 | laser printers and looked at closely. This is less a problem than one might |
---|
671 | think since, fortunately, when scientific journals print a tree it is usually |
---|
672 | shrunk so small that these imperfections (and often the tree itself) |
---|
673 | are hard to see! |
---|
674 | <P> |
---|
675 | One more font that could be added from the Hershey font collection would be a |
---|
676 | Greek font. If Greek users would |
---|
677 | find that useful I could add it, but my impression is that they publish |
---|
678 | mostly in English anyway. |
---|
679 | <P> |
---|
680 | <H2>Writing Code for a new Plotter, Printer or File Format</H2> |
---|
681 | <P> |
---|
682 | The C version of these programs consists of two C programs, "drawgram.c" |
---|
683 | and "drawtree.c". Each of these has common sections of code compiled |
---|
684 | into it called |
---|
685 | "draw.c", "draw2.c" and a common header file, "draw.h". In addition |
---|
686 | the Macintosh version requires two more files, "interface.c" and |
---|
687 | "interface.h". All of the graphics commands that are common to both |
---|
688 | programs will be found in "draw.c" and "draw2.c". The following instructions |
---|
689 | for writing your own code to drive a different kind of printer, |
---|
690 | plotter, or graphics file format, require you only to make changes in |
---|
691 | "drawgraphics.c". The two programs can then be recompiled. |
---|
692 | <P> |
---|
693 | If you want to write code for other printers, plotters, or vector |
---|
694 | file formats, this is not |
---|
695 | too hard. The plotter option "U" is provided as a place for you to insert |
---|
696 | your own code. Chris Meacham's system was to draw everything, including the |
---|
697 | characters in the names and all curves, by drawing a series of straight |
---|
698 | lines. Thus you need only master your plotter's commands for drawing |
---|
699 | straight lines. In function "plotrparms" |
---|
700 | you must set up the values of |
---|
701 | variables "xunitspercm" and "yunitspercm", which are the number of units in |
---|
702 | the x and y directions per centimeter, as well as variables "xsize" and |
---|
703 | "ysize" which are the size of the plotting area in centimeters in the x |
---|
704 | direction and the y direction. A variable "penchange" of a user-defined type |
---|
705 | is set to "yes" or "no" depending on whether the commands to change the pen |
---|
706 | must be issued when switching between plotting lines and drawing |
---|
707 | characters. Even though dot-matrix printers do not have pens, penchange |
---|
708 | should be set to "yes" for them. In function "plot" you must issue commands |
---|
709 | to draw a line from the current |
---|
710 | position (which is at (xnow, ynow) in the plotter's units) to the position |
---|
711 | (xabs, yabs), under the |
---|
712 | convention that the lower-left corner of the plotting area is (0.0, 0.0). In |
---|
713 | functions "initplotter" and "finishplotter" |
---|
714 | you must issue commands to |
---|
715 | initialize the plotter and to finish plotting, respectively. If the pen is |
---|
716 | to be changed an appropriate piece of code must be inserted in |
---|
717 | function "penchange". |
---|
718 | <P> |
---|
719 | For dot matrix printers and raster graphics matters are a bit more complex. The |
---|
720 | functions "plotrparms", "initplotter", "finishplotter" and "plot" |
---|
721 | still respectively set up the parameters for the plotter, initialize it, |
---|
722 | finish a plot, and plot one line. But now the plotting consists of drawing |
---|
723 | dots into a two-dimensional array called "stripe". Once the plot is |
---|
724 | finished this array is printed out. In most cases the array is not as tall |
---|
725 | as a full plot: instead it is a rectangular strip across it. When the |
---|
726 | program has finished drawing in ther strip, it prints it out and then |
---|
727 | moves down the plot to the next strip. For example, for Hewlett-Packard |
---|
728 | Laserjets we have defined the strip as 2550 dots wide and 20 dots deep. When |
---|
729 | the program goes to draw a line, it draws it into the strip and ignores |
---|
730 | any part of it that falls outside the strip. Thus the program does a complete |
---|
731 | plotting into the strip, then prints it, then moves down the diagram by (in |
---|
732 | this case) 20 dots, then does a complete plot into that strip, and so on. |
---|
733 | <P> |
---|
734 | To work with a new raster or dot matrix format, you will have to define the |
---|
735 | desired width of a strip ("strpwide"), the desired depth ("strpdeep"), and |
---|
736 | how many lines of bytes must be printed out to print a strip. For example |
---|
737 | Toshiba P351 printers in graphics mode print strips of dots 1350 bits wide |
---|
738 | by 24 bits deep, each column of 24 bits printing out as consecutive four bytes |
---|
739 | with 6 bits each. In that case, one prints out a |
---|
740 | strip by printing up to 1350 groups of 4 bytes. "strpdiv" is 4, and |
---|
741 | "strpwide" is 1350, and "strpdeep" is 24. Procedure "striprint" |
---|
742 | is the one that prints out a strip, and has special-case code for the |
---|
743 | different printers and file formats. For file formats, all of which |
---|
744 | print out a single row of dots at a time, the variable "strpdiv" is not |
---|
745 | used. The variable "dotmatrix" is set to |
---|
746 | "true" or "false" in function "plotrparms" |
---|
747 | according to whether or not "strpdiv" is to be used. Procedure "plotdot" |
---|
748 | sets a single dot in the array "strip" to 1 at position (xabs, yabs). The |
---|
749 | coordinates run from 1 at the top of the plot to larger numbers as we |
---|
750 | proceed down the page. Again, there is special-case code for different |
---|
751 | printers and file formats in that |
---|
752 | function. |
---|
753 | You will probably want to read the code for some of the dot matrix or file |
---|
754 | format options if you want to write code for one of them. Many of them |
---|
755 | have provision for printing only part of a line, ignoring parts of it that |
---|
756 | have no dots to print. |
---|
757 | <P> |
---|
758 | I would be happy to obtain the resulting code from you to consider |
---|
759 | adding it to this listing so we can cover more kinds of plotters, printers, |
---|
760 | and file formats. |
---|
761 | <P> |
---|
762 | <HR> |
---|
763 | <P> |
---|
764 | <H2>APPENDIX 1.</H2> Code to drive some other graphics devices. |
---|
765 | These pieces of code are to be |
---|
766 | inserted in the places reserved for the "Y" plotter option. The variables |
---|
767 | necessary to run this |
---|
768 | have already been incorporated into the |
---|
769 | programs. |
---|
770 | <P> |
---|
771 | <H3>Calcomp plotters:</H3> |
---|
772 | <P> |
---|
773 | Calcomp's industrial-strength plotters are not as much a fixture of |
---|
774 | University computer centers as they one were, but just in case you need to |
---|
775 | use one, this code should work: |
---|
776 | <P> |
---|
777 | A global declaration needed near the front of drawtree.c: |
---|
778 | <P> |
---|
779 | <PRE>Char cchex[16];</PRE> |
---|
780 | <P> |
---|
781 | Code to be inserted into function plotrparms: |
---|
782 | <P> |
---|
783 | <PRE> |
---|
784 | case 'Y': |
---|
785 | plotter = other; |
---|
786 | xunitspercm = 39.37; |
---|
787 | yunitspercm = 39.37; |
---|
788 | xsize = 25.0; |
---|
789 | ysize = 25.0; |
---|
790 | xposition = 12.5; |
---|
791 | yposition = 0.0; |
---|
792 | xoption = center; |
---|
793 | yoption = above; |
---|
794 | rotation = 0.0; |
---|
795 | break; |
---|
796 | </PRE> |
---|
797 | <P> |
---|
798 | Code to be inserted into function plot: |
---|
799 | <P> |
---|
800 | Declare these variables at the beginning of the function: |
---|
801 | <P> |
---|
802 | <PRE> |
---|
803 | long n, inc, xinc, yinc, xlast, ylast, xrel, |
---|
804 | yrel, xhigh, yhigh, xlow, ylow; |
---|
805 | Char quadrant; |
---|
806 | </PRE> |
---|
807 | <P> |
---|
808 | and insert this into the switch statement: |
---|
809 | <P> |
---|
810 | <PRE> |
---|
811 | case other: |
---|
812 | if (penstatus == pendown) |
---|
813 | putc('H', plotfile); |
---|
814 | else |
---|
815 | putc('D', plotfile); |
---|
816 | xrel = (long)floor(xabs + 0.5) - xnow; |
---|
817 | yrel = (long)floor(yabs + 0.5) - ynow; |
---|
818 | xnow = (long)floor(xabs + 0.5); |
---|
819 | ynow = (long)floor(yabs + 0.5); |
---|
820 | if (xrel > 0) { |
---|
821 | if (yrel > 0) |
---|
822 | quadrant = 'P'; |
---|
823 | else |
---|
824 | quadrant = 'T'; |
---|
825 | } else if (yrel > 0) |
---|
826 | quadrant = 'X'; |
---|
827 | else |
---|
828 | quadrant = '1'; |
---|
829 | xrel = labs(xrel); |
---|
830 | yrel = labs(yrel); |
---|
831 | if (xrel > yrel) |
---|
832 | n = xrel / 255 + 1; |
---|
833 | else |
---|
834 | n = yrel / 255 + 1; |
---|
835 | xinc = xrel / n; |
---|
836 | yinc = yrel / n; |
---|
837 | xlast = xrel % n; |
---|
838 | ylast = yrel % n; |
---|
839 | xhigh = xinc / 16; |
---|
840 | yhigh = yinc / 16; |
---|
841 | xlow = xinc & 15; |
---|
842 | ylow = yinc & 15; |
---|
843 | for (i = 1; i <= n; i++) |
---|
844 | fprintf(plotfile, "%c%c%c%c%c", |
---|
845 | quadrant, cchex[xhigh - 1], cchex[xlow - 1], cchex[yhigh - 1], |
---|
846 | cchex[ylow - 1]); |
---|
847 | if (xlast != 0 || ylast != 0) |
---|
848 | fprintf(plotfile, "%c%c%c%c%c", |
---|
849 | quadrant, cchex[-1], cchex[xlast - 1], cchex[-1], |
---|
850 | cchex[ylast - 1]); |
---|
851 | break; |
---|
852 | </PRE> |
---|
853 | <P> |
---|
854 | Code to be inserted into function initplotter: |
---|
855 | <P> |
---|
856 | <PRE> |
---|
857 | case other: |
---|
858 | cchex[-1] = 'C'; |
---|
859 | cchex[0] = 'D'; |
---|
860 | cchex[1] = 'H'; |
---|
861 | cchex[2] = 'L'; |
---|
862 | cchex[3] = 'P'; |
---|
863 | cchex[4] = 'T'; |
---|
864 | cchex[5] = 'X'; |
---|
865 | cchex[6] = '1'; |
---|
866 | cchex[7] = '5'; |
---|
867 | cchex[8] = '9'; |
---|
868 | cchex[9] = '/'; |
---|
869 | cchex[10] = '='; |
---|
870 | cchex[11] = '#'; |
---|
871 | cchex[12] = '"'; |
---|
872 | cchex[13] = '\''; |
---|
873 | cchex[14] = '^'; |
---|
874 | xnow = 0.0; |
---|
875 | ynow = 0.0; |
---|
876 | fprintf(plotfile, "CCCCCCCCCC"); |
---|
877 | break; |
---|
878 | </PRE> |
---|
879 | <P> |
---|
880 | Code to be inserted into function finishplotter: |
---|
881 | <P> |
---|
882 | <PRE> |
---|
883 | case other: |
---|
884 | plot(penup, 0.0, yrange + 50.0); |
---|
885 | break; |
---|
886 | </PRE> |
---|
887 | </BODY> |
---|
888 | </HTML> |
---|