Public Member Functions | Private Types | List of all members
lvr2::PointBuffer Class Reference

A class to handle point information with an arbitrarily large number of attribute channels. The added channels should always have the same length as the point array to keep the mapping between geometry (channel 'points') and the associated layers like RGB colors or point normals consistent. More...

#include <PointBuffer.hpp>

Inheritance diagram for lvr2::PointBuffer:
Inheritance graph
[legend]

Public Member Functions

PointBuffer clone () const
 Makes a clone. More...
 
ucharArr getColorArray (size_t &w)
 
floatArr getNormalArray ()
 
floatArr getPointArray ()
 Returns the internal point array. More...
 
bool hasColors () const
 True, if buffer contains colors. More...
 
bool hasNormals () const
 True, if buffer has normals. More...
 
size_t numPoints () const
 Returns the number of points in the buffer. More...
 
 PointBuffer ()
 
 PointBuffer (floatArr points, size_t n)
 
 PointBuffer (floatArr points, floatArr normals, size_t n)
 
void setColorArray (ucharArr colors, size_t n, size_t width=3)
 
void setNormalArray (floatArr normals, size_t n)
 
void setPointArray (floatArr points, size_t n)
 
- Public Member Functions inherited from lvr2::BaseBuffer
template<typename T >
void addAtomic (T data, const std::string &name)
 Adds an atomic value. Exists only for compatibility reasons. Dont use atomics, they are implemented as Channels. -> memory overhead. More...
 
template<typename T >
void addChannel (typename Channel< T >::Ptr data, const std::string &name)
 Adds a channel pointer to the map. More...
 
template<typename T >
void addChannel (boost::shared_array< T > array, std::string name, size_t n, size_t width)
 Constructs a channel from an boost::shared_array and saves it to the map. More...
 
template<typename T >
void addEmptyChannel (const std::string &name, size_t n, size_t width)
 Adds an empty channel to the map. More...
 
void addEmptyFloatChannel (const std::string &name, size_t n, size_t width)
 Adds an empty float channel to the map. More...
 
void addEmptyIndexChannel (const std::string &name, size_t n, size_t width)
 Adds an empty index channel to the map. More...
 
void addEmptyUCharChannel (const std::string &name, size_t n, size_t width)
 Adds an empty uchar channel to the map. More...
 
void addFloatAtomic (float data, const std::string &name)
 Adds an atomic float value. Exists only for compatibility reasons. Dont use atomics, they are implemented as Channels. -> memory overhead. More...
 
void addFloatChannel (FloatChannelPtr data, const std::string &name)
 Adds a float channel pointer to the map. More...
 
void addFloatChannel (floatArr array, std::string name, size_t n, size_t width)
 Constructs a float channel from an boost::shared_array and saves it to the map. More...
 
void addIndexChannel (IndexChannelPtr data, const std::string &name)
 Adds an index channel pointer to the map. cointer to add. cannel. More...
 
void addIndexChannel (indexArray array, std::string name, size_t n, size_t width)
 Constructs an index channel from an boost::shared_array and saves it to the map. More...
 
void addIntAtomic (int data, const std::string &name)
 Adds an atomic int value. Exists only for compatibility reasons. Dont use atomics, they are implemented as Channels. -> memory overhead. Kept because of api stability. More...
 
void addUCharAtomic (unsigned char data, const std::string &name)
 Adds an atomic uchar value. Exists only for compatibility reasons. Dont use atomics, they are implemented as Channels. -> memory overhead. Kept because of api stability. More...
 
void addUCharChannel (UCharChannelPtr data, const std::string &name)
 Adds an uchar channel pointer to the map. More...
 
void addUCharChannel (ucharArr array, std::string name, size_t n, size_t width)
 Constructs an uchar channel from an boost::shared_array and saves it to the map. More...
 
template<typename T >
size_t channelWidth (const std::string &name) const
 Gets a channels width. More...
 
BaseBuffer clone () const
 
size_t floatChannelWidth (const std::string &name) const
 Gets a float channels width. More...
 
template<typename T >
int getAllChannelsOfType (std::map< std::string, Channel< T > > &channels)
 Returns all channels of type T. More...
 
template<typename T >
int getAllChannelsOfType (std::vector< std::pair< std::string, Channel< T > >> &channels)
 Returns all channels of type T. More...
 
