Go to the documentation of this file.
35 #ifndef LVR2_GEOMETRY_BASEVECTOR_H_
36 #define LVR2_GEOMETRY_BASEVECTOR_H_
41 #include <Eigen/Dense>
59 template <
typename CoordT>
136 if(!(this->x == 0 && this->y == 0 && this->z == 0))
138 auto len = this->
length();
179 template<
typename CollectionT>
189 template<
typename CollectionT>
208 CoordT
operator[](
const unsigned& index)
const;
219 template<
typename T,
typename S>
222 #endif // ifndef __NVCC__
229 os <<
"Vec: [" << v.
x <<
" " << v.
y <<
" " << v.
z <<
"]" << std::endl;
248 template<
typename CoordType,
typename Scalar = CoordType>
252 CoordType x = mat(0, 0) * normal.
x + mat(1, 0) * normal.
y + mat(2, 0) * normal.
z;
253 CoordType y = mat(0, 1) * normal.
x + mat(1, 1) * normal.
y + mat(2, 1) * normal.
z;
254 CoordType z = mat(0, 2) * normal.
x + mat(1, 2) * normal.
y + mat(2, 2) * normal.
z;
263 #endif // ifndef __NVCC__
267 #include "lvr2/geometry/BaseVector.tcc"
CoordT length2() const
Returns the squared length of this vector.
BaseVector< CoordT > & operator-=(const BaseVector< CoordT > &other)
Element-wise subtraction.
CoordT length() const
Returns the length of this vector.
Normal< CoordT > normalized() const
Returns a normalized version of this vector.
A generic, weakly-typed vector.
BaseVector< CoordT > operator-(const BaseVector &other) const
Element-wise subtraction.
std::ostream & operator<<(std::ostream &os, const BaseVector< T > &v)
BaseVector< CoordT > operator/(const CoordT &scale) const
Scalar division.
CoordT distance2(const BaseVector &other) const
Calculates the squared distance to another vector.
bool operator!=(const BaseVector &other) const
BaseVector< CoordT > cross(const BaseVector &other) const
Calculates the cross product between this and the given vector. Returns a new BaseVector instance.
bool operator==(const BaseVector &other) const
BaseVector(const CoordT &x, const CoordT &y, const CoordT &z)
Builds a BaseVector with the given coordinates.
A vector guaranteed to be normalized (length = 1).
BaseVector< CoordT > operator*(const CoordT &scale) const
Scalar multiplication.
CoordType squaredDistanceFrom(const BaseVector< CoordType > &other) const
BaseVector(const BaseVector &o)
BaseVector< CoordT > & operator/=(const CoordT &scale)
Scalar division.
BaseVector< CoordT > operator+(const BaseVector &other) const
Element-wise addition.
CoordT distance(const BaseVector &other) const
Calculates the distance to another vector.
BaseVector< CoordT > & operator*=(const CoordT &scale)
Scalar multiplication.
BaseVector< CoordT > & operator+=(const BaseVector< CoordT > &other)
Element-wise addition.
CoordT dot(const BaseVector &other) const
Calculates the dot product between this and the given vector.
BaseVector()
Default constructs a null-vector.
CoordType distanceFrom(const BaseVector< CoordT > &other) const
static BaseVector< CoordT > average(const CollectionT &vecs)
Returns the average of all vectors in the given collection.
CoordT operator[](const unsigned &index) const
Indexed coordinate access (reading)
static BaseVector< CoordT > centroid(const CollectionT &points)
Returns the centroid of all points in the given collection.
BaseVector< CoordT > rotated(const BaseVector &n, const double &alpha) const
Calculates the rotated vector around an normal vector n with the rotation angle alpha.
BaseVector< CoordType > operator*(const Eigen::Matrix< Scalar, 4, 4 > &mat, const BaseVector< CoordType > &normal)
Multiplication operator to support transformation with Eigen matrices. Rotates the normal,...
lvr2
Author(s): Thomas Wiemann
, Sebastian Pütz , Alexander Mock , Lars Kiesow , Lukas Kalbertodt , Tristan Igelbrink , Johan M. von Behren , Dominik Feldschnieders , Alexander Löhr
autogenerated on Wed Mar 2 2022 00:37:22