Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefer combined assignment operators #3030

Merged
merged 7 commits into from
Apr 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/cloud_composer/src/cloud_composer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ pcl::cloud_composer::ComposerMainWindow::on_action_new_project__triggered (/*QSt
int k = 2;
while (name_model_map_.contains (name + tr ("-%1").arg (k)))
++k;
name = name + tr ("-%1").arg (k);
name += tr ("-%1").arg (k);
}
//qDebug () << "Setting name";
new_project_model->setName (name);
Expand Down
10 changes: 5 additions & 5 deletions apps/cloud_composer/src/items/cloud_item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,18 +122,18 @@ pcl::cloud_composer::CloudItem::setTemplateCloudFromBlob ()
if (field_names.contains ("x") && field_names.contains ("y") && field_names.contains ("z"))
point_type_ = (point_type_ | PointTypeFlags::XYZ);
if (field_names.contains ("rgb"))
point_type_ = point_type_ | PointTypeFlags::RGB;
point_type_ |= PointTypeFlags::RGB;
if (field_names.contains ("rgba"))
point_type_ = point_type_ | PointTypeFlags::RGBA;
point_type_ |= PointTypeFlags::RGBA;
if (field_names.contains ("normal_x") && field_names.contains ("normal_y") && field_names.contains ("normal_z"))
{
if (field_names.contains ("curvature"))
point_type_ = point_type_ | PointTypeFlags::NORMAL;
point_type_ |= PointTypeFlags::NORMAL;
else
point_type_ = point_type_ | PointTypeFlags::AXIS;
point_type_ |= PointTypeFlags::AXIS;
}
if (field_names.contains ("h") && field_names.contains ("s") && field_names.contains ("v"))
point_type_ = point_type_ | PointTypeFlags::HSV;
point_type_ |= PointTypeFlags::HSV;

QVariant cloud_pointer_variant;
QVariant kd_tree_variant;
Expand Down
4 changes: 2 additions & 2 deletions apps/cloud_composer/src/project_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ pcl::cloud_composer::ProjectModel::insertNewCloudFromFile ()
++k;
items = findItems (short_filename+ tr ("-%1").arg (k));
}
short_filename = short_filename+ tr ("-%1").arg (k);
short_filename += tr ("-%1").arg (k);
}
CloudItem* new_item = new CloudItem (short_filename, cloud_blob, origin, orientation, true);

Expand Down Expand Up @@ -337,7 +337,7 @@ pcl::cloud_composer::ProjectModel::insertNewCloudFromRGBandDepth ()
++k;
items = findItems (short_filename+ tr ("-%1").arg (k));
}
short_filename = short_filename+ tr ("-%1").arg (k);
short_filename += tr ("-%1").arg (k);
}

CloudItem* new_item = CloudItem::createCloudItemFromTemplate<PointXYZRGB> (short_filename,cloud);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,9 +362,9 @@ int main (int argc, char** argv)
pcl::transformPointCloud (*temp, *result, GlobalTransform);

//update the global transform
GlobalTransform = GlobalTransform * pairTransform;
GlobalTransform *= pairTransform;

//save aligned pair, transformed into the first cloud's frame
//save aligned pair, transformed into the first cloud's frame
std::stringstream ss;
ss << i << ".pcd";
pcl::io::savePCDFile (ss.str (), *result, true);
Expand Down
2 changes: 1 addition & 1 deletion features/include/pcl/features/from_meshes.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ namespace pcl
Eigen::Vector3d y;
y << 0, 1, 0;
rot.row(2) = normal;
y = y - normal(1) * normal;
y -= normal(1) * normal;
y.normalize();
rot.row(1) = y;
rot.row(0) = normal.cross(rot.row(1));
Expand Down
2 changes: 1 addition & 1 deletion features/include/pcl/features/impl/our_cvfh.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ pcl::OURCVFHEstimation<PointInT, PointNT, PointOutT>::sgurf (Eigen::Vector3f & c
float w = (max_dist - d_k);
Eigen::Vector3f diff = (pvector);
Eigen::Matrix3f mat = diff * diff.transpose ();
scatter = scatter + mat * w;
scatter += mat * w;
sum_w += w;
}

Expand Down
2 changes: 1 addition & 1 deletion filters/include/pcl/filters/impl/normal_space.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ pcl::NormalSpaceSampling<PointT, NormalT>::isEntireBinSampled (boost::dynamic_bi
bool status = true;
for (unsigned int i = start_index; i < start_index + length; i++)
{
status = status & array.test (i);
status &= array.test (i);
}
return status;
}
Expand Down
4 changes: 2 additions & 2 deletions filters/src/random_sample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ pcl::RandomSample<pcl::PCLPointCloud2>::applyFilter (PCLPointCloud2 &output)
S++;
top--;
N--;
quot = quot * float (top) / float (N);
quot *= float (top) / float (N);
}
index += S;
memcpy (&output.data[i++ * output.point_step], &input_->data[index++ * output.point_step], output.point_step);
Expand Down Expand Up @@ -130,7 +130,7 @@ pcl::RandomSample<pcl::PCLPointCloud2>::applyFilter (std::vector<int> &indices)
S++;
top--;
N--;
quot = quot * float (top) / float (N);
quot *= float (top) / float (N);
}
index += S;
indices[i++] = (*indices_)[index++];
Expand Down
2 changes: 1 addition & 1 deletion gpu/kinfu/tools/kinfu_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ getViewerPose (visualization::PCLVisualizer& viewer)
-1, 0, 0,
0, -1, 0;

rotation = rotation * axis_reorder;
rotation *= axis_reorder;
pose.linear() = rotation;
return pose;
}
Expand Down
2 changes: 1 addition & 1 deletion gpu/kinfu/tools/kinfu_app_sim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ getViewerPose (visualization::PCLVisualizer& viewer)
-1, 0, 0,
0, -1, 0;

rotation = rotation * axis_reorder;
rotation *= axis_reorder;
pose.linear() = rotation;
return pose;
}
Expand Down
6 changes: 3 additions & 3 deletions gpu/kinfu_large_scale/src/cuda/tsdf_volume.cu
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ namespace pcl
{
///If we went outside of the memory, make sure we go back to the beginning of it
if(pos > buffer.tsdf_memory_end)
pos = pos - size;
pos -= size;

if (pos >= buffer.tsdf_memory_start && pos <= buffer.tsdf_memory_end) // quickfix for http://dev.pointclouds.org/issues/894
pack_tsdf (0.f, 0, *pos);
Expand Down Expand Up @@ -134,7 +134,7 @@ namespace pcl

///We make sure that we are not already before the start of the memory
if(pos < buffer.tsdf_memory_start)
pos = pos + size;
pos += size;

int nbSteps = abs(maxBounds.z);

Expand All @@ -143,7 +143,7 @@ namespace pcl
{
///If we went outside of the memory, make sure we go back to the beginning of it
if(pos > buffer.tsdf_memory_end)
pos = pos - size;
pos -= size;

if (pos >= buffer.tsdf_memory_start && pos <= buffer.tsdf_memory_end) // quickfix for http://dev.pointclouds.org/issues/894
pack_tsdf (0.f, 0, *pos);
Expand Down
4 changes: 2 additions & 2 deletions gpu/kinfu_large_scale/src/screenshot_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ namespace pcl
Eigen::Vector3f teVecs = camPose.translation ();

// Create filenames
filename_pose = filename_pose + std::to_string(screenshot_counter) + file_extension_pose;
filename_image = filename_image + std::to_string(screenshot_counter) + file_extension_image;
filename_pose += std::to_string(screenshot_counter) + file_extension_pose;
filename_image += std::to_string(screenshot_counter) + file_extension_image;

// Write files
writePose (filename_pose, teVecs, erreMats);
Expand Down
2 changes: 1 addition & 1 deletion gpu/kinfu_large_scale/tools/kinfuLS_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ getViewerPose (visualization::PCLVisualizer& viewer)
-1, 0, 0,
0, -1, 0;

rotation = rotation * axis_reorder;
rotation *= axis_reorder;
pose.linear() = rotation;
return pose;
}
Expand Down
2 changes: 1 addition & 1 deletion gpu/kinfu_large_scale/tools/kinfu_app_sim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ getViewerPose (visualization::PCLVisualizer& viewer)
-1, 0, 0,
0, -1, 0;

rotation = rotation * axis_reorder;
rotation *= axis_reorder;
pose.linear() = rotation;
return pose;
}
Expand Down
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 gpu/utils/include/pcl/gpu/utils/device/algorithm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ namespace pcl
{
first = middle;
++first;
len = len - half - 1;
len -= half + 1;
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion io/src/ply_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ pcl::PLYReader::vertexAlphaCallback (pcl::io::ply::uint8 alpha)
&cloud_->data[vertex_count_ * cloud_->point_step + rgb_offset_before_],
sizeof (pcl::io::ply::float32));
// append alpha
rgba_ = rgba_ | a_ << 24;
rgba_ |= a_ << 24;
// put rgba back
memcpy (&cloud_->data[vertex_count_ * cloud_->point_step + rgb_offset_before_],
&rgba_,
Expand Down
6 changes: 3 additions & 3 deletions ml/src/svm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ static inline double powi (double base, int times)
if (t % 2 == 1)
ret *= tmp;

tmp = tmp * tmp;
tmp *= tmp;
}

return ret;
Expand Down 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 Expand Up @@ -2333,7 +2333,7 @@ static double svm_svr_probability (

for (int i = 0; i < prob->l; i++)
if (fabs (ymv[i]) > 5*std)
count = count + 1;
count += 1;
else
mae += fabs (ymv[i]);

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
2 changes: 1 addition & 1 deletion outofcore/include/pcl/outofcore/impl/octree_base_node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ namespace pcl

// Need to make the bounding box slightly bigger so points that fall on the max side aren't excluded
double epsilon = 1e-8;
tmp_max = tmp_max + epsilon*Eigen::Vector3d (1.0, 1.0, 1.0);
tmp_max += epsilon*Eigen::Vector3d (1.0, 1.0, 1.0);

node_metadata_->setBoundingBox (tmp_min, tmp_max);
node_metadata_->setDirectoryPathname (root_name.parent_path ());
Expand Down
2 changes: 1 addition & 1 deletion people/include/pcl/people/impl/head_based_subcluster.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ pcl::people::HeadBasedSubclustering<PointT>::createSubClusters (pcl::people::Per
PointT* current_point = &cloud_->points[*points_iterator]; // current point cloud point
Eigen::Vector3f p_current_eigen(current_point->x, current_point->y, current_point->z); // conversion to eigen
float t = p_current_eigen.dot(head_ground_coeffs) / normalize_factor; // height from the ground
p_current_eigen = p_current_eigen - head_ground_coeffs * t; // projection of the point on the groundplane
p_current_eigen -= head_ground_coeffs * t; // projection of the point on the groundplane

int i = 0;
bool correspondence_detected = false;
Expand Down
6 changes: 3 additions & 3 deletions people/include/pcl/people/impl/height_map_2d.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ pcl::people::HeightMap2D<PointT>::searchLocalMaxima ()
maxima_indices_[t] = i - int(offset/2 + 0.5);
maxima_cloud_indices_[t] = buckets_cloud_indices_[maxima_indices_[t]];
left = buckets_[i+1];
i = i+2;
i +=2;
offset = 0;
maxima_number_++;
}
Expand Down Expand Up @@ -216,15 +216,15 @@ pcl::people::HeightMap2D<PointT>::filterMaxima ()
PointT* p_current = &cloud_->points[maxima_cloud_indices_[i]]; // pointcloud point referring to the current maximum
Eigen::Vector3f p_current_eigen(p_current->x, p_current->y, p_current->z); // conversion to eigen
float t = p_current_eigen.dot(ground_coeffs_.head(3)) / std::pow(sqrt_ground_coeffs_, 2); // height from the ground
p_current_eigen = p_current_eigen - ground_coeffs_.head(3) * t; // projection of the point on the groundplane
p_current_eigen -= ground_coeffs_.head(3) * t; // projection of the point on the groundplane

int j = i-1;
while ((j >= 0) && (good_maximum))
{
PointT* p_previous = &cloud_->points[maxima_cloud_indices_[j]]; // pointcloud point referring to an already validated maximum
Eigen::Vector3f p_previous_eigen(p_previous->x, p_previous->y, p_previous->z); // conversion to eigen
float t = p_previous_eigen.dot(ground_coeffs_.head(3)) / std::pow(sqrt_ground_coeffs_, 2); // height from the ground
p_previous_eigen = p_previous_eigen - ground_coeffs_.head(3) * t; // projection of the point on the groundplane
p_previous_eigen -= ground_coeffs_.head(3) * t; // projection of the point on the groundplane

// distance of the projection of the points on the groundplane:
distance = (p_current_eigen-p_previous_eigen).norm();
Expand Down
2 changes: 1 addition & 1 deletion recognition/src/cg/hough_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ pcl::recognition::HoughSpace3D::findMaxima (double min_threshold, std::vector<do

for (int k = 2; k >= 0; --k){

moduled_index = moduled_index % partial_bin_products_[k+1];
moduled_index %= partial_bin_products_[k+1];
indexes[k] = moduled_index / partial_bin_products_[k];

if (indexes[k] > 0 && hough_space_[i] < hough_space_[i-partial_bin_products_[k]])
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
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pcl::registration::IncrementalRegistration<PointT, Scalar>::registerCloud (const

if ( converged ){
delta_transform_ = registration_->getFinalTransformation ();
abs_transform_ = abs_transform_ * delta_transform_;
abs_transform_ *= delta_transform_;
last_cloud_ = cloud;
}

Expand Down
10 changes: 5 additions & 5 deletions registration/include/pcl/registration/impl/ndt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ pcl::NormalDistributionsTransform<PointSource, PointTarget>::computeTransformati
Eigen::AngleAxis<float> (static_cast<float> (delta_p (5)), Eigen::Vector3f::UnitZ ())).matrix ();


p = p + delta_p;
p += delta_p;

// Update Visualizer (untested)
if (update_visualizer_ != 0)
Expand Down Expand Up @@ -733,12 +733,12 @@ pcl::NormalDistributionsTransform<PointSource, PointTarget>::computeStepLengthMT
open_interval = false;

// Converts f_l and g_l from psi to phi
f_l = f_l + phi_0 - mu * d_phi_0 * a_l;
g_l = g_l + mu * d_phi_0;
f_l += phi_0 - mu * d_phi_0 * a_l;
g_l += mu * d_phi_0;

// Converts f_u and g_u from psi to phi
f_u = f_u + phi_0 - mu * d_phi_0 * a_u;
g_u = g_u + mu * d_phi_0;
f_u += phi_0 - mu * d_phi_0 * a_u;
g_u += mu * d_phi_0;
}

if (open_interval)
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
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ pcl::CPCSegmentation<PointT>::applyCuttingPlane (uint32_t depth_levels_left)
++cluster_concave_pts;
}
// check if the score is below the threshold. If that is the case this segment should not be split
cluster_score = cluster_score * 1.0 / cluster_index.indices.size ();
cluster_score /= cluster_index.indices.size ();
// std::cout << "Cluster score: " << cluster_score << std::endl;
if (cluster_score >= min_cut_score_)
{
Expand Down Expand Up @@ -338,7 +338,7 @@ pcl::CPCSegmentation<PointT>::WeightedRandomSampleConsensus::computeModel (int)
current_score += index_score;
}
// normalize by the total number of inliers
current_score = current_score * 1.0 / current_inliers->size ();
current_score /= current_inliers->size ();

// Better match ?
if (current_score > best_score_)
Expand Down
Loading