Historic reasons for Left-Handed Coordinate System

∥☆過路亽.° 提交于 2019-12-04 03:14:12

问题


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 in 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.


回答1:


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.




回答2:


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.




回答3:


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.




回答4:


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);
}



回答5:


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.



来源:https://stackoverflow.com/questions/6698817/historic-reasons-for-left-handed-coordinate-system

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!