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

Add const qualifier to multiple methods in SAC module #2970

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
6 changes: 3 additions & 3 deletions sample_consensus/include/pcl/sample_consensus/impl/mlesac.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ template <typename PointT> double
pcl::MaximumLikelihoodSampleConsensus<PointT>::computeMedianAbsoluteDeviation (
const PointCloudConstPtr &cloud,
const boost::shared_ptr <std::vector<int> > &indices,
double sigma)
double sigma) const
{
std::vector<double> distances (indices->size ());

Expand Down Expand Up @@ -241,7 +241,7 @@ pcl::MaximumLikelihoodSampleConsensus<PointT>::getMinMax (
const PointCloudConstPtr &cloud,
const boost::shared_ptr <std::vector<int> > &indices,
Eigen::Vector4f &min_p,
Eigen::Vector4f &max_p)
Eigen::Vector4f &max_p) const
{
min_p.setConstant (FLT_MAX);
max_p.setConstant (-FLT_MAX);
Expand All @@ -264,7 +264,7 @@ template <typename PointT> void
pcl::MaximumLikelihoodSampleConsensus<PointT>::computeMedian (
const PointCloudConstPtr &cloud,
const boost::shared_ptr <std::vector<int> > &indices,
Eigen::Vector4f &median)
Eigen::Vector4f &median) const
{
// Copy the values to vectors for faster sorting
std::vector<float> x (indices->size ());
Expand Down
6 changes: 3 additions & 3 deletions sample_consensus/include/pcl/sample_consensus/mlesac.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ namespace pcl
double
computeMedianAbsoluteDeviation (const PointCloudConstPtr &cloud,
const boost::shared_ptr <std::vector<int> > &indices,
double sigma);
double sigma) const;

/** \brief Determine the minimum and maximum 3D bounding box coordinates for a given set of points
* \param[in] cloud the point cloud message
Expand All @@ -136,7 +136,7 @@ namespace pcl
getMinMax (const PointCloudConstPtr &cloud,
const boost::shared_ptr <std::vector<int> > &indices,
Eigen::Vector4f &min_p,
Eigen::Vector4f &max_p);
Eigen::Vector4f &max_p) const;

/** \brief Compute the median value of a 3D point cloud using a given set point indices and return it as a Point32.
* \param[in] cloud the point cloud data message
Expand All @@ -146,7 +146,7 @@ namespace pcl
void
computeMedian (const PointCloudConstPtr &cloud,
const boost::shared_ptr <std::vector<int> > &indices,
Eigen::Vector4f &median);
Eigen::Vector4f &median) const;

private:
/** \brief Maximum number of EM (Expectation Maximization) iterations. */
Expand Down
2 changes: 1 addition & 1 deletion sample_consensus/include/pcl/sample_consensus/rmsac.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ namespace pcl

/** \brief Get the percentage of points to pre-test. */
inline double
getFractionNrPretest () { return (fraction_nr_pretest_); }
getFractionNrPretest () const { return (fraction_nr_pretest_); }

private:
/** \brief Number of samples to randomly pre-test, in percents. */
Expand Down
2 changes: 1 addition & 1 deletion sample_consensus/include/pcl/sample_consensus/rransac.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ namespace pcl

/** \brief Get the percentage of points to pre-test. */
inline double
getFractionNrPretest () { return (fraction_nr_pretest_); }
getFractionNrPretest () const { return (fraction_nr_pretest_); }

private:
/** \brief Number of samples to randomly pre-test, in percents. */
Expand Down
12 changes: 6 additions & 6 deletions sample_consensus/include/pcl/sample_consensus/sac.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ namespace pcl

/** \brief Get the distance to model threshold, as set by the user. */
inline double
getDistanceThreshold () { return (threshold_); }
getDistanceThreshold () const { return (threshold_); }

/** \brief Set the maximum number of iterations.
* \param[in] max_iterations maximum number of iterations
Expand All @@ -150,7 +150,7 @@ namespace pcl

/** \brief Get the maximum number of iterations, as set by the user. */
inline int
getMaxIterations () { return (max_iterations_); }
getMaxIterations () const { return (max_iterations_); }

/** \brief Set the desired probability of choosing at least one sample free from outliers.
* \param[in] probability the desired probability of choosing at least one sample free from outliers
Expand All @@ -161,7 +161,7 @@ namespace pcl

/** \brief Obtain the probability of choosing at least one sample free from outliers, as set by the user. */
inline double
getProbability () { return (probability_); }
getProbability () const { return (probability_); }

/** \brief Compute the actual model. Pure virtual. */
virtual bool
Expand Down Expand Up @@ -290,19 +290,19 @@ namespace pcl
* \param[out] model the resultant model
*/
inline void
getModel (std::vector<int> &model) { model = model_; }
getModel (std::vector<int> &model) const { model = model_; }

/** \brief Return the best set of inliers found so far for this model.
* \param[out] inliers the resultant set of inliers
*/
inline void
getInliers (std::vector<int> &inliers) { inliers = inliers_; }
getInliers (std::vector<int> &inliers) const { inliers = inliers_; }

