Skip to content

Commit

Permalink
Merge pull request #4535 from JStech/fix-force-no-recompute
Browse files Browse the repository at this point in the history
  • Loading branch information
kunaltyagi authored Dec 14, 2020
2 parents 3ac8ddd + 343d5f4 commit ba2b709
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,7 @@ class CorrespondenceEstimationBase : public PCLBase<PointSource> {
setSearchMethodTarget(const KdTreePtr& tree, bool force_no_recompute = false)
{
tree_ = tree;
if (force_no_recompute) {
force_no_recompute_ = true;
}
force_no_recompute_ = force_no_recompute;
// Since we just set a new tree, we need to check for updates
target_cloud_updated_ = true;
}
Expand All @@ -239,9 +237,7 @@ class CorrespondenceEstimationBase : public PCLBase<PointSource> {
bool force_no_recompute = false)
{
tree_reciprocal_ = tree;
if (force_no_recompute) {
force_no_recompute_reciprocal_ = true;
}
force_no_recompute_reciprocal_ = force_no_recompute;
// Since we just set a new tree, we need to check for updates
source_cloud_updated_ = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,9 +303,7 @@ class DataContainer : public DataContainerInterface {
setSearchMethodTarget(const KdTreePtr& tree, bool force_no_recompute = false)
{
tree_ = tree;
if (force_no_recompute) {
force_no_recompute_ = true;
}
force_no_recompute_ = force_no_recompute;
target_cloud_updated_ = true;
}

Expand Down
8 changes: 2 additions & 6 deletions registration/include/pcl/registration/registration.h
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,7 @@ class Registration : public PCLBase<PointSource> {
setSearchMethodTarget(const KdTreePtr& tree, bool force_no_recompute = false)
{
tree_ = tree;
if (force_no_recompute) {
force_no_recompute_ = true;
}
force_no_recompute_ = force_no_recompute;
// Since we just set a new tree, we need to check for updates
target_cloud_updated_ = true;
}
Expand All @@ -253,9 +251,7 @@ class Registration : public PCLBase<PointSource> {
bool force_no_recompute = false)
{
tree_reciprocal_ = tree;
if (force_no_recompute) {
force_no_recompute_reciprocal_ = true;
}
force_no_recompute_reciprocal_ = force_no_recompute;
// Since we just set a new tree, we need to check for updates
source_cloud_updated_ = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,7 @@ class TransformationValidationEuclidean {
setSearchMethodTarget(const KdTreePtr& tree, bool force_no_recompute = false)
{
tree_ = tree;
if (force_no_recompute) {
force_no_recompute_ = true;
}
force_no_recompute_ = force_no_recompute;
}

/** \brief Set a threshold for which a specific transformation is considered valid.
Expand Down
8 changes: 4 additions & 4 deletions test/registration/test_ndt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@

using namespace pcl;
using namespace pcl::io;

PointCloud<PointXYZ> cloud_source, cloud_target;

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
TEST (PCL, NormalDistributionsTransform)
{
Expand All @@ -74,8 +74,8 @@ TEST (PCL, NormalDistributionsTransform)
// Check again, for all possible caching schemes
for (int iter = 0; iter < 4; iter++)
{
bool force_cache = (bool) iter/2;
bool force_cache_reciprocal = (bool) iter%2;
bool force_cache = static_cast<bool> (iter/2);
bool force_cache_reciprocal = static_cast<bool> (iter%2);
pcl::search::KdTree<PointT>::Ptr tree(new pcl::search::KdTree<PointT>);
// Ensure that, when force_cache is not set, we are robust to the wrong input
if (force_cache)
Expand Down
12 changes: 6 additions & 6 deletions test/registration/test_registration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -475,8 +475,8 @@ TEST (PCL, IterativeClosestPoint_PointToPlane)
// Check again, for all possible caching schemes
for (int iter = 0; iter < 4; iter++)
{
bool force_cache = (bool) iter/2;
bool force_cache_reciprocal = (bool) iter%2;
bool force_cache = static_cast<bool> (iter/2);
bool force_cache_reciprocal = static_cast<bool> (iter%2);
pcl::search::KdTree<PointT>::Ptr tree(new pcl::search::KdTree<PointT>);
// Ensure that, when force_cache is not set, we are robust to the wrong input
if (force_cache)
Expand Down Expand Up @@ -548,8 +548,8 @@ TEST (PCL, GeneralizedIterativeClosestPoint)
// Check again, for all possible caching schemes
for (int iter = 0; iter < 4; iter++)
{
bool force_cache = (bool) iter/2;
bool force_cache_reciprocal = (bool) iter%2;
bool force_cache = static_cast<bool> (iter/2);
bool force_cache_reciprocal = static_cast<bool> (iter%2);
pcl::search::KdTree<PointT>::Ptr tree(new pcl::search::KdTree<PointT>);
// Ensure that, when force_cache is not set, we are robust to the wrong input
if (force_cache)
Expand Down Expand Up @@ -621,8 +621,8 @@ TEST (PCL, GeneralizedIterativeClosestPoint6D)
// Check again, for all possible caching schemes
for (int iter = 0; iter < 4; iter++)
{
bool force_cache = (bool) iter/2;
bool force_cache_reciprocal = (bool) iter%2;
bool force_cache = static_cast<bool> (iter/2);
bool force_cache_reciprocal = static_cast<bool> (iter%2);
pcl::search::KdTree<PointT>::Ptr tree(new pcl::search::KdTree<PointT>);
// Ensure that, when force_cache is not set, we are robust to the wrong input
if (force_cache)
Expand Down
8 changes: 4 additions & 4 deletions test/registration/test_sac_ia.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ TEST (PCL, SampleConsensusInitialAlignment)
using PointT = pcl::PointXYZ;
for (int iter = 0; iter < 4; iter++)
{
bool force_cache = (bool) iter/2;
bool force_cache_reciprocal = (bool) iter%2;
bool force_cache = static_cast<bool> (iter/2);
bool force_cache_reciprocal = static_cast<bool> (iter%2);
pcl::search::KdTree<PointT>::Ptr tree(new pcl::search::KdTree<PointT>);
// Ensure that, when force_cache is not set, we are robust to the wrong input
if (force_cache)
Expand Down Expand Up @@ -212,8 +212,8 @@ TEST (PCL, SampleConsensusPrerejective)
using PointT = pcl::PointXYZ;
for (int iter = 0; iter < 4; iter++)
{
bool force_cache = (bool) iter/2;
bool force_cache_reciprocal = (bool) iter%2;
bool force_cache = static_cast<bool> (iter/2);
bool force_cache_reciprocal = static_cast<bool> (iter%2);
pcl::search::KdTree<PointT>::Ptr tree(new pcl::search::KdTree<PointT>);
// Ensure that, when force_cache is not set, we are robust to the wrong input
if (force_cache)
Expand Down

0 comments on commit ba2b709

Please sign in to comment.