Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm working on generating a 3D-looking application (in 2D) and am having difficulty generating my graphing points equally. I can only graph in 2D, but want to have a 3D look to it (similar to a FPS-style game).

My question: If I have a 3-dimension point $(X, Y, Z)$, what formula should I use to calculate the adjusted $(X, Y)$ points given my current point of view?

Example: Say I have a point $(-5, 5, 5)$. This would lie in the second quadrant of a standard graph, but if my view is at $(0, 0, 0)$, the point should not appear right at $(-5, 5)$ [in 2D], but slightly lower, and to the right a bit. How do I calculate where this point is located at in terms of $(X, Y)$?

share|cite|improve this question
There are, of course, libraries that do the work for you.... – Hurkyl Apr 9 '12 at 3:05

I'm afraid that's not enough info to determine the answer. For example, if you're sitting at (0,0,0) and look directly at (-5,5,5), it will be in the center of your field of view: (0,0).

Try this... sit in a chair facing a window. Look at something outside. Your line of vision will intersect the the window in one point, which you can find by trigonometry. Those (x,y) coordinates on the window are what you're looking for on the computer monitor. It's pretty straightforward once you understand the need to place the "window" in the virtual world, in addition to your point of view. For more on that, search for ray tracing.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.