/** \brief Return the model coefficients of the best model found so far.
* \param[out] model_coefficients the resultant model coefficients, as documented in \ref sample_consensus
*/
inline void
getModelCoefficients (Eigen::VectorXf &model_coefficients) { model_coefficients = model_coefficients_; }
getModelCoefficients (Eigen::VectorXf &model_coefficients) const { model_coefficients = model_coefficients_; }

protected:
/** \brief The underlying data model used (i.e. what is it that we attempt to search for). */
Expand Down
4 changes: 2 additions & 2 deletions sample_consensus/include/pcl/sample_consensus/sac_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ namespace pcl

/** \brief Get the normal angular distance weight. */
inline double
getNormalDistanceWeight () { return (normal_distance_weight_); }
getNormalDistanceWeight () const { return (normal_distance_weight_); }

/** \brief Provide a pointer to the input dataset that contains the point
* normals of the XYZ dataset.
Expand All @@ -630,7 +630,7 @@ namespace pcl

/** \brief Get a pointer to the normals of the input XYZ point cloud dataset. */
inline PointCloudNConstPtr
getInputNormals () { return (normals_); }
getInputNormals () const { return (normals_); }

protected:
/** \brief The relative weight (between 0 and 1) to give to the angular
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ namespace pcl

/** \brief Get the angle epsilon (delta) threshold. */
inline double
getEpsAngle () { return (eps_angle_); }
getEpsAngle () const { return (eps_angle_); }

/** \brief Set the axis along which we need to search for a cylinder direction.
* \param[in] ax the axis along which we need to search for a cylinder direction
Expand All @@ -159,7 +159,7 @@ namespace pcl

/** \brief Get the axis along which we need to search for a cylinder direction. */
inline Eigen::Vector3f
getAxis () { return (axis_); }
getAxis () const { return (axis_); }

/** \brief Check whether the given index samples can form a valid cylinder model, compute the model coefficients
* from these samples and store them in model_coefficients. The cylinder coefficients are: point_on_axis,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ namespace pcl

/** \brief Get the axis along which we need to search for a plane perpendicular to. */
inline Eigen::Vector3f
getAxis () { return (axis_.head<3> ()); }
getAxis () const { return (axis_.head<3> ()); }

/** \brief Set the angle epsilon (delta) threshold.
* \param[in] ea the maximum allowed deviation from 90 degrees between the plane normal and the given axis.
Expand All @@ -159,7 +159,7 @@ namespace pcl

/** \brief Get the angle epsilon (delta) threshold. */
inline double
getEpsAngle () { return (eps_angle_); }
getEpsAngle () const { return (eps_angle_); }

/** \brief Set the distance we expect the plane to be from the origin
* \param[in] d distance from the template plane to the origin
Expand All @@ -169,7 +169,7 @@ namespace pcl

/** \brief Get the distance of the plane from the origin. */
inline double
getDistanceFromOrigin () { return (distance_from_origin_); }
getDistanceFromOrigin () const { return (distance_from_origin_); }

/** \brief Set the distance epsilon (delta) threshold.
* \param[in] delta the maximum allowed deviation from the template distance from the origin
Expand All @@ -179,7 +179,7 @@ namespace pcl

/** \brief Get the distance epsilon (delta) threshold. */
inline double
getEpsDist () { return (eps_dist_); }
getEpsDist () const { return (eps_dist_); }

/** \brief Return an unique id for this model (SACMODEL_NORMAL_PARALLEL_PLANE). */
inline pcl::SacModel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ namespace pcl

/** \brief Get the axis along which we need to search for a plane perpendicular to. */
inline Eigen::Vector3f
getAxis () { return (axis_); }
getAxis () const { return (axis_); }

/** \brief Set the angle epsilon (delta) threshold.
* \param[in] ea the maximum allowed difference between the plane normal and the given axis.
Expand All @@ -129,7 +129,7 @@ namespace pcl

/** \brief Get the angle epsilon (delta) threshold. */
inline double
getEpsAngle () { return (eps_angle_); }
getEpsAngle () const { return (eps_angle_); }

/** \brief Select all the points which respect the given model coefficients as inliers.
* \param[in] model_coefficients the coefficients of a plane model that we need to compute distances to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ namespace pcl

/** \brief Get the axis along which we need to search for a plane perpendicular to. */
inline Eigen::Vector3f
getAxis () { return (axis_); }
getAxis () const { return (axis_); }

/** \brief Set the angle epsilon (delta) threshold.
* \param[in] ea the maximum allowed difference between the plane normal and the given axis.
Expand All @@ -132,7 +132,7 @@ namespace pcl

/** \brief Get the angle epsilon (delta) threshold. */
inline double
getEpsAngle () { return (eps_angle_); }
getEpsAngle () const { return (eps_angle_); }

/** \brief Select all the points which respect the given model coefficients as inliers.
* \param[in] model_coefficients the coefficients of a plane model that we need to compute distances to
Expand Down