26 #include <boost/operators.hpp>
42 private boost::equality_comparable<Vec3>,
43 private boost::additive<Vec3>,
44 private boost::additive<Vec3, Real>,
45 private boost::multiplicative<Vec3, Real>
49 Vec3(): x(0), y(0), z(0) {}
55 Vec3(
const Vec3& v): x(v.x), y(v.y), z(v.z) { }
70 explicit Vec3(
const double v[3]): x(v[0]), y(v[1]), z(v[2]) { }
73 explicit Vec3(
const float v[3]): x(v[0]), y(v[1]), z(v[2]) { }
87 return x==rhs.
x && y==rhs.
y && z==rhs.
z;
91 Real& operator[](std::size_t indx)
94 throw std::out_of_range(
"Index must be in the range [0-2]");
100 const Real& operator[](std::size_t indx)
const
103 throw std::out_of_range(
"Index must be in the range [0-2]");
151 return Vec3(-x, -y, -z);
183 Vec3 nrvo(d/v[0],d/v[1],d/v[2]);
189 os <<
"[" << v.
x <<
", " << v.
y <<
", " << v.
z <<
"]";
211 base_type::operator=(rhs);
216 Mat3 GetInertia()
const;
217 Vec3 GetCenter()
const;
218 Mat3 GetPrincipalAxes()
const;
219 Line3 GetODRLine()
const;
220 Plane GetODRPlane()
const;
226 Line3 FitCylinder(
const Vec3& initial_direction,
const Vec3& center)
const;
241 if (std::fabs(v.
w)<1e-10) {