We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello I am new to Processing. I am familiar with the Cartesian coordinate system, hence I don't find the Processing coordinate system very intuitive. If the origin (0,0) is the pixel in the upper left-hand corner, why are increasing values of Y, positive, instead of negative? Values of Y below the X-axis are usually negative, whereas values of Y above the X-axis are usually positive. Why did the designers of Processing choose to use such a coordinate system, and ignore the long-established Cartesian system, which is widely used in the disciplines of mathematics and engineering?
Answers
If you research just a little, you're gonna find Cartesian coord. is pretty rare among computer languages!
Processing isn't exactly a computer language, but rather a framework for many of them!
For example: Java, JavaScript, CoffeeScript, Ruby, Python, C/C++, etc.
Thus it practically needs to rely on the most used coordinate system for computers! >-)
GoToLoop is right, the idea isn't new in computing, the top-down axis has been used for decades in computer display.
I think the main reason comes from the CRT display: the electron beams start at the top-left, goes to right to draw the first line, then start again on left on the next line, etc.
In early computers, the pixels were mapped directly in memory, first byte (or bit for B&W) in memory representing the first pixel, etc., so that's a natural representation. I suppose it was kept out of habit, even after the display surface became more abstract.
Understood, thank you.
Logical, thank you.
Side note: it can be seen as laziness (should be easy to map coordinates to keep Cartesian model), but we are talking of an era where every little CPU cycle counter. Of an era of 1 MHz microprocessors... I saw code where instead of using a loop to iterate on each line of display, they removed the loop (has to increment a variable and to check its value) and made a line of code per display line! Such optimizations... GoToLoop would have been in heaven! ;-)
Of course, I am talking about assembly language here, not high level languages. (And games, that must not miss a single frame.)
I pre-date that era :~)