Archives ::

Wed, 28 Apr 2010

We deal with two-dimensional coordinate systems and vectors all the time when we're working with computer systems. Documents are two-dimensional, using a physical representation of the page. The screen is two-dimensional, and us regular mouse-users move the mouse in two dimensions. By and large, when we look at the horizontal movement, we count from the left across to the right - this is how the ruler on your favourite word-processor or graphics system is typically set up. It kind of makes sense given the prevalence of Western influence in mathematics and engineering; our writing is written left-to-right and so we write the numbers on our rulers this way. It's pretty difficult to escape from the left-to-right paradigm, even if you're left-handed. When it comes to the vertical, however, the rules are less fixed.

Sometimes the vertical axis is numbered from bottom to top; positive values above the origin, negative values below. I don't really know where this convention comes from, but it's easy to understand. When I want to say how far away something is from me, chances are I'll say that it's a certain distance in front of me. If I denote that on a piece of paper and then hold it up, I find that the further away something is, the higher up I place it on the paper.

Things that measure up the page:

  • Maps
  • x-y plots
  • Plans and elevations
  • Chessboards (from white side)

Sometimes, however, we measure from top to bottom. Imagine the process of writing on a piece of paper. You're probably imagining something that starts from the edge furthest from you, and coming towards you. Why do we go this way? One reason is that if you start close and move away, there's more chance of smudging what you've already done as you reach over it to write the next line. (It's the same as the process of filling up the auditorium for a lecture, a play or a film. You ought to start in the least accessible places and work outwards, rather than perching on the end of the row and forcing everyone to go past you to get to their seats.) If you start counting lines down the page, why not measure distances that way as well?

Things that measure down the page:

  • Framebuffers
  • Text lines
  • CRT beams (most of the time)
  • Chessboards (from black side)

Different computer systems follow different conventions. For laying out graphics on a page, you often find the origin in the lower left and the Y-axis increasing upwards. For writing text, the Y-axis is more naturally oriented increasing downwards. I've just checked in my current install of Office 2007; Word measures distance down the page, and Visio measures it upwards.

Is this ever a problem? Well, it depends if you're likely to be referring to coordinate positions a lot. If you're writing code that manipulates graphics, you'll need to know which way the vertical axis is measured. Have you memorised which way up the vertical axis is in LaTeX picture environments? Matlab plots? HTML 5 canvases? ImageMagick -draw commands?

The take-home message here is never to assume that you know what the vertical axis direction is. Always check - it may even be configurable, in which case you may have made an incorrect assumption about it. The message extends out to angles (which axis is zero? Is positive clockwise or anticlockwise? Are you measuring in degrees or radians?) and into three (and more) dimensions. It's best to make sure, and perhaps think now and again on where these discrepancies come from.

Add a comment:

Comments are closed for this story.