27 #include <boost/operators.hpp>
42 private boost::equality_comparable<Vec4>,
43 private boost::additive<Vec4>,
44 private boost::additive<Vec4, Real>,
45 private boost::multiplicative<Vec4, Real>
49 Vec4(): x(0), y(0), z(0), w(1) { }
55 Vec4(
const Vec4& v): x(v[0]), y(v[1]), z(v[2]), w(v[3]) { }
64 explicit Vec4(
const float v[4]): x(v[0]), y(v[1]), z(v[2]), w(v[3]) { }
67 explicit Vec4(
const double v[4]): x(v[0]), y(v[1]), z(v[2]), w(v[3]) { }
81 return x==rhs.
x && y==rhs.
y && z==rhs.
z && w==rhs.
w;
85 Real& operator[](std::size_t indx)
92 const Real& operator[](std::size_t indx)
const
100 throw std::out_of_range(
"index must be smaller than 4");
107 throw std::out_of_range(
"index must be smaller than 4");
163 return Vec4(-x, -y, -z, -w);
198 Vec4 nrvo(d/v[0],d/v[1],d/v[2],d/v[3]);
204 os <<
"(" << v[0] <<
"," << v[1] <<
"," << v[2] <<
"," << v[3] <<
")";