• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Coordinate System in Java

 
Ranch Hand
Posts: 104
2
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I have a very basic doubt regarding coordinate system used in Java and in 'C'. Here the origin is at the top left corner of the screen. Why it is not at the bottom left corner ? Since in conventional coordinate system, first quadrant represents the positive values for X and Y and its origin usually at the bottom left corner. Please clarify.

Regards
Omkar V S
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
as long as you know where it starts, why does it matter?
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Omkar Shetkar wrote:Since in conventional coordinate system, first quadrant represents the positive values for X and Y and its origin usually at the bottom left corner.


There are no negative values for X&Y in UI, so why waste screen space.
This question would be more suitable on the Java in General forum. Maybe some who has more technical knowledge about how CRTs work might be able to throw some light on this one. Moving thread.
 
Sheriff
Posts: 22784
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Maneesh Godbole wrote:There are no negative values for X&Y in UI, so why waste screen space.


I think what Omkar meant was why user interfaces do not have a coordinate system like PDF files do - start at the bottom left corner, and a higher Y value means higher in the document / higher in the user interface.

I can think of one reason - the simple fact that user interfaces are usually built from top to bottom. By flipping the coordinate system, you can still start at (0,0).

Consider a layout manager that lays out all components below each other. With the top left being (0,0):
Now the same example with the bottom left being (0,0):
The latter looks a bit less intuitive to me.
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think that the reason why screen coordinates usually go from the top left to the bottom right corner has to do with how old-fashioned CRT screens work: they draw the screen line by line, from top to bottom, each line being drawn from left to right. Because the CRT screen starts drawing at the top, it's more natural to start counting at the top.
 
Omkar Shetkar
Ranch Hand
Posts: 104
2
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for all your replies.

To consolidate, there is no particular one reason for the coordinate system to have origin at top left but there could be multiple reasons:

  • Top down approach while screen designing
  • It is more intuitive and understandable to design from top to down
  • Interlaced scanning of the CRT monitor which starts at top left corner and ends at bottom right corner




  • Regards
    Omkar V S


     
    lowercase baba
    Posts: 13089
    67
    Chrome Java Linux
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    I would further add that when you read an English document, you start at the top left and work your way down. Since many programming languages were developed by English-speaking people, it's natural to start building a document from there.
     
    Ranch Hand
    Posts: 32
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    I worked on some early CRT screen layout software. All of the previous replies apply, but there is more. Screens scroll, and not all screens had the same number of lines. The difference from the normal mathematics convention is a small negative factor, more than offset by several positive factors.
    reply
      Bookmark Topic Watch Topic
    • New Topic