Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Screen Coordinates to Cartesian Coordinates

  1. Nov 1, 2008 #1
    Hello. Is there some easy way to convert screen coordinates (origin at the top left corner) to Cartesian coordinates?
  2. jcsd
  3. Nov 1, 2008 #2


    User Avatar
    Staff Emeritus
    Science Advisor

    Sure: find the centre and translate...
  4. Nov 1, 2008 #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.

  5. Nov 1, 2008 #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.
    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.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook