Okay, here goes.

I have a camera at (Xc, Yc, Zc.) The Xc and Yc coordinates are latitude/longitude, and the Zc coordinate is an altitude in metres. I have a point at (Xp, Yp, Zp) and a field of view on the camera (Th1, Th2) - where Th1 is horizontal FOV and Th2 is vertical FOV.

Given this information, I'd like to:

  • test if the point is visible (i.e. in the camera's FOV)
  • project the point as the camera would see it

I've figured out already that the camera's horizontal view at any given distance is tan(Th1) * distance, but I don't know how to test if the point is visible.

Accuracy is not critical. I would prefer a simple solution over a complicated solution, if it works well enough. The computations will be performed by a small microcontroller, which isn't very fast at things like trig functions.

P.S. this is not homework, I'm doing this for some game development. It will be integrated with the real world, hence the latitude/longitude/altitude. It involves flying real RC planes through virtual hoops (or chasing virtual targets), so I have to project the positions of these hoops on a display.


2 Answers 2


You're missing some information - you've haven't got the direction that the camera is facing. I normally represent this by a matrix, but you could use axis/angle or quaternion representations too. So, assuming you already have a matrix M_view that takes a world-space point and converts it into a view space point, you can easily do it without any trig or floating point divides. My thoughts are this:

  • project point into view space. Ie. P_view = M_view * P_world.
  • calculate the horizontal view span size given the depth of P_view (ie. P_View.z * absTanTH1)
  • calculate the vertical view span size given the depth of P_view (ie. P_view.Z * absTanTH2)
  • check whether P_view.xy are within both horizontal and vertical spans.

In the end you should have a function that looks like this:

bool isPointInFrustum(vec3& P_view, float absTanTH1, float absTanTH2)
  if (P_view.z < 0.0 ||                          // point is behind camera
      abs(P_view.x) < (absTanTH1 * P_view.z)) || // point is outside horizontal planes of frustum
      abs(P_view.y) < (absTanTH2 * P_view.z))    // point is outside vertical planes of frustum
    return false;
  return true;

absTanTH1/TH2 are pre-calculated constants, computed like this:

  absTanTH1 = abs(tan(TH1));
  absTanTH2 = abs(tan(TH2));

  • \$\begingroup\$ Thanks for your answer. I will investigate this. :) Good point on the direction the camera is heading. This should be called heading. \$\endgroup\$
    – Thomas O
    Oct 12, 2010 at 6:27
  • \$\begingroup\$ With P_view.z, what if the camera is at a z of, say, 20, and the object is at 10. Would that just be replaced by P_view.z < 10? \$\endgroup\$
    – Thomas O
    Oct 12, 2010 at 6:28
  • \$\begingroup\$ No, because by definition, P_view is the object's position relative to the camera. In the circumstance you describe (camera at 20, and object at 10), and camera was facing away from the object then P_view.z would be -10. If camera was facing towards the object then P_view.z would be 10. \$\endgroup\$
    – jpaver
    Oct 12, 2010 at 16:17

I am facing the exact same kind of problematic, so I was happy to find that post, but things remain a little confusing to me.

I do not understand how the conversion from M_View to P_View works.

Here what I have - the absolute 6d position of the camera (x,y,z,wx,wy,wz) and its fields of view - the absolute 3d position of a point

I would like : to know of the point is in the field of vision of the camera

I understood how to answer this question once I have P_View, but I do not get how the conversion takes place ...

Thanks a lot


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .