A vector guaranteed to be normalized (length = 1). More...
#include <BaseVector.hpp>

Public Member Functions | |
| CoordType | getX () const |
| CoordType | getY () const |
| CoordType | getZ () const |
| Normal () | |
| Normal (BaseVector< CoordType > base) | |
| Creates a normal vector from the underlying vector representation. More... | |
| Normal (CoordType x, CoordType y, CoordType z) | |
| Initializes the normal with the given coordinates. More... | |
| template<typename T > | |
| Normal< CoordType > | operator+ (const T &other) const |
| template<typename T > | |
| Normal< CoordType > | operator- (const T &other) const |
| Normal< CoordType > | operator- () const |
| template<typename T > | |
| Normal< CoordType > & | operator= (const T &other) |
Public Member Functions inherited from lvr2::BaseVector< CoordType > | |
| BaseVector () | |
| Default constructs a null-vector. More... | |
| BaseVector (const CoordType &x, const CoordType &y, const CoordType &z) | |
| Builds a BaseVector with the given coordinates. More... | |
| BaseVector (const BaseVector &o) | |
| BaseVector< CoordType > | cross (const BaseVector &other) const |
| Calculates the cross product between this and the given vector. Returns a new BaseVector instance. More... | |
| CoordType | distance (const BaseVector &other) const |
| Calculates the distance to another vector. More... | |
| CoordType | distance2 (const BaseVector &other) const |
| Calculates the squared distance to another vector. More... | |
| CoordType | distanceFrom (const BaseVector< CoordType > &other) const |
| CoordType | dot (const BaseVector &other) const |
| Calculates the dot product between this and the given vector. More... | |
| CoordType | length () const |
| Returns the length of this vector. More... | |
| CoordType | length2 () const |
| Returns the squared length of this vector. More... | |
| void | normalize () |
| Normal< CoordType > | normalized () const |
| Returns a normalized version of this vector. More... | |
| bool | operator!= (const BaseVector &other) const |
| BaseVector< CoordType > | operator* (const CoordType &scale) const |
| Scalar multiplication. More... | |
| CoordType | operator* (const BaseVector< CoordType > &other) const |
| BaseVector< CoordType > & | operator*= (const CoordType &scale) |
| Scalar multiplication. More... | |
| BaseVector< CoordType > | operator+ (const BaseVector &other) const |
| Element-wise addition. More... | |
| BaseVector< CoordType > & | operator+= (const BaseVector< CoordType > &other) |
| Element-wise addition. More... | |
| BaseVector< CoordType > | operator- (const BaseVector &other) const |
| Element-wise subtraction. More... | |
| BaseVector< CoordType > & | operator-= (const BaseVector< CoordType > &other) |
| Element-wise subtraction. More... | |
| BaseVector< CoordType > | operator/ (const CoordType &scale) const |
| Scalar division. More... | |
| BaseVector< CoordType > & | operator/= (const CoordType &scale) |
| Scalar division. More... | |
| bool | operator== (const BaseVector &other) const |
| CoordType | operator[] (const unsigned &index) const |
| Indexed coordinate access (reading) More... | |
| CoordType & | operator[] (const unsigned &index) |
| Indexed coordinate access (writing) More... | |
| BaseVector< CoordType > | rotated (const BaseVector &n, const double &alpha) const |
| Calculates the rotated vector around an normal vector n with the rotation angle alpha. More... | |
| CoordType | squaredDistanceFrom (const BaseVector< CoordType > &other) const |
Static Public Member Functions | |
| template<typename CollectionT > | |
| static Normal< CoordType > & | average (const CollectionT &normals) |
| Returns the average of all normals in the given collection. More... | |
Static Public Member Functions inherited from lvr2::BaseVector< CoordType > | |
| static BaseVector< CoordType > | average (const CollectionT &vecs) |
| Returns the average of all vectors in the given collection. More... | |
| static BaseVector< CoordType > | centroid (const CollectionT &points) |
| Returns the centroid of all points in the given collection. More... | |
Friends | |
| template<typename T , typename S > | |
| Normal< T > | operator* (const Eigen::Matrix< S, 4, 4 > &mat, const Normal< T > &normal) |
Additional Inherited Members | |
Public Types inherited from lvr2::BaseVector< CoordType > | |
| using | CoordType = CoordType |
Public Attributes inherited from lvr2::BaseVector< CoordType > | |
| CoordType | x |
| CoordType | y |
| CoordType | z |
A vector guaranteed to be normalized (length = 1).
If you have an object of type Normal, you can be sure that it always has the length 1. The easiest way to create a Normal is to use the method Vector::normalized().
Definition at line 49 of file BaseVector.hpp.
|
inline |
Definition at line 62 of file Normal.hpp.
|
explicit |
Creates a normal vector from the underlying vector representation.
| base | This vector must not be the null-vector, else the behavior is undefined. |
| lvr2::Normal< CoordType >::Normal | ( | CoordType | x, |
| CoordType | y, | ||
| CoordType | z | ||
| ) |
Initializes the normal with the given coordinates.
Note that the given coordinates must not form the null-vector, else the behavior is undefined.
|
static |
Returns the average of all normals in the given collection.
The collection need to work with a range-based for-loop and its elements need to be normals. It has to contain at least one element.
|
inline |
Definition at line 92 of file Normal.hpp.
|
inline |
Definition at line 97 of file Normal.hpp.
|
inline |
Definition at line 102 of file Normal.hpp.
| Normal<CoordType> lvr2::Normal< CoordType >::operator+ | ( | const T & | other | ) | const |
| Normal<CoordType> lvr2::Normal< CoordType >::operator- | ( | const T & | other | ) | const |
| Normal<CoordType> lvr2::Normal< CoordType >::operator- | ( | ) | const |
| Normal<CoordType>& lvr2::Normal< CoordType >::operator= | ( | const T & | other | ) |
Allows to assign Vectors to normals. Vector data will be copied and normalized.
|
friend |