The fundamental hypothesis of the <PLOT> contour programs is that linear interpolation will suffice. Since the monomials 1, x, and y form a basis or first degree functions of two variables, the Vandermonde matrix for the combination will have dimension 3. Usually planar data is taken from a square or rectangular grid; if the corners of the grid squares are used as base points, there will be one too many. Rather than worry about all the ways that contour lines can cross a square, <PLOT> divides each square into two triangles, which are then treated separately. The three vertices of each half square fit nicely into the interpolation formula. When the approximation of linearity is grossly erroneous, the existence of a preferred diagonal becomes quite visible in the erratic wanderings of the contour.
For this case the basic equation has the form
The Vandermonde matrix is
The inverse matrix is
However it is arrived at, the equation can be exhibited in the explicit
For the purposes of contouring, it is fortunate that the basic equation is an implicit equation of considerable symmetry. For purposes of interpolation, z can be expressed as a function of x and y, but it is equally possible to assign z a value and solve for y as a function of x.
Even so, the equations appear rather formidable. If a specific contour
value z0 has been chosen, the term in z can be combined with the
constant term obtain an equation for a line in a plane:
For uniformity of appearance, z0 could be subtracted from the last
rows of the two left hand determinants. Further consolidation results
from selecting a specific value for one of the remaining variables, say
x0. Then the formula for y would be