1 // This is core/vpgl/vpgl_camera.h
2 #ifndef vpgl_camera_h_
3 #define vpgl_camera_h_
4 //:
5 // \file
6 // \brief A general camera class.
7 // \author Thomas Pollard
8 // \date January 28, 2005
9 // \author Joseph Mundy, Matt Leotta, Vishal Jain
10 //
11 //   A basic abstract camera class on which all specific cameras are based.
12 //   As such there is only one operation it performs:
13 //   project a 3d world point into a 2d image point.  The class is templated
14 //   over T which had better be an algebraic field. Since camera operations are
15 //   based on projective geometry, it could be that case that T is complex
16 //   in order to account for projecting quadric surfaces.
17 //
18 // \verbatim
19 //  Modifications
20 //   October 26, 2006 - Moved homogeneous methods to projective camera, since
21 //                      projective geometry may not apply in the most general case, e.g. rational cameras. - JLM
22 // \endverbatim
23 
24 #include <string>
25 #ifdef _MSC_VER
26 #  include <vcl_msvc_warnings.h>
27 #endif
28 #include <vbl/vbl_ref_count.h>
29 
30 template <class T>
31 class vpgl_camera : public vbl_ref_count
32 {
33  public:
34 
35   vpgl_camera() = default;
36   ~vpgl_camera() override = default;
37 
38   //: class identity functions for casting
type_name()39   virtual std::string type_name() const { return "vpgl_camera"; }
is_a()40   std::string is_a() const {return type_name();}
is_class(std::string const & name)41   bool is_class(std::string const& name) const {return type_name() == name;}
42 
43   //: The generic camera interface. u represents image column, v image row.
44   virtual void project(const T x, const T y, const T z, T& u, T& v) const = 0;
45 
46   //: clone *this* polymorphically
47   virtual vpgl_camera<T> *clone() const = 0;
48 };
49 
50 // convenience typedefs for smart pointers to abstract cameras
51 #include "vpgl_camera_double_sptr.h"
52 #include "vpgl_camera_float_sptr.h"
53 
54 #endif // vpgl_camera_h_
55