Screen Coordinates to Cartesian Coordinates

Click For Summary

Discussion Overview

The discussion revolves around the conversion of screen coordinates, with the origin at the top left corner, to Cartesian coordinates. Participants explore the implications of different coordinate systems and transformations necessary for displaying Cartesian coordinates on a screen.

Discussion Character

  • Technical explanation
  • Conceptual clarification
  • Mathematical reasoning

Main Points Raised

  • One participant suggests that screen coordinates are already a form of Cartesian coordinates, differing only in the origin's location and the direction of the positive y-axis.
  • Another participant proposes that to convert screen coordinates to Cartesian coordinates, one must translate the origin and possibly adjust the scale and direction of the y-axis.
  • A specific mathematical transformation is provided, detailing how to calculate the screen coordinates from Cartesian coordinates using the center of the screen and a scaling factor.
  • There is mention of the possibility of calculating the inverse transformation for user interactions, such as mouse clicks.

Areas of Agreement / Disagreement

Participants express differing views on whether screen coordinates are fundamentally Cartesian or require transformation to fit a different Cartesian framework. The discussion remains unresolved regarding the interpretation of screen coordinates.

Contextual Notes

Participants assume familiarity with coordinate systems and transformations, but there are unresolved aspects regarding the definitions and implications of the coordinate systems discussed.

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.
 

Similar threads

  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 10 ·
Replies
10
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 4 ·
Replies
4
Views
1K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 24 ·
Replies
24
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
3
Views
4K