Screen Coordinates to Cartesian Coordinates

AI Thread Summary
To convert screen coordinates, which originate from the top left corner, to Cartesian coordinates, it's essential to understand that screen coordinates are already a form of Cartesian system. The main requirement is to adjust the origin and the direction of the positive y-axis. To achieve this, one must identify the center point of the screen and apply a translation to reposition it to the center of the Cartesian system. Additionally, a scaling factor is necessary to convert Cartesian coordinates to pixel values. The transformation equations are as follows: Xs = Xc + (X - Pcx) * S and Ys = Yc - (Y - Pcy) * S, where (X, Y) represents Cartesian coordinates, (Xs, Ys) are the corresponding screen coordinates, and Pcx and Pcy denote the center of the screen in Cartesian coordinates. This method allows for accurate mapping and can also facilitate inverse transformations for user interactions, such as mouse clicks.
computerex
Messages
68
Reaction score
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
Sure: find the centre and translate...
 
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
 
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.
 
Thread 'Is this public key encryption?'
I've tried to intuit public key encryption but never quite managed. But this seems to wrap it up in a bow. This seems to be a very elegant way of transmitting a message publicly that only the sender and receiver can decipher. Is this how PKE works? No, it cant be. In the above case, the requester knows the target's "secret" key - because they have his ID, and therefore knows his birthdate.
Back
Top