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

[common] Replace usage of std::vector<int> with Indices #3989

Merged
merged 1 commit into from
May 20, 2020
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
4 changes: 2 additions & 2 deletions common/include/pcl/cloud_iterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ namespace pcl
public:
CloudIterator (PointCloud<PointT>& cloud);

CloudIterator (PointCloud<PointT>& cloud, const std::vector<int>& indices);
CloudIterator (PointCloud<PointT>& cloud, const Indices& indices);

CloudIterator (PointCloud<PointT>& cloud, const PointIndices& indices);

Expand Down Expand Up @@ -122,7 +122,7 @@ namespace pcl
public:
ConstCloudIterator (const PointCloud<PointT>& cloud);

ConstCloudIterator (const PointCloud<PointT>& cloud, const std::vector<int>& indices);
ConstCloudIterator (const PointCloud<PointT>& cloud, const Indices& indices);

ConstCloudIterator (const PointCloud<PointT>& cloud, const PointIndices& indices);

Expand Down
62 changes: 31 additions & 31 deletions common/include/pcl/common/centroid.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,20 +118,20 @@ namespace pcl
*/
template <typename PointT, typename Scalar> inline unsigned int
compute3DCentroid (const pcl::PointCloud<PointT> &cloud,
const std::vector<int> &indices,
const Indices &indices,
Eigen::Matrix<Scalar, 4, 1> &centroid);

template <typename PointT> inline unsigned int
compute3DCentroid (const pcl::PointCloud<PointT> &cloud,
const std::vector<int> &indices,
const Indices &indices,
Eigen::Vector4f &centroid)
{
return (compute3DCentroid <PointT, float> (cloud, indices, centroid));
}

