Skip to content

Commit

Permalink
Merge pull request #3282 from SunBlack/use_std-ceil
Browse files Browse the repository at this point in the history
Prefer C++ method std::ceil over C method ceil
  • Loading branch information
SergioRAgostinho authored Aug 12, 2019
2 parents cc4b40d + d3f85fc commit 4dfde20
Show file tree
Hide file tree
Showing 27 changed files with 66 additions and 66 deletions.
4 changes: 2 additions & 2 deletions common/include/pcl/pcl_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,12 @@ namespace pcl
__inline double
pcl_round (double number)
{
return (number < 0.0 ? ceil (number - 0.5) : floor (number + 0.5));
return (number < 0.0 ? std::ceil (number - 0.5) : floor (number + 0.5));
}
__inline float
pcl_round (float number)
{
return (number < 0.0f ? ceilf (number - 0.5f) : floorf (number + 0.5f));
return (number < 0.0f ? std::ceil (number - 0.5f) : floorf (number + 0.5f));
}

#ifdef __GNUC__
Expand Down
4 changes: 2 additions & 2 deletions common/src/range_image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -543,10 +543,10 @@ RangeImage::getInterpolatedSurfaceProjection (const Eigen::Affine3f& pose, int p
cell3_y = world2cell_factor*point3[1] + world2cell_offset,
cell3_z = point3[2];

int min_cell_x = (std::max) (0, int (pcl_lrint (ceil ( (std::min) (cell1_x, (std::min) (cell2_x, cell3_x)))))),
int min_cell_x = (std::max) (0, int (pcl_lrint (std::ceil ( (std::min) (cell1_x, (std::min) (cell2_x, cell3_x)))))),
max_cell_x = (std::min) (pixel_size-1, int (pcl_lrint (floor ( (std::max) (cell1_x,
(std::max) (cell2_x, cell3_x)))))),
min_cell_y = (std::max) (0, int (pcl_lrint (ceil ( (std::min) (cell1_y, (std::min) (cell2_y, cell3_y)))))),
min_cell_y = (std::max) (0, int (pcl_lrint (std::ceil ( (std::min) (cell1_y, (std::min) (cell2_y, cell3_y)))))),
max_cell_y = (std::min) (pixel_size-1, int (pcl_lrint (floor ( (std::max) (cell1_y,
(std::max) (cell2_y, cell3_y))))));
if (max_cell_x<min_cell_x || max_cell_y<min_cell_y)
Expand Down
4 changes: 2 additions & 2 deletions cuda/common/include/pcl/cuda/common/eigen.h
Original file line number Diff line number Diff line change
Expand Up @@ -572,9 +572,9 @@ namespace pcl
bounds.w += height_ / 2.0f;

res.x = (int)floor (bounds.x);
res.y = (int)ceil (bounds.y);
res.y = (int)std::ceil (bounds.y);
res.z = (int)floor (bounds.z);
res.w = (int)ceil (bounds.w);
res.w = (int)std::ceil (bounds.w);

// clamp the coordinates to fit to depth image size
res.x = clamp (res.x, 0, width_-1);
Expand Down
4 changes: 2 additions & 2 deletions cuda/nn/organized_neighbor_search.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,10 @@ namespace pcl

// determine 2-D search window
minX_arg = (int)floor((double)input_->width / 2 + (x1 / focalLength_));
maxX_arg = (int)ceil((double)input_->width / 2 + (x2 / focalLength_));
maxX_arg = (int)std::ceil((double)input_->width / 2 + (x2 / focalLength_));

minY_arg = (int)floor((double)input_->height / 2 + (y1 / focalLength_));
maxY_arg = (int)ceil((double)input_->height / 2 + (y2 / focalLength_));
maxY_arg = (int)std::ceil((double)input_->height / 2 + (y2 / focalLength_));

// make sure the coordinates fit to point cloud resolution
minX_arg = std::max<int> (0, minX_arg);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ main (int argc, char** argv)
// Load the results
pcl::visualization::PCLVisualizer p (argc, argv, "VFH Cluster Classifier");
int y_s = (int)floor (sqrt ((double)k));
int x_s = y_s + (int)ceil ((k / (double)y_s) - y_s);
int x_s = y_s + (int)std::ceil ((k / (double)y_s) - y_s);
double x_step = (double)(1 / (double)x_s);
double y_step = (double)(1 / (double)y_s);
pcl::console::print_highlight ("Preparing to load ");
Expand Down
4 changes: 2 additions & 2 deletions features/include/pcl/features/impl/brisk_2d.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ pcl::BRISK2DEstimation<PointInT, PointOutT, KeypointT, IntensityT>::generateKern
pattern_iterator->sigma = static_cast<float> (sigma_scale * scale_list_[scale] * (double (radius_list[ring])) * sin (M_PI / double (number_list[ring])));

// adapt the sizeList if necessary
const unsigned int size = static_cast<const unsigned int> (ceil (((scale_list_[scale] * radius_list[ring]) + pattern_iterator->sigma)) + 1);
const unsigned int size = static_cast<const unsigned int> (std::ceil (((scale_list_[scale] * radius_list[ring]) + pattern_iterator->sigma)) + 1);

if (size_list_[scale] < size)
size_list_[scale] = size;
Expand Down Expand Up @@ -211,7 +211,7 @@ pcl::BRISK2DEstimation<PointInT, PointOutT, KeypointT, IntensityT>::generateKern
}

