Go to the documentation of this file.00001 #ifndef msm_wt_mat_2d_h_
00002 #define msm_wt_mat_2d_h_
00003
00004
00005
00006
00007
00008 #include <vcl_cassert.h>
00009 #include <vcl_iosfwd.h>
00010 #include <vcl_string.h>
00011 #include <vsl/vsl_fwd.h>
00012
00013
00014
00015
00016 class msm_wt_mat_2d
00017 {
00018 private:
00019 double m11_, m12_, m22_;
00020 public:
00021
00022
00023 msm_wt_mat_2d()
00024 : m11_(1.0),m12_(0.0),m22_(1.0) {}
00025
00026
00027 msm_wt_mat_2d(double m11, double m12, double m22)
00028 : m11_(m11),m12_(m12),m22_(m22)
00029 { assert(m11_>=0); assert(m22_>=0);}
00030
00031
00032 ~msm_wt_mat_2d() {}
00033
00034
00035
00036
00037
00038
00039 void set_axes(double u1, double u2, double s1, double s2);
00040
00041 double m11() const { return m11_; }
00042 double m12() const { return m12_; }
00043 double m21() const { return m12_; }
00044 double m22() const { return m22_; }
00045
00046
00047 double det() const { return m11_*m22_ - m12_*m12_; }
00048
00049
00050 void eigen_values(double& EV1, double& EV2);
00051
00052
00053 msm_wt_mat_2d transform_by(double a, double b) const;
00054
00055
00056 double xWx(double x, double y) const
00057 { return x*x*m11_+y*y*m22_+2*x*y*m12_; }
00058
00059
00060 msm_wt_mat_2d operator*(msm_wt_mat_2d& W) const;
00061
00062
00063 msm_wt_mat_2d& operator*=(double s);
00064
00065
00066 msm_wt_mat_2d& operator+=(const msm_wt_mat_2d& W);
00067
00068
00069 msm_wt_mat_2d inverse() const;
00070
00071
00072 void print_summary(vcl_ostream& os) const;
00073
00074
00075 void b_write(vsl_b_ostream& bfs) const;
00076
00077
00078 void b_read(vsl_b_istream& bfs);
00079
00080
00081 bool operator==(const msm_wt_mat_2d& wt_mat);
00082 };
00083
00084
00085
00086 void vsl_b_write(vsl_b_ostream& bfs, const msm_wt_mat_2d& pts);
00087
00088
00089 void vsl_b_read(vsl_b_istream& bfs, msm_wt_mat_2d& pts);
00090
00091
00092 vcl_ostream& operator<<(vcl_ostream& os,const msm_wt_mat_2d& pts);
00093
00094
00095 void vsl_print_summary(vcl_ostream& os,const msm_wt_mat_2d& pts);
00096
00097 #endif // msm_wt_mat_2d_h_