26 #include <boost/operators.hpp>
41 private boost::equality_comparable<Vec4>,
42 private boost::additive<Vec4>,
43 private boost::additive<Vec4, Real>,
44 private boost::multiplicative<Vec4, Real>
48 Vec4(): x(0), y(0), z(0), w(0) { }
54 Vec4(
const Vec4& v): x(v[0]), y(v[1]), z(v[2]), w(v[3]) { }
63 explicit Vec4(
const float v[4]): x(v[0]), y(v[1]), z(v[2]), w(v[3]) { }
66 explicit Vec4(
const double v[4]): x(v[0]), y(v[1]), z(v[2]), w(v[3]) { }
80 return x==rhs.
x && y==rhs.
y && z==rhs.
z && w==rhs.
w;
84 Real& operator[](std::size_t indx)
87 throw std::out_of_range(
"Index must be in the range [0-3]");
93 const Real& operator[](std::size_t indx)
const
96 throw std::out_of_range(
"Index must be in the range [0-3]");
151 return Vec4(-x, -y, -z, -w);
186 Vec4 nrvo(d/v[0],d/v[1],d/v[2],d/v[3]);
192 os <<
"(" << v[0] <<
"," << v[1] <<
"," << v[2] <<
"," << v[3] <<
")";