// no bits:
strings_ = int (ceil ((float (no_short_pairs_)) / 128.0)) * 4 * 4;
strings_ = int (std::ceil ((float (no_short_pairs_)) / 128.0)) * 4 * 4;
}

///////////////////////////////////////////////////////////////////////////////////////////
Expand Down
36 changes: 18 additions & 18 deletions features/include/pcl/features/impl/esf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,12 @@ pcl::ESFEstimation<PointInT, PointOutT>::computeESF (
int p_cnt = 0;
// IN, OUT, MIXED, Ratio line tracing, index1->index2
{
const int xs = p1[0] < 0.0? static_cast<int>(floor(p1[0])+GRIDSIZE_H): static_cast<int>(ceil(p1[0])+GRIDSIZE_H-1);
const int ys = p1[1] < 0.0? static_cast<int>(floor(p1[1])+GRIDSIZE_H): static_cast<int>(ceil(p1[1])+GRIDSIZE_H-1);
const int zs = p1[2] < 0.0? static_cast<int>(floor(p1[2])+GRIDSIZE_H): static_cast<int>(ceil(p1[2])+GRIDSIZE_H-1);
const int xt = p2[0] < 0.0? static_cast<int>(floor(p2[0])+GRIDSIZE_H): static_cast<int>(ceil(p2[0])+GRIDSIZE_H-1);
const int yt = p2[1] < 0.0? static_cast<int>(floor(p2[1])+GRIDSIZE_H): static_cast<int>(ceil(p2[1])+GRIDSIZE_H-1);
const int zt = p2[2] < 0.0? static_cast<int>(floor(p2[2])+GRIDSIZE_H): static_cast<int>(ceil(p2[2])+GRIDSIZE_H-1);
const int xs = p1[0] < 0.0? static_cast<int>(floor(p1[0])+GRIDSIZE_H): static_cast<int>(std::ceil(p1[0])+GRIDSIZE_H-1);
const int ys = p1[1] < 0.0? static_cast<int>(floor(p1[1])+GRIDSIZE_H): static_cast<int>(std::ceil(p1[1])+GRIDSIZE_H-1);
const int zs = p1[2] < 0.0? static_cast<int>(floor(p1[2])+GRIDSIZE_H): static_cast<int>(std::ceil(p1[2])+GRIDSIZE_H-1);
const int xt = p2[0] < 0.0? static_cast<int>(floor(p2[0])+GRIDSIZE_H): static_cast<int>(std::ceil(p2[0])+GRIDSIZE_H-1);
const int yt = p2[1] < 0.0? static_cast<int>(floor(p2[1])+GRIDSIZE_H): static_cast<int>(std::ceil(p2[1])+GRIDSIZE_H-1);
const int zt = p2[2] < 0.0? static_cast<int>(floor(p2[2])+GRIDSIZE_H): static_cast<int>(std::ceil(p2[2])+GRIDSIZE_H-1);
wt_d2.push_back (this->lci (xs, ys, zs, xt, yt, zt, ratio, vxlcnt, pcnt1));
if (wt_d2.back () == 2)
h_mix_ratio[static_cast<int> (pcl_round (ratio * (binsize-1)))]++;
Expand All @@ -160,12 +160,12 @@ pcl::ESFEstimation<PointInT, PointOutT>::computeESF (
}
// IN, OUT, MIXED, Ratio line tracing, index1->index3
{
const int xs = p1[0] < 0.0? static_cast<int>(floor(p1[0])+GRIDSIZE_H): static_cast<int>(ceil(p1[0])+GRIDSIZE_H-1);
const int ys = p1[1] < 0.0? static_cast<int>(floor(p1[1])+GRIDSIZE_H): static_cast<int>(ceil(p1[1])+GRIDSIZE_H-1);
const int zs = p1[2] < 0.0? static_cast<int>(floor(p1[2])+GRIDSIZE_H): static_cast<int>(ceil(p1[2])+GRIDSIZE_H-1);
const int xt = p3[0] < 0.0? static_cast<int>(floor(p3[0])+GRIDSIZE_H): static_cast<int>(ceil(p3[0])+GRIDSIZE_H-1);
const int yt = p3[1] < 0.0? static_cast<int>(floor(p3[1])+GRIDSIZE_H): static_cast<int>(ceil(p3[1])+GRIDSIZE_H-1);
const int zt = p3[2] < 0.0? static_cast<int>(floor(p3[2])+GRIDSIZE_H): static_cast<int>(ceil(p3[2])+GRIDSIZE_H-1);
const int xs = p1[0] < 0.0? static_cast<int>(floor(p1[0])+GRIDSIZE_H): static_cast<int>(std::ceil(p1[0])+GRIDSIZE_H-1);
const int ys = p1[1] < 0.0? static_cast<int>(floor(p1[1])+GRIDSIZE_H): static_cast<int>(std::ceil(p1[1])+GRIDSIZE_H-1);
const int zs = p1[2] < 0.0? static_cast<int>(floor(p1[2])+GRIDSIZE_H): static_cast<int>(std::ceil(p1[2])+GRIDSIZE_H-1);
const int xt = p3[0] < 0.0? static_cast<int>(floor(p3[0])+GRIDSIZE_H): static_cast<int>(std::ceil(p3[0])+GRIDSIZE_H-1);
const int yt = p3[1] < 0.0? static_cast<int>(floor(p3[1])+GRIDSIZE_H): static_cast<int>(std::ceil(p3[1])+GRIDSIZE_H-1);
const int zt = p3[2] < 0.0? static_cast<int>(floor(p3[2])+GRIDSIZE_H): static_cast<int>(std::ceil(p3[2])+GRIDSIZE_H-1);
wt_d2.push_back (this->lci (xs, ys, zs, xt, yt, zt, ratio, vxlcnt, pcnt2));
if (wt_d2.back () == 2)
h_mix_ratio[static_cast<int>(pcl_round (ratio * (binsize-1)))]++;
Expand All @@ -174,12 +174,12 @@ pcl::ESFEstimation<PointInT, PointOutT>::computeESF (
}
// IN, OUT, MIXED, Ratio line tracing, index2->index3
{
const int xs = p2[0] < 0.0? static_cast<int>(floor(p2[0])+GRIDSIZE_H): static_cast<int>(ceil(p2[0])+GRIDSIZE_H-1);
const int ys = p2[1] < 0.0? static_cast<int>(floor(p2[1])+GRIDSIZE_H): static_cast<int>(ceil(p2[1])+GRIDSIZE_H-1);
const int zs = p2[2] < 0.0? static_cast<int>(floor(p2[2])+GRIDSIZE_H): static_cast<int>(ceil(p2[2])+GRIDSIZE_H-1);
const int xt = p3[0] < 0.0? static_cast<int>(floor(p3[0])+GRIDSIZE_H): static_cast<int>(ceil(p3[0])+GRIDSIZE_H-1);
const int yt = p3[1] < 0.0? static_cast<int>(floor(p3[1])+GRIDSIZE_H): static_cast<int>(ceil(p3[1])+GRIDSIZE_H-1);
const int zt = p3[2] < 0.0? static_cast<int>(floor(p3[2])+GRIDSIZE_H): static_cast<int>(ceil(p3[2])+GRIDSIZE_H-1);
const int xs = p2[0] < 0.0? static_cast<int>(floor(p2[0])+GRIDSIZE_H): static_cast<int>(std::ceil(p2[0])+GRIDSIZE_H-1);
const int ys = p2[1] < 0.0? static_cast<int>(floor(p2[1])+GRIDSIZE_H): static_cast<int>(std::ceil(p2[1])+GRIDSIZE_H-1);
const int zs = p2[2] < 0.0? static_cast<int>(floor(p2[2])+GRIDSIZE_H): static_cast<int>(std::ceil(p2[2])+GRIDSIZE_H-1);
const int xt = p3[0] < 0.0? static_cast<int>(floor(p3[0])+GRIDSIZE_H): static_cast<int>(std::ceil(p3[0])+GRIDSIZE_H-1);
const int yt = p3[1] < 0.0? static_cast<int>(floor(p3[1])+GRIDSIZE_H): static_cast<int>(std::ceil(p3[1])+GRIDSIZE_H-1);
const int zt = p3[2] < 0.0? static_cast<int>(floor(p3[2])+GRIDSIZE_H): static_cast<int>(std::ceil(p3[2])+GRIDSIZE_H-1);
wt_d2.push_back (this->lci (xs,ys,zs,xt,yt,zt,ratio,vxlcnt,pcnt3));
if (wt_d2.back () == 2)
h_mix_ratio[static_cast<int>(pcl_round(ratio * (binsize-1)))]++;
Expand Down
4 changes: 2 additions & 2 deletions gpu/kinfu_large_scale/src/kinfu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,8 @@ pcl::gpu::kinfuLS::KinfuTracker::allocateBufffers (int rows, int cols)
}
depthRawScaled_.create (rows, cols);
// see estimate transform for the magic numbers
int r = (int)ceil ( ((float)rows) / ESTIMATE_COMBINED_CUDA_GRID_Y );
int c = (int)ceil ( ((float)cols) / ESTIMATE_COMBINED_CUDA_GRID_X );
int r = (int)std::ceil ( ((float)rows) / ESTIMATE_COMBINED_CUDA_GRID_Y );
int c = (int)std::ceil ( ((float)cols) / ESTIMATE_COMBINED_CUDA_GRID_X );
gbuf_.create (27, r * c);
sumbuf_.create (27);
}
Expand Down
8 changes: 4 additions & 4 deletions gpu/people/src/cuda/nvidia/NPP_staging.cu
Original file line number Diff line number Diff line change
Expand Up @@ -2366,12 +2366,12 @@ __global__ void resizeSuperSample_32f(NcvSize32u srcSize,
float yEnd = fmin (y + scaleY, rh - 1.0f);
// x range of source samples
float floorXBegin = floorf (xBegin);
float ceilXEnd = ceilf (xEnd);
float ceilXEnd = std::ceil (xEnd);
int iXBegin = srcROI.x + (int) floorXBegin;
int iXEnd = srcROI.x + (int) ceilXEnd;
// y range of source samples
float floorYBegin = floorf (yBegin);
float ceilYEnd = ceilf (yEnd);
float ceilYEnd = std::ceil (yEnd);
int iYBegin = srcROI.y + (int) floorYBegin;
int iYEnd = srcROI.y + (int) ceilYEnd;

Expand Down Expand Up @@ -2451,10 +2451,10 @@ __global__ void resizeBicubic(NcvSize32u srcSize,

// sampling range
// border mode is clamp
float xmin = fmax (ceilf (x - 2.0f), 0.0f);
float xmin = fmax (std::ceil (x - 2.0f), 0.0f);
float xmax = fmin (floorf (x + 2.0f), rw - 1.0f);

float ymin = fmax (ceilf (y - 2.0f), 0.0f);
float ymin = fmax (std::ceil (y - 2.0f), 0.0f);
float ymax = fmin (floorf (y + 2.0f), rh - 1.0f);

// shift data window to match ROI
Expand Down
4 changes: 2 additions & 2 deletions gpu/people/src/cuda/shs.cu
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ namespace pcl
float y2 = (b + sqrt (det)) / a;

min = std::min (static_cast<int> (floor (y1)), static_cast<int> (floor (y2)));
max = std::max (static_cast<int> (ceil (y1)), static_cast<int> (ceil (y2)));
max = std::max (static_cast<int> (std::ceil (y1)), static_cast<int> (std::ceil (y2)));
minY = std::min (rows - 1, std::max (0, min));
maxY = std::max (std::min (rows - 1, max), 0);
}
Expand All @@ -112,7 +112,7 @@ namespace pcl
float x2 = (b + sqrt (det)) / a;

min = std::min (static_cast<int> (floor (x1)), static_cast<int> (floor (x2)));
max = std::max (static_cast<int> (ceil (x1)), static_cast<int> (ceil (x2)));
max = std::max (static_cast<int> (std::ceil (x1)), static_cast<int> (std::ceil (x2)));
minX = std::min (cols- 1, std::max (0, min));
maxX = std::max (std::min (cols - 1, max), 0);
}
Expand Down
4 changes: 2 additions & 2 deletions gpu/people/src/people_detector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ namespace
float y2 = (b + sqrt (det)) / a;

min = (int)std::min(floor(y1), floor(y2));
max = (int)std::max( ceil(y1), ceil(y2));
max = (int)std::max( std::ceil(y1), std::ceil(y2));
minY = std::min (rows - 1, std::max (0, min));
maxY = std::max (std::min (rows - 1, max), 0);
}
Expand All @@ -457,7 +457,7 @@ namespace
float x2 = (b + sqrt (det)) / a;

min = (int)std::min (floor(x1), floor(x2));
max = (int)std::max ( ceil(x1), ceil(x2));
max = (int)std::max ( std::ceil(x1), std::ceil(x2));
minX = std::min (cols- 1, std::max (0, min));
maxX = std::max (std::min (cols - 1, max), 0);
}
Expand Down
2 changes: 1 addition & 1 deletion io/include/pcl/compression/impl/entropy_range_coder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ pcl::StaticRangeCoder::encodeIntVectorToStream (std::vector<unsigned int>& input
}

