Skip to content

Commit

Permalink
Part G of transition to support modernize-use-default-member-init (#5860
Browse files Browse the repository at this point in the history
)

* Part G of transition to support modernize-use-default-member-init

* Fixed clang-tidy, clang-format CI issues

* Made changes per inspection

* Made changes per review

* Made more changes per review

* Addressed review comments

* Addressed CI errors, omitted review comments

* Addressed more build errors

* Addressed additional review comment
  • Loading branch information
gnawme committed Dec 2, 2023
1 parent 0e4683a commit e2656ed
Show file tree
Hide file tree
Showing 40 changed files with 231 additions and 418 deletions.
2 changes: 1 addition & 1 deletion registration/include/pcl/registration/impl/ndt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ namespace pcl {
template <typename PointSource, typename PointTarget, typename Scalar>
NormalDistributionsTransform<PointSource, PointTarget, Scalar>::
NormalDistributionsTransform()
: target_cells_(), trans_likelihood_()
: target_cells_()
{
reg_name_ = "NormalDistributionsTransform";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,28 +144,28 @@ namespace pcl
protected:

/** \brief Maximum window size to be used in filtering ground returns. */
int max_window_size_;
int max_window_size_{33};

/** \brief Slope value to be used in computing the height threshold. */
float slope_;
float slope_{0.7f};

/** \brief Maximum height above the parameterized ground surface to be considered a ground return. */
float max_distance_;
float max_distance_{10.0f};

/** \brief Initial height above the parameterized ground surface to be considered a ground return. */
float initial_distance_;
float initial_distance_{0.15f};

/** \brief Cell size. */
float cell_size_;
float cell_size_{1.0f};

/** \brief Base to be used in computing progressive window sizes. */
float base_;
float base_{2.0f};

/** \brief Exponentially grow window sizes? */
bool exponential_;
bool exponential_{true};

/** \brief Number of threads to be used. */
unsigned int threads_;
unsigned int threads_{0};
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,6 @@ namespace pcl
ConditionalEuclideanClustering (bool extract_removed_clusters = false) :
searcher_ (),
condition_function_ (),
cluster_tolerance_ (0.0f),
min_cluster_size_ (1),
max_cluster_size_ (std::numeric_limits<int>::max ()),
extract_removed_clusters_ (extract_removed_clusters),
small_clusters_ (new pcl::IndicesClusters),
large_clusters_ (new pcl::IndicesClusters)
Expand Down Expand Up @@ -237,28 +234,28 @@ namespace pcl

private:
/** \brief A pointer to the spatial search object */
SearcherPtr searcher_;
SearcherPtr searcher_{nullptr};

/** \brief The condition function that needs to hold for clustering */
std::function<bool (const PointT&, const PointT&, float)> condition_function_;

/** \brief The distance to scan for cluster candidates (default = 0.0) */
float cluster_tolerance_;
float cluster_tolerance_{0.0f};

/** \brief The minimum cluster size (default = 1) */
int min_cluster_size_;
int min_cluster_size_{1};

/** \brief The maximum cluster size (default = unlimited) */
int max_cluster_size_;
int max_cluster_size_{std::numeric_limits<int>::max ()};

/** \brief Set to true if you want to be able to extract the clusters that are too large or too small (default = false) */
bool extract_removed_clusters_;

/** \brief The resultant clusters that contain less than min_cluster_size points */
pcl::IndicesClustersPtr small_clusters_;
pcl::IndicesClustersPtr small_clusters_{nullptr};

/** \brief The resultant clusters that contain more than max_cluster_size points */
pcl::IndicesClustersPtr large_clusters_;
pcl::IndicesClustersPtr large_clusters_{nullptr};

public:
PCL_MAKE_ALIGNED_OPERATOR_NEW
Expand Down
14 changes: 7 additions & 7 deletions segmentation/include/pcl/segmentation/cpc_segmentation.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,25 +138,25 @@ namespace pcl
/// *** Parameters *** ///

/** \brief Maximum number of cuts */
std::uint32_t max_cuts_;
std::uint32_t max_cuts_{20};

/** \brief Minimum segment size for cutting */
std::uint32_t min_segment_size_for_cutting_;
std::uint32_t min_segment_size_for_cutting_{400};

/** \brief Cut_score threshold */
float min_cut_score_;
float min_cut_score_{0.16};

/** \brief Use local constrains for cutting */
bool use_local_constrains_;
bool use_local_constrains_{true};

/** \brief Use directed weights for the cutting */
bool use_directed_weights_;
bool use_directed_weights_{true};

/** \brief Use clean cutting */
bool use_clean_cutting_;
bool use_clean_cutting_{false};

/** \brief Iterations for RANSAC */
std::uint32_t ransac_itrs_;
std::uint32_t ransac_itrs_{10000};


/******************************************* Directional weighted RANSAC declarations ******************************************************************/
Expand Down
14 changes: 5 additions & 9 deletions segmentation/include/pcl/segmentation/extract_clusters.h
Original file line number Diff line number Diff line change
Expand Up @@ -337,11 +337,7 @@ namespace pcl

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/** \brief Empty constructor. */
EuclideanClusterExtraction () : tree_ (),
cluster_tolerance_ (0),
min_pts_per_cluster_ (1),
max_pts_per_cluster_ (std::numeric_limits<pcl::uindex_t>::max ())
{};
EuclideanClusterExtraction () = default;

/** \brief Provide a pointer to the search object.
* \param[in] tree a pointer to the spatial search object.
Expand Down Expand Up @@ -423,16 +419,16 @@ namespace pcl
using BasePCLBase::deinitCompute;

/** \brief A pointer to the spatial search object. */
KdTreePtr tree_;
KdTreePtr tree_{nullptr};

/** \brief The spatial cluster tolerance as a measure in the L2 Euclidean space. */
double cluster_tolerance_;
double cluster_tolerance_{0.0};

/** \brief The minimum number of points that a cluster needs to contain in order to be considered valid (default = 1). */
pcl::uindex_t min_pts_per_cluster_;
pcl::uindex_t min_pts_per_cluster_{1};

/** \brief The maximum number of points that a cluster needs to contain in order to be considered valid (default = MAXINT). */
pcl::uindex_t max_pts_per_cluster_;
pcl::uindex_t max_pts_per_cluster_{std::numeric_limits<pcl::uindex_t>::max()};

/** \brief Class getName method. */
virtual std::string getClassName () const { return ("EuclideanClusterExtraction"); }
Expand Down
17 changes: 6 additions & 11 deletions segmentation/include/pcl/segmentation/extract_labeled_clusters.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,7 @@ class LabeledEuclideanClusterExtraction : public PCLBase<PointT> {

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/** \brief Empty constructor. */
LabeledEuclideanClusterExtraction()
: tree_()
, cluster_tolerance_(0)
, min_pts_per_cluster_(1)
, max_pts_per_cluster_(std::numeric_limits<int>::max())
, max_label_(std::numeric_limits<int>::max()){};
LabeledEuclideanClusterExtraction() = default;

/** \brief Provide a pointer to the search object.
* \param[in] tree a pointer to the spatial search object.
Expand Down Expand Up @@ -177,22 +172,22 @@ class LabeledEuclideanClusterExtraction : public PCLBase<PointT> {
using BasePCLBase::input_;

/** \brief A pointer to the spatial search object. */
KdTreePtr tree_;
KdTreePtr tree_{nullptr};

/** \brief The spatial cluster tolerance as a measure in the L2 Euclidean space. */
double cluster_tolerance_;
double cluster_tolerance_{0};

/** \brief The minimum number of points that a cluster needs to contain in order to be
* considered valid (default = 1). */
int min_pts_per_cluster_;
int min_pts_per_cluster_{1};

/** \brief The maximum number of points that a cluster needs to contain in order to be
* considered valid (default = MAXINT). */
int max_pts_per_cluster_;
int max_pts_per_cluster_{std::numeric_limits<int>::max()};

/** \brief The maximum number of labels we can find in this pointcloud (default =
* MAXINT)*/
unsigned int max_label_;
unsigned int max_label_{std::numeric_limits<int>::max()};

/** \brief Class getName method. */
virtual std::string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,7 @@ namespace pcl
using PointIndicesConstPtr = PointIndices::ConstPtr;

/** \brief Empty constructor. */
ExtractPolygonalPrismData () : planar_hull_ (), min_pts_hull_ (3),
height_limit_min_ (0),
height_limit_max_(std::numeric_limits<float>::max()),
vpx_ (0), vpy_ (0), vpz_ (0)
{};
ExtractPolygonalPrismData () = default;

/** \brief Provide a pointer to the input planar hull dataset.
* \note Please see the example in the class description for how to obtain this.
Expand Down Expand Up @@ -187,23 +183,23 @@ namespace pcl

protected:
/** \brief A pointer to the input planar hull dataset. */
PointCloudConstPtr planar_hull_;
PointCloudConstPtr planar_hull_{nullptr};

/** \brief The minimum number of points needed on the convex hull. */
int min_pts_hull_;
int min_pts_hull_{3};

/** \brief The minimum allowed height (distance to the model) a point
* will be considered from.
*/
double height_limit_min_;
double height_limit_min_{0.0};

/** \brief The maximum allowed height (distance to the model) a point
* will be considered from.
*/
double height_limit_max_;
double height_limit_max_{std::numeric_limits<float>::max()};

/** \brief Values describing the data acquisition viewpoint. Default: 0,0,0. */
float vpx_, vpy_, vpz_;
float vpx_{0}, vpy_{0}, vpz_{0};

/** \brief Class getName method. */
virtual std::string
Expand Down
39 changes: 16 additions & 23 deletions segmentation/include/pcl/segmentation/grabcut_segmentation.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ namespace pcl
/// nodes and their outgoing internal edges
std::vector<capacitated_edge> nodes_;
/// current flow value (includes constant)
double flow_value_;
double flow_value_{0.0};
/// identifies which side of the cut a node falls
std::vector<unsigned char> cut_;

Expand Down Expand Up @@ -256,12 +256,9 @@ namespace pcl
class GaussianFitter
{
public:
GaussianFitter (float epsilon = 0.0001)
: sum_ (Eigen::Vector3f::Zero ())
, accumulator_ (Eigen::Matrix3f::Zero ())
, count_ (0)
, epsilon_ (epsilon)
{ }
GaussianFitter (float epsilon = 0.0001f)
: epsilon_ (epsilon)
{}

/// Add a color sample
void
Expand All @@ -281,11 +278,11 @@ namespace pcl

private:
/// sum of r,g, and b
Eigen::Vector3f sum_;
Eigen::Vector3f sum_{Eigen::Vector3f::Zero ()};
/// matrix of products (i.e. r*r, r*g, r*b), some values are duplicated.
Eigen::Matrix3f accumulator_;
Eigen::Matrix3f accumulator_{Eigen::Matrix3f::Zero ()};
/// count of color samples added to the gaussian
std::uint32_t count_;
std::uint32_t count_{0};
/// small value to add to covariance matrix diagonal to avoid singular values
float epsilon_;
PCL_MAKE_ALIGNED_OPERATOR_NEW
Expand Down Expand Up @@ -329,12 +326,8 @@ namespace pcl
using PCLBase<PointT>::fake_indices_;

/// Constructor
GrabCut (std::uint32_t K = 5, float lambda = 50.f)
: K_ (K)
, lambda_ (lambda)
, nb_neighbours_ (9)
, initialized_ (false)
{}
GrabCut(std::uint32_t K = 5, float lambda = 50.f) : K_(K), lambda_(lambda) {}

/// Destructor
~GrabCut () override = default;
// /// Set input cloud
Expand Down Expand Up @@ -399,12 +392,12 @@ namespace pcl
// Storage for N-link weights, each pixel stores links to nb_neighbours
struct NLinks
{
NLinks () : nb_links (0), indices (0), dists (0), weights (0) {}
NLinks () = default;

int nb_links;
Indices indices;
std::vector<float> dists;
std::vector<float> weights;
int nb_links{0};
Indices indices{};
std::vector<float> dists{};
std::vector<float> weights{};
};
bool
initCompute ();
Expand Down Expand Up @@ -460,9 +453,9 @@ namespace pcl
/// Pointer to the spatial search object.
KdTreePtr tree_;
/// Number of neighbours
int nb_neighbours_;
int nb_neighbours_{9};
/// is segmentation initialized
bool initialized_;
bool initialized_{false};
/// Precomputed N-link weights
std::vector<NLinks> n_links_;
/// Converted input
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,7 @@

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
template <typename PointT>
pcl::ApproximateProgressiveMorphologicalFilter<PointT>::ApproximateProgressiveMorphologicalFilter () :
max_window_size_ (33),
slope_ (0.7f),
max_distance_ (10.0f),
initial_distance_ (0.15f),
cell_size_ (1.0f),
base_ (2.0f),
exponential_ (true),
threads_ (0)
{
}
pcl::ApproximateProgressiveMorphologicalFilter<PointT>::ApproximateProgressiveMorphologicalFilter () = default;

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
template <typename PointT>
Expand Down
10 changes: 1 addition & 9 deletions segmentation/include/pcl/segmentation/impl/cpc_segmentation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,7 @@
#include <pcl/segmentation/cpc_segmentation.h>

template <typename PointT>
pcl::CPCSegmentation<PointT>::CPCSegmentation () :
max_cuts_ (20),
min_segment_size_for_cutting_ (400),
min_cut_score_ (0.16),
use_local_constrains_ (true),
use_directed_weights_ (true),
ransac_itrs_ (10000)
{
}
pcl::CPCSegmentation<PointT>::CPCSegmentation () = default;

template <typename PointT>
pcl::CPCSegmentation<PointT>::~CPCSegmentation () = default;
Expand Down
14 changes: 1 addition & 13 deletions segmentation/include/pcl/segmentation/impl/lccp_segmentation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,7 @@


template <typename PointT>
pcl::LCCPSegmentation<PointT>::LCCPSegmentation () :
concavity_tolerance_threshold_ (10),
grouping_data_valid_ (false),
supervoxels_set_ (false),
use_smoothness_check_ (false),
smoothness_threshold_ (0.1),
use_sanity_check_ (false),
seed_resolution_ (0),
voxel_resolution_ (0),
k_factor_ (0),
min_segment_size_ (0)
{
}
pcl::LCCPSegmentation<PointT>::LCCPSegmentation () = default;

template <typename PointT>
pcl::LCCPSegmentation<PointT>::~LCCPSegmentation () = default;
Expand Down
Loading

0 comments on commit e2656ed

Please sign in to comment.