Skip to content

Commit

Permalink
Prefer usage of operator/= instead of using operator/
Browse files Browse the repository at this point in the history
  • Loading branch information
Heiko Thiel committed Apr 23, 2019
1 parent cfc317e commit 220aa1d
Show file tree
Hide file tree
Showing 16 changed files with 31 additions and 31 deletions.
2 changes: 1 addition & 1 deletion gpu/people/src/probability_processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ pcl::gpu::people::ProbabilityProcessor::CreateGaussianKernel ( float sigma,
// Normalize f
for(int i = 0; i < kernelSize; i++)
{
f[i] = f[i]/sum;
f[i] /=sum;
}

return f;
Expand Down
2 changes: 1 addition & 1 deletion ml/src/svm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2095,7 +2095,7 @@ static void sigmoid_train (
break;
}
else
stepsize = stepsize / 2.0;
stepsize /= 2.0;
}

if (stepsize < min_step)
Expand Down
2 changes: 1 addition & 1 deletion ml/src/svm_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,7 @@ pcl::SVMClassify::scaleProblem (svm_problem &input, svm_scaling scaling)
break;

if (input.x[i][j].index < scaling.max && scaling.obj[ input.x[i][j].index ].index == 1)
input.x[i][j].value = input.x[i][j].value / scaling.obj[ input.x[i][j].index ].value;
input.x[i][j].value /= scaling.obj[ input.x[i][j].index ].value;

j++;
}
Expand Down
6 changes: 3 additions & 3 deletions recognition/src/face_detection/rf_face_detector_trainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ void pcl::RFFaceDetectorTrainer::faceVotesClustering()
}
}

mean = mean / static_cast<float> (good_votes);
mean /= static_cast<float> (good_votes);
clusters_mean[i] = mean;
}

Expand Down Expand Up @@ -202,14 +202,14 @@ void pcl::RFFaceDetectorTrainer::faceVotesClustering()
rot += angle_votes_[uncertainty[j].first];
}

rot = rot / static_cast<float> (num);
rot /= static_cast<float> (num);

Eigen::Vector3f pos;
pos.setZero ();
for (int j = 0; j < num; j++)
pos += head_center_votes_[uncertainty[j].first];

pos = pos / static_cast<float> (num);
pos /= static_cast<float> (num);

head_clusters_centers_.push_back (pos); //clusters_mean[i]
head_clusters_rotation_.push_back (rot);
Expand Down
6 changes: 3 additions & 3 deletions registration/src/gicp6d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,17 @@ namespace pcl
if (R > 0.04045)
R = pow ( (R + 0.055) / 1.055, 2.4);
else
R = R / 12.92;
R /= 12.92;

if (G > 0.04045)
G = pow ( (G + 0.055) / 1.055, 2.4);
else
G = G / 12.92;
G /= 12.92;

if (B > 0.04045)
B = pow ( (B + 0.055) / 1.055, 2.4);
else
B = B / 12.92;
B /= 12.92;

// postponed:
// R *= 100.0;
Expand Down
4 changes: 2 additions & 2 deletions simulation/src/range_likelihood.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ max_level (int a, int b)
while (true)
{
if (a%2 || b%2) return level;
a = a / 2;
b = b / 2;
a /= 2;
b /= 2;
level++;
}
}
Expand Down
8 changes: 4 additions & 4 deletions simulation/src/sum_reduce.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ pcl::simulation::SumReduce::SumReduce (int width, int height, int levels) : leve

for (int i = 0; i < levels_; ++i)
{
level_width = level_width / 2;
level_height = level_height / 2;
level_width /= 2;
level_height /= 2;

glBindTexture (GL_TEXTURE_2D, arrays_[i]);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
Expand Down Expand Up @@ -105,8 +105,8 @@ pcl::simulation::SumReduce::sum (GLuint input_array, float* output_array)
std::cout << "SumReduce::sum render" << std::endl;
}

width = width / 2;
height = height / 2;
width /= 2;
height /= 2;

glActiveTexture (GL_TEXTURE0);
glBindTexture (GL_TEXTURE_2D, arrays_[i]);
Expand Down
10 changes: 5 additions & 5 deletions surface/include/pcl/surface/impl/texture_mapping.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,19 @@ pcl::TextureMapping<PointInT>::mapTexture2Face (
Eigen::Vector3f p2p3 (p3[0] - p2[0], p3[1] - p2[1], p3[2] - p2[2]);

// Normalize
p1p2 = p1p2 / std::sqrt (p1p2.dot (p1p2));
p1p3 = p1p3 / std::sqrt (p1p3.dot (p1p3));
p2p3 = p2p3 / std::sqrt (p2p3.dot (p2p3));
p1p2 /= std::sqrt (p1p2.dot (p1p2));
p1p3 /= std::sqrt (p1p3.dot (p1p3));
p2p3 /= std::sqrt (p2p3.dot (p2p3));

// compute vector normal of a face
Eigen::Vector3f f_normal = p1p2.cross (p1p3);
f_normal = f_normal / std::sqrt (f_normal.dot (f_normal));
f_normal /= std::sqrt (f_normal.dot (f_normal));

// project vector field onto the face: vector v1_projected = v1 - Dot(v1, n) * n;
Eigen::Vector3f f_vector_field = vector_field_ - vector_field_.dot (f_normal) * f_normal;

// Normalize
f_vector_field = f_vector_field / std::sqrt (f_vector_field.dot (f_vector_field));
f_vector_field /= std::sqrt (f_vector_field.dot (f_vector_field));

// texture coordinates
Eigen::Vector2f tp1, tp2, tp3;
Expand Down
2 changes: 1 addition & 1 deletion surface/include/pcl/surface/texture_mapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ namespace pcl
{
vector_field_ = Eigen::Vector3f (x, y, z);
// normalize vector field
vector_field_ = vector_field_ / std::sqrt (vector_field_.dot (vector_field_));
vector_field_ /= std::sqrt (vector_field_.dot (vector_field_));
}

/** \brief Set texture files
Expand Down
2 changes: 1 addition & 1 deletion surface/src/on_nurbs/fitting_curve_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ FittingCurve2d::initNurbsPCA (int order, NurbsDataCurve2d *data, int ncps)
data->mean = mean;
data->eigenvectors = eigenvectors;

eigenvalues = eigenvalues / s; // seems that the eigenvalues are dependent on the number of points (???)
eigenvalues /= s; // seems that the eigenvalues are dependent on the number of points (???)
Eigen::Matrix2d eigenvectors_inv = eigenvectors.inverse ();

Eigen::Vector2d v_max (-DBL_MAX, -DBL_MAX);
Expand Down
2 changes: 1 addition & 1 deletion surface/src/on_nurbs/fitting_curve_pdm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ FittingCurve::initNurbsCurvePCA (int order, const vector_vec3d &data, int ncps,

NurbsTools::pca (data, mean, eigenvectors, eigenvalues);

eigenvalues = eigenvalues / s; // seems that the eigenvalues are dependent on the number of points (???)
eigenvalues /= s; // seems that the eigenvalues are dependent on the number of points (???)

double r = rf * sqrt (eigenvalues (0));

Expand Down
2 changes: 1 addition & 1 deletion surface/src/on_nurbs/fitting_cylinder_pdm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ FittingCylinder::initNurbsPCACylinder (int order, NurbsDataSurface *data)
data->mean = mean;
data->eigenvectors = eigenvectors;

eigenvalues = eigenvalues / s; // seems that the eigenvalues are dependent on the number of points (???)
eigenvalues /= s; // seems that the eigenvalues are dependent on the number of points (???)

Eigen::Vector3d v_max (0.0, 0.0, 0.0);
Eigen::Vector3d v_min (DBL_MAX, DBL_MAX, DBL_MAX);
Expand Down
4 changes: 2 additions & 2 deletions surface/src/on_nurbs/fitting_surface_pdm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ FittingSurface::initNurbsPCA (int order, NurbsDataSurface *m_data, Eigen::Vector
if (eigenvectors.col (2).dot (z) < 0.0)
flip = true;

eigenvalues = eigenvalues / s; // seems that the eigenvalues are dependent on the number of points (???)
eigenvalues /= s; // seems that the eigenvalues are dependent on the number of points (???)

Eigen::Vector3d sigma (sqrt (eigenvalues (0)), sqrt (eigenvalues (1)), sqrt (eigenvalues (2)));

Expand Down Expand Up @@ -461,7 +461,7 @@ FittingSurface::initNurbsPCABoundingBox (int order, NurbsDataSurface *m_data, Ei
if (eigenvectors.col (2).dot (z) < 0.0)
flip = true;

eigenvalues = eigenvalues / s; // seems that the eigenvalues are dependent on the number of points (???)
eigenvalues /= s; // seems that the eigenvalues are dependent on the number of points (???)
Eigen::Matrix3d eigenvectors_inv = eigenvectors.inverse ();

Eigen::Vector3d v_max (-DBL_MAX, -DBL_MAX, -DBL_MAX);
Expand Down
6 changes: 3 additions & 3 deletions tools/obj_rec_ransac_accepted_hypotheses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,9 +359,9 @@ update (CallbackParameters* params)
axis(2,0) = static_cast<float> (aux::getRandomInteger (-100, 100));
// Normalize the axis
float len = std::sqrt (axis(0,0)*axis(0,0) + axis(1,0)*axis(1,0) + axis(2,0)*axis(2,0));
axis(0,0) = axis(0,0)/len;
axis(1,0) = axis(1,0)/len;
axis(2,0) = axis(2,0)/len;
axis(0,0) /=len;
axis(1,0) /=len;
axis(2,0) /=len;

cout << "Input angle = " << angle << endl;
cout << "Input axis = \n" << axis << endl;
Expand Down
2 changes: 1 addition & 1 deletion tracking/include/pcl/tracking/impl/particle_filter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ pcl::tracking::ParticleFilterTracker<PointInT, StateT>::normalizeWeight ()
if (sum != 0.0)
{
for ( size_t i = 0; i < particles_->points.size (); i++ )
particles_->points[i].weight = particles_->points[i].weight / static_cast<float> (sum);
particles_->points[i].weight /= static_cast<float> (sum);
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ namespace pcl
{
Eigen::Vector4d pte (pt.x, pt.y, pt.z, 1);
window_cord = composite_mat * pte;
window_cord = window_cord/window_cord (3);
window_cord /=window_cord (3);
window_cord[0] = (window_cord[0]+1.0) / 2.0*window_size[0];
window_cord[1] = (window_cord[1]+1.0) / 2.0*window_size[1];
window_cord[2] = (window_cord[2]+1.0) / 2.0;
Expand Down

0 comments on commit 220aa1d

Please sign in to comment.