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;
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]);
204 os <<
"[" << v.
x <<
", " << v.
y <<
", " << v.
z <<
"]";
215 public std::vector<Vec3>,
216 private boost::equality_comparable<Vec3List>,
217 private boost::additive<Vec3List>,
218 private boost::additive<Vec3List, Real>,
219 private boost::multiplicative<Vec3List, Real>
232 base_type::operator=(rhs);
238 if (this->size()!=rhs.size()){
239 throw std::length_error(
"Vec3List must have the same size");
241 for (
unsigned int i=0;i!=this->size();++i) {
242 if (((*
this)[i])!=((rhs)[i])){
251 if (this->size()!=rhs.size()){
252 throw std::length_error(
"Vec3List must have the same size");
254 for (
unsigned int i=0;i!=this->size();++i) {
255 (*this)[i]+=(rhs)[i];
261 for (
unsigned int i=0;i!=this->size();++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];
281 for (
unsigned int i=0;i!=this->size();++i) {
300 for (
unsigned int i=0;i!=this->size();++i) {
309 for (
unsigned int i=0;i!=this->size();++i) {
316 Mat3 GetInertia()
const;
317 Vec3 GetCenter()
const;
318 Mat3 GetPrincipalAxes()
const;
319 Line3 GetODRLine()
const;
320 Plane GetODRPlane()
const;
329 std::pair<Line3, Real> FitCylinder(
const Vec3& initial_direction)
const;
344 if (std::fabs(v.
w)<1e-10) {
Vec3 & operator=(const Vec3 &v)
assignement op
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)