Skip to content

Commit b390826

Browse files
authored
Review casts in PCL, Part B (PointCloudLibrary#5508)
* Initial application of google-readability-casting * Addressed google-readability-casting escapes * Addressed clang-format violations flagged by CI * More clang-format escapes * Addressed clang-tidy escapes * Fixed compile issue not seen on desktop * Addressed review comments * Fixed clang-tidy complaint * Clarified PCLPointCloud2::concatenate logic * Addressed latest review comments * Addressed latest review comments * Eliminated double casts per review
1 parent 2888c5f commit b390826

File tree

161 files changed

+1031
-1022
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

161 files changed

+1031
-1022
lines changed

Diff for: .clang-tidy

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
Checks: '-*,modernize-use-auto,modernize-deprecated-headers,modernize-redundant-void-arg,modernize-replace-random-shuffle,modernize-use-equals-default,modernize-use-equals-delete,modernize-use-nullptr,modernize-use-override,modernize-use-using,performance-faster-string-find,performance-for-range-copy,performance-implicit-conversion-in-loop,performance-inefficient-algorithm,performance-inefficient-vector-operation,performance-move-const-arg,performance-move-constructor-init,performance-no-automatic-move,performance-noexcept-move-constructor,performance-type-promotion-in-math-fn,cppcoreguidelines-pro-type-cstyle-cast,cppcoreguidelines-pro-type-static-cast-downcast'
3-
WarningsAsErrors: '-*,modernize-use-auto,modernize-deprecated-headers,modernize-redundant-void-arg,modernize-replace-random-shuffle,modernize-use-equals-default,modernize-use-equals-delete,modernize-use-nullptr,modernize-use-override,modernize-use-using,performance-faster-string-find,performance-for-range-copy,performance-implicit-conversion-in-loop,performance-inefficient-algorithm,performance-inefficient-vector-operation,performance-move-const-arg,performance-move-constructor-init,performance-no-automatic-move,performance-noexcept-move-constructor,performance-type-promotion-in-math-fn,cppcoreguidelines-pro-type-cstyle-cast,cppcoreguidelines-pro-type-static-cast-downcast'
2+
Checks: '-*,modernize-use-auto,modernize-deprecated-headers,modernize-redundant-void-arg,modernize-replace-random-shuffle,modernize-use-equals-default,modernize-use-equals-delete,modernize-use-nullptr,modernize-use-override,modernize-use-using,performance-faster-string-find,performance-for-range-copy,performance-implicit-conversion-in-loop,performance-inefficient-algorithm,performance-inefficient-vector-operation,performance-move-const-arg,performance-move-constructor-init,performance-no-automatic-move,performance-noexcept-move-constructor,performance-type-promotion-in-math-fn,cppcoreguidelines-pro-type-cstyle-cast,cppcoreguidelines-pro-type-static-cast-downcast,google-readability-casting'
3+
WarningsAsErrors: '-*,modernize-use-auto,modernize-deprecated-headers,modernize-redundant-void-arg,modernize-replace-random-shuffle,modernize-use-equals-default,modernize-use-equals-delete,modernize-use-nullptr,modernize-use-override,modernize-use-using,performance-faster-string-find,performance-for-range-copy,performance-implicit-conversion-in-loop,performance-inefficient-algorithm,performance-inefficient-vector-operation,performance-move-const-arg,performance-move-constructor-init,performance-no-automatic-move,performance-noexcept-move-constructor,performance-type-promotion-in-math-fn,cppcoreguidelines-pro-type-cstyle-cast,cppcoreguidelines-pro-type-static-cast-downcast,google-readability-casting'
44
CheckOptions:
55
- {key: modernize-use-auto.MinTypeNameLength, value: 7}

Diff for: 2d/include/pcl/2d/impl/edge.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ Edge<PointInT, PointOutT>::suppressNonMaxima(
277277

278278
// maxima (j, i).intensity = 0;
279279

280-
switch (int(ptedge.direction)) {
280+
switch (static_cast<int>(ptedge.direction)) {
281281
case 0: {
282282
if (ptedge.magnitude >= edges(j - 1, i).magnitude &&
283283
ptedge.magnitude >= edges(j + 1, i).magnitude)

Diff for: 2d/include/pcl/2d/impl/kernel.hpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,9 @@ kernel<PointT>::gaussianKernel(pcl::PointCloud<PointT>& kernel)
106106
for (int j = 0; j < kernel_size_; j++) {
107107
int iks = (i - kernel_size_ / 2);
108108
int jks = (j - kernel_size_ / 2);
109-
kernel(j, i).intensity =
110-
std::exp(float(-double(iks * iks + jks * jks) / sigma_sqr));
111-
sum += float(kernel(j, i).intensity);
109+
kernel(j, i).intensity = std::exp(
110+
static_cast<float>(-static_cast<double>(iks * iks + jks * jks) / sigma_sqr));
111+
sum += (kernel(j, i).intensity);
112112
}
113113
}
114114

@@ -132,7 +132,8 @@ kernel<PointT>::loGKernel(pcl::PointCloud<PointT>& kernel)
132132
for (int j = 0; j < kernel_size_; j++) {
133133
int iks = (i - kernel_size_ / 2);
134134
int jks = (j - kernel_size_ / 2);
135-
float temp = float(double(iks * iks + jks * jks) / sigma_sqr);
135+
float temp =
136+
static_cast<float>(static_cast<double>(iks * iks + jks * jks) / sigma_sqr);
136137
kernel(j, i).intensity = (1.0f - temp) * std::exp(-temp);
137138
sum += kernel(j, i).intensity;
138139
}

Diff for: common/include/pcl/common/impl/bivariate_polynomial.hpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -208,19 +208,19 @@ BivariatePolynomialT<real>::findCriticalPoints (std::vector<real>& x_values, std
208208

209209
if (degree == 2)
210210
{
211-
real x = (real(2)*parameters[2]*parameters[3] - parameters[1]*parameters[4]) /
212-
(parameters[1]*parameters[1] - real(4)*parameters[0]*parameters[3]),
213-
y = (real(-2)*parameters[0]*x - parameters[2]) / parameters[1];
211+
real x = (static_cast<real>(2)*parameters[2]*parameters[3] - parameters[1]*parameters[4]) /
212+
(parameters[1]*parameters[1] - static_cast<real>(4)*parameters[0]*parameters[3]),
213+
y = (static_cast<real>(-2)*parameters[0]*x - parameters[2]) / parameters[1];
214214

215215
if (!std::isfinite(x) || !std::isfinite(y))
216216
return;
217217

218218
int type = 2;
219-
real det_H = real(4)*parameters[0]*parameters[3] - parameters[1]*parameters[1];
219+
real det_H = static_cast<real>(4)*parameters[0]*parameters[3] - parameters[1]*parameters[1];
220220
//std::cout << "det(H) = "<<det_H<<"\n";
221-
if (det_H > real(0)) // Check Hessian determinant
221+
if (det_H > static_cast<real>(0)) // Check Hessian determinant
222222
{
223-
if (parameters[0]+parameters[3] < real(0)) // Check Hessian trace
223+
if (parameters[0]+parameters[3] < static_cast<real>(0)) // Check Hessian trace
224224
type = 0;
225225
else
226226
type = 1;

Diff for: common/include/pcl/common/impl/common.hpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ pcl::getPointsInBox (const pcl::PointCloud<PointT> &cloud,
168168
continue;
169169
if (cloud[i].x > max_pt[0] || cloud[i].y > max_pt[1] || cloud[i].z > max_pt[2])
170170
continue;
171-
indices[l++] = int (i);
171+
indices[l++] = static_cast<int>(i);
172172
}
173173
}
174174
// NaN or Inf values could exist => check for them
@@ -186,7 +186,7 @@ pcl::getPointsInBox (const pcl::PointCloud<PointT> &cloud,
186186
continue;
187187
if (cloud[i].x > max_pt[0] || cloud[i].y > max_pt[1] || cloud[i].z > max_pt[2])
188188
continue;
189-
indices[l++] = int (i);
189+
indices[l++] = static_cast<int>(i);
190190
}
191191
}
192192
indices.resize (l);
@@ -210,7 +210,7 @@ pcl::getMaxDistance (const pcl::PointCloud<PointT> &cloud, const Eigen::Vector4f
210210
dist = (pivot_pt3 - pt).norm ();
211211
if (dist > max_dist)
212212
{
213-
max_idx = int (i);
213+
max_idx = static_cast<int>(i);
214214
max_dist = dist;
215215
}
216216
}
@@ -227,7 +227,7 @@ pcl::getMaxDistance (const pcl::PointCloud<PointT> &cloud, const Eigen::Vector4f
227227
dist = (pivot_pt3 - pt).norm ();
228228
if (dist > max_dist)
229229
{
230-
max_idx = int (i);
230+
max_idx = static_cast<int>(i);
231231
max_dist = dist;
232232
}
233233
}

Diff for: common/include/pcl/common/impl/pca.hpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ PCA<PointT>::initCompute ()
7171
demeanPointCloud (*input_, *indices_, mean_, cloud_demean);
7272
assert (cloud_demean.cols () == int (indices_->size ()));
7373
// Compute the product cloud_demean * cloud_demean^T
74-
const Eigen::Matrix3f alpha = (1.f / (float (indices_->size ()) - 1.f))
74+
const Eigen::Matrix3f alpha = (1.f / (static_cast<float>(indices_->size ()) - 1.f))
7575
* cloud_demean.topRows<3> () * cloud_demean.topRows<3> ().transpose ();
7676

7777
// Compute eigen vectors and values
@@ -102,7 +102,7 @@ PCA<PointT>::update (const PointT& input_point, FLAG flag)
102102

103103
Eigen::Vector3f input (input_point.x, input_point.y, input_point.z);
104104
const std::size_t n = eigenvectors_.cols ();// number of eigen vectors
105-
Eigen::VectorXf meanp = (float(n) * (mean_.head<3>() + input)) / float(n + 1);
105+
Eigen::VectorXf meanp = (static_cast<float>(n) * (mean_.head<3>() + input)) / static_cast<float>(n + 1);
106106
Eigen::VectorXf a = eigenvectors_.transpose() * (input - mean_.head<3>());
107107
Eigen::VectorXf y = (eigenvectors_ * a) + mean_.head<3>();
108108
Eigen::VectorXf h = y - input;
@@ -113,12 +113,12 @@ PCA<PointT>::update (const PointT& input_point, FLAG flag)
113113
float gamma = h.dot(input - mean_.head<3>());
114114
Eigen::MatrixXf D = Eigen::MatrixXf::Zero (a.size() + 1, a.size() + 1);
115115
D.block(0,0,n,n) = a * a.transpose();
116-
D /= float(n)/float((n+1) * (n+1));
116+
D /= static_cast<float>(n)/static_cast<float>((n+1) * (n+1));
117117
for(std::size_t i=0; i < a.size(); i++) {
118-
D(i,i)+= float(n)/float(n+1)*eigenvalues_(i);
119-
D(D.rows()-1,i) = float(n) / float((n+1) * (n+1)) * gamma * a(i);
118+
D(i,i)+= static_cast<float>(n)/static_cast<float>(n+1)*eigenvalues_(i);
119+
D(D.rows()-1,i) = static_cast<float>(n) / static_cast<float>((n+1) * (n+1)) * gamma * a(i);
120120
D(i,D.cols()-1) = D(D.rows()-1,i);
121-
D(D.rows()-1,D.cols()-1) = float(n)/float((n+1) * (n+1)) * gamma * gamma;
121+
D(D.rows()-1,D.cols()-1) = static_cast<float>(n)/static_cast<float>((n+1) * (n+1)) * gamma * gamma;
122122
}
123123

124124
Eigen::MatrixXf R(D.rows(), D.cols());

Diff for: common/include/pcl/impl/cloud_iterator.hpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -218,12 +218,12 @@ namespace pcl
218218

219219
unsigned getCurrentPointIndex () const override
220220
{
221-
return (unsigned (iterator_ - cloud_.begin ()));
221+
return (static_cast<unsigned>(iterator_ - cloud_.begin ()));
222222
}
223223

224224
unsigned getCurrentIndex () const override
225225
{
226-
return (unsigned (iterator_ - cloud_.begin ()));
226+
return (static_cast<unsigned>(iterator_ - cloud_.begin ()));
227227
}
228228

229229
std::size_t size () const override
@@ -292,12 +292,12 @@ namespace pcl
292292

293293
unsigned getCurrentPointIndex () const override
294294
{
295-
return (unsigned (*iterator_));
295+
return (static_cast<unsigned>(*iterator_));
296296
}
297297

298298
unsigned getCurrentIndex () const override
299299
{
300-
return (unsigned (iterator_ - indices_.begin ()));
300+
return (static_cast<unsigned>(iterator_ - indices_.begin ()));
301301
}
302302

303303
std::size_t size () const override

Diff for: common/include/pcl/range_image/impl/range_image.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ RangeImage::getAcutenessValue (const PointWithRange& point1, const PointWithRang
661661
float impact_angle = getImpactAngle (point1, point2);
662662
if (std::isinf (impact_angle))
663663
return -std::numeric_limits<float>::infinity ();
664-
float ret = 1.0f - float (std::fabs (impact_angle)/ (0.5f*M_PI));
664+
float ret = 1.0f - static_cast<float>(std::fabs (impact_angle)/ (0.5f*M_PI));
665665
if (impact_angle < 0.0f)
666666
ret = -ret;
667667
//if (std::abs (ret)>1)

Diff for: common/src/PCLPointCloud2.cpp

+7-11
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,13 @@ pcl::PCLPointCloud2::concatenate (pcl::PCLPointCloud2 &cloud1, const pcl::PCLPoi
5858
const auto size1 = cloud1.width * cloud1.height;
5959
const auto size2 = cloud2.width * cloud2.height;
6060
//if one input cloud has no points, but the other input does, just select the cloud with points
61-
switch ((bool (size1) << 1) + bool (size2))
62-
{
63-
case 1:
64-
cloud1 = cloud2;
65-
PCL_FALLTHROUGH
66-
case 0:
67-
case 2:
68-
cloud1.header.stamp = std::max (cloud1.header.stamp, cloud2.header.stamp);
69-
return (true);
70-
default:
71-
break;
61+
if ((size1 == 0) && (size2 != 0)) {
62+
cloud1 = cloud2;
63+
}
64+
65+
if ((size1 == 0) || (size2 == 0)) {
66+
cloud1.header.stamp = std::max (cloud1.header.stamp, cloud2.header.stamp);
67+
return true;
7268
}
7369

7470
// Ideally this should be in PCLPointField class since this is global behavior

Diff for: common/src/bearing_angle_image.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ BearingAngleImage::generateBAImage (PointCloud<PointXYZ>& point_cloud)
114114
points[(i + 1) * width + j].y = point_cloud.at (j, i + 1).y;
115115
points[(i + 1) * width + j].z = point_cloud.at (j, i + 1).z;
116116
// set the gray value for every pixel point
117-
points[(i + 1) * width + j].rgba = ((int)r) << 24 | ((int)g) << 16 | ((int)b) << 8 | 0xff;
117+
points[(i + 1) * width + j].rgba = (static_cast<int>(r)) << 24 | (static_cast<int>(g)) << 16 | (static_cast<int>(b)) << 8 | 0xff;
118118
}
119119
}
120120
}

Diff for: common/src/colors.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -609,9 +609,9 @@ pcl::getRandomColor (double min, double max)
609609
}
610610
while (sum <= min || sum >= max);
611611
pcl::RGB color;
612-
color.r = std::uint8_t (r * 255.0);
613-
color.g = std::uint8_t (g * 255.0);
614-
color.b = std::uint8_t (b * 255.0);
612+
color.r = static_cast<std::uint8_t>(r * 255.0);
613+
color.g = static_cast<std::uint8_t>(g * 255.0);
614+
color.b = static_cast<std::uint8_t>(b * 255.0);
615615
return (color);
616616
}
617617

Diff for: common/src/gaussian.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ pcl::GaussianKernel::compute (float sigma,
8383
kernel.resize (kernel_width);
8484
derivative.resize (kernel_width);
8585
const float factor = 0.01f;
86-
float max_gauss = 1.0f, max_deriv = float (sigma * std::exp (-0.5));
86+
float max_gauss = 1.0f, max_deriv = static_cast<float>(sigma * std::exp (-0.5));
8787
int hw = kernel_width / 2;
8888

8989
float sigma_sqr = 1.0f / (2.0f * sigma * sigma);

Diff for: common/src/range_image.cpp

+18-18
Original file line numberDiff line numberDiff line change
@@ -459,9 +459,9 @@ float*
459459
RangeImage::getInterpolatedSurfaceProjection (const Eigen::Affine3f& pose, int pixel_size, float world_size) const
460460
{
461461
float max_dist = 0.5f*world_size,
462-
cell_size = world_size/float (pixel_size);
462+
cell_size = world_size/static_cast<float>(pixel_size);
463463
float world2cell_factor = 1.0f/cell_size,
464-
world2cell_offset = 0.5f*float (pixel_size)-0.5f;
464+
world2cell_offset = 0.5f*static_cast<float>(pixel_size)-0.5f;
465465
float cell2world_factor = cell_size,
466466
cell2world_offset = -max_dist + 0.5f*cell_size;
467467
Eigen::Affine3f inverse_pose = pose.inverse (Eigen::Isometry);
@@ -537,11 +537,11 @@ RangeImage::getInterpolatedSurfaceProjection (const Eigen::Affine3f& pose, int p
537537
cell3_y = world2cell_factor*point3[1] + world2cell_offset,
538538
cell3_z = point3[2];
539539

540-
int min_cell_x = (std::max) (0, int (pcl_lrint (std::ceil ( (std::min) (cell1_x, (std::min) (cell2_x, cell3_x)))))),
541-
max_cell_x = (std::min) (pixel_size-1, int (pcl_lrint (std::floor ( (std::max) (cell1_x,
540+
int min_cell_x = (std::max) (0, static_cast<int>(pcl_lrint (std::ceil ( (std::min) (cell1_x, (std::min) (cell2_x, cell3_x)))))),
541+
max_cell_x = (std::min) (pixel_size-1, static_cast<int>(pcl_lrint (std::floor ( (std::max) (cell1_x,
542542
(std::max) (cell2_x, cell3_x)))))),
543-
min_cell_y = (std::max) (0, int (pcl_lrint (std::ceil ( (std::min) (cell1_y, (std::min) (cell2_y, cell3_y)))))),
544-
max_cell_y = (std::min) (pixel_size-1, int (pcl_lrint (std::floor ( (std::max) (cell1_y,
543+
min_cell_y = (std::max) (0, static_cast<int>(pcl_lrint (std::ceil ( (std::min) (cell1_y, (std::min) (cell2_y, cell3_y)))))),
544+
max_cell_y = (std::min) (pixel_size-1, static_cast<int>(pcl_lrint (std::floor ( (std::max) (cell1_y,
545545
(std::max) (cell2_y, cell3_y))))));
546546
if (max_cell_x<min_cell_x || max_cell_y<min_cell_y)
547547
continue;
@@ -720,9 +720,9 @@ RangeImage::getSurfaceAngleChangeImages (int radius, float*& angle_change_image_
720720
int size = width*height;
721721
angle_change_image_x = new float[size];
722722
angle_change_image_y = new float[size];
723-
for (int y=0; y<int (height); ++y)
723+
for (int y=0; y<static_cast<int>(height); ++y)
724724
{
725-
for (int x=0; x<int (width); ++x)
725+
for (int x=0; x<static_cast<int>(width); ++x)
726726
{
727727
int index = y*width+x;
728728
getSurfaceAngleChange (x, y, radius, angle_change_image_x[index], angle_change_image_y[index]);
@@ -739,9 +739,9 @@ RangeImage::getAcutenessValueImages (int pixel_distance, float*& acuteness_value
739739
int size = width*height;
740740
acuteness_value_image_x = new float[size];
741741
acuteness_value_image_y = new float[size];
742-
for (int y=0; y<int (height); ++y)
742+
for (int y=0; y<static_cast<int>(height); ++y)
743743
{
744-
for (int x=0; x<int (width); ++x)
744+
for (int x=0; x<static_cast<int>(width); ++x)
745745
{
746746
int index = y*width+x;
747747
acuteness_value_image_x[index] = getAcutenessValue (x, y, x+pixel_distance, y);
@@ -757,9 +757,9 @@ RangeImage::getImpactAngleImageBasedOnLocalNormals (int radius) const
757757
MEASURE_FUNCTION_TIME;
758758
int size = width*height;
759759
float* impact_angle_image = new float[size];
760-
for (int y=0; y<int (height); ++y)
760+
for (int y=0; y<static_cast<int>(height); ++y)
761761
{
762-
for (int x=0; x<int (width); ++x)
762+
for (int x=0; x<static_cast<int>(width); ++x)
763763
{
764764
impact_angle_image[y*width+x] = getImpactAngleBasedOnLocalNormal (x, y, radius);
765765
}
@@ -776,9 +776,9 @@ RangeImage::getRangeImageWithSmoothedSurface (int radius, RangeImage& smoothed_r
776776

777777
smoothed_range_image = *this;
778778
Eigen::Vector3f sensor_pos = getSensorPos ();
779-
for (int y=0; y<int (height); ++y)
779+
for (int y=0; y<static_cast<int>(height); ++y)
780780
{
781-
for (int x=0; x<int (width); ++x)
781+
for (int x=0; x<static_cast<int>(width); ++x)
782782
{
783783
PointWithRange& point = smoothed_range_image.getPoint (x, y);
784784
if (std::isinf (point.range))
@@ -874,9 +874,9 @@ RangeImage::getOverlap (const RangeImage& other_range_image, const Eigen::Affine
874874
reduction(+ : valid_points_counter) \
875875
reduction(+ : hits_counter) \
876876
num_threads(max_no_of_threads)
877-
for (int other_y=0; other_y<int (other_range_image.height); other_y+=pixel_step)
877+
for (int other_y=0; other_y<static_cast<int>(other_range_image.height); other_y+=pixel_step)
878878
{
879-
for (int other_x=0; other_x<int (other_range_image.width); other_x+=pixel_step)
879+
for (int other_x=0; other_x<static_cast<int>(other_range_image.width); other_x+=pixel_step)
880880
{
881881
const PointWithRange& point = other_range_image.getPoint (other_x, other_y);
882882
if (!std::isfinite (point.range))
@@ -920,9 +920,9 @@ RangeImage::getBlurredImageUsingIntegralImage (int blur_radius, float* integral_
920920
RangeImage& blurred_image) const
921921
{
922922
this->copyTo(blurred_image);
923-
for (int y=0; y<int (height); ++y)
923+
for (int y=0; y<static_cast<int>(height); ++y)
924924
{
925-
for (int x=0; x<int (width); ++x)
925+
for (int x=0; x<static_cast<int>(width); ++x)
926926
{
927927
const PointWithRange& old_point = getPoint (x, y);
928928
PointWithRange& new_point = blurred_image.getPoint (x, y);

Diff for: examples/features/example_difference_of_normals.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ int main (int argc, char *argv[])
9999

100100
// Create downsampled point cloud for DoN NN search with large scale
101101
large_cloud_downsampled = PointCloud<PointT>::Ptr(new pcl::PointCloud<PointT>);
102-
constexpr float largedownsample = float(scale2 / decimation);
102+
constexpr float largedownsample = static_cast<float>(scale2/decimation);
103103
sor.setLeafSize (largedownsample, largedownsample, largedownsample);
104104
sor.filter (*large_cloud_downsampled);
105105
std::cout << "Using leaf size of " << largedownsample << " for large scale, " << large_cloud_downsampled->size() << " points" << std::endl;

Diff for: examples/segmentation/example_cpc_segmentation.cpp

+10-10
Original file line numberDiff line numberDiff line change
@@ -77,39 +77,39 @@ keyboardEventOccurred (const pcl::visualization::KeyboardEvent& event_arg,
7777
if (event_arg.keyUp ())
7878
switch (key)
7979
{
80-
case (int) '1':
80+
case static_cast<int>('1'):
8181
show_normals = !show_normals;
8282
normals_changed = true;
8383
break;
84-
case (int) '2':
84+
case static_cast<int>('2'):
8585
show_adjacency = !show_adjacency;
8686
break;
87-
case (int) '3':
87+
case static_cast<int>('3'):
8888
show_supervoxels = !show_supervoxels;
8989
break;
90-
case (int) '4':
90+
case static_cast<int>('4'):
9191
show_segmentation = !show_segmentation;
9292
break;
93-
case (int) '5':
93+
case static_cast<int>('5'):
9494
normals_scale *= 1.25;
9595
normals_changed = true;
9696
break;
97-
case (int) '6':
97+
case static_cast<int>('6'):
9898
normals_scale *= 0.8;
9999
normals_changed = true;
100100
break;
101-
case (int) '7':
101+
case static_cast<int>('7'):
102102
line_width += 0.5;
103103
line_changed = true;
104104
break;
105-
case (int) '8':
105+
case static_cast<int>('8'):
106106
if (line_width <= 1)
107107
break;
108108
line_width -= 0.5;
109109
line_changed = true;
110110
break;
111-
case (int) 'd':
112-
case (int) 'D':
111+
case static_cast<int>('d'):
112+
case static_cast<int>('D'):
113113
show_help = !show_help;
114114
break;
115115
default:

0 commit comments

Comments
 (0)