Go to the documentation of this file.00001
00002 #ifndef vgl_h_matrix_3d_h_
00003 #define vgl_h_matrix_3d_h_
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include <vcl_vector.h>
00019 #include <vcl_iosfwd.h>
00020 #include <vnl/vnl_fwd.h>
00021 #include <vnl/vnl_matrix_fixed.h>
00022 #include <vgl/vgl_homg_point_3d.h>
00023 #include <vgl/vgl_homg_plane_3d.h>
00024
00025
00026
00027
00028 template <class T>
00029 class vgl_h_matrix_3d
00030 {
00031 protected:
00032 vnl_matrix_fixed<T,4,4> t12_matrix_;
00033 public:
00034 vgl_h_matrix_3d() {}
00035 ~vgl_h_matrix_3d() {}
00036 vgl_h_matrix_3d(const vgl_h_matrix_3d& M);
00037 vgl_h_matrix_3d(vnl_matrix_fixed<T,4,4> const& M);
00038 vgl_h_matrix_3d(vnl_matrix_fixed<T,3,3> const& M,
00039 vnl_vector_fixed<T,3> const& m);
00040 vgl_h_matrix_3d(const T* t_matrix);
00041 vgl_h_matrix_3d(vcl_istream&);
00042 vgl_h_matrix_3d(char const* filename);
00043 vgl_h_matrix_3d(vcl_vector<vgl_homg_point_3d<T> > const &points1,
00044 vcl_vector<vgl_homg_point_3d<T> > const &points2);
00045
00046
00047
00048 vgl_homg_point_3d<T> operator()(vgl_homg_point_3d<T> const& x) const;
00049 vgl_homg_point_3d<T> operator* (vgl_homg_point_3d<T> const& x) const {return (*this)(x);}
00050 bool operator==(vgl_h_matrix_3d<T> const& M) { return t12_matrix_ == M.get_matrix(); }
00051
00052 vgl_homg_plane_3d<T> preimage(vgl_homg_plane_3d<T> const& p);
00053
00054
00055 vgl_homg_point_3d<T> preimage(vgl_homg_point_3d<T> const& x) const;
00056 vgl_homg_plane_3d<T> operator()(vgl_homg_plane_3d<T> const& x) const;
00057
00058
00059 vgl_h_matrix_3d<T> operator * (vgl_h_matrix_3d<T> const& H) const
00060 {return t12_matrix_* H.t12_matrix_;}
00061
00062 bool read(vcl_istream&);
00063
00064
00065
00066 T get (unsigned int row_index, unsigned int col_index) const;
00067 void get (T* t_matrix) const;
00068 void get (vnl_matrix_fixed<T, 4, 4>* t_matrix) const;
00069 const vnl_matrix_fixed<T,4,4>& get_matrix() const { return t12_matrix_; }
00070 vgl_h_matrix_3d get_inverse() const;
00071
00072 void set (unsigned int row_index, unsigned int col_index, const T value)
00073 {t12_matrix_[row_index][col_index]=value;}
00074
00075 void set(const T *t_matrix);
00076 void set(vnl_matrix_fixed<T,4,4> const& t_matrix);
00077 bool projective_basis(vcl_vector<vgl_homg_point_3d<T> > const & five_points);
00078 void set_identity();
00079 void set_translation(T tx, T ty, T tz);
00080
00081 void set_rotation_about_axis(const vnl_vector_fixed<T,3>& axis, T angle);
00082 void set_rotation_roll_pitch_yaw(T yaw, T pitch, T roll);
00083 void set_rotation_euler(T rz1, T ry, T rz2);
00084 void set_rotation_matrix(vnl_matrix_fixed<T, 3, 3> const& R);
00085
00086 bool is_rotation() const;
00087 bool is_euclidean() const;
00088
00089
00090
00091
00092 vgl_h_matrix_3d<T> get_upper_3x3() const;
00093 vnl_matrix_fixed<T, 3,3> get_upper_3x3_matrix() const;
00094
00095
00096 vgl_homg_point_3d<T> get_translation() const;
00097 vnl_vector_fixed<T, 3> get_translation_vector() const;
00098 };
00099
00100
00101 template <class T> vcl_ostream& operator<<(vcl_ostream& s, vgl_h_matrix_3d<T> const& h);
00102 template <class T> vcl_istream& operator>>(vcl_istream& s, vgl_h_matrix_3d<T>& h);
00103
00104 #define VGL_H_MATRIX_3D_INSTANTIATE(T) extern "please include vgl/algo/vgl_h_matrix_3d.txx first"
00105
00106 #endif // vgl_h_matrix_3d_h_