PointBuffer.hpp
Go to the documentation of this file.
1 
28 #ifndef POINTBUFFER2_HPP
29 #define POINTBUFFER2_HPP
30 
31 #include "lvr2/io/DataStruct.hpp"
33 
34 #include <map>
35 #include <string>
36 
37 #include <boost/shared_array.hpp>
38 #include <iostream>
39 
40 namespace lvr2
41 {
42 
51 class PointBuffer : public BaseBuffer
52 {
53  using base = BaseBuffer;
54 public:
55  PointBuffer();
56 
57  /***
58  * @brief Constructs a point buffer with point the given number
59  * of point.
60  *
61  * @param points An array containing point data (x,y,z).
62  * @param n Number of points
63  */
64  PointBuffer(floatArr points, size_t n);
65 
66  /***
67  * @brief Constructs a point buffer with point and normal
68  * information. Both arrays are exspected to have the same
69  * length.
70  *
71  * @param points An array containing point data (x,y,z).
72  * @param normals An array containing normal information (nx, ny, nz)
73  * @param n Number of points
74  */
75  PointBuffer(floatArr points, floatArr normals, size_t n);
76 
77  /***
78  * @brief Adds points to the buffer. If the buffer already
79  * contains point cloud data, the interal buffer will
80  * be freed als well as all other attribute channels.
81  */
82  void setPointArray(floatArr points, size_t n);
83 
84  /***
85  * @brief Adds an channel containing point normal data to the
86  * buffer.
87  *
88  * @param normals A float array containing the normal data.
89  * expected to be tuples (nx, ny, nz).
90  */
91  void setNormalArray(floatArr normals, size_t n);
92 
93  /***
94  * @brief Generates and adds a channel for point color data
95  *
96  * @param colors Am array containing point cloud data
97  * @param n Number of colors in the buffer
98  * @param width Number of attributes per element. Normally
99  * 3 for RGB and 4 for RGBA buffers.
100  */
101  void setColorArray(ucharArr colors, size_t n, size_t width = 3);
102 
105 
110 
114  ucharArr getColorArray(size_t& w);
115 
117  bool hasColors() const;
118 
120  bool hasNormals() const;
121 
123  size_t numPoints() const;
124 
126  PointBuffer clone() const;
127 
128 };
129 
130 using PointBufferPtr = std::shared_ptr<PointBuffer>;
131 
132 } // namespace lvr2
133 
134 #endif // POINTBUFFER2_HPP
lvr2::floatArr
boost::shared_array< float > floatArr
Definition: DataStruct.hpp:133
BaseBuffer.hpp
lvr2::PointBuffer::getColorArray
ucharArr getColorArray(size_t &w)
Definition: PointBuffer.cpp:97
lvr2::PointBuffer::PointBuffer
PointBuffer()
Definition: PointBuffer.cpp:36
lvr2::PointBuffer::hasNormals
bool hasNormals() const
True, if buffer has normals.
Definition: PointBuffer.cpp:116
lvr2::PointBuffer::setColorArray
void setColorArray(ucharArr colors, size_t n, size_t width=3)
Definition: PointBuffer.cpp:69
lvr2::PointBufferPtr
std::shared_ptr< PointBuffer > PointBufferPtr
Definition: PointBuffer.hpp:130
lvr2::PointBuffer
A class to handle point information with an arbitrarily large number of attribute channels....
Definition: PointBuffer.hpp:51
lvr2::PointBuffer::clone
PointBuffer clone() const
Makes a clone.
Definition: PointBuffer.cpp:136
lvr2::PointBuffer::getNormalArray
floatArr getNormalArray()
Definition: PointBuffer.cpp:86
lvr2::PointBuffer::setNormalArray
void setNormalArray(floatArr normals, size_t n)
Definition: PointBuffer.cpp:64
lvr2::PointBuffer::getPointArray
floatArr getPointArray()
Returns the internal point array.
Definition: PointBuffer.cpp:75
lvr2::BaseBuffer
ChannelManager class Store and access AttributeChannels. It expands the MultiChannelMap with downwoar...
Definition: BaseBuffer.hpp:54
DataStruct.hpp
Datastructures for holding loaded data.
scripts.create_png.colors
colors
Definition: create_png.py:41
lvr2::PointBuffer::setPointArray
void setPointArray(floatArr points, size_t n)
Definition: PointBuffer.cpp:58
lvr2::PointBuffer::numPoints
size_t numPoints() const
Returns the number of points in the buffer.
Definition: PointBuffer.cpp:121
lvr2::PointBuffer::hasColors
bool hasColors() const
True, if buffer contains colors.
Definition: PointBuffer.cpp:111
lvr2::ucharArr
boost::shared_array< unsigned char > ucharArr
Definition: DataStruct.hpp:137
lvr2
Definition: BaseBufferManipulators.hpp:39


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:24