1
PASPLOT - Pascal Plotting Package 27 May 86
PASPLOT - a Pascal Plotting Package
John P. Strait
Herbert U. Rubenstein
University Computer Center
University of Minnesota
Copyright (C) 1977, 1979, 1985, 1986
Academic Computing Services and Systems
University of Minnesota
1
PASPLOT - Pascal Plotting Package 27 May 86
Abstract
========
PASPLOT is a package of Pascal-callable procedures which generate
output for controlling the following plotting devices:
1. Varian Statos 31 electrostatic paper plotter (100 steps/inch,
14.08 inches wide).
2. CalComp 565 drum, pen-and-ink plotter (100 steps/inch, 11.0
inches wide).
3. CalComp 563 drum, pen-and-ink plotter (200 steps/inch, 29.5
inches wide).
4. Tektronix terminals (consult specific Tektronix manuals).
The Pascal procedures are designed so that the programmer need not
worry about hardware details. Instead, by using procedure calls such
as MOVE or DRAW, the programmer generates a disk or tape file, called
CALCOM, which contains directives in a low-level plotting language.
These directives are processed by another program for final plotting
on one of the above output media.
PASPLOT.i
1
PASPLOT - Pascal Plotting Package 27 May 86
Contents
========
1 Introduction to Plotting: Basic Concepts.
3 Introduction to the Package: Basic Declarations.
PROGRAM MYPLOT(INPUT,OUTPUT,CALCOM);
TYPE CALCOMFILE = SEGMENTED FILE OF INTEGER;
ORIENTATION = (LONGX,LONGY);
POSITION = (ATSIDE,NEARSIDE,NOPOSITION);
VAR CALCOM : CALCOMFILE;
PROCEDURE PLOTOPEN(VAR F : CALCOMFILE; O : ORIENTATION;
P : POSITION; BX,BY : REAL;
M : PACKED ARRAY [LO .. HI : INTEGER] OF CHAR);
FUNCTION PLOTCLOSE : REAL;
6 Drawing Straight Line Segments: Plotting Primitives.
PROCEDURE DRAW(X,Y : REAL);
PROCEDURE MOVE(X,Y : REAL);
7 Drawing Symbols.
PROCEDURE DRAWCHAR(C : CHAR; H,A : REAL);
PROCEDURE DRAWSTRING(
S : PACKED ARRAY [LO .. HI : INTEGER] OF CHAR;
N : INTEGER; H,A : REAL);
PROCEDURE DRAWINTEGER(I : INTEGER; N : INTEGER; H,A : REAL);
PROCEDURE DRAWREAL(R : REAL; M,N : INTEGER; H,A : REAL);
PROCEDURE DRAWSPECIAL(C : INTEGER; H,A : REAL);
9 Automatic plotting: Drawing Graphs.
TYPE SIDE = (CW,CCW);
MODE = (LINEONLY,SYMBOLONLY,LINEANDSYMBOL);
SCALEINFO = RECORD
AXLEN : REAL;
FIRST : REAL;
DELTA : REAL
END;
PROCEDURE SCALEDATA(
VAR D : ARRAY[LO .. HI : INTEGER] OF REAL;
N : INTEGER; A : REAL; VAR I : SCALEINFO);
PROCEDURE DRAWAXIS(I : SCALEINFO; A : REAL;
N : INTEGER; S : SIDE;
M : PACKED ARRAY [LO .. HI : INTEGER] OF CHAR);
PROCEDURE DRAWLINE(
VAR X : ARRAY [XLO .. XHI : INTEGER] OF REAL;
VAR Y : ARRAY [YLO .. YHI : INTEGER] OF REAL;
N : INTEGER; IX,IY : SCALEINFO;
M : MODE; S : INTEGER);
17 Manipulating Parameters.
PROCEDURE SETSTEP(S : REAL);
PROCEDURE GETPOSITION(VAR X,Y : REAL);
PROCEDURE SETORIGIN(X,Y : REAL);
PROCEDURE SETSCALE(S : REAL);
PROCEDURE GETSCALE(VAR S : REAL);
PROCEDURE SETWINDOW(LX,HX,LY,HY : REAL);
PASPLOT.ii
1
PASPLOT - Pascal Plotting Package 27 May 86
PROCEDURE GETWINDOW(VAR LX,HX,LY,HY : REAL;
VAR ON : BOOLEAN);
PROCEDURE USEWINDOW(ON : BOOLEAN);
20 Plotting the Results: Control Statement Examples.
PASPLOT.iii
1
PASPLOT - Pascal Plotting Package 27 May 86
23 Appendix A - PASPLOT Error Messages.
25 Appendix B - References.
26 Appendix C - Sample Program.
28 Appendix D - Plotfile Structure.
30 Appendix E - Drawings.
[not included in machine-retrievable version]
33 Appendix F - Character Set Chart.
[not included in machine-retrievable version]
PASPLOT.iv
1
PASPLOT - Pascal Plotting Package 27 May 86
Preface
=======
This writeup describes a plotting package designed and implement-
ed at the University of Minnesota. PASPLOT was developed as a
supplement to the programming language Pascal, and it is written
almost entirely in Pascal with a few lines of COMPASS. PASPLOT was
originally conceived by Bill Elliott in the summer of 1975 as a
rewrite of the old FORTRAN PLOTPAC. It was not until the fall of 1976
that we (Herb and John) began to design and code this package. For
inspiration, we relied heavily on FORTRAN PLOTPAC and the plotting
software written by California Computer Products, Inc. (CalComp).
We are indebted to Bill Elliott for providing the inspiration
behind this project. Without his original vision of a well-designed
and integrated package, PASPLOT would not have been conceived. We
also thank Bill Elliott and Michael Frisch for the implementation and
documentation of the original FORTRAN PLOTPAC.
Thanks goes to the entire University Computer Center for provid-
ing a warm home for projects like this, and to all who helped
crystalize the design and documentation of PASPLOT.
In particular, we wish to thank Andy Mickel for his unwavering
support of Pascal, John Easton for his thoughtful comments on PASPLOT,
and Dennis Lienke for many hours of discussion.
JPS, HUR, May 1977.
JPS, Oct 1978.
PASPLOT.v
1
PASPLOT - Introduction to Plotting 27 May 86
Introduction to Plotting: Basic Concepts
========================================
The PASPLOT package is used for incremental plotting. Three
forms of incremental plotters are flatbed, drum, and electrostatic
plotters. Flatbed plotters have a large piece of paper laid flat on a
stationary platform or bed. A pen is moved in both X (side to side)
and Y (up and down) directions over its surface. Either ballpoint or
liquid ink pens can be used to yield a wide variety of lines.
Drum plotters draw on a continuous sheet of paper from a roll.
The paper is usually 30 inches or less in width. Paper rolls vary in
length and can be several hundred feet long. The pen can move across
the paper, and the paper itself moves on a drum in an orthogonal
direction. Incremental Plotting is a series of movements in very
small increments by the pen, the paper, or both. Increments are
usually 0.005 inches or 0.01 inches and they occur at a rate of
approximately 300 per second. The paper and pen movements are under
the control of software directives.
Electrostatic plotters also use a roll of paper. In one pass,
the following steps take place: First, the paper passes over a row of
charged points which are individually turned on or off, placing
electrostatic charges at precise locations on the paper. A special
program must process the low-level plotting directives in order to
control which points to charge and when. After being charged, the
paper passes over an ink bath. The distance between the ink and paper
is sufficiently small that the electrostatically charged spots attract
the ink. Finally, the paper passes through a drying apparatus.
It is important to understand the overall plotting system because
it has several levels of operation. Your Pascal program calls
routines in PASPLOT. These routines generate low-level plotting
language directives and write them onto a file called CALCOM. This
file is transmitted either to plotting machinery, such as the CalComp
pen-and-ink units, or further processed by intermediary programs like
VIEW and PLOT31, which produce directives suitable for operating other
plotting equipment.
PLOT31 is used in connection with the Varian Statos electrostatic
plotter, while VIEW generates plots on the Tektronix 4010 series
terminals. Both are available as control statements on all UCC
computer systems.
The hardware details outlined above are completely transparent to
the user. It is only necessary to think of a pen physically moving to
a specified location on a plotting page. If the pen is touching the
paper as it moves, it draws a line. If it is raised above the paper,
it simply becomes positioned at the new location. The particular
location is NOT described by its relation to the top or bottom of the
page. Instead, a Cartesian coordinate system (X-Y plane) defines
positions in relation to a given origin. This two-dimensional
plotting system can be used to draw pseudo three-dimensional plots.
Since pen plotting is a sequential process, every plot should be
carefully planned. The pen movement, and thus the plotting time,
PASPLOT.1
1
PASPLOT - Introduction to Plotting 27 May 86
should be minimized by keeping the pen from skipping all over the
plotting page. Even on the penless electrostatic plotters and
Tektronix terminals, where little time is gained by minimizing pen
motion, proper planning is a good idea because it makes debugging and
modifying easier.
Only a small class of lines is represented exactly on incremental
plotters. As mentioned earlier, the increment between plotting points
is typically on the order of 0.01 inches. On drum plotters lines are
drawn between these points. On electrostatic plotters, the points
themselves are inked and collectively form visible lines. In either
case absolute accuracy is not achievable because the number of
distinct points is limited. Since the average plot is so large (in
relation to the increment), this type of inaccuracy is insignificant
and almost invisible.
When planning a plot, the point of origin and paper orientation
must always be kept in mind. The initial position of the pen when the
plotting operation begins is set as the logical origin (X=0,Y=0). All
pen movements are defined in X and Y coordinate inches from the
origin. This origin can be re-established by appropriate procedure
calls. When the next plot is started, a new origin should be defined
to make a break between it and the previous plot.
It is convenient to visualize the plotting on a Cartesian plane.
One direction is limited by the physical width of the plotter while
the other can be as long as the length of a roll of plotting paper.
Thus, orientation is described as either LONGX or LONGY meaning that X
or Y will run along the length of the paper. Angles are expressed in
degrees and are measured counter-clockwise from the X-axis. The
CalComp plotter is equipped with 100-foot rolls of paper while the
electrostatic plotter uses rolls which are 500 feet long. For
economy, plots should not be excessively long.
PASPLOT.2
1
PASPLOT - Introduction to the Package 27 May 86
Introduction to the Package: Basic Declarations
===============================================
Certain declarations are required for using the Pascal plotting
package. Most of these declarations can be included in your program
by inserting the following compiler directive on the line immediately
after your program header.
(*$I'PASPLOT' INCLUDE PASPLOT DECLARATIONS *)
This directs the Pascal compiler to include all TYPE and PROCEDURE
declarations necessary for using PASPLOT. As different parts of the
PASPLOT system are discussed, we will show you the associated
declarations. Unless specifically noted, however, you do not need to
add these declarations to your program.
Since the plot is to be written to a file, you must include this
file in your program header. The plotting file can have any name, but
throughout this writeup, the file name CALCOM will be used.
PROGRAM MYPLOT(INPUT,OUTPUT,CALCOM);
Some data type definitions are also used by PASPLOT:
TYPE (*$B9*)
CALCOMFILE = SEGMENTED FILE OF INTEGER;
ORIENTATION = (LONGX,LONGY);
POSITION = (ATSIDE,NEARSIDE,NOPOSITION);
You must declare the CALCOM file as a variable:
VAR CALCOM : CALCOMFILE;
These declarations introduce the basic data items required by PASPLOT.
The package consists mainly of procedures and functions, and each one
requires its own declaration. The procedure or function declaration
for a particular routine will be given when it is introduced in this
writeup. For quick reference, the declarations are also given in the
table of Contents.
PLOTOPEN and PLOTCLOSE must be used for initiating and termina-
ting a plot - they bracket the rest of the plotting calls. They are
declared:
PROCEDURE PLOTOPEN(VAR F : CALCOMFILE; O : ORIENTATION;
P : POSITION; BX,BY : REAL;
M : PACKED ARRAY [LO .. HI : INTEGER] OF CHAR);
FUNCTION PLOTCLOSE : REAL;
PLOTOPEN must be called to initiate a plotting session, and set
initial conditions for the other plotting calls that follow. Its
PASPLOT.3
1
PASPLOT - Introduction to the Package 27 May 86
parameters are:
F The file to which the plotting commands will be written.
O The orientation of the plot (LONGX or LONGY). Specifying
LONGX makes the X-axis increase along the length of the
paper and the Y-axis increase across the page. LONGY does
the opposite.
P Sets the initial position of the pen, as well as the initial
origin. ATSIDE places the pen (and the initial origin) at
the extreme edge of the paper. NEARSIDE sets the pen one
half inch from the side. NOPOSITION allows the operator to
position the pen manually, and disables bound checking.
This last option makes sense only if you are using a
pen-and-ink plotter, and are operating it yourself.
BX,BY X and Y bounds for the plot. These parameters set the
maximum size of the plot. If a vector is drawn which will
exceed either of these bounds, an error message is issued
and plotting is aborted. This bound checking protects you
against accidentally creating an excessively large plot.
M An identifying message which will be drawn at the beginning
of the plot along with your user number and other informa-
tion.
For example:
PLOTOPEN(CALCOM,LONGX,NEARSIDE,20.0,10.0,
'J.T.S. GIRDER STRESS (RIGID)');
opens plotting on CALCOM with the X-axis extending along the length of
the paper. The pen is initially positioned one half inch from the
edge of the paper, and this point is defined as the plotting origin
(X=0,Y=0). If the program attempts to draw a line which makes the
plot exceed 20 inches in the X direction, or 10 inches in the Y
direction, a PASPLOT error message is issued with a Pascal post mortem
dump.
PLOTCLOSE terminates a plot, performing cleanup operations. If
PLOTCLOSE is not called, the plotting information written to CALCOM
will be incomplete. PLOTCLOSE is a parameterless function which
returns the actual length of the plot in inches. For example:
WRITELN(' THE PLOT IS ',PLOTCLOSE:4:2,' INCHES LONG.')
will close the plot, and write a message to the OUTPUT file. After
closing a plot, a new one may be opened with a call to PLOTOPEN. Thus
a single program may generate several plots, each having its own
orientation, initial pen position, X and Y bounds, and identifying
message. In fact, the plots may be written to different files if this
is desired.
PASPLOT.4
1
PASPLOT - Introduction to the Package 27 May 86
When a plot is opened, the plotting file is not repositioned.
This allows multiple plots in a single file. If you wish to have your
plotting file rewound, you should
REWRITE(CALCOM)
before opening the plot. PLOTCLOSE writes two endfiles on the
plotting file, and then backspaces over them. This ensures a good
terminator for a tape file, but still allows extending it with
multiple plots.
PASPLOT.5
1
PASPLOT - Drawing Straight Line Segments 27 May 86
Drawing Straight Line Segments: Plotting Primitives
===================================================
As far as PASPLOT is concerned, any picture that you can draw is
just a collection of straight line segments. Alphabetic characters,
curves, and complicated graphs are all made up of many short segments.
Thus the basic plotting routines are those that enable you to draw
such line segments. Two low-level operations are all that are
necessary:
1. Move the pen to a certain position on the page, without
drawing a line.
2. Draw a straight line segment from the current pen position
to a certain point on the page, and leave the pen there.
These are the primitives which are used by all the other plotting
routines in PASPLOT, and may also be used directly by your program.
These operations are performed by two procedures which are declared:
PROCEDURE MOVE(X,Y : REAL);
PROCEDURE DRAW(X,Y : REAL);
To draw a segment, you MOVE the pen to one end of the segment,
and then DRAW to the other end.
MOVE(2.0,2.0);
DRAW(4.0,4.0);
MOVE(4.0,2.0);
DRAW(2.0,4.0);
will draw a cross centered at (X=3,Y=3) (see drawing 1). The MOVE may
be omitted if the pen is already at the beginning of the segment.
MOVE(1.0,1.0);
DRAW(5.0,1.0);
DRAW(5.0,5.0);
DRAW(1.0,5.0);
DRAW(1.0,1.0);
will draw a 4-inch square around the cross (see drawing 2). Curves
can be drawn by using many short segments. For instance, a very
convincing circle can be drawn with as few as 20 segments.
MOVE(4.0,3.0);
ANGLE := 0.0;
WHILE ANGLE <= 6.2831 DO (* 6.2831 = 2*PI *)
BEGIN ANGLE := ANGLE + 0.31415; (* 0.31415 = PI/10 *)
DRAW( 3.0+COS(ANGLE) , 3.0+SIN(ANGLE) )
END;
will draw a circle with radius one inch inside the square (see drawing
3).
PASPLOT.6
1
PASPLOT - Drawing Symbols 27 May 86
Drawing Symbols
===============
Five procedures are provided for drawing symbols on a plot. They
can be used to draw characters and numbers at any angle, and any size.
They are declared:
PROCEDURE DRAWCHAR(C : CHAR; H,A : REAL);
PROCEDURE DRAWSTRING(
S : PACKED ARRAY [LO .. HI : INTEGER] OF CHAR;
N : INTEGER; H,A : REAL);
PROCEDURE DRAWINTEGER(I : INTEGER; N : INTEGER; H,A : REAL);
PROCEDURE DRAWREAL(R : REAL; M,N : INTEGER; H,A : REAL);
PROCEDURE DRAWSPECIAL(C : INTEGER; H,A : REAL);
These routines are somewhat similar to the Pascal WRITE proce-
dure. With the exception of the special symbols (see DRAWSPECIAL),
drawing starts at the lower left hand corner of the first symbol, and
after the last one is drawn, the pen is a bit to the right of its
lower right hand corner (see drawing 4). Thus many symbols can be
drawn one after another. For example:
MOVE(6.0,0.0);
DRAWSTRING('THE STANDARD DEVIATION IS', -1, 0.5, 10.0);
DRAWREAL(STANDEV, 8, 4, 0.5, 10.0);
is analagous to writing
WRITE('THE STANDARD DEVIATION IS',STANDEV:8:4);
(see drawing 5).
In all of the symbol routines, H is the desired height of the
symbols in inches, and A is the angle in degrees at which the symbols
will be drawn. In the previous example, the characters were one half
inch high, and were drawn at a 10 degree angle from the X-axis. Short
descriptions of the symbol routines follow. See Appendix F for the
character set table.
DRAWCHAR Draw the character C.
DRAWSTRING Draw the first N characters of the value S. If N is
greater than the length of S, draw leading spaces. If
N is less than zero, the length of the string is used
for the field width.
DRAWINTEGER Draw the integer value I in a field width of N.
This is similar to the formatted write:
WRITE(I:N)
A leading minus sign ( - ) is drawn if I is negative,
and leading blanks will be drawn if necessary to fill
the field width. The field width N will be expanded if
necessary to write a large number.
PASPLOT.7
1
PASPLOT - Drawing Symbols 27 May 86
DRAWREAL Draws either a fixed-point or floating-point represen-
tation of R.
Fixed-point representation (N > 0)
----------------------------------
If N is greater than zero, then a fixed-point represen-
tation of R with N digits after the decimal point is
drawn, analogous to "WRITE(R:M:N)". At least M or N+3
(whichever is larger) characters are drawn, with lead-
ing spaces if necessary. More characters may be drawn
if abs(R) is large.
Floating-point representation (N <= 0)
--------------------------------------
If N is less than or equal to zero, then a floating-
point representation of R is drawn, analogous to
"WRITE(R:M)". Exactly M or 9 (whichever is larger)
characters are drawn. The first character is a "-" if
R is negative or a space otherwise. The "exponent
part" always consists of an "E" followed by a "+" or
"-" and three digits.
DRAWSPECIAL Draw one of the 36 so-called special characters.
The first 14 characters are centered symbols. The
character is selected by the integer C, which should be
in the range [0..35]. In contrast to all other
symbols, the centered symbols are drawn around the
current pen position, and the pen is returned to the
center when the symbol is completed. For the other
special symbols, drawing starts at the lower left hand
corner of the symbol, and the pen is returned to its
original position. The centered symbols are useful for
drawing graphs. See appendix F for a list of the
special symbols.
PASPLOT.8
1
PASPLOT - Automatic Plotting 27 May 86
Automatic Plotting: Drawing Graphs
==================================
There are three routines in PASPLOT designed for automatic
graphing. They are: SCALEDATA, DRAWAXIS, and DRAWLINE.
SCALEDATA is designed to examine a given array of at least two
values and generate scaling information based upon those values and
user choices. SCALEDATA determines a data range by finding the
difference between the minimum and maximum values in the array. The
range is then centered with respect to the given axis length, and an
effective ordering of the data range is chosen to be either ascending
or descending. Numeric values are assigned to fields within a
structured parameter which serves to transfer the above scaling
information to DRAWAXIS and DRAWLINE.
DRAWAXIS will do the following things based upon information
provided either directly from the user or indirectly through SCALE-
DATA. Refer to drawing 6.
1. Draw an axis at a specified length and angle (starting at
the current pen position).
2. Place tic marks one inch apart along the axis spanning its
length.
3. Calculate and place division values in either ascending or
descending order next to each tic mark.
4. Divide each one inch segment into a specified number of
parts using smaller tic marks.
5. Draw an axis title (maximum of 30 characters) and possibly a
message indicating a scale factor for division values.
6. Place the tic marks, division values, and title message on
either the clockwise or counterclockwise side of the axis.
7. Return the pen to its original position at the time of the
call.
Note: Be sure to allow at least 0.6 inches for the combined space of
tic marks, division values, and title message characters.
Based upon information directly from the user or indirectly from
SCALEDATA, DRAWLINE will draw a graph of the given data in one of
three ways: lines only, symbols only, or both lines and symbols. That
is, a symbol may be placed at the position described by each
coordinate pair of data values (symbol-only), lines may be drawn to
connect those positions (line-only), or symbols marking the positions
may be superimposed on the lines connecting those positions (line-and-
symbol). DRAWLINE uses the same plotting area as DRAWAXIS. It
requires the same scaling information and uses it in much the same
way. DRAWLINE starts at the current pen position, graphs the
specified points, and returns the pen to its original position at the
time of the call. Three things will affect DRAWLINE just as they do
DRAWAXIS.
1. Magnitude of the data values.
2. The range and centering of data.
3. Ordering of data range (ascending or descending).
PASPLOT.9
1
PASPLOT - Automatic Plotting 27 May 86
Several different curves may be drawn on one graph by making multiple
calls to DRAWLINE with different data sets.
In order to avoid ambiguity in the sections ahead, the issue of
axes must be discussed. When a plot is opened, it is described as
either LONGX or LONGY to specify which way the X and Y axes (under
PASPLOT) will run. This refers to orientation of the plotting paper.
The graphing routine DRAWAXIS draws axis lines at any angle measured
from the X-axis of the plotting paper. Thus there are two kinds of
axes: those that are related to the orientation of the paper, and
those that can be drawn by DRAWAXIS. When discussing the latter the
terms "graphing" and "drawing" will generally be used, and the former
will usually be referenced with the term "plotting". This is not a
rigid terminology; the context should always be considered.
DRAWAXIS can draw axis lines at any angle, not just at 0 and 90
degrees. For example, pseudo three-dimensional graphs would require a
Z axis drawn somewhere between the X and Y axes. DRAWLINE however,
will always graph data as though the X axis were at 0 degrees and the
Y axis at 90 degrees. Unfortunately, the freedom provided by DRAWAXIS
creates a potential problem. DRAWLINE cannot compensate for axes
which are drawn at angles other than 0 and 90 degrees. It is only
capable of graphing data on a standard coordinate plane. If you want
axes at different angles, it is your responsibility to rotate the data
accordingly.
TYPE and VAR Declarations
-------------------------
The following TYPE declarations are used by the graphing rou-
tines.
TYPE
SIDE = (CW,CCW); (* CLOCKWISE AND COUNTERCLOCKWISE *)
MODE = (LINEONLY,SYMBOLONLY,LINEANDSYMBOL);
SCALEINFO = RECORD
AXLEN : REAL; (* AXIS LENGTH *)
FIRST : REAL; (* STARTING VALUE *)
DELTA : REAL (* SCALING FACTOR *)
END; (* SCALEINFO *)
In order to use the automatic graphing routines, you need to
declare arrays for the X and Y coordinate values and SCALEINFO
variables for communication of scaling information among the different
routines. You should include VAR declarations which are similar to
the following. You choose a value for MAX which is appropriate to the
amount of data you intend to graph.
VAR
X,Y : ARRAY[1..MAX] OF REAL; (* ARRAYS OF X-Y PAIRS *)
XINFO,YINFO : SCALEINFO; (* SCALING INFORMATION *)
PASPLOT.10
1
PASPLOT - Automatic Plotting 27 May 86
SIDE DRAWAXIS draws tic marks, division values, and a
title message on one side of the axis. The
particular side is described as either clockwise (
CW ) or counterclockwise ( CCW ) from the axis.
MODE DRAWLINE graphs data in one of three modes: lines
only, symbols only, or both lines and symbols.
SCALEINFO This type is used to communicate scaling informa-
tion among the three graphing procedures SCALE-
DATA, DRAWAXIS, and DRAWLINE. Either the user or
SCALEDATA will set the individual fields, and
DRAWAXIS and DRAWLINE will read them. AXLEN is
the length in inches of the desired axis. A
negative AXLEN causes division values to be set up
in descending order and the absolute value of
AXLEN to be taken as the length. FIRST is the
first division value. It is a minimum if AXLEN is
positive, or a maximum if AXLEN is negative.
DELTA is the increment to be added to or sub-
tracted from FIRST.
Procedure Declaration and Parameters
------------------------------------
The three graphing procedures, SCALEDATA, DRAWAXIS, and DRAWLINE
have the following declarations and parameter descriptions.
PROCEDURE SCALEDATA(VAR D : ARRAY LO .. HI : INTEGER] OF REAL;
N : INTEGER; A : REAL; VAR I : SCALEINFO);
SCALEDATA computes scaling information for DRAWAXIS and DRAWLINE
based on a given array of data elements. It passes the information by
setting fields in its SCALEINFO parameter. The user must specify axis
length and indicate the ordering of division values by making the axis
value positive or negative.
D An array of data elements (abscissas or ordinates) to be
centered and scaled. This is declared as a conformant array
parameter so that you can pass arrays with different sizes.
N The number of data elements in the array. N must be at
least 2.
A The physical length (in inches) of the axis.
I A SCALEINFO variable used to pass scaling information to
either DRAWAXIS or DRAWLINE. The three fields in this
variable are assigned values by SCALEDATA. These indicate
axis length, centering of data, and ordering of division
values.
PROCEDURE DRAWAXIS(I : SCALEINFO; A : REAL; N : INTEGER; S : SIDE;
M : PACKED ARRAY [LO .. HI : INTEGER] OF CHAR);
PASPLOT.11
1
PASPLOT - Automatic Plotting 27 May 86
DRAWAXIS will draw an axis for a specified length at an indicated
angle. Tic marks with division values in either ascending or
descending order are set up. The title message is then drawn on
either the clockwise or the counterclockwise side of the axis. If the
division values are larger than 100 or smaller than 1/10, they are
divided by an appropriate power of ten and an indicating message is
drawn following the axis title. The axis length and division values
are specified by either the user or SCALEDATA in the SCALEINFO
parameter prior to the call. A separate parameter contains the angle
given in degrees. The angle is measured from the X-axis of the plot
(be careful not to confuse the X-axis of the plot with the X-axis of
the graph). Finally, the pen is returned to its original position at
the time of the call.
I A SCALEINFO variable used to receive scaling information
from either the user or SCALEDATA. For a detailed
explanation of how to set these fields yourself, see Setting
Scaling Information.
A The angle of the axis, measured in degrees from the X-axis
of the plot.
N The number of parts that each major division is divided
into. Smaller tic marks are set up which indicate the
subdivisions. N must be at least 1.
S The side of the axis where tic marks, division values, and
axis title are to be placed. This will either be clockwise
or counterclockwise from the axis (CW or CCW).
M A character string for the axis title message.
PROCEDURE DRAWLINE(VAR X : ARRAY [XLO .. XHI : INTEGER] OF REAL;
VAR Y : ARRAY [YLO .. YHI : INTEGER] OF REAL;
N : INTEGER; IX,IY : SCALEINFO; M : MODE; S : INTEGER);
DRAWLINE will plot the given data (coordinate X-Y pairs) in one
of three modes: lines only, symbols only, or both lines and symbols.
Symbols are placed at the positions which each coordinate pair
describes and lines are drawn connecting these positions. If several
curves are to be plotted on the same graph, this can be done by making
multiple calls to DRAWLINE with different X and Y parameters. The
graph produced by DRAWLINE is "windowed" by assumed axis lengths.
Axis lengths and scaling values are contained in the SCALEINFO
parameters. The fields within these parameters are set by either the
user or SCALEDATA prior to the call. The X and Y axes are assumed to
exist at 0 and 90 degrees respectively (measured from the X-axis of
the plot). This assumption is made regardless of where or if the axes
were drawn.
X,Y Arrays of X and Y coordinate values. These are conformant
array parameters so that you can pass arrays with different
sizes.
N Number of coordinate pairs to be plotted. This will usually
be the number of elements in the above arrays. N must be at
PASPLOT.12
1
PASPLOT - Automatic Plotting 27 May 86
least 2.
IX,IY SCALEINFO variables used to receive scaling information
for the X and Y axes respectively. The fields in IX and IY
are set either by the user or by SCALEDATA. For a detailed
description of the contained fields see the TYPE declara-
tions.
M The mode of drawing, which should be LINEONLY, SYMBOLONLY,
or LINEANDSYMBOL. Symbols are placed at the positions which
each coordinate pair describes, and lines are drawn connect-
ing these positions.
S The index number of the special character used as a graphing
symbol. This number should be in the range [0..35]. The
first 14 are recommended because they are centered symbols.
A Simple Example
----------------
Suppose you have some data and you need a quick plot just to see
what it looks like. The example on the next page is a complete
program that would read the data and produce the graph shown in
drawing 7. Assume that the INPUT file contains one set of coordinate
pairs per line.
Note that DRAWAXIS is only necessary if you desire the axes, tic
marks, and division values, otherwise it can be left out. DRAWLINE
will graph the points and draw the lines anyway. DRAWLINE uses the
same area as the axes would have defined. That is, if you specify 20
inches for the axis when calling SCALEDATA then DRAWLINE will graph 20
inches or less in the X direction. Y distances are handled the same
way.
After drawing the axes or graphing the data, DRAWAXIS and
DRAWLINE will reset the pen to its original position, the position
which was current immediately preceding the call. DRAWLINE could be
called before DRAWAXIS and yield identical results because DRAWAXIS
and DRAWLINE are independent. They each receive the same information
through their parameters and neither routine alters any of the
SCALEINFO fields. Only the user or SCALEDATA can alter these fields.
This subject is discussed further in the next section.
PASPLOT.13
1
PASPLOT - Automatic Plotting 27 May 86
PROGRAM PLOTDATA(INPUT,OUTPUT,CALCOM);
(*$I'PASPLOT' INCLUDE PASPLOT DECLARATIONS *)
CONST
MAX = 100 (* MAXIMUM NUMBER OF X-Y PAIRS *);
VAR
CALCOM : CALCOMFILE;
XINFO,YINFO : SCALEINFO (* SCALING INFORMATION *);
X,Y : ARRAY[1..MAX] OF REAL (* COORDINATE PAIRS *);
I : INTEGER;
BEGIN (* MAIN PROGRAM *)
I := 0 (* INITIALIZE INDEX *);
WHILE NOT EOF(INPUT) DO
BEGIN (* READ DATA PAIRS *)
I := I + 1;
READ(X[I],Y[I]);
READLN
END;
IF I >= 2 THEN (* THERE MUST BE AT LEAST TWO X-Y PAIRS *)
BEGIN
PLOTOPEN(CALCOM,LONGX,NEARSIDE,15,10,
'TEST PLOT - GRAPH OF DATA');
MOVE(1.0,1.0) (* ALLOW FOR AXIS TITLE AND TICS *);
SCALEDATA(X,I,8,XINFO) (* 8 INCH X - AXIS *);
SCALEDATA(Y,I,5,YINFO) (* 5 INCH Y - AXIS *);
DRAWAXIS(XINFO,0,10,CW,' X - AXIS');
DRAWAXIS(YINFO,90,10,CCW,' Y - AXIS');
DRAWLINE(X,Y,I,XINFO,YINFO,LINEANDSYMBOL,1);
WRITELN(' PLOT IS ',PLOTCLOSE:5:2,' INCHES LONG.')
END
ELSE WRITELN(' NOT ENOUGH INPUT DATA.')
END (* MAIN PROGRAM *).
PASPLOT.14
1
PASPLOT - Automatic Plotting 27 May 86
Setting Scaling Information
---------------------------
The SCALEINFO record has three fields. They are AXLEN, FIRST,
and DELTA. The procedures DRAWAXIS and DRAWLINE use these values when
performing their functions. The call to DRAWAXIS is optional, but the
axes it prints make the graph produced by DRAWLINE clearer. AXLEN,
FIRST, and DELTA are values which regulate DRAWLINE just as they do
DRAWAXIS. These fields will be explained as if the axes are actually
drawn, although they need not be. Keep in mind that if DRAWAXIS is
not called, DRAWLINE will assume this information even though it is
not graphically reproduced.
Normally, SCALEDATA scans the array values and makes assignments
to FIRST and DELTA such that the entire range of data is centered with
respect to the axis lengths specified. FIRST is given the minimum
value and each major tic mark denotes FIRST plus a multiple of DELTA.
This ordering of division values is referred to as ascending. By
setting the SCALEINFO fields directly, two things can be accomplished:
1. A specific subrange of the data can be plotted. This
windowing effect can be applied to either the X's, the Y's,
or both.
2. Tic marks and division values can be arranged in ascending
or descending order. This can be applied to either the
X-axis, the Y-axis, or both. The graph drawn by DRAWLINE
will be "mirrored" accordingly if descending order is used.
With the above in mind the three SCALEINFO fields are now described:
AXLEN A real value which specifies the desired axis
length. If this number is negative the absolute
value will be assumed and division values will be
generated in descending order. Otherwise division
values will be in ascending order.
FIRST A real value which specifies the first division
value. If division values are in ascending order
then this will be a minimum. Otherwise, in the
case of descending order, FIRST will be a maxi-
mum.
DELTA A positive real value which specifies the incre-
ment to be added to or subtracted from FIRST, thus
determining the division values assigned to each
successive major tic mark. If division values are
in descending order, multiples of DELTA will be
subtracted from FIRST; otherwise, they are added.
The user can provide custom scaling information for any given
data range by setting AXLEN, FIRST, and DELTA directly in the
following manner:
PASPLOT.15
1
PASPLOT - Automatic Plotting 27 May 86
First, decide how long the axis should be and whether the
division values are to be generated in ascending or descend-
ing order. AXLEN should be the length in inches of the
axis. If descending order is preferred then set AXLEN to
that length times -1.
Second, decide on a data range by determining the minimum
and maximum values of the data. If ascending order was
chosen then FIRST should be the minimum value, and for
descending order, FIRST should be the maximum value.
Finally, calculate DELTA by dividing the difference between
the maximum and minimum values by the length of the axis.
Suppose you want an axis that is 7 inches long with division
values in ascending order and with maximum and minimum values of 1500
and -4000 respectively. AXLEN should be 7, FIRST should be -4000, and
DELTA should be 5500 divided by 7 which approximately equals 785.7.
For nicer division values DELTA could be rounded to 800 or even 1000
Maybe a 15 inch axis is desired with division values in
descending order and with maximum and minimum values of 0.005 and
0.002 respectively. In this case AXLEN should be -15, FIRST should be
0.005, and DELTA should be 0.003 divided by 15 which equals 0.0002.
PASPLOT.16
1
PASPLOT - Manipulating Parameters 27 May 86
Manipulating Parameters
=======================
The previous sections described routines and methods for drawing
line segments, characters, and graphs. These procedures provide the
ability to create many different kinds of drawings. To create
sophisticated results (for instance sub-graphs within larger draw-
ings), it is often convenient to be able to change PASPLOT's internal
parameters. Eight routines are provided for this purpose.
The most basic need is the ability to tell PASPLOT what kind of
plotting equipment is being used (see the Abstract for a list of
plotting devices). Since most plotting at the University of Minnesota
is done on the Statos 31 electrostatic plotter, PASPLOT assumes that
the plotting equipment has 100 increments per inch. To create plots
destined for other plotting equipment, a call to SETSTEP is necessary.
Note: SETSTEP must be called
before PLOTOPEN.
The declaration is:
PROCEDURE SETSTEP(S : REAL);
S Number of plotting steps (increments) per inch.
GETPOSITION and SETORIGIN deal with the current pen position.
After calls to certain plotting procedures, the pen's X and Y
coordinate values may be unknown. GETPOSITION can be used to
determine these coordinates. When a plot is opened, the pen is set at
or near the edge of the plotting surface, and this point is defined as
the plotting origin (X=0,Y=0). It is often convenient to define the
center of the plotting paper (or some other point) to be the origin.
SETORIGIN is used to redefine the position of the origin without
moving the pen. GETPOSITION and SETORIGIN are declared as follows.
PROCEDURE GETPOSITION(VAR X,Y : REAL);
PROCEDURE SETORIGIN(X,Y : REAL);
The following example illustrates the redefinition of the origin at
the center of a 14 inch square.
PLOTOPEN(CALCOM,LONGX,ATSIDE,14.0,14.0,'EXAMPLE PLOT');
SETORIGIN(7.0,7.0);
PASPLOT.17
1
PASPLOT - Manipulating Parameters 27 May 86
Plotting is normally done with a scale expressed in inches. It
may be more convenient to use a different scale, for example one where
plotting coordinates are expressed in centimeters or in feet. SET-
SCALE is used to change the scale factor, and GETSCALE is used to
determine the current scale factor. They are declared:
PROCEDURE SETSCALE(S : REAL);
PROCEDURE GETSCALE(VAR S : REAL);
The scale factor S is expressed in inches. That is, a move of one
coordinate unit will actually move the pen S inches. Thus to plot
twice normal size do
SETSCALE(2.0)
or to plot in centimeters do
SETSCALE(1.0 / 2.54)
or to plot in feet do
SETSCALE(12.0).
The default scale factor is, of course, 1.0.
The last of the parameter setting routines are SETWINDOW,
GETWINDOW, and USEWINDOW. These procedures are used to define a
restricted plotting area called a window. In PASPLOT only one
rectangular window can exist, although a more general windowing
concept can be imagined. A window restricts plotting in the following
manner. The only lines which are actually drawn on the plotting paper
are those which are drawn within the window. Lines which are entirely
outside the window are discarded, and those which are only partially
outside the window are truncated to the edge of the window. The
concept of windowing is related to the bounds checking performed by
PASPLOT (see Introduction to the Package), but is different in the
sense that drawing outside the window is not an error. Note that
bounds checking is only applied to lines which are actually drawn on
the paper, i.e. those which are inside the window. The declarations
are:
PROCEDURE SETWINDOW(LX,HX,LY,HY : REAL);
PROCEDURE GETWINDOW(VAR LX,HX,LY,HY : REAL; VAR ON : BOOLEAN);
PROCEDURE USEWINDOW(ON : BOOLEAN);
LX (Low X) The X coordinate of the left edge of the
rectangular window.
HX (High X) The X coordinate of the right edge.
LY (Low Y) The Y coordinate of the bottom edge.
HY (High Y) The Y coordinate of the top edge.
PASPLOT.18
1
PASPLOT - Manipulating Parameters 27 May 86
ON A boolean that is true when the window
checking is active.
When SETWINDOW is called, the window is automatically activated.
Window checking can be activated or deactivated at any time by calling
USEWINDOW. GETWINDOW returns the current values of LX, HX, LY, HY,
and ON. A few notes about PASPLOT windowing:
1. LX should always be less than HX, and LY should be less
than HY.
2. It is convenient to think of the window as being attached
to the plotting paper. The use of SETORIGIN and SETSCALE
will not affect the position of the window on the page.
3. LX, HX, LY, and HY are initialized to the bounds which are
set in PLOTOPEN, but the window is initially inactive.
PASPLOT.19
1
PASPLOT - Plotting the Results 27 May 86
Plotting the Results: Control Statement Examples
================================================
PASPLOT generates a file (usually called CALCOM) which contains
plotting directives in a low level language. This file is transmitted
to the target plotter which creates the actual drawing. Each of the
plotters supported by UCC requires different steps for this transmis-
sion.
Varian Statos 31 Electrostatic Plotter
--------------------------------------
The Varian Statos 31 plotter is driven by a PDP-11 computer which
has a direct hardware link to the CDC Cyber 74. Plots which are
destined for the electrostatic plotter must be post-processed into a
special format before they are transmitted to the PDP-11. This
processing is done by the PLOT31 control statement. The following
card deck setup may be used from batch entry.
Job card.
BIN(ss,bbbb)
USER statement.
PASCAL.
LGO.
PLOT31(CALCOM)
(7/8/9) (end of record card)
Pascal program
(7/8/9) (end of record card)
data, if any
(6/7/8/9) (end-of-information)
Electrostatic plots may also be generated at a interactive terminal.
The following command sequence should be used.
PASCAL
OLD,MYPROG
RNH -or- RUN
X,PLOT31(CALCOM,PLOTS)
X,ROUTE(PLOTS,DC=PL,TID=tt,BIN=bbbb)
[on the Cyber 74 or the Cyber 172]
-or- X,ROUTE(PLOTS,DC=PL,TID=tt,BIN=bbbb,UN=abc1234,PW=secret)
[on MERITSS]
The plot is returned to the site where the job originated (given in a
batch job job by the BIN card), or to the site specified on the ROUTE
statement. For on-campus sites, this means the shelf provided for
that site at Experimental Engineering, Lauderdale, St. Paul, or West
Bank. Turnaround time is usually a few hours at Lauderdale and
Experimental Engineering, but is about a half day at St. Paul and
West Bank. For off-campus sites, the plot is mailed to the site, and
can be picked up from the site supervisor. The user's supply budget
is automatically billed for electrostatic plotting at rates specified
in the UCC Instant. Current rates (at this printing) are $0.25 for
setup, and $0.20 per foot of paper. If the plot is mailed, the
postage and a $0.50 service charge are added.
PASPLOT.20
1
PASPLOT - Plotting the Results 27 May 86
CalComp Pen-and-Ink Plotters
----------------------------
The CalComp paper plotters are located in room 134 Space Science
Center, and a magnetic tape is used to transport the plotting
information to these plotters. The tape is read by a PDP-11
mini-computer which drives the CalComp plotters. Since a tape is the
communications medium, a batch job must be used to write the plot.
UCC will supply the tape, transport it to Space Science Center, and
return the plot to the site where the job was submitted. The
following control statement setup should be used.
Job card.
BIN(ss,bbbb)
USER statement.
PASCAL.
LABEL(CALCOM,VSN=PT2HCL,ID=$ss,pp,cc,ll,nn$,LB=KU,F=X,D=HI,PO=W)
LGO.
(7/8/9) (end-of-record)
Pascal program
(7/8/9) (end-of-record)
data, if any
(6/7/8/9) (end of information card)
The fields in the ID specification of the LABEL card are used as
directions to the operator of the CalComp plotter. The fields are:
ss - The size (width) of the plot:
10 for 10 inch width,
30 for 30 inch width,
10X for a 10 inch plot expanded to 30 inches.
pp - The type of pen to use:
BP for ballpoint,
IK for liquid ink.
cc - The color of ink to use:
BK for black,
BL for blue,
RD for red,
GR for green,
YL for yellow.
ll - The approximate length of the plot in feet.
nn - The number of plots (separate PLOTOPENs) generated.
When a plot is made at Space Science Center by UCC operators, it
is automatically billed against the user's supply budget. The rate
(at this printing) for CalComp paper plotting is $20.00 per hour of
plotting time on the auxiliary plotting system. See the UCC Instant
for current rate information. The plot is returned in the same way as
an electrostatic plot, but turnaround time is usually about 48 hours.
PASPLOT.21
1
PASPLOT - Plotting the Results 27 May 86
Tektronix Terminals
-------------------
A plot intended for a Tektronix 4010 series terminal must be
converted to special ASCII plotting codes, and transmitted to the
interactive terminal. This is done by the UCC-supported control
statement VIEW. Since Tektronix plotting requires an interactive
terminal, only timesharing users may create such plots. The following
command sequence should be used.
PASCAL
OLD,MYPROG
RNH -or- RUN
REWIND(CALCOM)
X,VIEW(CALCOM)
VIEW has scaling options and other parameters. For a more complete
explanation of VIEW and its partner SKIPPLT, see the UCC VIEW writeup,
which may be obtained in room 140 Experimental Engineering, or from
the UCC Reference Librarian.
PASPLOT.22
1
PASPLOT - Appendix A - PASPLOT Error Messages 27 May 86
Appendix A - PASPLOT Error Messages
===================================
BAD ORIENTATION VALUE IN PLOTOPEN.
BAD POSITION VALUE IN PLOTOPEN.
These refer to parameters in PLOTOPEN. Orientation values
must be LONGX or LONGY. Position values should be ATSIDE,
NEARSIDE, or NOPOSITION.
X OUT OF BOUNDS.
Y OUT OF BOUNDS.
PASPLOT has bounds checking to prevent accidents which
create excessively large plots. The X and Y bounds are set
when PLOTOPEN is called. The above errors occur whenever
the bounds are exceeded.
SETSTEP CALLED AFTER PLOTOPEN.
SETSTEP is called when using plotting hardware with certain
specifications other than the default ones in this package.
It must be called before PLOTOPEN.
N LESS THAN 2 IN DRAWLINE.
N LESS THAN 2 IN SCALEDATA.
AXIS MAGNITUDE ZERO IN SCALEDATA.
These errors refer to parameters in SCALEDATA and DRAWLINE.
N, the number of data elements in the arrays must not be
less than 2. The absolute value of the axis length
specified must be greater than 0.
ZERO AXLEN IN DRAWAXIS.
ZERO AXLEN IN DRAWLINE.
DELTA TOO SMALL IN DRAWAXIS.
DELTA TOO SMALL IN DRAWLINE.
These errors refer to the SCALEINFO parameter in DRAWAXIS or
DRAWLINE. DELTA and AXLEN are separate fields within the
parameter. DELTA must be greater than zero and AXLEN must
not be equal to zero. These errors can only occur when the
user sets fields in the SCALEINFO parameter incorrectly.
BAD MODE VALUE IN DRAWLINE.
This refers to the penultimate parameter in DRAWLINE. Mode
values must be LINEONLY, SYMBOLONLY, or LINEANDSYMBOL.
PASPLOT.23
1
PASPLOT - Appendix A - PASPLOT Error Messages 27 May 86
SYMBOL NOT IN [0..35] IN DRAWSPECIAL.
SYMBOL NOT IN [0..35] IN DRAWLINE.
These refer to the special symbol parameter in both DRAW-
SPECIAL and DRAWLINE. There are 36 special symbols, select-
ed by a value in the range [0..35].
LX >= HX IN SETWINDOW.
LY >= HY IN SETWINDOW.
If SETWINDOW is called with LX greater or equal to HX or LY
greater or equal to HY, this specifies a window through
which nothing can be seen, and is an error.
DRAW CALLED BEFORE PLOTOPEN.
DRAWAXIS CALLED BEFORE PLOTOPEN.
DRAWCHAR CALLED BEFORE PLOTOPEN.
DRAWINTEGER CALLED BEFORE PLOTOPEN.
DRAWLINE CALLED BEFORE PLOTOPEN.
DRAWREAL CALLED BEFORE PLOTOPEN.
DRAWSPECIAL CALLED BEFORE PLOTOPEN.
DRAWSTRING CALLED BEFORE PLOTOPEN.
GETPOSITION CALLED BEFORE PLOTOPEN.
GETSCALE CALLED BEFORE PLOTOPEN.
GETWINDOW CALLED BEFORE PLOTOPEN.
MOVE CALLED BEFORE PLOTOPEN.
PLOTCLOSE CALLED BEFORE PLOTOPEN.
SCALEDATA CALLED BEFORE PLOTOPEN.
SETORIGIN CALLED BEFORE PLOTOPEN.
SETSCALE CALLED BEFORE PLOTOPEN.
SETWINDOW CALLED BEFORE PLOTOPEN.
USEWINDOW CALLED BEFORE PLOTOPEN.
PLOTOPEN must be called before calling any of the above
procedures. PLOTOPEN is used for initiating a plot.
PLOT OPENED TWICE.
This message is issued if PLOTOPEN is called twice, without
calling PLOTCLOSE to terminate the first plot.
N TOO LARGE IN DRAWLINE.
N TOO LARGE IN SCALEDATA.
N is the number of elements in the data array which are to
be used by the automatic scaling and graphing routines. If
N is larger than the size of the array, this message is
issued.
PASPLOT.24
1
PASPLOT - Appendix B - References 27 May 86
Appendix B - References
=======================
Dixon, W. J. and Kronmal, R. A., The Choice of Origin and Scale for
Graphs. Journal of the ACM 12, 2 (April 1965), 259-261.
Elliott, W. J. and Frisch, M. J., PLOTPAC - Graphical Plotting
Package. University Computer Center, University of
Minnesota, July 1975, revised.
Jensen, K. and Wirth, N., PASCAL - User Manual and Report, Third |
Edition. Springer-Verlag, December 1985. |
Johnson, B., VIEW. University Computer Center, University of
Minnesota, March 1976.
Programming CalComp Pen Plotters. California Computer Products, Inc.,
September 1969.
Rubenstein, H. U., PRNTPLT - Pascal Printer Plotter. University
Computer Center, University of Minnesota, December 1975,
revised.
Space Filling Curves or How to Waste Time on a Plotter.
Software-Practice and Experience 1,4 (1971), 403-440.
Strait, J. P., Mickel, A. B., and Easton, J. T., Pascal-6000 Release
3. University Computer Center, University of Minnesota,
January 1979, revised.
Wirth, N., Algorithms + Data Structures = Programs. Prentice-Hall,
Inc., 1976.
PASPLOT.25
1
PASPLOT - Appendix C - Sample Program 27 May 86
PROGRAM SIERPINSKI(INPUT, OUTPUT, CALCOM);
(* PLOT SIERPINSKI CURVE OF ORDER N *)
(* N IS READ FROM INPUT, SUGGEST 1 <= N <= 7 *)
(* FROM N. WIRTH, ALGORITHMS + DATA STRUCTURES = PROGRAMS, P136 *)
(* 76/11/18. J. F. MINER *)
(* 77/02/17. J. T. EASTON *)
(* 77/05/30. J. P. STRAIT *)
(* THIS PROGRAM WAS USED TO GENERATE THE PASPLOT COVER DRAWING *)
(*$I'PASPLOT' INCLUDE PASPLOT DECLARATIONS *)
CONST
H0 = 512;
VAR
I, H, X, Y, X0, Y0, N : INTEGER;
CALCOM : CALCOMFILE;
PROCEDURE B(I : INTEGER); FORWARD;
PROCEDURE C(I : INTEGER); FORWARD;
PROCEDURE D(I : INTEGER); FORWARD;
PROCEDURE A(I : INTEGER);
BEGIN
IF I > 0 THEN
BEGIN
A(I-1); X := X+H; Y := Y-H; DRAW(X,Y);
B(I-1); X := X + 2*H; DRAW(X,Y);
D(I-1); X := X+H; Y := Y+H; DRAW(X,Y);
A(I-1)
END
END (*A*);
PROCEDURE B;
BEGIN
IF I > 0 THEN
BEGIN
B(I-1); X := X-H; Y := Y-H; DRAW(X,Y);
C(I-1); Y := Y-2*H; DRAW(X,Y);
A(I-1); X := X+H; Y := Y-H; DRAW(X,Y);
B(I-1)
END
END (*B*);
PROCEDURE C;
BEGIN
IF I > 0 THEN
BEGIN
C(I-1); X := X-H; Y := Y+H; DRAW(X,Y);
D(I-1); X := X-2*H; DRAW(X,Y);
B(I-1); X := X-H; Y := Y-H; DRAW(X,Y);
C(I-1)
END
END (*C*);
PASPLOT.26
1
PASPLOT - Appendix C - Sample Program 27 May 86
PROCEDURE D;
BEGIN
IF I > 0 THEN
BEGIN
D(I-1); X := X+H; Y := Y+H; DRAW(X,Y);
A(I-1); Y := Y + 2*H; DRAW(X,Y);
C(I-1); X := X-H; Y := Y+H; DRAW(X,Y);
D(I-1)
END
END (*D*);
BEGIN
READ(N);
REWRITE(CALCOM);
PLOTOPEN(CALCOM,LONGX,ATSIDE,10,10,'SIERPINSKI CURVES.');
SETORIGIN(1.0,1.0);
MOVE(0.25,-0.4);
DRAWSTRING('SIERPINSKI CURVES S1 TO S',25,0.21,0.0);
DRAWINTEGER(N,1,0.21,0.0);
DRAWCHAR('.',0.21,0.0);
MOVE(0.0,0.0);
SETSCALE(1 / 100);
I := 0; H := H0 DIV 4; X0 := 2*H; Y0 := 3*H;
REPEAT I := I+1; X0 := X0-H;
H := H DIV 2; Y0 := Y0+H;
X := X0; Y := Y0; MOVE(X,Y);
A(I); X := X+H; Y := Y-H; DRAW(X,Y);
B(I); X := X-H; Y := Y-H; DRAW(X,Y);
C(I); X := X-H; Y := Y+H; DRAW(X,Y);
D(I); X := X+H; Y := Y+H; DRAW(X,Y)
UNTIL I = N;
WRITELN(' PLOT IS ',PLOTCLOSE:4:2,' INCHES LONG.')
END (*SIERPINSKI*).
PASPLOT.27
1
PASPLOT - Appendix D - Plotfile Structure 27 May 86
Appendix D - Plotfile Structure
===============================
PASPLOT generates a disk or tape file consisting of directives in
a low-level plotting language which represent the plot. This plot
file is subsequently post-processed, usually by an auxiliary computer,
to drive a particular plotter. The general vector plotting language
which is used was originally designed for the University of Minnesota
FORTRAN plotting package PLOTPAC. This appendix describes only the
subset of the language which is used by PASPLOT, and is intended as a
guide for implementations of the post-processing software.
The plot file produced by PASPLOT consists of CDC logical records
which contain at most 200B 60-bit words. File marks are used to
separate plots and the last plot file is followed by two consecutive
file marks. The call to PLOTOPEN generates a small plot file which
contains the identifying message passed to PLOTOPEN and other informa-
tion such as the date and time. This plot file consists of vectors
which draw the character strings. A single plot bounded by calls to
PLOTOPEN and PLOTCLOSE generates two plot files, the first containing
identifying information and the second containing the plot itself.
Each word in each record contains 5 12-bit bytes which represent
vectors and directives. All vector commands refer to a coordinate
system where X increases across the paper and Y increases along the
length of the paper, regardless of whether the plot was generated in
LONGX or LONGY format. This means that PASPLOT reverses X and Y
values for a LONGX plot.
Directive Bytes Used by PASPLOT
-------------------------------
7777B Beginning of plot. This directive is the first byte of the
first record of a plot.
7776B End of plot directive. At least one of these directives
appears at the end of a plot file, and the remainder of the
last word is padded with them.
7772B Origin initialization directive. This directive represents the
initial pen position defined by the POSITION and ORIENTATION
parameters to PLOTOPEN. It is immediately followed by a byte
which has the form
9/0,2/POSITION,1/ORIENTATION
POSITION: 1 = ATSIDE.
2 = NEARSIDE.
3 = NOPOSITION.
ORIENTATION: 0 = LONGX.
1 = LONGY.
The initial pen position is set according to the following
table, assuming that the roll of unused plotting paper is above
you and is being drawn downward by the plotter. This means
PASPLOT.28
1
PASPLOT - Appendix D - Plotfile Structure 27 May 86
that as far as the vector directives are concerned, X increases
from left to right and Y increases upward. This unusual
plotter orientation is used for convenience in visualization,
although few plotters are actually mounted on the wall. Please
note that LONGX and LONGY only affect the initial pen position
and not the interpretation of the vector directives.
LONGX LONGY
----- -----
ATSIDE extreme right edge extreme left edge
NEARSIDE 1 inch from right edge 1 inch from left edge
NOPOSITION [ plotter operator sets the initial pen position ]
Vector Bytes
------------
Any byte which has a value less than 7721B represents the first
of an X-Y vector pair. The first byte specifies a change in X
position and indicates whether the pen is up or down during the
vector. The second byte specifies the change in Y position. The X
byte has the form
1/SIGN,1/PEN,10/DX
and the Y byte has the form
1/SIGN,11/DY.
DX cannot exceed 1000 (1750B) and DY cannot exceed 2000 (3720B). SIGN
indicates the sign of the change in X or Y position, and DX and DY
indicate the magnitudes of the changes. SIGN is 0 for a positive
change and is 1 for a negative change. PEN is 0 if the pen is to be
moved without drawing a line and is 1 if a line should be drawn. The
PASPLOT.29