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;
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] <<
")";
Vec4 & operator*=(Real d)
multipliable
Vec4(const Vec4 &v)
copy ctor
Vec4 & operator/=(Real d)
dividable
Vec4 & operator+=(Real d)
Vec4()
Default initialization, all components are set to zero.
Vec4(const double v[4])
explicit initialization with an array of doubles
Real GetX() const
element access
const Real & operator[](std::size_t indx) const
const element access
Vec4 & operator=(const Vec4 &v)
assignement op
Vec4 & operator+=(const Vec4 &rhs)
addable op
Vec2 operator/(Real d, const Vec2 &v)
Vec4 & operator-=(Real d)
bool operator==(const Vec4 &rhs) const
comparable
const Real & At(size_t indx) const
Vec4 operator-() const
negateable
Real & operator[](std::size_t indx)
element access
Three dimensional vector class, using Real precision.
const Real * Data() const
Vec4 & operator-=(const Vec4 &rhs)
subtractable op
Vec4(Real px, Real py, Real pz, Real pw)
Initialization with x, y and z component.
std::ostream & operator<<(std::ostream &os, const AlignedCuboid &c)
Vec4(const float v[4])
explicit initialization with an array of floats