2

I have been researching why the origins for most graphic applications are located in the top left corner of the screen. From everything I have read, they are located there because that is where the electron gun on a cathode ray tube would start to scan, from top to bottom.

Other than this historical reason, is there any usefulness to having the origin in the upper left hand corner versus (which is personally more natural to me) the bottom left hand corner?

From my knowledge, I can't think of any reason that one origin might be more useful than the other.

In terms of math, I don't think it should make any difference, as long as the relation between the pixels/point in the image stay the same you should be able to apply any mathematical transformation in the same way using either origin.

I am specifically looking for examples that show why it would be better to use one origin over the other, and not just for the reason that "this is the way it was done before" or "its easier this way because device x uses it" because all of those reasons relate back to the historical reason.

AnotherUser
  • 163
  • 1
  • 4
  • as you have an [account there](http://ux.stackexchange.com/users/50279/anotheruser), did you consider asking at UX.SE? – gnat Aug 05 '14 at 18:55
  • 1
    I went between using stack, math, and this. But now that I remember it UX would probably be better suited for this. – AnotherUser Aug 05 '14 at 18:56
  • Are you looking for a mathematical reason why one would be better (in terms of coding)? Or from a usability standpoint? – GrandmasterB Aug 05 '14 at 18:56
  • I guess either. I am wondering if there is a definitive reason why one would be better than the other; even in a special case. Every reason I have found is because it just makes sense to do so. Such as with cathode ray tubes, it makes sense to draw on the screen top down because thats how it happens physically. But there is no real reason it has to be drawn top down, it just so happened to happen that way. – AnotherUser Aug 05 '14 at 19:01
  • 2
    Keep in mind, not every graphics platform has Y increasing as you move down. OpenGL for example has Y increase as you move up the display. The top-left origin for graphics tends to only exist in 2D graphics environments. – GrandmasterB Aug 05 '14 at 19:11
  • 3
    A [related question](http://programmers.stackexchange.com/questions/226529/in-ios-y-axis-starts-from-the-top-and-grows-downward-it-is-the-opposite-to-osx/227729#227729) (near dupe) –  Aug 05 '14 at 19:22
  • It is better cause it requires more effort from the programmer and is buggier so you can bill more hours. :-) – user949300 Aug 06 '14 at 01:35
  • Maybe because the results of trig functions all return positive values in quadrant 1, so you don't need to transform coordinates? I haven't used trig for a long time, but I seem to recall something like that. – TMN Aug 05 '14 at 21:05

4 Answers4

8

I believe it is somewhat bound up with development of technology and applications.

The case

Text sent over serial communications, goes first character first, second character second, and so on. IMHO, it makes no sense to do otherwise because we can start reading as soon as the message starts, and we don't need any extra layout information. For western languages, that is top left, to bottom right. This started with the telegraph. The West developed much of the technology, so it makes sense that we made it easy for ourselves.

Text stored in computer memory is easiest to receive low address to high address, and easiest to manipulate when it is in the same order as we read it, first character at the lowest address, last character at the highest address.

Early text terminals did not store pixels, but instead stored character codes, and converted character codes to pixels on the fly (in hardware). So storing the received character codes in screen memory was the simplest option. Early personal computers did the same, and for some personal computers, the screen memory was just ordinary memory. So it uses less resources, or is easier to make, and easier to program for screen memory and in-memory text to store characters in the same order.

Screen memory must be serialised to an image representation in the order the screen needs it, i.e. for the electron gun to paint it. Technically, the electron-gun scan direction may be arbitrary, and could start in any corner, but IMHO culturally it makes sense for western language readers. Hence existing display devices (CRT's painting top-left to bottom-right) worked perfectly as computer displays.

It makes sense for western languages to have the text 0, 0 origin for a text display start at the top left.

IMHO, it makes a lot of sense to match a graphics device 0,0 origin to the textual display origin (though, IIRC, some devices did not!).

More Detail

The in-memory screen image is a chunk of memory with linearly increasing addresses. So the electronics to retrieve memory for display would be a more convenient if the screen-refresh counter started at '0' (i.e. the start of image memory), and just incremented in synch with drawing the screen. Simple DMA systems do this. It would then make some more sense that the graphic coordinate system map to that memory address simply. Minimum complexity would argue for aligning screen refresh addressing with graphics coordinate addressing; and they would share an origin.

The opposite case, where the two addressing schemes work in the opposite direction seems to increase hardware complexity for no apparent hardware benefit. At the time these decisions were being made, hardware was expensive.

However, I think the story starts with text terminals, remote text display devices for shared computers. Some old fashioned 'dumb character terminals' (which were CRT based) were addressed from the first line down, when they moved to a character position. So if you think about textual displays as a starting point, it might make more sense than starting with graphics.

Top-left origin makes sense for things like textual menu's and textual user interfaces (e.g. forms), which is typically read top to bottom left to right in western languages.

It is easy to write text onto a screen starting top left (western language), and it is somewhat independent of screen resolution; just let the device fold text or scroll when a boundary is reached.

Further, it took quite a lot of processing power to scroll the text up the screen (yes, seriously), and that visual effect was quite unpleasant (scrolling an entire row of text by a character height, on a long persistence phosphor screen), so it would make some sense to make it easy to start writing at the top of the screen, and minimise scrolling.

Typically the screen could be cleared completely, and the cursor set top left with a single command. Also it might be using communications systems with under 300 characters/second, 2400 baud (I know people who read faster than that).

Those display devices would typically wrap onto the next line automatically and silently (yes, seriously).

So it takes no maths to write (western) text, top to bottom, staring at the top, the devices can be quite simple, and the comms quite slow.

So, the display is doing some of the work autonomously, it is not all done by the program, and in-terminal processing is limited. It might even struggle to receive text, and write it if it had to scroll every line it receives.

The terminal is connecting to the computing system over public telephone lines, using modems, their is limited bandwidth (say 2400 baud). The shared computer might not know what type of terminal is connecting.

It is practical to write from the top left, using little more than tab, line-feed, return and clear screen. As long as the developer ensures the textual menu does not scroll off the screen on the smallest screens, then it is somewhat deice and screen resolution independent. The effect is quite pleasing because the screen text 'stays still', making it easy to read before the whole screen is finished, rather than flickering with scrolling.

Driving round the screen (e.g. using cursor keys), or jumping to a specific character location is straightforward because the in-memory coordinates of the text and the screen coordinates are 'the same'.

gbulmer
  • 478
  • 2
  • 6
  • But the math involved in drawing a menu/text from either origin is equally as difficult/easy. To draw a menu/text with a top origin you just start with y=0 and increase and for a bot origin start at y=max and decrease. – AnotherUser Aug 05 '14 at 18:56
  • Yes, the math is the same level of difficulty, but when you're moving your cursor and counting lines manually, how far down to the lower-left do you have to go before you reach zero? – JeffO Aug 05 '14 at 19:48
  • Writing text top to bottom on a text terminal requires no maths. IMHO JeffO has answered the rest. – gbulmer Aug 05 '14 at 20:02
  • Another library to add to the list from the 2400 and before days - curses uses a upper left (0,0) coordinate system. –  Aug 05 '14 at 21:15
  • In the days of terminals, the direction that CRTs drove in was completely up to the driving electronics. CRTs attached to text terminals used left to right, top to bottom schemes, but other schemes where common where useful. TVs used interlacing as a variant, whilst vector CRTs could be found in arcade machines and CAD workstations. Oscilloscopes used left to right, constant brightness with signal modulating a 0 at the center. And radar systems used a rotating around the center, center out movement scheme. – user1937198 Mar 22 '21 at 00:22
2

In the days of old, we had things like CRTs and input devices like the light pen.

CRT scan lines are from left to right, top to bottom. This had implications when accessing memory or clock cycles for drawing images - one wanted to be able to access the memory in the order that it was being used.

Thus, the index for video information started in the upper left. Later conventions for video memory and graphics followed on this.

See also Why are graphics coordinates measured from the upper left? on Stack Overflow.

  • 3
    All of this seems to just be based on the fact that CRT's are top to bottom, which behind that is just a whim of the man who built it. There is no real reason the electron gun started at the top and went down. – AnotherUser Aug 05 '14 at 19:03
  • @AnotherUser nope. Likely none at all. Maybe the convention of English text going left to right, top to bottom. But this is just speculation. But the 0,0 of many graphics systems is likely tied to that original convention. –  Aug 05 '14 at 19:04
  • @AnotherUser also note that not all modern graphics libraries follow this 0,0 upper left convention. The SO answer I linked points out that Cocoa and Quartz use a lower left origin. –  Aug 05 '14 at 19:08
  • 1
    @AnotherUser Cathode Ray Tubes had been around for 70 years before commonplace computer use. Historical image coordinates are obvious and natural for the earlier uses, so are more of a historical accident than a *whim*. – andy256 Aug 05 '14 at 23:26
0

If you have a scrolling display of text with increasing amounts added to the end, which you see so often on the web now, then it seems natural to have the origin at the top, and for y to increase downwards. How many languages read from bottom to top? Incidentally I think the custom may have been set by Apple with the first edition of 'Inside Mac', justified by a text being read from top to bottom.

0

I can’t give you exact reasons, but I used Quartz on MacOS with zero at the bottom and UUKit on iOS with zero at the top, and always felt that Quartz was an absolute pain in the behind. It was always a lot harder to think about code positioning things where you wanted them.

Technology wise there is zero difference between both. Consider that you can turn your phone or tablet around any way you like.

In terms of usefulness, it makes life easier for software developers to put zero at the top.

gnasher729
  • 42,090
  • 4
  • 59
  • 119
  • 1
    It makes life easier only until you need linear algebra. At that point Y axis pointing upward simplifies things, origin at top left would mean negative Y coordinates and switching between two systems is the most awkward of all. Y axis pointing up is also most natural for people with math background. – ojs Mar 21 '21 at 10:15
  • Ojs I don’t need linear algebra. And origin at top left with negative y coordinates means things off the top of the screen so you got something really wrong. – gnasher729 Mar 21 '21 at 15:08
  • Of course you don't. The world doesn't always rotate around your needs or preferences. – ojs Mar 21 '21 at 17:57
  • So what actual argument do you have? – gnasher729 Mar 22 '21 at 19:50
  • To rephrase myself, origin at top left and Y coordinate pointing downwards makes coordinate transformations more awkward and doesn't really have any benefits. – ojs Mar 23 '21 at 11:40