27 #include <boost/operators.hpp>
43 private boost::equality_comparable<Vec3>,
44 private boost::additive<Vec3>,
45 private boost::additive<Vec3, Real>,
46 private boost::multiplicative<Vec3, Real>
50 Vec3(): x(0), y(0), z(0) {}
56 Vec3(
const Vec3& v): x(v.x), y(v.y), z(v.z) { }
71 explicit Vec3(
const double v[3]): x(v[0]), y(v[1]), z(v[2]) { }
74 explicit Vec3(
const float v[3]): x(v[0]), y(v[1]), z(v[2]) { }
88 return x==rhs.
x && y==rhs.
y && z==rhs.
z;
92 Real& operator[](std::size_t indx)
99 const Real& operator[](std::size_t indx)
const
107 throw std::out_of_range(
"index must be smaller than 3");
114 throw std::out_of_range(
"index must be smaller than 3");
162 return Vec3(-x, -y, -z);
194 Vec3 nrvo(d/v[0],d/v[1],d/v[2]);
200 os <<
"[" << v.
x <<
", " << v.
y <<
", " << v.
z <<
"]";
211 public std::vector<Vec3>,
212 private boost::equality_comparable<Vec3List>,
213 private boost::additive<Vec3List>,
214 private boost::additive<Vec3List, Real>,
215 private boost::multiplicative<Vec3List, Real>
228 base_type::operator=(rhs);
234 if (this->size()!=rhs.size()){
235 throw std::length_error(
"Vec3List must have the same size");
237 for (
unsigned int i=0;i!=this->size();++i) {
238 if (((*
this)[i])!=((rhs)[i])){
247 if (this->size()!=rhs.size()){
248 throw std::length_error(
"Vec3List must have the same size");
250 for (
unsigned int i=0;i!=this->size();++i) {
251 (*this)[i]+=(rhs)[i];
257 for (
unsigned int i=0;i!=this->size();++i) {
266 if (this->size()!=rhs.size()){
267 throw std::length_error(
"Vec3List must have the same size");
269 for (
unsigned int i=0;i!=this->size();++i) {
270 (*this)[i]-=(rhs)[i];
277 for (
unsigned int i=0;i!=this->size();++i) {
296 for (
unsigned int i=0;i!=this->size();++i) {
305 for (
unsigned int i=0;i!=this->size();++i) {
312 Mat3 GetInertia()
const;
313 Vec3 GetCenter()
const;
314 Mat3 GetPrincipalAxes()
const;
315 Line3 GetODRLine()
const;
316 Plane GetODRPlane()
const;
322 Line3 FitCylinder(
const Vec3& initial_direction,
const Vec3& center)
const;
337 if (std::fabs(v.
w)<1e-10) {