8#include <unordered_map>
11#include <Eigen/Geometry>
13namespace gtsam_points {
21 using Ptr = std::shared_ptr<PointCloud>;
22 using ConstPtr = std::shared_ptr<const PointCloud>;
78 std::cerr <<
"warning: attribute " << attrib <<
" not found!!" << std::endl;
82 if (
sizeof(T) != found->second.first) {
83 std::cerr <<
"warning: attribute element size mismatch!! attrib:" << attrib <<
" size:" << found->second.first <<
" requested:" <<
sizeof(T)
87 return static_cast<const T*
>(found->second.second);
94 void save(
const std::string& path)
const;
122#ifndef DONT_DEFINE_FRAME_TRAITS
123#include <gtsam_points/types/frame_traits.hpp>
125namespace gtsam_points {
138 static double time(
const PointCloud& frame,
size_t i) {
return frame.
times[i]; }
139 static const Eigen::Vector4d& point(
const PointCloud& frame,
size_t i) {
return frame.
points[i]; }
140 static const Eigen::Vector4d& normal(
const PointCloud& frame,
size_t i) {
return frame.
normals[i]; }
141 static const Eigen::Matrix4d& cov(
const PointCloud& frame,
size_t i) {
return frame.
covs[i]; }
144 static const Eigen::Vector4d* points_ptr(
const PointCloud& frame) {
return frame.
points; }
Standard point cloud class that holds only pointers to point attributes.
Definition point_cloud.hpp:19
bool check_points_gpu() const
Warn if the point cloud doesn't have points on GPU.
void save(const std::string &path) const
Save the point cloud data.
void save_compact(const std::string &path) const
Save the point cloud data with a compact representation without unnecessary fields (e....
Eigen::Vector4d * normals
Point normals (nx, ny, nz, 0)
Definition point_cloud.hpp:107
bool check_times() const
Warn if the point cloud doesn't have times.
bool check_covs() const
Warn if the point cloud doesn't have covs.
bool has_points() const
Check if the point cloud has points.
bool check_normals_gpu() const
Warn if the point cloud doesn't have normals on GPU.
bool has_covs_gpu() const
Check if the point cloud has point covariances on GPU.
size_t num_points
Number of points.
Definition point_cloud.hpp:103
double * times
Per-point timestamp w.r.t. the first point (should be sorted)
Definition point_cloud.hpp:105
float * intensities_gpu
Point intensities on GPU.
Definition point_cloud.hpp:118
Eigen::Matrix3f * covs_gpu
Point covariances on GPU.
Definition point_cloud.hpp:117
bool has_normals() const
Check if the point cloud has point normals.
bool has_intensities_gpu() const
Check if the point cloud has point intensities on GPU.
Eigen::Matrix4d * covs
Point covariances cov(3, 3) = 0.
Definition point_cloud.hpp:108
Eigen::Vector3f * points_gpu
Point coordinates on GPU.
Definition point_cloud.hpp:115
bool check_intensities_gpu() const
Warn if the point cloud doesn't have intensities on GPU.
const T * aux_attribute(const std::string &attrib) const
Get the pointer to an aux attribute.
Definition point_cloud.hpp:75
size_t size() const
Number of points.
Definition point_cloud.hpp:43
bool has_intensities() const
Check if the point cloud has point intensities.
bool has_covs() const
Check if the point cloud has point covariances.
double * intensities
Point intensities.
Definition point_cloud.hpp:109
Eigen::Vector4d * points
Point coordinates (x, y, z, 1)
Definition point_cloud.hpp:106
bool has_times_gpu() const
Check if the point cloud has per-point timestamps on GPU.
bool has_times() const
Check if the point cloud has per-point timestamps.
Eigen::Vector3f * normals_gpu
Point normals on GPU.
Definition point_cloud.hpp:116
bool check_normals() const
Warn if the point cloud doesn't have normals.
bool check_covs_gpu() const
Warn if the point cloud doesn't have covs on GPU.
bool check_points() const
Warn if the point cloud doesn't have points.
bool check_times_gpu() const
Warn if the point cloud doesn't have times on GPU.
bool has_points_gpu() const
Check if the point cloud has points on GPU.
float * times_gpu
Per-point timestamp on GPU.
Definition point_cloud.hpp:114
bool has_normals_gpu() const
Check if the point cloud has point normals on GPU.
bool check_intensities() const
Warn if the point cloud doesn't have intensities.
std::unordered_map< std::string, std::pair< size_t, void * > > aux_attributes
Aux attributes <attribute_name, pair<element_size, data_ptr>>
Definition point_cloud.hpp:112
Definition frame_traits.hpp:17