Drawing contour lines

Surface III generates a set of graphic instructions that are used by the plotting device to create a contour map. The instructions consist of a series of X and Y coordinates that define the path along which a contour line is to be drawn. Associated with each pair of coordinates is a command which causes the pen of a mechanical plotter to be raised (no line is drawn) or lowered (a line is drawn) while it is moving from the current to the next position. On a mechanical plotter, the pen moves in a straight line from one coordinate to another, unless the plotter is equipped with a look-ahead or other dynamic slope generator. However, Surface III allows the number of line segments to be drawn within each grid cell to be specified, so any desired degree of apparent smoothing can be achieved.

Contour lines are traced through the grid matrix, which is the mathematical model of the surface that has been generated by Surface III. A bicubic spline is fitted to a grid cell using values at the nodes forming the corners of the cell and values of the nodes defining the eight adjacent cells. In addition to the estimated values themselves, the tangents to slopes between nodes are calculated, as well as "twist vectors" describing the slopes across the edges of adjacent cells.

The point at which a contour line intersects the side of a grid cell is determined by interpolation along the bicubic spline. Intermediate points are estimated on the surface of the bicubic spline inside the grid cell, subdividing it into a set of subcells. The points where the contour line will cross the edges of these subcells are located by linear interpolation, and the contour line is created by connecting these points with straight lines. Greater apparent smoothness of the contour lines can be achieved by specifying a finer set of subcells.

The use of bicubic splines for surface interpolation insures that the contoured surface has locally continuous first and second derivatives (there will be no abrupt changes in slope from cell to cell), and that successive contour lines will exhibit consistent relationships to each other.


go back