Public Member Functions | Static Public Member Functions | Friends | List of all members
lvr2::Normal< CoordType > Struct Template Reference

A vector guaranteed to be normalized (length = 1). More...

#include <BaseVector.hpp>

Inheritance diagram for lvr2::Normal< CoordType >:
Inheritance graph
[legend]

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< CoordTypeoperator+ (const T &other) const
 
template<typename T >
Normal< CoordTypeoperator- (const T &other) const
 
Normal< CoordTypeoperator- () 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< CoordTypecross (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< CoordTypenormalized () const
 Returns a normalized version of this vector. More...
 
bool operator!= (const BaseVector &other) const
 
BaseVector< CoordTypeoperator* (const CoordType &scale) const
 Scalar multiplication. More...
 
CoordType operator* (const BaseVector< CoordType > &other) const
 
BaseVector< CoordType > & operator*= (const CoordType &scale)
 Scalar multiplication. More...
 
BaseVector< CoordTypeoperator+ (const BaseVector &other) const
 Element-wise addition. More...
 
BaseVector< CoordType > & operator+= (const BaseVector< CoordType > &other)
 Element-wise addition. More...
 
BaseVector< CoordTypeoperator- (const BaseVector &other) const
 Element-wise subtraction. More...
 
BaseVector< CoordType > & operator-= (const BaseVector< CoordType > &other)
 Element-wise subtraction. More...
 
BaseVector< CoordTypeoperator/ (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...
 
CoordTypeoperator[] (const unsigned &index)
 Indexed coordinate access (writing) More...
 
BaseVector< CoordTyperotated (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< CoordTypeaverage (const CollectionT &vecs)
 Returns the average of all vectors in the given collection. More...
 
static BaseVector< CoordTypecentroid (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
 

Detailed Description

template<typename CoordType>
struct lvr2::Normal< CoordType >

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.

Constructor & Destructor Documentation

◆ Normal() [1/3]

template<typename CoordType>
lvr2::Normal< CoordType >::Normal ( )
inline

Definition at line 62 of file Normal.hpp.

◆ Normal() [2/3]

template<typename CoordType>
lvr2::Normal< CoordType >::Normal ( BaseVector< CoordType base)
explicit

Creates a normal vector from the underlying vector representation.

Parameters
baseThis vector must not be the null-vector, else the behavior is undefined.

◆ Normal() [3/3]

template<typename CoordType>
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.

Member Function Documentation

◆ average()

template<typename CoordType>
template<typename CollectionT >
static Normal<CoordType>& lvr2::Normal< CoordType >::average ( const CollectionT &  normals)
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.

◆ getX()

template<typename CoordType>
CoordType lvr2::Normal< CoordType >::getX ( ) const
inline

Definition at line 92 of file Normal.hpp.

◆ getY()

template<typename CoordType>
CoordType lvr2::Normal< CoordType >::getY ( ) const
inline

Definition at line 97 of file Normal.hpp.

◆ getZ()

template<typename CoordType>
CoordType lvr2::Normal< CoordType >::getZ ( ) const
inline

Definition at line 102 of file Normal.hpp.

◆ operator+()

template<typename CoordType>
template<typename T >
Normal<CoordType> lvr2::Normal< CoordType >::operator+ ( const T &  other) const

◆ operator-() [1/2]

template<typename CoordType>
template<typename T >
Normal<CoordType> lvr2::Normal< CoordType >::operator- ( const T &  other) const

◆ operator-() [2/2]

template<typename CoordType>
Normal<CoordType> lvr2::Normal< CoordType >::operator- ( ) const

◆ operator=()

template<typename CoordType>
template<typename T >
Normal<CoordType>& lvr2::Normal< CoordType >::operator= ( const T &  other)

Allows to assign Vectors to normals. Vector data will be copied and normalized.

Friends And Related Function Documentation

◆ operator*

template<typename CoordType>
template<typename T , typename S >
Normal<T> operator* ( const Eigen::Matrix< S, 4, 4 > &  mat,
const Normal< T > &  normal 
)
friend

The documentation for this struct was generated from the following files:


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 Mon Feb 28 2022 22:46:12