00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef GEOM_VEC4_H
00020 #define GEOM_VEC4_H
00021
00022 #include <cstddef>
00023 #include <ostream>
00024
00025 #include <boost/operators.hpp>
00026
00027 #include <ost/geom/module_config.hh>
00028 #include <ost/config.hh>
00029
00030 namespace geom {
00031
00032
00033 class Vec2;
00034 class Vec3;
00035 class Mat4;
00036
00037
00038
00039
00040 class DLLEXPORT_OST_GEOM Vec4:
00041 private boost::equality_comparable<Vec4>,
00042 private boost::additive<Vec4>,
00043 private boost::additive<Vec4, Real>,
00044 private boost::multiplicative<Vec4, Real>
00045 {
00046 public:
00048 Vec4();
00049
00051 Vec4(Real x, Real y, Real z, Real w);
00052
00054 Vec4(const Vec4& v);
00055
00057 Vec4(const Vec2& v);
00058
00060 Vec4(const Vec3& v);
00061
00063 explicit Vec4(const Real[4]);
00064
00065 #if OST_DOUBLE_PRECISION
00067 explicit Vec4(const float[4]);
00068 #endif
00069
00071 Vec4& operator=(const Vec4& v);
00072
00074 bool operator==(const Vec4& rhs) const;
00075
00077 Real& operator[](std::size_t indx);
00079 const Real& operator[](std::size_t indx) const;
00080
00082 Vec4& operator+=(const Vec4& rhs);
00083 Vec4& operator+=(Real d);
00085 Vec4& operator-=(const Vec4& rhs);
00086 Vec4& operator-=(Real d);
00088 Vec4 operator-() const;
00090 Vec4& operator*=(Real d);
00092 Vec4& operator/=(Real d);
00093
00094 Real* Data() {return data_;}
00095 const Real* Data() const {return data_;}
00096
00097 private:
00098 Real data_[4];
00099
00100 void set(Real x, Real y, Real z, Real w);
00101 };
00102
00103 DLLEXPORT_OST_GEOM Vec4 operator/(Real, const Vec4& v);
00104
00105 DLLEXPORT_OST_GEOM std::ostream& operator<<(std::ostream&, const Vec4&);
00106
00107 }
00108
00109 # endif