title: Translating between cartesian and screen coordinates
body: <p>For my game I need functions to translate between two coordinate systems. Well it's mainly math question but what I need is the C++ code to do it and a bit of explanation how to solve my issue.</p>
  
  <p>Screen coordiantes:</p>
  
  <p>a) top left corner is 0,0</p>
  
  <p>b) no minus values</p>
  
  <p>c) right += x (the more is x value, the more on the right is point)</p>
  
  <p>d) bottom +=y</p>
  
  <p>Cartesian 2D coordinates:</p>
  
  <p>a) middle point is (0, 0)</p>
  
  <p>b) minus values do exist</p>
  
  <p>c) right += x</p>
  
  <p>d) bottom -= y (the less is y, the more at the bottom is point)</p>
  
  <p>I need an easy way to translate from one system to another and vice versa. To do that, (I think) I need some knowledge like where is the (0, 0) [top left corner in screen coordinates] placed in the cartesian coordinates. </p>
  
  <p>However there is a problem that for some point in cartesian coordinates after translating it to screen ones, the position in screen coordinates may be minus, which is a nonsense. I cant put top left corner of screen coordinates in (-inifity, +infinity) cartesian coords...</p>
  
  <p>How can I solve this? The only solution I can think of is to place screen (0, 0) in cartesian (0, 0) and only use IV quarter of cartesian system, but in that case using cartesian system is pointless...</p>
  
  <p>I'm sure there are ways for translating screen coordinates into cartesian coordinates and vice versa, but I'm doing something wrong in my thinking with that minus values.</p>