contrib/gel/mrc/vpgl/algo/vpgl_ray.h
Go to the documentation of this file.
00001 // This is gel/mrc/vpgl/algo/vpgl_ray.h
00002 #ifndef vpgl_ray_h_
00003 #define vpgl_ray_h_
00004 //:
00005 // \file
00006 // \brief Methods for computing the camera ray direction at a given 3-d point
00007 // \author J. L. Mundy
00008 // \date Dec 22, 2007
00009 
00010 #include <vpgl/vpgl_rational_camera.h>
00011 #include <vpgl/vpgl_local_rational_camera.h>
00012 #include <vnl/vnl_double_3.h>
00013 #include <vgl/vgl_point_3d.h>
00014 #include <vgl/vgl_vector_3d.h>
00015 
00016 class vpgl_ray
00017 {
00018  public:
00019   ~vpgl_ray();
00020 
00021   //: Generic camera interfaces (pointer for abstract class)
00022   // Solves using back-project so will work for any camera
00023   // The ray direction assumes the camera is in the positive half-space
00024   // of the x-y plane. This assumption is necessary since some cameras
00025   // don't have a natural center of projection (e.g. rational cameras).
00026 
00027        // === vnl interface ===
00028 
00029   //: compute the ray at a given 3-d point
00030   static  bool ray(const vpgl_camera<double>* cam,
00031                    vnl_double_3 const& point_3d,
00032                    vnl_double_3& ray);
00033 
00034        // === vgl interface ===
00035 
00036   //: compute the ray at a given 3-d point
00037   static bool ray(const vpgl_camera<double>*  cam,
00038                   vgl_point_3d<double> const& point_3d,
00039                   vgl_vector_3d<double>& ray);
00040 
00041             // +++ concrete rational camera interfaces +++
00042 
00043        // === vnl interface ===
00044 
00045   //: compute the ray at a given 3-d point
00046   static bool ray(vpgl_rational_camera<double> const& rcam,
00047                   vnl_double_3 const& point_3d,
00048                   vnl_double_3& ray);
00049 
00050        // === vgl interface ===
00051 
00052   //: compute the ray at a given 3-d point
00053   static bool ray(vpgl_rational_camera<double> const& rcam,
00054                   vgl_point_3d<double> const& point_3d,
00055                   vgl_vector_3d<double>& ray);
00056 
00057   //: compute a ray in local Cartesian coordinates at a given (u, v)
00058   static bool ray(vpgl_local_rational_camera<double> const& lrcam,
00059                   const double u, const double v, 
00060                   vgl_point_3d<double>& origin, vgl_vector_3d<double>& dir);
00061 
00062 // compute a ray in local Cartesian coordinates for a local rational cam
00063   static bool plane_ray(vpgl_local_rational_camera<double> const& lrcam,
00064                         const vgl_point_2d<double> image_point1,
00065                         const vgl_point_2d<double> image_point2,
00066                         vgl_plane_3d<double>& plane);
00067 
00068  private:
00069   //: constructor private - static methods only
00070   vpgl_ray();
00071 };
00072 
00073 #endif // vpgl_ray_h_