Two sources of vast confusion in reading the C code are these:
(1) the code uses x and y as though they're Cartesian coordinate
variables, but (inconsistently) swaps them around so that "x"
variables usually refer to the y direction in the output charts.
(2) Coordinates in the y direction (whether they are x variables or
not) increase *downwards* (charts are printed row zero first).
There is extremely ugly and confusing code in targetcheck() and
getcourse() where two opposite sets of conventions bump up against
each other.
As a first step, towards untangling this mess, we'll change the
nomenclature so that coordinate names refer to 'i' and 'j'
directions, as in matrix indices (i vertical, increasing downwards,
and j horizontal, increasing rightwards). This patch does that for
the coord class members, also fixing two small bugs that turned
up during testing.
More steps will be necessary...