template<typename T >
boost::shared_array< T > getArray (const std::string &name, size_t &n, size_t &w)
 Gets a channel as array. More...
 
template<typename T >
boost::optional< T > getAtomic (const std::string &name)
 Gets an atomic value. More...
 
template<typename T >
Channel< T >::Optional getChannel (const std::string &name)
 Gets a channel and returns it as optional. More...
 
template<typename T >
const Channel< T >::Optional getChannel (const std::string &name) const
 Gets a channel and returns it as optional. More...
 
void getChannel (const std::string &name, FloatChannelOptional &channelOptional)
 Gets a float channel and returns it as optional. More...
 
void getChannel (const std::string &name, IndexChannelOptional &channelOptional)
 Gets an index channel and returns it as optional. More...
 
void getChannel (const std::string &name, UCharChannelOptional &channelOptional)
 Gets an uchar channel and returns it as optional. More...
 
floatArr getFloatArray (const std::string &name, size_t &n, size_t &w)
 Gets a float channel as array. More...
 
floatOptional getFloatAtomic (const std::string &name)
 Gets an atomic float value. More...
 
Channel< float >::Optional getFloatChannel (const std::string &name)
 Gets a float channel and returns it as optional. More...
 
FloatProxy getFloatHandle (unsigned int idx, const std::string &name)
 Get a Handle object (ElementProxy) of a float channel. More...
 
template<typename T >
ElementProxy< T > getHandle (unsigned int idx, const std::string &name)
 Get a Handle object (ElementProxy) of a specific typed channel. More...
 
indexArray getIndexArray (const std::string &name, size_t &n, size_t &w)
 Gets an index channel as array. More...
 
Channel< unsigned int >::Optional getIndexChannel (const std::string &name)
 Gets an index channel and returns it as optional. More...
 
IndexProxy getIndexHandle (unsigned int idx, const std::string &name)
 Get a Handle object (ElementProxy) of an index channel. More...
 
intOptional getIntAtomic (const std::string &name)
 Gets an atomic int value. More...
 
ucharArr getUCharArray (const std::string &name, size_t &n, size_t &w)
 Gets an uchar channel as array. More...
 
ucharOptional getUCharAtomic (const std::string &name)
 Gets an atomic uchar value. More...
 
Channel< unsigned char >::Optional getUCharChannel (const std::string &name)
 Gets an uchar channel and returns it as optional. More...
 
UCharProxy getUCharHandle (unsigned int idx, const std::string &name)
 Get a Handle object (ElementProxy) of an uchar channel. More...
 
template<typename T >
bool hasChannel (const std::string &name) const
 Checks if a channel is available. More...
 
bool hasFloatChannel (const std::string &name) const
 Checks if a float channel is available. More...
 
bool hasIndexChannel (const std::string &name) const
 Checks if an index channel is available. More...
 
bool hasUCharChannel (const std::string &name) const
 Checks if an uchar channel is available. More...
 
size_t indexChannelWidth (const std::string &name) const
 Gets an index channels width. More...
 
template<typename V >
BaseBuffer manipulate (V visitor)
 
template<typename T >
bool removeChannel (const std::string &name)
 Removes a channel with a specific type. If the type is not required use: erase. More...
 
bool removeFloatChannel (const std::string &name)
 Removes a float channel. If the type is not required use: erase. More...
 
bool removeIndexChannel (const std::string &name)
 Removes an index channel. If the type is not required use: erase. More...
 
bool removeUCharChannel (const std::string &name)
 Removes an uchar channel. If the type is not required use: erase. More...
 
size_t ucharChannelWidth (const std::string &name) const
 Gets an uchar channels width. More...
 
- Public Member Functions inherited from lvr2::VariantChannelMap< T >
template<typename U >
void add (const std::string &name, Channel< U > channel)
 Adds an Key + AttributeChannel to the map. More...
 
template<typename U >
void add (const std::string &name)
 Adds an empty channel. More...
 
template<typename U >
void add (const std::string &name, size_t numElements, size_t width)
 Adds an empty channel with size. More...
 
VariantChannelMap< T... > clone () const
 
template<typename U >
iterator< U > erase (iterator< U > it)
 
template<typename U >
Channel< U > & get (const std::string &name)
 Gets AttributeChannel with type U from map as reference. More...
 
template<typename U >
const Channel< U > & get (const std::string &name) const
 Gets AttributeChannel by type U from map. More...
 
