contrib/oxl/oxp/Mapping_2d_2d.h

Go to the documentation of this file.
00001 // This is oxl/oxp/Mapping_2d_2d.h
00002 #ifndef Mapping_2d_2d_h_
00003 #define Mapping_2d_2d_h_
00004 //:
00005 // \file
00006 // \brief Mapping from R^2 -> R^2
00007 //
00008 //    Mapping_2d_2d is a base class for functions from R^2 -> R^2.
00009 //    Operations such as warping can take a Mapping_2d_2d object
00010 //    and therefore be able to perform arbitrary warps.
00011 //
00012 //    The user should subclass from Mapping_2d_2d, and write
00013 //    the virtual functions implement_map, and implement_inverse_map.
00014 //
00015 // \author
00016 //     Andrew W. Fitzgibbon, Oxford RRG, 16 Mar 97
00017 //
00018 // \verbatim
00019 //  Modifications
00020 //   10 Sep. 2004 Peter Vanroose  Inlined all 1-line methods in class decl
00021 // \endverbatim
00022 //-----------------------------------------------------------------------------
00023 
00024 #include <vnl/vnl_double_2.h>
00025 class Mapping_2d_2d
00026 {
00027  public:
00028   virtual ~Mapping_2d_2d() {}
00029 
00030   //: Map (x1, y1) to (x2, y2)
00031   void map(double x1, double y1, double* x2, double* y2) {
00032     implement_map(x1, y1, x2, y2);
00033   }
00034 
00035   //: x2 = map(x1);
00036   vnl_double_2 map(const vnl_vector<double>& in) {
00037     vnl_double_2 ret;
00038     implement_map(in[0], in[1], &ret[0], &ret[1]);
00039     return ret;
00040   }
00041 
00042   //: Inverse map (x2, y2) to (x1, y1)
00043   void inverse_map(double x1, double y1, double* x2, double* y2) {
00044     implement_inverse_map(x1, y1, x2, y2);
00045   }
00046 
00047   //: x1 = $map^{-1}(x1)$;
00048   vnl_double_2 inverse_map(const vnl_vector<double>& in) {
00049     vnl_double_2 ret;
00050     implement_inverse_map(in[0], in[1], &ret[0], &ret[1]);
00051     return ret;
00052   }
00053 
00054   virtual void implement_map(double x1, double y1, double* x2, double* y2) = 0;
00055   virtual void implement_inverse_map(double x2, double y2, double* x1, double* y1) = 0;
00056 };
00057 
00058 #endif // Mapping_2d_2d_h_

Generated on Tue Dec 2 05:14:28 2008 for contrib/oxl/oxp by  doxygen 1.5.1