27 #include <boost/operators.hpp>
43 private boost::equality_comparable<Vec2>,
44 private boost::additive<Vec2>,
45 private boost::additive<Vec2, Real>,
46 private boost::multiplicative<Vec2, Real>
65 explicit Vec2(
const float v[2]): x(v[0]), y(v[1]) { }
69 explicit Vec2(
const double v[2]): x(v[0]), y(v[1]) { }
81 return x==rhs.
x && y==rhs.
y;
100 throw std::out_of_range(
"index must be smaller than 2");
107 throw std::out_of_range(
"index must be smaller than 2");
173 return Vec2(d/v.
x, d/v.
y);
178 os <<
"(" << v[0] <<
"," << v[1] <<
")";
194 if (std::fabs(v.
w)<1e-10) {
Vec2(Real px, Real py)
Initialization with x, y and z component.
Vec2()
Default initialization, all components are set to zero.
Vec2 & operator-=(Real d)
Vec2 & operator/=(Real d)
dividable
Vec2 & operator+=(Real d)
Vec2(const double v[2])
explicit initialization with an array of floats
Vec2 & operator-=(const Vec2 &rhs)
subtractable op
Real & operator[](std::size_t indx)
element access
const Real & operator[](std::size_t indx) const
const element access
Vec2(const float v[2])
explicit initialization with an array of doubles
const Real & At(size_t indx) const
const Real * Data() const
bool operator==(const Vec2 &rhs) const
comparable
Vec2 & operator+=(const Vec2 &rhs)
addable op
Vec2(const Vec2 &v)
copy ctor
Vec2 & operator*=(Real d)
multipliable
Vec2 operator-() const
negateable
Three dimensional vector class, using Real precision.
std::vector< Vec2 > Vec2List
Vec2 operator/(Real d, const Vec2 &v)
std::ostream & operator<<(std::ostream &os, const AlignedCuboid &c)