need to find corner points of view area

Started by
1 comment, last by Spencer Bowers 11 years, 11 months ago
I'm interfacing with a video camera mounted on a plane. The camera can tell me its GPS position (latitude, longitude, altitude) and the GPS position of its view area's center point (called Line of Sight). I also know the camera's horizontal field of view and aspect ratio. I can also acquire the plane's heading, pitch and roll, and the heading and pitch angles of the camera. The library I'm using (like Google Earth in Java) can convert between GPS positions and Cartesian coordinates used by OpenGL and can also do a ray cast against Earth geometry and return the point of collision.

I want to find the four corners of the camera's viewing area as GPS positions so I can draw the camera's view on the globe. As I said, if I can get the Cartesian coords then I can do the conversion to GPS. Here's what I have so far.

  1. Convert camera position and line of sight to Cartesian coords.
  2. Calculate the camera's direction vector: losPosition - cameraPosition
  3. For each corner, rotate the direction vector by half the field of view in each direction
  4. Use the camera point and rotated direction vector as a ray; do a raycast into earth geometry
  5. Convert collision point back into GPS position

When I draw the resulting bounding box, it's in the right area on the globe, but the shape is totally wrong. My guess is that I need to rotate the rays around the plane's up/forward/right axes instead of the world axes. Am I on the right track? If so, is there an easy way to find those axes? Can you think of an easier, or even just different, approach to this problem?
Advertisement
You are indeed on the right track.

What you need to do is use the heading, and roll to determine the plane's axes. I'm confused about the pitch variable, though. If you know your line of sight, only roll (rotation about the line of sight) is needed to determine your orientation. What is pitch for?
I was just listing the relevant information that I can get from the camera. But wouldn't pitch be necessary to find the right axes? If the plane is pitched up or down that would certainly seem to make a difference on its forward and up vectors.

This topic is closed to new replies.

Advertisement