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) {
371 if (std::fabs(v.
w)<1e-10) {
Three dimensional vector class, using Real precision.
Vec3 & operator-=(Real d)
Vec3 & operator+=(Real d)
Vec3(const float v[3])
explicit initialization with an array of floats
bool operator==(const Vec3 &rhs) const
comparable
Vec3 operator-() const
negateable
Vec3 & operator*=(Real d)
multipliable
Vec3 & operator-=(const Vec3 &rhs)
subtractable op
Vec3 & operator/=(Real d)
dividable
Real & operator[](std::size_t indx)
element access
Vec3(const double v[3])
explicit initialization with an array of doubles
const Real & operator[](std::size_t indx) const
const element access
Vec3()
Default initialization, all components are set to zero.
Vec3 & operator=(const Vec3 &v)
assignement op
const Real & At(size_t indx) const
Vec3(const Vec3 &v)
copy ctor
const Real * Data() const
Vec3(Real px, Real py, Real pz)
Initialization with x, y and z component.
Vec3 & operator+=(const Vec3 &rhs)
addable op
Real GetX() const
element access
Vec3List(const base_type &rhs)
Plane GetODRPlane() const
Real GetGDTTS(const Vec3List &other, bool norm=true) const
std::vector< Vec3 > base_type
Vec3List & operator+=(Real d)
Vec3List(base_type::iterator b, base_type::iterator e)
Real GetGDT(const Vec3List &other, Real thresh, bool norm=true) const
Real GetGDTHA(const Vec3List &other, bool norm=true) const
Vec3List(size_t size, const Vec3 &value=Vec3())
bool IsWithin(const Vec3List &other, Real dist) const
Vec3List & operator-=(Real d)
Vec3List(const Vec3List &rhs)
std::pair< Line3, Real > FitCylinder(const Vec3 &initial_direction) const
Vec3List & operator+=(const Vec3List &rhs)
addable op
Vec3List & operator/=(Real d)
dividable
void ApplyTransform(const Mat4 &m)
Mat3 GetPrincipalAxes() const
Real GetRMSD(const Vec3List &other) const
bool operator==(const Vec3List &rhs) const
comparable
Vec3List & operator*=(Real d)
negateable
Vec3List & operator-=(const Vec3List &rhs)
subtractable op
Real GetMinDist(const Vec3List &other) const
Real GetSummedSquaredDistances(const Vec3List &other) const
Vec3List & operator=(const Vec3List &rhs)
#define DLLEXPORT_OST_GEOM
Vec2 operator/(Real d, const Vec2 &v)
std::ostream & operator<<(std::ostream &os, const AlignedCuboid &c)