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
A class to handle point information with an arbitrarily large number of attribute channels...
Definition: PointBuffer.hpp:51
bool hasNormals() const
True, if buffer has normals.
void setNormalArray(floatArr normals, size_t n)
Definition: PointBuffer.cpp:64
Datastructures for holding loaded data.
floatArr getNormalArray()
Definition: PointBuffer.cpp:86
bool hasColors() const
True, if buffer contains colors.
boost::shared_array< unsigned char > ucharArr
Definition: DataStruct.hpp:137
std::shared_ptr< PointBuffer > PointBufferPtr
ucharArr getColorArray(size_t &w)
Definition: PointBuffer.cpp:97
void setPointArray(floatArr points, size_t n)
Definition: PointBuffer.cpp:58
boost::shared_array< float > floatArr
Definition: DataStruct.hpp:133
size_t numPoints() const
Returns the number of points in the buffer.
floatArr getPointArray()
Returns the internal point array.
Definition: PointBuffer.cpp:75
PointBuffer clone() const
Makes a clone.
void setColorArray(ucharArr colors, size_t n, size_t width=3)
Definition: PointBuffer.cpp:69
ChannelManager class Store and access AttributeChannels. It expands the MultiChannelMap with downwoar...
Definition: BaseBuffer.hpp:54


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