开发者

Historic reasons for Left-Handed Coordinate System

开发者 https://www.devze.com 2023-03-20 15:10 出处:网络
I find it a bit non-intuitive that the (0,0) maps to the left-top of the screen. Is there a historic reason for using a left-handed coordinate system i开发者_运维百科n Java Swing?

I find it a bit non-intuitive that the (0,0) maps to the left-top of the screen. Is there a historic reason for using a left-handed coordinate system i开发者_运维百科n Java Swing?

While mapping this to a right-handed system is not too difficult, I'm curious to know if there is any hidden benefit in having a left-handed system.


According to this article that's simply because that's the way it always was with television sets (which hasn't changed, BTW). So it seems that this early design decision still has an impact today.

Early home computers often were connected to the TV, so naturally they used this coordinate system. I guess a lot of monitors worked the same way simply because the manufacturers could partly recycle electronics/logic. And since this was then the "natural" coordinate system which programmers used (remember, we had to access the video system on a much lower level back then) it simply stuck as most people were used to it.

The exception to this model is PostScript and it successor, PDF. They model a paper and therefor weren't tied to use the screen's coordinate system for efficiency. They use (0,0) in the lower left, like mathematicians usually do. The NeXT used a video system called Display PostScript which is an extension to PostScript for drawing on-screen and thus used PostScripts system with (0,0) in the lower left. Todays Mac OS X derived from NeXT and thus also uses this system. On iOS, the Apple engineers decided to flip the system to the more common model with (0,0) in the upper left to make it easier for developers migrating from others systems.


I don't know any historical reason for it, but I think it actually makes sense. Or, rather, it makes sense given that we are in a culture that reads left to right and top to bottom.

Take a look, for example, at a web page--it extends to the right and downwards, so you never really know exactly where the bottom left-hands corner (for example) will be. On the other hand, if you take the top left-hand corner to be the origin, it will always be in the same place when you open page and you will never have to deal with negative numbers.

As such, it is my theory that the placement of the origin in the top left-hand corner is a product of the way we read.


Historically, TV pictures and fax machines scan from left-to-right, top-to-bottom. It's probably because most written languages are written that way, so if you're going to choose a scan direction, it's not surprising that people would choose to scan the same way.

Most written languages are left-to-right because most people are right-handed and there's less chance of smudging the ink of what you've already written.


It's arbitrary; GL, for example, puts (0, 0) at the bottom-left. In Java the relevant transformation is

protected void paintComponent(Graphics g) {
    super.paintComponent(g);
    Graphics2D g2d = (Graphics2D) g;
    ....
    AffineTransform at = g2d.getTransform();
    g2d.scale(1, -1);
    ...
    g2d.setTransform(at);
}


after doing some research, I could find nothing but statements that point out that in previous computers systems, the 0,0 was always the left upper corner, 'cause it's where one would begin writing.

And, as the text would continue to flow, it would go to the bottom, increasing the line number.

Some system have a convention to being like the cartesian plane: 0,0 is in the left, bottom. In general, drawing programs do that, because you would, in general, draw from that position.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号