contrib/oxl/mvl/HMatrix3D.h
Go to the documentation of this file.
00001 // This is oxl/mvl/HMatrix3D.h
00002 #ifndef HMatrix3D_h_
00003 #define HMatrix3D_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007 //:
00008 // \file
00009 //
00010 // A class to hold a 3D projective transformation matrix
00011 // and to perform common operations using it e.g. transfer point.
00012 //
00013 // \verbatim
00014 // Modifications
00015 //    22 Oct 2002 - Peter Vanroose - added vgl_homg_point_3d interface
00016 //    23 Oct 2002 - Peter Vanroose - using fixed 3x3 matrices throughout
00017 // \endverbatim
00018 
00019 #include <vnl/vnl_double_4x4.h>
00020 #include <vnl/vnl_fwd.h>
00021 #include <vgl/vgl_homg_point_3d.h>
00022 #include <vgl/algo/vgl_homg_operators_3d.h> // matrix * vgl_homg_point_3d
00023 #include <mvl/HomgPoint3D.h>
00024 #include <mvl/HomgLine3D.h>
00025 #include <mvl/HomgLineSeg3D.h>
00026 #include <vcl_iosfwd.h>
00027 
00028 class PMatrix;
00029 
00030 class HMatrix3D : public vnl_double_4x4
00031 {
00032   typedef vnl_double_4x4 Base;
00033  public:
00034   HMatrix3D();
00035   HMatrix3D(const HMatrix3D& M);
00036   HMatrix3D(vnl_double_4x4 const& M);
00037   HMatrix3D(vnl_double_3x3 const& M, vnl_double_3 const& m);
00038   HMatrix3D(const double* t_matrix);
00039   HMatrix3D(vcl_istream&);
00040  ~HMatrix3D();
00041 
00042   // Operations----------------------------------------------------------------
00043 
00044   HomgPoint3D transform(const HomgPoint3D& x1) const;
00045   vgl_homg_point_3d<double> transform(const vgl_homg_point_3d<double>& x1) const
00046     { return (*this) * x1; }
00047   HomgLine3D transform(const HomgLine3D& l1) const;
00048 
00049   bool load(vcl_istream&);
00050 
00051   // Data Access---------------------------------------------------------------
00052 
00053   double get (unsigned int row_index, unsigned int col_index) const;
00054   void get (double *t_matrix) const;
00055   void get (vnl_matrix<double>* t_matrix) const;
00056 
00057   HMatrix3D get_inverse() const;
00058 };
00059 
00060 PMatrix operator* (const PMatrix&, const HMatrix3D& H);
00061 
00062 // stream I/O
00063 vcl_ostream& operator<<(vcl_ostream &,HMatrix3D const &);
00064 vcl_istream& operator>>(vcl_istream &,HMatrix3D       &);
00065 
00066 #endif // HMatrix3D_h_