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

Transition to standard smart pointers, part 11 #3482

Merged
merged 11 commits into from
Nov 24, 2019
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 @@ -206,7 +206,7 @@ pcl::MaximumLikelihoodSampleConsensus<PointT>::computeModel (int debug_verbosity
template <typename PointT> double
pcl::MaximumLikelihoodSampleConsensus<PointT>::computeMedianAbsoluteDeviation (
const PointCloudConstPtr &cloud,
const boost::shared_ptr <std::vector<int> > &indices,
const IndicesPtr &indices,
double sigma) const
{
std::vector<double> distances (indices->size ());
Expand Down Expand Up @@ -239,7 +239,7 @@ pcl::MaximumLikelihoodSampleConsensus<PointT>::computeMedianAbsoluteDeviation (
template <typename PointT> void
pcl::MaximumLikelihoodSampleConsensus<PointT>::getMinMax (
const PointCloudConstPtr &cloud,
const boost::shared_ptr <std::vector<int> > &indices,
const IndicesPtr &indices,
Eigen::Vector4f &min_p,
Eigen::Vector4f &max_p) const
{
Expand All @@ -263,7 +263,7 @@ pcl::MaximumLikelihoodSampleConsensus<PointT>::getMinMax (
template <typename PointT> void
pcl::MaximumLikelihoodSampleConsensus<PointT>::computeMedian (
const PointCloudConstPtr &cloud,
const boost::shared_ptr <std::vector<int> > &indices,
const IndicesPtr &indices,
Eigen::Vector4f &median) const
{
// Copy the values to vectors for faster sorting
Expand Down
7 changes: 4 additions & 3 deletions sample_consensus/include/pcl/sample_consensus/mlesac.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ namespace pcl
using Ptr = boost::shared_ptr<MaximumLikelihoodSampleConsensus<PointT> >;
using ConstPtr = boost::shared_ptr<const MaximumLikelihoodSampleConsensus<PointT> >;

using typename SampleConsensus<PointT>::IndicesPtr;
using SampleConsensus<PointT>::max_iterations_;
using SampleConsensus<PointT>::threshold_;
using SampleConsensus<PointT>::iterations_;
Expand Down Expand Up @@ -123,7 +124,7 @@ namespace pcl
*/
double
computeMedianAbsoluteDeviation (const PointCloudConstPtr &cloud,
const boost::shared_ptr <std::vector<int> > &indices,
const IndicesPtr &indices,
double sigma) const;

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

Expand All @@ -145,7 +146,7 @@ namespace pcl
*/
void
computeMedian (const PointCloudConstPtr &cloud,
const boost::shared_ptr <std::vector<int> > &indices,
const IndicesPtr &indices,
Eigen::Vector4f &median) const;

private:
Expand Down
4 changes: 3 additions & 1 deletion sample_consensus/include/pcl/sample_consensus/sac.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ namespace pcl
using Ptr = boost::shared_ptr<SampleConsensus<T> >;
using ConstPtr = boost::shared_ptr<const SampleConsensus<T> >;

using IndicesPtr = boost::shared_ptr<std::vector<int>>;
SergioRAgostinho marked this conversation as resolved.
Show resolved Hide resolved

/** \brief Constructor for base SAC.
* \param[in] model a Sample Consensus model
* \param[in] random if true set the random seed to the current time, else set to 12345 (default: false)
Expand Down Expand Up @@ -270,7 +272,7 @@ namespace pcl
* \param[out] indices_subset the resultant output set of randomly selected indices
*/
inline void
getRandomSamples (const boost::shared_ptr <std::vector<int> > &indices,
getRandomSamples (const IndicesPtr &indices,
std::size_t nr_samples,
std::set<int> &indices_subset)
{
Expand Down
8 changes: 5 additions & 3 deletions sample_consensus/include/pcl/sample_consensus/sac_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ namespace pcl
using Ptr = boost::shared_ptr<SampleConsensusModel<PointT> >;
using ConstPtr = boost::shared_ptr<const SampleConsensusModel<PointT> >;

using IndicesPtr = boost::shared_ptr<std::vector<int>>;
SergioRAgostinho marked this conversation as resolved.
Show resolved Hide resolved

protected:
/** \brief Empty constructor for base SampleConsensusModel.
* \param[in] random if true set the random seed to the current time, else set to 12345 (default: false)
Expand Down Expand Up @@ -311,7 +313,7 @@ namespace pcl
* \param[in] indices a pointer to the vector of indices that represents the input data.
*/
inline void
setIndices (const boost::shared_ptr <std::vector<int> > &indices)
setIndices (const IndicesPtr &indices)
{
indices_ = indices;
shuffled_indices_ = *indices_;
Expand All @@ -328,7 +330,7 @@ namespace pcl
}

/** \brief Get a pointer to the vector of indices used. */
inline boost::shared_ptr <std::vector<int> >
inline IndicesPtr
getIndices () const { return (indices_); }

/** \brief Return a unique id for each type of model employed. */
Expand Down Expand Up @@ -524,7 +526,7 @@ namespace pcl
PointCloudConstPtr input_;

/** \brief A pointer to the vector of point indices to use. */
boost::shared_ptr <std::vector<int> > indices_;
IndicesPtr indices_;

/** The maximum number of samples to try until we get a good one */
static const unsigned int max_sample_checks_ = 1000;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ namespace pcl
using PointCloudConstPtr = typename SampleConsensusModel<PointT>::PointCloudConstPtr;

using Ptr = boost::shared_ptr<SampleConsensusModelCircle2D<PointT> >;
using ConstPtr = boost::shared_ptr<const SampleConsensusModelCircle2D<PointT>>;

/** \brief Constructor for base SampleConsensusModelCircle2D.
* \param[in] cloud the input point cloud dataset
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ namespace pcl
using PointCloudConstPtr = typename SampleConsensusModel<PointT>::PointCloudConstPtr;

using Ptr = boost::shared_ptr<SampleConsensusModelCone<PointT, PointNT> >;
using ConstPtr = boost::shared_ptr<const SampleConsensusModelCone<PointT, PointNT>>;

/** \brief Constructor for base SampleConsensusModelCone.
* \param[in] cloud the input point cloud dataset
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ namespace pcl
using PointCloudConstPtr = typename SampleConsensusModel<PointT>::PointCloudConstPtr;

using Ptr = boost::shared_ptr<SampleConsensusModelCylinder<PointT, PointNT> >;
using ConstPtr = boost::shared_ptr<const SampleConsensusModelCylinder<PointT, PointNT>>;

/** \brief Constructor for base SampleConsensusModelCylinder.
* \param[in] cloud the input point cloud dataset
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ namespace pcl
using PointCloudConstPtr = typename SampleConsensusModel<PointT>::PointCloudConstPtr;

using Ptr = boost::shared_ptr<SampleConsensusModelLine<PointT> >;
using ConstPtr = boost::shared_ptr<const SampleConsensusModelLine<PointT>>;

/** \brief Constructor for base SampleConsensusModelLine.
* \param[in] cloud the input point cloud dataset
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ namespace pcl
using PointCloudNConstPtr = typename SampleConsensusModelFromNormals<PointT, PointNT>::PointCloudNConstPtr;

using Ptr = boost::shared_ptr<SampleConsensusModelNormalParallelPlane<PointT, PointNT> >;
using ConstPtr = boost::shared_ptr<const SampleConsensusModelNormalParallelPlane<PointT, PointNT>>;

/** \brief Constructor for base SampleConsensusModelNormalParallelPlane.
* \param[in] cloud the input point cloud dataset
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ namespace pcl
using PointCloudNConstPtr = typename SampleConsensusModelFromNormals<PointT, PointNT>::PointCloudNConstPtr;

using Ptr = boost::shared_ptr<SampleConsensusModelNormalPlane<PointT, PointNT> >;
using ConstPtr = boost::shared_ptr<const SampleConsensusModelNormalPlane<PointT, PointNT>>;

/** \brief Constructor for base SampleConsensusModelNormalPlane.
* \param[in] cloud the input point cloud dataset
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ namespace pcl
using PointCloudNConstPtr = typename SampleConsensusModelFromNormals<PointT, PointNT>::PointCloudNConstPtr;

using Ptr = boost::shared_ptr<SampleConsensusModelNormalSphere<PointT, PointNT> >;
using ConstPtr = boost::shared_ptr<const SampleConsensusModelNormalSphere<PointT, PointNT>>;

/** \brief Constructor for base SampleConsensusModelNormalSphere.
* \param[in] cloud the input point cloud dataset
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ namespace pcl
using PointCloudConstPtr = typename SampleConsensusModelLine<PointT>::PointCloudConstPtr;

using Ptr = boost::shared_ptr<SampleConsensusModelParallelLine<PointT> >;
using ConstPtr = boost::shared_ptr<const SampleConsensusModelParallelLine<PointT>>;

/** \brief Constructor for base SampleConsensusModelParallelLine.
* \param[in] cloud the input point cloud dataset
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ namespace pcl
using PointCloudConstPtr = typename SampleConsensusModelPlane<PointT>::PointCloudConstPtr;

using Ptr = boost::shared_ptr<SampleConsensusModelParallelPlane<PointT> >;
using ConstPtr = boost::shared_ptr<const SampleConsensusModelParallelPlane<PointT>>;

/** \brief Constructor for base SampleConsensusModelParallelPlane.
* \param[in] cloud the input point cloud dataset
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ namespace pcl
using PointCloudConstPtr = typename SampleConsensusModelPlane<PointT>::PointCloudConstPtr;

using Ptr = boost::shared_ptr<SampleConsensusModelPerpendicularPlane<PointT> >;
using ConstPtr = boost::shared_ptr<const SampleConsensusModelPerpendicularPlane<PointT>>;

/** \brief Constructor for base SampleConsensusModelPerpendicularPlane.
* \param[in] cloud the input point cloud dataset
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ namespace pcl
using PointCloudConstPtr = typename SampleConsensusModel<PointT>::PointCloudConstPtr;

using Ptr = boost::shared_ptr<SampleConsensusModelPlane<PointT> >;
using ConstPtr = boost::shared_ptr<const SampleConsensusModelPlane<PointT>>;

/** \brief Constructor for base SampleConsensusModelPlane.
* \param[in] cloud the input point cloud dataset
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ namespace pcl
using PointCloudConstPtr = typename SampleConsensusModel<PointT>::PointCloudConstPtr;

using Ptr = boost::shared_ptr<SampleConsensusModelRegistration<PointT> >;
using ConstPtr = boost::shared_ptr<const SampleConsensusModelRegistration<PointT>>;

/** \brief Constructor for base SampleConsensusModelRegistration.
* \param[in] cloud the input point cloud dataset
Expand Down Expand Up @@ -217,6 +218,7 @@ namespace pcl
protected:
using SampleConsensusModel<PointT>::sample_size_;
using SampleConsensusModel<PointT>::model_size_;
using typename SampleConsensusModel<PointT>::IndicesPtr;
SergioRAgostinho marked this conversation as resolved.
Show resolved Hide resolved

/** \brief Check if a sample of indices results in a good sample of points
* indices.
Expand Down Expand Up @@ -314,7 +316,7 @@ namespace pcl
PointCloudConstPtr target_;

/** \brief A pointer to the vector of target point indices to use. */
boost::shared_ptr <std::vector<int> > indices_tgt_;
IndicesPtr indices_tgt_;

/** \brief Given the index in the original point cloud, give the matching original index in the target cloud */
std::map<int, int> correspondences_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ namespace pcl
using PointCloudConstPtr = typename SampleConsensusModel<PointT>::PointCloudConstPtr;

using Ptr = boost::shared_ptr<SampleConsensusModelSphere<PointT> >;
using ConstPtr = boost::shared_ptr<const SampleConsensusModelSphere<PointT>>;

/** \brief Constructor for base SampleConsensusModelSphere.
* \param[in] cloud the input point cloud dataset
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ namespace pcl
using PointCloudConstPtr = typename SampleConsensusModel<PointT>::PointCloudConstPtr;

using Ptr = boost::shared_ptr<SampleConsensusModelStick<PointT> >;
using ConstPtr = boost::shared_ptr<const SampleConsensusModelStick<PointT>>;

/** \brief Constructor for base SampleConsensusModelStick.
* \param[in] cloud the input point cloud dataset
Expand Down