00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef GEOM_MAT2_HH
00020 #define GEOM_MAT2_HH
00021
00022 #include <cstddef>
00023 #include <ostream>
00024
00025 #include <boost/operators.hpp>
00026
00027 #include <ost/geom/module_config.hh>
00028
00029 namespace geom {
00030
00031 class DLLEXPORT_OST_GEOM Mat2:
00032 private boost::equality_comparable<Mat2>,
00033 private boost::additive<Mat2>,
00034 private boost::multiplicative2<Mat2, Real>
00035 {
00036 public:
00037 static Mat2 Identity();
00038
00040 Mat2();
00041
00043
00051 Mat2(Real i00, Real i01, Real i10, Real i11);
00052
00054 Mat2(const Mat2& m);
00055
00057 explicit Mat2(const Real[4]);
00058
00060 Mat2& operator=(const Mat2& m);
00061
00063 bool operator==(const Mat2& rhs) const;
00064
00066 Real& operator()(std::size_t r, std::size_t c);
00068 const Real& operator()(std::size_t r, std::size_t c) const;
00069
00071 Mat2& operator+=(const Mat2& rhs);
00073 Mat2& operator-=(const Mat2& rhs);
00074
00075 Mat2& operator*=(const Real d);
00076 Mat2& operator/=(const Real d);
00077
00078 Mat2& operator*=(const Mat2& m);
00079
00080 Real* Data() {return &data_[0][0];}
00081 const Real* Data() const {return &data_[0][0];}
00082
00083 private:
00084 Real data_[2][2];
00085
00086 void set(Real i00, Real i01, Real i10, Real i11);
00087 };
00088
00089 DLLEXPORT_OST_GEOM std::ostream& operator<<(std::ostream& os, const Mat2& m);
00090
00091 }
00092
00093
00094 #endif