17 using Ptr = std::shared_ptr<PointCloud>;
18 using ConstPtr = std::shared_ptr<const PointCloud>;
25 template <
typename T,
int D,
typename Allocator>
28 for (
size_t i = 0; i <
points.size(); i++) {
29 this->
point(i) <<
points[i].template cast<double>().template head<3>(), 1.0;
57 Eigen::Matrix4d&
cov(
size_t i) {
return covs[i]; }
60 const Eigen::Vector4d&
point(
size_t i)
const {
return points[i]; }
66 const Eigen::Matrix4d&
cov(
size_t i)
const {
return covs[i]; }
71 std::vector<Eigen::Matrix4d>
covs;
86 static const Eigen::Vector4d&
point(
const Points& points,
size_t i) {
return points.
point(i); }
87 static const Eigen::Vector4d&
normal(
const Points& points,
size_t i) {
return points.
normal(i); }
88 static const Eigen::Matrix4d&
cov(
const Points& points,
size_t i) {
return points.
cov(i); }
auto cov(const T &points, size_t i)
Get i-th covariance. Only the top-left 3x3 matrix is filled, and the bottom row and the right col mus...
Definition: traits.hpp:52
Definition: flat_container.hpp:12
Point cloud.
Definition: point_cloud.hpp:15
bool empty() const
Check if the point cloud is empty.
Definition: point_cloud.hpp:40
~PointCloud()
Destructor.
Definition: point_cloud.hpp:34
PointCloud()
Constructor.
Definition: point_cloud.hpp:21
const Eigen::Matrix4d & cov(size_t i) const
Get i-th covariance (const).
Definition: point_cloud.hpp:66
std::vector< Eigen::Matrix4d > covs
Point covariances (3x3 matrix) + zero padding.
Definition: point_cloud.hpp:71
std::vector< Eigen::Vector4d > points
Point coordinates (x, y, z, 1)
Definition: point_cloud.hpp:69
std::shared_ptr< const PointCloud > ConstPtr
Definition: point_cloud.hpp:18
const Eigen::Vector4d & normal(size_t i) const
Get i-th normal (const).
Definition: point_cloud.hpp:63
Eigen::Matrix4d & cov(size_t i)
Get i-th covariance.
Definition: point_cloud.hpp:57
Eigen::Vector4d & point(size_t i)
Get i-th point.
Definition: point_cloud.hpp:51
const Eigen::Vector4d & point(size_t i) const
Get i-th point (const).
Definition: point_cloud.hpp:60
std::vector< Eigen::Vector4d > normals
Point normals (nx, ny, nz, 0)
Definition: point_cloud.hpp:70
size_t size() const
Number of points.
Definition: point_cloud.hpp:37
void resize(size_t n)
Resize point/normal/cov buffers.
Definition: point_cloud.hpp:44
PointCloud(const std::vector< Eigen::Matrix< T, D, 1 >, Allocator > &points)
Constructor.
Definition: point_cloud.hpp:26
std::shared_ptr< PointCloud > Ptr
Definition: point_cloud.hpp:17
Eigen::Vector4d & normal(size_t i)
Get i-th normal.
Definition: point_cloud.hpp:54
static bool has_points(const Points &points)
Definition: point_cloud.hpp:82
static const Eigen::Vector4d & normal(const Points &points, size_t i)
Definition: point_cloud.hpp:87
static void resize(Points &points, size_t n)
Definition: point_cloud.hpp:90
static void set_normal(Points &points, size_t i, const Eigen::Vector4d &n)
Definition: point_cloud.hpp:92
static bool has_normals(const Points &points)
Definition: point_cloud.hpp:83
static size_t size(const Points &points)
Definition: point_cloud.hpp:80
static void set_point(Points &points, size_t i, const Eigen::Vector4d &pt)
Definition: point_cloud.hpp:91
static const Eigen::Vector4d & point(const Points &points, size_t i)
Definition: point_cloud.hpp:86
static bool has_covs(const Points &points)
Definition: point_cloud.hpp:84
static void set_cov(Points &points, size_t i, const Eigen::Matrix4d &cov)
Definition: point_cloud.hpp:93
static const Eigen::Matrix4d & cov(const Points &points, size_t i)
Definition: point_cloud.hpp:88
Definition: traits.hpp:13