左手坐标系的历史原因

发布于 2024-11-19 21:07:21 字数 110 浏览 6 评论 0原文

我发现 (0,0) 映射到屏幕的左上角有点不直观。在 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 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

血之狂魔 2024-11-26 21:07:22

从历史上看,电视图片和传真机是从左到右、从上到下扫描的。这可能是因为大多数书面语言都是这样编写的,所以如果你要选择扫描方向,人们会选择相同的方式扫描也就不足为奇了。

大多数书面语言都是从左到右的,因为大多数人都是右撇子,因此不太可能弄脏已经写下的内容。

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.

唔猫 2024-11-26 21:07:22

这是任意的;例如,GL 将 (0, 0) 放在左下角。在Java中相关的转换是

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

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);
}
檐上三寸雪 2024-11-26 21:07:22

在做了一些研究之后,我除了指出在以前的计算机系统中,0,0 总是左上角的陈述之外什么也找不到,因为这是人们开始书写的地方。

而且,随着文本继续流动,它会到达底部,从而增加行号。

某些系统有一个类似于笛卡尔平面的约定:0,0 位于左侧底部。一般来说,绘图程序会这样做,因为通常您会从该位置进行绘图。

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.

无戏配角 2024-11-26 21:07:21

根据“为什么原点在左上角?” 作者:Raymond Chen 这只是因为电视机一直都是这样(顺便说一句,这一点没有改变)。所以看来这个早期的设计决策至今仍然具有影响。

早期的家用电脑经常连接到电视,所以很自然地使用了这个坐标系。我猜想很多显示器都以同样的方式工作,只是因为制造商可以部分回收电子/逻辑。由于这是当时程序员使用的“自然”坐标系(请记住,当时我们必须在较低的级别上访问视频系统),因此它只是卡住了,因为大多数人都习惯了它。

该模型的例外是 PostScript 及其后继者 PDF。他们对纸张进行建模,因此不必为了提高效率而使用屏幕坐标系。他们在左下角使用 (0,0),就像数学家通常所做的那样。 NeXT 使用称为 Display PostScript 的视频系统,该系统是 PostScript 的扩展,用于在屏幕上绘图,因此使用左下角为 (0,0) 的 PostScripts 系统。今天的 Mac OS X 源自 NeXT,因此也使用这个系统。在 iOS 上,苹果工程师决定将系统翻转为左上角为 (0,0) 的更常见模型,以便开发人员更容易从其他系统迁移。

According to “Why is the origin at the upper left corner?” by Raymond Chen 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.

↘紸啶 2024-11-26 21:07:21

我不知道其中有什么历史原因,但我认为它确实有道理。或者更确切地说,考虑到我们所处的文化是从左到右、从上到下阅读,这是有道理的。

例如,看一下网页 - 它向右和向下延伸,因此您永远无法真正知道左下角(例如)在哪里。另一方面,如果你以左上角为原点,那么当你打开页面时它总是在同一个位置,你永远不必处理负数。

因此,我的理论是,原点位于左上角的位置是我们阅读方式的产物。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文