Skip to content

Commit e2656ed

Browse files
authored
Part G of transition to support modernize-use-default-member-init (#5860)
* 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
1 parent 0e4683a commit e2656ed

40 files changed

+231
-418
lines changed

registration/include/pcl/registration/impl/ndt.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ namespace pcl {
4646
template <typename PointSource, typename PointTarget, typename Scalar>
4747
NormalDistributionsTransform<PointSource, PointTarget, Scalar>::
4848
NormalDistributionsTransform()
49-
: target_cells_(), trans_likelihood_()
49+
: target_cells_()
5050
{
5151
reg_name_ = "NormalDistributionsTransform";
5252

segmentation/include/pcl/segmentation/approximate_progressive_morphological_filter.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -144,28 +144,28 @@ namespace pcl
144144
protected:
145145

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

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

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

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

158158
/** \brief Cell size. */
159-
float cell_size_;
159+
float cell_size_{1.0f};
160160

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

164164
/** \brief Exponentially grow window sizes? */
165-
bool exponential_;
165+
bool exponential_{true};
166166

167167
/** \brief Number of threads to be used. */
168-
unsigned int threads_;
168+
unsigned int threads_{0};
169169
};
170170
}
171171

segmentation/include/pcl/segmentation/conditional_euclidean_clustering.h

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,6 @@ namespace pcl
9999
ConditionalEuclideanClustering (bool extract_removed_clusters = false) :
100100
searcher_ (),
101101
condition_function_ (),
102-
cluster_tolerance_ (0.0f),
103-
min_cluster_size_ (1),
104-
max_cluster_size_ (std::numeric_limits<int>::max ()),
105102
extract_removed_clusters_ (extract_removed_clusters),
106103
small_clusters_ (new pcl::IndicesClusters),
107104
large_clusters_ (new pcl::IndicesClusters)
@@ -237,28 +234,28 @@ namespace pcl
237234

238235
private:
239236
/** \brief A pointer to the spatial search object */
240-
SearcherPtr searcher_;
237+
SearcherPtr searcher_{nullptr};
241238

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

245242
/** \brief The distance to scan for cluster candidates (default = 0.0) */
246-
float cluster_tolerance_;
243+
float cluster_tolerance_{0.0f};
247244

248245
/** \brief The minimum cluster size (default = 1) */
249-
int min_cluster_size_;
246+
int min_cluster_size_{1};
250247

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

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

257254
/** \brief The resultant clusters that contain less than min_cluster_size points */
258-
pcl::IndicesClustersPtr small_clusters_;
255+
pcl::IndicesClustersPtr small_clusters_{nullptr};
259256

260257
/** \brief The resultant clusters that contain more than max_cluster_size points */
261-
pcl::IndicesClustersPtr large_clusters_;
258+
pcl::IndicesClustersPtr large_clusters_{nullptr};
262259

263260
public:
264261
PCL_MAKE_ALIGNED_OPERATOR_NEW

segmentation/include/pcl/segmentation/cpc_segmentation.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -138,25 +138,25 @@ namespace pcl
138138
/// *** Parameters *** ///
139139

140140
/** \brief Maximum number of cuts */
141-
std::uint32_t max_cuts_;
141+
std::uint32_t max_cuts_{20};
142142

143143
/** \brief Minimum segment size for cutting */
144-
std::uint32_t min_segment_size_for_cutting_;
144+
std::uint32_t min_segment_size_for_cutting_{400};
145145

146146
/** \brief Cut_score threshold */
147-
float min_cut_score_;
147+
float min_cut_score_{0.16};
148148

149149
/** \brief Use local constrains for cutting */
150-
bool use_local_constrains_;
150+
bool use_local_constrains_{true};
151151

152152
/** \brief Use directed weights for the cutting */
153-
bool use_directed_weights_;
153+
bool use_directed_weights_{true};
154154

155155
/** \brief Use clean cutting */
156-
bool use_clean_cutting_;
156+
bool use_clean_cutting_{false};
157157

158158
/** \brief Iterations for RANSAC */
159-
std::uint32_t ransac_itrs_;
159+
std::uint32_t ransac_itrs_{10000};
160160

161161

162162
/******************************************* Directional weighted RANSAC declarations ******************************************************************/

segmentation/include/pcl/segmentation/extract_clusters.h

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -337,11 +337,7 @@ namespace pcl
337337

338338
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
339339
/** \brief Empty constructor. */
340-
EuclideanClusterExtraction () : tree_ (),
341-
cluster_tolerance_ (0),
342-
min_pts_per_cluster_ (1),
343-
max_pts_per_cluster_ (std::numeric_limits<pcl::uindex_t>::max ())
344-
{};
340+
EuclideanClusterExtraction () = default;
345341

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

425421
/** \brief A pointer to the spatial search object. */
426-
KdTreePtr tree_;
422+
KdTreePtr tree_{nullptr};
427423

428424
/** \brief The spatial cluster tolerance as a measure in the L2 Euclidean space. */
429-
double cluster_tolerance_;
425+
double cluster_tolerance_{0.0};
430426

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

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

437433
/** \brief Class getName method. */
438434
virtual std::string getClassName () const { return ("EuclideanClusterExtraction"); }

segmentation/include/pcl/segmentation/extract_labeled_clusters.h

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,7 @@ class LabeledEuclideanClusterExtraction : public PCLBase<PointT> {
8888

8989
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
9090
/** \brief Empty constructor. */
91-
LabeledEuclideanClusterExtraction()
92-
: tree_()
93-
, cluster_tolerance_(0)
94-
, min_pts_per_cluster_(1)
95-
, max_pts_per_cluster_(std::numeric_limits<int>::max())
96-
, max_label_(std::numeric_limits<int>::max()){};
91+
LabeledEuclideanClusterExtraction() = default;
9792

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

179174
/** \brief A pointer to the spatial search object. */
180-
KdTreePtr tree_;
175+
KdTreePtr tree_{nullptr};
181176

182177
/** \brief The spatial cluster tolerance as a measure in the L2 Euclidean space. */
183-
double cluster_tolerance_;
178+
double cluster_tolerance_{0};
184179

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

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

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

197192
/** \brief Class getName method. */
198193
virtual std::string

segmentation/include/pcl/segmentation/extract_polygonal_prism_data.h

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,7 @@ namespace pcl
115115
using PointIndicesConstPtr = PointIndices::ConstPtr;
116116

117117
/** \brief Empty constructor. */
118-
ExtractPolygonalPrismData () : planar_hull_ (), min_pts_hull_ (3),
119-
height_limit_min_ (0),
120-
height_limit_max_(std::numeric_limits<float>::max()),
121-
vpx_ (0), vpy_ (0), vpz_ (0)
122-
{};
118+
ExtractPolygonalPrismData () = default;
123119

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

188184
protected:
189185
/** \brief A pointer to the input planar hull dataset. */
190-
PointCloudConstPtr planar_hull_;
186+
PointCloudConstPtr planar_hull_{nullptr};
191187

192188
/** \brief The minimum number of points needed on the convex hull. */
193-
int min_pts_hull_;
189+
int min_pts_hull_{3};
194190

195191
/** \brief The minimum allowed height (distance to the model) a point
196192
* will be considered from.
197193
*/
198-
double height_limit_min_;
194+
double height_limit_min_{0.0};
199195

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

205201
/** \brief Values describing the data acquisition viewpoint. Default: 0,0,0. */
206-
float vpx_, vpy_, vpz_;
202+
float vpx_{0}, vpy_{0}, vpz_{0};
207203

208204
/** \brief Class getName method. */
209205
virtual std::string

segmentation/include/pcl/segmentation/grabcut_segmentation.h

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ namespace pcl
157157
/// nodes and their outgoing internal edges
158158
std::vector<capacitated_edge> nodes_;
159159
/// current flow value (includes constant)
160-
double flow_value_;
160+
double flow_value_{0.0};
161161
/// identifies which side of the cut a node falls
162162
std::vector<unsigned char> cut_;
163163

@@ -256,12 +256,9 @@ namespace pcl
256256
class GaussianFitter
257257
{
258258
public:
259-
GaussianFitter (float epsilon = 0.0001)
260-
: sum_ (Eigen::Vector3f::Zero ())
261-
, accumulator_ (Eigen::Matrix3f::Zero ())
262-
, count_ (0)
263-
, epsilon_ (epsilon)
264-
{ }
259+
GaussianFitter (float epsilon = 0.0001f)
260+
: epsilon_ (epsilon)
261+
{}
265262

266263
/// Add a color sample
267264
void
@@ -281,11 +278,11 @@ namespace pcl
281278

282279
private:
283280
/// sum of r,g, and b
284-
Eigen::Vector3f sum_;
281+
Eigen::Vector3f sum_{Eigen::Vector3f::Zero ()};
285282
/// matrix of products (i.e. r*r, r*g, r*b), some values are duplicated.
286-
Eigen::Matrix3f accumulator_;
283+
Eigen::Matrix3f accumulator_{Eigen::Matrix3f::Zero ()};
287284
/// count of color samples added to the gaussian
288-
std::uint32_t count_;
285+
std::uint32_t count_{0};
289286
/// small value to add to covariance matrix diagonal to avoid singular values
290287
float epsilon_;
291288
PCL_MAKE_ALIGNED_OPERATOR_NEW
@@ -329,12 +326,8 @@ namespace pcl
329326
using PCLBase<PointT>::fake_indices_;
330327

331328
/// Constructor
332-
GrabCut (std::uint32_t K = 5, float lambda = 50.f)
333-
: K_ (K)
334-
, lambda_ (lambda)
335-
, nb_neighbours_ (9)
336-
, initialized_ (false)
337-
{}
329+
GrabCut(std::uint32_t K = 5, float lambda = 50.f) : K_(K), lambda_(lambda) {}
330+
338331
/// Destructor
339332
~GrabCut () override = default;
340333
// /// Set input cloud
@@ -399,12 +392,12 @@ namespace pcl
399392
// Storage for N-link weights, each pixel stores links to nb_neighbours
400393
struct NLinks
401394
{
402-
NLinks () : nb_links (0), indices (0), dists (0), weights (0) {}
395+
NLinks () = default;
403396

404-
int nb_links;
405-
Indices indices;
406-
std::vector<float> dists;
407-
std::vector<float> weights;
397+
int nb_links{0};
398+
Indices indices{};
399+
std::vector<float> dists{};
400+
std::vector<float> weights{};
408401
};
409402
bool
410403
initCompute ();
@@ -460,9 +453,9 @@ namespace pcl
460453
/// Pointer to the spatial search object.
461454
KdTreePtr tree_;
462455
/// Number of neighbours
463-
int nb_neighbours_;
456+
int nb_neighbours_{9};
464457
/// is segmentation initialized
465-
bool initialized_;
458+
bool initialized_{false};
466459
/// Precomputed N-link weights
467460
std::vector<NLinks> n_links_;
468461
/// Converted input

segmentation/include/pcl/segmentation/impl/approximate_progressive_morphological_filter.hpp

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,7 @@
4949

5050
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
5151
template <typename PointT>
52-
pcl::ApproximateProgressiveMorphologicalFilter<PointT>::ApproximateProgressiveMorphologicalFilter () :
53-
max_window_size_ (33),
54-
slope_ (0.7f),
55-
max_distance_ (10.0f),
56-
initial_distance_ (0.15f),
57-
cell_size_ (1.0f),
58-
base_ (2.0f),
59-
exponential_ (true),
60-
threads_ (0)
61-
{
62-
}
52+
pcl::ApproximateProgressiveMorphologicalFilter<PointT>::ApproximateProgressiveMorphologicalFilter () = default;
6353

6454
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
6555
template <typename PointT>

segmentation/include/pcl/segmentation/impl/cpc_segmentation.hpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,7 @@
4242
#include <pcl/segmentation/cpc_segmentation.h>
4343

4444
template <typename PointT>
45-
pcl::CPCSegmentation<PointT>::CPCSegmentation () :
46-
max_cuts_ (20),
47-
min_segment_size_for_cutting_ (400),
48-
min_cut_score_ (0.16),
49-
use_local_constrains_ (true),
50-
use_directed_weights_ (true),
51-
ransac_itrs_ (10000)
52-
{
53-
}
45+
pcl::CPCSegmentation<PointT>::CPCSegmentation () = default;
5446

5547
template <typename PointT>
5648
pcl::CPCSegmentation<PointT>::~CPCSegmentation () = default;

0 commit comments

Comments
 (0)