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;
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 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) {