template <typename PointT> inline unsigned int
compute3DCentroid (const pcl::PointCloud<PointT> &cloud,
const std::vector<int> &indices,
const Indices &indices,
Eigen::Vector4d &centroid)
{
return (compute3DCentroid <PointT, double> (cloud, indices, centroid));
Expand All @@ -149,20 +149,20 @@ namespace pcl
*/
template <typename PointT, typename Scalar> inline unsigned int
compute3DCentroid (const pcl::PointCloud<PointT> &cloud,
const pcl::PointIndices &indices,
const pcl::PointIndices &indices,
Eigen::Matrix<Scalar, 4, 1> &centroid);

template <typename PointT> inline unsigned int
compute3DCentroid (const pcl::PointCloud<PointT> &cloud,
const pcl::PointIndices &indices,
const pcl::PointIndices &indices,
Eigen::Vector4f &centroid)
{
return (compute3DCentroid <PointT, float> (cloud, indices, centroid));
}

template <typename PointT> inline unsigned int
compute3DCentroid (const pcl::PointCloud<PointT> &cloud,
const pcl::PointIndices &indices,
const pcl::PointIndices &indices,
Eigen::Vector4d &centroid)
{
return (compute3DCentroid <PointT, double> (cloud, indices, centroid));
Expand Down Expand Up @@ -251,13 +251,13 @@ namespace pcl
*/
template <typename PointT, typename Scalar> inline unsigned int
computeCovarianceMatrix (const pcl::PointCloud<PointT> &cloud,
const std::vector<int> &indices,
const Indices &indices,
const Eigen::Matrix<Scalar, 4, 1> &centroid,
Eigen::Matrix<Scalar, 3, 3> &covariance_matrix);

template <typename PointT> inline unsigned int
computeCovarianceMatrix (const pcl::PointCloud<PointT> &cloud,
const std::vector<int> &indices,
const Indices &indices,
const Eigen::Vector4f &centroid,
Eigen::Matrix3f &covariance_matrix)
{
Expand All @@ -266,7 +266,7 @@ namespace pcl

template <typename PointT> inline unsigned int
computeCovarianceMatrix (const pcl::PointCloud<PointT> &cloud,
const std::vector<int> &indices,
const Indices &indices,
const Eigen::Vector4d &centroid,
Eigen::Matrix3d &covariance_matrix)
{
Expand Down Expand Up @@ -327,13 +327,13 @@ namespace pcl
*/
template <typename PointT, typename Scalar> inline unsigned int
computeCovarianceMatrixNormalized (const pcl::PointCloud<PointT> &cloud,
const std::vector<int> &indices,
const Indices &indices,
const Eigen::Matrix<Scalar, 4, 1> &centroid,
Eigen::Matrix<Scalar, 3, 3> &covariance_matrix);

template <typename PointT> inline unsigned int
computeCovarianceMatrixNormalized (const pcl::PointCloud<PointT> &cloud,
const std::vector<int> &indices,
const Indices &indices,
const Eigen::Vector4f &centroid,
Eigen::Matrix3f &covariance_matrix)
{
Expand All @@ -342,7 +342,7 @@ namespace pcl

template <typename PointT> inline unsigned int
computeCovarianceMatrixNormalized (const pcl::PointCloud<PointT> &cloud,
const std::vector<int> &indices,
const Indices &indices,
const Eigen::Vector4d &centroid,
Eigen::Matrix3d &covariance_matrix)
{
Expand Down Expand Up @@ -435,13 +435,13 @@ namespace pcl
*/
template <typename PointT, typename Scalar> inline unsigned int
computeMeanAndCovarianceMatrix (const pcl::PointCloud<PointT> &cloud,
const std::vector<int> &indices,
const Indices &indices,
Eigen::Matrix<Scalar, 3, 3> &covariance_matrix,
Eigen::Matrix<Scalar, 4, 1> &centroid);

template <typename PointT> inline unsigned int
computeMeanAndCovarianceMatrix (const pcl::PointCloud<PointT> &cloud,
const std::vector<int> &indices,
const Indices &indices,
Eigen::Matrix3f &covariance_matrix,
Eigen::Vector4f &centroid)
{
Expand All @@ -450,7 +450,7 @@ namespace pcl

template <typename PointT> inline unsigned int
computeMeanAndCovarianceMatrix (const pcl::PointCloud<PointT> &cloud,
const std::vector<int> &indices,
const Indices &indices,
Eigen::Matrix3d &covariance_matrix,
Eigen::Vector4d &centroid)
{
Expand Down Expand Up @@ -537,20 +537,20 @@ namespace pcl
*/
template <typename PointT, typename Scalar> inline unsigned int
computeCovarianceMatrix (const pcl::PointCloud<PointT> &cloud,
const std::vector<int> &indices,
const Indices &indices,
Eigen::Matrix<Scalar, 3, 3> &covariance_matrix);

template <typename PointT> inline unsigned int
computeCovarianceMatrix (const pcl::PointCloud<PointT> &cloud,
const std::vector<int> &indices,
const Indices &indices,
Eigen::Matrix3f &covariance_matrix)
{
return (computeCovarianceMatrix<PointT, float> (cloud, indices, covariance_matrix));
}

template <typename PointT> inline unsigned int
computeCovarianceMatrix (const pcl::PointCloud<PointT> &cloud,
const std::vector<int> &indices,
const Indices &indices,
Eigen::Matrix3d &covariance_matrix)
{
return (computeCovarianceMatrix<PointT, double> (cloud, indices, covariance_matrix));
Expand Down Expand Up @@ -656,13 +656,13 @@ namespace pcl
*/
template <typename PointT, typename Scalar> void
demeanPointCloud (const pcl::PointCloud<PointT> &cloud_in,
const std::vector<int> &indices,
const Indices &indices,
const Eigen::Matrix<Scalar, 4, 1> &centroid,
pcl::PointCloud<PointT> &cloud_out);

template <typename PointT> void
demeanPointCloud (const pcl::PointCloud<PointT> &cloud_in,
const std::vector<int> &indices,
const Indices &indices,
const Eigen::Vector4f &centroid,
pcl::PointCloud<PointT> &cloud_out)
{
Expand All @@ -671,7 +671,7 @@ namespace pcl

template <typename PointT> void
demeanPointCloud (const pcl::PointCloud<PointT> &cloud_in,
const std::vector<int> &indices,
const Indices &indices,
const Eigen::Vector4d &centroid,
pcl::PointCloud<PointT> &cloud_out)
{
Expand Down Expand Up @@ -782,13 +782,13 @@ namespace pcl
*/
template <typename PointT, typename Scalar> void
demeanPointCloud (const pcl::PointCloud<PointT> &cloud_in,
const std::vector<int> &indices,
const Indices &indices,
const Eigen::Matrix<Scalar, 4, 1> &centroid,
Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic> &cloud_out);

template <typename PointT> void
demeanPointCloud (const pcl::PointCloud<PointT> &cloud_in,
const std::vector<int> &indices,
const Indices &indices,
const Eigen::Vector4f &centroid,
Eigen::MatrixXf &cloud_out)
{
Expand All @@ -797,7 +797,7 @@ namespace pcl

template <typename PointT> void
demeanPointCloud (const pcl::PointCloud<PointT> &cloud_in,
const std::vector<int> &indices,
const Indices &indices,
const Eigen::Vector4d &centroid,
Eigen::MatrixXd &cloud_out)
{
Expand Down Expand Up @@ -903,20 +903,20 @@ namespace pcl
*/
template <typename PointT, typename Scalar> inline void
computeNDCentroid (const pcl::PointCloud<PointT> &cloud,
const std::vector<int> &indices,
const Indices &indices,
Eigen::Matrix<Scalar, Eigen::Dynamic, 1> &centroid);

template <typename PointT> inline void
computeNDCentroid (const pcl::PointCloud<PointT> &cloud,
const std::vector<int> &indices,
const Indices &indices,
Eigen::VectorXf &centroid)
{
return (computeNDCentroid<PointT, float> (cloud, indices, centroid));
}

template <typename PointT> inline void
computeNDCentroid (const pcl::PointCloud<PointT> &cloud,
const std::vector<int> &indices,
const Indices &indices,
Eigen::VectorXd &centroid)
{
return (computeNDCentroid<PointT, double> (cloud, indices, centroid));
Expand All @@ -931,20 +931,20 @@ namespace pcl
*/
template <typename PointT, typename Scalar> inline void
computeNDCentroid (const pcl::PointCloud<PointT> &cloud,
const pcl::PointIndices &indices,
const pcl::PointIndices &indices,
Eigen::Matrix<Scalar, Eigen::Dynamic, 1> &centroid);

template <typename PointT> inline void
computeNDCentroid (const pcl::PointCloud<PointT> &cloud,
const pcl::PointIndices &indices,
const pcl::PointIndices &indices,
Eigen::VectorXf &centroid)
{
return (computeNDCentroid<PointT, float> (cloud, indices, centroid));
}

template <typename PointT> inline void
computeNDCentroid (const pcl::PointCloud<PointT> &cloud,
const pcl::PointIndices &indices,
const pcl::PointIndices &indices,
Eigen::VectorXd &centroid)
{
return (computeNDCentroid<PointT, double> (cloud, indices, centroid));
Expand Down Expand Up @@ -1091,7 +1091,7 @@ namespace pcl
* \ingroup common */
template <typename PointInT, typename PointOutT> std::size_t
computeCentroid (const pcl::PointCloud<PointInT>& cloud,
const std::vector<int>& indices,
const Indices& indices,
PointOutT& centroid);

}
Expand Down
8 changes: 4 additions & 4 deletions common/include/pcl/common/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ namespace pcl
*/
template <typename PointT> inline void
getPointsInBox (const pcl::PointCloud<PointT> &cloud, Eigen::Vector4f &min_pt,
Eigen::Vector4f &max_pt, std::vector<int> &indices);
Eigen::Vector4f &max_pt, Indices &indices);

/** \brief Get the point at maximum distance from a given point and a given pointcloud
* \param cloud the point cloud data message
Expand All @@ -107,7 +107,7 @@ namespace pcl
* \ingroup common
*/
template<typename PointT> inline void
getMaxDistance (const pcl::PointCloud<PointT> &cloud, const std::vector<int> &indices,
getMaxDistance (const pcl::PointCloud<PointT> &cloud, const Indices &indices,
const Eigen::Vector4f &pivot_pt, Eigen::Vector4f &max_pt);

/** \brief Get the minimum and maximum values on each of the 3 (x-y-z) dimensions in a given pointcloud
Expand Down Expand Up @@ -137,7 +137,7 @@ namespace pcl
* \ingroup common
*/
template <typename PointT> inline void
getMinMax3D (const pcl::PointCloud<PointT> &cloud, const std::vector<int> &indices,
getMinMax3D (const pcl::PointCloud<PointT> &cloud, const Indices &indices,
Eigen::Vector4f &min_pt, Eigen::Vector4f &max_pt);

/** \brief Get the minimum and maximum values on each of the 3 (x-y-z) dimensions in a given pointcloud
Expand All @@ -148,7 +148,7 @@ namespace pcl
* \ingroup common
*/
template <typename PointT> inline void
getMinMax3D (const pcl::PointCloud<PointT> &cloud, const pcl::PointIndices &indices,
getMinMax3D (const pcl::PointCloud<PointT> &cloud, const pcl::PointIndices &indices,
Eigen::Vector4f &min_pt, Eigen::Vector4f &max_pt);

/** \brief Compute the radius of a circumscribed circle for a triangle formed of three points pa, pb, and pc
Expand Down
3 changes: 2 additions & 1 deletion common/include/pcl/common/distances.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@

#include <limits>

#include <pcl/types.h>
#include <pcl/common/common.h>

/**
Expand Down Expand Up @@ -139,7 +140,7 @@ namespace pcl
* \ingroup common
*/
template <typename PointT> double inline
getMaxSegment (const pcl::PointCloud<PointT> &cloud, const std::vector<int> &indices,
getMaxSegment (const pcl::PointCloud<PointT> &cloud, const Indices &indices,
PointT &pmin, PointT &pmax)
{
double max_dist = std::numeric_limits<double>::min ();
Expand Down
Loading