// calculate amount of bytes per frequency table entry
uint8_t frequencyTableByteSize = static_cast<uint8_t> (ceil (
uint8_t frequencyTableByteSize = static_cast<uint8_t> (std::ceil (
std::log2 (static_cast<double> (cFreqTable_[static_cast<std::size_t> (frequencyTableSize - 1)])) / 8.0));

// write size of frequency table to output stream
Expand Down
6 changes: 3 additions & 3 deletions octree/include/pcl/octree/impl/octree_pointcloud.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -626,9 +626,9 @@ pcl::octree::OctreePointCloud<PointT, LeafContainerT, BranchContainerT, OctreeT>
const float minValue = std::numeric_limits<float>::epsilon();

// find maximum key values for x, y, z
max_key_x = static_cast<unsigned int> (ceil ((max_x_ - min_x_ - minValue) / resolution_));
max_key_y = static_cast<unsigned int> (ceil ((max_y_ - min_y_ - minValue) / resolution_));
max_key_z = static_cast<unsigned int> (ceil ((max_z_ - min_z_ - minValue) / resolution_));
max_key_x = static_cast<unsigned int> (std::ceil ((max_x_ - min_x_ - minValue) / resolution_));
max_key_y = static_cast<unsigned int> (std::ceil ((max_y_ - min_y_ - minValue) / resolution_));
max_key_z = static_cast<unsigned int> (std::ceil ((max_z_ - min_z_ - minValue) / resolution_));

// find maximum amount of keys
max_voxels = std::max (std::max (std::max (max_key_x, max_key_y), max_key_z), static_cast<unsigned int> (2));
Expand Down
4 changes: 2 additions & 2 deletions people/include/pcl/people/impl/person_classifier.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ pcl::people::PersonClassifier<PointT>::resize (PointCloudPtr& input_image,
for (int j = 0; j < width; j++) // for every column
{
A = T_inv * Eigen::Vector3f(i, j, 1);
c1 = ceil(A(0));
c1 = std::ceil(A(0));
f1 = floor(A(0));
c2 = ceil(A(1));
c2 = std::ceil(A(1));
f2 = floor(A(1));

if ( (f1 < 0) ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ pcl::recognition::SimpleOctree<NodeData, NodeDataCreator, Scalar>::build (const

// Compute the number of tree levels
if ( arg > 1 )
tree_levels_ = static_cast<int> (ceil (std::log (arg)/std::log (2.0)) + 0.5);
tree_levels_ = static_cast<int> (std::ceil (std::log (arg)/std::log (2.0)) + 0.5);
else
tree_levels_ = 0;

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 @@ -54,7 +54,7 @@ pcl::recognition::HoughSpace3D::HoughSpace3D (const Eigen::Vector3d &min_coord,

for (int i = 0; i < 3; ++i)
{
bin_count_[i] = static_cast<int> (ceil ((max_coord[i] - min_coord_[i]) / bin_size_[i]));
bin_count_[i] = static_cast<int> (std::ceil ((max_coord[i] - min_coord_[i]) / bin_size_[i]));
}

partial_bin_products_[0] = 1;
Expand Down
2 changes: 1 addition & 1 deletion recognition/src/ransac_based/orr_octree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ pcl::recognition::ORROctree::build (const float* bounds, float voxel_size)

// Compute the number of tree levels
if ( arg > 1.0f )
tree_levels_ = static_cast<int> (ceil (std::log (arg)/std::log (2.0)) + 0.5);
tree_levels_ = static_cast<int> (std::ceil (std::log (arg)/std::log (2.0)) + 0.5);
else
tree_levels_ = 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ pcl::PyramidFeatureHistogram<PointFeature>::initializeHistogram ()
D += aux * aux;
}
D = std::sqrt (D);
nr_levels = static_cast<size_t> (ceilf (std::log2(D)));
nr_levels = static_cast<size_t> (std::ceil (std::log2(D)));
PCL_DEBUG ("[pcl::PyramidFeatureHistogram::initializeHistogram] Pyramid will have %u levels with a hyper-parallelepiped diagonal size of %f\n", nr_levels, D);


Expand All @@ -187,7 +187,7 @@ pcl::PyramidFeatureHistogram<PointFeature>::initializeHistogram ()
for (size_t dim_i = 0; dim_i < nr_dimensions; ++dim_i)
{
bins_per_dimension[dim_i] =
static_cast<size_t> (ceilf ((dimension_range_target_[dim_i].second - dimension_range_target_[dim_i].first) / (powf (2.0f, static_cast<float> (level_i)) * std::sqrt (static_cast<float> (nr_dimensions)))));
static_cast<size_t> (std::ceil ((dimension_range_target_[dim_i].second - dimension_range_target_[dim_i].first) / (powf (2.0f, static_cast<float> (level_i)) * std::sqrt (static_cast<float> (nr_dimensions)))));
bin_step[dim_i] = powf (2.0f, static_cast<float> (level_i)) * std::sqrt (static_cast<float> (nr_dimensions));
}
hist_levels[level_i] = PyramidFeatureHistogramLevel (bins_per_dimension, bin_step);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ pcl::MaximumLikelihoodSampleConsensus<PointT>::computeModel (int debug_verbosity

++iterations_;
if (debug_verbosity_level > 1)
PCL_DEBUG ("[pcl::MaximumLikelihoodSampleConsensus::computeModel] Trial %d out of %d. Best penalty is %f.\n", iterations_, static_cast<int> (ceil (k)), d_best_penalty);
PCL_DEBUG ("[pcl::MaximumLikelihoodSampleConsensus::computeModel] Trial %d out of %d. Best penalty is %f.\n", iterations_, static_cast<int> (std::ceil (k)), d_best_penalty);
if (iterations_ > max_iterations_)
{
if (debug_verbosity_level > 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ pcl::MEstimatorSampleConsensus<PointT>::computeModel (int debug_verbosity_level)

++iterations_;
if (debug_verbosity_level > 1)
PCL_DEBUG ("[pcl::MEstimatorSampleConsensus::computeModel] Trial %d out of %d. Best penalty is %f.\n", iterations_, static_cast<int> (ceil (k)), d_best_penalty);
PCL_DEBUG ("[pcl::MEstimatorSampleConsensus::computeModel] Trial %d out of %d. Best penalty is %f.\n", iterations_, static_cast<int> (std::ceil (k)), d_best_penalty);
if (iterations_ > max_iterations_)
{
if (debug_verbosity_level > 0)
Expand Down
6 changes: 3 additions & 3 deletions sample_consensus/include/pcl/sample_consensus/impl/prosac.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ pcl::ProgressiveSampleConsensus<PointT>::computeModel (int debug_verbosity_level
// Update other variables
float T_n_minus_1 = T_n;
T_n *= (static_cast<float>(n) + 1.0f) / (static_cast<float>(n) + 1.0f - static_cast<float>(m));
T_prime_n += ceilf (T_n - T_n_minus_1);
T_prime_n += std::ceil (T_n - T_n_minus_1);
}

// Step 2
Expand Down Expand Up @@ -181,7 +181,7 @@ pcl::ProgressiveSampleConsensus<PointT>::computeModel (int debug_verbosity_level
{
// Typo in Equation 7, not (n-m choose i-m) but (n choose i-m)
size_t I_possible_n_star_min = m
+ static_cast<size_t> (ceil (boost::math::quantile (boost::math::complement (boost::math::binomial_distribution<float>(static_cast<float> (possible_n_star), 0.1f), 0.05))));
+ static_cast<size_t> (std::ceil (boost::math::quantile (boost::math::complement (boost::math::binomial_distribution<float>(static_cast<float> (possible_n_star), 0.1f), 0.05))));
// If Equation 9 is not verified, exit
if (I_possible_n_star < I_possible_n_star_min)
break;
Expand All @@ -205,7 +205,7 @@ pcl::ProgressiveSampleConsensus<PointT>::computeModel (int debug_verbosity_level
else if (bottom_log == 1)
k_n_star = T_N;
else
k_n_star = static_cast<int> (ceil (std::log (0.05) / std::log (bottom_log)));
k_n_star = static_cast<int> (std::ceil (std::log (0.05) / std::log (bottom_log)));
// It seems weird to have very few iterations, so do have a few (totally empirical)
k_n_star = (std::max)(k_n_star, 2 * m);
}
Expand Down
Loading

0 comments on commit 4dfde20

Please sign in to comment.