-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPointCloud.h
51 lines (39 loc) · 1.25 KB
/
PointCloud.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef POINTCLOUD_H
#define POINTCLOUD_H
#include <QVector>
#include <QVector3D>
#include <QColor>
class PointCloud
{
public:
PointCloud();
PointCloud(const QVector<QVector3D> &points,
const QVector<QColor> &colors = QVector<QColor>());
~PointCloud();
const QVector3D& point(int index) const;
void setPoint(int index, const QVector3D& point);
int count() const;
bool hasColor() const;
const QVector3D& boundingBoxMinimum() const;
const QVector3D& boundingBoxMaximum() const;
const QVector3D& boundingBoxCenter() const;
// Return x,y,z interleaved vector of floats
QVector<float> pointData() const;
// Return rgb interleaved values for color as unsigned bytes
QVector<unsigned char> colorData() const;
QVector<float> colorDataF() const;
// Shuffle point order in-place
void shuffle();
// Return shuffled version of this point cloud
PointCloud shuffled() const;
private:
void calculateExtents() const;
QVector<QVector3D> m_points;
QVector<QColor> m_colors;
// Following are mutable to allow logical constness
mutable bool m_needsExtents;
mutable QVector3D m_min;
mutable QVector3D m_max;
mutable QVector3D m_center;
};
#endif // POINTCLOUD_H