Screen Coordinates to Cartesian Coordinates

In summary, there is an easy way to convert screen coordinates to Cartesian coordinates by finding the centre point and applying a translation and scaling. However, it is important to note that screen coordinates are already a form of Cartesian system, just with a different origin and orientation. To display in Cartesian coordinates on the screen, you can use the formula Xs=Xc+(X-Pcx)*S and Ys=Yc-(Y-Pcy)*S, where Xc and Yc are half of the screen size, Pcx and Pcy are the centre of the screen in Cartesian coordinates, and S is the scale factor from Cartesian to pixels.
  • #1
computerex
68
0
Hello. Is there some easy way to convert screen coordinates (origin at the top left corner) to Cartesian coordinates?
 
Technology news on Phys.org
  • #2
Sure: find the centre and translate...
 
  • #3
I think I know what you mean, but I think asking for it shows a misunderstanding. Screen coordinates are a rectilinear 2 dimensional system, so they are already Cartesian. They just happen to be a Cartesian system with the origin at the upper left corner and the positive y-axis pointing down the screen.

What I think you want is a Cartesian system with the origin in a different location and probably a different direction for the positive y axis. If this is true, then cristo's answer is the way to go. You are simply transforming from one Cartesian system to a different one.

John
 
  • #4
I have made an application where I need to display in Cartesian coordinates on the screen.
As Cristo said, you need to find the equivalent Cartesian coordintes of the centre point Pc. A translate willl bring Pc to the centre of the screen, and a scale will bring everything you want to see on the screen. You need to flip the sign of y so that y will go up instead.
Convert the centre of the screen in Carteesian coordinate to (Xc,Yc) in pixels, and S, scale to covert Cartesian to pixels. Usually, Xc and Yc are half of the screen size.
Xs=Xc+(X-Pcx)*S
Ys=Yc-(Y-Pcy)*S
where (X,Y) in Cartesian is mapped to (Xs,Ys) in screen coordinates, Pcx and Pcy are the centre of the screen in Cartesian coordinates, S is the scales factor from Cartesian to pixels.
You can calculte the inverse transformation if you pick things with the mouse.
 

What are screen coordinates and how are they different from Cartesian coordinates?

Screen coordinates refer to the x and y values used to locate a point on a computer screen, with the origin typically being the top left corner of the screen. Cartesian coordinates, on the other hand, refer to the x, y, and z values used to locate a point in a three-dimensional space. The origin in Cartesian coordinates is typically the center of the coordinate system.

How do you convert screen coordinates to Cartesian coordinates?

To convert screen coordinates to Cartesian coordinates, you can use the formula x = x_screen - (screen_width / 2) and y = (screen_height / 2) - y_screen. This will give you the x and y values in Cartesian coordinates, with the origin at the center of the screen.

Why is it important to convert screen coordinates to Cartesian coordinates?

Converting screen coordinates to Cartesian coordinates is important when working with three-dimensional graphics and animations. Cartesian coordinates allow for more precise positioning of objects in a three-dimensional space, while screen coordinates are limited to a two-dimensional plane.

What are the limitations of using screen coordinates?

Screen coordinates are limited to a two-dimensional plane, which means they cannot accurately represent objects in a three-dimensional space. They are also dependent on the size and resolution of the screen, making it difficult to ensure consistency across different devices.

How can you ensure accuracy when converting between screen coordinates and Cartesian coordinates?

To ensure accuracy when converting between screen coordinates and Cartesian coordinates, it is important to consider the size and resolution of the screen, as well as the position of the origin in each coordinate system. It may also be helpful to use mathematical functions or libraries specifically designed for this conversion.

Similar threads

  • Programming and Computer Science
Replies
5
Views
2K
  • Programming and Computer Science
Replies
6
Views
2K
  • Introductory Physics Homework Help
Replies
2
Views
125
Replies
2
Views
1K
Replies
4
Views
684
  • Differential Geometry
Replies
2
Views
2K
  • Programming and Computer Science
Replies
24
Views
1K
Replies
7
Views
1K
  • Introductory Physics Homework Help
Replies
30
Views
500
  • Special and General Relativity
Replies
4
Views
917
Back
Top