title: 3D to 2D - moving camera
body: <p>I'm trying to make a 3D engine to to see how it works (i love to know how things exactly work) .. I heard that they put the camera somewhere and move and rotate the whole world - that was easy to make the only hard thing was making a function to multiply matrices<br>
  but i want to move the camera and keep the world at it's position - i saw some people doing it and i actually prefer it .. when i tried to make it myself i faced a simple mathematical problem<br>
  to understand the problem i will convert 2D to 1D instead of 3D to 2D(same thing)
  look at this picture:</p>
  
  <p><img src="https://i.stack.imgur.com/zum8m.jpg" alt="Figure"></p>
  
  <p>Now i have a Camera position(x,y) and it's Vector (the blue point) From 0 to 1<br>
  And i made another Vector from the camera to the object and divided it by the distance to get a vector from 0 to 1 (the white point)<br>
  Now the distance from the two vectors (d) are the displacement that i need to draw a point on the screen - but the problem is "which direction" .. distance is always positive so i have to determine if the second point is on the right of the direction vector or on the left - it's very simple for the eye but it's very hard using codes   </p>
  
  <p>when i tried to compare (y2-y1)/(x2-x1) i got incorrect results when one vector is on a quarter and the other vector is on another quarter (quarters of the Coordinate Plane) </p>
  
  <p>so how to compare those two vectors to see where it is according to the other vector?</p>
  
  <p>i also tried atan2 and i got some incorrect results but i think atan2 will be slow for computers because i have to calculate 2 times for every 3D point<br>
  if there is an easier way tell me</p>
  
  <p>i used many words to describe my question because i only know the simple words in english</p>