45#include <pcl/pcl_base.h>
53 template <
typename Po
intT>
103 setIndices (std::size_t row_start, std::size_t col_start, std::size_t nb_rows, std::size_t nb_cols)
override;
160 getAABB (PointT& min_point, PointT& max_point)
const;
174 getOBB (PointT& min_point, PointT& max_point, PointT& position, Eigen::Matrix3f& rotational_matrix)
const;
192 getEigenVectors (Eigen::Vector3f& major, Eigen::Vector3f& middle, Eigen::Vector3f& minor)
const;
225 rotateVector (
const Eigen::Vector3f& vector,
const Eigen::Vector3f& axis,
const float angle, Eigen::Vector3f& rotated_vector)
const;
239 computeCovarianceMatrix (Eigen::Matrix <float, 3, 3>& covariance_matrix)
const;
247 computeCovarianceMatrix (
PointCloudConstPtr cloud, Eigen::Matrix <float, 3, 3>& covariance_matrix)
const;
261 computeEigenVectors (
const Eigen::Matrix <float, 3, 3>& covariance_matrix, Eigen::Vector3f& major_axis,
262 Eigen::Vector3f& middle_axis, Eigen::Vector3f& minor_axis,
float& major_value,
float& middle_value,
272 calculateMomentOfInertia (
const Eigen::Vector3f& current_axis,
const Eigen::Vector3f& mean_value)
const;
281 getProjectedCloud (
const Eigen::Vector3f& normal_vector,
const Eigen::Vector3f& point,
typename pcl::PointCloud <PointT>::Ptr projected_cloud)
const;
288 computeEccentricity (
const Eigen::Matrix <float, 3, 3>& covariance_matrix,
const Eigen::Vector3f& normal_vector);
294 bool is_valid_{
false};
300 float point_mass_{0.0001f};
303 bool normalize_{
true};
306 Eigen::Vector3f mean_value_;
309 Eigen::Vector3f major_axis_;
312 Eigen::Vector3f middle_axis_;
315 Eigen::Vector3f minor_axis_;
318 float major_value_{0.0f};
321 float middle_value_{0.0f};
324 float minor_value_{0.0f};
327 std::vector <float> moment_of_inertia_;
330 std::vector <float> eccentricity_;
333 PointT aabb_min_point_;
336 PointT aabb_max_point_;
339 PointT obb_min_point_;
342 PointT obb_max_point_;
345 Eigen::Vector3f obb_position_;
348 Eigen::Matrix3f obb_rotational_matrix_;
355#define PCL_INSTANTIATE_MomentOfInertiaEstimation(T) template class PCL_EXPORTS pcl::MomentOfInertiaEstimation<T>;
357#ifdef PCL_NO_PRECOMPILE
358#include <pcl/features/impl/moment_of_inertia_estimation.hpp>
float getAngleStep() const
Returns the angle step.
void setIndices(const IndicesPtr &indices) override
Provide a pointer to the vector of indices that represents the input data.
void compute()
This method launches the computation of all features.
bool getEigenValues(float &major, float &middle, float &minor) const
This method gives access to the computed eigen values.
float getPointMass() const
Returns the mass of point.
bool getEccentricity(std::vector< float > &eccentricity) const
This method gives access to the computed ecentricities.
bool getOBB(PointT &min_point, PointT &max_point, PointT &position, Eigen::Matrix3f &rotational_matrix) const
This method gives access to the computed oriented bounding box.
typename pcl::PCLBase< PointT >::PointCloudConstPtr PointCloudConstPtr
bool getNormalizePointMassFlag() const
Returns the normalize_ flag.
bool getAABB(PointT &min_point, PointT &max_point) const
This method gives access to the computed axis aligned bounding box.
void setNormalizePointMassFlag(bool need_to_normalize)
This method allows to set the normalize_ flag.
void setPointMass(const float point_mass)
This method allows to set point mass that will be used for moment of inertia calculation.
void setAngleStep(const float step)
This method allows to set the angle step.
MomentOfInertiaEstimation()
Constructor that sets default values for member variables.
bool getMassCenter(Eigen::Vector3f &mass_center) const
This method gives access to the computed mass center.
typename pcl::PCLBase< PointT >::PointIndicesConstPtr PointIndicesConstPtr
void setInputCloud(const PointCloudConstPtr &cloud) override
Provide a pointer to the input dataset.
bool getMomentOfInertia(std::vector< float > &moment_of_inertia) const
This method gives access to the computed moments of inertia.
bool getEigenVectors(Eigen::Vector3f &major, Eigen::Vector3f &middle, Eigen::Vector3f &minor) const
This method gives access to the computed eigen vectors.
PointCloudConstPtr input_
The input point cloud dataset.
typename PointCloud::ConstPtr PointCloudConstPtr
IndicesPtr indices_
A pointer to the vector of point indices to use.
bool initCompute()
This method should get called before starting the actual computation.
bool use_indices_
Set to true if point indices are used.
bool fake_indices_
If no set of indices are given, we construct a set of fake indices that mimic the input PointCloud.
PointIndices::ConstPtr PointIndicesConstPtr
PCLBase()
Empty constructor.
bool deinitCompute()
This method should get called after finishing the actual computation.
shared_ptr< PointCloud< PointT > > Ptr
#define PCL_MAKE_ALIGNED_OPERATOR_NEW
Macro to signal a class requires a custom allocator.
Defines functions, macros and traits for allocating and using memory.
shared_ptr< Indices > IndicesPtr
shared_ptr< const Indices > IndicesConstPtr
Defines all the PCL and non-PCL macros used.