-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathprimitive.h
97 lines (73 loc) · 1.79 KB
/
primitive.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#ifndef PRIMITIVE_H
#define PRIMITIVE_H
#include <set>
#include <QtCore>
#include <Eigen/Core>
template <size_t DIMENSION>
class Primitive
{
public:
Primitive(const Eigen::Matrix<float, DIMENSION, 1> ¢er)
: mCenter(center)
{
}
virtual ~Primitive()
{
}
virtual const Eigen::Matrix<float, DIMENSION, 1>& center() const
{
return mCenter;
}
virtual void center(const Eigen::Matrix<float, DIMENSION, 1> ¢er)
{
mCenter = center;
}
const Eigen::Vector3f& color() const
{
return mColor;
}
void color(const Eigen::Vector3f &color)
{
mColor = color;
}
int label() const
{
return mLabel;
}
void label(int label)
{
mLabel = label;
}
const std::vector<size_t>& inliers() const
{
return mInliers;
}
void inliers(const std::vector<size_t> &inliers)
{
mInliers = inliers;
}
void addInlier(size_t point)
{
mInliers.push_back(point);
}
void addInliers(const std::vector<size_t> &points)
{
mInliers.insert(mInliers.end(), points.begin(), points.end());
}
virtual void leastSquares(const Eigen::Matrix<float, DIMENSION, -1> &points)
{
Q_UNUSED(points);
}
virtual float getSignedDistanceFromSurface(const Eigen::Matrix<float, DIMENSION, 1> &point) const = 0;
virtual Eigen::Matrix<float, DIMENSION, 1> normalAt(const Eigen::Matrix<float, DIMENSION, 1> &point) const = 0;
protected:
Eigen::Matrix<float, DIMENSION, 1> mCenter;
Eigen::Vector3f mColor;
std::vector<size_t> mInliers;
int mLabel;
};
template class Primitive<2>;
template class Primitive<3>;
typedef Primitive<2> Primitive2d;
typedef Primitive<3> Primitive3d;
#endif // PRIMITIVE_H