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

Review casts in PCL, Part B #5508

Prev Previous commit
Next Next commit
Clarified PCLPointCloud2::concatenate logic
  • Loading branch information
gnawme committed Jan 12, 2023
commit f257e3b0f849bf90c33eade479771bcdc14b66b8
10 changes: 4 additions & 6 deletions common/src/PCLPointCloud2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,13 @@ pcl::PCLPointCloud2::concatenate (pcl::PCLPointCloud2 &cloud1, const pcl::PCLPoi
const auto size1 = cloud1.width * cloud1.height;
const auto size2 = cloud2.width * cloud2.height;
//if one input cloud has no points, but the other input does, just select the cloud with points
auto chooser = (static_cast<bool>(size1) << 1) + static_cast<bool>(size2);
if (chooser == 1) {
if ((size1 == 0) && (size2 != 0)) {
cloud1 = cloud2;
}

if ((chooser == 0) || (chooser == 2))
{
cloud1.header.stamp = std::max(cloud1.header.stamp, cloud2.header.stamp);
return (true);
if (size2 == 0) {
gnawme marked this conversation as resolved.
Show resolved Hide resolved
cloud1.header.stamp = std::max (cloud1.header.stamp, cloud2.header.stamp);
return true;
}

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