template<typename U >
Channel< U >::Optional getOptional (const std::string &name)
 
template<typename U >
const Channel< U >::Optional getOptional (const std::string &name) const
 
template<typename U >
bool is_type (const std::string &name) const
 Checks if key has specific type U. More...
 
template<typename U >
std::vector< std::string > keys ()
 Gets the available keys by a specific type. More...
 
template<typename V >
VariantChannelMap< T... > manipulate (V visitor)
 
template<typename U >
size_t numChannels ()
 Counts the number of channels by a specific type. For total number of channels use "size()". More...
 
int type (const std::string &name) const
 Gets type index of a map entry. More...
 
template<typename U >
iterator< U > typedBegin ()
 
template<typename U >
const_iterator< U > typedBegin () const
 

Private Types

using base = BaseBuffer
 

Additional Inherited Members

- Public Types inherited from lvr2::BaseBuffer
using base = std::unordered_map< std::string, VariantChannel< T... > >
 
- Public Types inherited from lvr2::VariantChannelMap< T >
using base = std::unordered_map< std::string, VariantChannel< T... > >
 
using elem_type = std::pair< const key_type, val_type >
 
using key_type = std::string
 
template<std::size_t N>
using type_of_index = typename val_type::template type_of_index< N >
 
using types = std::tuple< T... >
 
using val_type = VariantChannel< T... >
 
- Static Public Attributes inherited from lvr2::VariantChannelMap< T >
static constexpr std::size_t num_types = val_type::num_types
 

Detailed Description

A class to handle point information with an arbitrarily large number of attribute channels. The added channels should always have the same length as the point array to keep the mapping between geometry (channel 'points') and the associated layers like RGB colors or point normals consistent.

Definition at line 51 of file PointBuffer.hpp.

Member Typedef Documentation

◆ base

Definition at line 53 of file PointBuffer.hpp.

Constructor & Destructor Documentation

◆ PointBuffer() [1/3]

lvr2::PointBuffer::PointBuffer ( )

Definition at line 36 of file PointBuffer.cpp.

◆ PointBuffer() [2/3]

lvr2::PointBuffer::PointBuffer ( floatArr  points,
size_t  n 
)

Definition at line 42 of file PointBuffer.cpp.

◆ PointBuffer() [3/3]

lvr2::PointBuffer::PointBuffer ( floatArr  points,
floatArr  normals,
size_t  n 
)

Definition at line 51 of file PointBuffer.cpp.

Member Function Documentation

◆ clone()

PointBuffer lvr2::PointBuffer::clone ( ) const

Makes a clone.

Definition at line 136 of file PointBuffer.cpp.

◆ getColorArray()

ucharArr lvr2::PointBuffer::getColorArray ( size_t &  w)

If the buffer stores color information, the call we return an empty array, i.e., the shared pointer contains a nullptr.

Definition at line 97 of file PointBuffer.cpp.

◆ getNormalArray()

floatArr lvr2::PointBuffer::getNormalArray ( )

If the buffer stores normals, the call we return an empty array, i.e., the shared pointer contains a nullptr.

Definition at line 86 of file PointBuffer.cpp.

◆ getPointArray()

floatArr lvr2::PointBuffer::getPointArray ( )

Returns the internal point array.

Definition at line 75 of file PointBuffer.cpp.

◆ hasColors()

bool lvr2::PointBuffer::hasColors ( ) const

True, if buffer contains colors.

Definition at line 111 of file PointBuffer.cpp.

◆ hasNormals()

bool lvr2::PointBuffer::hasNormals ( ) const

True, if buffer has normals.

Definition at line 116 of file PointBuffer.cpp.

◆ numPoints()

size_t lvr2::PointBuffer::numPoints ( ) const

Returns the number of points in the buffer.

Definition at line 121 of file PointBuffer.cpp.

◆ setColorArray()

void lvr2::PointBuffer::setColorArray ( ucharArr  colors,
size_t  n,
size_t  width = 3 
)

Definition at line 69 of file PointBuffer.cpp.

◆ setNormalArray()

void lvr2::PointBuffer::setNormalArray ( floatArr  normals,
size_t  n 
)

Definition at line 64 of file PointBuffer.cpp.

◆ setPointArray()

void lvr2::PointBuffer::setPointArray ( floatArr  points,
size_t  n 
)

Definition at line 58 of file PointBuffer.cpp.


The documentation for this class 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