27 #include <boost/operators.hpp>
44 private boost::equality_comparable<Vec3>,
45 private boost::additive<Vec3>,
46 private boost::additive<Vec3, Real>,
47 private boost::multiplicative<Vec3, Real>
51 Vec3(): x(0), y(0), z(0) {}
57 Vec3(
const Vec3& v): x(v.x), y(v.y), z(v.z) { }
72 explicit Vec3(
const double v[3]): x(v[0]), y(v[1]), z(v[2]) { }
75 explicit Vec3(
const float v[3]): x(v[0]), y(v[1]), z(v[2]) { }
92 #pragma GCC diagnostic push
93 #pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
102 #pragma GCC diagnostic pop
107 return x==rhs.
x && y==rhs.
y && z==rhs.
z;
126 throw std::out_of_range(
"index must be smaller than 3");
133 throw std::out_of_range(
"index must be smaller than 3");
181 return Vec3(-x, -y, -z);
213 Vec3 nrvo(d/v[0],d/v[1],d/v[2]);
223 os <<
"[" << v.
x <<
", " << v.
y <<
", " << v.
z <<
"]";
234 public std::vector<Vec3>,
235 private boost::equality_comparable<Vec3List>,
236 private boost::additive<Vec3List>,
237 private boost::additive<Vec3List, Real>,
238 private boost::multiplicative<Vec3List, Real>
251 base_type::operator=(rhs);
257 if (this->size()!=rhs.size()){
258 throw std::length_error(
"Vec3List must have the same size");
260 for (
unsigned int i=0;i!=this->size();++i) {
261 if (((*
this)[i])!=((rhs)[i])){
270 if (this->size()!=rhs.size()){
271 throw std::length_error(
"Vec3List must have the same size");
273 for (
unsigned int i=0;i!=this->size();++i) {
274 (*this)[i]+=(rhs)[i];
280 for (
unsigned int i=0;i!=this->size();++i) {
289 if (this->size()!=rhs.size()){
290 throw std::length_error(
"Vec3List must have the same size");
292 for (
unsigned int i=0;i!=this->size();++i) {
293 (*this)[i]-=(rhs)[i];
300 for (
unsigned int i=0;i!=this->size();++i) {
319 for (
unsigned int i=0;i!=this->size();++i) {
328 for (
unsigned int i=0;i!=this->size();++i) {
335 Mat3 GetInertia()
const;
336 Vec3 GetCenter()
const;
337 Mat3 GetPrincipalAxes()
const;
338 Line3 GetODRLine()
const;
339 Plane GetODRPlane()
const;
340 void ApplyTransform(
const Mat4& m);
341 Real GetSummedSquaredDistances(
const Vec3List& other)
const;
343 Real GetGDTHA(
const Vec3List& other,
bool norm=
true)
const;
344 Real GetGDTTS(
const Vec3List& other,
bool norm=
true)
const;
356 std::pair<Line3, Real> FitCylinder(
const Vec3& initial_direction)
const;
371 if (std::fabs(v.
w)<1e-10) {
Vec3List & operator*=(Real d)
negateable
const Real & At(size_t indx) const
Vec3List & operator-=(Real d)
bool operator==(const Vec3 &rhs) const
comparable
const Real * Data() const
Vec3List(const Vec3List &rhs)
Vec3List(base_type::iterator b, base_type::iterator e)
Vec2 operator/(Real d, const Vec2 &v)
Real & operator[](std::size_t indx)
element access
Vec3List(size_t size, const Vec3 &value=Vec3())
Vec3List & operator-=(const Vec3List &rhs)
subtractable op
Vec3(const float v[3])
explicit initialization with an array of floats
Vec3List & operator=(const Vec3List &rhs)
Vec3()
Default initialization, all components are set to zero.
Vec3(Real px, Real py, Real pz)
Initialization with x, y and z component.
std::vector< Vec3 > base_type
Vec3 & operator+=(const Vec3 &rhs)
addable op
Vec3List(const base_type &rhs)
Vec3 & operator-=(const Vec3 &rhs)
subtractable op
Three dimensional vector class, using Real precision.
Vec3 & operator*=(Real d)
multipliable
Vec3List & operator/=(Real d)
dividable
Vec3 operator-() const
negateable
Vec3List & operator+=(const Vec3List &rhs)
addable op
Real GetX() const
element access
const Real & operator[](std::size_t indx) const
const element access
Vec3(const Vec3 &v)
copy ctor
Vec3List & operator+=(Real d)
std::ostream & operator<<(std::ostream &os, const AlignedCuboid &c)
#define DLLEXPORT_OST_GEOM
Vec3 & operator+=(Real d)
Vec3 & operator/=(Real d)
dividable
Vec3(const double v[3])
explicit initialization with an array of doubles
bool operator==(const Vec3List &rhs) const
comparable
Vec3 & operator-=(Real d)