diff --git a/CHANGES.md b/CHANGES.md index 01a7ad91e87..eef19d6444f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3062,7 +3062,7 @@ pcl::OrganizedDataIndex -> pcl::search::OrganizedNeighbor * added new templated methods for `nearestKSearch` and `radiusSearch` for situations when PointT is different than the one the KdTree object was created with (e.g., KdTree vs nearestKSearch (PointT2 &p...) * added two new methods for `getApproximateIndices` where given a reference cloud of point type T1 we're trying to find the corresponding indices in a different cloud of point type T2 * refactorized a lot of code in search and octree to make it look more consistent with the rest of the API -* fixed a bug in octree_search which was semantically doing something bad: for each `radiusSearch`/`nearestKSearch`/`approxNearestSearch` call with a PointCloudConstPtr, the octree was getting recreated. Changed the API to be consistent with the rest of PCL (including pcl_search and pcl_kdtree) where we pass in a PointCloud instead of a PointCloudConstPtr which simply calls searchMethod (cloud.points[i], ...) +* fixed a bug in octree_search which was semantically doing something bad: for each `radiusSearch`/`nearestKSearch`/`approxNearestSearch` call with a PointCloudConstPtr, the octree was getting recreated. Changed the API to be consistent with the rest of PCL (including pcl_search and pcl_kdtree) where we pass in a PointCloud instead of a PointCloudConstPtr which simply calls searchMethod (cloud[i], ...) * minor code optimizations * renamed organized_neighbor.h header in pcl_search (unreleased, therefore API changes OK!) to organized.h * disabled the auto-search tuning as it wasn't really working. must clean this up further @@ -3117,7 +3117,7 @@ pcl::OrganizedDataIndex -> pcl::search::OrganizedNeighbor * added unit test for `getIntersectedVoxelCentersRecursive` * added method `getIntersectedVoxelIndices` for getting indices of intersected voxels and updated unit test * refactorized a lot of code in search and octree to make it look more consistent with the rest of the API -* fixed a bug in octree_search which was semantically doing something bad: for each `radiusSearch`/`nearestKSearch`/`approxNearestSearch` call with a PointCloudConstPtr, the octree was getting recreated. Changed the API to be consistent with the rest of PCL (including pcl_search and pcl_kdtree) where we pass in a PointCloud instead of a PointCloudConstPtr which simply calls searchMethod (cloud.points[i], ...) +* fixed a bug in octree_search which was semantically doing something bad: for each `radiusSearch`/`nearestKSearch`/`approxNearestSearch` call with a PointCloudConstPtr, the octree was getting recreated. Changed the API to be consistent with the rest of PCL (including pcl_search and pcl_kdtree) where we pass in a PointCloud instead of a PointCloudConstPtr which simply calls searchMethod (cloud[i], ...) * minor code optimizations * renamed organized_neighbor.h header in pcl_search (unreleased, therefore API changes OK!) to organized.h * disabled the auto-search tuning as it wasn't really working. must clean this up further diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/global/cvfh_estimator.h b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/global/cvfh_estimator.h index a0b23363dd4..e43974c6313 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/global/cvfh_estimator.h +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/global/cvfh_estimator.h @@ -136,7 +136,7 @@ class CVFHEstimation : public GlobalEstimator { vfh_signature.points.resize(1); vfh_signature.width = vfh_signature.height = 1; for (int d = 0; d < 308; ++d) - vfh_signature.points[0].histogram[d] = cvfh_signatures.points[i].histogram[d]; + vfh_signature[0].histogram[d] = cvfh_signatures[i].histogram[d]; signatures.push_back(vfh_signature); } diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/global/ourcvfh_estimator.h b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/global/ourcvfh_estimator.h index 573e5d7ec9b..85e5c2647cf 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/global/ourcvfh_estimator.h +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/global/ourcvfh_estimator.h @@ -165,7 +165,7 @@ class OURCVFHEstimator : public GlobalEstimator { vfh_signature.points.resize(1); vfh_signature.width = vfh_signature.height = 1; for (int d = 0; d < 308; ++d) - vfh_signature.points[0].histogram[d] = point.histogram[d]; + vfh_signature[0].histogram[d] = point.histogram[d]; signatures.push_back(vfh_signature); } diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_classifier.hpp b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_classifier.hpp index 9a87f2d4abe..d0dd3507af9 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_classifier.hpp +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_classifier.hpp @@ -97,8 +97,8 @@ pcl::rec_3d_framework::GlobalNNPipeline::classify( if (!signatures.empty()) { for (std::size_t idx = 0; idx < signatures.size(); idx++) { - float* hist = signatures[idx].points[0].histogram; - int size_feat = sizeof(signatures[idx].points[0].histogram) / sizeof(float); + float* hist = signatures[idx][0].histogram; + int size_feat = sizeof(signatures[idx][0].histogram) / sizeof(float); std::vector std_hist(hist, hist + size_feat); ModelT empty; diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_recognizer_crh.hpp b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_recognizer_crh.hpp index 9326e05e5b7..6d8d08b2164 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_recognizer_crh.hpp +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_recognizer_crh.hpp @@ -197,8 +197,8 @@ pcl::rec_3d_framework::GlobalNNCRHRecognizer::reco pcl::ScopeTime t_matching("Matching and roll..."); for (std::size_t idx = 0; idx < signatures.size(); idx++) { - float* hist = signatures[idx].points[0].histogram; - int size_feat = sizeof(signatures[idx].points[0].histogram) / sizeof(float); + float* hist = signatures[idx][0].histogram; + int size_feat = sizeof(signatures[idx][0].histogram) / sizeof(float); std::vector std_hist(hist, hist + size_feat); ModelT empty; diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_recognizer_cvfh.hpp b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_recognizer_cvfh.hpp index 4237490cc68..1afe7079c28 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_recognizer_cvfh.hpp +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_recognizer_cvfh.hpp @@ -253,8 +253,8 @@ pcl::rec_3d_framework::GlobalNNCVFHRecognizer::rec for (std::size_t c = 0; c < categories_to_be_searched_.size(); c++) { std::cout << "Using category:" << categories_to_be_searched_[c] << std::endl; for (std::size_t idx = 0; idx < signatures.size(); idx++) { - float* hist = signatures[idx].points[0].histogram; - int size_feat = sizeof(signatures[idx].points[0].histogram) / sizeof(float); + float* hist = signatures[idx][0].histogram; + int size_feat = sizeof(signatures[idx][0].histogram) / sizeof(float); std::vector std_hist(hist, hist + size_feat); flann_model histogram; @@ -293,8 +293,8 @@ pcl::rec_3d_framework::GlobalNNCVFHRecognizer::rec else { for (std::size_t idx = 0; idx < signatures.size(); idx++) { - float* hist = signatures[idx].points[0].histogram; - int size_feat = sizeof(signatures[idx].points[0].histogram) / sizeof(float); + float* hist = signatures[idx][0].histogram; + int size_feat = sizeof(signatures[idx][0].histogram) / sizeof(float); std::vector std_hist(hist, hist + size_feat); flann_model histogram; diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/utils/vtk_model_sampling.h b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/utils/vtk_model_sampling.h index b8ff03d5997..148e78a2f0f 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/utils/vtk_model_sampling.h +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/utils/vtk_model_sampling.h @@ -114,9 +114,9 @@ uniform_sampling(const vtkSmartPointer& polydata, for (i = 0; i < n_samples; i++) { Eigen::Vector4f p(0.f, 0.f, 0.f, 0.f); randPSurface(polydata, &cumulativeAreas, totalArea, p); - cloud_out.points[i].x = static_cast(p[0]); - cloud_out.points[i].y = static_cast(p[1]); - cloud_out.points[i].z = static_cast(p[2]); + cloud_out[i].x = static_cast(p[0]); + cloud_out[i].y = static_cast(p[1]); + cloud_out[i].z = static_cast(p[2]); } } @@ -167,9 +167,9 @@ getVerticesAsPointCloud(const vtkSmartPointer& polydata, for (vtkIdType i = 0; i < points->GetNumberOfPoints(); i++) { double p[3]; points->GetPoint(i, p); - cloud_out.points[i].x = static_cast(p[0]); - cloud_out.points[i].y = static_cast(p[1]); - cloud_out.points[i].z = static_cast(p[2]); + cloud_out[i].x = static_cast(p[0]); + cloud_out[i].y = static_cast(p[1]); + cloud_out[i].z = static_cast(p[2]); } } diff --git a/apps/modeler/src/normal_estimation_worker.cpp b/apps/modeler/src/normal_estimation_worker.cpp index c3b3700e348..0329f655343 100755 --- a/apps/modeler/src/normal_estimation_worker.cpp +++ b/apps/modeler/src/normal_estimation_worker.cpp @@ -131,8 +131,8 @@ pcl::modeler::NormalEstimationWorker::processImpl(CloudMeshItem* cloud_mesh_item for (std::size_t i = 0, i_end = indices->size(); i < i_end; ++i) { std::size_t dest = (*indices)[i]; - cloud->points[dest].normal_x = normals.points[i].normal_x; - cloud->points[dest].normal_y = normals.points[i].normal_y; - cloud->points[dest].normal_z = normals.points[i].normal_z; + cloud->points[dest].normal_x = normals[i].normal_x; + cloud->points[dest].normal_y = normals[i].normal_y; + cloud->points[dest].normal_z = normals[i].normal_z; } } diff --git a/apps/point_cloud_editor/src/cloud.cpp b/apps/point_cloud_editor/src/cloud.cpp index b104a54284b..186f8397199 100644 --- a/apps/point_cloud_editor/src/cloud.cpp +++ b/apps/point_cloud_editor/src/cloud.cpp @@ -227,7 +227,7 @@ Cloud::drawWithRGB () const { glEnableClientState(GL_COLOR_ARRAY); glColorPointer(3, GL_UNSIGNED_BYTE, sizeof(Point3D), - &(cloud_.points[0].b)); + &(cloud_[0].b)); draw(); } @@ -267,7 +267,7 @@ Cloud::draw (bool disable_highlight) const glTranslatef(-center_xyz_[0], -center_xyz_[1], -center_xyz_[2]); glEnableClientState(GL_VERTEX_ARRAY); - glVertexPointer(3, GL_FLOAT, sizeof(Point3D), &(cloud_.points[0].x)); + glVertexPointer(3, GL_FLOAT, sizeof(Point3D), &(cloud_[0].x)); if (disable_highlight || (!selection_ptr) || selection_ptr->empty()) { @@ -328,7 +328,7 @@ Cloud::remove(const Selection& selection) { unsigned int pos = cloud_.size(); for (auto rit = selection.rbegin(); rit != selection.rend(); ++rit) - std::swap(cloud_.points[--pos], cloud_.points[*rit]); + std::swap(cloud_[--pos], cloud_[*rit]); resize(cloud_.size()-selection.size()); } @@ -439,7 +439,7 @@ Cloud::restore (const CopyBuffer& copy_buffer, const Selection& selection) append(copied_cloud); unsigned int pos = cloud_.size(); for (auto rit = selection.rbegin(); rit != selection.rend(); ++rit) - std::swap(cloud_.points[--pos], cloud_.points[*rit]); + std::swap(cloud_[--pos], cloud_[*rit]); } std::string @@ -459,15 +459,15 @@ Cloud::updateCloudMembers () std::fill_n(min_xyz_, XYZ_SIZE, 0.0f); std::fill_n(max_xyz_, XYZ_SIZE, 0.0f); - float *pt = &(cloud_.points[0].data[X]); + float *pt = &(cloud_[0].data[X]); std::copy(pt, pt+XYZ_SIZE, max_xyz_); std::copy(max_xyz_, max_xyz_+XYZ_SIZE, min_xyz_); for (std::size_t i = 1; i < cloud_.size(); ++i) { for (unsigned int j = 0; j < XYZ_SIZE; ++j) { - min_xyz_[j] = std::min(min_xyz_[j], cloud_.points[i].data[j]); - max_xyz_[j] = std::max(max_xyz_[j], cloud_.points[i].data[j]); + min_xyz_[j] = std::min(min_xyz_[j], cloud_[i].data[j]); + max_xyz_[j] = std::max(max_xyz_[j], cloud_[i].data[j]); } } float range = 0.0f; @@ -493,7 +493,7 @@ Cloud::enableTexture () const glEnable(GL_TEXTURE_1D); glEnableClientState(GL_TEXTURE_COORD_ARRAY); glTexCoordPointer(1, GL_FLOAT, sizeof(Point3D), - &(cloud_.points[0].data[color_ramp_axis_])); + &(cloud_[0].data[color_ramp_axis_])); glMatrixMode(GL_TEXTURE); glPushMatrix(); glLoadIdentity(); diff --git a/apps/src/ni_agast.cpp b/apps/src/ni_agast.cpp index a7f110e56e8..46e9d010338 100644 --- a/apps/src/ni_agast.cpp +++ b/apps/src/ni_agast.cpp @@ -235,9 +235,9 @@ class AGASTDemo { if (!std::isfinite(pt.x) || !std::isfinite(pt.y) || !std::isfinite(pt.z)) continue; - keypoints3d.points[j].x = pt.x; - keypoints3d.points[j].y = pt.y; - keypoints3d.points[j].z = pt.z; + keypoints3d[j].x = pt.x; + keypoints3d[j].y = pt.y; + keypoints3d[j].z = pt.z; ++j; } diff --git a/apps/src/ni_brisk.cpp b/apps/src/ni_brisk.cpp index 8b5ad09fa9e..39ded06869a 100644 --- a/apps/src/ni_brisk.cpp +++ b/apps/src/ni_brisk.cpp @@ -185,9 +185,9 @@ class BRISKDemo { PointT pt = bilinearInterpolation(cloud, keypoints->points[i].x, keypoints->points[i].y); - keypoints3d.points[j].x = pt.x; - keypoints3d.points[j].y = pt.y; - keypoints3d.points[j].z = pt.z; + keypoints3d[j].x = pt.x; + keypoints3d[j].y = pt.y; + keypoints3d[j].z = pt.z; ++j; } diff --git a/apps/src/organized_segmentation_demo.cpp b/apps/src/organized_segmentation_demo.cpp index 8dccb9b1372..cca4aa09161 100644 --- a/apps/src/organized_segmentation_demo.cpp +++ b/apps/src/organized_segmentation_demo.cpp @@ -81,15 +81,15 @@ displayCurvature(pcl::PointCloud& cloud, { pcl::PointCloud curvature_cloud = cloud; for (std::size_t i = 0; i < cloud.points.size(); i++) { - if (normals.points[i].curvature < 0.04) { - curvature_cloud.points[i].r = 0; - curvature_cloud.points[i].g = 255; - curvature_cloud.points[i].b = 0; + if (normals[i].curvature < 0.04) { + curvature_cloud[i].r = 0; + curvature_cloud[i].g = 255; + curvature_cloud[i].b = 0; } else { - curvature_cloud.points[i].r = 255; - curvature_cloud.points[i].g = 0; - curvature_cloud.points[i].b = 0; + curvature_cloud[i].r = 255; + curvature_cloud[i].g = 0; + curvature_cloud[i].b = 0; } } @@ -105,14 +105,14 @@ displayDistanceMap(pcl::PointCloud& cloud, pcl::PointCloud distance_map_cloud = cloud; for (std::size_t i = 0; i < cloud.points.size(); i++) { if (distance_map[i] < 5.0) { - distance_map_cloud.points[i].r = 255; - distance_map_cloud.points[i].g = 0; - distance_map_cloud.points[i].b = 0; + distance_map_cloud[i].r = 255; + distance_map_cloud[i].g = 0; + distance_map_cloud[i].b = 0; } else { - distance_map_cloud.points[i].r = 0; - distance_map_cloud.points[i].g = 255; - distance_map_cloud.points[i].b = 0; + distance_map_cloud[i].r = 0; + distance_map_cloud[i].g = 255; + distance_map_cloud[i].b = 0; } } diff --git a/common/include/pcl/common/distances.h b/common/include/pcl/common/distances.h index fdaad9023b5..ae8ef706a64 100644 --- a/common/include/pcl/common/distances.h +++ b/common/include/pcl/common/distances.h @@ -112,8 +112,8 @@ namespace pcl for (std::size_t j = i; j < cloud.points.size (); ++j) { // Compute the distance - double dist = (cloud.points[i].getVector4fMap () - - cloud.points[j].getVector4fMap ()).squaredNorm (); + double dist = (cloud[i].getVector4fMap () - + cloud[j].getVector4fMap ()).squaredNorm (); if (dist <= max_dist) continue; @@ -126,8 +126,8 @@ namespace pcl if (i_min == token || i_max == token) return (max_dist = std::numeric_limits::min ()); - pmin = cloud.points[i_min]; - pmax = cloud.points[i_max]; + pmin = cloud[i_min]; + pmax = cloud[i_max]; return (std::sqrt (max_dist)); } @@ -152,8 +152,8 @@ namespace pcl for (std::size_t j = i; j < indices.size (); ++j) { // Compute the distance - double dist = (cloud.points[indices[i]].getVector4fMap () - - cloud.points[indices[j]].getVector4fMap ()).squaredNorm (); + double dist = (cloud[indices[i]].getVector4fMap () - + cloud[indices[j]].getVector4fMap ()).squaredNorm (); if (dist <= max_dist) continue; @@ -166,8 +166,8 @@ namespace pcl if (i_min == token || i_max == token) return (max_dist = std::numeric_limits::min ()); - pmin = cloud.points[indices[i_min]]; - pmax = cloud.points[indices[i_max]]; + pmin = cloud[indices[i_min]]; + pmax = cloud[indices[i_max]]; return (std::sqrt (max_dist)); } diff --git a/common/include/pcl/common/impl/centroid.hpp b/common/include/pcl/common/impl/centroid.hpp index c01b5ae7738..1aad8fb8768 100644 --- a/common/include/pcl/common/impl/centroid.hpp +++ b/common/include/pcl/common/impl/centroid.hpp @@ -759,7 +759,7 @@ demeanPointCloud (const pcl::PointCloud &cloud_in, cloud_out (1, i) = cloud_in[i].y - centroid[1]; cloud_out (2, i) = cloud_in[i].z - centroid[2]; // One column at a time - //cloud_out.block<4, 1> (0, i) = cloud_in.points[i].getVector4fMap () - centroid; + //cloud_out.block<4, 1> (0, i) = cloud_in[i].getVector4fMap () - centroid; } // Make sure we zero the 4th dimension out (1 row, N columns) @@ -783,7 +783,7 @@ demeanPointCloud (const pcl::PointCloud &cloud_in, cloud_out (1, i) = cloud_in[indices[i]].y - centroid[1]; cloud_out (2, i) = cloud_in[indices[i]].z - centroid[2]; // One column at a time - //cloud_out.block<4, 1> (0, i) = cloud_in.points[indices[i]].getVector4fMap () - centroid; + //cloud_out.block<4, 1> (0, i) = cloud_in[indices[i]].getVector4fMap () - centroid; } // Make sure we zero the 4th dimension out (1 row, N columns) diff --git a/common/include/pcl/common/impl/common.hpp b/common/include/pcl/common/impl/common.hpp index 8001e43401e..ab9dde9dcab 100644 --- a/common/include/pcl/common/impl/common.hpp +++ b/common/include/pcl/common/impl/common.hpp @@ -111,9 +111,9 @@ pcl::getPointsInBox (const pcl::PointCloud &cloud, for (std::size_t i = 0; i < cloud.points.size (); ++i) { // Check if the point is inside bounds - if (cloud.points[i].x < min_pt[0] || cloud.points[i].y < min_pt[1] || cloud.points[i].z < min_pt[2]) + if (cloud[i].x < min_pt[0] || cloud[i].y < min_pt[1] || cloud[i].z < min_pt[2]) continue; - if (cloud.points[i].x > max_pt[0] || cloud.points[i].y > max_pt[1] || cloud.points[i].z > max_pt[2]) + if (cloud[i].x > max_pt[0] || cloud[i].y > max_pt[1] || cloud[i].z > max_pt[2]) continue; indices[l++] = int (i); } @@ -124,14 +124,14 @@ pcl::getPointsInBox (const pcl::PointCloud &cloud, for (std::size_t i = 0; i < cloud.points.size (); ++i) { // Check if the point is invalid - if (!std::isfinite (cloud.points[i].x) || - !std::isfinite (cloud.points[i].y) || - !std::isfinite (cloud.points[i].z)) + if (!std::isfinite (cloud[i].x) || + !std::isfinite (cloud[i].y) || + !std::isfinite (cloud[i].z)) continue; // Check if the point is inside bounds - if (cloud.points[i].x < min_pt[0] || cloud.points[i].y < min_pt[1] || cloud.points[i].z < min_pt[2]) + if (cloud[i].x < min_pt[0] || cloud[i].y < min_pt[1] || cloud[i].z < min_pt[2]) continue; - if (cloud.points[i].x > max_pt[0] || cloud.points[i].y > max_pt[1] || cloud.points[i].z > max_pt[2]) + if (cloud[i].x > max_pt[0] || cloud[i].y > max_pt[1] || cloud[i].z > max_pt[2]) continue; indices[l++] = int (i); } @@ -153,7 +153,7 @@ pcl::getMaxDistance (const pcl::PointCloud &cloud, const Eigen::Vector4f { for (std::size_t i = 0; i < cloud.points.size (); ++i) { - pcl::Vector3fMapConst pt = cloud.points[i].getVector3fMap (); + pcl::Vector3fMapConst pt = cloud[i].getVector3fMap (); dist = (pivot_pt3 - pt).norm (); if (dist > max_dist) { @@ -168,9 +168,9 @@ pcl::getMaxDistance (const pcl::PointCloud &cloud, const Eigen::Vector4f for (std::size_t i = 0; i < cloud.points.size (); ++i) { // Check if the point is invalid - if (!std::isfinite (cloud.points[i].x) || !std::isfinite (cloud.points[i].y) || !std::isfinite (cloud.points[i].z)) + if (!std::isfinite (cloud[i].x) || !std::isfinite (cloud[i].y) || !std::isfinite (cloud[i].z)) continue; - pcl::Vector3fMapConst pt = cloud.points[i].getVector3fMap (); + pcl::Vector3fMapConst pt = cloud[i].getVector3fMap (); dist = (pivot_pt3 - pt).norm (); if (dist > max_dist) { @@ -181,7 +181,7 @@ pcl::getMaxDistance (const pcl::PointCloud &cloud, const Eigen::Vector4f } if(max_idx != -1) - max_pt = cloud.points[max_idx].getVector4fMap (); + max_pt = cloud[max_idx].getVector4fMap (); else max_pt = Eigen::Vector4f(std::numeric_limits::quiet_NaN(),std::numeric_limits::quiet_NaN(),std::numeric_limits::quiet_NaN(),std::numeric_limits::quiet_NaN()); } @@ -201,7 +201,7 @@ pcl::getMaxDistance (const pcl::PointCloud &cloud, const Indices &indice { for (std::size_t i = 0; i < indices.size (); ++i) { - pcl::Vector3fMapConst pt = cloud.points[indices[i]].getVector3fMap (); + pcl::Vector3fMapConst pt = cloud[indices[i]].getVector3fMap (); dist = (pivot_pt3 - pt).norm (); if (dist > max_dist) { @@ -216,12 +216,12 @@ pcl::getMaxDistance (const pcl::PointCloud &cloud, const Indices &indice for (std::size_t i = 0; i < indices.size (); ++i) { // Check if the point is invalid - if (!std::isfinite (cloud.points[indices[i]].x) || !std::isfinite (cloud.points[indices[i]].y) + if (!std::isfinite (cloud[indices[i]].x) || !std::isfinite (cloud[indices[i]].y) || - !std::isfinite (cloud.points[indices[i]].z)) + !std::isfinite (cloud[indices[i]].z)) continue; - pcl::Vector3fMapConst pt = cloud.points[indices[i]].getVector3fMap (); + pcl::Vector3fMapConst pt = cloud[indices[i]].getVector3fMap (); dist = (pivot_pt3 - pt).norm (); if (dist > max_dist) { @@ -232,7 +232,7 @@ pcl::getMaxDistance (const pcl::PointCloud &cloud, const Indices &indice } if(max_idx != -1) - max_pt = cloud.points[indices[max_idx]].getVector4fMap (); + max_pt = cloud[indices[max_idx]].getVector4fMap (); else max_pt = Eigen::Vector4f(std::numeric_limits::quiet_NaN(),std::numeric_limits::quiet_NaN(),std::numeric_limits::quiet_NaN(),std::numeric_limits::quiet_NaN()); } @@ -326,7 +326,7 @@ pcl::getMinMax3D (const pcl::PointCloud &cloud, const pcl::PointIndices { for (const int &index : indices.indices) { - pcl::Array4fMapConst pt = cloud.points[index].getArray4fMap (); + pcl::Array4fMapConst pt = cloud[index].getArray4fMap (); min_p = min_p.min (pt); max_p = max_p.max (pt); } @@ -337,11 +337,11 @@ pcl::getMinMax3D (const pcl::PointCloud &cloud, const pcl::PointIndices for (const int &index : indices.indices) { // Check if the point is invalid - if (!std::isfinite (cloud.points[index].x) || - !std::isfinite (cloud.points[index].y) || - !std::isfinite (cloud.points[index].z)) + if (!std::isfinite (cloud[index].x) || + !std::isfinite (cloud[index].y) || + !std::isfinite (cloud[index].z)) continue; - pcl::Array4fMapConst pt = cloud.points[index].getArray4fMap (); + pcl::Array4fMapConst pt = cloud[index].getArray4fMap (); min_p = min_p.min (pt); max_p = max_p.max (pt); } @@ -363,7 +363,7 @@ pcl::getMinMax3D (const pcl::PointCloud &cloud, const Indices &indices, { for (const int &index : indices) { - pcl::Array4fMapConst pt = cloud.points[index].getArray4fMap (); + pcl::Array4fMapConst pt = cloud[index].getArray4fMap (); min_pt = min_pt.array ().min (pt); max_pt = max_pt.array ().max (pt); } @@ -374,11 +374,11 @@ pcl::getMinMax3D (const pcl::PointCloud &cloud, const Indices &indices, for (const int &index : indices) { // Check if the point is invalid - if (!std::isfinite (cloud.points[index].x) || - !std::isfinite (cloud.points[index].y) || - !std::isfinite (cloud.points[index].z)) + if (!std::isfinite (cloud[index].x) || + !std::isfinite (cloud[index].y) || + !std::isfinite (cloud[index].z)) continue; - pcl::Array4fMapConst pt = cloud.points[index].getArray4fMap (); + pcl::Array4fMapConst pt = cloud[index].getArray4fMap (); min_pt = min_pt.array ().min (pt); max_pt = max_pt.array ().max (pt); } diff --git a/common/include/pcl/common/impl/io.hpp b/common/include/pcl/common/impl/io.hpp index efea2294d59..738c630c67d 100644 --- a/common/include/pcl/common/impl/io.hpp +++ b/common/include/pcl/common/impl/io.hpp @@ -135,11 +135,11 @@ copyPointCloud (const pcl::PointCloud &cloud_in, if (isSamePointType ()) // Copy the whole memory block - memcpy (&cloud_out.points[0], &cloud_in.points[0], cloud_in.points.size () * sizeof (PointInT)); + memcpy (&cloud_out[0], &cloud_in[0], cloud_in.points.size () * sizeof (PointInT)); else // Iterate over each point for (std::size_t i = 0; i < cloud_in.points.size (); ++i) - copyPoint (cloud_in.points[i], cloud_out.points[i]); + copyPoint (cloud_in[i], cloud_out[i]); } @@ -166,7 +166,7 @@ copyPointCloud (const pcl::PointCloud &cloud_in, // Iterate over each point for (std::size_t i = 0; i < indices.size (); ++i) - cloud_out.points[i] = cloud_in.points[indices[i]]; + cloud_out[i] = cloud_in[indices[i]]; } @@ -186,7 +186,7 @@ copyPointCloud (const pcl::PointCloud &cloud_in, // Iterate over each point for (std::size_t i = 0; i < indices.size (); ++i) - copyPoint (cloud_in.points[indices[i]], cloud_out.points[i]); + copyPoint (cloud_in[indices[i]], cloud_out[i]); } @@ -213,7 +213,7 @@ copyPointCloud (const pcl::PointCloud &cloud_in, // Iterate over each point for (std::size_t i = 0; i < indices.indices.size (); ++i) - cloud_out.points[i] = cloud_in.points[indices.indices[i]]; + cloud_out[i] = cloud_in[indices.indices[i]]; } @@ -259,7 +259,7 @@ copyPointCloud (const pcl::PointCloud &cloud_in, for (const auto &index : cluster_index.indices) { // Iterate over each dimension - cloud_out.points[cp] = cloud_in.points[index]; + cloud_out[cp] = cloud_in[index]; cp++; } } @@ -297,7 +297,7 @@ copyPointCloud (const pcl::PointCloud &cloud_in, // Iterate over each idx for (const auto &index : cluster_index.indices) { - copyPoint (cloud_in.points[index], cloud_out.points[cp]); + copyPoint (cloud_in[index], cloud_out[cp]); ++cp; } } @@ -332,8 +332,8 @@ concatenateFields (const pcl::PointCloud &cloud1_in, for (std::size_t i = 0; i < cloud_out.points.size (); ++i) { // Iterate over each dimension - pcl::for_each_type (pcl::NdConcatenateFunctor (cloud1_in.points[i], cloud_out.points[i])); - pcl::for_each_type (pcl::NdConcatenateFunctor (cloud2_in.points[i], cloud_out.points[i])); + pcl::for_each_type (pcl::NdConcatenateFunctor (cloud1_in[i], cloud_out[i])); + pcl::for_each_type (pcl::NdConcatenateFunctor (cloud2_in[i], cloud_out[i])); } } @@ -365,8 +365,8 @@ copyPointCloud (const pcl::PointCloud &cloud_in, pcl::PointCloud if (border_type == pcl::BORDER_TRANSPARENT) { - const PointT* in = &(cloud_in.points[0]); - PointT* out = &(cloud_out.points[0]); + const PointT* in = &(cloud_in[0]); + PointT* out = &(cloud_out[0]); PointT* out_inner = out + cloud_out.width*top + left; for (std::uint32_t i = 0; i < cloud_in.height; i++, out_inner += cloud_out.width, in += cloud_in.width) { @@ -391,8 +391,8 @@ copyPointCloud (const pcl::PointCloud &cloud_in, pcl::PointCloud for (int i = 0; i < right; i++) padding[i+left] = pcl::interpolatePointIndex (cloud_in.width+i, cloud_in.width, border_type); - const PointT* in = &(cloud_in.points[0]); - PointT* out = &(cloud_out.points[0]); + const PointT* in = &(cloud_in[0]); + PointT* out = &(cloud_out[0]); PointT* out_inner = out + cloud_out.width*top + left; for (std::uint32_t i = 0; i < cloud_in.height; i++, out_inner += cloud_out.width, in += cloud_in.width) @@ -434,8 +434,8 @@ copyPointCloud (const pcl::PointCloud &cloud_in, pcl::PointCloud int bottom = cloud_out.height - cloud_in.height - top; std::vector buff (cloud_out.width, value); PointT* buff_ptr = &(buff[0]); - const PointT* in = &(cloud_in.points[0]); - PointT* out = &(cloud_out.points[0]); + const PointT* in = &(cloud_in[0]); + PointT* out = &(cloud_out[0]); PointT* out_inner = out + cloud_out.width*top + left; for (std::uint32_t i = 0; i < cloud_in.height; i++, out_inner += cloud_out.width, in += cloud_in.width) diff --git a/common/include/pcl/common/impl/transforms.hpp b/common/include/pcl/common/impl/transforms.hpp index ad9c7f60c95..52c835261bb 100644 --- a/common/include/pcl/common/impl/transforms.hpp +++ b/common/include/pcl/common/impl/transforms.hpp @@ -251,9 +251,9 @@ transformPointCloud (const pcl::PointCloud &cloud_in, // otherwise we get errors during the multiplication (?) for (std::size_t i = 0; i < cloud_out.points.size (); ++i) { - if (!std::isfinite (cloud_in.points[i].x) || - !std::isfinite (cloud_in.points[i].y) || - !std::isfinite (cloud_in.points[i].z)) + if (!std::isfinite (cloud_in[i].x) || + !std::isfinite (cloud_in[i].y) || + !std::isfinite (cloud_in[i].z)) continue; tf.se3 (cloud_in[i].data, cloud_out[i].data); } @@ -286,7 +286,7 @@ transformPointCloud (const pcl::PointCloud &cloud_in, { // Copy fields first, then transform xyz data if (copy_all_fields) - cloud_out.points[i] = cloud_in.points[indices[i]]; + cloud_out[i] = cloud_in[indices[i]]; tf.se3 (cloud_in[indices[i]].data, cloud_out[i].data); } } @@ -297,10 +297,10 @@ transformPointCloud (const pcl::PointCloud &cloud_in, for (std::size_t i = 0; i < npts; ++i) { if (copy_all_fields) - cloud_out.points[i] = cloud_in.points[indices[i]]; - if (!std::isfinite (cloud_in.points[indices[i]].x) || - !std::isfinite (cloud_in.points[indices[i]].y) || - !std::isfinite (cloud_in.points[indices[i]].z)) + cloud_out[i] = cloud_in[indices[i]]; + if (!std::isfinite (cloud_in[indices[i]].x) || + !std::isfinite (cloud_in[indices[i]].y) || + !std::isfinite (cloud_in[indices[i]].z)) continue; tf.se3 (cloud_in[indices[i]].data, cloud_out[i].data); } @@ -345,9 +345,9 @@ transformPointCloudWithNormals (const pcl::PointCloud &cloud_in, { for (std::size_t i = 0; i < cloud_out.points.size (); ++i) { - if (!std::isfinite (cloud_in.points[i].x) || - !std::isfinite (cloud_in.points[i].y) || - !std::isfinite (cloud_in.points[i].z)) + if (!std::isfinite (cloud_in[i].x) || + !std::isfinite (cloud_in[i].y) || + !std::isfinite (cloud_in[i].z)) continue; tf.se3 (cloud_in[i].data, cloud_out[i].data); tf.so3 (cloud_in[i].data_n, cloud_out[i].data_n); @@ -381,7 +381,7 @@ transformPointCloudWithNormals (const pcl::PointCloud &cloud_in, { // Copy fields first, then transform if (copy_all_fields) - cloud_out.points[i] = cloud_in.points[indices[i]]; + cloud_out[i] = cloud_in[indices[i]]; tf.se3 (cloud_in[indices[i]].data, cloud_out[i].data); tf.so3 (cloud_in[indices[i]].data_n, cloud_out[i].data_n); } @@ -393,11 +393,11 @@ transformPointCloudWithNormals (const pcl::PointCloud &cloud_in, { // Copy fields first, then transform if (copy_all_fields) - cloud_out.points[i] = cloud_in.points[indices[i]]; + cloud_out[i] = cloud_in[indices[i]]; - if (!std::isfinite (cloud_in.points[indices[i]].x) || - !std::isfinite (cloud_in.points[indices[i]].y) || - !std::isfinite (cloud_in.points[indices[i]].z)) + if (!std::isfinite (cloud_in[indices[i]].x) || + !std::isfinite (cloud_in[indices[i]].y) || + !std::isfinite (cloud_in[indices[i]].z)) continue; tf.se3 (cloud_in[indices[i]].data, cloud_out[i].data); diff --git a/common/include/pcl/conversions.h b/common/include/pcl/conversions.h index db008eb313e..8485fb5d138 100644 --- a/common/include/pcl/conversions.h +++ b/common/include/pcl/conversions.h @@ -177,7 +177,7 @@ namespace pcl // Copy point data std::uint32_t num_points = msg.width * msg.height; cloud.points.resize (num_points); - std::uint8_t* cloud_data = reinterpret_cast(&cloud.points[0]); + std::uint8_t* cloud_data = reinterpret_cast(&cloud[0]); // Check if we can copy adjacent points in a single memcpy. We can do so if there // is exactly one field to copy and it is the same size as the source and destination @@ -258,7 +258,7 @@ namespace pcl msg.data.resize (data_size); if (data_size) { - memcpy(&msg.data[0], &cloud.points[0], data_size); + memcpy(&msg.data[0], &cloud[0], data_size); } // Fill fields metadata diff --git a/common/include/pcl/impl/cloud_iterator.hpp b/common/include/pcl/impl/cloud_iterator.hpp index d03d9ca7442..397419e76b7 100644 --- a/common/include/pcl/impl/cloud_iterator.hpp +++ b/common/include/pcl/impl/cloud_iterator.hpp @@ -286,7 +286,7 @@ namespace pcl const PointT& operator* () const override { - return (cloud_.points[*iterator_]); + return (cloud_[*iterator_]); } const PointT* operator-> () const override diff --git a/common/include/pcl/point_cloud.h b/common/include/pcl/point_cloud.h index 2bbbde30d1c..ec8b0e80629 100644 --- a/common/include/pcl/point_cloud.h +++ b/common/include/pcl/point_cloud.h @@ -212,7 +212,7 @@ namespace pcl // Copy the obvious assert (indices.size () <= pc.size ()); for (std::size_t i = 0; i < indices.size (); i++) - points[i] = pc.points[indices[i]]; + points[i] = pc[indices[i]]; } /** \brief Allocate constructor from point cloud subset diff --git a/common/src/range_image.cpp b/common/src/range_image.cpp index 40425c7b930..b9dd990a4cb 100644 --- a/common/src/range_image.cpp +++ b/common/src/range_image.cpp @@ -257,7 +257,7 @@ RangeImage::cropImage (int borderSize, int top, int right, int bottom, int left) currentPoint = unobserved_point; continue; } - currentPoint = oldRangeImage.points[oldY*oldRangeImage.width + oldX]; + currentPoint = oldRangeImage[oldY*oldRangeImage.width + oldX]; } } } diff --git a/cuda/apps/src/kinect_normals_cuda.cpp b/cuda/apps/src/kinect_normals_cuda.cpp index b9c942d97ca..dc87ef4bfa5 100644 --- a/cuda/apps/src/kinect_normals_cuda.cpp +++ b/cuda/apps/src/kinect_normals_cuda.cpp @@ -111,7 +111,7 @@ class NormalEstimation pt.z = cloud->points[i].z; // Pack RGB into a float pt.rgb = *(float*)(&cloud->points[i].rgb); - data_host.points[i] = pt; + data_host[i] = pt; } data_host.width = cloud->width; data_host.height = cloud->height; diff --git a/cuda/apps/src/kinect_ransac.cpp b/cuda/apps/src/kinect_ransac.cpp index 0effead638c..fd780ebb47c 100644 --- a/cuda/apps/src/kinect_ransac.cpp +++ b/cuda/apps/src/kinect_ransac.cpp @@ -77,7 +77,7 @@ class SimpleKinectTool pt.z = cloud->points[i].z; // Pack RGB into a float pt.rgb = *(float*)(&cloud->points[i].rgb); - data_host.points[i] = pt; + data_host[i] = pt; } data_host.width = cloud->width; data_host.height = cloud->height; diff --git a/cuda/apps/src/kinect_segmentation_cuda.cpp b/cuda/apps/src/kinect_segmentation_cuda.cpp index b7debcc3a2e..c92393975d6 100644 --- a/cuda/apps/src/kinect_segmentation_cuda.cpp +++ b/cuda/apps/src/kinect_segmentation_cuda.cpp @@ -158,7 +158,7 @@ class Segmentation pt.z = cloud->points[i].z; // Pack RGB into a float pt.rgb = *(float*)(&cloud->points[i].rgb); - data_host.points[i] = pt; + data_host[i] = pt; } data_host.width = cloud->width; data_host.height = cloud->height; diff --git a/cuda/apps/src/kinect_segmentation_planes_cuda.cpp b/cuda/apps/src/kinect_segmentation_planes_cuda.cpp index 341e0cd32ff..89ea398184c 100644 --- a/cuda/apps/src/kinect_segmentation_planes_cuda.cpp +++ b/cuda/apps/src/kinect_segmentation_planes_cuda.cpp @@ -132,7 +132,7 @@ class Segmentation pt.z = cloud->points[i].z; // Pack RGB into a float pt.rgb = *(float*)(&cloud->points[i].rgb); - data_host.points[i] = pt; + data_host[i] = pt; } data_host.width = cloud->width; data_host.height = cloud->height; diff --git a/cuda/filters/include/pcl/cuda/filters/filter.h b/cuda/filters/include/pcl/cuda/filters/filter.h index 0d81a47b0d9..416fc88dd56 100644 --- a/cuda/filters/include/pcl/cuda/filters/filter.h +++ b/cuda/filters/include/pcl/cuda/filters/filter.h @@ -43,7 +43,7 @@ namespace pcl_cuda /** \brief Removes points with x, y, or z equal to NaN * \param cloud_in the input point cloud * \param cloud_out the input point cloud - * \param index the mapping (ordered): cloud_out.points[i] = cloud_in.points[index[i]] + * \param index the mapping (ordered): cloud_out[i] = cloud_in[index[i]] * \note The density of the point cloud is lost. * \note Can be called with cloud_in == cloud_out */ diff --git a/cuda/io/src/cloud_from_pcl.cu b/cuda/io/src/cloud_from_pcl.cu index 74050af102e..2ef517c20ee 100644 --- a/cuda/io/src/cloud_from_pcl.cu +++ b/cuda/io/src/cloud_from_pcl.cu @@ -51,11 +51,11 @@ fromPCL (const pcl::PointCloud &input, PointCloudAOS &ou // output.points.resize (input.points.size()); // for (std::size_t i = 0; i < input.points.size (); ++i) // { -// output.points[i].x = input.points[i].x; -// output.points[i].y = input.points[i].y; -// output.points[i].z = input.points[i].z; +// output[i].x = input[i].x; +// output[i].y = input[i].y; +// output[i].z = input[i].z; // // Pack RGB into a float -// output.points[i].rgb = *(float*)(&input.points[i].rgb); +// output[i].rgb = *(float*)(&input[i].rgb); // } // thrust::copy (output.points.begin(), output.points.end (), input.points.begin()); // output.width = input.width; diff --git a/cuda/io/src/cloud_to_pcl.cpp b/cuda/io/src/cloud_to_pcl.cpp index df0af108565..71f4536a448 100644 --- a/cuda/io/src/cloud_to_pcl.cpp +++ b/cuda/io/src/cloud_to_pcl.cpp @@ -53,16 +53,16 @@ toPCL (const PointCloudAOS &input, output.points.resize (input.points.size ()); for (std::size_t i = 0; i < input.points.size (); ++i) { - output.points[i].x = input.points[i].x; - output.points[i].y = input.points[i].y; - output.points[i].z = input.points[i].z; + output[i].x = input.points[i].x; + output[i].y = input.points[i].y; + output[i].z = input.points[i].z; // Pack RGB into a float - output.points[i].rgb = *(float*)(&input.points[i].rgb); + output[i].rgb = *(float*)(&input.points[i].rgb); - output.points[i].normal_x = normals[i].x; - output.points[i].normal_y = normals[i].y; - output.points[i].normal_z = normals[i].z; - output.points[i].curvature = normals[i].w; + output[i].normal_x = normals[i].x; + output[i].normal_y = normals[i].y; + output[i].normal_z = normals[i].z; + output[i].curvature = normals[i].w; } output.width = input.width; @@ -80,23 +80,7 @@ toPCL (const PointCloudAOS &d_input, input << d_input; thrust::host_vector normals = d_normals; - output.points.resize (input.points.size ()); - for (std::size_t i = 0; i < input.points.size (); ++i) - { - output.points[i].x = input.points[i].x; - output.points[i].y = input.points[i].y; - output.points[i].z = input.points[i].z; - // Pack RGB into a float - output.points[i].rgb = *(float*)(&input.points[i].rgb); - - output.points[i].normal_x = normals[i].x; - output.points[i].normal_y = normals[i].y; - output.points[i].normal_z = normals[i].z; - output.points[i].curvature = normals[i].w; - } - output.width = input.width; - output.height = input.height; - output.is_dense = input.is_dense; + toPCL(input, normals, output); } ////////////////////////////////////////////////////////////////////////// @@ -107,11 +91,11 @@ toPCL (const PointCloudAOS &input, output.points.resize (input.points.size ()); for (std::size_t i = 0; i < input.points.size (); ++i) { - output.points[i].x = input.points[i].x; - output.points[i].y = input.points[i].y; - output.points[i].z = input.points[i].z; + output[i].x = input.points[i].x; + output[i].y = input.points[i].y; + output[i].z = input.points[i].z; // Pack RGB into a float - output.points[i].rgb = *(float*)(&input.points[i].rgb); + output[i].rgb = *(float*)(&input.points[i].rgb); } output.width = input.width; @@ -120,9 +104,9 @@ toPCL (const PointCloudAOS &input, /* for (std::size_t i = 0; i < output.points.size (); ++i) std::cerr << - output.points[i].x << " " << - output.points[i].y << " " << - output.points[i].z << " " << std::endl;*/ + output[i].x << " " << + output[i].y << " " << + output[i].z << " " << std::endl;*/ } ////////////////////////////////////////////////////////////////////////// @@ -133,27 +117,8 @@ toPCL (const PointCloudAOS &input, PointCloudAOS cloud; cloud << input; - output.points.resize (cloud.points.size ()); - for (std::size_t i = 0; i < cloud.points.size (); ++i) - { - output.points[i].x = cloud.points[i].x; - output.points[i].y = cloud.points[i].y; - output.points[i].z = cloud.points[i].z; - // Pack RGB into a float - output.points[i].rgb = *(float*)(&cloud.points[i].rgb); - } - - output.width = cloud.width; - output.height = cloud.height; - output.is_dense = cloud.is_dense; - -/* for (std::size_t i = 0; i < output.points.size (); ++i) - std::cerr << - output.points[i].x << " " << - output.points[i].y << " " << - output.points[i].z << " " << std::endl;*/ + toPCL(cloud, output); } - } // namespace } // namespace diff --git a/doc/tutorials/content/adding_custom_ptype.rst b/doc/tutorials/content/adding_custom_ptype.rst index 6bf3fa9ed11..d123d953d4c 100644 --- a/doc/tutorials/content/adding_custom_ptype.rst +++ b/doc/tutorials/content/adding_custom_ptype.rst @@ -853,10 +853,10 @@ data (SSE padded), together with a test float. cloud.width = 2; cloud.height = 1; - cloud.points[0].test = 1; - cloud.points[1].test = 2; - cloud.points[0].x = cloud.points[0].y = cloud.points[0].z = 0; - cloud.points[1].x = cloud.points[1].y = cloud.points[1].z = 3; + cloud[0].test = 1; + cloud[1].test = 2; + cloud[0].x = cloud[0].y = cloud[0].z = 0; + cloud[1].x = cloud[1].y = cloud[1].z = 3; pcl::io::savePCDFile ("test.pcd", cloud); } diff --git a/doc/tutorials/content/mobile_streaming.rst b/doc/tutorials/content/mobile_streaming.rst index c9ba545e8f0..2437690cdd9 100644 --- a/doc/tutorials/content/mobile_streaming.rst +++ b/doc/tutorials/content/mobile_streaming.rst @@ -193,9 +193,9 @@ that lie outside of the predefined bounding box or contain NaN values. const int conversion_factor = 500; - cloud_buffers.points[j*3 + 0] = static_cast (point.x * conversion_factor); - cloud_buffers.points[j*3 + 1] = static_cast (point.y * conversion_factor); - cloud_buffers.points[j*3 + 2] = static_cast (point.z * conversion_factor); + cloud_buffers[j*3 + 0] = static_cast (point.x * conversion_factor); + cloud_buffers[j*3 + 1] = static_cast (point.y * conversion_factor); + cloud_buffers[j*3 + 2] = static_cast (point.z * conversion_factor); cloud_buffers.rgb[j*3 + 0] = point.r; cloud_buffers.rgb[j*3 + 1] = point.g; diff --git a/doc/tutorials/content/narf_feature_extraction.rst b/doc/tutorials/content/narf_feature_extraction.rst index ea0214e1723..62e2476d6c3 100644 --- a/doc/tutorials/content/narf_feature_extraction.rst +++ b/doc/tutorials/content/narf_feature_extraction.rst @@ -35,7 +35,7 @@ The interesting part begins here: std::vector keypoint_indices2; keypoint_indices2.resize(keypoint_indices.points.size()); for (unsigned int i=0; igetWidth(); @@ -225,12 +225,12 @@ class PeoplePCDApp for(int i = 0; i < rgba_host_.size(); ++i) { const unsigned char *pixel = &rgb_host_[i * 3]; - RGB& rgba = rgba_host_.points[i]; + RGB& rgba = rgba_host_[i]; rgba.r = pixel[0]; rgba.g = pixel[1]; rgba.b = pixel[2]; } - image_device_.upload(&rgba_host_.points[0], s, h, w); + image_device_.upload(&rgba_host_[0], s, h, w); } data_ready_cond_.notify_one(); } diff --git a/doc/tutorials/content/sources/narf_feature_extraction/narf_feature_extraction.cpp b/doc/tutorials/content/sources/narf_feature_extraction/narf_feature_extraction.cpp index 735cd0f5ef5..e3546d7d3d1 100644 --- a/doc/tutorials/content/sources/narf_feature_extraction/narf_feature_extraction.cpp +++ b/doc/tutorials/content/sources/narf_feature_extraction/narf_feature_extraction.cpp @@ -177,8 +177,8 @@ main (int argc, char** argv) // -----Show keypoints in range image widget----- // ---------------------------------------------- //for (std::size_t i=0; i& keypoints = *keypoints_ptr; keypoints.points.resize (keypoint_indices.points.size ()); for (std::size_t i=0; i keypoints_color_handler (keypoints_ptr, 0, 255, 0); viewer.addPointCloud (keypoints_ptr, keypoints_color_handler, "keypoints"); viewer.setPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 7, "keypoints"); @@ -198,7 +198,7 @@ main (int argc, char** argv) std::vector keypoint_indices2; keypoint_indices2.resize (keypoint_indices.points.size ()); for (unsigned int i=0; i& keypoints = *keypoints_ptr; keypoints.points.resize (keypoint_indices.points.size ()); for (std::size_t i=0; i keypoints_color_handler (keypoints_ptr, 0, 255, 0); viewer.addPointCloud (keypoints_ptr, keypoints_color_handler, "keypoints"); diff --git a/doc/tutorials/content/sources/openni_narf_keypoint_extraction/openni_narf_keypoint_extraction.cpp b/doc/tutorials/content/sources/openni_narf_keypoint_extraction/openni_narf_keypoint_extraction.cpp index 09d3f5a2e69..d2ca834f920 100644 --- a/doc/tutorials/content/sources/openni_narf_keypoint_extraction/openni_narf_keypoint_extraction.cpp +++ b/doc/tutorials/content/sources/openni_narf_keypoint_extraction/openni_narf_keypoint_extraction.cpp @@ -186,8 +186,8 @@ int main (int argc, char** argv) // ---------------------------------------------- range_image_widget.showRangeImage (range_image_planar, 0.5f, 10.0f); //for (std::size_t i=0; i color_handler_keypoints (keypoints_cloud_ptr, 0, 255, 0); if (!viewer.updatePointCloud (keypoints_cloud_ptr, color_handler_keypoints, "keypoints")) diff --git a/doc/tutorials/content/sources/pcd_write/pcd_write.cpp b/doc/tutorials/content/sources/pcd_write/pcd_write.cpp index d5862f5d9c5..8ded8808261 100644 --- a/doc/tutorials/content/sources/pcd_write/pcd_write.cpp +++ b/doc/tutorials/content/sources/pcd_write/pcd_write.cpp @@ -15,16 +15,16 @@ int for (std::size_t i = 0; i < cloud.points.size (); ++i) { - cloud.points[i].x = 1024 * rand () / (RAND_MAX + 1.0f); - cloud.points[i].y = 1024 * rand () / (RAND_MAX + 1.0f); - cloud.points[i].z = 1024 * rand () / (RAND_MAX + 1.0f); + cloud[i].x = 1024 * rand () / (RAND_MAX + 1.0f); + cloud[i].y = 1024 * rand () / (RAND_MAX + 1.0f); + cloud[i].z = 1024 * rand () / (RAND_MAX + 1.0f); } pcl::io::savePCDFileASCII ("test_pcd.pcd", cloud); std::cerr << "Saved " << cloud.points.size () << " data points to test_pcd.pcd." << std::endl; for (std::size_t i = 0; i < cloud.points.size (); ++i) - std::cerr << " " << cloud.points[i].x << " " << cloud.points[i].y << " " << cloud.points[i].z << std::endl; + std::cerr << " " << cloud[i].x << " " << cloud[i].y << " " << cloud[i].z << std::endl; return (0); } \ No newline at end of file diff --git a/doc/tutorials/content/sources/range_image_border_extraction/range_image_border_extraction.cpp b/doc/tutorials/content/sources/range_image_border_extraction/range_image_border_extraction.cpp index 6206c99d9cd..f9a652ff78e 100644 --- a/doc/tutorials/content/sources/range_image_border_extraction/range_image_border_extraction.cpp +++ b/doc/tutorials/content/sources/range_image_border_extraction/range_image_border_extraction.cpp @@ -149,12 +149,12 @@ main (int argc, char** argv) { for (int x=0; x< (int)range_image.width; ++x) { - if (border_descriptions.points[y*range_image.width + x].traits[pcl::BORDER_TRAIT__OBSTACLE_BORDER]) - border_points.points.push_back (range_image.points[y*range_image.width + x]); - if (border_descriptions.points[y*range_image.width + x].traits[pcl::BORDER_TRAIT__VEIL_POINT]) - veil_points.points.push_back (range_image.points[y*range_image.width + x]); - if (border_descriptions.points[y*range_image.width + x].traits[pcl::BORDER_TRAIT__SHADOW_BORDER]) - shadow_points.points.push_back (range_image.points[y*range_image.width + x]); + if (border_descriptions[y*range_image.width + x].traits[pcl::BORDER_TRAIT__OBSTACLE_BORDER]) + border_points.points.push_back (range_image[y*range_image.width + x]); + if (border_descriptions[y*range_image.width + x].traits[pcl::BORDER_TRAIT__VEIL_POINT]) + veil_points.points.push_back (range_image[y*range_image.width + x]); + if (border_descriptions[y*range_image.width + x].traits[pcl::BORDER_TRAIT__SHADOW_BORDER]) + shadow_points.points.push_back (range_image[y*range_image.width + x]); } } pcl::visualization::PointCloudColorHandlerCustom border_points_color_handler (border_points_ptr, 0, 255, 0); diff --git a/doc/tutorials/content/sources/vfh_recognition/build_tree.cpp b/doc/tutorials/content/sources/vfh_recognition/build_tree.cpp index ee1bda7ac49..142d221d086 100644 --- a/doc/tutorials/content/sources/vfh_recognition/build_tree.cpp +++ b/doc/tutorials/content/sources/vfh_recognition/build_tree.cpp @@ -50,7 +50,7 @@ loadHist (const boost::filesystem::path &path, vfh_model &vfh) for (std::size_t i = 0; i < fields[vfh_idx].count; ++i) { - vfh.second[i] = point.points[0].histogram[i]; + vfh.second[i] = point[0].histogram[i]; } vfh.first = path.string (); return (true); diff --git a/doc/tutorials/content/sources/vfh_recognition/nearest_neighbors.cpp b/doc/tutorials/content/sources/vfh_recognition/nearest_neighbors.cpp index 936355a99e5..ed247ddb32c 100644 --- a/doc/tutorials/content/sources/vfh_recognition/nearest_neighbors.cpp +++ b/doc/tutorials/content/sources/vfh_recognition/nearest_neighbors.cpp @@ -53,7 +53,7 @@ loadHist (const boost::filesystem::path &path, vfh_model &vfh) for (std::size_t i = 0; i < fields[vfh_idx].count; ++i) { - vfh.second[i] = point.points[0].histogram[i]; + vfh.second[i] = point[0].histogram[i]; } vfh.first = path.string (); return (true); diff --git a/doc/tutorials/content/writing_new_classes.rst b/doc/tutorials/content/writing_new_classes.rst index a405eb7dfad..604cf7bbbe0 100644 --- a/doc/tutorials/content/writing_new_classes.rst +++ b/doc/tutorials/content/writing_new_classes.rst @@ -138,7 +138,7 @@ and save the results to disk. W += weight; } - outcloud.points[point_id].intensity = BF / W; + outcloud[point_id].intensity = BF / W; } // Save filtered output @@ -631,7 +631,7 @@ There're two methods that we need to implement here, namely `applyFilter` and { tree_->radiusSearch (point_id, sigma_s_ * 2, k_indices, k_distances); - output.points[point_id].intensity = computePointWeight (point_id, k_indices, k_distances); + output[point_id].intensity = computePointWeight (point_id, k_indices, k_distances); } } @@ -764,7 +764,7 @@ The implementation file header thus becomes: { tree_->radiusSearch (point_id, sigma_s_ * 2, k_indices, k_distances); - output.points[point_id].intensity = computePointWeight (point_id, k_indices, k_distances); + output[point_id].intensity = computePointWeight (point_id, k_indices, k_distances); } } @@ -879,7 +879,7 @@ The implementation file header thus becomes: { tree_->radiusSearch ((*indices_)[i], sigma_s_ * 2, k_indices, k_distances); - output.points[(*indices_)[i]].intensity = computePointWeight ((*indices_)[i], k_indices, k_distances); + output[(*indices_)[i]].intensity = computePointWeight ((*indices_)[i], k_indices, k_distances); } } @@ -1243,7 +1243,7 @@ And the *bilateral.hpp* likes: tree_->radiusSearch ((*indices_)[i], sigma_s_ * 2, k_indices, k_distances); // Overwrite the intensity value with the computed average - output.points[(*indices_)[i]].intensity = computePointWeight ((*indices_)[i], k_indices, k_distances); + output[(*indices_)[i]].intensity = computePointWeight ((*indices_)[i], k_indices, k_distances); } } diff --git a/examples/features/example_rift_estimation.cpp b/examples/features/example_rift_estimation.cpp index aaa4c8e2d5f..4c3af0435db 100644 --- a/examples/features/example_rift_estimation.cpp +++ b/examples/features/example_rift_estimation.cpp @@ -102,7 +102,7 @@ main (int, char** argv) std::cout<<" with size "< first_descriptor = rift_output.points[0]; + pcl::Histogram<32> first_descriptor = rift_output[0]; std::cout << first_descriptor << std::endl; return 0; } diff --git a/features/include/pcl/features/from_meshes.h b/features/include/pcl/features/from_meshes.h index 8563a0e193e..4aec0a1f8cf 100644 --- a/features/include/pcl/features/from_meshes.h +++ b/features/include/pcl/features/from_meshes.h @@ -34,20 +34,20 @@ namespace pcl if (polygon.vertices.size() < 3) continue; // compute normal for triangle - Eigen::Vector3f vec_a_b = cloud.points[polygon.vertices[0]].getVector3fMap() - cloud.points[polygon.vertices[1]].getVector3fMap(); - Eigen::Vector3f vec_a_c = cloud.points[polygon.vertices[0]].getVector3fMap() - cloud.points[polygon.vertices[2]].getVector3fMap(); + Eigen::Vector3f vec_a_b = cloud[polygon.vertices[0]].getVector3fMap() - cloud[polygon.vertices[1]].getVector3fMap(); + Eigen::Vector3f vec_a_c = cloud[polygon.vertices[0]].getVector3fMap() - cloud[polygon.vertices[2]].getVector3fMap(); Eigen::Vector3f normal = vec_a_b.cross(vec_a_c); - pcl::flipNormalTowardsViewpoint(cloud.points[polygon.vertices[0]], 0.0f, 0.0f, 0.0f, normal(0), normal(1), normal(2)); + pcl::flipNormalTowardsViewpoint(cloud[polygon.vertices[0]], 0.0f, 0.0f, 0.0f, normal(0), normal(1), normal(2)); // add normal to all points in polygon for (const auto& vertex: polygon.vertices) - normals.points[vertex].getNormalVector3fMap() += normal; + normals[vertex].getNormalVector3fMap() += normal; } for (std::size_t i = 0; i < nr_points; ++i) { - normals.points[i].getNormalVector3fMap().normalize(); - pcl::flipNormalTowardsViewpoint(cloud.points[i], 0.0f, 0.0f, 0.0f, normals.points[i].normal_x, normals.points[i].normal_y, normals.points[i].normal_z); + normals[i].getNormalVector3fMap().normalize(); + pcl::flipNormalTowardsViewpoint(cloud[i], 0.0f, 0.0f, 0.0f, normals[i].normal_x, normals[i].normal_y, normals[i].normal_z); } } diff --git a/features/include/pcl/features/impl/boundary.hpp b/features/include/pcl/features/impl/boundary.hpp index ff551328108..46a15f65501 100644 --- a/features/include/pcl/features/impl/boundary.hpp +++ b/features/include/pcl/features/impl/boundary.hpp @@ -54,7 +54,7 @@ pcl::BoundaryEstimation::isBoundaryPoint ( const Eigen::Vector4f &u, const Eigen::Vector4f &v, const float angle_threshold) { - return (isBoundaryPoint (cloud, cloud.points[q_idx], indices, u, v, angle_threshold)); + return (isBoundaryPoint (cloud, cloud[q_idx], indices, u, v, angle_threshold)); } ////////////////////////////////////////////////////////////////////////////////////////////// @@ -78,12 +78,12 @@ pcl::BoundaryEstimation::isBoundaryPoint ( for (const int &index : indices) { - if (!std::isfinite (cloud.points[index].x) || - !std::isfinite (cloud.points[index].y) || - !std::isfinite (cloud.points[index].z)) + if (!std::isfinite (cloud[index].x) || + !std::isfinite (cloud[index].y) || + !std::isfinite (cloud[index].z)) continue; - Eigen::Vector4f delta = cloud.points[index].getVector4fMap () - q_point.getVector4fMap (); + Eigen::Vector4f delta = cloud[index].getVector4fMap () - q_point.getVector4fMap (); if (delta == Eigen::Vector4f::Zero()) continue; @@ -131,7 +131,7 @@ pcl::BoundaryEstimation::computeFeature (PointClou { if (this->searchForNeighbors ((*indices_)[idx], search_parameter_, nn_indices, nn_dists) == 0) { - output.points[idx].boundary_point = std::numeric_limits::quiet_NaN (); + output[idx].boundary_point = std::numeric_limits::quiet_NaN (); output.is_dense = false; continue; } @@ -142,7 +142,7 @@ pcl::BoundaryEstimation::computeFeature (PointClou getCoordinateSystemOnPlane (normals_->points[(*indices_)[idx]], u, v); // Estimate whether the point is lying on a boundary surface or not - output.points[idx].boundary_point = isBoundaryPoint (*surface_, input_->points[(*indices_)[idx]], nn_indices, u, v, angle_threshold_); + output[idx].boundary_point = isBoundaryPoint (*surface_, input_->points[(*indices_)[idx]], nn_indices, u, v, angle_threshold_); } } else @@ -153,7 +153,7 @@ pcl::BoundaryEstimation::computeFeature (PointClou if (!isFinite ((*input_)[(*indices_)[idx]]) || this->searchForNeighbors ((*indices_)[idx], search_parameter_, nn_indices, nn_dists) == 0) { - output.points[idx].boundary_point = std::numeric_limits::quiet_NaN (); + output[idx].boundary_point = std::numeric_limits::quiet_NaN (); output.is_dense = false; continue; } @@ -164,7 +164,7 @@ pcl::BoundaryEstimation::computeFeature (PointClou getCoordinateSystemOnPlane (normals_->points[(*indices_)[idx]], u, v); // Estimate whether the point is lying on a boundary surface or not - output.points[idx].boundary_point = isBoundaryPoint (*surface_, input_->points[(*indices_)[idx]], nn_indices, u, v, angle_threshold_); + output[idx].boundary_point = isBoundaryPoint (*surface_, input_->points[(*indices_)[idx]], nn_indices, u, v, angle_threshold_); } } } diff --git a/features/include/pcl/features/impl/brisk_2d.hpp b/features/include/pcl/features/impl/brisk_2d.hpp index bbf3687943a..4283b8eef00 100644 --- a/features/include/pcl/features/impl/brisk_2d.hpp +++ b/features/include/pcl/features/impl/brisk_2d.hpp @@ -248,7 +248,7 @@ BRISK2DEstimation::smoothedIntensity const int r_x_1 = (1024 - r_x); const int r_y_1 = (1024 - r_y); - //+const unsigned char* ptr = static_cast (&image.points[0].r) + x + y * imagecols; + //+const unsigned char* ptr = static_cast (&image[0].r) + x + y * imagecols; const unsigned char* ptr = static_cast(&image[0]) + x + y * imagecols; // just interpolate: @@ -311,7 +311,7 @@ BRISK2DEstimation::smoothedIntensity { // now the calculation: - //+const unsigned char* ptr = static_cast (&image.points[0].r) + x_left + imagecols * y_top; + //+const unsigned char* ptr = static_cast (&image[0].r) + x_left + imagecols * y_top; const unsigned char* ptr = static_cast(&image[0]) + x_left + imagecols * y_top; // first the corners: @@ -373,7 +373,7 @@ BRISK2DEstimation::smoothedIntensity // now the calculation: - //const unsigned char* ptr = static_cast (&image.points[0].r) + x_left + imagecols * y_top; + //const unsigned char* ptr = static_cast (&image[0].r) + x_left + imagecols * y_top; const unsigned char* ptr = static_cast(&image[0]) + x_left + imagecols * y_top; // first row: @@ -555,7 +555,7 @@ BRISK2DEstimation::compute ( //output.height = 1; for (std::size_t k = 0; k < ksize; k++) { - unsigned char* ptr = &output.points[k].descriptor[0]; + unsigned char* ptr = &output[k].descriptor[0]; int theta; KeypointT &kp = keypoints_->points[k]; @@ -661,8 +661,8 @@ BRISK2DEstimation::compute ( //ptr += strings_; //// Account for the scale + orientation; - //ptr += sizeof (output.points[0].scale); - //ptr += sizeof (output.points[0].orientation); + //ptr += sizeof (output[0].scale); + //ptr += sizeof (output[0].orientation); } // we do not change the denseness diff --git a/features/include/pcl/features/impl/crh.hpp b/features/include/pcl/features/impl/crh.hpp index 4146c4463b8..48902b0277e 100644 --- a/features/include/pcl/features/impl/crh.hpp +++ b/features/include/pcl/features/impl/crh.hpp @@ -88,8 +88,8 @@ pcl::CRHEstimation::computeFeature (PointCloudOut for (std::size_t i = 0; i < indices_->size (); i++) { - grid.points[i].getVector4fMap () = surface_->points[(*indices_)[i]].getVector4fMap (); - grid.points[i].getNormalVector4fMap () = normals_->points[(*indices_)[i]].getNormalVector4fMap (); + grid[i].getVector4fMap () = surface_->points[(*indices_)[i]].getVector4fMap (); + grid[i].getNormalVector4fMap () = normals_->points[(*indices_)[i]].getNormalVector4fMap (); } pcl::transformPointCloudWithNormals (grid, grid, transformPC); @@ -123,15 +123,15 @@ pcl::CRHEstimation::computeFeature (PointCloudOut output.points.resize (1); output.width = output.height = 1; - output.points[0].histogram[0] = freq_data[0].r; //dc + output[0].histogram[0] = freq_data[0].r; //dc int k = 1; for (int i = 1; i < (nbins / 2); i++, k += 2) { - output.points[0].histogram[k] = freq_data[i].r; - output.points[0].histogram[k + 1] = freq_data[i].i; + output[0].histogram[k] = freq_data[i].r; + output[0].histogram[k + 1] = freq_data[i].i; } - output.points[0].histogram[nbins - 1] = freq_data[nbins / 2].r; //nyquist + output[0].histogram[nbins - 1] = freq_data[nbins / 2].r; //nyquist } #define PCL_INSTANTIATE_CRHEstimation(T,NT,OutT) template class PCL_EXPORTS pcl::CRHEstimation; diff --git a/features/include/pcl/features/impl/cvfh.hpp b/features/include/pcl/features/impl/cvfh.hpp index 499d78e8157..6fbc6450de6 100644 --- a/features/include/pcl/features/impl/cvfh.hpp +++ b/features/include/pcl/features/impl/cvfh.hpp @@ -127,8 +127,8 @@ pcl::CVFHEstimation::extractEuclideanClustersSmoot //processed[nn_indices[j]] = true; // [-1;1] - const double dot_p = normals.points[seed_queue[idx]].getNormalVector3fMap().dot( - normals.points[nn_indices[j]].getNormalVector3fMap()); + const double dot_p = normals[seed_queue[idx]].getNormalVector3fMap().dot( + normals[nn_indices[j]].getNormalVector3fMap()); if (std::acos (dot_p) < eps_angle) { @@ -167,7 +167,7 @@ pcl::CVFHEstimation::filterNormalsWithHighCurvatur for (const int &index : indices_to_use) { - if (cloud.points[index].curvature > threshold) + if (cloud[index].curvature > threshold) { indices_out[out] = index; out++; @@ -303,7 +303,7 @@ pcl::CVFHEstimation::computeFeature (PointCloudOut vfh.setCentroidToUse (centroids_dominant_orientations_[i]); pcl::PointCloud vfh_signature; vfh.compute (vfh_signature); - output.points[i] = vfh_signature.points[0]; + output[i] = vfh_signature[0]; } } else @@ -323,7 +323,7 @@ pcl::CVFHEstimation::computeFeature (PointCloudOut output.points.resize (1); output.width = 1; - output.points[0] = vfh_signature.points[0]; + output[0] = vfh_signature[0]; } } diff --git a/features/include/pcl/features/impl/don.hpp b/features/include/pcl/features/impl/don.hpp index e333d667e4c..6d0452f3e12 100644 --- a/features/include/pcl/features/impl/don.hpp +++ b/features/include/pcl/features/impl/don.hpp @@ -87,14 +87,14 @@ pcl::DifferenceOfNormalsEstimation::computeFeature //perform DoN subtraction and return results for (std::size_t point_id = 0; point_id < input_->points.size (); ++point_id) { - output.points[point_id].getNormalVector3fMap () = (input_normals_small_->points[point_id].getNormalVector3fMap () + output[point_id].getNormalVector3fMap () = (input_normals_small_->points[point_id].getNormalVector3fMap () - input_normals_large_->points[point_id].getNormalVector3fMap ()) / 2.0; - if(!std::isfinite (output.points[point_id].normal_x) || - !std::isfinite (output.points[point_id].normal_y) || - !std::isfinite (output.points[point_id].normal_z)){ - output.points[point_id].getNormalVector3fMap () = Eigen::Vector3f(0,0,0); + if(!std::isfinite (output[point_id].normal_x) || + !std::isfinite (output[point_id].normal_y) || + !std::isfinite (output[point_id].normal_z)){ + output[point_id].getNormalVector3fMap () = Eigen::Vector3f(0,0,0); } - output.points[point_id].curvature = output.points[point_id].getNormalVector3fMap ().norm(); + output[point_id].curvature = output[point_id].getNormalVector3fMap ().norm(); } } diff --git a/features/include/pcl/features/impl/esf.hpp b/features/include/pcl/features/impl/esf.hpp index 58ef720191d..c3ecb5674f4 100644 --- a/features/include/pcl/features/impl/esf.hpp +++ b/features/include/pcl/features/impl/esf.hpp @@ -98,9 +98,9 @@ pcl::ESFEstimation::computeESF ( continue; } - Eigen::Vector4f p1 = pc.points[index1].getVector4fMap (); - Eigen::Vector4f p2 = pc.points[index2].getVector4fMap (); - Eigen::Vector4f p3 = pc.points[index3].getVector4fMap (); + Eigen::Vector4f p1 = pc[index1].getVector4fMap (); + Eigen::Vector4f p2 = pc[index2].getVector4fMap (); + Eigen::Vector4f p3 = pc[index3].getVector4fMap (); // A3 Eigen::Vector4f v21 (p2 - p1); @@ -138,9 +138,9 @@ pcl::ESFEstimation::computeESF ( } // D2 - d2v.push_back (pcl::euclideanDistance (pc.points[index1], pc.points[index2])); - d2v.push_back (pcl::euclideanDistance (pc.points[index1], pc.points[index3])); - d2v.push_back (pcl::euclideanDistance (pc.points[index2], pc.points[index3])); + d2v.push_back (pcl::euclideanDistance (pc[index1], pc[index2])); + d2v.push_back (pcl::euclideanDistance (pc[index1], pc[index3])); + d2v.push_back (pcl::euclideanDistance (pc[index2], pc[index3])); int vxlcnt_sum = 0; int p_cnt = 0; @@ -426,9 +426,9 @@ pcl::ESFEstimation::voxelize9 (PointCloudIn &cluster) { for (std::size_t i = 0; i < cluster.points.size (); ++i) { - int xx = cluster.points[i].x<0.0? static_cast(std::floor(cluster.points[i].x)+GRIDSIZE_H) : static_cast(std::ceil(cluster.points[i].x)+GRIDSIZE_H-1); - int yy = cluster.points[i].y<0.0? static_cast(std::floor(cluster.points[i].y)+GRIDSIZE_H) : static_cast(std::ceil(cluster.points[i].y)+GRIDSIZE_H-1); - int zz = cluster.points[i].z<0.0? static_cast(std::floor(cluster.points[i].z)+GRIDSIZE_H) : static_cast(std::ceil(cluster.points[i].z)+GRIDSIZE_H-1); + int xx = cluster[i].x<0.0? static_cast(std::floor(cluster[i].x)+GRIDSIZE_H) : static_cast(std::ceil(cluster[i].x)+GRIDSIZE_H-1); + int yy = cluster[i].y<0.0? static_cast(std::floor(cluster[i].y)+GRIDSIZE_H) : static_cast(std::ceil(cluster[i].y)+GRIDSIZE_H-1); + int zz = cluster[i].z<0.0? static_cast(std::floor(cluster[i].z)+GRIDSIZE_H) : static_cast(std::ceil(cluster[i].z)+GRIDSIZE_H-1); for (int x = -1; x < 2; x++) for (int y = -1; y < 2; y++) @@ -454,9 +454,9 @@ pcl::ESFEstimation::cleanup9 (PointCloudIn &cluster) { for (std::size_t i = 0; i < cluster.points.size (); ++i) { - int xx = cluster.points[i].x<0.0? static_cast(std::floor(cluster.points[i].x)+GRIDSIZE_H) : static_cast(std::ceil(cluster.points[i].x)+GRIDSIZE_H-1); - int yy = cluster.points[i].y<0.0? static_cast(std::floor(cluster.points[i].y)+GRIDSIZE_H) : static_cast(std::ceil(cluster.points[i].y)+GRIDSIZE_H-1); - int zz = cluster.points[i].z<0.0? static_cast(std::floor(cluster.points[i].z)+GRIDSIZE_H) : static_cast(std::ceil(cluster.points[i].z)+GRIDSIZE_H-1); + int xx = cluster[i].x<0.0? static_cast(std::floor(cluster[i].x)+GRIDSIZE_H) : static_cast(std::ceil(cluster[i].x)+GRIDSIZE_H-1); + int yy = cluster[i].y<0.0? static_cast(std::floor(cluster[i].y)+GRIDSIZE_H) : static_cast(std::ceil(cluster[i].y)+GRIDSIZE_H-1); + int zz = cluster[i].z<0.0? static_cast(std::floor(cluster[i].z)+GRIDSIZE_H) : static_cast(std::ceil(cluster[i].z)+GRIDSIZE_H-1); for (int x = -1; x < 2; x++) for (int y = -1; y < 2; y++) @@ -489,7 +489,7 @@ pcl::ESFEstimation::scale_points_unit_sphere ( for (std::size_t i = 0; i < local_cloud_.points.size (); ++i) { - float d = pcl::euclideanDistance(cog,local_cloud_.points[i]); + float d = pcl::euclideanDistance(cog,local_cloud_[i]); if (d > max_distance) max_distance = d; } @@ -546,7 +546,7 @@ pcl::ESFEstimation::computeFeature (PointCloudOut &output) output.height = 1; for (std::size_t d = 0; d < hist.size (); ++d) - output.points[0].histogram[d] = hist[d]; + output[0].histogram[d] = hist[d]; } #define PCL_INSTANTIATE_ESFEstimation(T,OutT) template class PCL_EXPORTS pcl::ESFEstimation; diff --git a/features/include/pcl/features/impl/fpfh.hpp b/features/include/pcl/features/impl/fpfh.hpp index 08e8ac8b86f..4608bdb0899 100644 --- a/features/include/pcl/features/impl/fpfh.hpp +++ b/features/include/pcl/features/impl/fpfh.hpp @@ -52,8 +52,8 @@ pcl::FPFHEstimation::computePairFeatures ( const pcl::PointCloud &cloud, const pcl::PointCloud &normals, int p_idx, int q_idx, float &f1, float &f2, float &f3, float &f4) { - pcl::computePairFeatures (cloud.points[p_idx].getVector4fMap (), normals.points[p_idx].getNormalVector4fMap (), - cloud.points[q_idx].getVector4fMap (), normals.points[q_idx].getNormalVector4fMap (), + pcl::computePairFeatures (cloud[p_idx].getVector4fMap (), normals[p_idx].getNormalVector4fMap (), + cloud[q_idx].getVector4fMap (), normals[q_idx].getNormalVector4fMap (), f1, f2, f3, f4); return (true); } @@ -254,7 +254,7 @@ pcl::FPFHEstimation::computeFeature (PointCloudOut if (this->searchForNeighbors ((*indices_)[idx], search_parameter_, nn_indices, nn_dists) == 0) { for (Eigen::Index d = 0; d < fpfh_histogram_.size (); ++d) - output.points[idx].histogram[d] = std::numeric_limits::quiet_NaN (); + output[idx].histogram[d] = std::numeric_limits::quiet_NaN (); output.is_dense = false; continue; @@ -269,7 +269,7 @@ pcl::FPFHEstimation::computeFeature (PointCloudOut weightPointSPFHSignature (hist_f1_, hist_f2_, hist_f3_, nn_indices, nn_dists, fpfh_histogram_); // ...and copy it into the output cloud - std::copy_n(fpfh_histogram_.data (), fpfh_histogram_.size (), output.points[idx].histogram); + std::copy_n(fpfh_histogram_.data (), fpfh_histogram_.size (), output[idx].histogram); } } else @@ -281,7 +281,7 @@ pcl::FPFHEstimation::computeFeature (PointCloudOut this->searchForNeighbors ((*indices_)[idx], search_parameter_, nn_indices, nn_dists) == 0) { for (Eigen::Index d = 0; d < fpfh_histogram_.size (); ++d) - output.points[idx].histogram[d] = std::numeric_limits::quiet_NaN (); + output[idx].histogram[d] = std::numeric_limits::quiet_NaN (); output.is_dense = false; continue; @@ -296,7 +296,7 @@ pcl::FPFHEstimation::computeFeature (PointCloudOut weightPointSPFHSignature (hist_f1_, hist_f2_, hist_f3_, nn_indices, nn_dists, fpfh_histogram_); // ...and copy it into the output cloud - std::copy_n(fpfh_histogram_.data (), fpfh_histogram_.size (), output.points[idx].histogram); + std::copy_n(fpfh_histogram_.data (), fpfh_histogram_.size (), output[idx].histogram); } } } diff --git a/features/include/pcl/features/impl/fpfh_omp.hpp b/features/include/pcl/features/impl/fpfh_omp.hpp index 3aab1328e14..c319ded09c9 100644 --- a/features/include/pcl/features/impl/fpfh_omp.hpp +++ b/features/include/pcl/features/impl/fpfh_omp.hpp @@ -149,7 +149,7 @@ pcl::FPFHEstimationOMP::computeFeature (PointCloud this->searchForNeighbors ((*indices_)[idx], search_parameter_, nn_indices, nn_dists) == 0) { for (int d = 0; d < nr_bins; ++d) - output.points[idx].histogram[d] = std::numeric_limits::quiet_NaN (); + output[idx].histogram[d] = std::numeric_limits::quiet_NaN (); output.is_dense = false; continue; @@ -167,7 +167,7 @@ pcl::FPFHEstimationOMP::computeFeature (PointCloud // ...and copy it into the output cloud for (int d = 0; d < nr_bins; ++d) - output.points[idx].histogram[d] = fpfh_histogram[d]; + output[idx].histogram[d] = fpfh_histogram[d]; } } diff --git a/features/include/pcl/features/impl/gasd.hpp b/features/include/pcl/features/impl/gasd.hpp index 02223d6b798..056da6e02a3 100644 --- a/features/include/pcl/features/impl/gasd.hpp +++ b/features/include/pcl/features/impl/gasd.hpp @@ -240,7 +240,7 @@ pcl::GASDEstimation::copyShapeHistogramsToOutput (const std { const std::size_t idx = ( (i + 1) * (grid_size + 2) + (j + 1)) * (grid_size + 2) + (k + 1); - std::copy (hists[idx].data () + 1, hists[idx].data () + hists_size + 1, output.points[0].histogram + pos); + std::copy (hists[idx].data () + 1, hists[idx].data () + hists_size + 1, output[0].histogram + pos); pos += hists_size; } } @@ -304,7 +304,7 @@ pcl::GASDEstimation::computeFeature (PointCloudOut &output) copyShapeHistogramsToOutput (shape_grid_size, shape_hists_size_, shape_hists, output, pos_); // set remaining values of the descriptor to zero (if any) - std::fill (output.points[0].histogram + pos_, output.points[0].histogram + output.points[0].descriptorSize (), 0.0f); + std::fill (output[0].histogram + pos_, output[0].histogram + output[0].descriptorSize (), 0.0f); } ////////////////////////////////////////////////////////////////////////////////////////////// @@ -326,7 +326,7 @@ pcl::GASDColorEstimation::copyColorHistogramsToOutput (cons hists[idx][1] += hists[idx][hists_size + 1]; hists[idx][hists_size] += hists[idx][0]; - std::copy (hists[idx].data () + 1, hists[idx].data () + hists_size + 1, output.points[0].histogram + pos); + std::copy (hists[idx].data () + 1, hists[idx].data () + hists_size + 1, output[0].histogram + pos); pos += hists_size; } } @@ -392,7 +392,7 @@ pcl::GASDColorEstimation::computeFeature (PointCloudOut &ou copyColorHistogramsToOutput (color_grid_size, color_hists_size_, color_hists, output, pos_); // set remaining values of the descriptor to zero (if any) - std::fill (output.points[0].histogram + pos_, output.points[0].histogram + output.points[0].descriptorSize (), 0.0f); + std::fill (output[0].histogram + pos_, output[0].histogram + output[0].descriptorSize (), 0.0f); } #define PCL_INSTANTIATE_GASDEstimation(InT, OutT) template class PCL_EXPORTS pcl::GASDEstimation; diff --git a/features/include/pcl/features/impl/gfpfh.hpp b/features/include/pcl/features/impl/gfpfh.hpp index 08a99213531..5eb1435b494 100644 --- a/features/include/pcl/features/impl/gfpfh.hpp +++ b/features/include/pcl/features/impl/gfpfh.hpp @@ -130,7 +130,7 @@ pcl::GFPFHEstimation::computeFeature (PointCloudOu output.width = 1; output.height = 1; output.points.resize (1); - std::copy (gfpfh_histogram.cbegin (), gfpfh_histogram.cend (), output.points[0].histogram); + std::copy (gfpfh_histogram.cbegin (), gfpfh_histogram.cend (), output[0].histogram); } ////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/features/include/pcl/features/impl/grsd.hpp b/features/include/pcl/features/impl/grsd.hpp index daf15ec8469..a5d9675dc37 100644 --- a/features/include/pcl/features/impl/grsd.hpp +++ b/features/include/pcl/features/impl/grsd.hpp @@ -118,7 +118,7 @@ pcl::GRSDEstimation::computeFeature (PointCloudOut int nrf = 0; for (int i = 0; i < NR_CLASS + 1; i++) for (int j = i; j < NR_CLASS + 1; j++) - output.points[0].histogram[nrf++] = transition_matrix (i, j) + transition_matrix (j, i); + output[0].histogram[nrf++] = transition_matrix (i, j) + transition_matrix (j, i); } #define PCL_INSTANTIATE_GRSDEstimation(T,NT,OutT) template class PCL_EXPORTS pcl::GRSDEstimation; diff --git a/features/include/pcl/features/impl/integral_image_normal.hpp b/features/include/pcl/features/impl/integral_image_normal.hpp index 8dd65609546..9356d82592f 100644 --- a/features/include/pcl/features/impl/integral_image_normal.hpp +++ b/features/include/pcl/features/impl/integral_image_normal.hpp @@ -1042,23 +1042,23 @@ pcl::IntegralImageNormalEstimation::computeFeaturePart (con unsigned v = pt_index / input_->width; if (v < border || v > bottom) { - output.points[idx].getNormalVector3fMap ().setConstant (bad_point); - output.points[idx].curvature = bad_point; + output[idx].getNormalVector3fMap ().setConstant (bad_point); + output[idx].curvature = bad_point; continue; } if (u < border || u > right) { - output.points[idx].getNormalVector3fMap ().setConstant (bad_point); - output.points[idx].curvature = bad_point; + output[idx].getNormalVector3fMap ().setConstant (bad_point); + output[idx].curvature = bad_point; continue; } const float depth = input_->points[pt_index].z; if (!std::isfinite (depth)) { - output.points[idx].getNormalVector3fMap ().setConstant (bad_point); - output.points[idx].curvature = bad_point; + output[idx].getNormalVector3fMap ().setConstant (bad_point); + output[idx].curvature = bad_point; continue; } @@ -1086,15 +1086,15 @@ pcl::IntegralImageNormalEstimation::computeFeaturePart (con unsigned v = pt_index / input_->width; if (v < border || v > bottom) { - output.points[idx].getNormalVector3fMap ().setConstant (bad_point); - output.points[idx].curvature = bad_point; + output[idx].getNormalVector3fMap ().setConstant (bad_point); + output[idx].curvature = bad_point; continue; } if (u < border || u > right) { - output.points[idx].getNormalVector3fMap ().setConstant (bad_point); - output.points[idx].curvature = bad_point; + output[idx].getNormalVector3fMap ().setConstant (bad_point); + output[idx].curvature = bad_point; continue; } diff --git a/features/include/pcl/features/impl/intensity_gradient.hpp b/features/include/pcl/features/impl/intensity_gradient.hpp index e8cf3353e18..bac11cdb12b 100644 --- a/features/include/pcl/features/impl/intensity_gradient.hpp +++ b/features/include/pcl/features/impl/intensity_gradient.hpp @@ -62,7 +62,7 @@ pcl::IntensityGradientEstimation (indices_->size ()); ++idx) { - PointOutT &p_out = output.points[idx]; + PointOutT &p_out = output[idx]; if (!this->searchForNeighbors ((*indices_)[idx], search_parameter_, nn_indices, nn_dists)) { @@ -199,7 +199,7 @@ pcl::IntensityGradientEstimation (indices_->size ()); ++idx) { - PointOutT &p_out = output.points[idx]; + PointOutT &p_out = output[idx]; if (!isFinite ((*surface_) [(*indices_)[idx]]) || !this->searchForNeighbors ((*indices_)[idx], search_parameter_, nn_indices, nn_dists)) { diff --git a/features/include/pcl/features/impl/intensity_spin.hpp b/features/include/pcl/features/impl/intensity_spin.hpp index 36f4fb7d507..89114bb1f11 100644 --- a/features/include/pcl/features/impl/intensity_spin.hpp +++ b/features/include/pcl/features/impl/intensity_spin.hpp @@ -61,8 +61,8 @@ pcl::IntensitySpinEstimation::computeIntensitySpinImage ( float max_intensity = -std::numeric_limits::max (); for (int idx = 0; idx < k; ++idx) { - min_intensity = (std::min) (min_intensity, cloud.points[indices[idx]].intensity); - max_intensity = (std::max) (max_intensity, cloud.points[indices[idx]].intensity); + min_intensity = (std::min) (min_intensity, cloud[indices[idx]].intensity); + max_intensity = (std::max) (max_intensity, cloud[indices[idx]].intensity); } float constant = 1.0f / (2.0f * sigma_ * sigma_); @@ -74,7 +74,7 @@ pcl::IntensitySpinEstimation::computeIntensitySpinImage ( const float eps = std::numeric_limits::epsilon (); float d = static_cast (nr_distance_bins) * std::sqrt (squared_distances[idx]) / (radius + eps); float i = static_cast (nr_intensity_bins) * - (cloud.points[indices[idx]].intensity - min_intensity) / (max_intensity - min_intensity + eps); + (cloud[indices[idx]].intensity - min_intensity) / (max_intensity - min_intensity + eps); if (sigma == 0) { @@ -152,7 +152,7 @@ pcl::IntensitySpinEstimation::computeFeature (PointCloudOut if (k == 0) { for (int bin = 0; bin < nr_intensity_bins_ * nr_distance_bins_; ++bin) - output.points[idx].histogram[bin] = std::numeric_limits::quiet_NaN (); + output[idx].histogram[bin] = std::numeric_limits::quiet_NaN (); output.is_dense = false; continue; } @@ -164,7 +164,7 @@ pcl::IntensitySpinEstimation::computeFeature (PointCloudOut std::size_t bin = 0; for (Eigen::Index bin_j = 0; bin_j < intensity_spin_image.cols (); ++bin_j) for (Eigen::Index bin_i = 0; bin_i < intensity_spin_image.rows (); ++bin_i) - output.points[idx].histogram[bin++] = intensity_spin_image (bin_i, bin_j); + output[idx].histogram[bin++] = intensity_spin_image (bin_i, bin_j); } } diff --git a/features/include/pcl/features/impl/linear_least_squares_normal.hpp b/features/include/pcl/features/impl/linear_least_squares_normal.hpp index 73bd0e32b5c..bcb08d5e54f 100644 --- a/features/include/pcl/features/impl/linear_least_squares_normal.hpp +++ b/features/include/pcl/features/impl/linear_least_squares_normal.hpp @@ -245,19 +245,19 @@ pcl::LinearLeastSquaresNormalEstimation::computeFeature (Po if (length <= 0.0f) { - output.points[index].normal_x = bad_point; - output.points[index].normal_y = bad_point; - output.points[index].normal_z = bad_point; - output.points[index].curvature = bad_point; + output[index].normal_x = bad_point; + output[index].normal_y = bad_point; + output[index].normal_z = bad_point; + output[index].curvature = bad_point; } else { const float normInv = 1.0f / std::sqrt (length); - output.points[index].normal_x = nx * normInv; - output.points[index].normal_y = ny * normInv; - output.points[index].normal_z = nz * normInv; - output.points[index].curvature = bad_point; + output[index].normal_x = nx * normInv; + output[index].normal_y = ny * normInv; + output[index].normal_z = nz * normInv; + output[index].curvature = bad_point; } } } diff --git a/features/include/pcl/features/impl/moment_invariants.hpp b/features/include/pcl/features/impl/moment_invariants.hpp index 14baabc6d89..d4899aaaa0f 100644 --- a/features/include/pcl/features/impl/moment_invariants.hpp +++ b/features/include/pcl/features/impl/moment_invariants.hpp @@ -60,9 +60,9 @@ pcl::MomentInvariantsEstimation::computePointMomentInvarian for (const int &index : indices) { // Demean the points - temp_pt_[0] = cloud.points[index].x - xyz_centroid_[0]; - temp_pt_[1] = cloud.points[index].y - xyz_centroid_[1]; - temp_pt_[2] = cloud.points[index].z - xyz_centroid_[2]; + temp_pt_[0] = cloud[index].x - xyz_centroid_[0]; + temp_pt_[1] = cloud[index].y - xyz_centroid_[1]; + temp_pt_[2] = cloud[index].z - xyz_centroid_[2]; mu200 += temp_pt_[0] * temp_pt_[0]; mu020 += temp_pt_[1] * temp_pt_[1]; @@ -129,13 +129,13 @@ pcl::MomentInvariantsEstimation::computeFeature (PointCloud { if (this->searchForNeighbors ((*indices_)[idx], search_parameter_, nn_indices, nn_dists) == 0) { - output.points[idx].j1 = output.points[idx].j2 = output.points[idx].j3 = std::numeric_limits::quiet_NaN (); + output[idx].j1 = output[idx].j2 = output[idx].j3 = std::numeric_limits::quiet_NaN (); output.is_dense = false; continue; } computePointMomentInvariants (*surface_, nn_indices, - output.points[idx].j1, output.points[idx].j2, output.points[idx].j3); + output[idx].j1, output[idx].j2, output[idx].j3); } } else @@ -146,13 +146,13 @@ pcl::MomentInvariantsEstimation::computeFeature (PointCloud if (!isFinite ((*input_)[(*indices_)[idx]]) || this->searchForNeighbors ((*indices_)[idx], search_parameter_, nn_indices, nn_dists) == 0) { - output.points[idx].j1 = output.points[idx].j2 = output.points[idx].j3 = std::numeric_limits::quiet_NaN (); + output[idx].j1 = output[idx].j2 = output[idx].j3 = std::numeric_limits::quiet_NaN (); output.is_dense = false; continue; } computePointMomentInvariants (*surface_, nn_indices, - output.points[idx].j1, output.points[idx].j2, output.points[idx].j3); + output[idx].j1, output[idx].j2, output[idx].j3); } } } diff --git a/features/include/pcl/features/impl/normal_3d.hpp b/features/include/pcl/features/impl/normal_3d.hpp index ffd1ff55055..1dd5c33d423 100644 --- a/features/include/pcl/features/impl/normal_3d.hpp +++ b/features/include/pcl/features/impl/normal_3d.hpp @@ -60,16 +60,16 @@ pcl::NormalEstimation::computeFeature (PointCloudOut &outpu for (std::size_t idx = 0; idx < indices_->size (); ++idx) { if (this->searchForNeighbors ((*indices_)[idx], search_parameter_, nn_indices, nn_dists) == 0 || - !computePointNormal (*surface_, nn_indices, output.points[idx].normal[0], output.points[idx].normal[1], output.points[idx].normal[2], output.points[idx].curvature)) + !computePointNormal (*surface_, nn_indices, output[idx].normal[0], output[idx].normal[1], output[idx].normal[2], output[idx].curvature)) { - output.points[idx].normal[0] = output.points[idx].normal[1] = output.points[idx].normal[2] = output.points[idx].curvature = std::numeric_limits::quiet_NaN (); + output[idx].normal[0] = output[idx].normal[1] = output[idx].normal[2] = output[idx].curvature = std::numeric_limits::quiet_NaN (); output.is_dense = false; continue; } flipNormalTowardsViewpoint (input_->points[(*indices_)[idx]], vpx_, vpy_, vpz_, - output.points[idx].normal[0], output.points[idx].normal[1], output.points[idx].normal[2]); + output[idx].normal[0], output[idx].normal[1], output[idx].normal[2]); } } @@ -80,16 +80,16 @@ pcl::NormalEstimation::computeFeature (PointCloudOut &outpu { if (!isFinite ((*input_)[(*indices_)[idx]]) || this->searchForNeighbors ((*indices_)[idx], search_parameter_, nn_indices, nn_dists) == 0 || - !computePointNormal (*surface_, nn_indices, output.points[idx].normal[0], output.points[idx].normal[1], output.points[idx].normal[2], output.points[idx].curvature)) + !computePointNormal (*surface_, nn_indices, output[idx].normal[0], output[idx].normal[1], output[idx].normal[2], output[idx].curvature)) { - output.points[idx].normal[0] = output.points[idx].normal[1] = output.points[idx].normal[2] = output.points[idx].curvature = std::numeric_limits::quiet_NaN (); + output[idx].normal[0] = output[idx].normal[1] = output[idx].normal[2] = output[idx].curvature = std::numeric_limits::quiet_NaN (); output.is_dense = false; continue; } flipNormalTowardsViewpoint (input_->points[(*indices_)[idx]], vpx_, vpy_, vpz_, - output.points[idx].normal[0], output.points[idx].normal[1], output.points[idx].normal[2]); + output[idx].normal[0], output[idx].normal[1], output[idx].normal[2]); } } diff --git a/features/include/pcl/features/impl/normal_3d_omp.hpp b/features/include/pcl/features/impl/normal_3d_omp.hpp index 42abc887c47..5420de574e0 100644 --- a/features/include/pcl/features/impl/normal_3d_omp.hpp +++ b/features/include/pcl/features/impl/normal_3d_omp.hpp @@ -80,20 +80,20 @@ pcl::NormalEstimationOMP::computeFeature (PointCloudOut &ou { Eigen::Vector4f n; if (this->searchForNeighbors ((*indices_)[idx], search_parameter_, nn_indices, nn_dists) == 0 || - !pcl::computePointNormal (*surface_, nn_indices, n, output.points[idx].curvature)) + !pcl::computePointNormal (*surface_, nn_indices, n, output[idx].curvature)) { - output.points[idx].normal[0] = output.points[idx].normal[1] = output.points[idx].normal[2] = output.points[idx].curvature = std::numeric_limits::quiet_NaN (); + output[idx].normal[0] = output[idx].normal[1] = output[idx].normal[2] = output[idx].curvature = std::numeric_limits::quiet_NaN (); output.is_dense = false; continue; } - output.points[idx].normal_x = n[0]; - output.points[idx].normal_y = n[1]; - output.points[idx].normal_z = n[2]; + output[idx].normal_x = n[0]; + output[idx].normal_y = n[1]; + output[idx].normal_z = n[2]; flipNormalTowardsViewpoint (input_->points[(*indices_)[idx]], vpx_, vpy_, vpz_, - output.points[idx].normal[0], output.points[idx].normal[1], output.points[idx].normal[2]); + output[idx].normal[0], output[idx].normal[1], output[idx].normal[2]); } } @@ -110,20 +110,20 @@ pcl::NormalEstimationOMP::computeFeature (PointCloudOut &ou Eigen::Vector4f n; if (!isFinite ((*input_)[(*indices_)[idx]]) || this->searchForNeighbors ((*indices_)[idx], search_parameter_, nn_indices, nn_dists) == 0 || - !pcl::computePointNormal (*surface_, nn_indices, n, output.points[idx].curvature)) + !pcl::computePointNormal (*surface_, nn_indices, n, output[idx].curvature)) { - output.points[idx].normal[0] = output.points[idx].normal[1] = output.points[idx].normal[2] = output.points[idx].curvature = std::numeric_limits::quiet_NaN (); + output[idx].normal[0] = output[idx].normal[1] = output[idx].normal[2] = output[idx].curvature = std::numeric_limits::quiet_NaN (); output.is_dense = false; continue; } - output.points[idx].normal_x = n[0]; - output.points[idx].normal_y = n[1]; - output.points[idx].normal_z = n[2]; + output[idx].normal_x = n[0]; + output[idx].normal_y = n[1]; + output[idx].normal_z = n[2]; flipNormalTowardsViewpoint (input_->points[(*indices_)[idx]], vpx_, vpy_, vpz_, - output.points[idx].normal[0], output.points[idx].normal[1], output.points[idx].normal[2]); + output[idx].normal[0], output[idx].normal[1], output[idx].normal[2]); } } diff --git a/features/include/pcl/features/impl/normal_based_signature.hpp b/features/include/pcl/features/impl/normal_based_signature.hpp index 0c5dbfbd5bb..63d84f84bd1 100644 --- a/features/include/pcl/features/impl/normal_based_signature.hpp +++ b/features/include/pcl/features/impl/normal_based_signature.hpp @@ -178,7 +178,7 @@ pcl::NormalBasedSignatureEstimation::computeFeatu for (std::size_t j = 0; j < M_prime_; ++j) feature_point.values[i*M_prime_ + j] = final_matrix (i, j); - output.points[index_i] = feature_point; + output[index_i] = feature_point; } } diff --git a/features/include/pcl/features/impl/our_cvfh.hpp b/features/include/pcl/features/impl/our_cvfh.hpp index e987883a724..7f25f0871b6 100644 --- a/features/include/pcl/features/impl/our_cvfh.hpp +++ b/features/include/pcl/features/impl/our_cvfh.hpp @@ -125,9 +125,9 @@ pcl::OURCVFHEstimation::extractEuclideanClustersSm //processed[nn_indices[j]] = true; // [-1;1] - double dot_p = normals.points[seed_queue[sq_idx]].normal[0] * normals.points[nn_indices[j]].normal[0] - + normals.points[seed_queue[sq_idx]].normal[1] * normals.points[nn_indices[j]].normal[1] + normals.points[seed_queue[sq_idx]].normal[2] - * normals.points[nn_indices[j]].normal[2]; + double dot_p = normals[seed_queue[sq_idx]].normal[0] * normals[nn_indices[j]].normal[0] + + normals[seed_queue[sq_idx]].normal[1] * normals[nn_indices[j]].normal[1] + normals[seed_queue[sq_idx]].normal[2] + * normals[nn_indices[j]].normal[2]; if (std::abs (std::acos (dot_p)) < eps_angle) { @@ -171,7 +171,7 @@ pcl::OURCVFHEstimation::filterNormalsWithHighCurva for (const int &index : indices_to_use) { - if (cloud.points[index].curvature > threshold) + if (cloud[index].curvature > threshold) { indices_out[out] = index; out++; @@ -513,18 +513,18 @@ pcl::OURCVFHEstimation::computeRFAndShapeDistribut vfh_signature.points.resize (1); vfh_signature.width = vfh_signature.height = 1; for (int d = 0; d < 308; ++d) - vfh_signature.points[0].histogram[d] = output.points[i].histogram[d]; + vfh_signature[0].histogram[d] = output[i].histogram[d]; int pos = 45 * 3; for (int k = 0; k < num_hists; k++) { for (int ii = 0; ii < size_hists; ii++, pos++) { - vfh_signature.points[0].histogram[pos] = quadrants[k][ii]; + vfh_signature[0].histogram[pos] = quadrants[k][ii]; } } - ourcvfh_output.points.push_back (vfh_signature.points[0]); + ourcvfh_output.points.push_back (vfh_signature[0]); ourcvfh_output.width = ourcvfh_output.points.size (); delete[] weights; } @@ -705,7 +705,7 @@ pcl::OURCVFHEstimation::computeFeature (PointCloud vfh.setCentroidToUse (centroids_dominant_orientations_[i]); pcl::PointCloud vfh_signature; vfh.compute (vfh_signature); - output.points[i] = vfh_signature.points[0]; + output[i] = vfh_signature[0]; } //finish filling the descriptor with the shape distribution @@ -732,7 +732,7 @@ pcl::OURCVFHEstimation::computeFeature (PointCloud output.points.resize (1); output.width = 1; - output.points[0] = vfh_signature.points[0]; + output[0] = vfh_signature[0]; Eigen::Matrix4f id = Eigen::Matrix4f::Identity (); transforms_.push_back (id); valid_transforms_.push_back (false); diff --git a/features/include/pcl/features/impl/pfh.hpp b/features/include/pcl/features/impl/pfh.hpp index ada95705a2c..3ca4ebab40f 100644 --- a/features/include/pcl/features/impl/pfh.hpp +++ b/features/include/pcl/features/impl/pfh.hpp @@ -49,8 +49,8 @@ pcl::PFHEstimation::computePairFeatures ( const pcl::PointCloud &cloud, const pcl::PointCloud &normals, int p_idx, int q_idx, float &f1, float &f2, float &f3, float &f4) { - pcl::computePairFeatures (cloud.points[p_idx].getVector4fMap (), normals.points[p_idx].getNormalVector4fMap (), - cloud.points[q_idx].getVector4fMap (), normals.points[q_idx].getNormalVector4fMap (), + pcl::computePairFeatures (cloud[p_idx].getVector4fMap (), normals[p_idx].getNormalVector4fMap (), + cloud[q_idx].getVector4fMap (), normals[q_idx].getNormalVector4fMap (), f1, f2, f3, f4); return (true); } @@ -78,7 +78,7 @@ pcl::PFHEstimation::computePointPFHSignature ( for (std::size_t j_idx = 0; j_idx < i_idx; ++j_idx) { // If the 3D points are invalid, don't bother estimating, just continue - if (!isFinite (cloud.points[indices[i_idx]]) || !isFinite (cloud.points[indices[j_idx]])) + if (!isFinite (cloud[indices[i_idx]]) || !isFinite (cloud[indices[j_idx]])) continue; if (use_cache_) @@ -187,7 +187,7 @@ pcl::PFHEstimation::computeFeature (PointCloudOut if (this->searchForNeighbors ((*indices_)[idx], search_parameter_, nn_indices, nn_dists) == 0) { for (Eigen::Index d = 0; d < pfh_histogram_.size (); ++d) - output.points[idx].histogram[d] = std::numeric_limits::quiet_NaN (); + output[idx].histogram[d] = std::numeric_limits::quiet_NaN (); output.is_dense = false; continue; @@ -198,7 +198,7 @@ pcl::PFHEstimation::computeFeature (PointCloudOut // Copy into the resultant cloud for (Eigen::Index d = 0; d < pfh_histogram_.size (); ++d) - output.points[idx].histogram[d] = pfh_histogram_[d]; + output[idx].histogram[d] = pfh_histogram_[d]; } } else @@ -210,7 +210,7 @@ pcl::PFHEstimation::computeFeature (PointCloudOut this->searchForNeighbors ((*indices_)[idx], search_parameter_, nn_indices, nn_dists) == 0) { for (Eigen::Index d = 0; d < pfh_histogram_.size (); ++d) - output.points[idx].histogram[d] = std::numeric_limits::quiet_NaN (); + output[idx].histogram[d] = std::numeric_limits::quiet_NaN (); output.is_dense = false; continue; @@ -221,7 +221,7 @@ pcl::PFHEstimation::computeFeature (PointCloudOut // Copy into the resultant cloud for (Eigen::Index d = 0; d < pfh_histogram_.size (); ++d) - output.points[idx].histogram[d] = pfh_histogram_[d]; + output[idx].histogram[d] = pfh_histogram_[d]; } } } diff --git a/features/include/pcl/features/impl/pfhrgb.hpp b/features/include/pcl/features/impl/pfhrgb.hpp index fd80181ab9a..2df24277b4a 100644 --- a/features/include/pcl/features/impl/pfhrgb.hpp +++ b/features/include/pcl/features/impl/pfhrgb.hpp @@ -49,11 +49,11 @@ pcl::PFHRGBEstimation::computeRGBPairFeatures ( int p_idx, int q_idx, float &f1, float &f2, float &f3, float &f4, float &f5, float &f6, float &f7) { - Eigen::Vector4i colors1 (cloud.points[p_idx].r, cloud.points[p_idx].g, cloud.points[p_idx].b, 0), - colors2 (cloud.points[q_idx].r, cloud.points[q_idx].g, cloud.points[q_idx].b, 0); - pcl::computeRGBPairFeatures (cloud.points[p_idx].getVector4fMap (), normals.points[p_idx].getNormalVector4fMap (), + Eigen::Vector4i colors1 (cloud[p_idx].r, cloud[p_idx].g, cloud[p_idx].b, 0), + colors2 (cloud[q_idx].r, cloud[q_idx].g, cloud[q_idx].b, 0); + pcl::computeRGBPairFeatures (cloud[p_idx].getVector4fMap (), normals[p_idx].getNormalVector4fMap (), colors1, - cloud.points[q_idx].getVector4fMap (), normals.points[q_idx].getNormalVector4fMap (), + cloud[q_idx].getVector4fMap (), normals[q_idx].getNormalVector4fMap (), colors2, f1, f2, f3, f4, f5, f6, f7); return (true); @@ -152,7 +152,7 @@ pcl::PFHRGBEstimation::computeFeature (PointCloudO computePointPFHRGBSignature (*surface_, *normals_, nn_indices, nr_subdiv_, pfhrgb_histogram_); std::copy_n (pfhrgb_histogram_.data (), pfhrgb_histogram_.size (), - output.points[idx].histogram); + output[idx].histogram); } } diff --git a/features/include/pcl/features/impl/ppf.hpp b/features/include/pcl/features/impl/ppf.hpp index 5a3ea883daa..4b32537e2b9 100644 --- a/features/include/pcl/features/impl/ppf.hpp +++ b/features/include/pcl/features/impl/ppf.hpp @@ -112,7 +112,7 @@ pcl::PPFEstimation::computeFeature (PointCloudOut output.is_dense = false; } - output.points[index_i*input_->points.size () + j] = p; + output[index_i*input_->points.size () + j] = p; } } } diff --git a/features/include/pcl/features/impl/ppfrgb.hpp b/features/include/pcl/features/impl/ppfrgb.hpp index 8841634bdc4..5245e706ad8 100644 --- a/features/include/pcl/features/impl/ppfrgb.hpp +++ b/features/include/pcl/features/impl/ppfrgb.hpp @@ -101,7 +101,7 @@ pcl::PPFRGBEstimation::computeFeature (PointCloudO else p.f1 = p.f2 = p.f3 = p.f4 = p.alpha_m = p.r_ratio = p.g_ratio = p.b_ratio = 0.f; - output.points[index_i*input_->points.size () + j] = p; + output[index_i*input_->points.size () + j] = p; } } } @@ -168,7 +168,7 @@ pcl::PPFRGBRegionEstimation::computeFeature (Point average_feature_nn.r_ratio /= normalization_factor; average_feature_nn.g_ratio /= normalization_factor; average_feature_nn.b_ratio /= normalization_factor; - output.points[index_i] = average_feature_nn; + output[index_i] = average_feature_nn; } PCL_INFO ("Output size: %u\n", output.points.size ()); } diff --git a/features/include/pcl/features/impl/principal_curvatures.hpp b/features/include/pcl/features/impl/principal_curvatures.hpp index e119adec61a..2bb2ad2ab30 100644 --- a/features/include/pcl/features/impl/principal_curvatures.hpp +++ b/features/include/pcl/features/impl/principal_curvatures.hpp @@ -52,7 +52,7 @@ pcl::PrincipalCurvaturesEstimation::computePointPr float &pcx, float &pcy, float &pcz, float &pc1, float &pc2) { EIGEN_ALIGN16 Eigen::Matrix3f I = Eigen::Matrix3f::Identity (); - Eigen::Vector3f n_idx (normals.points[p_idx].normal[0], normals.points[p_idx].normal[1], normals.points[p_idx].normal[2]); + Eigen::Vector3f n_idx (normals[p_idx].normal[0], normals[p_idx].normal[1], normals[p_idx].normal[2]); EIGEN_ALIGN16 Eigen::Matrix3f M = I - n_idx * n_idx.transpose (); // projection matrix (into tangent plane) // Project normals into the tangent plane @@ -61,9 +61,9 @@ pcl::PrincipalCurvaturesEstimation::computePointPr xyz_centroid_.setZero (); for (std::size_t idx = 0; idx < indices.size(); ++idx) { - normal[0] = normals.points[indices[idx]].normal[0]; - normal[1] = normals.points[indices[idx]].normal[1]; - normal[2] = normals.points[indices[idx]].normal[2]; + normal[0] = normals[indices[idx]].normal[0]; + normal[1] = normals[indices[idx]].normal[1]; + normal[2] = normals[indices[idx]].normal[2]; projected_normals_[idx] = M * normal; xyz_centroid_ += projected_normals_[idx]; @@ -128,16 +128,16 @@ pcl::PrincipalCurvaturesEstimation::computeFeature { if (this->searchForNeighbors ((*indices_)[idx], search_parameter_, nn_indices, nn_dists) == 0) { - output.points[idx].principal_curvature[0] = output.points[idx].principal_curvature[1] = output.points[idx].principal_curvature[2] = - output.points[idx].pc1 = output.points[idx].pc2 = std::numeric_limits::quiet_NaN (); + output[idx].principal_curvature[0] = output[idx].principal_curvature[1] = output[idx].principal_curvature[2] = + output[idx].pc1 = output[idx].pc2 = std::numeric_limits::quiet_NaN (); output.is_dense = false; continue; } // Estimate the principal curvatures at each patch computePointPrincipalCurvatures (*normals_, (*indices_)[idx], nn_indices, - output.points[idx].principal_curvature[0], output.points[idx].principal_curvature[1], output.points[idx].principal_curvature[2], - output.points[idx].pc1, output.points[idx].pc2); + output[idx].principal_curvature[0], output[idx].principal_curvature[1], output[idx].principal_curvature[2], + output[idx].pc1, output[idx].pc2); } } else @@ -148,16 +148,16 @@ pcl::PrincipalCurvaturesEstimation::computeFeature if (!isFinite ((*input_)[(*indices_)[idx]]) || this->searchForNeighbors ((*indices_)[idx], search_parameter_, nn_indices, nn_dists) == 0) { - output.points[idx].principal_curvature[0] = output.points[idx].principal_curvature[1] = output.points[idx].principal_curvature[2] = - output.points[idx].pc1 = output.points[idx].pc2 = std::numeric_limits::quiet_NaN (); + output[idx].principal_curvature[0] = output[idx].principal_curvature[1] = output[idx].principal_curvature[2] = + output[idx].pc1 = output[idx].pc2 = std::numeric_limits::quiet_NaN (); output.is_dense = false; continue; } // Estimate the principal curvatures at each patch computePointPrincipalCurvatures (*normals_, (*indices_)[idx], nn_indices, - output.points[idx].principal_curvature[0], output.points[idx].principal_curvature[1], output.points[idx].principal_curvature[2], - output.points[idx].pc1, output.points[idx].pc2); + output[idx].principal_curvature[0], output[idx].principal_curvature[1], output[idx].principal_curvature[2], + output[idx].pc1, output[idx].pc2); } } } diff --git a/features/include/pcl/features/impl/rift.hpp b/features/include/pcl/features/impl/rift.hpp index d5ed46b2198..02dbb14e69c 100644 --- a/features/include/pcl/features/impl/rift.hpp +++ b/features/include/pcl/features/impl/rift.hpp @@ -61,15 +61,15 @@ pcl::RIFTEstimation::computeRIFT ( int nr_gradient_bins = static_cast (rift_descriptor.cols ()); // Get the center point - pcl::Vector3fMapConst p0 = cloud.points[p_idx].getVector3fMap (); + pcl::Vector3fMapConst p0 = cloud[p_idx].getVector3fMap (); // Compute the RIFT descriptor rift_descriptor.setZero (); for (std::size_t idx = 0; idx < indices.size (); ++idx) { // Compute the gradient magnitude and orientation (relative to the center point) - pcl::Vector3fMapConst point = cloud.points[indices[idx]].getVector3fMap (); - Eigen::Map gradient_vector (& (gradient.points[indices[idx]].gradient[0])); + pcl::Vector3fMapConst point = cloud[indices[idx]].getVector3fMap (); + Eigen::Map gradient_vector (& (gradient[indices[idx]].gradient[0])); float gradient_magnitude = gradient_vector.norm (); float gradient_angle_from_center = std::acos (gradient_vector.dot ((point - p0).normalized ()) / gradient_magnitude); @@ -171,7 +171,7 @@ pcl::RIFTEstimation::computeFeature (PointCloudO computeRIFT (*surface_, *gradient_, (*indices_)[idx], static_cast (search_radius_), nn_indices, nn_dist_sqr, rift_descriptor); // Default layout is column major, copy elementwise - std::copy_n (rift_descriptor.data (), rift_descriptor.size (), output.points[idx].histogram); + std::copy_n (rift_descriptor.data (), rift_descriptor.size (), output[idx].histogram); } } diff --git a/features/include/pcl/features/impl/rsd.hpp b/features/include/pcl/features/impl/rsd.hpp index f71470ac066..4ffcd2df77b 100644 --- a/features/include/pcl/features/impl/rsd.hpp +++ b/features/include/pcl/features/impl/rsd.hpp @@ -78,18 +78,18 @@ pcl::computeRSD (const pcl::PointCloud &surface, const pcl::PointCloud for (i = begin+1; i != end; ++i) { // compute angle between the two lines going through normals (disregard orientation!) - double cosine = normals.points[*i].normal[0] * normals.points[*begin].normal[0] + - normals.points[*i].normal[1] * normals.points[*begin].normal[1] + - normals.points[*i].normal[2] * normals.points[*begin].normal[2]; + double cosine = normals[*i].normal[0] * normals[*begin].normal[0] + + normals[*i].normal[1] * normals[*begin].normal[1] + + normals[*i].normal[2] * normals[*begin].normal[2]; if (cosine > 1) cosine = 1; if (cosine < -1) cosine = -1; double angle = std::acos (cosine); if (angle > M_PI/2) angle = M_PI - angle; /// \note: orientation is neglected! // Compute point to point distance - double dist = sqrt ((surface.points[*i].x - surface.points[*begin].x) * (surface.points[*i].x - surface.points[*begin].x) + - (surface.points[*i].y - surface.points[*begin].y) * (surface.points[*i].y - surface.points[*begin].y) + - (surface.points[*i].z - surface.points[*begin].z) * (surface.points[*i].z - surface.points[*begin].z)); + double dist = sqrt ((surface[*i].x - surface[*begin].x) * (surface[*i].x - surface[*begin].x) + + (surface[*i].y - surface[*begin].y) * (surface[*i].y - surface[*begin].y) + + (surface[*i].z - surface[*begin].z) * (surface[*i].z - surface[*begin].z)); if (dist > max_dist) continue; /// \note: we neglect points that are outside the specified interval! @@ -179,9 +179,9 @@ pcl::computeRSD (const pcl::PointCloud &normals, for (i = begin+1; i != end; ++i) { // compute angle between the two lines going through normals (disregard orientation!) - double cosine = normals.points[*i].normal[0] * normals.points[*begin].normal[0] + - normals.points[*i].normal[1] * normals.points[*begin].normal[1] + - normals.points[*i].normal[2] * normals.points[*begin].normal[2]; + double cosine = normals[*i].normal[0] * normals[*begin].normal[0] + + normals[*i].normal[1] * normals[*begin].normal[1] + + normals[*i].normal[2] * normals[*begin].normal[2]; if (cosine > 1) cosine = 1; if (cosine < -1) cosine = -1; double angle = std::acos (cosine); @@ -273,8 +273,8 @@ pcl::RSDEstimation::computeFeature (PointCloudOut { // Compute and store r_min and r_max in the output cloud this->searchForNeighbors ((*indices_)[idx], search_parameter_, nn_indices, nn_sqr_dists); - //histograms_->push_back (computeRSD (*surface_, *normals_, nn_indices, search_radius_, nr_subdiv_, plane_radius_, output.points[idx], true)); - histograms_->push_back (computeRSD (*normals_, nn_indices, nn_sqr_dists, search_radius_, nr_subdiv_, plane_radius_, output.points[idx], true)); + //histograms_->push_back (computeRSD (*surface_, *normals_, nn_indices, search_radius_, nr_subdiv_, plane_radius_, output[idx], true)); + histograms_->push_back (computeRSD (*normals_, nn_indices, nn_sqr_dists, search_radius_, nr_subdiv_, plane_radius_, output[idx], true)); } } else @@ -284,8 +284,8 @@ pcl::RSDEstimation::computeFeature (PointCloudOut { // Compute and store r_min and r_max in the output cloud this->searchForNeighbors ((*indices_)[idx], search_parameter_, nn_indices, nn_sqr_dists); - //computeRSD (*surface_, *normals_, nn_indices, search_radius_, nr_subdiv_, plane_radius_, output.points[idx], false); - computeRSD (*normals_, nn_indices, nn_sqr_dists, search_radius_, nr_subdiv_, plane_radius_, output.points[idx], false); + //computeRSD (*surface_, *normals_, nn_indices, search_radius_, nr_subdiv_, plane_radius_, output[idx], false); + computeRSD (*normals_, nn_indices, nn_sqr_dists, search_radius_, nr_subdiv_, plane_radius_, output[idx], false); } } } diff --git a/features/include/pcl/features/impl/shot.hpp b/features/include/pcl/features/impl/shot.hpp index 1e757140d59..96268d98e01 100644 --- a/features/include/pcl/features/impl/shot.hpp +++ b/features/include/pcl/features/impl/shot.hpp @@ -798,9 +798,9 @@ pcl::SHOTEstimation::computeFeature (pcl { // Copy into the resultant cloud for (int d = 0; d < descLength_; ++d) - output.points[idx].descriptor[d] = std::numeric_limits::quiet_NaN (); + output[idx].descriptor[d] = std::numeric_limits::quiet_NaN (); for (int d = 0; d < 9; ++d) - output.points[idx].rf[d] = std::numeric_limits::quiet_NaN (); + output[idx].rf[d] = std::numeric_limits::quiet_NaN (); output.is_dense = false; continue; @@ -811,12 +811,12 @@ pcl::SHOTEstimation::computeFeature (pcl // Copy into the resultant cloud for (int d = 0; d < descLength_; ++d) - output.points[idx].descriptor[d] = shot_[d]; + output[idx].descriptor[d] = shot_[d]; for (int d = 0; d < 3; ++d) { - output.points[idx].rf[d + 0] = frames_->points[idx].x_axis[d]; - output.points[idx].rf[d + 3] = frames_->points[idx].y_axis[d]; - output.points[idx].rf[d + 6] = frames_->points[idx].z_axis[d]; + output[idx].rf[d + 0] = frames_->points[idx].x_axis[d]; + output[idx].rf[d + 3] = frames_->points[idx].y_axis[d]; + output[idx].rf[d + 6] = frames_->points[idx].z_axis[d]; } } } @@ -870,9 +870,9 @@ pcl::SHOTColorEstimation::computeFeature { // Copy into the resultant cloud for (int d = 0; d < descLength_; ++d) - output.points[idx].descriptor[d] = std::numeric_limits::quiet_NaN (); + output[idx].descriptor[d] = std::numeric_limits::quiet_NaN (); for (int d = 0; d < 9; ++d) - output.points[idx].rf[d] = std::numeric_limits::quiet_NaN (); + output[idx].rf[d] = std::numeric_limits::quiet_NaN (); output.is_dense = false; continue; @@ -883,12 +883,12 @@ pcl::SHOTColorEstimation::computeFeature // Copy into the resultant cloud for (int d = 0; d < descLength_; ++d) - output.points[idx].descriptor[d] = shot_[d]; + output[idx].descriptor[d] = shot_[d]; for (int d = 0; d < 3; ++d) { - output.points[idx].rf[d + 0] = frames_->points[idx].x_axis[d]; - output.points[idx].rf[d + 3] = frames_->points[idx].y_axis[d]; - output.points[idx].rf[d + 6] = frames_->points[idx].z_axis[d]; + output[idx].rf[d + 0] = frames_->points[idx].x_axis[d]; + output[idx].rf[d + 3] = frames_->points[idx].y_axis[d]; + output[idx].rf[d + 6] = frames_->points[idx].z_axis[d]; } } } diff --git a/features/include/pcl/features/impl/shot_omp.hpp b/features/include/pcl/features/impl/shot_omp.hpp index 681f1ae3fce..b136daa958e 100644 --- a/features/include/pcl/features/impl/shot_omp.hpp +++ b/features/include/pcl/features/impl/shot_omp.hpp @@ -181,9 +181,9 @@ pcl::SHOTEstimationOMP::computeFeature ( { // Copy into the resultant cloud for (Eigen::Index d = 0; d < shot.size (); ++d) - output.points[idx].descriptor[d] = std::numeric_limits::quiet_NaN (); + output[idx].descriptor[d] = std::numeric_limits::quiet_NaN (); for (int d = 0; d < 9; ++d) - output.points[idx].rf[d] = std::numeric_limits::quiet_NaN (); + output[idx].rf[d] = std::numeric_limits::quiet_NaN (); output.is_dense = false; continue; @@ -194,12 +194,12 @@ pcl::SHOTEstimationOMP::computeFeature ( // Copy into the resultant cloud for (Eigen::Index d = 0; d < shot.size (); ++d) - output.points[idx].descriptor[d] = shot[d]; + output[idx].descriptor[d] = shot[d]; for (int d = 0; d < 3; ++d) { - output.points[idx].rf[d + 0] = frames_->points[idx].x_axis[d]; - output.points[idx].rf[d + 3] = frames_->points[idx].y_axis[d]; - output.points[idx].rf[d + 6] = frames_->points[idx].z_axis[d]; + output[idx].rf[d + 0] = frames_->points[idx].x_axis[d]; + output[idx].rf[d + 3] = frames_->points[idx].y_axis[d]; + output[idx].rf[d + 6] = frames_->points[idx].z_axis[d]; } } } @@ -268,9 +268,9 @@ pcl::SHOTColorEstimationOMP::computeFeat { // Copy into the resultant cloud for (Eigen::Index d = 0; d < shot.size (); ++d) - output.points[idx].descriptor[d] = std::numeric_limits::quiet_NaN (); + output[idx].descriptor[d] = std::numeric_limits::quiet_NaN (); for (int d = 0; d < 9; ++d) - output.points[idx].rf[d] = std::numeric_limits::quiet_NaN (); + output[idx].rf[d] = std::numeric_limits::quiet_NaN (); output.is_dense = false; continue; @@ -281,12 +281,12 @@ pcl::SHOTColorEstimationOMP::computeFeat // Copy into the resultant cloud for (Eigen::Index d = 0; d < shot.size (); ++d) - output.points[idx].descriptor[d] = shot[d]; + output[idx].descriptor[d] = shot[d]; for (int d = 0; d < 3; ++d) { - output.points[idx].rf[d + 0] = frames_->points[idx].x_axis[d]; - output.points[idx].rf[d + 3] = frames_->points[idx].y_axis[d]; - output.points[idx].rf[d + 6] = frames_->points[idx].z_axis[d]; + output[idx].rf[d + 0] = frames_->points[idx].x_axis[d]; + output[idx].rf[d + 3] = frames_->points[idx].y_axis[d]; + output[idx].rf[d + 6] = frames_->points[idx].z_axis[d]; } } } diff --git a/features/include/pcl/features/impl/spin_image.hpp b/features/include/pcl/features/impl/spin_image.hpp index cf29439f30a..d3de4069064 100644 --- a/features/include/pcl/features/impl/spin_image.hpp +++ b/features/include/pcl/features/impl/spin_image.hpp @@ -331,7 +331,7 @@ pcl::SpinImageEstimation::computeFeature (PointClo { for (Eigen::Index iCol = 0; iCol < res.cols () ; iCol++) { - output.points[i_input].histogram[ iRow*res.cols () + iCol ] = static_cast (res (iRow, iCol)); + output[i_input].histogram[ iRow*res.cols () + iCol ] = static_cast (res (iRow, iCol)); } } } diff --git a/features/include/pcl/features/impl/usc.hpp b/features/include/pcl/features/impl/usc.hpp index c2065a52c88..77ec8f32386 100644 --- a/features/include/pcl/features/impl/usc.hpp +++ b/features/include/pcl/features/impl/usc.hpp @@ -239,23 +239,23 @@ pcl::UniqueShapeContext::computeFeature (PointClo !std::isfinite (current_frame.y_axis[0]) || !std::isfinite (current_frame.z_axis[0]) ) { - std::fill (output.points[point_index].descriptor, output.points[point_index].descriptor + descriptor_length_, + std::fill (output[point_index].descriptor, output[point_index].descriptor + descriptor_length_, std::numeric_limits::quiet_NaN ()); - std::fill (output.points[point_index].rf, output.points[point_index].rf + 9, 0); + std::fill (output[point_index].rf, output[point_index].rf + 9, 0); output.is_dense = false; continue; } for (int d = 0; d < 3; ++d) { - output.points[point_index].rf[0 + d] = current_frame.x_axis[d]; - output.points[point_index].rf[3 + d] = current_frame.y_axis[d]; - output.points[point_index].rf[6 + d] = current_frame.z_axis[d]; + output[point_index].rf[0 + d] = current_frame.x_axis[d]; + output[point_index].rf[3 + d] = current_frame.y_axis[d]; + output[point_index].rf[6 + d] = current_frame.z_axis[d]; } std::vector descriptor (descriptor_length_); computePointDescriptor (point_index, descriptor); - std::copy (descriptor.begin (), descriptor.end (), output.points[point_index].descriptor); + std::copy (descriptor.begin (), descriptor.end (), output[point_index].descriptor); } } diff --git a/features/include/pcl/features/impl/vfh.hpp b/features/include/pcl/features/impl/vfh.hpp index f47180d2151..9c937ad5897 100644 --- a/features/include/pcl/features/impl/vfh.hpp +++ b/features/include/pcl/features/impl/vfh.hpp @@ -133,8 +133,8 @@ pcl::VFHEstimation::computePointSPFHSignature (con for (const int &index : indices) { // Compute the pair P to NNi - if (!computePairFeatures (centroid_p, centroid_n, cloud.points[index].getVector4fMap (), - normals.points[index].getNormalVector4fMap (), pfh_tuple[0], pfh_tuple[1], + if (!computePairFeatures (centroid_p, centroid_n, cloud[index].getVector4fMap (), + normals[index].getNormalVector4fMap (), pfh_tuple[0], pfh_tuple[1], pfh_tuple[2], pfh_tuple[3])) continue; @@ -239,7 +239,7 @@ pcl::VFHEstimation::computeFeature (PointCloudOut output.height = 1; // Estimate the FPFH at nn_indices[0] using the entire cloud and copy the resultant signature - auto outPtr = std::begin (output.points[0].histogram); + auto outPtr = std::begin (output[0].histogram); for (int i = 0; i < 4; ++i) { diff --git a/features/src/narf.cpp b/features/src/narf.cpp index 5a133265a08..8c8dc3e6b54 100644 --- a/features/src/narf.cpp +++ b/features/src/narf.cpp @@ -379,7 +379,7 @@ Narf::extractForInterestPoints (const RangeImage& range_image, const PointCloud< //!!! nizar 20110408 : for OpenMP sake on MSVC this must be kept signed for (std::ptrdiff_t idx = 0; idx < static_cast(interest_points.points.size ()); ++idx) { - const auto& interest_point = interest_points.points[idx]; + const auto& interest_point = interest_points[idx]; Vector3fMapConst point = interest_point.getVector3fMap (); Narf* feature = new Narf; @@ -678,7 +678,7 @@ NarfDescriptor::computeFeature(NarfDescriptor::PointCloudOut& output) output.points.resize(feature_list.size()); for (std::size_t i = 0; i < feature_list.size(); ++i) { - feature_list[i]->copyToNarf36(output.points[i]); + feature_list[i]->copyToNarf36(output[i]); } // Cleanup diff --git a/filters/include/pcl/filters/filter.h b/filters/include/pcl/filters/filter.h index 2759857e31d..373dce10bf9 100644 --- a/filters/include/pcl/filters/filter.h +++ b/filters/include/pcl/filters/filter.h @@ -51,7 +51,7 @@ namespace pcl /** \brief Removes points with x, y, or z equal to NaN * \param[in] cloud_in the input point cloud * \param[out] cloud_out the output point cloud - * \param[out] index the mapping (ordered): cloud_out.points[i] = cloud_in.points[index[i]] + * \param[out] index the mapping (ordered): cloud_out[i] = cloud_in[index[i]] * \note The density of the point cloud is lost. * \note Can be called with cloud_in == cloud_out * \ingroup filters @@ -64,7 +64,7 @@ namespace pcl /** \brief Removes points that have their normals invalid (i.e., equal to NaN) * \param[in] cloud_in the input point cloud * \param[out] cloud_out the output point cloud - * \param[out] index the mapping (ordered): cloud_out.points[i] = cloud_in.points[index[i]] + * \param[out] index the mapping (ordered): cloud_out[i] = cloud_in[index[i]] * \note The density of the point cloud is lost. * \note Can be called with cloud_in == cloud_out * \ingroup filters diff --git a/filters/include/pcl/filters/filter_indices.h b/filters/include/pcl/filters/filter_indices.h index 12374b3593c..2c1d13c4361 100644 --- a/filters/include/pcl/filters/filter_indices.h +++ b/filters/include/pcl/filters/filter_indices.h @@ -52,7 +52,7 @@ namespace pcl * \note This function does not modify the input point cloud! * * \param cloud_in the input point cloud - * \param index the mapping (ordered): filtered_cloud.points[i] = cloud_in.points[index[i]] + * \param index the mapping (ordered): filtered_cloud[i] = cloud_in[index[i]] * * \see removeNaNFromPointCloud * \ingroup filters diff --git a/filters/include/pcl/filters/impl/approximate_voxel_grid.hpp b/filters/include/pcl/filters/impl/approximate_voxel_grid.hpp index 50e82786c2d..1a97f928bb9 100644 --- a/filters/include/pcl/filters/impl/approximate_voxel_grid.hpp +++ b/filters/include/pcl/filters/impl/approximate_voxel_grid.hpp @@ -47,7 +47,7 @@ template void pcl::ApproximateVoxelGrid::flush (PointCloud &output, std::size_t op, he *hhe, int rgba_index, int centroid_size) { hhe->centroid /= static_cast (hhe->count); - pcl::for_each_type (pcl::xNdCopyEigenPointFunctor (hhe->centroid, output.points[op])); + pcl::for_each_type (pcl::xNdCopyEigenPointFunctor (hhe->centroid, output[op])); // ---[ RGB special case if (rgba_index >= 0) { @@ -56,7 +56,7 @@ pcl::ApproximateVoxelGrid::flush (PointCloud &output, std::size_t op, he g = hhe->centroid[centroid_size-2], b = hhe->centroid[centroid_size-1]; int rgb = (static_cast (r)) << 16 | (static_cast (g)) << 8 | (static_cast (b)); - memcpy (reinterpret_cast (&output.points[op]) + rgba_index, &rgb, sizeof (float)); + memcpy (reinterpret_cast (&output[op]) + rgba_index, &rgb, sizeof (float)); } } diff --git a/filters/include/pcl/filters/impl/bilateral.hpp b/filters/include/pcl/filters/impl/bilateral.hpp index b8d79fc108f..f15e6d5b54d 100644 --- a/filters/include/pcl/filters/impl/bilateral.hpp +++ b/filters/include/pcl/filters/impl/bilateral.hpp @@ -103,7 +103,7 @@ pcl::BilateralFilter::applyFilter (PointCloud &output) tree_->radiusSearch ((*indices_)[i], sigma_s_ * 2, k_indices, k_distances); // Overwrite the intensity value with the computed average - output.points[(*indices_)[i]].intensity = static_cast (computePointWeight ((*indices_)[i], k_indices, k_distances)); + output[(*indices_)[i]].intensity = static_cast (computePointWeight ((*indices_)[i], k_indices, k_distances)); } } diff --git a/filters/include/pcl/filters/impl/conditional_removal.hpp b/filters/include/pcl/filters/impl/conditional_removal.hpp index 6f2c9207f79..b7bb2e2ed8c 100644 --- a/filters/include/pcl/filters/impl/conditional_removal.hpp +++ b/filters/include/pcl/filters/impl/conditional_removal.hpp @@ -709,7 +709,7 @@ pcl::ConditionalRemoval::applyFilter (PointCloud &output) if (condition_->evaluate (point)) { - copyPoint (point, output.points[nr_p]); + copyPoint (point, output[nr_p]); nr_p++; } else @@ -743,11 +743,11 @@ pcl::ConditionalRemoval::applyFilter (PointCloud &output) } // copy all the fields - copyPoint (input_->points[cp], output.points[cp]); + copyPoint (input_->points[cp], output[cp]); if (!condition_->evaluate (input_->points[cp])) { - output.points[cp].getVector4fMap ().setConstant (user_filter_value_); + output[cp].getVector4fMap ().setConstant (user_filter_value_); removed_p = true; if (extract_removed_indices_) @@ -759,7 +759,7 @@ pcl::ConditionalRemoval::applyFilter (PointCloud &output) } else { - output.points[cp].getVector4fMap ().setConstant (user_filter_value_); + output[cp].getVector4fMap ().setConstant (user_filter_value_); removed_p = true; //as for !keep_organized_: removed points due to setIndices are not considered as removed_indices_ } diff --git a/filters/include/pcl/filters/impl/extract_indices.hpp b/filters/include/pcl/filters/impl/extract_indices.hpp index 7005fde4dc4..259a666f205 100644 --- a/filters/include/pcl/filters/impl/extract_indices.hpp +++ b/filters/include/pcl/filters/impl/extract_indices.hpp @@ -99,7 +99,7 @@ pcl::ExtractIndices::applyFilter (PointCloud &output) output = *input_; return; } - std::uint8_t* pt_data = reinterpret_cast (&output.points[pt_index]); + std::uint8_t* pt_data = reinterpret_cast (&output[pt_index]); for (const auto &field : fields) memcpy (pt_data + field.offset, &user_filter_value_, sizeof (float)); } diff --git a/filters/include/pcl/filters/impl/filter.hpp b/filters/include/pcl/filters/impl/filter.hpp index 6c63735ef21..a210ac3b519 100644 --- a/filters/include/pcl/filters/impl/filter.hpp +++ b/filters/include/pcl/filters/impl/filter.hpp @@ -71,11 +71,11 @@ pcl::removeNaNFromPointCloud (const pcl::PointCloud &cloud_in, std::size_t j = 0; for (std::size_t i = 0; i < cloud_in.points.size (); ++i) { - if (!std::isfinite (cloud_in.points[i].x) || - !std::isfinite (cloud_in.points[i].y) || - !std::isfinite (cloud_in.points[i].z)) + if (!std::isfinite (cloud_in[i].x) || + !std::isfinite (cloud_in[i].y) || + !std::isfinite (cloud_in[i].z)) continue; - cloud_out.points[j] = cloud_in.points[i]; + cloud_out[j] = cloud_in[i]; index[j] = static_cast(i); j++; } @@ -117,13 +117,13 @@ pcl::removeNaNNormalsFromPointCloud (const pcl::PointCloud &cloud_in, for (std::size_t i = 0; i < cloud_in.points.size (); ++i) { - if (!std::isfinite (cloud_in.points[i].normal_x) || - !std::isfinite (cloud_in.points[i].normal_y) || - !std::isfinite (cloud_in.points[i].normal_z)) + if (!std::isfinite (cloud_in[i].normal_x) || + !std::isfinite (cloud_in[i].normal_y) || + !std::isfinite (cloud_in[i].normal_z)) continue; - if (cloud_out.is_dense && !pcl::isFinite(cloud_in.points[i])) + if (cloud_out.is_dense && !pcl::isFinite(cloud_in[i])) cloud_out.is_dense = false; - cloud_out.points[j] = cloud_in.points[i]; + cloud_out[j] = cloud_in[i]; index[j] = static_cast(i); j++; } diff --git a/filters/include/pcl/filters/impl/filter_indices.hpp b/filters/include/pcl/filters/impl/filter_indices.hpp index cee70c36c13..42531481d16 100644 --- a/filters/include/pcl/filters/impl/filter_indices.hpp +++ b/filters/include/pcl/filters/impl/filter_indices.hpp @@ -59,9 +59,9 @@ pcl::removeNaNFromPointCloud (const pcl::PointCloud &cloud_in, int j = 0; for (int i = 0; i < static_cast (cloud_in.points.size ()); ++i) { - if (!std::isfinite (cloud_in.points[i].x) || - !std::isfinite (cloud_in.points[i].y) || - !std::isfinite (cloud_in.points[i].z)) + if (!std::isfinite (cloud_in[i].x) || + !std::isfinite (cloud_in[i].y) || + !std::isfinite (cloud_in[i].z)) continue; index[j] = i; j++; diff --git a/filters/include/pcl/filters/impl/morphological_filter.hpp b/filters/include/pcl/filters/impl/morphological_filter.hpp index 25c8407f45c..ba25ac7d5c3 100644 --- a/filters/include/pcl/filters/impl/morphological_filter.hpp +++ b/filters/include/pcl/filters/impl/morphological_filter.hpp @@ -99,12 +99,12 @@ applyMorphologicalOperator (const typename pcl::PointCloud::ConstPtr &cl { case MORPH_DILATE: { - cloud_out.points[p_idx].z = max_pt.z (); + cloud_out[p_idx].z = max_pt.z (); break; } case MORPH_ERODE: { - cloud_out.points[p_idx].z = min_pt.z (); + cloud_out[p_idx].z = min_pt.z (); break; } } @@ -123,11 +123,11 @@ applyMorphologicalOperator (const typename pcl::PointCloud::ConstPtr &cl { Eigen::Vector3f bbox_min, bbox_max; std::vector pt_indices; - float minx = cloud_temp.points[p_idx].x - half_res; - float miny = cloud_temp.points[p_idx].y - half_res; + float minx = cloud_temp[p_idx].x - half_res; + float miny = cloud_temp[p_idx].y - half_res; float minz = -std::numeric_limits::max (); - float maxx = cloud_temp.points[p_idx].x + half_res; - float maxy = cloud_temp.points[p_idx].y + half_res; + float maxx = cloud_temp[p_idx].x + half_res; + float maxy = cloud_temp[p_idx].y + half_res; float maxz = std::numeric_limits::max (); bbox_min = Eigen::Vector3f (minx, miny, minz); bbox_max = Eigen::Vector3f (maxx, maxy, maxz); @@ -142,12 +142,12 @@ applyMorphologicalOperator (const typename pcl::PointCloud::ConstPtr &cl { case MORPH_OPEN: { - cloud_out.points[p_idx].z = min_pt.z (); + cloud_out[p_idx].z = min_pt.z (); break; } case MORPH_CLOSE: { - cloud_out.points[p_idx].z = max_pt.z (); + cloud_out[p_idx].z = max_pt.z (); break; } } @@ -160,11 +160,11 @@ applyMorphologicalOperator (const typename pcl::PointCloud::ConstPtr &cl { Eigen::Vector3f bbox_min, bbox_max; std::vector pt_indices; - float minx = cloud_temp.points[p_idx].x - half_res; - float miny = cloud_temp.points[p_idx].y - half_res; + float minx = cloud_temp[p_idx].x - half_res; + float miny = cloud_temp[p_idx].y - half_res; float minz = -std::numeric_limits::max (); - float maxx = cloud_temp.points[p_idx].x + half_res; - float maxy = cloud_temp.points[p_idx].y + half_res; + float maxx = cloud_temp[p_idx].x + half_res; + float maxy = cloud_temp[p_idx].y + half_res; float maxz = std::numeric_limits::max (); bbox_min = Eigen::Vector3f (minx, miny, minz); bbox_max = Eigen::Vector3f (maxx, maxy, maxz); @@ -180,12 +180,12 @@ applyMorphologicalOperator (const typename pcl::PointCloud::ConstPtr &cl case MORPH_OPEN: default: { - cloud_out.points[p_idx].z = max_pt.z (); + cloud_out[p_idx].z = max_pt.z (); break; } case MORPH_CLOSE: { - cloud_out.points[p_idx].z = min_pt.z (); + cloud_out[p_idx].z = min_pt.z (); break; } } diff --git a/filters/include/pcl/filters/impl/sampling_surface_normal.hpp b/filters/include/pcl/filters/impl/sampling_surface_normal.hpp index 14f0eb9a26c..02c26f4008c 100644 --- a/filters/include/pcl/filters/impl/sampling_surface_normal.hpp +++ b/filters/include/pcl/filters/impl/sampling_surface_normal.hpp @@ -66,52 +66,52 @@ pcl::SamplingSurfaceNormal::applyFilter (PointCloud &output) template void pcl::SamplingSurfaceNormal::findXYZMaxMin (const PointCloud& cloud, Vector& max_vec, Vector& min_vec) { - float maxval = cloud.points[0].x; - float minval = cloud.points[0].x; + float maxval = cloud[0].x; + float minval = cloud[0].x; for (std::size_t i = 0; i < cloud.points.size (); i++) { - if (cloud.points[i].x > maxval) + if (cloud[i].x > maxval) { - maxval = cloud.points[i].x; + maxval = cloud[i].x; } - if (cloud.points[i].x < minval) + if (cloud[i].x < minval) { - minval = cloud.points[i].x; + minval = cloud[i].x; } } max_vec (0) = maxval; min_vec (0) = minval; - maxval = cloud.points[0].y; - minval = cloud.points[0].y; + maxval = cloud[0].y; + minval = cloud[0].y; for (std::size_t i = 0; i < cloud.points.size (); i++) { - if (cloud.points[i].y > maxval) + if (cloud[i].y > maxval) { - maxval = cloud.points[i].y; + maxval = cloud[i].y; } - if (cloud.points[i].y < minval) + if (cloud[i].y < minval) { - minval = cloud.points[i].y; + minval = cloud[i].y; } } max_vec (1) = maxval; min_vec (1) = minval; - maxval = cloud.points[0].z; - minval = cloud.points[0].z; + maxval = cloud[0].z; + minval = cloud[0].z; for (std::size_t i = 0; i < cloud.points.size (); i++) { - if (cloud.points[i].z > maxval) + if (cloud[i].z > maxval) { - maxval = cloud.points[i].z; + maxval = cloud[i].z; } - if (cloud.points[i].z < minval) + if (cloud[i].z < minval) { - minval = cloud.points[i].z; + minval = cloud[i].z; } } max_vec (2) = maxval; @@ -168,9 +168,9 @@ pcl::SamplingSurfaceNormal::samplePartition ( for (int i = first; i < last; i++) { PointT pt; - pt.x = data.points[indices[i]].x; - pt.y = data.points[indices[i]].y; - pt.z = data.points[indices[i]].z; + pt.x = data[indices[i]].x; + pt.y = data[indices[i]].y; + pt.z = data[indices[i]].z; cloud.points.push_back (pt); } cloud.width = 1; @@ -189,7 +189,7 @@ pcl::SamplingSurfaceNormal::samplePartition ( if (r < ratio_) { - PointT pt = cloud.points[i]; + PointT pt = cloud[i]; pt.normal[0] = normal (0); pt.normal[1] = normal (1); pt.normal[2] = normal (2); @@ -233,7 +233,7 @@ pcl::SamplingSurfaceNormal::computeMeanAndCovarianceMatrix (const pcl::P Eigen::Matrix3f &covariance_matrix, Eigen::Vector4f ¢roid) { - // create the buffer on the stack which is much faster than using cloud.points[indices[i]] and centroid as a buffer + // create the buffer on the stack which is much faster than using cloud[indices[i]] and centroid as a buffer Eigen::Matrix accu = Eigen::Matrix::Zero (); std::size_t point_count = 0; for (std::size_t i = 0; i < cloud.points.size (); i++) @@ -299,11 +299,11 @@ pcl::SamplingSurfaceNormal::findCutVal ( const PointCloud& cloud, const int cut_dim, const int cut_index) { if (cut_dim == 0) - return (cloud.points[cut_index].x); + return (cloud[cut_index].x); if (cut_dim == 1) - return (cloud.points[cut_index].y); + return (cloud[cut_index].y); if (cut_dim == 2) - return (cloud.points[cut_index].z); + return (cloud[cut_index].z); return (0.0f); } diff --git a/filters/include/pcl/filters/impl/shadowpoints.hpp b/filters/include/pcl/filters/impl/shadowpoints.hpp index 839789ed575..593c13eafe7 100644 --- a/filters/include/pcl/filters/impl/shadowpoints.hpp +++ b/filters/include/pcl/filters/impl/shadowpoints.hpp @@ -60,14 +60,14 @@ pcl::ShadowPoints::applyFilter (PointCloud &output) const float val = std::abs (normal.normal_x * pt.x + normal.normal_y * pt.y + normal.normal_z * pt.z); if ( (val >= threshold_) ^ negative_) - output.points[cp++] = pt; + output[cp++] = pt; else { if (extract_removed_indices_) (*removed_indices_)[ri++] = i; if (keep_organized_) { - PointT &pt_new = output.points[cp++] = pt; + PointT &pt_new = output[cp++] = pt; pt_new.x = pt_new.y = pt_new.z = user_filter_value_; } diff --git a/filters/include/pcl/filters/impl/uniform_sampling.hpp b/filters/include/pcl/filters/impl/uniform_sampling.hpp index eb9ae9e57d6..ae7bedf61cc 100644 --- a/filters/include/pcl/filters/impl/uniform_sampling.hpp +++ b/filters/include/pcl/filters/impl/uniform_sampling.hpp @@ -134,7 +134,7 @@ pcl::UniformSampling::applyFilter (PointCloud &output) int cp = 0; for (const auto& leaf : leaves_) - output.points[cp++] = input_->points[leaf.second.idx]; + output[cp++] = input_->points[leaf.second.idx]; output.width = static_cast (output.points.size ()); } diff --git a/filters/include/pcl/filters/impl/voxel_grid.hpp b/filters/include/pcl/filters/impl/voxel_grid.hpp index 669b5c6fe64..8a81fd738b5 100644 --- a/filters/include/pcl/filters/impl/voxel_grid.hpp +++ b/filters/include/pcl/filters/impl/voxel_grid.hpp @@ -415,7 +415,7 @@ pcl::VoxelGrid::applyFilter (PointCloud &output) centroid += input_->points[index_vector[li].cloud_point_index].getVector4fMap (); centroid /= static_cast (last_index - first_index); - output.points[index].getVector4fMap () = centroid; + output[index].getVector4fMap () = centroid; } else { @@ -425,7 +425,7 @@ pcl::VoxelGrid::applyFilter (PointCloud &output) for (unsigned int li = first_index; li < last_index; ++li) centroid.add (input_->points[index_vector[li].cloud_point_index]); - centroid.get (output.points[index]); + centroid.get (output[index]); } ++index; diff --git a/filters/include/pcl/filters/sampling_surface_normal.h b/filters/include/pcl/filters/sampling_surface_normal.h index 9afeaac9447..d39ef1c8709 100644 --- a/filters/include/pcl/filters/sampling_surface_normal.h +++ b/filters/include/pcl/filters/sampling_surface_normal.h @@ -162,11 +162,11 @@ namespace pcl operator () (const int& p0, const int& p1) { if (dim == 0) - return (cloud.points[p0].x < cloud.points[p1].x); + return (cloud[p0].x < cloud[p1].x); if (dim == 1) - return (cloud.points[p0].y < cloud.points[p1].y); + return (cloud[p0].y < cloud[p1].y); if (dim == 2) - return (cloud.points[p0].z < cloud.points[p1].z); + return (cloud[p0].z < cloud[p1].z); return (false); } }; diff --git a/filters/include/pcl/filters/voxel_grid_covariance.h b/filters/include/pcl/filters/voxel_grid_covariance.h index e751d4c5769..3c77a1094ff 100644 --- a/filters/include/pcl/filters/voxel_grid_covariance.h +++ b/filters/include/pcl/filters/voxel_grid_covariance.h @@ -445,7 +445,7 @@ namespace pcl { if (index >= static_cast (cloud.points.size ()) || index < 0) return (0); - return (nearestKSearch (cloud.points[index], k, k_leaves, k_sqr_distances)); + return (nearestKSearch (cloud[index], k, k_leaves, k_sqr_distances)); } @@ -501,7 +501,7 @@ namespace pcl { if (index >= static_cast (cloud.points.size ()) || index < 0) return (0); - return (radiusSearch (cloud.points[index], radius, k_leaves, k_sqr_distances, max_nn)); + return (radiusSearch (cloud[index], radius, k_leaves, k_sqr_distances, max_nn)); } protected: diff --git a/filters/src/project_inliers.cpp b/filters/src/project_inliers.cpp index 815f3063a8c..23cf697fc99 100644 --- a/filters/src/project_inliers.cpp +++ b/filters/src/project_inliers.cpp @@ -102,9 +102,9 @@ pcl::ProjectInliers::applyFilter (PCLPointCloud2 &output) // Copy the projected points for (std::size_t i = 0; i < indices_->size (); ++i) { - memcpy (&output.data[(*indices_)[i] * output.point_step + output.fields[x_idx].offset], &cloud_out.points[(*indices_)[i]].x, sizeof (float)); - memcpy (&output.data[(*indices_)[i] * output.point_step + output.fields[y_idx].offset], &cloud_out.points[(*indices_)[i]].y, sizeof (float)); - memcpy (&output.data[(*indices_)[i] * output.point_step + output.fields[z_idx].offset], &cloud_out.points[(*indices_)[i]].z, sizeof (float)); + memcpy (&output.data[(*indices_)[i] * output.point_step + output.fields[x_idx].offset], &cloud_out[(*indices_)[i]].x, sizeof (float)); + memcpy (&output.data[(*indices_)[i] * output.point_step + output.fields[y_idx].offset], &cloud_out[(*indices_)[i]].y, sizeof (float)); + memcpy (&output.data[(*indices_)[i] * output.point_step + output.fields[z_idx].offset], &cloud_out[(*indices_)[i]].z, sizeof (float)); } } else @@ -146,9 +146,9 @@ pcl::ProjectInliers::applyFilter (PCLPointCloud2 &output) for (std::size_t i = 0; i < indices_->size (); ++i) { memcpy (&output.data[i * output.point_step], &input_->data[(*indices_)[i] * input_->point_step], output.point_step); - memcpy (&output.data[i * output.point_step + output.fields[x_idx].offset], &cloud_out.points[(*indices_)[i]].x, sizeof (float)); - memcpy (&output.data[i * output.point_step + output.fields[y_idx].offset], &cloud_out.points[(*indices_)[i]].y, sizeof (float)); - memcpy (&output.data[i * output.point_step + output.fields[z_idx].offset], &cloud_out.points[(*indices_)[i]].z, sizeof (float)); + memcpy (&output.data[i * output.point_step + output.fields[x_idx].offset], &cloud_out[(*indices_)[i]].x, sizeof (float)); + memcpy (&output.data[i * output.point_step + output.fields[y_idx].offset], &cloud_out[(*indices_)[i]].y, sizeof (float)); + memcpy (&output.data[i * output.point_step + output.fields[z_idx].offset], &cloud_out[(*indices_)[i]].z, sizeof (float)); } } } diff --git a/filters/src/voxel_grid_label.cpp b/filters/src/voxel_grid_label.cpp index 2746fadf28d..872ad6a12ff 100644 --- a/filters/src/voxel_grid_label.cpp +++ b/filters/src/voxel_grid_label.cpp @@ -313,20 +313,20 @@ pcl::VoxelGridLabel::applyFilter (PointCloud &output) // Do we need to process all the fields? if (!downsample_all_data_) { - output.points[index].x = centroid[0]; - output.points[index].y = centroid[1]; - output.points[index].z = centroid[2]; + output[index].x = centroid[0]; + output[index].y = centroid[1]; + output[index].z = centroid[2]; } else { - pcl::for_each_type (pcl::NdCopyEigenPointFunctor (centroid, output.points[index])); + pcl::for_each_type (pcl::NdCopyEigenPointFunctor (centroid, output[index])); // ---[ RGB special case if (rgba_index >= 0) { // pack r/g/b into rgb float r = centroid[centroid_size-3], g = centroid[centroid_size-2], b = centroid[centroid_size-1]; int rgb = (static_cast (r) << 16) | (static_cast (g) << 8) | static_cast (b); - memcpy (reinterpret_cast (&output.points[index]) + rgba_index, &rgb, sizeof (float)); + memcpy (reinterpret_cast (&output[index]) + rgba_index, &rgb, sizeof (float)); } if (label_index >= 0) @@ -342,7 +342,7 @@ pcl::VoxelGridLabel::applyFilter (PointCloud &output) best_label = label.first; } } - output.points[index].label = best_label; + output[index].label = best_label; } } cp = i; diff --git a/gpu/examples/octree/src/octree_search.cpp b/gpu/examples/octree/src/octree_search.cpp index fba1f0f5e5c..d0c0c50e915 100644 --- a/gpu/examples/octree/src/octree_search.cpp +++ b/gpu/examples/octree/src/octree_search.cpp @@ -90,7 +90,7 @@ int main (int argc, char** argv) for (std::size_t j = 0; j < sizes[i] ; ++j) { - cloud_result.points.push_back(cloud.points[data[j + i * max_answers]]); + cloud_result.points.push_back(cloud[data[j + i * max_answers]]); std::cout << "INFO: data : " << j << " " << j + i * max_answers << " data " << data[j+ i * max_answers] << std::endl; } std::stringstream ss; diff --git a/gpu/features/test/test_fpfh.cpp b/gpu/features/test/test_fpfh.cpp index 1c283a24c94..7f73445f24b 100644 --- a/gpu/features/test/test_fpfh.cpp +++ b/gpu/features/test/test_fpfh.cpp @@ -95,7 +95,7 @@ TEST(PCL_FeaturesGPU, fpfh_low_level) for(std::size_t i = 0; i < downloaded.size(); ++i) { FPFHSignature33& gpu = downloaded[i]; - FPFHSignature33& cpu = fpfhs.points[i]; + FPFHSignature33& cpu = fpfhs[i]; std::size_t FSize = sizeof(FPFHSignature33)/sizeof(gpu.histogram[0]); @@ -170,7 +170,7 @@ TEST(PCL_FeaturesGPU, fpfh_high_level1) for(std::size_t i = 0; i < downloaded.size(); ++i) { FPFHSignature33& gpu = downloaded[i]; - FPFHSignature33& cpu = fpfhs.points[i]; + FPFHSignature33& cpu = fpfhs[i]; std::size_t FSize = sizeof(FPFHSignature33)/sizeof(gpu.histogram[0]); @@ -248,7 +248,7 @@ TEST(PCL_FeaturesGPU, fpfh_high_level2) for(std::size_t i = 0; i < downloaded.size(); ++i) { FPFHSignature33& gpu = downloaded[i]; - FPFHSignature33& cpu = fpfhs.points[i]; + FPFHSignature33& cpu = fpfhs[i]; std::size_t FSize = sizeof(FPFHSignature33)/sizeof(gpu.histogram[0]); @@ -325,7 +325,7 @@ TEST(PCL_FeaturesGPU, fpfh_high_level3) for(std::size_t i = 0; i < downloaded.size(); ++i) { FPFHSignature33& gpu = downloaded[i]; - FPFHSignature33& cpu = fpfhs.points[i]; + FPFHSignature33& cpu = fpfhs[i]; std::size_t FSize = sizeof(FPFHSignature33)/sizeof(gpu.histogram[0]); @@ -403,7 +403,7 @@ TEST(PCL_FeaturesGPU, fpfh_high_level4) for(std::size_t i = 0; i < downloaded.size(); ++i) { FPFHSignature33& gpu = downloaded[i]; - FPFHSignature33& cpu = fpfhs.points[i]; + FPFHSignature33& cpu = fpfhs[i]; std::size_t FSize = sizeof(FPFHSignature33)/sizeof(gpu.histogram[0]); diff --git a/gpu/features/test/test_pfh.cpp b/gpu/features/test/test_pfh.cpp index 465b803090e..bde4ebe2774 100644 --- a/gpu/features/test/test_pfh.cpp +++ b/gpu/features/test/test_pfh.cpp @@ -96,7 +96,7 @@ TEST(PCL_FeaturesGPU, pfh_low_level) for(std::size_t i = 0; i < downloaded.size(); ++i) { PFHSignature125& gpu = downloaded[i]; - PFHSignature125& cpu = pfhs.points[i]; + PFHSignature125& cpu = pfhs[i]; std::size_t FSize = sizeof(PFHSignature125)/sizeof(gpu.histogram[0]); @@ -175,7 +175,7 @@ TEST(PCL_FeaturesGPU, pfh_high_level1) for(std::size_t i = 0; i < downloaded.size(); ++i) { PFHSignature125& gpu = downloaded[i]; - PFHSignature125& cpu = fpfhs.points[i]; + PFHSignature125& cpu = fpfhs[i]; std::size_t FSize = sizeof(PFHSignature125)/sizeof(gpu.histogram[0]); @@ -253,7 +253,7 @@ TEST(PCL_FeaturesGPU, pfh_high_level2) for(std::size_t i = 0; i < downloaded.size(); ++i) { PFHSignature125& gpu = downloaded[i]; - PFHSignature125& cpu = fpfhs.points[i]; + PFHSignature125& cpu = fpfhs[i]; std::size_t FSize = sizeof(PFHSignature125)/sizeof(gpu.histogram[0]); @@ -331,7 +331,7 @@ TEST(PCL_FeaturesGPU, pfh_high_level3) for(std::size_t i = 0; i < downloaded.size(); ++i) { PFHSignature125& gpu = downloaded[i]; - PFHSignature125& cpu = fpfhs.points[i]; + PFHSignature125& cpu = fpfhs[i]; std::size_t FSize = sizeof(PFHSignature125)/sizeof(gpu.histogram[0]); @@ -409,7 +409,7 @@ TEST(PCL_FeaturesGPU, pfh_high_level4) for(std::size_t i = 0; i < downloaded.size(); ++i) { PFHSignature125& gpu = downloaded[i]; - PFHSignature125& cpu = fpfhs.points[i]; + PFHSignature125& cpu = fpfhs[i]; std::size_t FSize = sizeof(PFHSignature125)/sizeof(gpu.histogram[0]); @@ -508,7 +508,7 @@ TEST(PCL_FeaturesGPU, pfhrgb) for(std::size_t i = 170; i < downloaded.size(); ++i) { PFHRGBSignature250& gpu = downloaded[i]; - PFHRGBSignature250& cpu = fpfhs.points[i]; + PFHRGBSignature250& cpu = fpfhs[i]; std::size_t FSize = sizeof(PFHRGBSignature250)/sizeof(gpu.histogram[0]); diff --git a/gpu/features/test/test_ppf.cpp b/gpu/features/test/test_ppf.cpp index 6c55481a1d1..918e62c7b1c 100644 --- a/gpu/features/test/test_ppf.cpp +++ b/gpu/features/test/test_ppf.cpp @@ -96,7 +96,7 @@ TEST(PCL_FeaturesGPU, ppf) for(std::size_t i = 0; i < downloaded.size(); ++i) { PPFSignature& gpu = downloaded[i]; - PPFSignature& cpu = ppfs.points[i]; + PPFSignature& cpu = ppfs[i]; ASSERT_NEAR(gpu.f1, cpu.f1, 0.01f); ASSERT_NEAR(gpu.f2, cpu.f2, 0.01f); @@ -173,7 +173,7 @@ TEST(PCL_FeaturesGPU, ppfrgb) for(std::size_t i = 207025; i < downloaded.size(); ++i) { PPFRGBSignature& gpu = downloaded[i]; - PPFRGBSignature& cpu = ppfs.points[i]; + PPFRGBSignature& cpu = ppfs[i]; ASSERT_NEAR(gpu.f1, cpu.f1, 0.01f); ASSERT_NEAR(gpu.f2, cpu.f2, 0.01f); @@ -264,7 +264,7 @@ TEST(PCL_FeaturesGPU, ppfrgb_region) for(std::size_t i = 0; i < downloaded.size(); ++i) { PPFRGBSignature& gpu = downloaded[i]; - PPFRGBSignature& cpu = ppfs.points[i]; + PPFRGBSignature& cpu = ppfs[i]; ASSERT_NEAR(gpu.f1, cpu.f1, 0.01f); ASSERT_NEAR(gpu.f2, cpu.f2, 0.01f); diff --git a/gpu/features/test/test_principal_curvatures.cpp b/gpu/features/test/test_principal_curvatures.cpp index 1d222f46ae5..00318560a39 100644 --- a/gpu/features/test/test_principal_curvatures.cpp +++ b/gpu/features/test/test_principal_curvatures.cpp @@ -88,7 +88,7 @@ TEST(PCL_FeaturesGPU, PrincipalCurvatures) for(std::size_t i = 0; i < downloaded.size(); ++i) { PrincipalCurvatures& gpu = downloaded[i]; - PrincipalCurvatures& cpu = pc.points[i]; + PrincipalCurvatures& cpu = pc[i]; ASSERT_NEAR(gpu.principal_curvature_x, cpu.principal_curvature_x, 0.01f); ASSERT_NEAR(gpu.principal_curvature_y, cpu.principal_curvature_y, 0.01f); diff --git a/gpu/features/test/test_vfh.cpp b/gpu/features/test/test_vfh.cpp index cb63e85e8c1..381af35fd99 100644 --- a/gpu/features/test/test_vfh.cpp +++ b/gpu/features/test/test_vfh.cpp @@ -101,7 +101,7 @@ TEST(PCL_FeaturesGPU, vfh1) } VFHSignature308& gpu = downloaded[0]; - VFHSignature308& cpu = vfh.points[0]; + VFHSignature308& cpu = vfh[0]; std::size_t FSize = sizeof(VFHSignature308)/sizeof(gpu.histogram[0]); @@ -168,7 +168,7 @@ TEST(PCL_FeaturesGPU, vfh_norm_bins_false) fe.compute (vfh); VFHSignature308& gpu = downloaded[0]; - VFHSignature308& cpu = vfh.points[0]; + VFHSignature308& cpu = vfh[0]; std::size_t FSize = sizeof(VFHSignature308)/sizeof(gpu.histogram[0]); @@ -235,7 +235,7 @@ TEST(PCL_FeaturesGPU, vfh_norm_distance_true) fe.compute (vfh); VFHSignature308& gpu = downloaded[0]; - VFHSignature308& cpu = vfh.points[0]; + VFHSignature308& cpu = vfh[0]; std::size_t FSize = sizeof(VFHSignature308)/sizeof(gpu.histogram[0]); @@ -303,7 +303,7 @@ TEST(PCL_FeaturesGPU, vfh_fill_size_component_true) fe.compute (vfh); VFHSignature308& gpu = downloaded[0]; - VFHSignature308& cpu = vfh.points[0]; + VFHSignature308& cpu = vfh[0]; std::size_t FSize = sizeof(VFHSignature308)/sizeof(gpu.histogram[0]); diff --git a/gpu/kinfu/tools/kinfu_app.cpp b/gpu/kinfu/tools/kinfu_app.cpp index e1572b80810..16aebc5b63f 100644 --- a/gpu/kinfu/tools/kinfu_app.cpp +++ b/gpu/kinfu/tools/kinfu_app.cpp @@ -270,7 +270,7 @@ typename PointCloud::Ptr merge(const PointCloud& points, const pcl::copyPointCloud (points, *merged_ptr); for (std::size_t i = 0; i < colors.size (); ++i) - merged_ptr->points[i].rgba = colors.points[i].rgba; + merged_ptr->points[i].rgba = colors[i].rgba; return merged_ptr; } diff --git a/gpu/kinfu/tools/kinfu_app_sim.cpp b/gpu/kinfu/tools/kinfu_app_sim.cpp index ca7d427163c..3398cef2824 100644 --- a/gpu/kinfu/tools/kinfu_app_sim.cpp +++ b/gpu/kinfu/tools/kinfu_app_sim.cpp @@ -533,7 +533,7 @@ typename PointCloud::Ptr merge(const PointCloud& points, const //pcl::concatenateFields (points, colors, *merged_ptr); why error? for (std::size_t i = 0; i < colors.size (); ++i) - merged_ptr->points[i].rgba = colors.points[i].rgba; + merged_ptr->points[i].rgba = colors[i].rgba; return merged_ptr; } diff --git a/gpu/kinfu_large_scale/include/pcl/gpu/kinfu_large_scale/impl/standalone_marching_cubes.hpp b/gpu/kinfu_large_scale/include/pcl/gpu/kinfu_large_scale/impl/standalone_marching_cubes.hpp index a20af684801..108532711d3 100644 --- a/gpu/kinfu_large_scale/include/pcl/gpu/kinfu_large_scale/impl/standalone_marching_cubes.hpp +++ b/gpu/kinfu_large_scale/include/pcl/gpu/kinfu_large_scale/impl/standalone_marching_cubes.hpp @@ -196,9 +196,9 @@ pcl::gpu::kinfuLS::StandaloneMarchingCubes::convertTsdfVectors (const Po shared(cloud, output) for(int i = 0; i < (int) cloud.points.size (); ++i) { - int x = cloud.points[i].x; - int y = cloud.points[i].y; - int z = cloud.points[i].z; + int x = cloud[i].x; + int y = cloud[i].y; + int z = cloud[i].z; if(x > 0 && x < voxels_x_ && y > 0 && y < voxels_y_ && z > 0 && z < voxels_z_) { @@ -206,7 +206,7 @@ pcl::gpu::kinfuLS::StandaloneMarchingCubes::convertTsdfVectors (const Po int dst_index = x + voxels_x_ * y + voxels_y_ * voxels_x_ * z; short2& elem = *reinterpret_cast (&output[dst_index]); - elem.x = static_cast (cloud.points[i].intensity * DIVISOR); + elem.x = static_cast (cloud[i].intensity * DIVISOR); elem.y = static_cast (1); } } diff --git a/gpu/kinfu_large_scale/tools/kinfuLS_app.cpp b/gpu/kinfu_large_scale/tools/kinfuLS_app.cpp index 350fd615cb2..1f34ba9bee4 100644 --- a/gpu/kinfu_large_scale/tools/kinfuLS_app.cpp +++ b/gpu/kinfu_large_scale/tools/kinfuLS_app.cpp @@ -220,7 +220,7 @@ typename PointCloud::Ptr merge(const PointCloud& points, const pcl::copyPointCloud (points, *merged_ptr); for (std::size_t i = 0; i < colors.size (); ++i) - merged_ptr->points[i].rgba = colors.points[i].rgba; + merged_ptr->points[i].rgba = colors[i].rgba; return merged_ptr; } diff --git a/gpu/kinfu_large_scale/tools/kinfu_app_sim.cpp b/gpu/kinfu_large_scale/tools/kinfu_app_sim.cpp index fa8ab9156a0..0cb02140e3c 100644 --- a/gpu/kinfu_large_scale/tools/kinfu_app_sim.cpp +++ b/gpu/kinfu_large_scale/tools/kinfu_app_sim.cpp @@ -530,7 +530,7 @@ typename PointCloud::Ptr merge(const PointCloud& points, const //pcl::concatenateFields (points, colors, *merged_ptr); why error? for (std::size_t i = 0; i < colors.size (); ++i) - merged_ptr->points[i].rgba = colors.points[i].rgba; + merged_ptr->points[i].rgba = colors[i].rgba; return merged_ptr; } diff --git a/gpu/octree/test/test_knn_search.cpp b/gpu/octree/test/test_knn_search.cpp index 8b5856fbfdd..7bfbc4090ba 100644 --- a/gpu/octree/test/test_knn_search.cpp +++ b/gpu/octree/test/test_knn_search.cpp @@ -165,7 +165,7 @@ TEST(PCL_OctreeGPU, exactNeighbourSearch) PriorityPair gpu; gpu.index = downloaded_cur[n]; - float dist = (data.queries[i].getVector3fMap() - data.points[gpu.index].getVector3fMap()).norm(); + float dist = (data.queries[i].getVector3fMap() - data[gpu.index].getVector3fMap()).norm(); gpu.dist2 = dist * dist; pairs_gpu.push_back(gpu); } diff --git a/gpu/people/src/bodyparts_detector.cpp b/gpu/people/src/bodyparts_detector.cpp index 14cfae775a1..bce429bb513 100644 --- a/gpu/people/src/bodyparts_detector.cpp +++ b/gpu/people/src/bodyparts_detector.cpp @@ -214,7 +214,7 @@ pcl::gpu::people::RDFBodyPartsDetector::process (const pcl::device::Depth& depth for(std::size_t k = 0; k < dst_labels_.size(); ++k) { - const PointXYZ& p = cloud.points[k]; + const PointXYZ& p = cloud[k]; int cc = dst_labels_[k]; means[cc].x += p.x; means[cc].y += p.y; @@ -308,7 +308,7 @@ pcl::gpu::people::RDFBodyPartsDetector::processSmooth (const pcl::device::Depth& for(std::size_t k = 0; k < dst_labels_.size(); ++k) { - const PointXYZ& p = cloud.points[k]; + const PointXYZ& p = cloud[k]; int cc = dst_labels_[k]; means[cc].x += p.x; means[cc].y += p.y; diff --git a/gpu/people/src/colormap.cpp b/gpu/people/src/colormap.cpp index c8c208b27ea..81ea27814dc 100644 --- a/gpu/people/src/colormap.cpp +++ b/gpu/people/src/colormap.cpp @@ -72,7 +72,7 @@ void pcl::gpu::people::colorLMap (const pcl::PointCloud& cloud_in, p { colormap_out.resize(cloud_in.size()); for(std::size_t i = 0; i < cloud_in.size (); i++) - colormap_out.points[i] = getLColor(cloud_in.points[i]); + colormap_out[i] = getLColor(cloud_in[i]); colormap_out.width = cloud_in.width; colormap_out.height = cloud_in.height; diff --git a/gpu/people/src/cuda/shs.cu b/gpu/people/src/cuda/shs.cu index aa801de206c..b3c1f02e3de 100644 --- a/gpu/people/src/cuda/shs.cu +++ b/gpu/people/src/cuda/shs.cu @@ -164,7 +164,7 @@ void optimized_shs5(const PointCloud &cloud, float tolerance, const for(std::size_t i = 0; i < cloud.points.size(); ++i) { PointXYZHSV h; - PointXYZRGB p = cloud.points[i]; + PointXYZRGB p = cloud[i]; PointXYZRGBtoXYZHSV(p, h); hue[i] = h.h; } @@ -194,13 +194,13 @@ void optimized_shs5(const PointCloud &cloud, float tolerance, const int sq_idx = 0; seed_queue.push_back (i); - PointXYZRGB p = cloud.points[i]; + PointXYZRGB p = cloud[i]; float h = hue[i]; while (sq_idx < (int)seed_queue.size ()) { int index = seed_queue[sq_idx]; - const PointXYZRGB& q = cloud.points[index]; + const PointXYZRGB& q = cloud[index]; if(!isFinite (q)) continue; @@ -228,7 +228,7 @@ void optimized_shs5(const PointCloud &cloud, float tolerance, const if (mask[idx]) continue; - if (sqnorm(cloud.points[idx], q) <= squared_radius) + if (sqnorm(cloud[idx], q) <= squared_radius) { float h_l = hue[idx]; diff --git a/gpu/people/src/organized_plane_detector.cpp b/gpu/people/src/organized_plane_detector.cpp index 94abc5e2082..35a62756ceb 100644 --- a/gpu/people/src/organized_plane_detector.cpp +++ b/gpu/people/src/organized_plane_detector.cpp @@ -112,7 +112,7 @@ pcl::gpu::people::OrganizedPlaneDetector::process(const PointCloud::Con { for(const int &index : inlier_index.indices) // iterate over all the indices in that plane { - P_l_host_.points[index].probs[pcl::gpu::people::Background] = 1.f; // set background at max + P_l_host_[index].probs[pcl::gpu::people::Background] = 1.f; // set background at max } } } @@ -162,7 +162,7 @@ pcl::gpu::people::OrganizedPlaneDetector::copyHostLabelProbability(HostLabelProb { for(int label = 0; label < pcl::gpu::people::NUM_LABELS; label++) { - dst.points[hist].probs[label] = src.points[hist].probs[label]; + dst[hist].probs[label] = src[hist].probs[label]; } } return 1; @@ -181,8 +181,8 @@ pcl::gpu::people::OrganizedPlaneDetector::copyAndClearHostLabelProbability(HostL { for(int label = 0; label < pcl::gpu::people::NUM_LABELS; label++) { - dst.points[hist].probs[label] = src.points[hist].probs[label]; - src.points[hist].probs[label] = 0.f; + dst[hist].probs[label] = src[hist].probs[label]; + src[hist].probs[label] = 0.f; } } return 1; diff --git a/gpu/people/src/people_detector.cpp b/gpu/people/src/people_detector.cpp index cd284138584..447f09d700a 100644 --- a/gpu/people/src/people_detector.cpp +++ b/gpu/people/src/people_detector.cpp @@ -162,14 +162,14 @@ pcl::gpu::people::PeopleDetector::process (const pcl::PointCloud::Const for(std::size_t i = 0; i < cloud->points.size(); ++i) { - cloud_host_.points[i].x = cloud->points[i].x; - cloud_host_.points[i].y = cloud->points[i].y; - cloud_host_.points[i].z = cloud->points[i].z; + cloud_host_[i].x = cloud->points[i].x; + cloud_host_[i].y = cloud->points[i].y; + cloud_host_[i].z = cloud->points[i].z; - bool valid = isFinite(cloud_host_.points[i]); + bool valid = isFinite(cloud_host_[i]); - hue_host_.points[i] = !valid ? qnan : device::computeHue(cloud->points[i].rgba); - depth_host_.points[i] = !valid ? 0 : static_cast(cloud_host_.points[i].z * 1000); //m -> mm + hue_host_[i] = !valid ? qnan : device::computeHue(cloud->points[i].rgba); + depth_host_[i] = !valid ? 0 : static_cast(cloud_host_[i].z * 1000); //m -> mm } cloud_device_.upload(cloud_host_.points, cloud_host_.width); hue_device_.upload(hue_host_.points, hue_host_.width); @@ -199,7 +199,7 @@ pcl::gpu::people::PeopleDetector::process () std::fill(flowermat_host_.points.begin(), flowermat_host_.points.end(), 0); { //ScopeTime time("shs"); - shs5(cloud_host_, seed, &flowermat_host_.points[0]); + shs5(cloud_host_, seed, &flowermat_host_[0]); } int cols = cloud_device_.cols(); @@ -249,15 +249,15 @@ pcl::gpu::people::PeopleDetector::processProb (const pcl::PointCloud::C for(std::size_t i = 0; i < cloud->points.size(); ++i) { - cloud_host_color_.points[i].x = cloud_host_.points[i].x = cloud->points[i].x; - cloud_host_color_.points[i].y = cloud_host_.points[i].y = cloud->points[i].y; - cloud_host_color_.points[i].z = cloud_host_.points[i].z = cloud->points[i].z; - cloud_host_color_.points[i].rgba = cloud->points[i].rgba; + cloud_host_color_[i].x = cloud_host_[i].x = cloud->points[i].x; + cloud_host_color_[i].y = cloud_host_[i].y = cloud->points[i].y; + cloud_host_color_[i].z = cloud_host_[i].z = cloud->points[i].z; + cloud_host_color_[i].rgba = cloud->points[i].rgba; - bool valid = isFinite(cloud_host_.points[i]); + bool valid = isFinite(cloud_host_[i]); - hue_host_.points[i] = !valid ? qnan : device::computeHue(cloud->points[i].rgba); - depth_host_.points[i] = !valid ? 0 : static_cast(cloud_host_.points[i].z * 1000); //m -> mm + hue_host_[i] = !valid ? qnan : device::computeHue(cloud->points[i].rgba); + depth_host_[i] = !valid ? 0 : static_cast(cloud_host_[i].z * 1000); //m -> mm } cloud_device_.upload(cloud_host_.points, cloud_host_.width); hue_device_.upload(hue_host_.points, hue_host_.width); @@ -338,7 +338,7 @@ pcl::gpu::people::PeopleDetector::processProb () std::fill(flowermat_host_.points.begin(), flowermat_host_.points.end(), 0); { //ScopeTime time("shs"); - shs5(cloud_host_, seed, &flowermat_host_.points[0]); + shs5(cloud_host_, seed, &flowermat_host_[0]); } int cols = cloud_device_.cols(); @@ -479,7 +479,7 @@ pcl::gpu::people::PeopleDetector::shs5(const pcl::PointCloud &cloud, con pcl::device::Intr intr(fx_, fy_, cx_, cy_); intr.setDefaultPPIfIncorrect(cloud.width, cloud.height); - const float *hue = &hue_host_.points[0]; + const float *hue = &hue_host_[0]; double squared_radius = CLUST_TOL_SHS * CLUST_TOL_SHS; std::vector< std::vector > storage(100); @@ -512,7 +512,7 @@ pcl::gpu::people::PeopleDetector::shs5(const pcl::PointCloud &cloud, con while (sq_idx < (int)seed_queue.size ()) { int index = seed_queue[sq_idx]; - const PointT& q = cloud.points[index]; + const PointT& q = cloud[index]; if(!pcl::isFinite (q)) continue; @@ -532,7 +532,7 @@ pcl::gpu::people::PeopleDetector::shs5(const pcl::PointCloud &cloud, con if (mask[idx]) continue; - if (sqnorm(cloud.points[idx], q) <= squared_radius) + if (sqnorm(cloud[idx], q) <= squared_radius) { float h_l = hue[idx]; diff --git a/gpu/people/tools/people_app.cpp b/gpu/people/tools/people_app.cpp index fb63014d6ca..707ded16a36 100644 --- a/gpu/people/tools/people_app.cpp +++ b/gpu/people/tools/people_app.cpp @@ -191,7 +191,7 @@ class PeoplePCDApp people_detector_.depth_device1_.download(depth_host_.points, c); } - depth_view_.showShortImage(&depth_host_.points[0], depth_host_.width, depth_host_.height, 0, 5000, true); + depth_view_.showShortImage(&depth_host_[0], depth_host_.width, depth_host_.height, 0, 5000, true); depth_view_.spinOnce(1, true); if (write_) @@ -238,7 +238,7 @@ class PeoplePCDApp depth_host_.points.resize(w *h); depth_host_.width = w; depth_host_.height = h; - std::copy(data, data + w * h, &depth_host_.points[0]); + std::copy(data, data + w * h, &depth_host_[0]); //getting image w = image_wrapper->getWidth(); @@ -256,12 +256,12 @@ class PeoplePCDApp for(std::size_t i = 0; i < rgba_host_.size(); ++i) { const unsigned char *pixel = &rgb_host_[i * 3]; - pcl::RGB& rgba = rgba_host_.points[i]; + pcl::RGB& rgba = rgba_host_[i]; rgba.r = pixel[0]; rgba.g = pixel[1]; rgba.b = pixel[2]; } - image_device_.upload(&rgba_host_.points[0], s, h, w); + image_device_.upload(&rgba_host_[0], s, h, w); } data_ready_cond_.notify_one(); } diff --git a/io/include/pcl/compression/organized_pointcloud_conversion.h b/io/include/pcl/compression/organized_pointcloud_conversion.h index e799e73ef40..44f0d96f8ee 100644 --- a/io/include/pcl/compression/organized_pointcloud_conversion.h +++ b/io/include/pcl/compression/organized_pointcloud_conversion.h @@ -108,7 +108,7 @@ struct OrganizedConversion for (std::size_t i = 0; i < cloud_size; ++i) { // Get point from cloud - const PointT& point = cloud_arg.points[i]; + const PointT& point = cloud_arg[i]; if (pcl::isFinite (point)) { @@ -296,7 +296,7 @@ struct OrganizedConversion for (std::size_t i = 0; i < cloud_size; ++i) { - const PointT& point = cloud_arg.points[i]; + const PointT& point = cloud_arg[i]; if (pcl::isFinite (point)) { diff --git a/io/include/pcl/io/impl/lzf_image_io.hpp b/io/include/pcl/io/impl/lzf_image_io.hpp index bd8ae741d75..5bd15762960 100644 --- a/io/include/pcl/io/impl/lzf_image_io.hpp +++ b/io/include/pcl/io/impl/lzf_image_io.hpp @@ -96,7 +96,7 @@ LZFDepth16ImageReader::read ( { for (std::uint32_t u = 0; u < cloud.width; ++u, ++point_idx, depth_idx += 2) { - PointT &pt = cloud.points[point_idx]; + PointT &pt = cloud[point_idx]; unsigned short val; memcpy (&val, &uncompressed_data[depth_idx], sizeof (unsigned short)); if (val == 0) @@ -169,7 +169,7 @@ LZFDepth16ImageReader::readOMP (const std::string &filename, { int u = i % cloud.width; int v = i / cloud.width; - PointT &pt = cloud.points[i]; + PointT &pt = cloud[i]; int depth_idx = 2*i; unsigned short val; memcpy (&val, &uncompressed_data[depth_idx], sizeof (unsigned short)); @@ -242,7 +242,7 @@ LZFRGB24ImageReader::read ( for (std::size_t i = 0; i < cloud.size (); ++i, ++rgb_idx) { - PointT &pt = cloud.points[i]; + PointT &pt = cloud[i]; pt.b = color_b[rgb_idx]; pt.g = color_g[rgb_idx]; @@ -298,7 +298,7 @@ LZFRGB24ImageReader::readOMP ( #endif//_OPENMP for (long int i = 0; i < cloud.size (); ++i) { - PointT &pt = cloud.points[i]; + PointT &pt = cloud[i]; pt.b = color_b[i]; pt.g = color_g[i]; @@ -351,12 +351,12 @@ LZFYUV422ImageReader::read ( int v = color_v[i] - 128; int u = color_u[i] - 128; - PointT &pt1 = cloud.points[y_idx + 0]; + PointT &pt1 = cloud[y_idx + 0]; pt1.r = CLIP_CHAR (color_y[y_idx + 0] + ((v * 18678 + 8192 ) >> 14)); pt1.g = CLIP_CHAR (color_y[y_idx + 0] + ((v * -9519 - u * 6472 + 8192) >> 14)); pt1.b = CLIP_CHAR (color_y[y_idx + 0] + ((u * 33292 + 8192 ) >> 14)); - PointT &pt2 = cloud.points[y_idx + 1]; + PointT &pt2 = cloud[y_idx + 1]; pt2.r = CLIP_CHAR (color_y[y_idx + 1] + ((v * 18678 + 8192 ) >> 14)); pt2.g = CLIP_CHAR (color_y[y_idx + 1] + ((v * -9519 - u * 6472 + 8192) >> 14)); pt2.b = CLIP_CHAR (color_y[y_idx + 1] + ((u * 33292 + 8192 ) >> 14)); @@ -417,12 +417,12 @@ LZFYUV422ImageReader::readOMP ( int v = color_v[i] - 128; int u = color_u[i] - 128; - PointT &pt1 = cloud.points[y_idx + 0]; + PointT &pt1 = cloud[y_idx + 0]; pt1.r = CLIP_CHAR (color_y[y_idx + 0] + ((v * 18678 + 8192 ) >> 14)); pt1.g = CLIP_CHAR (color_y[y_idx + 0] + ((v * -9519 - u * 6472 + 8192) >> 14)); pt1.b = CLIP_CHAR (color_y[y_idx + 0] + ((u * 33292 + 8192 ) >> 14)); - PointT &pt2 = cloud.points[y_idx + 1]; + PointT &pt2 = cloud[y_idx + 1]; pt2.r = CLIP_CHAR (color_y[y_idx + 1] + ((v * 18678 + 8192 ) >> 14)); pt2.g = CLIP_CHAR (color_y[y_idx + 1] + ((v * -9519 - u * 6472 + 8192) >> 14)); pt2.b = CLIP_CHAR (color_y[y_idx + 1] + ((u * 33292 + 8192 ) >> 14)); @@ -472,7 +472,7 @@ LZFBayer8ImageReader::read ( int rgb_idx = 0; for (std::size_t i = 0; i < cloud.size (); ++i, rgb_idx += 3) { - PointT &pt = cloud.points[i]; + PointT &pt = cloud[i]; pt.b = rgb_buffer[rgb_idx + 2]; pt.g = rgb_buffer[rgb_idx + 1]; @@ -528,7 +528,7 @@ LZFBayer8ImageReader::readOMP ( #endif//_OPENMP for (long int i = 0; i < cloud.size (); ++i) { - PointT &pt = cloud.points[i]; + PointT &pt = cloud[i]; long int rgb_idx = 3*i; pt.b = rgb_buffer[rgb_idx + 2]; pt.g = rgb_buffer[rgb_idx + 1]; diff --git a/io/include/pcl/io/impl/pcd_io.hpp b/io/include/pcl/io/impl/pcd_io.hpp index 6a78597ccda..a9492765fa5 100644 --- a/io/include/pcl/io/impl/pcd_io.hpp +++ b/io/include/pcl/io/impl/pcd_io.hpp @@ -203,7 +203,7 @@ pcl::PCDWriter::writeBinary (const std::string &file_name, int nrj = 0; for (const auto &field : fields) { - memcpy (out, reinterpret_cast (&cloud.points[i]) + field.offset, fields_sizes[nrj]); + memcpy (out, reinterpret_cast (&cloud[i]) + field.offset, fields_sizes[nrj]); out += fields_sizes[nrj++]; } } @@ -331,7 +331,7 @@ pcl::PCDWriter::writeBinaryCompressed (const std::string &file_name, { for (std::size_t j = 0; j < fields.size (); ++j) { - memcpy (pters[j], reinterpret_cast (&cloud.points[i]) + fields[j].offset, fields_sizes[j]); + memcpy (pters[j], reinterpret_cast (&cloud[i]) + fields[j].offset, fields_sizes[j]); // Increment the pointer pters[j] += fields_sizes[j]; } @@ -489,42 +489,42 @@ pcl::PCDWriter::writeASCII (const std::string &file_name, const pcl::PointCloud< case pcl::PCLPointField::INT8: { std::int8_t value; - memcpy (&value, reinterpret_cast (&cloud.points[i]) + fields[d].offset + c * sizeof (std::int8_t), sizeof (std::int8_t)); + memcpy (&value, reinterpret_cast (&cloud[i]) + fields[d].offset + c * sizeof (std::int8_t), sizeof (std::int8_t)); stream << boost::numeric_cast(value); break; } case pcl::PCLPointField::UINT8: { std::uint8_t value; - memcpy (&value, reinterpret_cast (&cloud.points[i]) + fields[d].offset + c * sizeof (std::uint8_t), sizeof (std::uint8_t)); + memcpy (&value, reinterpret_cast (&cloud[i]) + fields[d].offset + c * sizeof (std::uint8_t), sizeof (std::uint8_t)); stream << boost::numeric_cast(value); break; } case pcl::PCLPointField::INT16: { std::int16_t value; - memcpy (&value, reinterpret_cast (&cloud.points[i]) + fields[d].offset + c * sizeof (std::int16_t), sizeof (std::int16_t)); + memcpy (&value, reinterpret_cast (&cloud[i]) + fields[d].offset + c * sizeof (std::int16_t), sizeof (std::int16_t)); stream << boost::numeric_cast(value); break; } case pcl::PCLPointField::UINT16: { std::uint16_t value; - memcpy (&value, reinterpret_cast (&cloud.points[i]) + fields[d].offset + c * sizeof (std::uint16_t), sizeof (std::uint16_t)); + memcpy (&value, reinterpret_cast (&cloud[i]) + fields[d].offset + c * sizeof (std::uint16_t), sizeof (std::uint16_t)); stream << boost::numeric_cast(value); break; } case pcl::PCLPointField::INT32: { std::int32_t value; - memcpy (&value, reinterpret_cast (&cloud.points[i]) + fields[d].offset + c * sizeof (std::int32_t), sizeof (std::int32_t)); + memcpy (&value, reinterpret_cast (&cloud[i]) + fields[d].offset + c * sizeof (std::int32_t), sizeof (std::int32_t)); stream << boost::numeric_cast(value); break; } case pcl::PCLPointField::UINT32: { std::uint32_t value; - memcpy (&value, reinterpret_cast (&cloud.points[i]) + fields[d].offset + c * sizeof (std::uint32_t), sizeof (std::uint32_t)); + memcpy (&value, reinterpret_cast (&cloud[i]) + fields[d].offset + c * sizeof (std::uint32_t), sizeof (std::uint32_t)); stream << boost::numeric_cast(value); break; } @@ -538,12 +538,12 @@ pcl::PCDWriter::writeASCII (const std::string &file_name, const pcl::PointCloud< if ("rgb" == fields[d].name) { std::uint32_t value; - memcpy (&value, reinterpret_cast (&cloud.points[i]) + fields[d].offset + c * sizeof (float), sizeof (float)); + memcpy (&value, reinterpret_cast (&cloud[i]) + fields[d].offset + c * sizeof (float), sizeof (float)); stream << boost::numeric_cast(value); break; } float value; - memcpy (&value, reinterpret_cast (&cloud.points[i]) + fields[d].offset + c * sizeof (float), sizeof (float)); + memcpy (&value, reinterpret_cast (&cloud[i]) + fields[d].offset + c * sizeof (float), sizeof (float)); if (std::isnan (value)) stream << "nan"; else @@ -553,7 +553,7 @@ pcl::PCDWriter::writeASCII (const std::string &file_name, const pcl::PointCloud< case pcl::PCLPointField::FLOAT64: { double value; - memcpy (&value, reinterpret_cast (&cloud.points[i]) + fields[d].offset + c * sizeof (double), sizeof (double)); + memcpy (&value, reinterpret_cast (&cloud[i]) + fields[d].offset + c * sizeof (double), sizeof (double)); if (std::isnan (value)) stream << "nan"; else @@ -675,7 +675,7 @@ pcl::PCDWriter::writeBinary (const std::string &file_name, int nrj = 0; for (const auto &field : fields) { - memcpy (out, reinterpret_cast (&cloud.points[index]) + field.offset, fields_sizes[nrj]); + memcpy (out, reinterpret_cast (&cloud[index]) + field.offset, fields_sizes[nrj]); out += fields_sizes[nrj++]; } } @@ -772,42 +772,42 @@ pcl::PCDWriter::writeASCII (const std::string &file_name, case pcl::PCLPointField::INT8: { std::int8_t value; - memcpy (&value, reinterpret_cast (&cloud.points[index]) + fields[d].offset + c * sizeof (std::int8_t), sizeof (std::int8_t)); + memcpy (&value, reinterpret_cast (&cloud[index]) + fields[d].offset + c * sizeof (std::int8_t), sizeof (std::int8_t)); stream << boost::numeric_cast(value); break; } case pcl::PCLPointField::UINT8: { std::uint8_t value; - memcpy (&value, reinterpret_cast (&cloud.points[index]) + fields[d].offset + c * sizeof (std::uint8_t), sizeof (std::uint8_t)); + memcpy (&value, reinterpret_cast (&cloud[index]) + fields[d].offset + c * sizeof (std::uint8_t), sizeof (std::uint8_t)); stream << boost::numeric_cast(value); break; } case pcl::PCLPointField::INT16: { std::int16_t value; - memcpy (&value, reinterpret_cast (&cloud.points[index]) + fields[d].offset + c * sizeof (std::int16_t), sizeof (std::int16_t)); + memcpy (&value, reinterpret_cast (&cloud[index]) + fields[d].offset + c * sizeof (std::int16_t), sizeof (std::int16_t)); stream << boost::numeric_cast(value); break; } case pcl::PCLPointField::UINT16: { std::uint16_t value; - memcpy (&value, reinterpret_cast (&cloud.points[index]) + fields[d].offset + c * sizeof (std::uint16_t), sizeof (std::uint16_t)); + memcpy (&value, reinterpret_cast (&cloud[index]) + fields[d].offset + c * sizeof (std::uint16_t), sizeof (std::uint16_t)); stream << boost::numeric_cast(value); break; } case pcl::PCLPointField::INT32: { std::int32_t value; - memcpy (&value, reinterpret_cast (&cloud.points[index]) + fields[d].offset + c * sizeof (std::int32_t), sizeof (std::int32_t)); + memcpy (&value, reinterpret_cast (&cloud[index]) + fields[d].offset + c * sizeof (std::int32_t), sizeof (std::int32_t)); stream << boost::numeric_cast(value); break; } case pcl::PCLPointField::UINT32: { std::uint32_t value; - memcpy (&value, reinterpret_cast (&cloud.points[index]) + fields[d].offset + c * sizeof (std::uint32_t), sizeof (std::uint32_t)); + memcpy (&value, reinterpret_cast (&cloud[index]) + fields[d].offset + c * sizeof (std::uint32_t), sizeof (std::uint32_t)); stream << boost::numeric_cast(value); break; } @@ -821,13 +821,13 @@ pcl::PCDWriter::writeASCII (const std::string &file_name, if ("rgb" == fields[d].name) { std::uint32_t value; - memcpy (&value, reinterpret_cast (&cloud.points[index]) + fields[d].offset + c * sizeof (float), sizeof (float)); + memcpy (&value, reinterpret_cast (&cloud[index]) + fields[d].offset + c * sizeof (float), sizeof (float)); stream << boost::numeric_cast(value); } else { float value; - memcpy (&value, reinterpret_cast (&cloud.points[index]) + fields[d].offset + c * sizeof (float), sizeof (float)); + memcpy (&value, reinterpret_cast (&cloud[index]) + fields[d].offset + c * sizeof (float), sizeof (float)); if (std::isnan (value)) stream << "nan"; else @@ -838,7 +838,7 @@ pcl::PCDWriter::writeASCII (const std::string &file_name, case pcl::PCLPointField::FLOAT64: { double value; - memcpy (&value, reinterpret_cast (&cloud.points[index]) + fields[d].offset + c * sizeof (double), sizeof (double)); + memcpy (&value, reinterpret_cast (&cloud[index]) + fields[d].offset + c * sizeof (double), sizeof (double)); if (std::isnan (value)) stream << "nan"; else diff --git a/io/include/pcl/io/impl/point_cloud_image_extractors.hpp b/io/include/pcl/io/impl/point_cloud_image_extractors.hpp index 17e5838426c..57260e267d5 100644 --- a/io/include/pcl/io/impl/point_cloud_image_extractors.hpp +++ b/io/include/pcl/io/impl/point_cloud_image_extractors.hpp @@ -91,9 +91,9 @@ pcl::io::PointCloudImageExtractorFromNormalField::extractImpl (const Poi float x; float y; float z; - pcl::getFieldValue (cloud.points[i], offset_x, x); - pcl::getFieldValue (cloud.points[i], offset_y, y); - pcl::getFieldValue (cloud.points[i], offset_z, z); + pcl::getFieldValue (cloud[i], offset_x, x); + pcl::getFieldValue (cloud[i], offset_y, y); + pcl::getFieldValue (cloud[i], offset_z, z); img.data[i * 3 + 0] = static_cast((x + 1.0) * 127); img.data[i * 3 + 1] = static_cast((y + 1.0) * 127); img.data[i * 3 + 2] = static_cast((z + 1.0) * 127); @@ -125,7 +125,7 @@ pcl::io::PointCloudImageExtractorFromRGBField::extractImpl (const PointC for (std::size_t i = 0; i < cloud.points.size (); ++i) { std::uint32_t val; - pcl::getFieldValue (cloud.points[i], offset, val); + pcl::getFieldValue (cloud[i], offset, val); img.data[i * 3 + 0] = (val >> 16) & 0x0000ff; img.data[i * 3 + 1] = (val >> 8) & 0x0000ff; img.data[i * 3 + 2] = (val) & 0x0000ff; @@ -157,7 +157,7 @@ pcl::io::PointCloudImageExtractorFromLabelField::extractImpl (const Poin for (std::size_t i = 0; i < cloud.points.size (); ++i) { std::uint32_t val; - pcl::getFieldValue (cloud.points[i], offset, val); + pcl::getFieldValue (cloud[i], offset, val); data[i] = static_cast(val); } break; @@ -176,7 +176,7 @@ pcl::io::PointCloudImageExtractorFromLabelField::extractImpl (const Poin for (std::size_t i = 0; i < cloud.points.size (); ++i) { std::uint32_t val; - pcl::getFieldValue (cloud.points[i], offset, val); + pcl::getFieldValue (cloud[i], offset, val); if (colormap.count (val) == 0) { colormap[val] = i * 3; @@ -207,10 +207,10 @@ pcl::io::PointCloudImageExtractorFromLabelField::extractImpl (const Poin for (std::size_t i = 0; i < cloud.points.size (); ++i) { // If we need to paint NaN points with black do not waste colors on them - if (paint_nans_with_black_ && !pcl::isFinite (cloud.points[i])) + if (paint_nans_with_black_ && !pcl::isFinite (cloud[i])) continue; std::uint32_t val; - pcl::getFieldValue (cloud.points[i], offset, val); + pcl::getFieldValue (cloud[i], offset, val); labels.insert (val); } @@ -228,7 +228,7 @@ pcl::io::PointCloudImageExtractorFromLabelField::extractImpl (const Poin for (std::size_t i = 0; i < cloud.points.size (); ++i) { std::uint32_t val; - pcl::getFieldValue (cloud.points[i], offset, val); + pcl::getFieldValue (cloud[i], offset, val); memcpy (&img.data[i * 3], GlasbeyLUT::data () + colormap[val] * 3, 3); } @@ -265,7 +265,7 @@ pcl::io::PointCloudImageExtractorWithScaling::extractImpl (const PointCl for (std::size_t i = 0; i < cloud.points.size (); ++i) { float val; - pcl::getFieldValue (cloud.points[i], offset, val); + pcl::getFieldValue (cloud[i], offset, val); if (val < min) min = val; if (val > max) @@ -278,7 +278,7 @@ pcl::io::PointCloudImageExtractorWithScaling::extractImpl (const PointCl for (std::size_t i = 0; i < cloud.points.size (); ++i) { float val; - pcl::getFieldValue (cloud.points[i], offset, val); + pcl::getFieldValue (cloud[i], offset, val); if (scaling_method_ == SCALING_NO) { data[i] = val; diff --git a/io/include/pcl/io/impl/vtk_lib_io.hpp b/io/include/pcl/io/impl/vtk_lib_io.hpp index 59beb8be2ea..9f873f78cf9 100644 --- a/io/include/pcl/io/impl/vtk_lib_io.hpp +++ b/io/include/pcl/io/impl/vtk_lib_io.hpp @@ -101,9 +101,9 @@ pcl::io::vtkPolyDataToPointCloud (vtkPolyData* const polydata, pcl::PointCloud

GetPoint (i, coordinate); - pcl::setFieldValue (cloud.points[i], x_idx, coordinate[0]); - pcl::setFieldValue (cloud.points[i], y_idx, coordinate[1]); - pcl::setFieldValue (cloud.points[i], z_idx, coordinate[2]); + pcl::setFieldValue (cloud[i], x_idx, coordinate[0]); + pcl::setFieldValue (cloud[i], y_idx, coordinate[1]); + pcl::setFieldValue (cloud[i], z_idx, coordinate[2]); } } @@ -126,9 +126,9 @@ pcl::io::vtkPolyDataToPointCloud (vtkPolyData* const polydata, pcl::PointCloud

GetTupleValue (i, normal); - pcl::setFieldValue (cloud.points[i], normal_x_idx, normal[0]); - pcl::setFieldValue (cloud.points[i], normal_y_idx, normal[1]); - pcl::setFieldValue (cloud.points[i], normal_z_idx, normal[2]); + pcl::setFieldValue (cloud[i], normal_x_idx, normal[0]); + pcl::setFieldValue (cloud[i], normal_y_idx, normal[1]); + pcl::setFieldValue (cloud[i], normal_z_idx, normal[2]); } } @@ -152,7 +152,7 @@ pcl::io::vtkPolyDataToPointCloud (vtkPolyData* const polydata, pcl::PointCloud

GetTupleValue (i, color); pcl::RGB rgb; rgb.r = color[0]; rgb.g = color[1]; rgb.b = color[2]; - pcl::setFieldValue (cloud.points[i], rgb_idx, rgb.rgba); + pcl::setFieldValue (cloud[i], rgb_idx, rgb.rgba); } } } diff --git a/io/src/depth_sense/depth_sense_grabber_impl.cpp b/io/src/depth_sense/depth_sense_grabber_impl.cpp index 6cb6b48b57d..7d1c92d5587 100644 --- a/io/src/depth_sense/depth_sense_grabber_impl.cpp +++ b/io/src/depth_sense/depth_sense_grabber_impl.cpp @@ -250,16 +250,16 @@ pcl::io::depth_sense::DepthSenseGrabberImpl::computeXYZ (PointCloud& clou point.depth = (*depth_buffer_)[i]; if (std::isnan (point.depth)) { - cloud.points[i].x = nan; - cloud.points[i].y = nan; - cloud.points[i].z = nan; + cloud[i].x = nan; + cloud[i].y = nan; + cloud[i].z = nan; } else { projection_->get3DCoordinates (&point, &vertex, 1); - cloud.points[i].x = vertex.x; - cloud.points[i].y = vertex.y; - cloud.points[i].z = vertex.z; + cloud[i].x = vertex.x; + cloud[i].y = vertex.y; + cloud[i].z = vertex.z; } point.point.x += 1; ++i; diff --git a/io/src/ensenso_grabber.cpp b/io/src/ensenso_grabber.cpp index 63133c38d33..f0f67cdb023 100644 --- a/io/src/ensenso_grabber.cpp +++ b/io/src/ensenso_grabber.cpp @@ -326,9 +326,9 @@ pcl::EnsensoGrabber::grabSingleCloud (pcl::PointCloud &cloud) con // Copy data in point cloud (and convert millimeters in meters) for (std::size_t i = 0; i < pointMap.size (); i += 3) { - cloud.points[i / 3].x = pointMap[i] / 1000.0; - cloud.points[i / 3].y = pointMap[i + 1] / 1000.0; - cloud.points[i / 3].z = pointMap[i + 2] / 1000.0; + cloud[i / 3].x = pointMap[i] / 1000.0; + cloud[i / 3].y = pointMap[i + 1] / 1000.0; + cloud[i / 3].z = pointMap[i + 2] / 1000.0; } return (true); diff --git a/io/src/png_io.cpp b/io/src/png_io.cpp index 88ef7ebbbe4..f8493eade43 100644 --- a/io/src/png_io.cpp +++ b/io/src/png_io.cpp @@ -103,13 +103,13 @@ pcl::io::saveRgbPNGFile (const std::string& file_name, const unsigned char *rgb_ void pcl::io::savePNGFile (const std::string& file_name, const pcl::PointCloud& cloud) { - saveCharPNGFile(file_name, &cloud.points[0], cloud.width, cloud.height, 1); + saveCharPNGFile(file_name, &cloud[0], cloud.width, cloud.height, 1); } void pcl::io::savePNGFile (const std::string& file_name, const pcl::PointCloud& cloud) { - saveShortPNGFile(file_name, &cloud.points[0], cloud.width, cloud.height, 1); + saveShortPNGFile(file_name, &cloud[0], cloud.width, cloud.height, 1); } void diff --git a/kdtree/include/pcl/kdtree/impl/kdtree_flann.hpp b/kdtree/include/pcl/kdtree/impl/kdtree_flann.hpp index 7d76b185d82..a81a78e65e0 100644 --- a/kdtree/include/pcl/kdtree/impl/kdtree_flann.hpp +++ b/kdtree/include/pcl/kdtree/impl/kdtree_flann.hpp @@ -243,7 +243,7 @@ pcl::KdTreeFLANN::convertCloudToArray (const PointCloud &cloud) for (int cloud_index = 0; cloud_index < original_no_of_points; ++cloud_index) { // Check if the point is invalid - if (!point_representation_->isValid (cloud.points[cloud_index])) + if (!point_representation_->isValid (cloud[cloud_index])) { identity_mapping_ = false; continue; @@ -251,7 +251,7 @@ pcl::KdTreeFLANN::convertCloudToArray (const PointCloud &cloud) index_mapping_.push_back (cloud_index); - point_representation_->vectorize (cloud.points[cloud_index], cloud_ptr); + point_representation_->vectorize (cloud[cloud_index], cloud_ptr); cloud_ptr += dim_; } } @@ -284,13 +284,13 @@ pcl::KdTreeFLANN::convertCloudToArray (const PointCloud &cloud, co for (const int &index : indices) { // Check if the point is invalid - if (!point_representation_->isValid (cloud.points[index])) + if (!point_representation_->isValid (cloud[index])) continue; // map from 0 - N -> indices [0] - indices [N] index_mapping_.push_back (index); // If the returned index should be for the indices vector - point_representation_->vectorize (cloud.points[index], cloud_ptr); + point_representation_->vectorize (cloud[index], cloud_ptr); cloud_ptr += dim_; } } diff --git a/kdtree/include/pcl/kdtree/kdtree.h b/kdtree/include/pcl/kdtree/kdtree.h index df74eebcde7..5dc0644b093 100644 --- a/kdtree/include/pcl/kdtree/kdtree.h +++ b/kdtree/include/pcl/kdtree/kdtree.h @@ -158,7 +158,7 @@ namespace pcl std::vector &k_indices, std::vector &k_sqr_distances) const { assert (index >= 0 && index < static_cast (cloud.points.size ()) && "Out-of-bounds error in nearestKSearch!"); - return (nearestKSearch (cloud.points[index], k, k_indices, k_sqr_distances)); + return (nearestKSearch (cloud[index], k, k_indices, k_sqr_distances)); } /** \brief Search for k-nearest neighbors for the given query point. @@ -246,7 +246,7 @@ namespace pcl unsigned int max_nn = 0) const { assert (index >= 0 && index < static_cast (cloud.points.size ()) && "Out-of-bounds error in radiusSearch!"); - return (radiusSearch(cloud.points[index], radius, k_indices, k_sqr_distances, max_nn)); + return (radiusSearch(cloud[index], radius, k_indices, k_sqr_distances, max_nn)); } /** \brief Search for all the nearest neighbors of the query point in a given radius. diff --git a/keypoints/include/pcl/keypoints/impl/iss_3d.hpp b/keypoints/include/pcl/keypoints/impl/iss_3d.hpp index ec58967ef9c..89f586a7711 100644 --- a/keypoints/include/pcl/keypoints/impl/iss_3d.hpp +++ b/keypoints/include/pcl/keypoints/impl/iss_3d.hpp @@ -120,7 +120,7 @@ pcl::ISSKeypoint3D::getBoundaryPoints (PointCloudI for (int index = 0; index < int (input.points.size ()); index++) { edge_points[index] = false; - PointInT current_point = input.points[index]; + PointInT current_point = input[index]; if (pcl::isFinite(current_point)) { @@ -149,7 +149,7 @@ pcl::ISSKeypoint3D::getBoundaryPoints (PointCloudI template void pcl::ISSKeypoint3D::getScatterMatrix (const int& current_index, Eigen::Matrix3d &cov_m) { - const PointInT& current_point = (*input_).points[current_index]; + const PointInT& current_point = (*input_)[current_index]; double central_point[3]; memset(central_point, 0, sizeof(double) * 3); @@ -176,7 +176,7 @@ pcl::ISSKeypoint3D::getScatterMatrix (const int& c for (int n_idx = 0; n_idx < n_neighbors; n_idx++) { - const PointInT& n_point = (*input_).points[nn_indices[n_idx]]; + const PointInT& n_point = (*input_)[nn_indices[n_idx]]; double neigh_point[3]; memset(neigh_point, 0, sizeof(double) * 3); diff --git a/keypoints/include/pcl/keypoints/impl/sift_keypoint.hpp b/keypoints/include/pcl/keypoints/impl/sift_keypoint.hpp index 7b06de57354..9027b89c3d4 100644 --- a/keypoints/include/pcl/keypoints/impl/sift_keypoint.hpp +++ b/keypoints/include/pcl/keypoints/impl/sift_keypoint.hpp @@ -180,9 +180,9 @@ pcl::SIFTKeypoint::detectKeypointsForOctave ( PointOutT keypoint; const int &keypoint_index = extrema_indices[i_keypoint]; - keypoint.x = input.points[keypoint_index].x; - keypoint.y = input.points[keypoint_index].y; - keypoint.z = input.points[keypoint_index].z; + keypoint.x = input[keypoint_index].x; + keypoint.y = input[keypoint_index].y; + keypoint.z = input[keypoint_index].z; memcpy (reinterpret_cast (&keypoint) + out_fields_[scale_idx_].offset, &scales[extrema_scales[i_keypoint]], sizeof (float)); output.points.push_back (keypoint); @@ -194,9 +194,9 @@ pcl::SIFTKeypoint::detectKeypointsForOctave ( for (const int &keypoint_index : extrema_indices) { PointOutT keypoint; - keypoint.x = input.points[keypoint_index].x; - keypoint.y = input.points[keypoint_index].y; - keypoint.z = input.points[keypoint_index].z; + keypoint.x = input[keypoint_index].x; + keypoint.y = input[keypoint_index].y; + keypoint.z = input[keypoint_index].z; output.points.push_back (keypoint); } @@ -234,7 +234,7 @@ void pcl::SIFTKeypoint::computeScaleSpace ( float denominator = 0.0f; for (std::size_t i_neighbor = 0; i_neighbor < nn_indices.size (); ++i_neighbor) { - const float &value = getFieldValue_ (input.points[nn_indices[i_neighbor]]); + const float &value = getFieldValue_ (input[nn_indices[i_neighbor]]); const float &dist_sqr = nn_dist[i_neighbor]; if (dist_sqr <= 9*sigma_sqr) { diff --git a/keypoints/src/narf_keypoint.cpp b/keypoints/src/narf_keypoint.cpp index a23572cfad5..81c6136ae0d 100644 --- a/keypoints/src/narf_keypoint.cpp +++ b/keypoints/src/narf_keypoint.cpp @@ -295,7 +295,7 @@ NarfKeypoint::calculateCompleteInterestImage () int y = index/range_image.width, x = index - y*range_image.width; - const BorderTraits& border_traits = border_descriptions.points[index].traits; + const BorderTraits& border_traits = border_descriptions[index].traits; if (border_traits[BORDER_TRAIT__SHADOW_BORDER] || border_traits[BORDER_TRAIT__VEIL_POINT]) continue; @@ -328,7 +328,7 @@ NarfKeypoint::calculateCompleteInterestImage () int index2 = neighbors_to_check[neighbors_to_check_idx]; if (!range_image.isValid (index2)) continue; - const BorderTraits& border_traits2 = border_descriptions.points[index2].traits; + const BorderTraits& border_traits2 = border_descriptions[index2].traits; if (border_traits2[BORDER_TRAIT__SHADOW_BORDER] || border_traits2[BORDER_TRAIT__VEIL_POINT]) continue; int y2 = index2/range_image.width, @@ -460,7 +460,7 @@ NarfKeypoint::calculateSparseInterestImage () interest_image_[index] = 0.0f; if (!range_image.isValid (index)) continue; - const BorderTraits& border_traits = border_descriptions.points[index].traits; + const BorderTraits& border_traits = border_descriptions[index].traits; if (border_traits[BORDER_TRAIT__SHADOW_BORDER] || border_traits[BORDER_TRAIT__VEIL_POINT]) continue; interest_image_[index] = 2.0f; @@ -515,7 +515,7 @@ NarfKeypoint::calculateSparseInterestImage () int index2 = neighbors_to_check[neighbors_to_check_idx]; if (!range_image.isValid (index2)) continue; - const BorderTraits& border_traits2 = border_descriptions.points[index2].traits; + const BorderTraits& border_traits2 = border_descriptions[index2].traits; if (border_traits2[BORDER_TRAIT__SHADOW_BORDER] || border_traits2[BORDER_TRAIT__VEIL_POINT]) continue; int y2 = index2/range_image.width, @@ -785,7 +785,7 @@ NarfKeypoint::calculateInterestPoints () if (invalid_beams[i] || !range_image.isValid (x2, y2)) continue; int index2 = y2*width + x2; - const BorderTraits& neighbor_border_traits = border_descriptions.points[index2].traits; + const BorderTraits& neighbor_border_traits = border_descriptions[index2].traits; if (neighbor_border_traits[BORDER_TRAIT__SHADOW_BORDER] || neighbor_border_traits[BORDER_TRAIT__VEIL_POINT]) { invalid_beams[i] = true; diff --git a/ml/include/pcl/ml/impl/kmeans.hpp b/ml/include/pcl/ml/impl/kmeans.hpp index 9933b50bf3e..af8b358f732 100644 --- a/ml/include/pcl/ml/impl/kmeans.hpp +++ b/ml/include/pcl/ml/impl/kmeans.hpp @@ -151,7 +151,7 @@ Kmeans::cluster(std::vector& clusters) for (std::size_t i = 0; i < fields[vfh_idx].count; ++i) { - //vfh.second[i] = point.points[0].histogram[i]; + //vfh.second[i] = point[0].histogram[i]; } */ diff --git a/ml/src/kmeans.cpp b/ml/src/kmeans.cpp index a2677d9670e..ced6bb7edb0 100644 --- a/ml/src/kmeans.cpp +++ b/ml/src/kmeans.cpp @@ -276,7 +276,7 @@ if (user_index == -1) for (std::size_t i = 0; i < fields[vfh_idx].count; ++i) { - //vfh.second[i] = point.points[0].histogram[i]; + //vfh.second[i] = point[0].histogram[i]; } */ diff --git a/octree/include/pcl/octree/octree_search.h b/octree/include/pcl/octree/octree_search.h index 6d97a606b3f..83d30c6f1d3 100644 --- a/octree/include/pcl/octree/octree_search.h +++ b/octree/include/pcl/octree/octree_search.h @@ -167,7 +167,7 @@ class OctreePointCloudSearch int& result_index, float& sqr_distance) { - return (approxNearestSearch(cloud.points[query_index], result_index, sqr_distance)); + return (approxNearestSearch(cloud[query_index], result_index, sqr_distance)); } /** \brief Search for approx. nearest neighbor at the query point. @@ -207,8 +207,7 @@ class OctreePointCloudSearch std::vector& k_sqr_distances, unsigned int max_nn = 0) { - return ( - radiusSearch(cloud.points[index], radius, k_indices, k_sqr_distances, max_nn)); + return (radiusSearch(cloud[index], radius, k_indices, k_sqr_distances, max_nn)); } /** \brief Search for all neighbors of query point that are within a given radius. diff --git a/recognition/include/pcl/recognition/crh_alignment.h b/recognition/include/pcl/recognition/crh_alignment.h index 3a444251e1c..74ff8f55ec2 100644 --- a/recognition/include/pcl/recognition/crh_alignment.h +++ b/recognition/include/pcl/recognition/crh_alignment.h @@ -188,7 +188,7 @@ namespace pcl pcl::PointCloud > input_ftt_negate (input_ftt); for (int i = 2; i < (nbins_); i += 2) - input_ftt_negate.points[0].histogram[i] = -input_ftt_negate.points[0].histogram[i]; + input_ftt_negate[0].histogram[i] = -input_ftt_negate[0].histogram[i]; int nr_bins_after_padding = 180; int peak_distance = 5; @@ -199,16 +199,16 @@ namespace pcl multAB[i].r = multAB[i].i = 0.f; int k = 0; - multAB[k].r = input_ftt_negate.points[0].histogram[0] * target_ftt.points[0].histogram[0]; + multAB[k].r = input_ftt_negate[0].histogram[0] * target_ftt[0].histogram[0]; k++; float a, b, c, d; for (int i = 1; i < cutoff; i += 2, k++) { - a = input_ftt_negate.points[0].histogram[i]; - b = input_ftt_negate.points[0].histogram[i + 1]; - c = target_ftt.points[0].histogram[i]; - d = target_ftt.points[0].histogram[i + 1]; + a = input_ftt_negate[0].histogram[i]; + b = input_ftt_negate[0].histogram[i + 1]; + c = target_ftt[0].histogram[i]; + d = target_ftt[0].histogram[i + 1]; multAB[k].r = a * c - b * d; multAB[k].i = b * c + a * d; @@ -218,7 +218,7 @@ namespace pcl multAB[k].i /= tmp; } - multAB[nbins_ - 1].r = input_ftt_negate.points[0].histogram[nbins_ - 1] * target_ftt.points[0].histogram[nbins_ - 1]; + multAB[nbins_ - 1].r = input_ftt_negate[0].histogram[nbins_ - 1] * target_ftt[0].histogram[nbins_ - 1]; kiss_fft_cfg mycfg = kiss_fft_alloc (nr_bins_after_padding, 1, nullptr, nullptr); kiss_fft_cpx * invAB = new kiss_fft_cpx[nr_bins_after_padding]; diff --git a/recognition/include/pcl/recognition/impl/hv/hv_go.hpp b/recognition/include/pcl/recognition/impl/hv/hv_go.hpp index 92d7aa8bb0d..5fb8cdc70a0 100644 --- a/recognition/include/pcl/recognition/impl/hv/hv_go.hpp +++ b/recognition/include/pcl/recognition/impl/hv/hv_go.hpp @@ -82,7 +82,7 @@ inline void extractEuclideanClustersSmooth(const typename pcl::PointCloud (seed_queue.size ())) { - if (normals.points[seed_queue[sq_idx]].curvature > curvature_threshold) + if (normals[seed_queue[sq_idx]].curvature > curvature_threshold) { sq_idx++; continue; @@ -100,7 +100,7 @@ inline void extractEuclideanClustersSmooth(const typename pcl::PointCloud curvature_threshold) + if (normals[nn_indices[j]].curvature > curvature_threshold) { continue; } @@ -108,9 +108,9 @@ inline void extractEuclideanClustersSmooth(const typename pcl::PointCloud::simplifyCl continue; PointT pt_1 = in_point_cloud->points[i_point]; - PointT pt_2 = temp_cloud.points[index]; + PointT pt_2 = temp_cloud[index]; float distance = (pt_1.x - pt_2.x) * (pt_1.x - pt_2.x) + (pt_1.y - pt_2.y) * (pt_1.y - pt_2.y) + (pt_1.z - pt_2.z) * (pt_1.z - pt_2.z); if (distance < dist_to_grid_center[index]) diff --git a/recognition/include/pcl/recognition/impl/linemod/line_rgbd.hpp b/recognition/include/pcl/recognition/impl/linemod/line_rgbd.hpp index 77d08cb309b..bc305c48607 100644 --- a/recognition/include/pcl/recognition/impl/linemod/line_rgbd.hpp +++ b/recognition/include/pcl/recognition/impl/linemod/line_rgbd.hpp @@ -169,7 +169,7 @@ LineRGBD::loadTemplates (const std::string &file_name, con std::size_t counter = 0; for (std::size_t j = 0; j < template_point_cloud.size (); ++j) { - const PointXYZRGBA & p = template_point_cloud.points[j]; + const PointXYZRGBA & p = template_point_cloud[j]; if (!std::isfinite (p.x) || !std::isfinite (p.y) || !std::isfinite (p.z)) continue; @@ -202,7 +202,7 @@ LineRGBD::loadTemplates (const std::string &file_name, con for (std::size_t j = 0; j < template_point_cloud.size (); ++j) { - PointXYZRGBA p = template_point_cloud.points[j]; + PointXYZRGBA p = template_point_cloud[j]; if (!std::isfinite (p.x) || !std::isfinite (p.y) || !std::isfinite (p.z)) continue; @@ -211,7 +211,7 @@ LineRGBD::loadTemplates (const std::string &file_name, con p.y -= center_y; p.z -= center_z; - template_point_cloud.points[j] = p; + template_point_cloud[j] = p; } } @@ -256,7 +256,7 @@ LineRGBD::createAndAddTemplate ( std::size_t counter = 0; for (std::size_t j = 0; j < template_point_cloud.size (); ++j) { - const PointXYZRGBA & p = template_point_cloud.points[j]; + const PointXYZRGBA & p = template_point_cloud[j]; if (!std::isfinite (p.x) || !std::isfinite (p.y) || !std::isfinite (p.z)) continue; @@ -289,7 +289,7 @@ LineRGBD::createAndAddTemplate ( for (std::size_t j = 0; j < template_point_cloud.size (); ++j) { - PointXYZRGBA p = template_point_cloud.points[j]; + PointXYZRGBA p = template_point_cloud[j]; if (!std::isfinite (p.x) || !std::isfinite (p.y) || !std::isfinite (p.z)) continue; @@ -298,7 +298,7 @@ LineRGBD::createAndAddTemplate ( p.y -= center_y; p.z -= center_z; - template_point_cloud.points[j] = p; + template_point_cloud[j] = p; } } @@ -347,7 +347,7 @@ LineRGBD::addTemplate (const SparseQuantizedMultiModTempla std::size_t counter = 0; for (std::size_t j = 0; j < template_point_cloud.size (); ++j) { - const PointXYZRGBA & p = template_point_cloud.points[j]; + const PointXYZRGBA & p = template_point_cloud[j]; if (!std::isfinite (p.x) || !std::isfinite (p.y) || !std::isfinite (p.z)) continue; @@ -380,7 +380,7 @@ LineRGBD::addTemplate (const SparseQuantizedMultiModTempla for (std::size_t j = 0; j < template_point_cloud.size (); ++j) { - PointXYZRGBA p = template_point_cloud.points[j]; + PointXYZRGBA p = template_point_cloud[j]; if (!std::isfinite (p.x) || !std::isfinite (p.y) || !std::isfinite (p.z)) continue; @@ -389,7 +389,7 @@ LineRGBD::addTemplate (const SparseQuantizedMultiModTempla p.y -= center_y; p.z -= center_z; - template_point_cloud.points[j] = p; + template_point_cloud[j] = p; } } @@ -632,13 +632,13 @@ LineRGBD::computeTransformedTemplatePoints ( cloud.height = template_point_cloud.height; for (std::size_t point_index = 0; point_index < nr_points; ++point_index) { - pcl::PointXYZRGBA point = template_point_cloud.points[point_index]; + pcl::PointXYZRGBA point = template_point_cloud[point_index]; point.x += translation_x; point.y += translation_y; point.z += translation_z; - cloud.points[point_index] = point; + cloud[point_index] = point; } } diff --git a/recognition/include/pcl/recognition/ransac_based/trimmed_icp.h b/recognition/include/pcl/recognition/ransac_based/trimmed_icp.h index de41b119984..1d4ee8352e1 100644 --- a/recognition/include/pcl/recognition/ransac_based/trimmed_icp.h +++ b/recognition/include/pcl/recognition/ransac_based/trimmed_icp.h @@ -125,7 +125,7 @@ namespace pcl for ( int i = 0 ; i < num_source_points ; ++i ) { // Transform the i-th source point based on the current transform matrix - aux::transform (guess_and_result, source_points.points[i], transformed_source_point); + aux::transform (guess_and_result, source_points[i], transformed_source_point); // Perform the closest point search kdtree_.nearestKSearch (transformed_source_point, 1, target_index, sqr_dist_to_target); diff --git a/recognition/include/pcl/recognition/surface_normal_modality.h b/recognition/include/pcl/recognition/surface_normal_modality.h index fd2e1309982..3026384d3cd 100644 --- a/recognition/include/pcl/recognition/surface_normal_modality.h +++ b/recognition/include/pcl/recognition/surface_normal_modality.h @@ -601,10 +601,10 @@ pcl::SurfaceNormalModality::computeAndQuantizeSurfaceNormals () if (std::isnan(px) || pz > 2.0f) { - surface_normals_.points[index].normal_x = bad_point; - surface_normals_.points[index].normal_y = bad_point; - surface_normals_.points[index].normal_z = bad_point; - surface_normals_.points[index].curvature = bad_point; + surface_normals_[index].normal_x = bad_point; + surface_normals_[index].normal_y = bad_point; + surface_normals_[index].normal_z = bad_point; + surface_normals_[index].curvature = bad_point; quantized_surface_normals_ (x, y) = 0; @@ -660,10 +660,10 @@ pcl::SurfaceNormalModality::computeAndQuantizeSurfaceNormals () if (length <= 0.0f) { - surface_normals_.points[index].normal_x = bad_point; - surface_normals_.points[index].normal_y = bad_point; - surface_normals_.points[index].normal_z = bad_point; - surface_normals_.points[index].curvature = bad_point; + surface_normals_[index].normal_x = bad_point; + surface_normals_[index].normal_y = bad_point; + surface_normals_[index].normal_z = bad_point; + surface_normals_[index].curvature = bad_point; quantized_surface_normals_ (x, y) = 0; } @@ -675,10 +675,10 @@ pcl::SurfaceNormalModality::computeAndQuantizeSurfaceNormals () const float normal_y = ny * normInv; const float normal_z = nz * normInv; - surface_normals_.points[index].normal_x = normal_x; - surface_normals_.points[index].normal_y = normal_y; - surface_normals_.points[index].normal_z = normal_z; - surface_normals_.points[index].curvature = bad_point; + surface_normals_[index].normal_x = normal_x; + surface_normals_[index].normal_y = normal_y; + surface_normals_[index].normal_z = normal_z; + surface_normals_[index].curvature = bad_point; float angle = 11.25f + std::atan2 (normal_y, normal_x)*180.0f/3.14f; diff --git a/registration/include/pcl/registration/impl/ia_ransac.hpp b/registration/include/pcl/registration/impl/ia_ransac.hpp index bc32641c70c..06dfadf426e 100644 --- a/registration/include/pcl/registration/impl/ia_ransac.hpp +++ b/registration/include/pcl/registration/impl/ia_ransac.hpp @@ -98,7 +98,7 @@ SampleConsensusInitialAlignment::selectSampl bool valid_sample = true; for (const int &sample_idx : sample_indices) { - float distance_between_samples = euclideanDistance (cloud.points[sample_index], cloud.points[sample_idx]); + float distance_between_samples = euclideanDistance (cloud[sample_index], cloud[sample_idx]); if (sample_index == sample_idx || distance_between_samples < min_sample_distance) { @@ -142,7 +142,7 @@ SampleConsensusInitialAlignment::findSimilar corresponding_indices.resize (sample_indices.size ()); for (std::size_t i = 0; i < sample_indices.size (); ++i) { - // Find the k features nearest to input_features.points[sample_indices[i]] + // Find the k features nearest to input_features[sample_indices[i]] feature_tree_->nearestKSearch (input_features, sample_indices[i], k_correspondences_, nn_indices, nn_distances); // Select one at random and add it to corresponding_indices @@ -164,7 +164,7 @@ SampleConsensusInitialAlignment::computeErro for (int i = 0; i < static_cast (cloud.points.size ()); ++i) { - // Find the distance between cloud.points[i] and its nearest neighbor in the target point cloud + // Find the distance between cloud[i] and its nearest neighbor in the target point cloud tree_->nearestKSearch (cloud, i, 1, nn_index, nn_distance); // Compute the error diff --git a/registration/include/pcl/registration/impl/ndt.hpp b/registration/include/pcl/registration/impl/ndt.hpp index e07b56e2172..9d1982f31e4 100644 --- a/registration/include/pcl/registration/impl/ndt.hpp +++ b/registration/include/pcl/registration/impl/ndt.hpp @@ -201,7 +201,7 @@ NormalDistributionsTransform::computeDerivatives (Eige // Update gradient and hessian for each point, line 17 in Algorithm 2 [Magnusson 2009] for (std::size_t idx = 0; idx < input_->points.size (); idx++) { - x_trans_pt = trans_cloud.points[idx]; + x_trans_pt = trans_cloud[idx]; // Find nieghbors (Radius search has been experimentally faster than direct neighbor checking. std::vector neighborhood; @@ -416,7 +416,7 @@ NormalDistributionsTransform::computeHessian (Eigen::M // Update hessian for each point, line 17 in Algorithm 2 [Magnusson 2009] for (std::size_t idx = 0; idx < input_->points.size (); idx++) { - x_trans_pt = trans_cloud.points[idx]; + x_trans_pt = trans_cloud[idx]; // Find nieghbors (Radius search has been experimentally faster than direct neighbor checking. std::vector neighborhood; diff --git a/registration/include/pcl/registration/impl/registration.hpp b/registration/include/pcl/registration/impl/registration.hpp index bd40767a7e2..fbb5201d129 100644 --- a/registration/include/pcl/registration/impl/registration.hpp +++ b/registration/include/pcl/registration/impl/registration.hpp @@ -133,7 +133,7 @@ Registration::getFitnessScore (double max_rang for (std::size_t i = 0; i < input_transformed.points.size (); ++i) { // Find its nearest neighbor in the target - tree_->nearestKSearch (input_transformed.points[i], 1, nn_indices, nn_dists); + tree_->nearestKSearch (input_transformed[i], 1, nn_indices, nn_dists); // Deal with occlusions (incomplete targets) if (nn_dists[0] <= max_range) @@ -184,7 +184,7 @@ Registration::align (PointCloudSource &output, // Copy the point data to output for (std::size_t i = 0; i < indices_->size (); ++i) - output.points[i] = input_->points[(*indices_)[i]]; + output[i] = input_->points[(*indices_)[i]]; // Set the internal point representation of choice unless otherwise noted if (point_representation_ && !force_no_recompute_) @@ -197,7 +197,7 @@ Registration::align (PointCloudSource &output, // Right before we estimate the transformation, we set all the point.data[3] values to 1 to aid the rigid // transformation for (std::size_t i = 0; i < indices_->size (); ++i) - output.points[i].data[3] = 1.0; + output[i].data[3] = 1.0; computeTransformation (output, guess); diff --git a/registration/include/pcl/registration/impl/sample_consensus_prerejective.hpp b/registration/include/pcl/registration/impl/sample_consensus_prerejective.hpp index aec01f8bee4..5a4a3cebbd2 100644 --- a/registration/include/pcl/registration/impl/sample_consensus_prerejective.hpp +++ b/registration/include/pcl/registration/impl/sample_consensus_prerejective.hpp @@ -315,7 +315,7 @@ SampleConsensusPrerejective::getFitness (std // Find its nearest neighbor in the target std::vector nn_indices (1); std::vector nn_dists (1); - tree_->nearestKSearch (input_transformed.points[i], 1, nn_indices, nn_dists); + tree_->nearestKSearch (input_transformed[i], 1, nn_indices, nn_dists); // Check if point is an inlier if (nn_dists[0] < max_range) diff --git a/registration/include/pcl/registration/impl/transformation_estimation_lm.hpp b/registration/include/pcl/registration/impl/transformation_estimation_lm.hpp index 280dccfe62d..e6e3f8f7398 100644 --- a/registration/include/pcl/registration/impl/transformation_estimation_lm.hpp +++ b/registration/include/pcl/registration/impl/transformation_estimation_lm.hpp @@ -226,8 +226,8 @@ pcl::registration::TransformationEstimationLM::validateTra for (std::size_t i = 0; i < cloud_src->size (); ++i) { const PointSource &src = cloud_src->points[i]; - PointTarget &tgt = input_transformed.points[i]; + PointTarget &tgt = input_transformed[i]; tgt.x = static_cast (transformation_matrix (0, 0) * src.x + transformation_matrix (0, 1) * src.y + transformation_matrix (0, 2) * src.z + transformation_matrix (0, 3)); tgt.y = static_cast (transformation_matrix (1, 0) * src.x + transformation_matrix (1, 1) * src.y + transformation_matrix (1, 2) * src.z + transformation_matrix (1, 3)); tgt.z = static_cast (transformation_matrix (2, 0) * src.x + transformation_matrix (2, 1) * src.y + transformation_matrix (2, 2) * src.z + transformation_matrix (2, 3)); @@ -84,7 +84,7 @@ TransformationValidationEuclidean::validateTra for (std::size_t i = 0; i < input_transformed.points.size (); ++i) { // Find its nearest neighbor in the target - tree_->nearestKSearch (input_transformed.points[i], 1, nn_indices, nn_dists); + tree_->nearestKSearch (input_transformed[i], 1, nn_indices, nn_dists); // Deal with occlusions (incomplete targets) if (nn_dists[0] > max_range_) diff --git a/sample_consensus/include/pcl/sample_consensus/impl/sac_model_circle.hpp b/sample_consensus/include/pcl/sample_consensus/impl/sac_model_circle.hpp index 1900088f280..ac25b324d8e 100644 --- a/sample_consensus/include/pcl/sample_consensus/impl/sac_model_circle.hpp +++ b/sample_consensus/include/pcl/sample_consensus/impl/sac_model_circle.hpp @@ -255,7 +255,7 @@ pcl::SampleConsensusModelCircle2D::projectPoints ( // Iterate over each point for (std::size_t i = 0; i < projected_points.points.size (); ++i) // Iterate over each dimension - pcl::for_each_type (NdConcatenateFunctor (input_->points[i], projected_points.points[i])); + pcl::for_each_type (NdConcatenateFunctor (input_->points[i], projected_points[i])); // Iterate through the points and project them to the circle for (const auto &inlier : inliers) @@ -264,8 +264,8 @@ pcl::SampleConsensusModelCircle2D::projectPoints ( float dy = input_->points[inlier].y - model_coefficients[1]; float a = std::sqrt ( (model_coefficients[2] * model_coefficients[2]) / (dx * dx + dy * dy) ); - projected_points.points[inlier].x = a * dx + model_coefficients[0]; - projected_points.points[inlier].y = a * dy + model_coefficients[1]; + projected_points[inlier].x = a * dx + model_coefficients[0]; + projected_points[inlier].y = a * dy + model_coefficients[1]; } } else @@ -279,7 +279,7 @@ pcl::SampleConsensusModelCircle2D::projectPoints ( // Iterate over each point for (std::size_t i = 0; i < inliers.size (); ++i) // Iterate over each dimension - pcl::for_each_type (NdConcatenateFunctor (input_->points[inliers[i]], projected_points.points[i])); + pcl::for_each_type (NdConcatenateFunctor (input_->points[inliers[i]], projected_points[i])); // Iterate through the points and project them to the circle for (std::size_t i = 0; i < inliers.size (); ++i) @@ -288,8 +288,8 @@ pcl::SampleConsensusModelCircle2D::projectPoints ( float dy = input_->points[inliers[i]].y - model_coefficients[1]; float a = std::sqrt ( (model_coefficients[2] * model_coefficients[2]) / (dx * dx + dy * dy) ); - projected_points.points[i].x = a * dx + model_coefficients[0]; - projected_points.points[i].y = a * dy + model_coefficients[1]; + projected_points[i].x = a * dx + model_coefficients[0]; + projected_points[i].y = a * dy + model_coefficients[1]; } } } diff --git a/sample_consensus/include/pcl/sample_consensus/impl/sac_model_circle3d.hpp b/sample_consensus/include/pcl/sample_consensus/impl/sac_model_circle3d.hpp index 781758c61bb..764c6f7e227 100644 --- a/sample_consensus/include/pcl/sample_consensus/impl/sac_model_circle3d.hpp +++ b/sample_consensus/include/pcl/sample_consensus/impl/sac_model_circle3d.hpp @@ -314,7 +314,7 @@ pcl::SampleConsensusModelCircle3D::projectPoints ( // Iterate over each point for (std::size_t i = 0; i < projected_points.points.size (); ++i) // Iterate over each dimension - pcl::for_each_type (NdConcatenateFunctor (input_->points[i], projected_points.points[i])); + pcl::for_each_type (NdConcatenateFunctor (input_->points[i], projected_points[i])); // Iterate through the 3d points and calculate the distances from them to the plane for (std::size_t i = 0; i < inliers.size (); ++i) @@ -340,9 +340,9 @@ pcl::SampleConsensusModelCircle3D::projectPoints ( // K : Point on Circle Eigen::Vector3d K = C + r * helper_vectorP_projC.normalized (); - projected_points.points[i].x = static_cast (K[0]); - projected_points.points[i].y = static_cast (K[1]); - projected_points.points[i].z = static_cast (K[2]); + projected_points[i].x = static_cast (K[0]); + projected_points[i].y = static_cast (K[1]); + projected_points[i].z = static_cast (K[2]); } } else @@ -356,7 +356,7 @@ pcl::SampleConsensusModelCircle3D::projectPoints ( // Iterate over each point for (std::size_t i = 0; i < inliers.size (); ++i) // Iterate over each dimension - pcl::for_each_type (NdConcatenateFunctor (input_->points[inliers[i]], projected_points.points[i])); + pcl::for_each_type (NdConcatenateFunctor (input_->points[inliers[i]], projected_points[i])); // Iterate through the 3d points and calculate the distances from them to the plane for (std::size_t i = 0; i < inliers.size (); ++i) @@ -381,9 +381,9 @@ pcl::SampleConsensusModelCircle3D::projectPoints ( // K : Point on Circle Eigen::Vector3d K = C + r * helper_vectorP_projC.normalized (); - projected_points.points[i].x = static_cast (K[0]); - projected_points.points[i].y = static_cast (K[1]); - projected_points.points[i].z = static_cast (K[2]); + projected_points[i].x = static_cast (K[0]); + projected_points[i].y = static_cast (K[1]); + projected_points[i].z = static_cast (K[2]); } } } diff --git a/sample_consensus/include/pcl/sample_consensus/impl/sac_model_cone.hpp b/sample_consensus/include/pcl/sample_consensus/impl/sac_model_cone.hpp index 6d52c254b19..bd206253144 100644 --- a/sample_consensus/include/pcl/sample_consensus/impl/sac_model_cone.hpp +++ b/sample_consensus/include/pcl/sample_consensus/impl/sac_model_cone.hpp @@ -379,7 +379,7 @@ pcl::SampleConsensusModelCone::projectPoints ( // Iterate over each point for (std::size_t i = 0; i < projected_points.points.size (); ++i) // Iterate over each dimension - pcl::for_each_type (NdConcatenateFunctor (input_->points[i], projected_points.points[i])); + pcl::for_each_type (NdConcatenateFunctor (input_->points[i], projected_points[i])); // Iterate through the 3d points and calculate the distances from them to the cone for (const auto &inlier : inliers) @@ -391,7 +391,7 @@ pcl::SampleConsensusModelCone::projectPoints ( float k = (pt.dot (axis_dir) - apexdotdir) * dirdotdir; - pcl::Vector4fMap pp = projected_points.points[inlier].getVector4fMap (); + pcl::Vector4fMap pp = projected_points[inlier].getVector4fMap (); pp.matrix () = apex + k * axis_dir; Eigen::Vector4f dir = pt - pp; @@ -416,12 +416,12 @@ pcl::SampleConsensusModelCone::projectPoints ( // Iterate over each point for (std::size_t i = 0; i < inliers.size (); ++i) // Iterate over each dimension - pcl::for_each_type (NdConcatenateFunctor (input_->points[inliers[i]], projected_points.points[i])); + pcl::for_each_type (NdConcatenateFunctor (input_->points[inliers[i]], projected_points[i])); // Iterate through the 3d points and calculate the distances from them to the cone for (std::size_t i = 0; i < inliers.size (); ++i) { - pcl::Vector4fMap pp = projected_points.points[i].getVector4fMap (); + pcl::Vector4fMap pp = projected_points[i].getVector4fMap (); pcl::Vector4fMapConst pt = input_->points[inliers[i]].getVector4fMap (); float k = (pt.dot (axis_dir) - apexdotdir) * dirdotdir; diff --git a/sample_consensus/include/pcl/sample_consensus/impl/sac_model_cylinder.hpp b/sample_consensus/include/pcl/sample_consensus/impl/sac_model_cylinder.hpp index 10e32744c34..7b0d25f0475 100644 --- a/sample_consensus/include/pcl/sample_consensus/impl/sac_model_cylinder.hpp +++ b/sample_consensus/include/pcl/sample_consensus/impl/sac_model_cylinder.hpp @@ -334,7 +334,7 @@ pcl::SampleConsensusModelCylinder::projectPoints ( // Iterate over each point for (std::size_t i = 0; i < projected_points.points.size (); ++i) // Iterate over each dimension - pcl::for_each_type (NdConcatenateFunctor (input_->points[i], projected_points.points[i])); + pcl::for_each_type (NdConcatenateFunctor (input_->points[i], projected_points[i])); // Iterate through the 3d points and calculate the distances from them to the cylinder for (const auto &inlier : inliers) @@ -346,7 +346,7 @@ pcl::SampleConsensusModelCylinder::projectPoints ( float k = (p.dot (line_dir) - ptdotdir) * dirdotdir; - pcl::Vector4fMap pp = projected_points.points[inlier].getVector4fMap (); + pcl::Vector4fMap pp = projected_points[inlier].getVector4fMap (); pp.matrix () = line_pt + k * line_dir; Eigen::Vector4f dir = p - pp; @@ -367,12 +367,12 @@ pcl::SampleConsensusModelCylinder::projectPoints ( // Iterate over each point for (std::size_t i = 0; i < inliers.size (); ++i) // Iterate over each dimension - pcl::for_each_type (NdConcatenateFunctor (input_->points[inliers[i]], projected_points.points[i])); + pcl::for_each_type (NdConcatenateFunctor (input_->points[inliers[i]], projected_points[i])); // Iterate through the 3d points and calculate the distances from them to the cylinder for (std::size_t i = 0; i < inliers.size (); ++i) { - pcl::Vector4fMap pp = projected_points.points[i].getVector4fMap (); + pcl::Vector4fMap pp = projected_points[i].getVector4fMap (); pcl::Vector4fMapConst p = input_->points[inliers[i]].getVector4fMap (); float k = (p.dot (line_dir) - ptdotdir) * dirdotdir; diff --git a/sample_consensus/include/pcl/sample_consensus/impl/sac_model_line.hpp b/sample_consensus/include/pcl/sample_consensus/impl/sac_model_line.hpp index bd06fcefbf3..808360442be 100644 --- a/sample_consensus/include/pcl/sample_consensus/impl/sac_model_line.hpp +++ b/sample_consensus/include/pcl/sample_consensus/impl/sac_model_line.hpp @@ -265,7 +265,7 @@ pcl::SampleConsensusModelLine::projectPoints ( // Iterate over each point for (std::size_t i = 0; i < projected_points.points.size (); ++i) // Iterate over each dimension - pcl::for_each_type (NdConcatenateFunctor (input_->points[i], projected_points.points[i])); + pcl::for_each_type (NdConcatenateFunctor (input_->points[i], projected_points[i])); // Iterate through the 3d points and calculate the distances from them to the line for (const auto &inlier : inliers) @@ -276,9 +276,9 @@ pcl::SampleConsensusModelLine::projectPoints ( Eigen::Vector4f pp = line_pt + k * line_dir; // Calculate the projection of the point on the line (pointProj = A + k * B) - projected_points.points[inlier].x = pp[0]; - projected_points.points[inlier].y = pp[1]; - projected_points.points[inlier].z = pp[2]; + projected_points[inlier].x = pp[0]; + projected_points[inlier].y = pp[1]; + projected_points[inlier].z = pp[2]; } } else @@ -292,7 +292,7 @@ pcl::SampleConsensusModelLine::projectPoints ( // Iterate over each point for (std::size_t i = 0; i < inliers.size (); ++i) // Iterate over each dimension - pcl::for_each_type (NdConcatenateFunctor (input_->points[inliers[i]], projected_points.points[i])); + pcl::for_each_type (NdConcatenateFunctor (input_->points[inliers[i]], projected_points[i])); // Iterate through the 3d points and calculate the distances from them to the line for (std::size_t i = 0; i < inliers.size (); ++i) @@ -303,9 +303,9 @@ pcl::SampleConsensusModelLine::projectPoints ( Eigen::Vector4f pp = line_pt + k * line_dir; // Calculate the projection of the point on the line (pointProj = A + k * B) - projected_points.points[i].x = pp[0]; - projected_points.points[i].y = pp[1]; - projected_points.points[i].z = pp[2]; + projected_points[i].x = pp[0]; + projected_points[i].y = pp[1]; + projected_points[i].z = pp[2]; } } } diff --git a/sample_consensus/include/pcl/sample_consensus/impl/sac_model_plane.hpp b/sample_consensus/include/pcl/sample_consensus/impl/sac_model_plane.hpp index c4efebe995b..80a6d8a28ad 100644 --- a/sample_consensus/include/pcl/sample_consensus/impl/sac_model_plane.hpp +++ b/sample_consensus/include/pcl/sample_consensus/impl/sac_model_plane.hpp @@ -297,7 +297,7 @@ pcl::SampleConsensusModelPlane::projectPoints ( // Iterate over each point for (std::size_t i = 0; i < input_->points.size (); ++i) // Iterate over each dimension - pcl::for_each_type (NdConcatenateFunctor (input_->points[i], projected_points.points[i])); + pcl::for_each_type (NdConcatenateFunctor (input_->points[i], projected_points[i])); // Iterate through the 3d points and calculate the distances from them to the plane for (const auto &inlier : inliers) @@ -310,7 +310,7 @@ pcl::SampleConsensusModelPlane::projectPoints ( // use normalized coefficients to calculate the scalar projection float distance_to_plane = tmp_mc.dot (p); - pcl::Vector4fMap pp = projected_points.points[inlier].getVector4fMap (); + pcl::Vector4fMap pp = projected_points[inlier].getVector4fMap (); pp.matrix () = p - mc * distance_to_plane; // mc[3] = 0, therefore the 3rd coordinate is safe } } @@ -326,7 +326,7 @@ pcl::SampleConsensusModelPlane::projectPoints ( for (std::size_t i = 0; i < inliers.size (); ++i) { // Iterate over each dimension - pcl::for_each_type (NdConcatenateFunctor (input_->points[inliers[i]], projected_points.points[i])); + pcl::for_each_type (NdConcatenateFunctor (input_->points[inliers[i]], projected_points[i])); } // Iterate through the 3d points and calculate the distances from them to the plane @@ -340,7 +340,7 @@ pcl::SampleConsensusModelPlane::projectPoints ( // use normalized coefficients to calculate the scalar projection float distance_to_plane = tmp_mc.dot (p); - pcl::Vector4fMap pp = projected_points.points[i].getVector4fMap (); + pcl::Vector4fMap pp = projected_points[i].getVector4fMap (); pp.matrix () = p - mc * distance_to_plane; // mc[3] = 0, therefore the 3rd coordinate is safe } } diff --git a/sample_consensus/include/pcl/sample_consensus/impl/sac_model_stick.hpp b/sample_consensus/include/pcl/sample_consensus/impl/sac_model_stick.hpp index 37655c7cf4b..bdbfc4e7f10 100644 --- a/sample_consensus/include/pcl/sample_consensus/impl/sac_model_stick.hpp +++ b/sample_consensus/include/pcl/sample_consensus/impl/sac_model_stick.hpp @@ -313,7 +313,7 @@ pcl::SampleConsensusModelStick::projectPoints ( for (std::size_t i = 0; i < projected_points.points.size (); ++i) { // Iterate over each dimension - pcl::for_each_type (NdConcatenateFunctor (input_->points[i], projected_points.points[i])); + pcl::for_each_type (NdConcatenateFunctor (input_->points[i], projected_points[i])); } // Iterate through the 3d points and calculate the distances from them to the line @@ -325,9 +325,9 @@ pcl::SampleConsensusModelStick::projectPoints ( Eigen::Vector4f pp = line_pt + k * line_dir; // Calculate the projection of the point on the line (pointProj = A + k * B) - projected_points.points[inlier].x = pp[0]; - projected_points.points[inlier].y = pp[1]; - projected_points.points[inlier].z = pp[2]; + projected_points[inlier].x = pp[0]; + projected_points[inlier].y = pp[1]; + projected_points[inlier].z = pp[2]; } } else @@ -342,7 +342,7 @@ pcl::SampleConsensusModelStick::projectPoints ( for (std::size_t i = 0; i < inliers.size (); ++i) { // Iterate over each dimension - pcl::for_each_type (NdConcatenateFunctor (input_->points[inliers[i]], projected_points.points[i])); + pcl::for_each_type (NdConcatenateFunctor (input_->points[inliers[i]], projected_points[i])); } // Iterate through the 3d points and calculate the distances from them to the line @@ -354,9 +354,9 @@ pcl::SampleConsensusModelStick::projectPoints ( Eigen::Vector4f pp = line_pt + k * line_dir; // Calculate the projection of the point on the line (pointProj = A + k * B) - projected_points.points[i].x = pp[0]; - projected_points.points[i].y = pp[1]; - projected_points.points[i].z = pp[2]; + projected_points[i].x = pp[0]; + projected_points[i].y = pp[1]; + projected_points[i].z = pp[2]; } } } diff --git a/search/include/pcl/search/impl/search.hpp b/search/include/pcl/search/impl/search.hpp index 600accf5859..a01b43e7aff 100644 --- a/search/include/pcl/search/impl/search.hpp +++ b/search/include/pcl/search/impl/search.hpp @@ -87,7 +87,7 @@ pcl::search::Search::nearestKSearch ( Indices &k_indices, std::vector &k_sqr_distances) const { assert (index >= 0 && index < static_cast (cloud.points.size ()) && "Out-of-bounds error in nearestKSearch!"); - return (nearestKSearch (cloud.points[index], k, k_indices, k_sqr_distances)); + return (nearestKSearch (cloud[index], k, k_indices, k_sqr_distances)); } /////////////////////////////////////////////////////////////////////////////////////////// @@ -139,7 +139,7 @@ pcl::search::Search::radiusSearch ( unsigned int max_nn) const { assert (index >= 0 && index < static_cast (cloud.points.size ()) && "Out-of-bounds error in radiusSearch!"); - return (radiusSearch(cloud.points[index], radius, k_indices, k_sqr_distances, max_nn)); + return (radiusSearch(cloud[index], radius, k_indices, k_sqr_distances, max_nn)); } /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/segmentation/include/pcl/segmentation/extract_clusters.h b/segmentation/include/pcl/segmentation/extract_clusters.h index f3def98c219..190f2fd99a8 100644 --- a/segmentation/include/pcl/segmentation/extract_clusters.h +++ b/segmentation/include/pcl/segmentation/extract_clusters.h @@ -146,9 +146,9 @@ namespace pcl //processed[nn_indices[j]] = true; // [-1;1] - double dot_p = normals.points[i].normal[0] * normals.points[nn_indices[j]].normal[0] + - normals.points[i].normal[1] * normals.points[nn_indices[j]].normal[1] + - normals.points[i].normal[2] * normals.points[nn_indices[j]].normal[2]; + double dot_p = normals[i].normal[0] * normals[nn_indices[j]].normal[0] + + normals[i].normal[1] * normals[nn_indices[j]].normal[1] + + normals[i].normal[2] * normals[nn_indices[j]].normal[2]; if ( std::acos (std::abs (dot_p)) < eps_angle ) { processed[nn_indices[j]] = true; @@ -238,7 +238,7 @@ namespace pcl while (sq_idx < static_cast (seed_queue.size ())) { // Search for sq_idx - if (!tree->radiusSearch (cloud.points[seed_queue[sq_idx]], tolerance, nn_indices, nn_distances)) + if (!tree->radiusSearch (cloud[seed_queue[sq_idx]], tolerance, nn_indices, nn_distances)) { sq_idx++; continue; @@ -252,9 +252,9 @@ namespace pcl //processed[nn_indices[j]] = true; // [-1;1] double dot_p = - normals.points[indices[i]].normal[0] * normals.points[indices[nn_indices[j]]].normal[0] + - normals.points[indices[i]].normal[1] * normals.points[indices[nn_indices[j]]].normal[1] + - normals.points[indices[i]].normal[2] * normals.points[indices[nn_indices[j]]].normal[2]; + normals[indices[i]].normal[0] * normals[indices[nn_indices[j]]].normal[0] + + normals[indices[i]].normal[1] * normals[indices[nn_indices[j]]].normal[1] + + normals[indices[i]].normal[2] * normals[indices[nn_indices[j]]].normal[2]; if ( std::acos (std::abs (dot_p)) < eps_angle ) { processed[nn_indices[j]] = true; diff --git a/segmentation/include/pcl/segmentation/impl/crf_segmentation.hpp b/segmentation/include/pcl/segmentation/impl/crf_segmentation.hpp index 3898e091914..c67c9acdae0 100644 --- a/segmentation/include/pcl/segmentation/impl/crf_segmentation.hpp +++ b/segmentation/include/pcl/segmentation/impl/crf_segmentation.hpp @@ -450,7 +450,7 @@ pcl::CrfSegmentation::segmentPoints (pcl::PointCloud for (std::size_t i = 0; i < N; i++) { - tmp_cloud_OLD.points[i].label = map[i]; + tmp_cloud_OLD[i].label = map[i]; } @@ -541,7 +541,7 @@ pcl::CrfSegmentation::segmentPoints (pcl::PointCloud for (int i = 0; i < N; i++) { - output.points[i].label = labels[r[i]]; + output[i].label = labels[r[i]]; } @@ -552,10 +552,10 @@ pcl::CrfSegmentation::segmentPoints (pcl::PointCloud bool c = true; for (std::size_t i = 0; i < tmp_cloud.points.size (); i++) { - if (tmp_cloud.points[i].label != tmp_cloud_OLD.points[i].label) + if (tmp_cloud[i].label != tmp_cloud_OLD[i].label) { - std::cout << "idx: " << i << " = " < &cloud, while (sq_idx < static_cast (seed_queue.size ())) { // Search for sq_idx - int ret = tree->radiusSearch (cloud.points[seed_queue[sq_idx]], tolerance, nn_indices, nn_distances); + int ret = tree->radiusSearch (cloud[seed_queue[sq_idx]], tolerance, nn_indices, nn_distances); if( ret == -1) { PCL_ERROR("[pcl::extractEuclideanClusters] Received error code -1 from radiusSearch\n"); diff --git a/segmentation/include/pcl/segmentation/impl/extract_labeled_clusters.hpp b/segmentation/include/pcl/segmentation/impl/extract_labeled_clusters.hpp index 92aa157a396..18108f8e630 100644 --- a/segmentation/include/pcl/segmentation/impl/extract_labeled_clusters.hpp +++ b/segmentation/include/pcl/segmentation/impl/extract_labeled_clusters.hpp @@ -88,7 +88,7 @@ pcl::extractLabeledEuclideanClusters (const PointCloud &cloud, { if (processed[nn_indices[j]]) // Has this point been processed before ? continue; - if (cloud.points[i].label == cloud.points[nn_indices[j]].label) + if (cloud[i].label == cloud[nn_indices[j]].label) { // Perform a simple Euclidean clustering seed_queue.push_back (nn_indices[j]); @@ -111,7 +111,7 @@ pcl::extractLabeledEuclideanClusters (const PointCloud &cloud, r.indices.erase (std::unique (r.indices.begin (), r.indices.end ()), r.indices.end ()); r.header = cloud.header; - labeled_clusters[cloud.points[i].label].push_back (r); // We could avoid a copy by working directly in the vector + labeled_clusters[cloud[i].label].push_back (r); // We could avoid a copy by working directly in the vector } } } diff --git a/segmentation/include/pcl/segmentation/impl/extract_polygonal_prism_data.hpp b/segmentation/include/pcl/segmentation/impl/extract_polygonal_prism_data.hpp index 6f2bf95f0fa..be1438b8d1f 100644 --- a/segmentation/include/pcl/segmentation/impl/extract_polygonal_prism_data.hpp +++ b/segmentation/include/pcl/segmentation/impl/extract_polygonal_prism_data.hpp @@ -88,10 +88,10 @@ pcl::isPointIn2DPolygon (const PointT &point, const pcl::PointCloud &pol xy_polygon.points.resize (polygon.points.size ()); for (std::size_t i = 0; i < polygon.points.size (); ++i) { - Eigen::Vector4f pt (polygon.points[i].x, polygon.points[i].y, polygon.points[i].z, 0); - xy_polygon.points[i].x = pt[k1]; - xy_polygon.points[i].y = pt[k2]; - xy_polygon.points[i].z = 0; + Eigen::Vector4f pt (polygon[i].x, polygon[i].y, polygon[i].z, 0); + xy_polygon[i].x = pt[k1]; + xy_polygon[i].y = pt[k2]; + xy_polygon[i].z = 0; } PointT xy_point; xy_point.z = 0; @@ -111,12 +111,12 @@ pcl::isXYPointIn2DXYPolygon (const PointT &point, const pcl::PointCloud int nr_poly_points = static_cast (polygon.points.size ()); // start with the last point to make the check last point<->first point the first one - double xold = polygon.points[nr_poly_points - 1].x; - double yold = polygon.points[nr_poly_points - 1].y; + double xold = polygon[nr_poly_points - 1].x; + double yold = polygon[nr_poly_points - 1].y; for (int i = 0; i < nr_poly_points; i++) { - double xnew = polygon.points[i].x; - double ynew = polygon.points[i].y; + double xnew = polygon[i].x; + double ynew = polygon[i].y; if (xnew > xold) { x1 = xold; @@ -216,9 +216,9 @@ pcl::ExtractPolygonalPrismData::segment (pcl::PointIndices &output) for (std::size_t i = 0; i < planar_hull_->points.size (); ++i) { Eigen::Vector4f pt (planar_hull_->points[i].x, planar_hull_->points[i].y, planar_hull_->points[i].z, 0); - polygon.points[i].x = pt[k1]; - polygon.points[i].y = pt[k2]; - polygon.points[i].z = 0; + polygon[i].x = pt[k1]; + polygon[i].y = pt[k2]; + polygon[i].z = 0; } PointT pt_xy; @@ -234,9 +234,9 @@ pcl::ExtractPolygonalPrismData::segment (pcl::PointIndices &output) continue; // Check what points are inside the hull - Eigen::Vector4f pt (projected_points.points[i].x, - projected_points.points[i].y, - projected_points.points[i].z, 0); + Eigen::Vector4f pt (projected_points[i].x, + projected_points[i].y, + projected_points[i].z, 0); pt_xy.x = pt[k1]; pt_xy.y = pt[k2]; diff --git a/segmentation/include/pcl/segmentation/impl/organized_multi_plane_segmentation.hpp b/segmentation/include/pcl/segmentation/impl/organized_multi_plane_segmentation.hpp index be0a6a7ba4f..2b5666b0c50 100644 --- a/segmentation/include/pcl/segmentation/impl/organized_multi_plane_segmentation.hpp +++ b/segmentation/include/pcl/segmentation/impl/organized_multi_plane_segmentation.hpp @@ -55,7 +55,7 @@ projectToPlaneFromViewpoint (pcl::PointCloud& cloud, Eigen::Vector4f& no projected_cloud.resize (cloud.points.size ()); for (std::size_t i = 0; i < cloud.points.size (); i++) { - Eigen::Vector3f pt (cloud.points[i].x, cloud.points[i].y, cloud.points[i].z); + Eigen::Vector3f pt (cloud[i].x, cloud[i].y, cloud[i].z); //Eigen::Vector3f intersection = (vp, pt, norm, centroid); float u = norm.dot ((centroid - vp)) / norm.dot ((pt - vp)); Eigen::Vector3f intersection (vp + u * (pt - vp)); @@ -212,7 +212,7 @@ pcl::OrganizedMultiPlaneSegmentation::segment (std::ve pcl::OrganizedConnectedComponentSegmentation::findLabeledRegionBoundary (inlier_indices[i].indices[0], labels, boundary_indices[i]); boundary_cloud.points.resize (boundary_indices[i].indices.size ()); for (std::size_t j = 0; j < boundary_indices[i].indices.size (); j++) - boundary_cloud.points[j] = input_->points[boundary_indices[i].indices[j]]; + boundary_cloud[j] = input_->points[boundary_indices[i].indices[j]]; Eigen::Vector3f centroid = Eigen::Vector3f (centroids[i][0],centroids[i][1],centroids[i][2]); Eigen::Vector4f model = Eigen::Vector4f (model_coefficients[i].values[0], @@ -251,7 +251,7 @@ pcl::OrganizedMultiPlaneSegmentation::segmentAndRefine pcl::OrganizedConnectedComponentSegmentation::findLabeledRegionBoundary (inlier_indices[i].indices[max_inlier_idx], labels, boundary_indices[i]); boundary_cloud.points.resize (boundary_indices[i].indices.size ()); for (std::size_t j = 0; j < boundary_indices[i].indices.size (); j++) - boundary_cloud.points[j] = input_->points[boundary_indices[i].indices[j]]; + boundary_cloud[j] = input_->points[boundary_indices[i].indices[j]]; Eigen::Vector3f centroid = Eigen::Vector3f (centroids[i][0],centroids[i][1],centroids[i][2]); Eigen::Vector4f model = Eigen::Vector4f (model_coefficients[i].values[0], @@ -295,7 +295,7 @@ pcl::OrganizedMultiPlaneSegmentation::segmentAndRefine pcl::OrganizedConnectedComponentSegmentation::findLabeledRegionBoundary (inlier_indices[i].indices[max_inlier_idx], labels, boundary_indices[i]); boundary_cloud.points.resize (boundary_indices[i].indices.size ()); for (std::size_t j = 0; j < boundary_indices[i].indices.size (); j++) - boundary_cloud.points[j] = input_->points[boundary_indices[i].indices[j]]; + boundary_cloud[j] = input_->points[boundary_indices[i].indices[j]]; Eigen::Vector3f centroid = Eigen::Vector3f (centroids[i][0],centroids[i][1],centroids[i][2]); Eigen::Vector4f model = Eigen::Vector4f (model_coefficients[i].values[0], diff --git a/segmentation/include/pcl/segmentation/impl/seeded_hue_segmentation.hpp b/segmentation/include/pcl/segmentation/impl/seeded_hue_segmentation.hpp index 8c9fb15cc77..22bf9188cff 100644 --- a/segmentation/include/pcl/segmentation/impl/seeded_hue_segmentation.hpp +++ b/segmentation/include/pcl/segmentation/impl/seeded_hue_segmentation.hpp @@ -74,7 +74,7 @@ pcl::seededHueSegmentation (const PointCloud &cloud, seed_queue.push_back (i); PointXYZRGB p; - p = cloud.points[i]; + p = cloud[i]; PointXYZHSV h; PointXYZRGBtoXYZHSV(p, h); @@ -96,7 +96,7 @@ pcl::seededHueSegmentation (const PointCloud &cloud, continue; PointXYZRGB p_l; - p_l = cloud.points[nn_indices[j]]; + p_l = cloud[nn_indices[j]]; PointXYZHSV h_l; PointXYZRGBtoXYZHSV(p_l, h_l); @@ -149,7 +149,7 @@ pcl::seededHueSegmentation (const PointCloud &cloud, seed_queue.push_back (i); PointXYZRGB p; - p = cloud.points[i]; + p = cloud[i]; PointXYZHSV h; PointXYZRGBtoXYZHSV(p, h); @@ -170,7 +170,7 @@ pcl::seededHueSegmentation (const PointCloud &cloud, continue; PointXYZRGB p_l; - p_l = cloud.points[nn_indices[j]]; + p_l = cloud[nn_indices[j]]; PointXYZHSV h_l; PointXYZRGBtoXYZHSV(p_l, h_l); diff --git a/segmentation/include/pcl/segmentation/impl/segment_differences.hpp b/segmentation/include/pcl/segmentation/impl/segment_differences.hpp index 7c499593d40..8940aa5152a 100755 --- a/segmentation/include/pcl/segmentation/impl/segment_differences.hpp +++ b/segmentation/include/pcl/segmentation/impl/segment_differences.hpp @@ -62,12 +62,12 @@ pcl::getPointCloudDifference ( for (int i = 0; i < static_cast (src.points.size ()); ++i) { // Ignore invalid points in the inpout cloud - if (!isFinite (src.points[i])) + if (!isFinite (src[i])) continue; // Search for the closest point in the target data set (number of neighbors to find = 1) - if (!tree->nearestKSearch (src.points[i], 1, nn_indices, nn_distances)) + if (!tree->nearestKSearch (src[i], 1, nn_indices, nn_distances)) { - PCL_WARN ("No neighbor found for point %lu (%f %f %f)!\n", i, src.points[i].x, src.points[i].y, src.points[i].z); + PCL_WARN ("No neighbor found for point %lu (%f %f %f)!\n", i, src[i].x, src[i].y, src[i].z); continue; } // Add points without a corresponding point in the target cloud to the output cloud diff --git a/simulation/src/model.cpp b/simulation/src/model.cpp index a154d6ce4cd..776f51df759 100644 --- a/simulation/src/model.cpp +++ b/simulation/src/model.cpp @@ -22,11 +22,11 @@ pcl::simulation::TriangleMeshModel::TriangleMeshModel(pcl::PolygonMesh::Ptr plg) Eigen::Vector4f tmp; for (const auto& polygon : plg->polygons) { for (const unsigned int& point : polygon.vertices) { - tmp = newcloud.points[point].getVector4fMap(); + tmp = newcloud[point].getVector4fMap(); vertices.push_back(Vertex(Eigen::Vector3f(tmp(0), tmp(1), tmp(2)), - Eigen::Vector3f(newcloud.points[point].r / 255.0f, - newcloud.points[point].g / 255.0f, - newcloud.points[point].b / 255.0f))); + Eigen::Vector3f(newcloud[point].r / 255.0f, + newcloud[point].g / 255.0f, + newcloud[point].b / 255.0f))); indices.push_back(indices.size()); } } @@ -37,7 +37,7 @@ pcl::simulation::TriangleMeshModel::TriangleMeshModel(pcl::PolygonMesh::Ptr plg) Eigen::Vector4f tmp; for (const auto& polygon : plg->polygons) { for (const unsigned int& point : polygon.vertices) { - tmp = newcloud.points[point].getVector4fMap(); + tmp = newcloud[point].getVector4fMap(); vertices.push_back(Vertex(Eigen::Vector3f(tmp(0), tmp(1), tmp(2)), Eigen::Vector3f(1.0, 1.0, 1.0))); indices.push_back(indices.size()); @@ -132,15 +132,15 @@ pcl::simulation::PolygonMeshModel::PolygonMeshModel(GLenum mode, for (std::size_t j = 0; j < apoly_in.vertices.size(); j++) { // each point std::uint32_t pt = apoly_in.vertices[j]; - tmp = newcloud.points[pt].getVector4fMap(); + tmp = newcloud[pt].getVector4fMap(); // x,y,z apoly.vertices_[3 * j + 0] = tmp(0); apoly.vertices_[3 * j + 1] = tmp(1); apoly.vertices_[3 * j + 2] = tmp(2); // r,g,b: input is ints 0->255, opengl wants floats 0->1 - apoly.colors_[4 * j + 0] = newcloud.points[pt].r / 255.0f; // Red - apoly.colors_[4 * j + 1] = newcloud.points[pt].g / 255.0f; // Green - apoly.colors_[4 * j + 2] = newcloud.points[pt].b / 255.0f; // Blue + apoly.colors_[4 * j + 0] = newcloud[pt].r / 255.0f; // Red + apoly.colors_[4 * j + 1] = newcloud[pt].g / 255.0f; // Green + apoly.colors_[4 * j + 2] = newcloud[pt].b / 255.0f; // Blue apoly.colors_[4 * j + 3] = 1.0f; // transparency? unnecessary? } polygons.push_back(apoly); @@ -158,7 +158,7 @@ pcl::simulation::PolygonMeshModel::PolygonMeshModel(GLenum mode, for (std::size_t j = 0; j < apoly_in.vertices.size(); j++) { // each point std::uint32_t pt = apoly_in.vertices[j]; - tmp = newcloud.points[pt].getVector4fMap(); + tmp = newcloud[pt].getVector4fMap(); // x,y,z apoly.vertices_[3 * j + 0] = tmp(0); apoly.vertices_[3 * j + 1] = tmp(1); diff --git a/surface/include/pcl/surface/impl/bilateral_upsampling.hpp b/surface/include/pcl/surface/impl/bilateral_upsampling.hpp index d7d9e4ac140..4fca5414c87 100644 --- a/surface/include/pcl/surface/impl/bilateral_upsampling.hpp +++ b/surface/include/pcl/surface/impl/bilateral_upsampling.hpp @@ -123,24 +123,24 @@ pcl::BilateralUpsampling::performProcessing (PointCloudOut } } - output.points[y*input_->width + x].r = input_->points[y*input_->width + x].r; - output.points[y*input_->width + x].g = input_->points[y*input_->width + x].g; - output.points[y*input_->width + x].b = input_->points[y*input_->width + x].b; + output[y*input_->width + x].r = input_->points[y*input_->width + x].r; + output[y*input_->width + x].g = input_->points[y*input_->width + x].g; + output[y*input_->width + x].b = input_->points[y*input_->width + x].b; if (norm_sum != 0.0f) { float depth = sum / norm_sum; Eigen::Vector3f pc (static_cast (x) * depth, static_cast (y) * depth, depth); Eigen::Vector3f pw (unprojection_matrix_ * pc); - output.points[y*input_->width + x].x = pw[0]; - output.points[y*input_->width + x].y = pw[1]; - output.points[y*input_->width + x].z = pw[2]; + output[y*input_->width + x].x = pw[0]; + output[y*input_->width + x].y = pw[1]; + output[y*input_->width + x].z = pw[2]; } else { - output.points[y*input_->width + x].x = nan; - output.points[y*input_->width + x].y = nan; - output.points[y*input_->width + x].z = nan; + output[y*input_->width + x].x = nan; + output[y*input_->width + x].y = nan; + output[y*input_->width + x].z = nan; } } diff --git a/surface/include/pcl/surface/impl/concave_hull.hpp b/surface/include/pcl/surface/impl/concave_hull.hpp index f8f945f2dbb..a5365c29fd5 100644 --- a/surface/include/pcl/surface/impl/concave_hull.hpp +++ b/surface/include/pcl/surface/impl/concave_hull.hpp @@ -187,11 +187,11 @@ pcl::ConcaveHull::performReconstruction (PointCloud &alpha_shape, std: for (std::size_t i = 0; i < cloud_transformed.points.size (); ++i) { - points[i * dim_ + 0] = static_cast (cloud_transformed.points[i].x); - points[i * dim_ + 1] = static_cast (cloud_transformed.points[i].y); + points[i * dim_ + 0] = static_cast (cloud_transformed[i].x); + points[i * dim_ + 1] = static_cast (cloud_transformed[i].y); if (dim_ > 2) - points[i * dim_ + 2] = static_cast (cloud_transformed.points[i].z); + points[i * dim_ + 2] = static_cast (cloud_transformed[i].z); } // Compute concave hull @@ -207,9 +207,9 @@ pcl::ConcaveHull::performReconstruction (PointCloud &alpha_shape, std: bool NaNvalues = false; for (std::size_t i = 0; i < cloud_transformed.size (); ++i) { - if (!std::isfinite (cloud_transformed.points[i].x) || - !std::isfinite (cloud_transformed.points[i].y) || - !std::isfinite (cloud_transformed.points[i].z)) + if (!std::isfinite (cloud_transformed[i].x) || + !std::isfinite (cloud_transformed[i].y) || + !std::isfinite (cloud_transformed[i].z)) { NaNvalues = true; break; @@ -355,9 +355,9 @@ pcl::ConcaveHull::performReconstruction (PointCloud &alpha_shape, std: { if (!added_vertices[vertex->id]) { - alpha_shape.points[vertices].x = static_cast (vertex->point[0]); - alpha_shape.points[vertices].y = static_cast (vertex->point[1]); - alpha_shape.points[vertices].z = static_cast (vertex->point[2]); + alpha_shape[vertices].x = static_cast (vertex->point[0]); + alpha_shape[vertices].y = static_cast (vertex->point[1]); + alpha_shape[vertices].z = static_cast (vertex->point[2]); qhid_to_pcidx[vertex->id] = vertices; //map the vertex id of qhull to the point cloud index added_vertices[vertex->id] = true; @@ -439,13 +439,13 @@ pcl::ConcaveHull::performReconstruction (PointCloud &alpha_shape, std: { if (!added_vertices[vertex->id]) { - alpha_shape.points[vertices].x = static_cast (vertex->point[0]); - alpha_shape.points[vertices].y = static_cast (vertex->point[1]); + alpha_shape[vertices].x = static_cast (vertex->point[0]); + alpha_shape[vertices].y = static_cast (vertex->point[1]); if (dim_ > 2) - alpha_shape.points[vertices].z = static_cast (vertex->point[2]); + alpha_shape[vertices].z = static_cast (vertex->point[2]); else - alpha_shape.points[vertices].z = 0; + alpha_shape[vertices].z = 0; qhid_to_pcidx[vertex->id] = vertices; //map the vertex id of qhull to the point cloud index added_vertices[vertex->id] = true; @@ -482,7 +482,7 @@ pcl::ConcaveHull::performReconstruction (PointCloud &alpha_shape, std: int sorted_idx = 0; while (!edges.empty ()) { - alpha_shape_sorted.points[sorted_idx] = alpha_shape.points[(*curr).first]; + alpha_shape_sorted[sorted_idx] = alpha_shape[(*curr).first]; // check where we can go from (*curr).first for (const int &i : (*curr).second) { @@ -573,7 +573,7 @@ pcl::ConcaveHull::performReconstruction (PointCloud &alpha_shape, std: for (std::size_t i = 0; i < alpha_shape.points.size (); i++) { - tree.nearestKSearch (alpha_shape.points[i], 1, neighbor, distances); + tree.nearestKSearch (alpha_shape[i], 1, neighbor, distances); hull_indices_.indices.push_back (neighbor[0]); } diff --git a/surface/include/pcl/surface/impl/convex_hull.hpp b/surface/include/pcl/surface/impl/convex_hull.hpp index a81798fd6ca..da6e19c6bc4 100644 --- a/surface/include/pcl/surface/impl/convex_hull.hpp +++ b/surface/include/pcl/surface/impl/convex_hull.hpp @@ -96,9 +96,9 @@ pcl::ConvexHull::performReconstruction2D (PointCloud &hull, std::vecto pcl::PointCloud normal_calc_cloud; normal_calc_cloud.points.resize (3); - normal_calc_cloud.points[0] = p0; - normal_calc_cloud.points[1] = p1; - normal_calc_cloud.points[2] = p2; + normal_calc_cloud[0] = p0; + normal_calc_cloud[1] = p1; + normal_calc_cloud[2] = p2; Eigen::Vector4d normal_calc_centroid; Eigen::Matrix3d normal_calc_covariance; @@ -215,7 +215,7 @@ pcl::ConvexHull::performReconstruction2D (PointCloud &hull, std::vecto int num_vertices = qh num_vertices; hull.points.resize (num_vertices); - memset (&hull.points[0], static_cast (hull.points.size ()), sizeof (PointInT)); + memset (&hull[0], static_cast (hull.points.size ()), sizeof (PointInT)); vertexT * vertex; int i = 0; @@ -226,7 +226,7 @@ pcl::ConvexHull::performReconstruction2D (PointCloud &hull, std::vecto FORALLvertices { - hull.points[i] = input_->points[(*indices_)[qh_pointid (vertex->point)]]; + hull[i] = input_->points[(*indices_)[qh_pointid (vertex->point)]]; idx_points[i].first = qh_pointid (vertex->point); ++i; } @@ -238,24 +238,24 @@ pcl::ConvexHull::performReconstruction2D (PointCloud &hull, std::vecto { for (std::size_t j = 0; j < hull.points.size (); j++) { - idx_points[j].second[0] = hull.points[j].x - centroid[0]; - idx_points[j].second[1] = hull.points[j].y - centroid[1]; + idx_points[j].second[0] = hull[j].x - centroid[0]; + idx_points[j].second[1] = hull[j].y - centroid[1]; } } else if (yz_proj_safe) { for (std::size_t j = 0; j < hull.points.size (); j++) { - idx_points[j].second[0] = hull.points[j].y - centroid[1]; - idx_points[j].second[1] = hull.points[j].z - centroid[2]; + idx_points[j].second[0] = hull[j].y - centroid[1]; + idx_points[j].second[1] = hull[j].z - centroid[2]; } } else if (xz_proj_safe) { for (std::size_t j = 0; j < hull.points.size (); j++) { - idx_points[j].second[0] = hull.points[j].x - centroid[0]; - idx_points[j].second[1] = hull.points[j].z - centroid[2]; + idx_points[j].second[0] = hull[j].x - centroid[0]; + idx_points[j].second[1] = hull[j].z - centroid[2]; } } std::sort (idx_points.begin (), idx_points.end (), comparePoints2D); @@ -270,7 +270,7 @@ pcl::ConvexHull::performReconstruction2D (PointCloud &hull, std::vecto for (int j = 0; j < static_cast (hull.points.size ()); j++) { hull_indices_.indices.push_back ((*indices_)[idx_points[j].first]); - hull.points[j] = input_->points[(*indices_)[idx_points[j].first]]; + hull[j] = input_->points[(*indices_)[idx_points[j].first]]; polygons[0].vertices[j] = static_cast (j); } @@ -373,7 +373,7 @@ pcl::ConvexHull::performReconstruction3D ( { // Add vertices to hull point_cloud and store index hull_indices_.indices.push_back ((*indices_)[qh_pointid (vertex->point)]); - hull.points[i] = input_->points[hull_indices_.indices.back ()]; + hull[i] = input_->points[hull_indices_.indices.back ()]; qhid_to_pcidx[vertex->id] = i; // map the vertex id of qhull to the point cloud index ++i; diff --git a/surface/include/pcl/surface/impl/grid_projection.hpp b/surface/include/pcl/surface/impl/grid_projection.hpp index 864b6ab4ed6..f97bf76a2d5 100644 --- a/surface/include/pcl/surface/impl/grid_projection.hpp +++ b/surface/include/pcl/surface/impl/grid_projection.hpp @@ -336,7 +336,7 @@ pcl::GridProjection::getProjectionWithPlaneFit (const Eigen::Vector4f & model_coefficients[3] = -1 * model_coefficients.dot (xyz_centroid); // Projected point - Eigen::Vector3f point (p.x (), p.y (), p.z ()); //= Eigen::Vector3f::MapAligned (&output.points[cp].x, 3); + Eigen::Vector3f point (p.x (), p.y (), p.z ()); //= Eigen::Vector3f::MapAligned (&output[cp].x, 3); float distance = point.dot (model_coefficients.head <3> ()) + model_coefficients[3]; point -= distance * model_coefficients.head < 3 > (); @@ -737,9 +737,9 @@ pcl::GridProjection::performReconstruction (pcl::PolygonMesh &output) // Copy the data from surface_ to cloud for (std::size_t i = 0; i < cloud.points.size (); ++i) { - cloud.points[i].x = surface_[i].x (); - cloud.points[i].y = surface_[i].y (); - cloud.points[i].z = surface_[i].z (); + cloud[i].x = surface_[i].x (); + cloud[i].y = surface_[i].y (); + cloud[i].z = surface_[i].z (); } pcl::toPCLPointCloud2 (cloud, output.cloud); } diff --git a/surface/include/pcl/surface/impl/mls.hpp b/surface/include/pcl/surface/impl/mls.hpp index f98a9609b7a..2e01bd79d38 100644 --- a/surface/include/pcl/surface/impl/mls.hpp +++ b/surface/include/pcl/surface/impl/mls.hpp @@ -150,10 +150,10 @@ pcl::MovingLeastSquares::process (PointCloudOut &output) for (std::size_t i = 0; i < output.size (); ++i) { using FieldList = typename pcl::traits::fieldList::type; - pcl::for_each_type (SetIfFieldExists (output.points[i], "normal_x", normals_->points[i].normal_x)); - pcl::for_each_type (SetIfFieldExists (output.points[i], "normal_y", normals_->points[i].normal_y)); - pcl::for_each_type (SetIfFieldExists (output.points[i], "normal_z", normals_->points[i].normal_z)); - pcl::for_each_type (SetIfFieldExists (output.points[i], "curvature", normals_->points[i].curvature)); + pcl::for_each_type (SetIfFieldExists (output[i], "normal_x", normals_->points[i].normal_x)); + pcl::for_each_type (SetIfFieldExists (output[i], "normal_y", normals_->points[i].normal_y)); + pcl::for_each_type (SetIfFieldExists (output[i], "normal_z", normals_->points[i].normal_z)); + pcl::for_each_type (SetIfFieldExists (output[i], "curvature", normals_->points[i].curvature)); } } @@ -738,7 +738,7 @@ pcl::MLSResult::computeMLSSurface (const pcl::PointCloud &cloud, model_coefficients.head<3> ().matrix () = eigen_vector; model_coefficients[3] = -1 * model_coefficients.dot (xyz_centroid); - query_point = cloud.points[index].getVector3fMap ().template cast (); + query_point = cloud[index].getVector3fMap ().template cast (); if (!std::isfinite(eigen_vector[0]) || !std::isfinite(eigen_vector[1]) || !std::isfinite(eigen_vector[2])) { @@ -790,9 +790,9 @@ pcl::MLSResult::computeMLSSurface (const pcl::PointCloud &cloud, std::vector > de_meaned (num_neighbors); for (std::size_t ni = 0; ni < static_cast(num_neighbors); ++ni) { - de_meaned[ni][0] = cloud.points[nn_indices[ni]].x - mean[0]; - de_meaned[ni][1] = cloud.points[nn_indices[ni]].y - mean[1]; - de_meaned[ni][2] = cloud.points[nn_indices[ni]].z - mean[2]; + de_meaned[ni][0] = cloud[nn_indices[ni]].x - mean[0]; + de_meaned[ni][1] = cloud[nn_indices[ni]].y - mean[1]; + de_meaned[ni][2] = cloud[nn_indices[ni]].z - mean[2]; weight_vec (ni) = weight_func (de_meaned[ni].dot (de_meaned[ni])); } diff --git a/surface/include/pcl/surface/impl/poisson.hpp b/surface/include/pcl/surface/impl/poisson.hpp index eb52095c56e..dcd3e4951d5 100644 --- a/surface/include/pcl/surface/impl/poisson.hpp +++ b/surface/include/pcl/surface/impl/poisson.hpp @@ -195,16 +195,16 @@ pcl::Poisson::performReconstruction (PolygonMesh &output) for (int i = 0; i < int (mesh.inCorePoints.size ()); i++) { p = mesh.inCorePoints[i]; - cloud.points[i].x = p.coords[0]*scale+center.coords[0]; - cloud.points[i].y = p.coords[1]*scale+center.coords[1]; - cloud.points[i].z = p.coords[2]*scale+center.coords[2]; + cloud[i].x = p.coords[0]*scale+center.coords[0]; + cloud[i].y = p.coords[1]*scale+center.coords[1]; + cloud[i].z = p.coords[2]*scale+center.coords[2]; } for (int i = int (mesh.inCorePoints.size ()); i < int (mesh.outOfCorePointCount () + mesh.inCorePoints.size ()); i++) { mesh.nextOutOfCorePoint (p); - cloud.points[i].x = p.coords[0]*scale+center.coords[0]; - cloud.points[i].y = p.coords[1]*scale+center.coords[1]; - cloud.points[i].z = p.coords[2]*scale+center.coords[2]; + cloud[i].x = p.coords[0]*scale+center.coords[0]; + cloud[i].y = p.coords[1]*scale+center.coords[1]; + cloud[i].z = p.coords[2]*scale+center.coords[2]; } pcl::toPCLPointCloud2 (cloud, output.cloud); output.polygons.resize (mesh.polygonCount ()); @@ -276,16 +276,16 @@ pcl::Poisson::performReconstruction (pcl::PointCloud &points, for (int i = 0; i < int(mesh.inCorePoints.size ()); i++) { p = mesh.inCorePoints[i]; - points.points[i].x = p.coords[0]*scale+center.coords[0]; - points.points[i].y = p.coords[1]*scale+center.coords[1]; - points.points[i].z = p.coords[2]*scale+center.coords[2]; + points[i].x = p.coords[0]*scale+center.coords[0]; + points[i].y = p.coords[1]*scale+center.coords[1]; + points[i].z = p.coords[2]*scale+center.coords[2]; } for (int i = int(mesh.inCorePoints.size()); i < int (mesh.outOfCorePointCount() + mesh.inCorePoints.size ()); i++) { mesh.nextOutOfCorePoint (p); - points.points[i].x = p.coords[0]*scale+center.coords[0]; - points.points[i].y = p.coords[1]*scale+center.coords[1]; - points.points[i].z = p.coords[2]*scale+center.coords[2]; + points[i].x = p.coords[0]*scale+center.coords[0]; + points[i].y = p.coords[1]*scale+center.coords[1]; + points[i].z = p.coords[2]*scale+center.coords[2]; } polygons.resize (mesh.polygonCount ()); diff --git a/test/common/test_bearing_angle_image.cpp b/test/common/test_bearing_angle_image.cpp index 3fb1fb7a74a..a9c9a9e4188 100644 --- a/test/common/test_bearing_angle_image.cpp +++ b/test/common/test_bearing_angle_image.cpp @@ -60,20 +60,20 @@ TEST (BearingAngleImageTest, GetAngle) ///////////////////////////////////////////////////////////////////// TEST (BearingAngleImageTest, GenerateBAImage) { - point_cloud.points[0] = pcl::PointXYZ (3.0, 1.5, -2.0); - point_cloud.points[1] = pcl::PointXYZ (1.0, 3.0, 2.0); - point_cloud.points[2] = pcl::PointXYZ (2.0, 3.0, 2.0); + point_cloud[0] = pcl::PointXYZ (3.0, 1.5, -2.0); + point_cloud[1] = pcl::PointXYZ (1.0, 3.0, 2.0); + point_cloud[2] = pcl::PointXYZ (2.0, 3.0, 2.0); - point_cloud.points[3] = pcl::PointXYZ (2.0, 3.0, 1.0); - point_cloud.points[4] = pcl::PointXYZ (4.0, 2.0, 2.0); - point_cloud.points[5] = pcl::PointXYZ (-1.5, 3.0, 1.0); + point_cloud[3] = pcl::PointXYZ (2.0, 3.0, 1.0); + point_cloud[4] = pcl::PointXYZ (4.0, 2.0, 2.0); + point_cloud[5] = pcl::PointXYZ (-1.5, 3.0, 1.0); bearing_angle_image.generateBAImage (point_cloud); std::uint8_t grays[6]; for (int i = 0; i < 3 * 2; ++i) { - grays[i] = (bearing_angle_image.points[i].rgba >> 8) & 0xff; + grays[i] = (bearing_angle_image[i].rgba >> 8) & 0xff; } EXPECT_EQ (0, grays[0]); diff --git a/test/common/test_wrappers.cpp b/test/common/test_wrappers.cpp index 99fe1953ac0..0d96a431f9f 100644 --- a/test/common/test_wrappers.cpp +++ b/test/common/test_wrappers.cpp @@ -56,7 +56,7 @@ TEST (PointCloud, size) TEST (PointCloud, sq_brackets_wrapper) { for (std::uint32_t i = 0; i < size; ++i) - EXPECT_EQ_VECTORS (cloud.points[i].getVector3fMap (), + EXPECT_EQ_VECTORS (cloud[i].getVector3fMap (), cloud[i].getVector3fMap ()); } diff --git a/test/features/test_boundary_estimation.cpp b/test/features/test_boundary_estimation.cpp index 407ebefc0da..49129b57176 100644 --- a/test/features/test_boundary_estimation.cpp +++ b/test/features/test_boundary_estimation.cpp @@ -97,13 +97,13 @@ TEST (PCL, BoundaryEstimation) EXPECT_EQ (pt, true); // isBoundaryPoint (points) - pt = b.isBoundaryPoint (cloud, cloud.points[0], indices, u, v, float (M_PI) / 2.0); + pt = b.isBoundaryPoint (cloud, cloud[0], indices, u, v, float (M_PI) / 2.0); EXPECT_EQ (pt, false); - pt = b.isBoundaryPoint (cloud, cloud.points[indices.size () / 3], indices, u, v, float (M_PI) / 2.0); + pt = b.isBoundaryPoint (cloud, cloud[indices.size () / 3], indices, u, v, float (M_PI) / 2.0); EXPECT_EQ (pt, false); - pt = b.isBoundaryPoint (cloud, cloud.points[indices.size () / 2], indices, u, v, float (M_PI) / 2.0); + pt = b.isBoundaryPoint (cloud, cloud[indices.size () / 2], indices, u, v, float (M_PI) / 2.0); EXPECT_EQ (pt, false); - pt = b.isBoundaryPoint (cloud, cloud.points[indices.size () - 1], indices, u, v, float (M_PI) / 2.0); + pt = b.isBoundaryPoint (cloud, cloud[indices.size () - 1], indices, u, v, float (M_PI) / 2.0); EXPECT_EQ (pt, true); // Object diff --git a/test/features/test_gasd_estimation.cpp b/test/features/test_gasd_estimation.cpp index b6f462f1081..fa45d89a22b 100644 --- a/test/features/test_gasd_estimation.cpp +++ b/test/features/test_gasd_estimation.cpp @@ -114,9 +114,9 @@ TEST (PCL, GASDShapeEstimationNoInterp) 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; EXPECT_EQ (descriptor.points.size (), 1); - for (std::size_t i = 0; i < std::size_t (descriptor.points[0].descriptorSize ()); ++i) + for (std::size_t i = 0; i < std::size_t (descriptor[0].descriptorSize ()); ++i) { - EXPECT_NEAR (descriptor.points[0].histogram[i], ref_values[i], 1e-5); + EXPECT_NEAR (descriptor[0].histogram[i], ref_values[i], 1e-5); } } @@ -158,9 +158,9 @@ TEST(PCL, GASDShapeEstimationTrilinearInterp) 0, 0, 0, 0, 0, 0, 0, 0}; EXPECT_EQ (descriptor.points.size (), 1); - for (std::size_t i = 0; i < std::size_t (descriptor.points[0].descriptorSize ()); ++i) + for (std::size_t i = 0; i < std::size_t (descriptor[0].descriptorSize ()); ++i) { - EXPECT_NEAR (descriptor.points[0].histogram[i], ref_values[i], 1e-5); + EXPECT_NEAR (descriptor[0].histogram[i], ref_values[i], 1e-5); } } @@ -217,9 +217,9 @@ TEST (PCL, GASDShapeAndColorEstimationNoInterp) 0, 0, 0, 0, 0, 0, 0, 0}; EXPECT_EQ (descriptor.points.size (), 1); - for (std::size_t i = 0; i < std::size_t (descriptor.points[0].descriptorSize ()); ++i) + for (std::size_t i = 0; i < std::size_t (descriptor[0].descriptorSize ()); ++i) { - EXPECT_NEAR (descriptor.points[0].histogram[i], ref_values[i], 1e-5); + EXPECT_NEAR (descriptor[0].histogram[i], ref_values[i], 1e-5); } } @@ -304,9 +304,9 @@ TEST(PCL, GASDShapeAndColorEstimationQuadrilinearInterp) 0, 0, 0, 0, 0, 0, 0, 0}; EXPECT_EQ (descriptor.points.size (), 1); - for (std::size_t i = 0; i < std::size_t( descriptor.points[0].descriptorSize ()); ++i) + for (std::size_t i = 0; i < std::size_t( descriptor[0].descriptorSize ()); ++i) { - EXPECT_NEAR (descriptor.points[0].histogram[i], ref_values[i], 1e-5); + EXPECT_NEAR (descriptor[0].histogram[i], ref_values[i], 1e-5); } } diff --git a/test/features/test_gradient_estimation.cpp b/test/features/test_gradient_estimation.cpp index 26acde5e6f7..42c6225a116 100644 --- a/test/features/test_gradient_estimation.cpp +++ b/test/features/test_gradient_estimation.cpp @@ -94,7 +94,7 @@ TEST (PCL, IntensityGradientEstimation) const PointXYZI &p = cloud_ptr->points[i]; // A pointer to the estimated gradient values - const float * g_est = gradient.points[i].gradient; + const float * g_est = gradient[i].gradient; // Compute the surface normal analytically. float nx = -0.2f * p.x; diff --git a/test/features/test_ii_normals.cpp b/test/features/test_ii_normals.cpp index c5e5154d9db..9bdac5bc435 100644 --- a/test/features/test_ii_normals.cpp +++ b/test/features/test_ii_normals.cpp @@ -360,9 +360,9 @@ TEST (PCL, NormalEstimation) for (std::size_t i = 0; i < cloud.points.size (); ++i) { - EXPECT_NEAR (std::abs (output.points[i].normal_x), 0, 1e-2); - EXPECT_NEAR (std::abs (output.points[i].normal_y), 0, 1e-2); - EXPECT_NEAR (std::abs (output.points[i].normal_z), 1.0, 1e-2); + EXPECT_NEAR (std::abs (output[i].normal_x), 0, 1e-2); + EXPECT_NEAR (std::abs (output[i].normal_y), 0, 1e-2); + EXPECT_NEAR (std::abs (output[i].normal_z), 1.0, 1e-2); } } diff --git a/test/features/test_normal_estimation.cpp b/test/features/test_normal_estimation.cpp index 5b0c2fc68f2..b1c810d4569 100644 --- a/test/features/test_normal_estimation.cpp +++ b/test/features/test_normal_estimation.cpp @@ -125,14 +125,14 @@ TEST (PCL, NormalEstimation) EXPECT_NEAR (curvature, 0.0693136, 1e-4); // flipNormalTowardsViewpoint (Vector) - flipNormalTowardsViewpoint (cloud.points[0], 0, 0, 0, plane_parameters); + flipNormalTowardsViewpoint (cloud[0], 0, 0, 0, plane_parameters); EXPECT_NEAR (plane_parameters[0], -0.035592, 1e-4); EXPECT_NEAR (plane_parameters[1], -0.369596, 1e-4); EXPECT_NEAR (plane_parameters[2], -0.928511, 1e-4); EXPECT_NEAR (plane_parameters[3], 0.0799743, 1e-4); // flipNormalTowardsViewpoint - flipNormalTowardsViewpoint (cloud.points[0], 0, 0, 0, nx, ny, nz); + flipNormalTowardsViewpoint (cloud[0], 0, 0, 0, nx, ny, nz); EXPECT_NEAR (nx, -0.035592, 1e-4); EXPECT_NEAR (ny, -0.369596, 1e-4); EXPECT_NEAR (nz, -0.928511, 1e-4); diff --git a/test/features/test_pfh_estimation.cpp b/test/features/test_pfh_estimation.cpp index 973f5814ccb..0504515189c 100644 --- a/test/features/test_pfh_estimation.cpp +++ b/test/features/test_pfh_estimation.cpp @@ -110,8 +110,8 @@ testIndicesAndSearchSurface (const typename PointCloud::Ptr & points, { for (int j = 0; j < ndims; ++j) { - ASSERT_EQ (output0.points[i].histogram[j], output1.points[i].histogram[j]); - ASSERT_EQ (output1.points[i].histogram[j], output2.points[i].histogram[j]); + ASSERT_EQ (output0[i].histogram[j], output1[i].histogram[j]); + ASSERT_EQ (output1[i].histogram[j], output2[i].histogram[j]); } } @@ -143,7 +143,7 @@ testIndicesAndSearchSurface (const typename PointCloud::Ptr & points, { for (int j = 0; j < ndims; ++j) { - ASSERT_EQ (output3.points[i].histogram[j], output4.points[i].histogram[j]); + ASSERT_EQ (output3[i].histogram[j], output4[i].histogram[j]); } } } @@ -470,7 +470,7 @@ TEST (PCL, VFHEstimation) EXPECT_EQ (int (vfhs->points.size ()), 1); //for (std::size_t d = 0; d < 308; ++d) - // std::cerr << vfhs.points[0].histogram[d] << std::endl; + // std::cerr << vfhs[0].histogram[d] << std::endl; } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -512,9 +512,9 @@ TEST (PCL, GFPFH) const float ref_values[] = { 1877, 6375, 5361, 14393, 6674, 2471, 2248, 2753, 3117, 4585, 14388, 32407, 15122, 3061, 3202, 794 }; EXPECT_EQ (descriptor.points.size (), 1); - for (std::size_t i = 0; i < std::size_t (descriptor.points[0].descriptorSize ()); ++i) + for (std::size_t i = 0; i < std::size_t (descriptor[0].descriptorSize ()); ++i) { - EXPECT_EQ (descriptor.points[0].histogram[i], ref_values[i]); + EXPECT_EQ (descriptor[0].histogram[i], ref_values[i]); } } diff --git a/test/features/test_rift_estimation.cpp b/test/features/test_rift_estimation.cpp index 248d1241324..2544053abc9 100644 --- a/test/features/test_rift_estimation.cpp +++ b/test/features/test_rift_estimation.cpp @@ -75,7 +75,7 @@ TEST (PCL, RIFTEstimation) gradient.points.resize (gradient.width); for (std::size_t i = 0; i < cloud_xyzi.points.size (); ++i) { - const PointXYZI &p = cloud_xyzi.points[i]; + const PointXYZI &p = cloud_xyzi[i]; // Compute the surface normal analytically. float nx = p.x; @@ -97,9 +97,9 @@ TEST (PCL, RIFTEstimation) float gy = (-ny * nx) * tmpx + (1 - ny * ny) * tmpy + (-ny * nz) * tmpz; float gz = (-nz * nx) * tmpx + (-nz * ny) * tmpy + (1 - nz * nz) * tmpz; - gradient.points[i].gradient[0] = gx; - gradient.points[i].gradient[1] = gy; - gradient.points[i].gradient[2] = gz; + gradient[i].gradient[0] = gx; + gradient[i].gradient[1] = gy; + gradient[i].gradient[2] = gz; } // Compute the RIFT features @@ -117,7 +117,7 @@ TEST (PCL, RIFTEstimation) rift_est.compute (rift_output); // Compare to independently verified values - const RIFTDescriptor &rift = rift_output.points[220]; + const RIFTDescriptor &rift = rift_output[220]; float correct_rift_feature_values[32]; unsigned major, minor, patch; diff --git a/test/features/test_shot_estimation.cpp b/test/features/test_shot_estimation.cpp index c23d665b4fb..e4852de22d0 100644 --- a/test/features/test_shot_estimation.cpp +++ b/test/features/test_shot_estimation.cpp @@ -71,8 +71,8 @@ checkDesc(const pcl::PointCloud& d0, const pcl::PointCloud& d1) { ASSERT_EQ (d0.size (), d1.size ()); for (std::size_t i = 0; i < d1.size (); ++i) - for (std::size_t j = 0; j < d0.points[i].descriptor.size(); ++j) - ASSERT_EQ (d0.points[i].descriptor[j], d1.points[i].descriptor[j]); + for (std::size_t j = 0; j < d0[i].descriptor.size(); ++j) + ASSERT_EQ (d0[i].descriptor[j], d1[i].descriptor[j]); } /////////////////////////////////////////////////////////////////////////////////// @@ -82,7 +82,7 @@ checkDesc(const pcl::PointCloud& d0, const pcl::PointCloud(const pcl::PointCloud& d0, const pcl::PointCloud(const pcl::PointCloud& d0, const p ASSERT_EQ (d0.size (), d1.size ()); for (std::size_t i = 0; i < d1.size (); ++i) for (std::size_t j = 0; j < 1980; ++j) - ASSERT_EQ (d0.points[i].descriptor[j], d1.points[i].descriptor[j]); + ASSERT_EQ (d0[i].descriptor[j], d1[i].descriptor[j]); } /////////////////////////////////////////////////////////////////////////////////// @@ -112,7 +112,7 @@ checkDesc(const pcl::PointCloud& ASSERT_EQ (d0.size (), d1.size ()); for (std::size_t i = 0; i < d1.size (); ++i) for (std::size_t j = 0; j < 1960; ++j) - ASSERT_EQ (d0.points[i].descriptor[j], d1.points[i].descriptor[j]); + ASSERT_EQ (d0[i].descriptor[j], d1[i].descriptor[j]); } /////////////////////////////////////////////////////////////////////////////////// @@ -586,9 +586,9 @@ TYPED_TEST (SHOTShapeAndColorTest, Estimation) for (int i = 0; i < static_cast (cloud.points.size ()); ++i) { PointXYZRGBA p; - p.x = cloud.points[i].x; - p.y = cloud.points[i].y; - p.z = cloud.points[i].z; + p.x = cloud[i].x; + p.y = cloud[i].y; + p.z = cloud[i].z; p.rgba = ( (i%255) << 16 ) + ( ( (255 - i ) %255) << 8) + ( ( i*37 ) %255); cloudWithColors.push_back(p); diff --git a/test/features/test_spin_estimation.cpp b/test/features/test_spin_estimation.cpp index e95ede69c35..1abec8a57f6 100644 --- a/test/features/test_spin_estimation.cpp +++ b/test/features/test_spin_estimation.cpp @@ -270,7 +270,7 @@ TEST (PCL, IntensitySpinEstimation) ispin_est.compute (ispin_output); // Compare to independently verified values - const IntensitySpin &ispin = ispin_output.points[220]; + const IntensitySpin &ispin = ispin_output[220]; const float correct_ispin_feature_values[20] = {2.4387f, 9.4737f, 21.3232f, 28.3025f, 22.5639f, 13.2426f, 35.7026f, 60.0755f, 66.9240f, 50.4225f, 42.7086f, 83.5818f, 105.4513f, 97.8454f, 67.3801f, 75.7127f, 119.4726f, 120.9649f, 93.4829f, 55.4045f}; diff --git a/test/filters/test_filters.cpp b/test/filters/test_filters.cpp index fe429bba6f0..e3719896c42 100644 --- a/test/filters/test_filters.cpp +++ b/test/filters/test_filters.cpp @@ -122,13 +122,13 @@ TEST (ExtractIndices, Filters) EXPECT_EQ (int (output.width), 2); EXPECT_EQ (int (output.height), 1); - EXPECT_EQ (cloud->points[0].x, output.points[0].x); - EXPECT_EQ (cloud->points[0].y, output.points[0].y); - EXPECT_EQ (cloud->points[0].z, output.points[0].z); + EXPECT_EQ (cloud->points[0].x, output[0].x); + EXPECT_EQ (cloud->points[0].y, output[0].y); + EXPECT_EQ (cloud->points[0].z, output[0].z); - EXPECT_EQ (cloud->points[cloud->points.size () - 1].x, output.points[1].x); - EXPECT_EQ (cloud->points[cloud->points.size () - 1].y, output.points[1].y); - EXPECT_EQ (cloud->points[cloud->points.size () - 1].z, output.points[1].z); + EXPECT_EQ (cloud->points[cloud->points.size () - 1].x, output[1].x); + EXPECT_EQ (cloud->points[cloud->points.size () - 1].y, output[1].y); + EXPECT_EQ (cloud->points[cloud->points.size () - 1].z, output[1].z); ei.setNegative (true); ei.filter (output); @@ -137,13 +137,13 @@ TEST (ExtractIndices, Filters) EXPECT_EQ (output.width, cloud->points.size () - 2); EXPECT_EQ (int (output.height), 1); - EXPECT_EQ (cloud->points[1].x, output.points[0].x); - EXPECT_EQ (cloud->points[1].y, output.points[0].y); - EXPECT_EQ (cloud->points[1].z, output.points[0].z); + EXPECT_EQ (cloud->points[1].x, output[0].x); + EXPECT_EQ (cloud->points[1].y, output[0].y); + EXPECT_EQ (cloud->points[1].z, output[0].z); - EXPECT_EQ (cloud->points[cloud->points.size () - 2].x, output.points[output.points.size () - 1].x); - EXPECT_EQ (cloud->points[cloud->points.size () - 2].y, output.points[output.points.size () - 1].y); - EXPECT_EQ (cloud->points[cloud->points.size () - 2].z, output.points[output.points.size () - 1].z); + EXPECT_EQ (cloud->points[cloud->points.size () - 2].x, output[output.points.size () - 1].x); + EXPECT_EQ (cloud->points[cloud->points.size () - 2].y, output[output.points.size () - 1].y); + EXPECT_EQ (cloud->points[cloud->points.size () - 2].z, output[output.points.size () - 1].z); // Test the pcl::PCLPointCloud2 method ExtractIndices ei2; @@ -159,13 +159,13 @@ TEST (ExtractIndices, Filters) EXPECT_EQ (int (output.width), 2); EXPECT_EQ (int (output.height), 1); - EXPECT_EQ (cloud->points[0].x, output.points[0].x); - EXPECT_EQ (cloud->points[0].y, output.points[0].y); - EXPECT_EQ (cloud->points[0].z, output.points[0].z); + EXPECT_EQ (cloud->points[0].x, output[0].x); + EXPECT_EQ (cloud->points[0].y, output[0].y); + EXPECT_EQ (cloud->points[0].z, output[0].z); - EXPECT_EQ (cloud->points[cloud->points.size () - 1].x, output.points[1].x); - EXPECT_EQ (cloud->points[cloud->points.size () - 1].y, output.points[1].y); - EXPECT_EQ (cloud->points[cloud->points.size () - 1].z, output.points[1].z); + EXPECT_EQ (cloud->points[cloud->points.size () - 1].x, output[1].x); + EXPECT_EQ (cloud->points[cloud->points.size () - 1].y, output[1].y); + EXPECT_EQ (cloud->points[cloud->points.size () - 1].z, output[1].z); ei2.setNegative (true); ei2.filter (output_blob); @@ -176,13 +176,13 @@ TEST (ExtractIndices, Filters) EXPECT_EQ (output.width, cloud->points.size () - 2); EXPECT_EQ (int (output.height), 1); - EXPECT_EQ (cloud->points[1].x, output.points[0].x); - EXPECT_EQ (cloud->points[1].y, output.points[0].y); - EXPECT_EQ (cloud->points[1].z, output.points[0].z); + EXPECT_EQ (cloud->points[1].x, output[0].x); + EXPECT_EQ (cloud->points[1].y, output[0].y); + EXPECT_EQ (cloud->points[1].z, output[0].z); - EXPECT_EQ (cloud->points[cloud->points.size () - 2].x, output.points[output.points.size () - 1].x); - EXPECT_EQ (cloud->points[cloud->points.size () - 2].y, output.points[output.points.size () - 1].y); - EXPECT_EQ (cloud->points[cloud->points.size () - 2].z, output.points[output.points.size () - 1].z); + EXPECT_EQ (cloud->points[cloud->points.size () - 2].x, output[output.points.size () - 1].x); + EXPECT_EQ (cloud->points[cloud->points.size () - 2].y, output[output.points.size () - 1].y); + EXPECT_EQ (cloud->points[cloud->points.size () - 2].z, output[output.points.size () - 1].z); ei2.setNegative (false); ei2.setKeepOrganized (true); @@ -194,12 +194,12 @@ TEST (ExtractIndices, Filters) EXPECT_EQ (output.width, cloud->width); EXPECT_EQ (output.height, cloud->height); - EXPECT_EQ (output.points[0].x, cloud->points[0].x); - EXPECT_EQ (output.points[0].y, cloud->points[0].y); - EXPECT_EQ (output.points[0].z, cloud->points[0].z); - EXPECT_TRUE (std::isnan(output.points[1].x)); - EXPECT_TRUE (std::isnan(output.points[1].y)); - EXPECT_TRUE (std::isnan(output.points[1].z)); + EXPECT_EQ (output[0].x, cloud->points[0].x); + EXPECT_EQ (output[0].y, cloud->points[0].y); + EXPECT_EQ (output[0].z, cloud->points[0].z); + EXPECT_TRUE (std::isnan(output[1].x)); + EXPECT_TRUE (std::isnan(output[1].y)); + EXPECT_TRUE (std::isnan(output[1].z)); ei2.setNegative (true); ei2.setKeepOrganized (true); @@ -211,12 +211,12 @@ TEST (ExtractIndices, Filters) EXPECT_EQ (output.width, cloud->width); EXPECT_EQ (output.height, cloud->height); - EXPECT_TRUE (std::isnan(output.points[0].x)); - EXPECT_TRUE (std::isnan(output.points[0].y)); - EXPECT_TRUE (std::isnan(output.points[0].z)); - EXPECT_EQ (output.points[1].x, cloud->points[1].x); - EXPECT_EQ (output.points[1].y, cloud->points[1].y); - EXPECT_EQ (output.points[1].z, cloud->points[1].z); + EXPECT_TRUE (std::isnan(output[0].x)); + EXPECT_TRUE (std::isnan(output[0].y)); + EXPECT_TRUE (std::isnan(output[0].z)); + EXPECT_EQ (output[1].x, cloud->points[1].x); + EXPECT_EQ (output[1].y, cloud->points[1].y); + EXPECT_EQ (output[1].z, cloud->points[1].z); // Test setNegative on empty datasets PointCloud empty, result; @@ -257,8 +257,8 @@ TEST (ExtractIndices, Filters) sc.points.resize (5); sc.width = 5; sc.height = 1; sc.is_dense = true; for (int i = 0; i < 5; i++) { - sc.points[i].x = sc.points[i].z = 0; - sc.points[i].y = i; + sc[i].x = sc[i].z = 0; + sc[i].y = i; } PassThrough ps; ps.setInputCloud (sc.makeShared ()); @@ -270,7 +270,7 @@ TEST (ExtractIndices, Filters) ps.filter (scf); std::cerr << scf.points.size () << std::endl; for (std::size_t j = 0; j < scf.points.size (); ++j) - std::cerr << scf.points[j] << std::endl; + std::cerr << scf[j] << std::endl; } */ } @@ -298,13 +298,13 @@ TEST (PassThrough, Filters) EXPECT_EQ (int (output.height), 1); EXPECT_EQ (bool (output.is_dense), true); - EXPECT_NEAR (output.points[0].x, -0.074556, 1e-5); - EXPECT_NEAR (output.points[0].y, 0.13415, 1e-5); - EXPECT_NEAR (output.points[0].z, 0.051046, 1e-5); + EXPECT_NEAR (output[0].x, -0.074556, 1e-5); + EXPECT_NEAR (output[0].y, 0.13415, 1e-5); + EXPECT_NEAR (output[0].z, 0.051046, 1e-5); - EXPECT_NEAR (output.points[41].x, -0.030331, 1e-5); - EXPECT_NEAR (output.points[41].y, 0.039749, 1e-5); - EXPECT_NEAR (output.points[41].z, 0.052133, 1e-5); + EXPECT_NEAR (output[41].x, -0.030331, 1e-5); + EXPECT_NEAR (output[41].y, 0.039749, 1e-5); + EXPECT_NEAR (output[41].z, 0.052133, 1e-5); pt.setNegative (true); pt.filter (output); @@ -314,13 +314,13 @@ TEST (PassThrough, Filters) EXPECT_EQ (int (output.height), 1); EXPECT_EQ (bool (output.is_dense), true); - EXPECT_NEAR (output.points[0].x, 0.0054216, 1e-5); - EXPECT_NEAR (output.points[0].y, 0.11349, 1e-5); - EXPECT_NEAR (output.points[0].z, 0.040749, 1e-5); + EXPECT_NEAR (output[0].x, 0.0054216, 1e-5); + EXPECT_NEAR (output[0].y, 0.11349, 1e-5); + EXPECT_NEAR (output[0].z, 0.040749, 1e-5); - EXPECT_NEAR (output.points[354].x, -0.07793, 1e-5); - EXPECT_NEAR (output.points[354].y, 0.17516, 1e-5); - EXPECT_NEAR (output.points[354].z, -0.0444, 1e-5); + EXPECT_NEAR (output[354].x, -0.07793, 1e-5); + EXPECT_NEAR (output[354].y, 0.17516, 1e-5); + EXPECT_NEAR (output[354].z, -0.0444, 1e-5); PassThrough pt_(true); @@ -342,13 +342,13 @@ TEST (PassThrough, Filters) EXPECT_EQ (bool (output.is_dense), true); EXPECT_EQ (int (output.points.size ()), cloud->points.size ()-pt_.getRemovedIndices()->size()); - EXPECT_NEAR (output.points[0].x, -0.074556, 1e-5); - EXPECT_NEAR (output.points[0].y, 0.13415, 1e-5); - EXPECT_NEAR (output.points[0].z, 0.051046, 1e-5); + EXPECT_NEAR (output[0].x, -0.074556, 1e-5); + EXPECT_NEAR (output[0].y, 0.13415, 1e-5); + EXPECT_NEAR (output[0].z, 0.051046, 1e-5); - EXPECT_NEAR (output.points[41].x, -0.030331, 1e-5); - EXPECT_NEAR (output.points[41].y, 0.039749, 1e-5); - EXPECT_NEAR (output.points[41].z, 0.052133, 1e-5); + EXPECT_NEAR (output[41].x, -0.030331, 1e-5); + EXPECT_NEAR (output[41].y, 0.039749, 1e-5); + EXPECT_NEAR (output[41].z, 0.052133, 1e-5); pt_.setNegative (true); pt_.filter (output); @@ -359,13 +359,13 @@ TEST (PassThrough, Filters) EXPECT_EQ (bool (output.is_dense), true); EXPECT_EQ (int (output.points.size ()), cloud->points.size ()-pt_.getRemovedIndices()->size()); - EXPECT_NEAR (output.points[0].x, 0.0054216, 1e-5); - EXPECT_NEAR (output.points[0].y, 0.11349, 1e-5); - EXPECT_NEAR (output.points[0].z, 0.040749, 1e-5); + EXPECT_NEAR (output[0].x, 0.0054216, 1e-5); + EXPECT_NEAR (output[0].y, 0.11349, 1e-5); + EXPECT_NEAR (output[0].z, 0.040749, 1e-5); - EXPECT_NEAR (output.points[354].x, -0.07793, 1e-5); - EXPECT_NEAR (output.points[354].y, 0.17516, 1e-5); - EXPECT_NEAR (output.points[354].z, -0.0444, 1e-5); + EXPECT_NEAR (output[354].x, -0.07793, 1e-5); + EXPECT_NEAR (output[354].y, 0.17516, 1e-5); + EXPECT_NEAR (output[354].z, -0.0444, 1e-5); // Test the keep organized structure pt.setUserFilterValue (std::numeric_limits::quiet_NaN ()); @@ -376,8 +376,8 @@ TEST (PassThrough, Filters) EXPECT_EQ (output.width, cloud->width); EXPECT_EQ (output.height, cloud->height); EXPECT_EQ (output.is_dense, cloud->is_dense); - EXPECT_NEAR (output.points[0].x, cloud->points[0].x, 1e-5); - EXPECT_NEAR (output.points[output.points.size () - 1].x, cloud->points[cloud->points.size () - 1].x, 1e-5); + EXPECT_NEAR (output[0].x, cloud->points[0].x, 1e-5); + EXPECT_NEAR (output[output.points.size () - 1].x, cloud->points[cloud->points.size () - 1].x, 1e-5); pt.setFilterFieldName ("z"); pt.setNegative (false); @@ -389,12 +389,12 @@ TEST (PassThrough, Filters) EXPECT_EQ (output.height, cloud->height); EXPECT_EQ (bool (output.is_dense), false); // NaN was set as a user filter value - EXPECT_TRUE (std::isnan (output.points[0].x)); - EXPECT_TRUE (std::isnan (output.points[0].y)); - EXPECT_TRUE (std::isnan (output.points[0].z)); - EXPECT_TRUE (std::isnan (output.points[41].x)); - EXPECT_TRUE (std::isnan (output.points[41].y)); - EXPECT_TRUE (std::isnan (output.points[41].z)); + EXPECT_TRUE (std::isnan (output[0].x)); + EXPECT_TRUE (std::isnan (output[0].y)); + EXPECT_TRUE (std::isnan (output[0].z)); + EXPECT_TRUE (std::isnan (output[41].x)); + EXPECT_TRUE (std::isnan (output[41].y)); + EXPECT_TRUE (std::isnan (output[41].z)); pt.setNegative (true); pt.filter (output); @@ -404,13 +404,13 @@ TEST (PassThrough, Filters) EXPECT_EQ (output.height, cloud->height); EXPECT_EQ (bool (output.is_dense), false); // NaN was set as a user filter value - EXPECT_NEAR (output.points[0].x, cloud->points[0].x, 1e-5); - EXPECT_NEAR (output.points[0].y, cloud->points[0].y, 1e-5); - EXPECT_NEAR (output.points[0].z, cloud->points[0].z, 1e-5); + EXPECT_NEAR (output[0].x, cloud->points[0].x, 1e-5); + EXPECT_NEAR (output[0].y, cloud->points[0].y, 1e-5); + EXPECT_NEAR (output[0].z, cloud->points[0].z, 1e-5); - EXPECT_NEAR (output.points[41].x, cloud->points[41].x, 1e-5); - EXPECT_NEAR (output.points[41].y, cloud->points[41].y, 1e-5); - EXPECT_NEAR (output.points[41].z, cloud->points[41].z, 1e-5); + EXPECT_NEAR (output[41].x, cloud->points[41].x, 1e-5); + EXPECT_NEAR (output[41].y, cloud->points[41].y, 1e-5); + EXPECT_NEAR (output[41].z, cloud->points[41].z, 1e-5); // Test the PCLPointCloud2 method PassThrough pt2; @@ -436,13 +436,13 @@ TEST (PassThrough, Filters) EXPECT_EQ (int (output.height), 1); EXPECT_EQ (bool (output.is_dense), true); - EXPECT_NEAR (output.points[0].x, -0.074556, 1e-5); - EXPECT_NEAR (output.points[0].y, 0.13415, 1e-5); - EXPECT_NEAR (output.points[0].z, 0.051046, 1e-5); + EXPECT_NEAR (output[0].x, -0.074556, 1e-5); + EXPECT_NEAR (output[0].y, 0.13415, 1e-5); + EXPECT_NEAR (output[0].z, 0.051046, 1e-5); - EXPECT_NEAR (output.points[41].x, -0.030331, 1e-5); - EXPECT_NEAR (output.points[41].y, 0.039749, 1e-5); - EXPECT_NEAR (output.points[41].z, 0.052133, 1e-5); + EXPECT_NEAR (output[41].x, -0.030331, 1e-5); + EXPECT_NEAR (output[41].y, 0.039749, 1e-5); + EXPECT_NEAR (output[41].z, 0.052133, 1e-5); pt2.setNegative (true); pt2.filter (output_blob); @@ -454,13 +454,13 @@ TEST (PassThrough, Filters) EXPECT_EQ (int (output.height), 1); EXPECT_EQ (bool (output.is_dense), true); - EXPECT_NEAR (output.points[0].x, 0.0054216, 1e-5); - EXPECT_NEAR (output.points[0].y, 0.11349, 1e-5); - EXPECT_NEAR (output.points[0].z, 0.040749, 1e-5); + EXPECT_NEAR (output[0].x, 0.0054216, 1e-5); + EXPECT_NEAR (output[0].y, 0.11349, 1e-5); + EXPECT_NEAR (output[0].z, 0.040749, 1e-5); - EXPECT_NEAR (output.points[354].x, -0.07793, 1e-5); - EXPECT_NEAR (output.points[354].y, 0.17516, 1e-5); - EXPECT_NEAR (output.points[354].z, -0.0444, 1e-5); + EXPECT_NEAR (output[354].x, -0.07793, 1e-5); + EXPECT_NEAR (output[354].y, 0.17516, 1e-5); + EXPECT_NEAR (output[354].z, -0.0444, 1e-5); PassThrough pt2_(true); pt2_.setInputCloud (cloud_blob); @@ -485,13 +485,13 @@ TEST (PassThrough, Filters) EXPECT_EQ (bool (output.is_dense), true); EXPECT_EQ (int (output.points.size ()), cloud->points.size ()-pt2_.getRemovedIndices()->size()); - EXPECT_NEAR (output.points[0].x, -0.074556, 1e-5); - EXPECT_NEAR (output.points[0].y, 0.13415, 1e-5); - EXPECT_NEAR (output.points[0].z, 0.051046, 1e-5); + EXPECT_NEAR (output[0].x, -0.074556, 1e-5); + EXPECT_NEAR (output[0].y, 0.13415, 1e-5); + EXPECT_NEAR (output[0].z, 0.051046, 1e-5); - EXPECT_NEAR (output.points[41].x, -0.030331, 1e-5); - EXPECT_NEAR (output.points[41].y, 0.039749, 1e-5); - EXPECT_NEAR (output.points[41].z, 0.052133, 1e-5); + EXPECT_NEAR (output[41].x, -0.030331, 1e-5); + EXPECT_NEAR (output[41].y, 0.039749, 1e-5); + EXPECT_NEAR (output[41].z, 0.052133, 1e-5); pt2_.setNegative (true); pt2_.filter (output_blob); @@ -504,13 +504,13 @@ TEST (PassThrough, Filters) EXPECT_EQ (bool (output.is_dense), true); EXPECT_EQ (int (output.points.size ()), cloud->points.size ()-pt2_.getRemovedIndices()->size()); - EXPECT_NEAR (output.points[0].x, 0.0054216, 1e-5); - EXPECT_NEAR (output.points[0].y, 0.11349, 1e-5); - EXPECT_NEAR (output.points[0].z, 0.040749, 1e-5); + EXPECT_NEAR (output[0].x, 0.0054216, 1e-5); + EXPECT_NEAR (output[0].y, 0.11349, 1e-5); + EXPECT_NEAR (output[0].z, 0.040749, 1e-5); - EXPECT_NEAR (output.points[354].x, -0.07793, 1e-5); - EXPECT_NEAR (output.points[354].y, 0.17516, 1e-5); - EXPECT_NEAR (output.points[354].z, -0.0444, 1e-5); + EXPECT_NEAR (output[354].x, -0.07793, 1e-5); + EXPECT_NEAR (output[354].y, 0.17516, 1e-5); + EXPECT_NEAR (output[354].z, -0.0444, 1e-5); // Test the keep organized structure pt2.setUserFilterValue (std::numeric_limits::quiet_NaN ()); @@ -522,8 +522,8 @@ TEST (PassThrough, Filters) EXPECT_EQ (output.width, cloud->width); EXPECT_EQ (output.height, cloud->height); EXPECT_EQ (output.is_dense, cloud->is_dense); - EXPECT_NEAR (output.points[0].x, cloud->points[0].x, 1e-5); - EXPECT_NEAR (output.points[output.points.size () - 1].x, cloud->points[cloud->points.size () - 1].x, 1e-5); + EXPECT_NEAR (output[0].x, cloud->points[0].x, 1e-5); + EXPECT_NEAR (output[output.points.size () - 1].x, cloud->points[cloud->points.size () - 1].x, 1e-5); pt2.setFilterFieldName ("z"); pt2.setNegative (false); @@ -536,13 +536,13 @@ TEST (PassThrough, Filters) EXPECT_EQ (output.height, cloud->height); EXPECT_EQ (bool (output.is_dense), false); // NaN was set as a user filter value - EXPECT_TRUE (std::isnan (output.points[0].x)); - EXPECT_TRUE (std::isnan (output.points[0].y)); - EXPECT_TRUE (std::isnan (output.points[0].z)); + EXPECT_TRUE (std::isnan (output[0].x)); + EXPECT_TRUE (std::isnan (output[0].y)); + EXPECT_TRUE (std::isnan (output[0].z)); - EXPECT_TRUE (std::isnan (output.points[41].x)); - EXPECT_TRUE (std::isnan (output.points[41].y)); - EXPECT_TRUE (std::isnan (output.points[41].z)); + EXPECT_TRUE (std::isnan (output[41].x)); + EXPECT_TRUE (std::isnan (output[41].y)); + EXPECT_TRUE (std::isnan (output[41].z)); pt2.setNegative (true); pt2.filter (output_blob); @@ -553,13 +553,13 @@ TEST (PassThrough, Filters) EXPECT_EQ (output.height, cloud->height); EXPECT_EQ (bool (output.is_dense), false); // NaN was set as a user filter value - EXPECT_NEAR (output.points[0].x, cloud->points[0].x, 1e-5); - EXPECT_NEAR (output.points[0].y, cloud->points[0].y, 1e-5); - EXPECT_NEAR (output.points[0].z, cloud->points[0].z, 1e-5); + EXPECT_NEAR (output[0].x, cloud->points[0].x, 1e-5); + EXPECT_NEAR (output[0].y, cloud->points[0].y, 1e-5); + EXPECT_NEAR (output[0].z, cloud->points[0].z, 1e-5); - EXPECT_NEAR (output.points[41].x, cloud->points[41].x, 1e-5); - EXPECT_NEAR (output.points[41].y, cloud->points[41].y, 1e-5); - EXPECT_NEAR (output.points[41].z, cloud->points[41].z, 1e-5); + EXPECT_NEAR (output[41].x, cloud->points[41].x, 1e-5); + EXPECT_NEAR (output[41].y, cloud->points[41].y, 1e-5); + EXPECT_NEAR (output[41].z, cloud->points[41].z, 1e-5); } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -587,13 +587,13 @@ TEST (VoxelGrid, Filters) EXPECT_EQ (int (output.height), 1); EXPECT_EQ (bool (output.is_dense), true); - EXPECT_NEAR (output.points[0].x, -0.026125, 1e-4); - EXPECT_NEAR (output.points[0].y, 0.039788, 1e-4); - EXPECT_NEAR (output.points[0].z, 0.052827, 1e-4); + EXPECT_NEAR (output[0].x, -0.026125, 1e-4); + EXPECT_NEAR (output[0].y, 0.039788, 1e-4); + EXPECT_NEAR (output[0].z, 0.052827, 1e-4); - EXPECT_NEAR (output.points[13].x, -0.073202, 1e-4); - EXPECT_NEAR (output.points[13].y, 0.1296, 1e-4); - EXPECT_NEAR (output.points[13].z, 0.051333, 1e-4); + EXPECT_NEAR (output[13].x, -0.073202, 1e-4); + EXPECT_NEAR (output[13].y, 0.1296, 1e-4); + EXPECT_NEAR (output[13].z, 0.051333, 1e-4); grid.setFilterLimitsNegative (true); grid.setSaveLeafLayout(true); @@ -604,17 +604,17 @@ TEST (VoxelGrid, Filters) EXPECT_EQ (int (output.height), 1); EXPECT_EQ (bool (output.is_dense), true); - //EXPECT_NEAR (output.points[0].x, -0.070192, 1e-4); - //EXPECT_NEAR (output.points[0].y, 0.17653, 1e-4); - //EXPECT_NEAR (output.points[0].z, -0.048774, 1e-4); + //EXPECT_NEAR (output[0].x, -0.070192, 1e-4); + //EXPECT_NEAR (output[0].y, 0.17653, 1e-4); + //EXPECT_NEAR (output[0].z, -0.048774, 1e-4); - //EXPECT_NEAR (output.points[99].x, -0.068948, 1e-4); - //EXPECT_NEAR (output.points[99].y, 0.1447, 1e-4); - //EXPECT_NEAR (output.points[99].z, 0.042178, 1e-4); + //EXPECT_NEAR (output[99].x, -0.068948, 1e-4); + //EXPECT_NEAR (output[99].y, 0.1447, 1e-4); + //EXPECT_NEAR (output[99].z, 0.042178, 1e-4); // centroids should be identified correctly - EXPECT_EQ (grid.getCentroidIndex (output.points[0]), 0); - EXPECT_EQ (grid.getCentroidIndex (output.points[99]), 99); + EXPECT_EQ (grid.getCentroidIndex (output[0]), 0); + EXPECT_EQ (grid.getCentroidIndex (output[99]), 99); EXPECT_EQ (grid.getCentroidIndexAt (grid.getGridCoordinates (-1,-1,-1)), -1); //PCL_ERROR ("IGNORE PREVIOUS ERROR: testing it's functionality!\n"); @@ -622,22 +622,22 @@ TEST (VoxelGrid, Filters) int centroidIdx = grid.getCentroidIndex (cloud->points[195]); // for arbitrary points, the centroid should be close - EXPECT_LE (std::abs (output.points[centroidIdx].x - cloud->points[195].x), 0.02); - EXPECT_LE (std::abs (output.points[centroidIdx].y - cloud->points[195].y), 0.02); - EXPECT_LE (std::abs (output.points[centroidIdx].z - cloud->points[195].z), 0.02); + EXPECT_LE (std::abs (output[centroidIdx].x - cloud->points[195].x), 0.02); + EXPECT_LE (std::abs (output[centroidIdx].y - cloud->points[195].y), 0.02); + EXPECT_LE (std::abs (output[centroidIdx].z - cloud->points[195].z), 0.02); // if getNeighborCentroidIndices works then the other helper functions work as well - EXPECT_EQ (grid.getNeighborCentroidIndices (output.points[0], Eigen::MatrixXi::Zero(3,1))[0], 0); - EXPECT_EQ (grid.getNeighborCentroidIndices (output.points[99], Eigen::MatrixXi::Zero(3,1))[0], 99); + EXPECT_EQ (grid.getNeighborCentroidIndices (output[0], Eigen::MatrixXi::Zero(3,1))[0], 0); + EXPECT_EQ (grid.getNeighborCentroidIndices (output[99], Eigen::MatrixXi::Zero(3,1))[0], 99); // neighboring centroid should be in the right position Eigen::MatrixXi directions = Eigen::Vector3i (0, 0, 1); std::vector neighbors = grid.getNeighborCentroidIndices (cloud->points[195], directions); EXPECT_EQ (neighbors.size (), std::size_t (directions.cols ())); EXPECT_NE (neighbors.at (0), -1); - EXPECT_LE (std::abs (output.points[neighbors.at (0)].x - output.points[centroidIdx].x), 0.02); - EXPECT_LE (std::abs (output.points[neighbors.at (0)].y - output.points[centroidIdx].y), 0.02); - EXPECT_LE ( output.points[neighbors.at (0)].z - output.points[centroidIdx].z, 0.02 * 2); + EXPECT_LE (std::abs (output[neighbors.at (0)].x - output[centroidIdx].x), 0.02); + EXPECT_LE (std::abs (output[neighbors.at (0)].y - output[centroidIdx].y), 0.02); + EXPECT_LE ( output[neighbors.at (0)].z - output[centroidIdx].z, 0.02 * 2); // Test the pcl::PCLPointCloud2 method VoxelGrid grid2; @@ -666,13 +666,13 @@ TEST (VoxelGrid, Filters) EXPECT_EQ (int (output.height), 1); EXPECT_EQ (bool (output.is_dense), true); - EXPECT_NEAR (output.points[0].x, -0.026125, 1e-4); - EXPECT_NEAR (output.points[0].y, 0.039788, 1e-4); - EXPECT_NEAR (output.points[0].z, 0.052827, 1e-4); + EXPECT_NEAR (output[0].x, -0.026125, 1e-4); + EXPECT_NEAR (output[0].y, 0.039788, 1e-4); + EXPECT_NEAR (output[0].z, 0.052827, 1e-4); - EXPECT_NEAR (output.points[13].x, -0.073202, 1e-4); - EXPECT_NEAR (output.points[13].y, 0.1296, 1e-4); - EXPECT_NEAR (output.points[13].z, 0.051333, 1e-4); + EXPECT_NEAR (output[13].x, -0.073202, 1e-4); + EXPECT_NEAR (output[13].y, 0.1296, 1e-4); + EXPECT_NEAR (output[13].z, 0.051333, 1e-4); grid2.setFilterLimitsNegative (true); grid2.setSaveLeafLayout(true); @@ -685,17 +685,17 @@ TEST (VoxelGrid, Filters) EXPECT_EQ (int (output.height), 1); EXPECT_EQ (bool (output.is_dense), true); - //EXPECT_NEAR (output.points[0].x, -0.070192, 1e-4); - //EXPECT_NEAR (output.points[0].y, 0.17653, 1e-4); - //EXPECT_NEAR (output.points[0].z, -0.048774, 1e-4); + //EXPECT_NEAR (output[0].x, -0.070192, 1e-4); + //EXPECT_NEAR (output[0].y, 0.17653, 1e-4); + //EXPECT_NEAR (output[0].z, -0.048774, 1e-4); - //EXPECT_NEAR (output.points[99].x, -0.068948, 1e-4); - //EXPECT_NEAR (output.points[99].y, 0.1447, 1e-4); - //EXPECT_NEAR (output.points[99].z, 0.042178, 1e-4); + //EXPECT_NEAR (output[99].x, -0.068948, 1e-4); + //EXPECT_NEAR (output[99].y, 0.1447, 1e-4); + //EXPECT_NEAR (output[99].z, 0.042178, 1e-4); // centroids should be identified correctly - EXPECT_EQ (grid2.getCentroidIndex (output.points[0].x, output.points[0].y, output.points[0].z), 0); - EXPECT_EQ (grid2.getCentroidIndex (output.points[99].x, output.points[99].y, output.points[99].z), 99); + EXPECT_EQ (grid2.getCentroidIndex (output[0].x, output[0].y, output[0].z), 0); + EXPECT_EQ (grid2.getCentroidIndex (output[99].x, output[99].y, output[99].z), 99); EXPECT_EQ (grid2.getCentroidIndexAt (grid2.getGridCoordinates (-1,-1,-1)), -1); //PCL_ERROR ("IGNORE PREVIOUS ERROR: testing it's functionality!\n"); @@ -704,22 +704,22 @@ TEST (VoxelGrid, Filters) EXPECT_NE (centroidIdx2, -1); // for arbitrary points, the centroid should be close - EXPECT_LE (std::abs (output.points[centroidIdx2].x - 0.048722), 0.02); - EXPECT_LE (std::abs (output.points[centroidIdx2].y - 0.073760), 0.02); - EXPECT_LE (std::abs (output.points[centroidIdx2].z - 0.017434), 0.02); + EXPECT_LE (std::abs (output[centroidIdx2].x - 0.048722), 0.02); + EXPECT_LE (std::abs (output[centroidIdx2].y - 0.073760), 0.02); + EXPECT_LE (std::abs (output[centroidIdx2].z - 0.017434), 0.02); // if getNeighborCentroidIndices works then the other helper functions work as well - EXPECT_EQ (grid2.getNeighborCentroidIndices (output.points[0].x, output.points[0].y, output.points[0].z, Eigen::MatrixXi::Zero(3,1))[0], 0); - EXPECT_EQ (grid2.getNeighborCentroidIndices (output.points[99].x, output.points[99].y, output.points[99].z, Eigen::MatrixXi::Zero(3,1))[0], 99); + EXPECT_EQ (grid2.getNeighborCentroidIndices (output[0].x, output[0].y, output[0].z, Eigen::MatrixXi::Zero(3,1))[0], 0); + EXPECT_EQ (grid2.getNeighborCentroidIndices (output[99].x, output[99].y, output[99].z, Eigen::MatrixXi::Zero(3,1))[0], 99); // neighboring centroid should be in the right position Eigen::MatrixXi directions2 = Eigen::Vector3i (0, 0, 1); std::vector neighbors2 = grid2.getNeighborCentroidIndices (0.048722f, 0.073760f, 0.017434f, directions2); EXPECT_EQ (neighbors2.size (), std::size_t (directions2.cols ())); EXPECT_NE (neighbors2.at (0), -1); - EXPECT_LE (std::abs (output.points[neighbors2.at (0)].x - output.points[centroidIdx2].x), 0.02); - EXPECT_LE (std::abs (output.points[neighbors2.at (0)].y - output.points[centroidIdx2].y), 0.02); - EXPECT_LE (output.points[neighbors2.at (0)].z - output.points[centroidIdx2].z, 0.02 * 2); + EXPECT_LE (std::abs (output[neighbors2.at (0)].x - output[centroidIdx2].x), 0.02); + EXPECT_LE (std::abs (output[neighbors2.at (0)].y - output[centroidIdx2].y), 0.02); + EXPECT_LE (output[neighbors2.at (0)].z - output[centroidIdx2].z, 0.02 * 2); } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -748,13 +748,13 @@ TEST (VoxelGrid_No_DownsampleAllData, Filters) EXPECT_EQ (int (output.height), 1); EXPECT_EQ (bool (output.is_dense), true); - EXPECT_NEAR (output.points[0].x, -0.026125, 1e-4); - EXPECT_NEAR (output.points[0].y, 0.039788, 1e-4); - EXPECT_NEAR (output.points[0].z, 0.052827, 1e-4); + EXPECT_NEAR (output[0].x, -0.026125, 1e-4); + EXPECT_NEAR (output[0].y, 0.039788, 1e-4); + EXPECT_NEAR (output[0].z, 0.052827, 1e-4); - EXPECT_NEAR (output.points[13].x, -0.073202, 1e-4); - EXPECT_NEAR (output.points[13].y, 0.1296, 1e-4); - EXPECT_NEAR (output.points[13].z, 0.051333, 1e-4); + EXPECT_NEAR (output[13].x, -0.073202, 1e-4); + EXPECT_NEAR (output[13].y, 0.1296, 1e-4); + EXPECT_NEAR (output[13].z, 0.051333, 1e-4); grid.setFilterLimitsNegative (true); grid.setSaveLeafLayout(true); @@ -766,8 +766,8 @@ TEST (VoxelGrid_No_DownsampleAllData, Filters) EXPECT_EQ (bool (output.is_dense), true); // centroids should be identified correctly - EXPECT_EQ (grid.getCentroidIndex (output.points[0]), 0); - EXPECT_EQ (grid.getCentroidIndex (output.points[99]), 99); + EXPECT_EQ (grid.getCentroidIndex (output[0]), 0); + EXPECT_EQ (grid.getCentroidIndex (output[99]), 99); EXPECT_EQ (grid.getCentroidIndexAt (grid.getGridCoordinates (-1,-1,-1)), -1); //PCL_ERROR ("IGNORE PREVIOUS ERROR: testing it's functionality!\n"); @@ -775,22 +775,22 @@ TEST (VoxelGrid_No_DownsampleAllData, Filters) int centroidIdx = grid.getCentroidIndex (cloud->points[195]); // for arbitrary points, the centroid should be close - EXPECT_LE (std::abs (output.points[centroidIdx].x - cloud->points[195].x), 0.02); - EXPECT_LE (std::abs (output.points[centroidIdx].y - cloud->points[195].y), 0.02); - EXPECT_LE (std::abs (output.points[centroidIdx].z - cloud->points[195].z), 0.02); + EXPECT_LE (std::abs (output[centroidIdx].x - cloud->points[195].x), 0.02); + EXPECT_LE (std::abs (output[centroidIdx].y - cloud->points[195].y), 0.02); + EXPECT_LE (std::abs (output[centroidIdx].z - cloud->points[195].z), 0.02); // if getNeighborCentroidIndices works then the other helper functions work as well - EXPECT_EQ (grid.getNeighborCentroidIndices (output.points[0], Eigen::MatrixXi::Zero(3,1))[0], 0); - EXPECT_EQ (grid.getNeighborCentroidIndices (output.points[99], Eigen::MatrixXi::Zero(3,1))[0], 99); + EXPECT_EQ (grid.getNeighborCentroidIndices (output[0], Eigen::MatrixXi::Zero(3,1))[0], 0); + EXPECT_EQ (grid.getNeighborCentroidIndices (output[99], Eigen::MatrixXi::Zero(3,1))[0], 99); // neighboring centroid should be in the right position Eigen::MatrixXi directions = Eigen::Vector3i (0, 0, 1); std::vector neighbors = grid.getNeighborCentroidIndices (cloud->points[195], directions); EXPECT_EQ (neighbors.size (), std::size_t (directions.cols ())); EXPECT_NE (neighbors.at (0), -1); - EXPECT_LE (std::abs (output.points[neighbors.at (0)].x - output.points[centroidIdx].x), 0.02); - EXPECT_LE (std::abs (output.points[neighbors.at (0)].y - output.points[centroidIdx].y), 0.02); - EXPECT_LE ( output.points[neighbors.at (0)].z - output.points[centroidIdx].z, 0.02 * 2); + EXPECT_LE (std::abs (output[neighbors.at (0)].x - output[centroidIdx].x), 0.02); + EXPECT_LE (std::abs (output[neighbors.at (0)].y - output[centroidIdx].y), 0.02); + EXPECT_LE ( output[neighbors.at (0)].z - output[centroidIdx].z, 0.02 * 2); // Test the pcl::PCLPointCloud2 method VoxelGrid grid2; @@ -820,13 +820,13 @@ TEST (VoxelGrid_No_DownsampleAllData, Filters) EXPECT_EQ (int (output.height), 1); EXPECT_EQ (bool (output.is_dense), true); - EXPECT_NEAR (output.points[0].x, -0.026125, 1e-4); - EXPECT_NEAR (output.points[0].y, 0.039788, 1e-4); - EXPECT_NEAR (output.points[0].z, 0.052827, 1e-4); + EXPECT_NEAR (output[0].x, -0.026125, 1e-4); + EXPECT_NEAR (output[0].y, 0.039788, 1e-4); + EXPECT_NEAR (output[0].z, 0.052827, 1e-4); - EXPECT_NEAR (output.points[13].x, -0.073202, 1e-4); - EXPECT_NEAR (output.points[13].y, 0.1296, 1e-4); - EXPECT_NEAR (output.points[13].z, 0.051333, 1e-4); + EXPECT_NEAR (output[13].x, -0.073202, 1e-4); + EXPECT_NEAR (output[13].y, 0.1296, 1e-4); + EXPECT_NEAR (output[13].z, 0.051333, 1e-4); grid2.setFilterLimitsNegative (true); grid2.setSaveLeafLayout(true); @@ -840,8 +840,8 @@ TEST (VoxelGrid_No_DownsampleAllData, Filters) EXPECT_EQ (bool (output.is_dense), true); // centroids should be identified correctly - EXPECT_EQ (grid2.getCentroidIndex (output.points[0].x, output.points[0].y, output.points[0].z), 0); - EXPECT_EQ (grid2.getCentroidIndex (output.points[99].x, output.points[99].y, output.points[99].z), 99); + EXPECT_EQ (grid2.getCentroidIndex (output[0].x, output[0].y, output[0].z), 0); + EXPECT_EQ (grid2.getCentroidIndex (output[99].x, output[99].y, output[99].z), 99); EXPECT_EQ (grid2.getCentroidIndexAt (grid2.getGridCoordinates (-1,-1,-1)), -1); //PCL_ERROR ("IGNORE PREVIOUS ERROR: testing it's functionality!\n"); @@ -850,22 +850,22 @@ TEST (VoxelGrid_No_DownsampleAllData, Filters) EXPECT_NE (centroidIdx2, -1); // for arbitrary points, the centroid should be close - EXPECT_LE (std::abs (output.points[centroidIdx2].x - 0.048722), 0.02); - EXPECT_LE (std::abs (output.points[centroidIdx2].y - 0.073760), 0.02); - EXPECT_LE (std::abs (output.points[centroidIdx2].z - 0.017434), 0.02); + EXPECT_LE (std::abs (output[centroidIdx2].x - 0.048722), 0.02); + EXPECT_LE (std::abs (output[centroidIdx2].y - 0.073760), 0.02); + EXPECT_LE (std::abs (output[centroidIdx2].z - 0.017434), 0.02); // if getNeighborCentroidIndices works then the other helper functions work as well - EXPECT_EQ (grid2.getNeighborCentroidIndices (output.points[0].x, output.points[0].y, output.points[0].z, Eigen::MatrixXi::Zero(3,1))[0], 0); - EXPECT_EQ (grid2.getNeighborCentroidIndices (output.points[99].x, output.points[99].y, output.points[99].z, Eigen::MatrixXi::Zero(3,1))[0], 99); + EXPECT_EQ (grid2.getNeighborCentroidIndices (output[0].x, output[0].y, output[0].z, Eigen::MatrixXi::Zero(3,1))[0], 0); + EXPECT_EQ (grid2.getNeighborCentroidIndices (output[99].x, output[99].y, output[99].z, Eigen::MatrixXi::Zero(3,1))[0], 99); // neighboring centroid should be in the right position Eigen::MatrixXi directions2 = Eigen::Vector3i (0, 0, 1); std::vector neighbors2 = grid2.getNeighborCentroidIndices (0.048722f, 0.073760f, 0.017434f, directions2); EXPECT_EQ (neighbors2.size (), std::size_t (directions2.cols ())); EXPECT_NE (neighbors2.at (0), -1); - EXPECT_LE (std::abs (output.points[neighbors2.at (0)].x - output.points[centroidIdx2].x), 0.02); - EXPECT_LE (std::abs (output.points[neighbors2.at (0)].y - output.points[centroidIdx2].y), 0.02); - EXPECT_LE (output.points[neighbors2.at (0)].z - output.points[centroidIdx2].z, 0.02 * 2); + EXPECT_LE (std::abs (output[neighbors2.at (0)].x - output[centroidIdx2].x), 0.02); + EXPECT_LE (std::abs (output[neighbors2.at (0)].y - output[centroidIdx2].y), 0.02); + EXPECT_LE (output[neighbors2.at (0)].z - output[centroidIdx2].z, 0.02 * 2); } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -919,11 +919,11 @@ TEST (VoxelGrid_RGB, Filters) { int rgb; int r,g,b; - memcpy (&rgb, &(output_rgb.points[0].rgb), sizeof(int)); + memcpy (&rgb, &(output_rgb[0].rgb), sizeof(int)); r = (rgb >> 16) & 0xFF; g = (rgb >> 8 ) & 0xFF; b = (rgb >> 0 ) & 0xFF; - EXPECT_NEAR (output_rgb.points[0].x, 0.0, 1e-4); - EXPECT_NEAR (output_rgb.points[0].y, 0.0, 1e-4); - EXPECT_NEAR (output_rgb.points[0].z, 0.0, 1e-4); + EXPECT_NEAR (output_rgb[0].x, 0.0, 1e-4); + EXPECT_NEAR (output_rgb[0].y, 0.0, 1e-4); + EXPECT_NEAR (output_rgb[0].z, 0.0, 1e-4); EXPECT_NEAR (r, ave_r, 1.0); EXPECT_NEAR (g, ave_g, 1.0); EXPECT_NEAR (b, ave_b, 1.0); @@ -945,11 +945,11 @@ TEST (VoxelGrid_RGB, Filters) { int rgb; int r,g,b; - memcpy (&rgb, &(output_rgb.points[0].rgb), sizeof(int)); + memcpy (&rgb, &(output_rgb[0].rgb), sizeof(int)); r = (rgb >> 16) & 0xFF; g = (rgb >> 8 ) & 0xFF; b = (rgb >> 0 ) & 0xFF; - EXPECT_NEAR (output_rgb.points[0].x, 0.0, 1e-4); - EXPECT_NEAR (output_rgb.points[0].y, 0.0, 1e-4); - EXPECT_NEAR (output_rgb.points[0].z, 0.0, 1e-4); + EXPECT_NEAR (output_rgb[0].x, 0.0, 1e-4); + EXPECT_NEAR (output_rgb[0].y, 0.0, 1e-4); + EXPECT_NEAR (output_rgb[0].z, 0.0, 1e-4); EXPECT_NEAR (r, ave_r, 1.0); EXPECT_NEAR (g, ave_g, 1.0); EXPECT_NEAR (b, ave_b, 1.0); @@ -1013,11 +1013,11 @@ TEST (VoxelGrid_RGBA, Filters) { int rgba; int r,g,b,a; - memcpy (&rgba, &(output_rgba.points[0].rgba), sizeof(int)); + memcpy (&rgba, &(output_rgba[0].rgba), sizeof(int)); a = (rgba >> 24) & 0xFF; r = (rgba >> 16) & 0xFF; g = (rgba >> 8 ) & 0xFF; b = (rgba >> 0 ) & 0xFF; - EXPECT_NEAR (output_rgba.points[0].x, 0.0, 1e-4); - EXPECT_NEAR (output_rgba.points[0].y, 0.0, 1e-4); - EXPECT_NEAR (output_rgba.points[0].z, 0.0, 1e-4); + EXPECT_NEAR (output_rgba[0].x, 0.0, 1e-4); + EXPECT_NEAR (output_rgba[0].y, 0.0, 1e-4); + EXPECT_NEAR (output_rgba[0].z, 0.0, 1e-4); EXPECT_NEAR (r, ave_r, 1.0); EXPECT_NEAR (g, ave_g, 1.0); EXPECT_NEAR (b, ave_b, 1.0); @@ -1040,11 +1040,11 @@ TEST (VoxelGrid_RGBA, Filters) { int rgba; int r,g,b,a; - memcpy (&rgba, &(output_rgba.points[0].rgba), sizeof(int)); + memcpy (&rgba, &(output_rgba[0].rgba), sizeof(int)); a = (rgba >> 24) & 0xFF; r = (rgba >> 16) & 0xFF; g = (rgba >> 8 ) & 0xFF; b = (rgba >> 0 ) & 0xFF; - EXPECT_NEAR (output_rgba.points[0].x, 0.0, 1e-4); - EXPECT_NEAR (output_rgba.points[0].y, 0.0, 1e-4); - EXPECT_NEAR (output_rgba.points[0].z, 0.0, 1e-4); + EXPECT_NEAR (output_rgba[0].x, 0.0, 1e-4); + EXPECT_NEAR (output_rgba[0].y, 0.0, 1e-4); + EXPECT_NEAR (output_rgba[0].z, 0.0, 1e-4); EXPECT_NEAR (r, ave_r, 1.0); EXPECT_NEAR (g, ave_g, 1.0); EXPECT_NEAR (b, ave_b, 1.0); @@ -1260,20 +1260,20 @@ TEST (VoxelGridCovariance, Filters) EXPECT_EQ (int (output.height), 1); EXPECT_EQ (bool (output.is_dense), true); - EXPECT_NEAR (output.points[0].x, -0.073619894683361053, 1e-4); - EXPECT_NEAR (output.points[0].y, 0.16789889335632324, 1e-4); - EXPECT_NEAR (output.points[0].z, -0.03018110990524292, 1e-4); + EXPECT_NEAR (output[0].x, -0.073619894683361053, 1e-4); + EXPECT_NEAR (output[0].y, 0.16789889335632324, 1e-4); + EXPECT_NEAR (output[0].z, -0.03018110990524292, 1e-4); - EXPECT_NEAR (output.points[13].x, -0.06865914911031723, 1e-4); - EXPECT_NEAR (output.points[13].y, 0.15243285894393921, 1e-4); - EXPECT_NEAR (output.points[13].z, 0.03266800194978714, 1e-4); + EXPECT_NEAR (output[13].x, -0.06865914911031723, 1e-4); + EXPECT_NEAR (output[13].y, 0.15243285894393921, 1e-4); + EXPECT_NEAR (output[13].z, 0.03266800194978714, 1e-4); grid.setSaveLeafLayout (true); grid.filter (output); // centroids should be identified correctly - EXPECT_EQ (grid.getCentroidIndex (output.points[0]), 0); - EXPECT_EQ (grid.getCentroidIndex (output.points[17]), 17); + EXPECT_EQ (grid.getCentroidIndex (output[0]), 0); + EXPECT_EQ (grid.getCentroidIndex (output[17]), 17); EXPECT_EQ (grid.getCentroidIndexAt (grid.getGridCoordinates (-1,-1,-1)), -1); //PCL_ERROR ("IGNORE PREVIOUS ERROR: testing it's functionality!\n"); @@ -1282,17 +1282,17 @@ TEST (VoxelGridCovariance, Filters) EXPECT_NE (centroidIdx, -1); // if getNeighborCentroidIndices works then the other helper functions work as well - EXPECT_EQ (grid.getNeighborCentroidIndices (output.points[0], Eigen::MatrixXi::Zero(3,1))[0], 0); - EXPECT_EQ (grid.getNeighborCentroidIndices (output.points[17], Eigen::MatrixXi::Zero(3,1))[0], 17); + EXPECT_EQ (grid.getNeighborCentroidIndices (output[0], Eigen::MatrixXi::Zero(3,1))[0], 0); + EXPECT_EQ (grid.getNeighborCentroidIndices (output[17], Eigen::MatrixXi::Zero(3,1))[0], 17); // neighboring centroid should be in the right position Eigen::MatrixXi directions = Eigen::Vector3i (0, 1, 0); std::vector neighbors = grid.getNeighborCentroidIndices (cloud->points[38], directions); EXPECT_EQ (neighbors.size (), std::size_t (directions.cols ())); EXPECT_NE (neighbors.at (0), -1); - EXPECT_LE (std::abs (output.points[neighbors.at (0)].x - output.points[centroidIdx].x), 0.02); - EXPECT_LE (std::abs (output.points[neighbors.at (0)].y - output.points[centroidIdx].y), 0.02); - EXPECT_LE (output.points[neighbors.at (0)].z - output.points[centroidIdx].z, 0.02 * 2); + EXPECT_LE (std::abs (output[neighbors.at (0)].x - output[centroidIdx].x), 0.02); + EXPECT_LE (std::abs (output[neighbors.at (0)].y - output[centroidIdx].y), 0.02); + EXPECT_LE (output[neighbors.at (0)].z - output[centroidIdx].z, 0.02 * 2); // testing search functions grid.setSaveLeafLayout (false); @@ -1379,9 +1379,9 @@ TEST (RadiusOutlierRemoval, Filters) EXPECT_EQ (int (cloud_out.points.size ()), 307); EXPECT_EQ (int (cloud_out.width), 307); EXPECT_EQ (bool (cloud_out.is_dense), true); - EXPECT_NEAR (cloud_out.points[cloud_out.points.size () - 1].x, -0.077893, 1e-4); - EXPECT_NEAR (cloud_out.points[cloud_out.points.size () - 1].y, 0.16039, 1e-4); - EXPECT_NEAR (cloud_out.points[cloud_out.points.size () - 1].z, -0.021299, 1e-4); + EXPECT_NEAR (cloud_out[cloud_out.points.size () - 1].x, -0.077893, 1e-4); + EXPECT_NEAR (cloud_out[cloud_out.points.size () - 1].y, 0.16039, 1e-4); + EXPECT_NEAR (cloud_out[cloud_out.points.size () - 1].z, -0.021299, 1e-4); // Test the pcl::PCLPointCloud2 method PCLPointCloud2 cloud_out2; @@ -1395,9 +1395,9 @@ TEST (RadiusOutlierRemoval, Filters) EXPECT_EQ (int (cloud_out.points.size ()), 307); EXPECT_EQ (int (cloud_out.width), 307); EXPECT_EQ (bool (cloud_out.is_dense), true); - EXPECT_NEAR (cloud_out.points[cloud_out.points.size () - 1].x, -0.077893, 1e-4); - EXPECT_NEAR (cloud_out.points[cloud_out.points.size () - 1].y, 0.16039, 1e-4); - EXPECT_NEAR (cloud_out.points[cloud_out.points.size () - 1].z, -0.021299, 1e-4); + EXPECT_NEAR (cloud_out[cloud_out.points.size () - 1].x, -0.077893, 1e-4); + EXPECT_NEAR (cloud_out[cloud_out.points.size () - 1].y, 0.16039, 1e-4); + EXPECT_NEAR (cloud_out[cloud_out.points.size () - 1].z, -0.021299, 1e-4); // Remove outliers using a spherical density criterion RadiusOutlierRemoval outrem_(true); @@ -1411,9 +1411,9 @@ TEST (RadiusOutlierRemoval, Filters) EXPECT_EQ (bool (cloud_out.is_dense), true); EXPECT_EQ (int (cloud_out.points.size ()), cloud->points.size ()-outrem_.getRemovedIndices()->size()); - EXPECT_NEAR (cloud_out.points[cloud_out.points.size () - 1].x, -0.077893, 1e-4); - EXPECT_NEAR (cloud_out.points[cloud_out.points.size () - 1].y, 0.16039, 1e-4); - EXPECT_NEAR (cloud_out.points[cloud_out.points.size () - 1].z, -0.021299, 1e-4); + EXPECT_NEAR (cloud_out[cloud_out.points.size () - 1].x, -0.077893, 1e-4); + EXPECT_NEAR (cloud_out[cloud_out.points.size () - 1].y, 0.16039, 1e-4); + EXPECT_NEAR (cloud_out[cloud_out.points.size () - 1].z, -0.021299, 1e-4); // Test the pcl::PCLPointCloud2 method RadiusOutlierRemoval outrem2_(true); @@ -1428,9 +1428,9 @@ TEST (RadiusOutlierRemoval, Filters) EXPECT_EQ (bool (cloud_out.is_dense), true); EXPECT_EQ (int (cloud_out.points.size ()), cloud_blob->width*cloud_blob->height-outrem2_.getRemovedIndices()->size()); - EXPECT_NEAR (cloud_out.points[cloud_out.points.size () - 1].x, -0.077893, 1e-4); - EXPECT_NEAR (cloud_out.points[cloud_out.points.size () - 1].y, 0.16039, 1e-4); - EXPECT_NEAR (cloud_out.points[cloud_out.points.size () - 1].z, -0.021299, 1e-4); + EXPECT_NEAR (cloud_out[cloud_out.points.size () - 1].x, -0.077893, 1e-4); + EXPECT_NEAR (cloud_out[cloud_out.points.size () - 1].y, 0.16039, 1e-4); + EXPECT_NEAR (cloud_out[cloud_out.points.size () - 1].z, -0.021299, 1e-4); } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -1448,9 +1448,9 @@ TEST (StatisticalOutlierRemoval, Filters) EXPECT_EQ (int (output.points.size ()), 352); EXPECT_EQ (int (output.width), 352); EXPECT_EQ (bool (output.is_dense), true); - EXPECT_NEAR (output.points[output.points.size () - 1].x, -0.034667, 1e-4); - EXPECT_NEAR (output.points[output.points.size () - 1].y, 0.15131, 1e-4); - EXPECT_NEAR (output.points[output.points.size () - 1].z, -0.00071029, 1e-4); + EXPECT_NEAR (output[output.points.size () - 1].x, -0.034667, 1e-4); + EXPECT_NEAR (output[output.points.size () - 1].y, 0.15131, 1e-4); + EXPECT_NEAR (output[output.points.size () - 1].z, -0.00071029, 1e-4); outrem.setNegative (true); outrem.filter (output); @@ -1458,9 +1458,9 @@ TEST (StatisticalOutlierRemoval, Filters) EXPECT_EQ (int (output.points.size ()), int (cloud->points.size ()) - 352); EXPECT_EQ (int (output.width), int (cloud->width) - 352); EXPECT_EQ (bool (output.is_dense), true); - EXPECT_NEAR (output.points[output.points.size () - 1].x, -0.07793, 1e-4); - EXPECT_NEAR (output.points[output.points.size () - 1].y, 0.17516, 1e-4); - EXPECT_NEAR (output.points[output.points.size () - 1].z, -0.0444, 1e-4); + EXPECT_NEAR (output[output.points.size () - 1].x, -0.07793, 1e-4); + EXPECT_NEAR (output[output.points.size () - 1].y, 0.17516, 1e-4); + EXPECT_NEAR (output[output.points.size () - 1].z, -0.0444, 1e-4); // Test the pcl::PCLPointCloud2 method PCLPointCloud2 output2; @@ -1475,9 +1475,9 @@ TEST (StatisticalOutlierRemoval, Filters) EXPECT_EQ (int (output.points.size ()), 352); EXPECT_EQ (int (output.width), 352); EXPECT_EQ (bool (output.is_dense), true); - EXPECT_NEAR (output.points[output.points.size () - 1].x, -0.034667, 1e-4); - EXPECT_NEAR (output.points[output.points.size () - 1].y, 0.15131, 1e-4); - EXPECT_NEAR (output.points[output.points.size () - 1].z, -0.00071029, 1e-4); + EXPECT_NEAR (output[output.points.size () - 1].x, -0.034667, 1e-4); + EXPECT_NEAR (output[output.points.size () - 1].y, 0.15131, 1e-4); + EXPECT_NEAR (output[output.points.size () - 1].z, -0.00071029, 1e-4); outrem2.setNegative (true); outrem2.filter (output2); @@ -1487,9 +1487,9 @@ TEST (StatisticalOutlierRemoval, Filters) EXPECT_EQ (int (output.points.size ()), int (cloud->points.size ()) - 352); EXPECT_EQ (int (output.width), int (cloud->width) - 352); EXPECT_EQ (bool (output.is_dense), true); - EXPECT_NEAR (output.points[output.points.size () - 1].x, -0.07793, 1e-4); - EXPECT_NEAR (output.points[output.points.size () - 1].y, 0.17516, 1e-4); - EXPECT_NEAR (output.points[output.points.size () - 1].z, -0.0444, 1e-4); + EXPECT_NEAR (output[output.points.size () - 1].x, -0.07793, 1e-4); + EXPECT_NEAR (output[output.points.size () - 1].y, 0.17516, 1e-4); + EXPECT_NEAR (output[output.points.size () - 1].z, -0.0444, 1e-4); // Remove outliers using a spherical density criterion StatisticalOutlierRemoval outrem_(true); @@ -1502,9 +1502,9 @@ TEST (StatisticalOutlierRemoval, Filters) EXPECT_EQ (int (output.width), 352); EXPECT_EQ (bool (output.is_dense), true); EXPECT_EQ (int (output.points.size ()), cloud->points.size ()-outrem_.getRemovedIndices()->size()); - EXPECT_NEAR (output.points[output.points.size () - 1].x, -0.034667, 1e-4); - EXPECT_NEAR (output.points[output.points.size () - 1].y, 0.15131, 1e-4); - EXPECT_NEAR (output.points[output.points.size () - 1].z, -0.00071029, 1e-4); + EXPECT_NEAR (output[output.points.size () - 1].x, -0.034667, 1e-4); + EXPECT_NEAR (output[output.points.size () - 1].y, 0.15131, 1e-4); + EXPECT_NEAR (output[output.points.size () - 1].z, -0.00071029, 1e-4); outrem_.setNegative (true); outrem_.filter (output); @@ -1513,9 +1513,9 @@ TEST (StatisticalOutlierRemoval, Filters) EXPECT_EQ (int (output.width), int (cloud->width) - 352); EXPECT_EQ (bool (output.is_dense), true); EXPECT_EQ (int (output.points.size ()) ,cloud->points.size ()-outrem_.getRemovedIndices()->size()); - EXPECT_NEAR (output.points[output.points.size () - 1].x, -0.07793, 1e-4); - EXPECT_NEAR (output.points[output.points.size () - 1].y, 0.17516, 1e-4); - EXPECT_NEAR (output.points[output.points.size () - 1].z, -0.0444, 1e-4); + EXPECT_NEAR (output[output.points.size () - 1].x, -0.07793, 1e-4); + EXPECT_NEAR (output[output.points.size () - 1].y, 0.17516, 1e-4); + EXPECT_NEAR (output[output.points.size () - 1].z, -0.0444, 1e-4); // Test the pcl::PCLPointCloud2 method StatisticalOutlierRemoval outrem2_(true); @@ -1530,9 +1530,9 @@ TEST (StatisticalOutlierRemoval, Filters) EXPECT_EQ (int (output.width), 352); EXPECT_EQ (bool (output.is_dense), true); EXPECT_EQ (int (output.points.size ()), cloud_blob->width*cloud_blob->height-outrem2_.getRemovedIndices()->size()); - EXPECT_NEAR (output.points[output.points.size () - 1].x, -0.034667, 1e-4); - EXPECT_NEAR (output.points[output.points.size () - 1].y, 0.15131, 1e-4); - EXPECT_NEAR (output.points[output.points.size () - 1].z, -0.00071029, 1e-4); + EXPECT_NEAR (output[output.points.size () - 1].x, -0.034667, 1e-4); + EXPECT_NEAR (output[output.points.size () - 1].y, 0.15131, 1e-4); + EXPECT_NEAR (output[output.points.size () - 1].z, -0.00071029, 1e-4); outrem2_.setNegative (true); outrem2_.filter (output2); @@ -1543,9 +1543,9 @@ TEST (StatisticalOutlierRemoval, Filters) EXPECT_EQ (int (output.width), int (cloud->width) - 352); EXPECT_EQ (bool (output.is_dense), true); EXPECT_EQ (int (output.points.size ()), cloud_blob->width*cloud_blob->height-outrem2_.getRemovedIndices()->size()); - EXPECT_NEAR (output.points[output.points.size () - 1].x, -0.07793, 1e-4); - EXPECT_NEAR (output.points[output.points.size () - 1].y, 0.17516, 1e-4); - EXPECT_NEAR (output.points[output.points.size () - 1].z, -0.0444, 1e-4); + EXPECT_NEAR (output[output.points.size () - 1].x, -0.07793, 1e-4); + EXPECT_NEAR (output[output.points.size () - 1].y, 0.17516, 1e-4); + EXPECT_NEAR (output[output.points.size () - 1].z, -0.0444, 1e-4); } ////////////////////////////////////////////////////////////////////////////////////////////// @@ -1580,9 +1580,9 @@ TEST (ConditionalRemoval, Filters) EXPECT_EQ (bool (output.isOrganized ()), false); EXPECT_EQ (int (output.points.size ()), 28); - EXPECT_NEAR (output.points[output.points.size () - 1].x, -0.087292, 1e-4); - EXPECT_NEAR (output.points[output.points.size () - 1].y, 0.103140, 1e-4); - EXPECT_NEAR (output.points[output.points.size () - 1].z, 0.020825, 1e-4); + EXPECT_NEAR (output[output.points.size () - 1].x, -0.087292, 1e-4); + EXPECT_NEAR (output[output.points.size () - 1].y, 0.103140, 1e-4); + EXPECT_NEAR (output[output.points.size () - 1].z, 0.020825, 1e-4); EXPECT_EQ (bool (output.is_dense), true); // try the not dense version @@ -1617,9 +1617,9 @@ TEST (ConditionalRemoval, Filters) EXPECT_EQ (bool (output.isOrganized ()), false); EXPECT_EQ (int (output.points.size ()), 28); EXPECT_EQ (int (output.points.size ()), cloud->points.size()-condrem_.getRemovedIndices()->size()); - EXPECT_NEAR (output.points[output.points.size () - 1].x, -0.087292, 1e-4); - EXPECT_NEAR (output.points[output.points.size () - 1].y, 0.103140, 1e-4); - EXPECT_NEAR (output.points[output.points.size () - 1].z, 0.020825, 1e-4); + EXPECT_NEAR (output[output.points.size () - 1].x, -0.087292, 1e-4); + EXPECT_NEAR (output[output.points.size () - 1].y, 0.103140, 1e-4); + EXPECT_NEAR (output[output.points.size () - 1].z, 0.020825, 1e-4); EXPECT_EQ (bool (output.is_dense), true); // try the not dense version @@ -1674,25 +1674,25 @@ TEST (ConditionalRemovalSetIndices, Filters) EXPECT_EQ (int (output.width), 2); EXPECT_EQ (int (output.height), 1); - EXPECT_EQ (cloud->points[0].x, output.points[0].x); - EXPECT_EQ (cloud->points[0].y, output.points[0].y); - EXPECT_EQ (cloud->points[0].z, output.points[0].z); + EXPECT_EQ (cloud->points[0].x, output[0].x); + EXPECT_EQ (cloud->points[0].y, output[0].y); + EXPECT_EQ (cloud->points[0].z, output[0].z); - EXPECT_EQ (cloud->points[cloud->points.size () - 1].x, output.points[1].x); - EXPECT_EQ (cloud->points[cloud->points.size () - 1].y, output.points[1].y); - EXPECT_EQ (cloud->points[cloud->points.size () - 1].z, output.points[1].z); + EXPECT_EQ (cloud->points[cloud->points.size () - 1].x, output[1].x); + EXPECT_EQ (cloud->points[cloud->points.size () - 1].y, output[1].y); + EXPECT_EQ (cloud->points[cloud->points.size () - 1].z, output[1].z); // try the not dense version condrem2.setKeepOrganized (true); condrem2.filter (output); - EXPECT_EQ (cloud->points[0].x, output.points[0].x); - EXPECT_EQ (cloud->points[0].y, output.points[0].y); - EXPECT_EQ (cloud->points[0].z, output.points[0].z); + EXPECT_EQ (cloud->points[0].x, output[0].x); + EXPECT_EQ (cloud->points[0].y, output[0].y); + EXPECT_EQ (cloud->points[0].z, output[0].z); - EXPECT_EQ (cloud->points[cloud->points.size () - 1].x, output.points[output.points.size () - 1].x); - EXPECT_EQ (cloud->points[cloud->points.size () - 1].y, output.points[output.points.size () - 1].y); - EXPECT_EQ (cloud->points[cloud->points.size () - 1].z, output.points[output.points.size () - 1].z); + EXPECT_EQ (cloud->points[cloud->points.size () - 1].x, output[output.points.size () - 1].x); + EXPECT_EQ (cloud->points[cloud->points.size () - 1].y, output[output.points.size () - 1].y); + EXPECT_EQ (cloud->points[cloud->points.size () - 1].z, output[output.points.size () - 1].z); int num_not_nan = 0; for (const auto &point : output.points) @@ -1722,13 +1722,13 @@ TEST (ConditionalRemovalSetIndices, Filters) EXPECT_EQ (int (output.width), 2); EXPECT_EQ (int (output.height), 1); - EXPECT_EQ (cloud->points[0].x, output.points[0].x); - EXPECT_EQ (cloud->points[0].y, output.points[0].y); - EXPECT_EQ (cloud->points[0].z, output.points[0].z); + EXPECT_EQ (cloud->points[0].x, output[0].x); + EXPECT_EQ (cloud->points[0].y, output[0].y); + EXPECT_EQ (cloud->points[0].z, output[0].z); - EXPECT_EQ (cloud->points[cloud->points.size () - 1].x, output.points[1].x); - EXPECT_EQ (cloud->points[cloud->points.size () - 1].y, output.points[1].y); - EXPECT_EQ (cloud->points[cloud->points.size () - 1].z, output.points[1].z); + EXPECT_EQ (cloud->points[cloud->points.size () - 1].x, output[1].x); + EXPECT_EQ (cloud->points[cloud->points.size () - 1].y, output[1].y); + EXPECT_EQ (cloud->points[cloud->points.size () - 1].z, output[1].z); EXPECT_EQ (int (output.points.size ()), int (indices->size ()) - int (condrem2_.getRemovedIndices ()->size ())); @@ -1736,13 +1736,13 @@ TEST (ConditionalRemovalSetIndices, Filters) condrem2_.setKeepOrganized (true); condrem2_.filter (output); - EXPECT_EQ (cloud->points[0].x, output.points[0].x); - EXPECT_EQ (cloud->points[0].y, output.points[0].y); - EXPECT_EQ (cloud->points[0].z, output.points[0].z); + EXPECT_EQ (cloud->points[0].x, output[0].x); + EXPECT_EQ (cloud->points[0].y, output[0].y); + EXPECT_EQ (cloud->points[0].z, output[0].z); - EXPECT_EQ (cloud->points[cloud->points.size () - 1].x, output.points[output.points.size () - 1].x); - EXPECT_EQ (cloud->points[cloud->points.size () - 1].y, output.points[output.points.size () - 1].y); - EXPECT_EQ (cloud->points[cloud->points.size () - 1].z, output.points[output.points.size () - 1].z); + EXPECT_EQ (cloud->points[cloud->points.size () - 1].x, output[output.points.size () - 1].x); + EXPECT_EQ (cloud->points[cloud->points.size () - 1].y, output[output.points.size () - 1].y); + EXPECT_EQ (cloud->points[cloud->points.size () - 1].z, output[output.points.size () - 1].z); num_not_nan = 0; for (const auto &point : output.points) @@ -1977,13 +1977,13 @@ TEST (ConditionalRemovalTfQuadraticXYZComparison, Filters) EXPECT_EQ (10, int (output.points.size ())); - EXPECT_EQ (input->points[0].x, output.points[0].x); - EXPECT_EQ (input->points[0].y, output.points[0].y); - EXPECT_EQ (input->points[0].z, output.points[0].z); + EXPECT_EQ (input->points[0].x, output[0].x); + EXPECT_EQ (input->points[0].y, output[0].y); + EXPECT_EQ (input->points[0].z, output[0].z); - EXPECT_EQ (input->points[9].x, output.points[9].x); - EXPECT_EQ (input->points[9].y, output.points[9].y); - EXPECT_EQ (input->points[9].z, output.points[9].z); + EXPECT_EQ (input->points[9].x, output[9].x); + EXPECT_EQ (input->points[9].y, output[9].y); + EXPECT_EQ (input->points[9].z, output[9].z); // rotate cylinder comparison along z-axis by PI/2 cyl_comp->transformComparison (getTransformation (0.0f, 0.0f, 0.0f, 0.0f, 0.0f, float (M_PI) / 2.0f).inverse ()); @@ -1992,13 +1992,13 @@ TEST (ConditionalRemovalTfQuadraticXYZComparison, Filters) EXPECT_EQ (4, int (output.points.size ())); - EXPECT_EQ (input->points[0].x, output.points[0].x); - EXPECT_EQ (input->points[0].y, output.points[0].y); - EXPECT_EQ (input->points[0].z, output.points[0].z); + EXPECT_EQ (input->points[0].x, output[0].x); + EXPECT_EQ (input->points[0].y, output[0].y); + EXPECT_EQ (input->points[0].z, output[0].z); - EXPECT_EQ (input->points[3].x, output.points[3].x); - EXPECT_EQ (input->points[3].y, output.points[3].y); - EXPECT_EQ (input->points[3].z, output.points[3].z); + EXPECT_EQ (input->points[3].x, output[3].x); + EXPECT_EQ (input->points[3].y, output[3].y); + EXPECT_EQ (input->points[3].z, output[3].z); // change comparison to a simple plane (x < 5) Eigen::Vector3f planeVector; @@ -2013,13 +2013,13 @@ TEST (ConditionalRemovalTfQuadraticXYZComparison, Filters) EXPECT_EQ (6, int (output.points.size ())); - EXPECT_EQ (input->points[0].x, output.points[0].x); - EXPECT_EQ (input->points[0].y, output.points[0].y); - EXPECT_EQ (input->points[0].z, output.points[0].z); + EXPECT_EQ (input->points[0].x, output[0].x); + EXPECT_EQ (input->points[0].y, output[0].y); + EXPECT_EQ (input->points[0].z, output[0].z); - EXPECT_EQ (input->points[5].x, output.points[5].x); - EXPECT_EQ (input->points[5].y, output.points[5].y); - EXPECT_EQ (input->points[5].z, output.points[5].z); + EXPECT_EQ (input->points[5].x, output[5].x); + EXPECT_EQ (input->points[5].y, output[5].y); + EXPECT_EQ (input->points[5].z, output[5].z); } diff --git a/test/filters/test_sampling.cpp b/test/filters/test_sampling.cpp index 76cb2cfbf95..08ce577a62e 100644 --- a/test/filters/test_sampling.cpp +++ b/test/filters/test_sampling.cpp @@ -172,9 +172,9 @@ TEST (RandomSample, Filters) // Check that indices are sorted EXPECT_LT (indices[i], indices[i+1]); // Compare original points with sampled indices against sampled points - EXPECT_NEAR (cloud_walls->points[indices[i]].x, cloud_out.points[i].x, 1e-4); - EXPECT_NEAR (cloud_walls->points[indices[i]].y, cloud_out.points[i].y, 1e-4); - EXPECT_NEAR (cloud_walls->points[indices[i]].z, cloud_out.points[i].z, 1e-4); + EXPECT_NEAR (cloud_walls->points[indices[i]].x, cloud_out[i].x, 1e-4); + EXPECT_NEAR (cloud_walls->points[indices[i]].y, cloud_out[i].y, 1e-4); + EXPECT_NEAR (cloud_walls->points[indices[i]].z, cloud_out[i].z, 1e-4); } IndicesConstPtr removed = sample.getRemovedIndices (); @@ -238,9 +238,9 @@ TEST (RandomSample, Filters) // Check that indices are sorted EXPECT_LT (indices2[i], indices2[i+1]); // Compare original points with sampled indices against sampled points - EXPECT_NEAR (cloud_walls->points[indices2[i]].x, cloud_out.points[i].x, 1e-4); - EXPECT_NEAR (cloud_walls->points[indices2[i]].y, cloud_out.points[i].y, 1e-4); - EXPECT_NEAR (cloud_walls->points[indices2[i]].z, cloud_out.points[i].z, 1e-4); + EXPECT_NEAR (cloud_walls->points[indices2[i]].x, cloud_out[i].x, 1e-4); + EXPECT_NEAR (cloud_walls->points[indices2[i]].y, cloud_out[i].y, 1e-4); + EXPECT_NEAR (cloud_walls->points[indices2[i]].z, cloud_out[i].z, 1e-4); } } diff --git a/test/io/test_io.cpp b/test/io/test_io.cpp index d1cb5c652f1..0430ff08e3f 100644 --- a/test/io/test_io.cpp +++ b/test/io/test_io.cpp @@ -297,15 +297,15 @@ TEST (PCL, ConcatenatePoints) for (std::size_t i = 0; i < cloud_a.points.size (); ++i) { - EXPECT_FLOAT_EQ (cloud_c.points[i].x, cloud_a.points[i].x); - EXPECT_FLOAT_EQ (cloud_c.points[i].y, cloud_a.points[i].y); - EXPECT_FLOAT_EQ (cloud_c.points[i].z, cloud_a.points[i].z); + EXPECT_FLOAT_EQ (cloud_c[i].x, cloud_a[i].x); + EXPECT_FLOAT_EQ (cloud_c[i].y, cloud_a[i].y); + EXPECT_FLOAT_EQ (cloud_c[i].z, cloud_a[i].z); } for (std::size_t i = cloud_a.points.size (); i < cloud_c.points.size (); ++i) { - EXPECT_FLOAT_EQ (cloud_c.points[i].x, cloud_b.points[i - cloud_a.points.size ()].x); - EXPECT_FLOAT_EQ (cloud_c.points[i].y, cloud_b.points[i - cloud_a.points.size ()].y); - EXPECT_FLOAT_EQ (cloud_c.points[i].z, cloud_b.points[i - cloud_a.points.size ()].z); + EXPECT_FLOAT_EQ (cloud_c[i].x, cloud_b[i - cloud_a.points.size ()].x); + EXPECT_FLOAT_EQ (cloud_c[i].y, cloud_b[i - cloud_a.points.size ()].y); + EXPECT_FLOAT_EQ (cloud_c[i].z, cloud_b[i - cloud_a.points.size ()].z); } } @@ -343,12 +343,12 @@ TEST (PCL, ConcatenateFields) for (std::size_t i = 0; i < cloud_a.points.size (); ++i) { - EXPECT_FLOAT_EQ (cloud_c.points[i].x, cloud_a.points[i].x); - EXPECT_FLOAT_EQ (cloud_c.points[i].y, cloud_a.points[i].y); - EXPECT_FLOAT_EQ (cloud_c.points[i].z, cloud_a.points[i].z); - EXPECT_FLOAT_EQ (cloud_c.points[i].normal[0], cloud_b.points[i].normal[0]); - EXPECT_FLOAT_EQ (cloud_c.points[i].normal[1], cloud_b.points[i].normal[1]); - EXPECT_FLOAT_EQ (cloud_c.points[i].normal[2], cloud_b.points[i].normal[2]); + EXPECT_FLOAT_EQ (cloud_c[i].x, cloud_a[i].x); + EXPECT_FLOAT_EQ (cloud_c[i].y, cloud_a[i].y); + EXPECT_FLOAT_EQ (cloud_c[i].z, cloud_a[i].z); + EXPECT_FLOAT_EQ (cloud_c[i].normal[0], cloud_b[i].normal[0]); + EXPECT_FLOAT_EQ (cloud_c[i].normal[1], cloud_b[i].normal[1]); + EXPECT_FLOAT_EQ (cloud_c[i].normal[2], cloud_b[i].normal[2]); } } @@ -371,11 +371,11 @@ TEST (PCL, IO) cloud[i].x = static_cast (1024 * rand () / (RAND_MAX + 1.0)); cloud[i].y = static_cast (1024 * rand () / (RAND_MAX + 1.0)); cloud[i].z = static_cast (1024 * rand () / (RAND_MAX + 1.0)); - cloud.points[i].intensity = static_cast (i); + cloud[i].intensity = static_cast (i); } PointXYZI first, last; - first.x = cloud.points[0].x; first.y = cloud.points[0].y; first.z = cloud.points[0].z; first.intensity = cloud.points[0].intensity; - last.x = cloud.points[nr_p - 1].x; last.y = cloud.points[nr_p - 1].y; last.z = cloud.points[nr_p - 1].z; last.intensity = cloud.points[nr_p - 1].intensity; + first.x = cloud[0].x; first.y = cloud[0].y; first.z = cloud[0].z; first.intensity = cloud[0].intensity; + last.x = cloud[nr_p - 1].x; last.y = cloud[nr_p - 1].y; last.z = cloud[nr_p - 1].z; last.intensity = cloud[nr_p - 1].intensity; // Tests for PointCloud::operator() EXPECT_FLOAT_EQ (first.x, cloud (0, 0).x); @@ -450,7 +450,7 @@ TEST (PCL, IO) fromPCLPointCloud2 (cloud_blob, cloud); for (std::size_t i = 0; i < nr_p; ++i) - EXPECT_EQ (cloud.points[i].intensity, i); + EXPECT_EQ (cloud[i].intensity, i); EXPECT_EQ (std::uint32_t (cloud_blob.width), cloud.width); // test for toPCLPointCloud2 () EXPECT_EQ (std::uint32_t (cloud_blob.height), cloud.height); // test for toPCLPointCloud2 () @@ -482,15 +482,15 @@ TEST (PCL, IO) EXPECT_EQ (int (cloud.is_dense), cloud_blob.is_dense); // test for fromPCLPointCloud2 () EXPECT_EQ (std::size_t (cloud.points.size ()), nr_p); // test for fromPCLPointCloud2 () - EXPECT_FLOAT_EQ (cloud.points[0].x, first.x); // test for fromPCLPointCloud2 () - EXPECT_FLOAT_EQ (cloud.points[0].y, first.y); // test for fromPCLPointCloud2 () - EXPECT_FLOAT_EQ (cloud.points[0].z, first.z); // test for fromPCLPointCloud2 () - EXPECT_FLOAT_EQ (cloud.points[0].intensity, first.intensity); // test for fromPCLPointCloud2 () + EXPECT_FLOAT_EQ (cloud[0].x, first.x); // test for fromPCLPointCloud2 () + EXPECT_FLOAT_EQ (cloud[0].y, first.y); // test for fromPCLPointCloud2 () + EXPECT_FLOAT_EQ (cloud[0].z, first.z); // test for fromPCLPointCloud2 () + EXPECT_FLOAT_EQ (cloud[0].intensity, first.intensity); // test for fromPCLPointCloud2 () - EXPECT_FLOAT_EQ (cloud.points[nr_p - 1].x, last.x); // test for fromPCLPointCloud2 () - EXPECT_FLOAT_EQ (cloud.points[nr_p - 1].y, last.y); // test for fromPCLPointCloud2 () - EXPECT_FLOAT_EQ (cloud.points[nr_p - 1].z, last.z); // test for fromPCLPointCloud2 () - EXPECT_FLOAT_EQ (cloud.points[nr_p - 1].intensity, last.intensity); // test for fromPCLPointCloud2 () + EXPECT_FLOAT_EQ (cloud[nr_p - 1].x, last.x); // test for fromPCLPointCloud2 () + EXPECT_FLOAT_EQ (cloud[nr_p - 1].y, last.y); // test for fromPCLPointCloud2 () + EXPECT_FLOAT_EQ (cloud[nr_p - 1].z, last.z); // test for fromPCLPointCloud2 () + EXPECT_FLOAT_EQ (cloud[nr_p - 1].intensity, last.intensity); // test for fromPCLPointCloud2 () // Make sure we have permissions to write there res = savePCDFile ("test_pcl_io.pcd", cloud_blob, Eigen::Vector4f::Zero (), Eigen::Quaternionf::Identity (), true); @@ -513,15 +513,15 @@ TEST (PCL, IO) EXPECT_EQ (int (cloud.is_dense), cloud_blob.is_dense); // test for fromPCLPointCloud2 () EXPECT_EQ (std::size_t (cloud.points.size ()), nr_p); // test for fromPCLPointCloud2 () - EXPECT_FLOAT_EQ (cloud.points[0].x, first.x); // test for fromPCLPointCloud2 () - EXPECT_FLOAT_EQ (cloud.points[0].y, first.y); // test for fromPCLPointCloud2 () - EXPECT_FLOAT_EQ (cloud.points[0].z, first.z); // test for fromPCLPointCloud2 () - EXPECT_FLOAT_EQ (cloud.points[0].intensity, first.intensity); // test for fromPCLPointCloud2 () + EXPECT_FLOAT_EQ (cloud[0].x, first.x); // test for fromPCLPointCloud2 () + EXPECT_FLOAT_EQ (cloud[0].y, first.y); // test for fromPCLPointCloud2 () + EXPECT_FLOAT_EQ (cloud[0].z, first.z); // test for fromPCLPointCloud2 () + EXPECT_FLOAT_EQ (cloud[0].intensity, first.intensity); // test for fromPCLPointCloud2 () - EXPECT_FLOAT_EQ (cloud.points[nr_p - 1].x, last.x); // test for fromPCLPointCloud2 () - EXPECT_FLOAT_EQ (cloud.points[nr_p - 1].y, last.y); // test for fromPCLPointCloud2 () - EXPECT_FLOAT_EQ (cloud.points[nr_p - 1].z, last.z); // test for fromPCLPointCloud2 () - EXPECT_FLOAT_EQ (cloud.points[nr_p - 1].intensity, last.intensity); // test for fromPCLPointCloud2 () + EXPECT_FLOAT_EQ (cloud[nr_p - 1].x, last.x); // test for fromPCLPointCloud2 () + EXPECT_FLOAT_EQ (cloud[nr_p - 1].y, last.y); // test for fromPCLPointCloud2 () + EXPECT_FLOAT_EQ (cloud[nr_p - 1].z, last.z); // test for fromPCLPointCloud2 () + EXPECT_FLOAT_EQ (cloud[nr_p - 1].intensity, last.intensity); // test for fromPCLPointCloud2 () // Save as ASCII try @@ -548,15 +548,15 @@ TEST (PCL, IO) EXPECT_EQ (int (cloud.is_dense), cloud_blob.is_dense); // test for fromPCLPointCloud2 () EXPECT_EQ (std::size_t (cloud.points.size ()), nr_p); // test for fromPCLPointCloud2 () - EXPECT_FLOAT_EQ (cloud.points[0].x, first.x); // test for fromPCLPointCloud2 () - EXPECT_FLOAT_EQ (cloud.points[0].y, first.y); // test for fromPCLPointCloud2 () - EXPECT_FLOAT_EQ (cloud.points[0].z, first.z); // test for fromPCLPointCloud2 () - EXPECT_FLOAT_EQ (cloud.points[0].intensity, first.intensity); // test for fromPCLPointCloud2 () + EXPECT_FLOAT_EQ (cloud[0].x, first.x); // test for fromPCLPointCloud2 () + EXPECT_FLOAT_EQ (cloud[0].y, first.y); // test for fromPCLPointCloud2 () + EXPECT_FLOAT_EQ (cloud[0].z, first.z); // test for fromPCLPointCloud2 () + EXPECT_FLOAT_EQ (cloud[0].intensity, first.intensity); // test for fromPCLPointCloud2 () - EXPECT_FLOAT_EQ (cloud.points[nr_p - 1].x, last.x); // test for fromPCLPointCloud2 () - EXPECT_FLOAT_EQ (cloud.points[nr_p - 1].y, last.y); // test for fromPCLPointCloud2 () - EXPECT_FLOAT_EQ (cloud.points[nr_p - 1].z, last.z); // test for fromPCLPointCloud2 () - EXPECT_FLOAT_EQ (cloud.points[nr_p - 1].intensity, last.intensity); // test for fromPCLPointCloud2 () + EXPECT_FLOAT_EQ (cloud[nr_p - 1].x, last.x); // test for fromPCLPointCloud2 () + EXPECT_FLOAT_EQ (cloud[nr_p - 1].y, last.y); // test for fromPCLPointCloud2 () + EXPECT_FLOAT_EQ (cloud[nr_p - 1].z, last.z); // test for fromPCLPointCloud2 () + EXPECT_FLOAT_EQ (cloud[nr_p - 1].intensity, last.intensity); // test for fromPCLPointCloud2 () // Save as ASCII try @@ -583,15 +583,15 @@ TEST (PCL, IO) EXPECT_EQ (int (cloud.is_dense), cloud_blob.is_dense); // test for fromPCLPointCloud2 () EXPECT_EQ (std::size_t (cloud.points.size ()), nr_p); // test for fromPCLPointCloud2 () - EXPECT_FLOAT_EQ (cloud.points[0].x, first.x); // test for fromPCLPointCloud2 () - EXPECT_FLOAT_EQ (cloud.points[0].y, first.y); // test for fromPCLPointCloud2 () - EXPECT_FLOAT_EQ (cloud.points[0].z, first.z); // test for fromPCLPointCloud2 () - EXPECT_FLOAT_EQ (cloud.points[0].intensity, first.intensity); // test for fromPCLPointCloud2 () + EXPECT_FLOAT_EQ (cloud[0].x, first.x); // test for fromPCLPointCloud2 () + EXPECT_FLOAT_EQ (cloud[0].y, first.y); // test for fromPCLPointCloud2 () + EXPECT_FLOAT_EQ (cloud[0].z, first.z); // test for fromPCLPointCloud2 () + EXPECT_FLOAT_EQ (cloud[0].intensity, first.intensity); // test for fromPCLPointCloud2 () - EXPECT_FLOAT_EQ (cloud.points[nr_p - 1].x, last.x); // test for fromPCLPointCloud2 () - EXPECT_FLOAT_EQ (cloud.points[nr_p - 1].y, last.y); // test for fromPCLPointCloud2 () - EXPECT_FLOAT_EQ (cloud.points[nr_p - 1].z, last.z); // test for fromPCLPointCloud2 () - EXPECT_FLOAT_EQ (float (cloud.points[nr_p - 1].intensity), float (last.intensity)); // test for fromPCLPointCloud2 () + EXPECT_FLOAT_EQ (cloud[nr_p - 1].x, last.x); // test for fromPCLPointCloud2 () + EXPECT_FLOAT_EQ (cloud[nr_p - 1].y, last.y); // test for fromPCLPointCloud2 () + EXPECT_FLOAT_EQ (cloud[nr_p - 1].z, last.z); // test for fromPCLPointCloud2 () + EXPECT_FLOAT_EQ (float (cloud[nr_p - 1].intensity), float (last.intensity)); // test for fromPCLPointCloud2 () std::vector indices (cloud.width * cloud.height / 2); for (int i = 0; i < static_cast (indices.size ()); ++i) indices[i] = i; @@ -620,10 +620,10 @@ TEST (PCL, IO) EXPECT_EQ (int (cloud.is_dense), cloud_blob.is_dense); // test for fromPCLPointCloud2 () EXPECT_EQ (std::size_t (cloud.points.size ()), nr_p / 2); // test for fromPCLPointCloud2 () - EXPECT_FLOAT_EQ (cloud.points[0].x, first.x); // test for fromPCLPointCloud2 () - EXPECT_FLOAT_EQ (cloud.points[0].y, first.y); // test for fromPCLPointCloud2 () - EXPECT_FLOAT_EQ (cloud.points[0].z, first.z); // test for fromPCLPointCloud2 () - EXPECT_FLOAT_EQ (float (cloud.points[0].intensity), float (first.intensity)); // test for fromPCLPointCloud2 () + EXPECT_FLOAT_EQ (cloud[0].x, first.x); // test for fromPCLPointCloud2 () + EXPECT_FLOAT_EQ (cloud[0].y, first.y); // test for fromPCLPointCloud2 () + EXPECT_FLOAT_EQ (cloud[0].z, first.z); // test for fromPCLPointCloud2 () + EXPECT_FLOAT_EQ (float (cloud[0].intensity), float (first.intensity)); // test for fromPCLPointCloud2 () indices.resize (cloud.width * cloud.height / 2); for (int i = 0; i < static_cast (indices.size ()); ++i) indices[i] = i; @@ -652,10 +652,10 @@ TEST (PCL, IO) EXPECT_EQ (int (cloud.is_dense), cloud_blob.is_dense); // test for fromPCLPointCloud2 () EXPECT_EQ (std::size_t (cloud.points.size ()), nr_p / 4); // test for fromPCLPointCloud2 () - EXPECT_FLOAT_EQ (cloud.points[0].x, first.x); // test for fromPCLPointCloud2 () - EXPECT_FLOAT_EQ (cloud.points[0].y, first.y); // test for fromPCLPointCloud2 () - EXPECT_FLOAT_EQ (cloud.points[0].z, first.z); // test for fromPCLPointCloud2 () - EXPECT_FLOAT_EQ (cloud.points[0].intensity, first.intensity); // test for fromPCLPointCloud2 () + EXPECT_FLOAT_EQ (cloud[0].x, first.x); // test for fromPCLPointCloud2 () + EXPECT_FLOAT_EQ (cloud[0].y, first.y); // test for fromPCLPointCloud2 () + EXPECT_FLOAT_EQ (cloud[0].z, first.z); // test for fromPCLPointCloud2 () + EXPECT_FLOAT_EQ (cloud[0].intensity, first.intensity); // test for fromPCLPointCloud2 () remove ("test_pcl_io_ascii.pcd"); remove ("test_pcl_io_binary.pcd"); @@ -678,14 +678,14 @@ TEST (PCL, PCDReaderWriter) // Randomly create a new point cloud for (std::size_t i = 0; i < nr_p; ++i) { - cloud.points[i].x = static_cast (1024 * rand () / (RAND_MAX + 1.0)); - cloud.points[i].y = static_cast (1024 * rand () / (RAND_MAX + 1.0)); - cloud.points[i].z = static_cast (1024 * rand () / (RAND_MAX + 1.0)); - cloud.points[i].intensity = static_cast (i); + cloud[i].x = static_cast (1024 * rand () / (RAND_MAX + 1.0)); + cloud[i].y = static_cast (1024 * rand () / (RAND_MAX + 1.0)); + cloud[i].z = static_cast (1024 * rand () / (RAND_MAX + 1.0)); + cloud[i].intensity = static_cast (i); } PointXYZI first, last; - first.x = cloud.points[0].x; first.y = cloud.points[0].y; first.z = cloud.points[0].z; first.intensity = cloud.points[0].intensity; - last.x = cloud.points[nr_p - 1].x; last.y = cloud.points[nr_p - 1].y; last.z = cloud.points[nr_p - 1].z; last.intensity = cloud.points[nr_p - 1].intensity; + first.x = cloud[0].x; first.y = cloud[0].y; first.z = cloud[0].z; first.intensity = cloud[0].intensity; + last.x = cloud[nr_p - 1].x; last.y = cloud[nr_p - 1].y; last.z = cloud[nr_p - 1].z; last.intensity = cloud[nr_p - 1].intensity; // Convert from data type to blob toPCLPointCloud2 (cloud, cloud_blob); @@ -719,15 +719,15 @@ TEST (PCL, PCDReaderWriter) EXPECT_EQ (int (cloud.is_dense), cloud_blob.is_dense); // test for fromPCLPointCloud2 () EXPECT_EQ (std::size_t (cloud.points.size ()), nr_p); // test for fromPCLPointCloud2 () - EXPECT_FLOAT_EQ (cloud.points[0].x, first.x); // test for fromPCLPointCloud2 () - EXPECT_FLOAT_EQ (cloud.points[0].y, first.y); // test for fromPCLPointCloud2 () - EXPECT_FLOAT_EQ (cloud.points[0].z, first.z); // test for fromPCLPointCloud2 () - EXPECT_FLOAT_EQ (cloud.points[0].intensity, first.intensity); // test for fromPCLPointCloud2 () + EXPECT_FLOAT_EQ (cloud[0].x, first.x); // test for fromPCLPointCloud2 () + EXPECT_FLOAT_EQ (cloud[0].y, first.y); // test for fromPCLPointCloud2 () + EXPECT_FLOAT_EQ (cloud[0].z, first.z); // test for fromPCLPointCloud2 () + EXPECT_FLOAT_EQ (cloud[0].intensity, first.intensity); // test for fromPCLPointCloud2 () - EXPECT_FLOAT_EQ (cloud.points[nr_p - 1].x, last.x); // test for fromPCLPointCloud2 () - EXPECT_FLOAT_EQ (cloud.points[nr_p - 1].y, last.y); // test for fromPCLPointCloud2 () - EXPECT_FLOAT_EQ (cloud.points[nr_p - 1].z, last.z); // test for fromPCLPointCloud2 () - EXPECT_FLOAT_EQ (cloud.points[nr_p - 1].intensity, last.intensity); // test for fromPCLPointCloud2 () + EXPECT_FLOAT_EQ (cloud[nr_p - 1].x, last.x); // test for fromPCLPointCloud2 () + EXPECT_FLOAT_EQ (cloud[nr_p - 1].y, last.y); // test for fromPCLPointCloud2 () + EXPECT_FLOAT_EQ (cloud[nr_p - 1].z, last.z); // test for fromPCLPointCloud2 () + EXPECT_FLOAT_EQ (cloud[nr_p - 1].intensity, last.intensity); // test for fromPCLPointCloud2 () remove ("test_pcl_io.pcd"); } @@ -798,11 +798,11 @@ TEST (PCL, ASCIIRead) // Randomly create a new point cloud for (std::size_t i = 0; i < nr_p; ++i) { - cloud.points[i].x = static_cast (1024 * rand () / (RAND_MAX + 1.0)); - cloud.points[i].y = static_cast (1024 * rand () / (RAND_MAX + 1.0)); - cloud.points[i].z = static_cast (1024 * rand () / (RAND_MAX + 1.0)); - cloud.points[i].intensity = static_cast (i); - afile << cloud.points[i].x << " , " << cloud.points[i].y << " , " << cloud.points[i].z << " , " << cloud.points[i].intensity << " \n"; + cloud[i].x = static_cast (1024 * rand () / (RAND_MAX + 1.0)); + cloud[i].y = static_cast (1024 * rand () / (RAND_MAX + 1.0)); + cloud[i].z = static_cast (1024 * rand () / (RAND_MAX + 1.0)); + cloud[i].intensity = static_cast (i); + afile << cloud[i].x << " , " << cloud[i].y << " , " << cloud[i].z << " , " << cloud[i].intensity << " \n"; } afile.close(); @@ -813,10 +813,10 @@ TEST (PCL, ASCIIRead) EXPECT_EQ(cloud.points.size(), rcloud.points.size() ); for(std::size_t i=0;i < rcloud.points.size(); i++){ - EXPECT_FLOAT_EQ(cloud.points[i].x, rcloud.points[i].x); - EXPECT_FLOAT_EQ(cloud.points[i].y,rcloud.points[i].y); - EXPECT_FLOAT_EQ(cloud.points[i].z, rcloud.points[i].z); - EXPECT_FLOAT_EQ(cloud.points[i].intensity, rcloud.points[i].intensity); + EXPECT_FLOAT_EQ(cloud[i].x, rcloud[i].x); + EXPECT_FLOAT_EQ(cloud[i].y,rcloud[i].y); + EXPECT_FLOAT_EQ(cloud[i].z, rcloud[i].z); + EXPECT_FLOAT_EQ(cloud[i].intensity, rcloud[i].intensity); } remove ("test_pcd.txt"); @@ -939,12 +939,12 @@ TEST (PCL, ExtendedIO) cloud.width = 2; cloud.height = 1; cloud.points.resize (2); - cloud.points[0].x = cloud.points[0].y = cloud.points[0].z = 1; - cloud.points[1].x = cloud.points[1].y = cloud.points[1].z = 2; + cloud[0].x = cloud[0].y = cloud[0].z = 1; + cloud[1].x = cloud[1].y = cloud[1].z = 2; for (int i = 0; i < 33; ++i) { - cloud.points[0].histogram[i] = static_cast (i); - cloud.points[1].histogram[i] = 33.0f - static_cast (i); + cloud[0].histogram[i] = static_cast (i); + cloud[1].histogram[i] = 33.0f - static_cast (i); } savePCDFile ("v.pcd", cloud); @@ -956,12 +956,12 @@ TEST (PCL, ExtendedIO) EXPECT_EQ (cloud.is_dense, true); EXPECT_EQ (int (cloud.points.size ()), 2); - EXPECT_EQ (cloud.points[0].x, 1); EXPECT_EQ (cloud.points[0].y, 1); EXPECT_EQ (cloud.points[0].z, 1); - EXPECT_EQ (cloud.points[1].x, 2); EXPECT_EQ (cloud.points[1].y, 2); EXPECT_EQ (cloud.points[1].z, 2); + EXPECT_EQ (cloud[0].x, 1); EXPECT_EQ (cloud[0].y, 1); EXPECT_EQ (cloud[0].z, 1); + EXPECT_EQ (cloud[1].x, 2); EXPECT_EQ (cloud[1].y, 2); EXPECT_EQ (cloud[1].z, 2); for (int i = 0; i < 33; ++i) { - ASSERT_EQ (cloud.points[0].histogram[i], i); - ASSERT_EQ (cloud.points[1].histogram[i], 33-i); + ASSERT_EQ (cloud[0].histogram[i], i); + ASSERT_EQ (cloud[1].histogram[i], 33-i); } remove ("v.pcd"); @@ -975,7 +975,7 @@ TEST (PCL, EigenConversions) cloud.points.resize (5); for (int i = 0; i < int (cloud.points.size ()); ++i) - cloud.points[i].x = cloud.points[i].y = cloud.points[i].z = static_cast (i); + cloud[i].x = cloud[i].y = cloud[i].z = static_cast (i); pcl::PCLPointCloud2 blob; toPCLPointCloud2 (cloud, blob); @@ -987,9 +987,9 @@ TEST (PCL, EigenConversions) for (std::size_t i = 0; i < cloud.points.size (); ++i) { - EXPECT_EQ (mat (0, i), cloud.points[i].x); - EXPECT_EQ (mat (1, i), cloud.points[i].y); - EXPECT_EQ (mat (2, i), cloud.points[i].z); + EXPECT_EQ (mat (0, i), cloud[i].x); + EXPECT_EQ (mat (1, i), cloud[i].y); + EXPECT_EQ (mat (2, i), cloud[i].z); EXPECT_EQ (mat (3, i), 1); } @@ -997,9 +997,9 @@ TEST (PCL, EigenConversions) fromPCLPointCloud2 (blob, cloud); for (std::size_t i = 0; i < cloud.points.size (); ++i) { - EXPECT_EQ (cloud.points[i].x, i); - EXPECT_EQ (cloud.points[i].y, i); - EXPECT_EQ (cloud.points[i].z, i); + EXPECT_EQ (cloud[i].x, i); + EXPECT_EQ (cloud[i].y, i); + EXPECT_EQ (cloud[i].z, i); } getPointCloudAsEigen (blob, mat); @@ -1008,9 +1008,9 @@ TEST (PCL, EigenConversions) for (std::size_t i = 0; i < cloud.points.size (); ++i) { - EXPECT_EQ (mat (0, i), cloud.points[i].x); - EXPECT_EQ (mat (1, i), cloud.points[i].y); - EXPECT_EQ (mat (2, i), cloud.points[i].z); + EXPECT_EQ (mat (0, i), cloud[i].x); + EXPECT_EQ (mat (1, i), cloud[i].y); + EXPECT_EQ (mat (2, i), cloud[i].z); EXPECT_EQ (mat (3, i), 1); } } @@ -1029,31 +1029,31 @@ TEST (PCL, CopyPointCloud) for (std::size_t i = 0; i < cloud_a.points.size (); ++i) { - cloud_a.points[i].x = static_cast (1024 * rand () / (RAND_MAX + 1.0)); - cloud_a.points[i].y = static_cast (1024 * rand () / (RAND_MAX + 1.0)); - cloud_a.points[i].z = static_cast (1024 * rand () / (RAND_MAX + 1.0)); - cloud_b.points[i].rgba = 255; + cloud_a[i].x = static_cast (1024 * rand () / (RAND_MAX + 1.0)); + cloud_a[i].y = static_cast (1024 * rand () / (RAND_MAX + 1.0)); + cloud_a[i].z = static_cast (1024 * rand () / (RAND_MAX + 1.0)); + cloud_b[i].rgba = 255; } pcl::copyPointCloud (cloud_a, cloud_b); for (std::size_t i = 0; i < cloud_a.points.size (); ++i) { - EXPECT_EQ (cloud_b.points[i].x, cloud_a.points[i].x); - EXPECT_EQ (cloud_b.points[i].y, cloud_a.points[i].y); - EXPECT_EQ (cloud_b.points[i].z, cloud_a.points[i].z); - EXPECT_EQ (cloud_b.points[i].rgba, 255); - cloud_a.points[i].x = cloud_a.points[i].y = cloud_a.points[i].z = 0; + EXPECT_EQ (cloud_b[i].x, cloud_a[i].x); + EXPECT_EQ (cloud_b[i].y, cloud_a[i].y); + EXPECT_EQ (cloud_b[i].z, cloud_a[i].z); + EXPECT_EQ (cloud_b[i].rgba, 255); + cloud_a[i].x = cloud_a[i].y = cloud_a[i].z = 0; } pcl::copyPointCloud (cloud_b, cloud_a); for (std::size_t i = 0; i < cloud_a.points.size (); ++i) { - EXPECT_EQ (cloud_b.points[i].x, cloud_a.points[i].x); - EXPECT_EQ (cloud_b.points[i].y, cloud_a.points[i].y); - EXPECT_EQ (cloud_b.points[i].z, cloud_a.points[i].z); - EXPECT_EQ (cloud_b.points[i].rgba, 255); + EXPECT_EQ (cloud_b[i].x, cloud_a[i].x); + EXPECT_EQ (cloud_b[i].y, cloud_a[i].y); + EXPECT_EQ (cloud_b[i].z, cloud_a[i].z); + EXPECT_EQ (cloud_b[i].rgba, 255); } } @@ -1071,9 +1071,9 @@ TEST (PCL, LZF) // Randomly create a new point cloud for (std::size_t i = 0; i < nr_p; ++i) { - cloud.points[i].x = static_cast (1024 * rand () / (RAND_MAX + 1.0)); - cloud.points[i].y = static_cast (1024 * rand () / (RAND_MAX + 1.0)); - cloud.points[i].z = static_cast (1024 * rand () / (RAND_MAX + 1.0)); + cloud[i].x = static_cast (1024 * rand () / (RAND_MAX + 1.0)); + cloud[i].y = static_cast (1024 * rand () / (RAND_MAX + 1.0)); + cloud[i].z = static_cast (1024 * rand () / (RAND_MAX + 1.0)); } PCDWriter writer; int res = writer.writeBinaryCompressed ("test_pcl_io_compressed.pcd", cloud); @@ -1090,9 +1090,9 @@ TEST (PCL, LZF) for (std::size_t i = 0; i < cloud2.points.size (); ++i) { - ASSERT_EQ (cloud2.points[i].x, cloud.points[i].x); - ASSERT_EQ (cloud2.points[i].y, cloud.points[i].y); - ASSERT_EQ (cloud2.points[i].z, cloud.points[i].z); + ASSERT_EQ (cloud2[i].x, cloud[i].x); + ASSERT_EQ (cloud2[i].y, cloud[i].y); + ASSERT_EQ (cloud2[i].z, cloud[i].z); } pcl::PCLPointCloud2 blob; @@ -1109,9 +1109,9 @@ TEST (PCL, LZF) for (std::size_t i = 0; i < cloud2.points.size (); ++i) { - EXPECT_EQ (cloud2.points[i].x, cloud.points[i].x); - EXPECT_EQ (cloud2.points[i].y, cloud.points[i].y); - EXPECT_EQ (cloud2.points[i].z, cloud.points[i].z); + EXPECT_EQ (cloud2[i].x, cloud[i].x); + EXPECT_EQ (cloud2[i].y, cloud[i].y); + EXPECT_EQ (cloud2[i].z, cloud[i].z); } } @@ -1129,13 +1129,13 @@ TEST (PCL, LZFExtended) // Randomly create a new point cloud for (std::size_t i = 0; i < nr_p; ++i) { - cloud.points[i].x = static_cast (1024 * rand () / (RAND_MAX + 1.0)); - cloud.points[i].y = static_cast (1024 * rand () / (RAND_MAX + 1.0)); - cloud.points[i].z = static_cast (1024 * rand () / (RAND_MAX + 1.0)); - cloud.points[i].normal_x = static_cast (1024 * rand () / (RAND_MAX + 1.0)); - cloud.points[i].normal_y = static_cast (1024 * rand () / (RAND_MAX + 1.0)); - cloud.points[i].normal_z = static_cast (1024 * rand () / (RAND_MAX + 1.0)); - cloud.points[i].rgb = static_cast (1024 * rand () / (RAND_MAX + 1.0)); + cloud[i].x = static_cast (1024 * rand () / (RAND_MAX + 1.0)); + cloud[i].y = static_cast (1024 * rand () / (RAND_MAX + 1.0)); + cloud[i].z = static_cast (1024 * rand () / (RAND_MAX + 1.0)); + cloud[i].normal_x = static_cast (1024 * rand () / (RAND_MAX + 1.0)); + cloud[i].normal_y = static_cast (1024 * rand () / (RAND_MAX + 1.0)); + cloud[i].normal_z = static_cast (1024 * rand () / (RAND_MAX + 1.0)); + cloud[i].rgb = static_cast (1024 * rand () / (RAND_MAX + 1.0)); } pcl::PCLPointCloud2 blob; @@ -1156,13 +1156,13 @@ TEST (PCL, LZFExtended) for (std::size_t i = 0; i < cloud2.points.size (); ++i) { - EXPECT_EQ (cloud2.points[i].x, cloud.points[i].x); - EXPECT_EQ (cloud2.points[i].y, cloud.points[i].y); - EXPECT_EQ (cloud2.points[i].z, cloud.points[i].z); - EXPECT_EQ (cloud2.points[i].normal_x, cloud.points[i].normal_x); - EXPECT_EQ (cloud2.points[i].normal_y, cloud.points[i].normal_y); - EXPECT_EQ (cloud2.points[i].normal_z, cloud.points[i].normal_z); - EXPECT_EQ (cloud2.points[i].rgb, cloud.points[i].rgb); + EXPECT_EQ (cloud2[i].x, cloud[i].x); + EXPECT_EQ (cloud2[i].y, cloud[i].y); + EXPECT_EQ (cloud2[i].z, cloud[i].z); + EXPECT_EQ (cloud2[i].normal_x, cloud[i].normal_x); + EXPECT_EQ (cloud2[i].normal_y, cloud[i].normal_y); + EXPECT_EQ (cloud2[i].normal_z, cloud[i].normal_z); + EXPECT_EQ (cloud2[i].rgb, cloud[i].rgb); } remove ("test_pcl_io_compressed.pcd"); @@ -1182,13 +1182,13 @@ TEST (PCL, LZFInMem) // Randomly create a new point cloud for (std::size_t i = 0; i < nr_p; ++i) { - cloud.points[i].x = static_cast (1024 * rand () / (RAND_MAX + 1.0)); - cloud.points[i].y = static_cast (1024 * rand () / (RAND_MAX + 1.0)); - cloud.points[i].z = static_cast (1024 * rand () / (RAND_MAX + 1.0)); - cloud.points[i].normal_x = static_cast (1024 * rand () / (RAND_MAX + 1.0)); - cloud.points[i].normal_y = static_cast (1024 * rand () / (RAND_MAX + 1.0)); - cloud.points[i].normal_z = static_cast (1024 * rand () / (RAND_MAX + 1.0)); - cloud.points[i].rgb = static_cast (1024 * rand () / (RAND_MAX + 1.0)); + cloud[i].x = static_cast (1024 * rand () / (RAND_MAX + 1.0)); + cloud[i].y = static_cast (1024 * rand () / (RAND_MAX + 1.0)); + cloud[i].z = static_cast (1024 * rand () / (RAND_MAX + 1.0)); + cloud[i].normal_x = static_cast (1024 * rand () / (RAND_MAX + 1.0)); + cloud[i].normal_y = static_cast (1024 * rand () / (RAND_MAX + 1.0)); + cloud[i].normal_z = static_cast (1024 * rand () / (RAND_MAX + 1.0)); + cloud[i].rgb = static_cast (1024 * rand () / (RAND_MAX + 1.0)); } pcl::PCLPointCloud2 blob; @@ -1226,13 +1226,13 @@ TEST (PCL, LZFInMem) for (std::size_t i = 0; i < cloud2.points.size (); ++i) { - EXPECT_EQ (cloud2.points[i].x, cloud.points[i].x); - EXPECT_EQ (cloud2.points[i].y, cloud.points[i].y); - EXPECT_EQ (cloud2.points[i].z, cloud.points[i].z); - EXPECT_EQ (cloud2.points[i].normal_x, cloud.points[i].normal_x); - EXPECT_EQ (cloud2.points[i].normal_y, cloud.points[i].normal_y); - EXPECT_EQ (cloud2.points[i].normal_z, cloud.points[i].normal_z); - EXPECT_EQ (cloud2.points[i].rgb, cloud.points[i].rgb); + EXPECT_EQ (cloud2[i].x, cloud[i].x); + EXPECT_EQ (cloud2[i].y, cloud[i].y); + EXPECT_EQ (cloud2[i].z, cloud[i].z); + EXPECT_EQ (cloud2[i].normal_x, cloud[i].normal_x); + EXPECT_EQ (cloud2[i].normal_y, cloud[i].normal_y); + EXPECT_EQ (cloud2[i].normal_z, cloud[i].normal_z); + EXPECT_EQ (cloud2[i].rgb, cloud[i].rgb); } } @@ -1251,15 +1251,15 @@ TEST (PCL, Locale) srand (static_cast (time (nullptr))); std::size_t nr_p = cloud.points.size (); // Randomly create a new point cloud - cloud.points[0].x = std::numeric_limits::quiet_NaN (); - cloud.points[0].y = std::numeric_limits::quiet_NaN (); - cloud.points[0].z = std::numeric_limits::quiet_NaN (); + cloud[0].x = std::numeric_limits::quiet_NaN (); + cloud[0].y = std::numeric_limits::quiet_NaN (); + cloud[0].z = std::numeric_limits::quiet_NaN (); for (std::size_t i = 1; i < nr_p; ++i) { - cloud.points[i].x = static_cast (1024 * rand () / (RAND_MAX + 1.0)); - cloud.points[i].y = static_cast (1024 * rand () / (RAND_MAX + 1.0)); - cloud.points[i].z = static_cast (1024 * rand () / (RAND_MAX + 1.0)); + cloud[i].x = static_cast (1024 * rand () / (RAND_MAX + 1.0)); + cloud[i].y = static_cast (1024 * rand () / (RAND_MAX + 1.0)); + cloud[i].z = static_cast (1024 * rand () / (RAND_MAX + 1.0)); } PCDWriter writer; try @@ -1298,14 +1298,14 @@ TEST (PCL, Locale) EXPECT_EQ (cloud2.is_dense, false); EXPECT_EQ (cloud2.points.size (), cloud.points.size ()); - EXPECT_TRUE (std::isnan(cloud2.points[0].x)); - EXPECT_TRUE (std::isnan(cloud2.points[0].y)); - EXPECT_TRUE (std::isnan(cloud2.points[0].z)); + EXPECT_TRUE (std::isnan(cloud2[0].x)); + EXPECT_TRUE (std::isnan(cloud2[0].y)); + EXPECT_TRUE (std::isnan(cloud2[0].z)); for (std::size_t i = 1; i < cloud2.points.size (); ++i) { - ASSERT_FLOAT_EQ (cloud2.points[i].x, cloud.points[i].x); - ASSERT_FLOAT_EQ (cloud2.points[i].y, cloud.points[i].y); - ASSERT_FLOAT_EQ (cloud2.points[i].z, cloud.points[i].z); + ASSERT_FLOAT_EQ (cloud2[i].x, cloud[i].x); + ASSERT_FLOAT_EQ (cloud2[i].y, cloud[i].y); + ASSERT_FLOAT_EQ (cloud2[i].z, cloud[i].z); } } catch (const std::exception&) diff --git a/test/io/test_point_cloud_image_extractors.cpp b/test/io/test_point_cloud_image_extractors.cpp index 57bb8768f73..bdf839ef495 100644 --- a/test/io/test_point_cloud_image_extractors.cpp +++ b/test/io/test_point_cloud_image_extractors.cpp @@ -171,7 +171,7 @@ TEST (PCL, PointCloudImageExtractorFromLabelFieldMono) cloud.is_dense = true; cloud.points.resize (cloud.width * cloud.height); for (std::size_t i = 0; i < cloud.points.size (); i++) - cloud.points[i].label = i; + cloud[i].label = i; pcl::PCLImage image; PointCloudImageExtractorFromLabelField pcie; @@ -198,7 +198,7 @@ TEST (PCL, PointCloudImageExtractorFromLabelFieldRGB) cloud.is_dense = true; cloud.points.resize (cloud.width * cloud.height); for (std::size_t i = 0; i < cloud.points.size (); i++) - cloud.points[i].label = i % 2; + cloud[i].label = i % 2; pcl::PCLImage image; PointCloudImageExtractorFromLabelField pcie; @@ -236,7 +236,7 @@ TEST (PCL, PointCloudImageExtractorFromLabelFieldGlasbey) cloud.is_dense = true; cloud.points.resize (cloud.width * cloud.height); for (std::size_t i = 0; i < cloud.points.size (); i++) - cloud.points[i].label = i % 2; + cloud[i].label = i % 2; pcl::PCLImage image; PointCloudImageExtractorFromLabelField pcie; @@ -250,7 +250,7 @@ TEST (PCL, PointCloudImageExtractorFromLabelFieldGlasbey) // Fill in different labels and extract another image for (std::size_t i = 0; i < cloud.points.size (); i++) - cloud.points[i].label = i % 2 + 10; + cloud[i].label = i % 2 + 10; pcl::PCLImage image2; ASSERT_TRUE (pcie.extract (cloud, image2)); @@ -273,7 +273,7 @@ TEST (PCL, PointCloudImageExtractorFromZField) cloud.is_dense = true; cloud.points.resize (cloud.width * cloud.height); for (std::size_t i = 0; i < cloud.points.size (); i++) - cloud.points[i].z = 1.0 + i; + cloud[i].z = 1.0 + i; pcl::PCLImage image; PointCloudImageExtractorFromZField pcie; @@ -300,10 +300,10 @@ TEST (PCL, PointCloudImageExtractorFromCurvatureField) cloud.is_dense = true; cloud.points.resize (cloud.width * cloud.height); - cloud.points[0].curvature = 1.0; - cloud.points[1].curvature = 2.0; - cloud.points[2].curvature = 1.0; - cloud.points[3].curvature = 2.0; + cloud[0].curvature = 1.0; + cloud[1].curvature = 2.0; + cloud[2].curvature = 1.0; + cloud[3].curvature = 2.0; pcl::PCLImage image; PointCloudImageExtractorFromCurvatureField pcie; @@ -332,10 +332,10 @@ TEST (PCL, PointCloudImageExtractorFromIntensityField) cloud.is_dense = true; cloud.points.resize (cloud.width * cloud.height); - cloud.points[0].intensity = 10.0; - cloud.points[1].intensity = 23.3; - cloud.points[2].intensity = 28.9; - cloud.points[3].intensity = 40.0; + cloud[0].intensity = 10.0; + cloud[1].intensity = 23.3; + cloud[2].intensity = 28.9; + cloud[3].intensity = 40.0; pcl::PCLImage image; PointCloudImageExtractorFromIntensityField pcie; @@ -349,7 +349,7 @@ TEST (PCL, PointCloudImageExtractorFromIntensityField) // by default Intensity field extractor does not apply scaling for (std::size_t i = 0; i < cloud.points.size (); i++) - EXPECT_EQ (static_cast (cloud.points[i].intensity), data[i]); + EXPECT_EQ (static_cast (cloud[i].intensity), data[i]); } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -399,11 +399,11 @@ TEST (PCL, PointCloudImageExtractorBlackNaNs) cloud.is_dense = false; cloud.points.resize (cloud.width * cloud.height); - cloud.points[0].curvature = 1.0; - cloud.points[1].curvature = 2.0; - cloud.points[2].curvature = 1.0; - cloud.points[3].curvature = 2.0; - cloud.points[3].z = std::numeric_limits::quiet_NaN (); + cloud[0].curvature = 1.0; + cloud[1].curvature = 2.0; + cloud[2].curvature = 1.0; + cloud[3].curvature = 2.0; + cloud[3].z = std::numeric_limits::quiet_NaN (); pcl::PCLImage image; diff --git a/test/kdtree/test_kdtree.cpp b/test/kdtree/test_kdtree.cpp index 0de67ac123b..9b463ab6718 100644 --- a/test/kdtree/test_kdtree.cpp +++ b/test/kdtree/test_kdtree.cpp @@ -98,7 +98,7 @@ TEST (PCL, KdTreeFLANN_radiusSearch) double max_dist = 0.15; set brute_force_result; for (std::size_t i=0; i < cloud.points.size(); ++i) - if (euclideanDistance(cloud.points[i], test_point) < max_dist) + if (euclideanDistance(cloud[i], test_point) < max_dist) brute_force_result.insert(i); std::vector k_indices; std::vector k_distances; @@ -168,7 +168,7 @@ TEST (PCL, KdTreeFLANN_nearestKSearch) multimap sorted_brute_force_result; for (std::size_t i = 0; i < cloud.points.size (); ++i) { - float distance = euclideanDistance (cloud.points[i], test_point); + float distance = euclideanDistance (cloud[i], test_point); sorted_brute_force_result.insert (make_pair (distance, static_cast (i))); } float max_dist = 0.0f; @@ -190,7 +190,7 @@ TEST (PCL, KdTreeFLANN_nearestKSearch) // Check if all found neighbors have distance smaller than max_dist for (const int &k_index : k_indices) { - const MyPoint& point = cloud.points[k_index]; + const MyPoint& point = cloud[k_index]; bool ok = euclideanDistance (test_point, point) <= max_dist; if (!ok) ok = (std::abs (euclideanDistance (test_point, point)) - max_dist) <= 1e-6; diff --git a/test/keypoints/test_iss_3d.cpp b/test/keypoints/test_iss_3d.cpp index 11d54f68fb7..fe28aa34cad 100644 --- a/test/keypoints/test_iss_3d.cpp +++ b/test/keypoints/test_iss_3d.cpp @@ -91,9 +91,9 @@ TEST (PCL, ISSKeypoint3D_WBE) for (std::size_t i = 0; i < correct_nr_keypoints; ++i) { - EXPECT_NEAR (keypoints.points[i].x, correct_keypoints[i][0], 1e-6); - EXPECT_NEAR (keypoints.points[i].y, correct_keypoints[i][1], 1e-6); - EXPECT_NEAR (keypoints.points[i].z, correct_keypoints[i][2], 1e-6); + EXPECT_NEAR (keypoints[i].x, correct_keypoints[i][0], 1e-6); + EXPECT_NEAR (keypoints[i].y, correct_keypoints[i][1], 1e-6); + EXPECT_NEAR (keypoints[i].z, correct_keypoints[i][2], 1e-6); } tree.reset (new search::KdTree ()); @@ -145,9 +145,9 @@ TEST (PCL, ISSKeypoint3D_BE) for (std::size_t i = 0; i < correct_nr_keypoints; ++i) { - EXPECT_NEAR (keypoints.points[i].x, correct_keypoints[i][0], 1e-6); - EXPECT_NEAR (keypoints.points[i].y, correct_keypoints[i][1], 1e-6); - EXPECT_NEAR (keypoints.points[i].z, correct_keypoints[i][2], 1e-6); + EXPECT_NEAR (keypoints[i].x, correct_keypoints[i][0], 1e-6); + EXPECT_NEAR (keypoints[i].y, correct_keypoints[i][1], 1e-6); + EXPECT_NEAR (keypoints[i].z, correct_keypoints[i][2], 1e-6); } tree.reset (new search::KdTree ()); diff --git a/test/keypoints/test_keypoints.cpp b/test/keypoints/test_keypoints.cpp index 59551a1a9e3..50354126fb4 100644 --- a/test/keypoints/test_keypoints.cpp +++ b/test/keypoints/test_keypoints.cpp @@ -114,10 +114,10 @@ TEST (PCL, SIFTKeypoint) ASSERT_EQ (keypoints.points.size (), correct_nr_keypoints); for (std::size_t i = 0; i < correct_nr_keypoints; ++i) { - EXPECT_NEAR (keypoints.points[i].x, correct_keypoints[i][0], 1e-4); - EXPECT_NEAR (keypoints.points[i].y, correct_keypoints[i][1], 1e-4); - EXPECT_NEAR (keypoints.points[i].z, correct_keypoints[i][2], 1e-4); - EXPECT_NEAR (keypoints.points[i].scale, correct_keypoints[i][3], 1e-4); + EXPECT_NEAR (keypoints[i].x, correct_keypoints[i][0], 1e-4); + EXPECT_NEAR (keypoints[i].y, correct_keypoints[i][1], 1e-4); + EXPECT_NEAR (keypoints[i].z, correct_keypoints[i][2], 1e-4); + EXPECT_NEAR (keypoints[i].scale, correct_keypoints[i][3], 1e-4); } } diff --git a/test/registration/test_registration.cpp b/test/registration/test_registration.cpp index f05cf49523c..ac985112778 100644 --- a/test/registration/test_registration.cpp +++ b/test/registration/test_registration.cpp @@ -839,7 +839,7 @@ main (int argc, char** argv) // Tranpose the cloud_model /*for (std::size_t i = 0; i < cloud_model.points.size (); ++i) { - // cloud_model.points[i].z += 1; + // cloud_model[i].z += 1; }*/ } /* ]--- */ diff --git a/test/registration/test_registration_api.cpp b/test/registration/test_registration_api.cpp index 8818cfc2465..9a43521aec2 100644 --- a/test/registration/test_registration_api.cpp +++ b/test/registration/test_registration_api.cpp @@ -737,7 +737,7 @@ main (int argc, char** argv) // Tranpose the cloud_model /*for (std::size_t i = 0; i < cloud_model.points.size (); ++i) { - // cloud_model.points[i].z += 1; + // cloud_model[i].z += 1; }*/ } /* ]--- */ diff --git a/test/sample_consensus/test_sample_consensus.cpp b/test/sample_consensus/test_sample_consensus.cpp index 8f3be2a4d89..f8048d5aa01 100644 --- a/test/sample_consensus/test_sample_consensus.cpp +++ b/test/sample_consensus/test_sample_consensus.cpp @@ -103,9 +103,9 @@ TYPED_TEST(SacTest, InfiniteLoop) cloud.points.resize (point_count); for (unsigned idx = 0; idx < point_count; ++idx) { - cloud.points[idx].x = static_cast (idx); - cloud.points[idx].y = 0.0; - cloud.points[idx].z = 0.0; + cloud[idx].x = static_cast (idx); + cloud[idx].y = 0.0; + cloud[idx].z = 0.0; } SampleConsensusModelSpherePtr model (new SampleConsensusModelSphere (cloud.makeShared ())); diff --git a/test/sample_consensus/test_sample_consensus_line_models.cpp b/test/sample_consensus/test_sample_consensus_line_models.cpp index 2af4ff3e68b..1196190e975 100644 --- a/test/sample_consensus/test_sample_consensus_line_models.cpp +++ b/test/sample_consensus/test_sample_consensus_line_models.cpp @@ -57,16 +57,16 @@ TEST (SampleConsensusModelLine, RANSAC) PointCloud cloud; cloud.points.resize (10); - cloud.points[0].getVector3fMap () << 1.0f, 2.00f, 3.00f; - cloud.points[1].getVector3fMap () << 4.0f, 5.00f, 6.00f; - cloud.points[2].getVector3fMap () << 7.0f, 8.00f, 9.00f; - cloud.points[3].getVector3fMap () << 10.0f, 11.00f, 12.00f; - cloud.points[4].getVector3fMap () << 13.0f, 14.00f, 15.00f; - cloud.points[5].getVector3fMap () << 16.0f, 17.00f, 18.00f; - cloud.points[6].getVector3fMap () << 19.0f, 20.00f, 21.00f; - cloud.points[7].getVector3fMap () << 22.0f, 23.00f, 24.00f; - cloud.points[8].getVector3fMap () << -5.0f, 1.57f, 0.75f; - cloud.points[9].getVector3fMap () << 4.0f, 2.00f, 3.00f; + cloud[0].getVector3fMap () << 1.0f, 2.00f, 3.00f; + cloud[1].getVector3fMap () << 4.0f, 5.00f, 6.00f; + cloud[2].getVector3fMap () << 7.0f, 8.00f, 9.00f; + cloud[3].getVector3fMap () << 10.0f, 11.00f, 12.00f; + cloud[4].getVector3fMap () << 13.0f, 14.00f, 15.00f; + cloud[5].getVector3fMap () << 16.0f, 17.00f, 18.00f; + cloud[6].getVector3fMap () << 19.0f, 20.00f, 21.00f; + cloud[7].getVector3fMap () << 22.0f, 23.00f, 24.00f; + cloud[8].getVector3fMap () << -5.0f, 1.57f, 0.75f; + cloud[9].getVector3fMap () << 4.0f, 2.00f, 3.00f; // Create a shared line model pointer directly SampleConsensusModelLinePtr model (new SampleConsensusModelLine (cloud.makeShared ())); @@ -102,9 +102,9 @@ TEST (SampleConsensusModelLine, RANSAC) PointCloud proj_points; model->projectPoints (inliers, coeff_refined, proj_points); - EXPECT_XYZ_NEAR (PointXYZ ( 7.0, 8.0, 9.0), proj_points.points[2], 1e-4); - EXPECT_XYZ_NEAR (PointXYZ (10.0, 11.0, 12.0), proj_points.points[3], 1e-4); - EXPECT_XYZ_NEAR (PointXYZ (16.0, 17.0, 18.0), proj_points.points[5], 1e-4); + EXPECT_XYZ_NEAR (PointXYZ ( 7.0, 8.0, 9.0), proj_points[2], 1e-4); + EXPECT_XYZ_NEAR (PointXYZ (10.0, 11.0, 12.0), proj_points[3], 1e-4); + EXPECT_XYZ_NEAR (PointXYZ (16.0, 17.0, 18.0), proj_points[5], 1e-4); } TEST (SampleConsensusModelLine, OnGroundPlane) @@ -114,17 +114,17 @@ TEST (SampleConsensusModelLine, OnGroundPlane) // All the points are on the ground plane (z=0). // The line is parallel to the x axis, so all the inlier points have the same z and y coordinates. - cloud.points[0].getVector3fMap () << 0.0f, 0.0f, 0.0f; - cloud.points[1].getVector3fMap () << 1.0f, 0.0f, 0.0f; - cloud.points[2].getVector3fMap () << 2.0f, 0.0f, 0.0f; - cloud.points[3].getVector3fMap () << 3.0f, 0.0f, 0.0f; - cloud.points[4].getVector3fMap () << 4.0f, 0.0f, 0.0f; - cloud.points[5].getVector3fMap () << 5.0f, 0.0f, 0.0f; + cloud[0].getVector3fMap () << 0.0f, 0.0f, 0.0f; + cloud[1].getVector3fMap () << 1.0f, 0.0f, 0.0f; + cloud[2].getVector3fMap () << 2.0f, 0.0f, 0.0f; + cloud[3].getVector3fMap () << 3.0f, 0.0f, 0.0f; + cloud[4].getVector3fMap () << 4.0f, 0.0f, 0.0f; + cloud[5].getVector3fMap () << 5.0f, 0.0f, 0.0f; // Outliers - cloud.points[6].getVector3fMap () << 2.1f, 2.0f, 0.0f; - cloud.points[7].getVector3fMap () << 5.0f, 4.1f, 0.0f; - cloud.points[8].getVector3fMap () << 0.4f, 1.3f, 0.0f; - cloud.points[9].getVector3fMap () << 3.3f, 0.1f, 0.0f; + cloud[6].getVector3fMap () << 2.1f, 2.0f, 0.0f; + cloud[7].getVector3fMap () << 5.0f, 4.1f, 0.0f; + cloud[8].getVector3fMap () << 0.4f, 1.3f, 0.0f; + cloud[9].getVector3fMap () << 3.3f, 0.1f, 0.0f; // Create a shared line model pointer directly SampleConsensusModelLinePtr model (new SampleConsensusModelLine (cloud.makeShared ())); @@ -155,24 +155,24 @@ TEST (SampleConsensusModelParallelLine, RANSAC) PointCloud cloud (16, 1); // Line 1 - cloud.points[0].getVector3fMap () << 1.0f, 2.00f, 3.00f; - cloud.points[1].getVector3fMap () << 4.0f, 5.00f, 6.00f; - cloud.points[2].getVector3fMap () << 7.0f, 8.00f, 9.00f; - cloud.points[3].getVector3fMap () << 10.0f, 11.00f, 12.00f; - cloud.points[4].getVector3fMap () << 13.0f, 14.00f, 15.00f; - cloud.points[5].getVector3fMap () << 16.0f, 17.00f, 18.00f; - cloud.points[6].getVector3fMap () << 19.0f, 20.00f, 21.00f; - cloud.points[7].getVector3fMap () << 22.0f, 23.00f, 24.00f; + cloud[0].getVector3fMap () << 1.0f, 2.00f, 3.00f; + cloud[1].getVector3fMap () << 4.0f, 5.00f, 6.00f; + cloud[2].getVector3fMap () << 7.0f, 8.00f, 9.00f; + cloud[3].getVector3fMap () << 10.0f, 11.00f, 12.00f; + cloud[4].getVector3fMap () << 13.0f, 14.00f, 15.00f; + cloud[5].getVector3fMap () << 16.0f, 17.00f, 18.00f; + cloud[6].getVector3fMap () << 19.0f, 20.00f, 21.00f; + cloud[7].getVector3fMap () << 22.0f, 23.00f, 24.00f; // Random points - cloud.points[8].getVector3fMap () << -5.0f, 1.57f, 0.75f; - cloud.points[9].getVector3fMap () << 4.0f, 2.00f, 3.00f; + cloud[8].getVector3fMap () << -5.0f, 1.57f, 0.75f; + cloud[9].getVector3fMap () << 4.0f, 2.00f, 3.00f; // Line 2 (parallel to the Z axis) - cloud.points[10].getVector3fMap () << -1.00f, 5.00f, 0.0f; - cloud.points[11].getVector3fMap () << -1.05f, 5.01f, 1.0f; - cloud.points[12].getVector3fMap () << -1.01f, 5.05f, 2.0f; - cloud.points[13].getVector3fMap () << -1.05f, 5.01f, 3.0f; - cloud.points[14].getVector3fMap () << -1.01f, 5.05f, 4.0f; - cloud.points[15].getVector3fMap () << -1.05f, 5.01f, 5.0f; + cloud[10].getVector3fMap () << -1.00f, 5.00f, 0.0f; + cloud[11].getVector3fMap () << -1.05f, 5.01f, 1.0f; + cloud[12].getVector3fMap () << -1.01f, 5.05f, 2.0f; + cloud[13].getVector3fMap () << -1.05f, 5.01f, 3.0f; + cloud[14].getVector3fMap () << -1.01f, 5.05f, 4.0f; + cloud[15].getVector3fMap () << -1.05f, 5.01f, 5.0f; // Create a shared line model pointer directly const double eps = 0.1; //angle eps in radians @@ -209,8 +209,8 @@ TEST (SampleConsensusModelParallelLine, RANSAC) PointCloud proj_points; model->projectPoints (inliers, coeff, proj_points); - EXPECT_XYZ_NEAR (PointXYZ (-1.05, 5.05, 3.0), proj_points.points[13], 0.1); - EXPECT_XYZ_NEAR (PointXYZ (-1.05, 5.05, 4.0), proj_points.points[14], 0.1); + EXPECT_XYZ_NEAR (PointXYZ (-1.05, 5.05, 3.0), proj_points[13], 0.1); + EXPECT_XYZ_NEAR (PointXYZ (-1.05, 5.05, 4.0), proj_points[14], 0.1); } int diff --git a/test/sample_consensus/test_sample_consensus_plane_models.cpp b/test/sample_consensus/test_sample_consensus_plane_models.cpp index 381015031c1..5c954fec729 100644 --- a/test/sample_consensus/test_sample_consensus_plane_models.cpp +++ b/test/sample_consensus/test_sample_consensus_plane_models.cpp @@ -104,9 +104,9 @@ void verifyPlaneSac (ModelType& model, // Projection tests PointCloud proj_points; model->projectPoints (inliers, coeff_refined, proj_points); - EXPECT_XYZ_NEAR (PointXYZ (1.1266, 0.0152, -0.0156), proj_points.points[20], proj_tol); - EXPECT_XYZ_NEAR (PointXYZ (1.1843, -0.0635, -0.0201), proj_points.points[30], proj_tol); - EXPECT_XYZ_NEAR (PointXYZ (1.0749, -0.0586, 0.0587), proj_points.points[50], proj_tol); + EXPECT_XYZ_NEAR (PointXYZ (1.1266, 0.0152, -0.0156), proj_points[20], proj_tol); + EXPECT_XYZ_NEAR (PointXYZ (1.1843, -0.0635, -0.0201), proj_points[30], proj_tol); + EXPECT_XYZ_NEAR (PointXYZ (1.0749, -0.0586, 0.0587), proj_points[50], proj_tol); } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -252,13 +252,13 @@ TEST (SampleConsensusModelNormalParallelPlane, RANSAC) for (std::size_t idx = 0; idx < cloud.size (); ++idx) { - cloud.points[idx].x = static_cast ((rand () % 200) - 100); - cloud.points[idx].y = static_cast ((rand () % 200) - 100); - cloud.points[idx].z = 0.0f; + cloud[idx].x = static_cast ((rand () % 200) - 100); + cloud[idx].y = static_cast ((rand () % 200) - 100); + cloud[idx].z = 0.0f; - normals.points[idx].normal_x = 0.0f; - normals.points[idx].normal_y = 0.0f; - normals.points[idx].normal_z = 1.0f; + normals[idx].normal_x = 0.0f; + normals[idx].normal_y = 0.0f; + normals[idx].normal_z = 1.0f; } // Create a shared plane model pointer directly diff --git a/test/sample_consensus/test_sample_consensus_quadric_models.cpp b/test/sample_consensus/test_sample_consensus_quadric_models.cpp index e3ff89b66c0..80a114d3f21 100644 --- a/test/sample_consensus/test_sample_consensus_quadric_models.cpp +++ b/test/sample_consensus/test_sample_consensus_quadric_models.cpp @@ -63,16 +63,16 @@ TEST (SampleConsensusModelSphere, RANSAC) // Use a custom point cloud for these tests until we need something better PointCloud cloud; cloud.points.resize (10); - cloud.points[0].getVector3fMap () << 1.7068f, 1.0684f, 2.2147f; - cloud.points[1].getVector3fMap () << 2.4708f, 2.3081f, 1.1736f; - cloud.points[2].getVector3fMap () << 2.7609f, 1.9095f, 1.3574f; - cloud.points[3].getVector3fMap () << 2.8016f, 1.6704f, 1.5009f; - cloud.points[4].getVector3fMap () << 1.8517f, 2.0276f, 1.0112f; - cloud.points[5].getVector3fMap () << 1.8726f, 1.3539f, 2.7523f; - cloud.points[6].getVector3fMap () << 2.5179f, 2.3218f, 1.2074f; - cloud.points[7].getVector3fMap () << 2.4026f, 2.5114f, 2.7588f; - cloud.points[8].getVector3fMap () << 2.6999f, 2.5606f, 1.5571f; - cloud.points[9].getVector3fMap () << 0.0000f, 0.0000f, 0.0000f; + cloud[0].getVector3fMap () << 1.7068f, 1.0684f, 2.2147f; + cloud[1].getVector3fMap () << 2.4708f, 2.3081f, 1.1736f; + cloud[2].getVector3fMap () << 2.7609f, 1.9095f, 1.3574f; + cloud[3].getVector3fMap () << 2.8016f, 1.6704f, 1.5009f; + cloud[4].getVector3fMap () << 1.8517f, 2.0276f, 1.0112f; + cloud[5].getVector3fMap () << 1.8726f, 1.3539f, 2.7523f; + cloud[6].getVector3fMap () << 2.5179f, 2.3218f, 1.2074f; + cloud[7].getVector3fMap () << 2.4026f, 2.5114f, 2.7588f; + cloud[8].getVector3fMap () << 2.6999f, 2.5606f, 1.5571f; + cloud[9].getVector3fMap () << 0.0000f, 0.0000f, 0.0000f; // Create a shared sphere model pointer directly SampleConsensusModelSpherePtr model (new SampleConsensusModelSphere (cloud.makeShared ())); @@ -116,61 +116,61 @@ TEST (SampleConsensusModelNormalSphere, RANSAC) PointCloud cloud; PointCloud normals; cloud.points.resize (27); normals.points.resize (27); - cloud.points[ 0].getVector3fMap () << -0.014695f, 0.009549f, 0.954775f; - cloud.points[ 1].getVector3fMap () << 0.014695f, 0.009549f, 0.954775f; - cloud.points[ 2].getVector3fMap () << -0.014695f, 0.040451f, 0.954775f; - cloud.points[ 3].getVector3fMap () << 0.014695f, 0.040451f, 0.954775f; - cloud.points[ 4].getVector3fMap () << -0.009082f, -0.015451f, 0.972049f; - cloud.points[ 5].getVector3fMap () << 0.009082f, -0.015451f, 0.972049f; - cloud.points[ 6].getVector3fMap () << -0.038471f, 0.009549f, 0.972049f; - cloud.points[ 7].getVector3fMap () << 0.038471f, 0.009549f, 0.972049f; - cloud.points[ 8].getVector3fMap () << -0.038471f, 0.040451f, 0.972049f; - cloud.points[ 9].getVector3fMap () << 0.038471f, 0.040451f, 0.972049f; - cloud.points[10].getVector3fMap () << -0.009082f, 0.065451f, 0.972049f; - cloud.points[11].getVector3fMap () << 0.009082f, 0.065451f, 0.972049f; - cloud.points[12].getVector3fMap () << -0.023776f, -0.015451f, 0.982725f; - cloud.points[13].getVector3fMap () << 0.023776f, -0.015451f, 0.982725f; - cloud.points[14].getVector3fMap () << -0.023776f, 0.065451f, 0.982725f; - cloud.points[15].getVector3fMap () << 0.023776f, 0.065451f, 0.982725f; - cloud.points[16].getVector3fMap () << -0.000000f, -0.025000f, 1.000000f; - cloud.points[17].getVector3fMap () << 0.000000f, -0.025000f, 1.000000f; - cloud.points[18].getVector3fMap () << -0.029389f, -0.015451f, 1.000000f; - cloud.points[19].getVector3fMap () << 0.029389f, -0.015451f, 1.000000f; - cloud.points[20].getVector3fMap () << -0.047553f, 0.009549f, 1.000000f; - cloud.points[21].getVector3fMap () << 0.047553f, 0.009549f, 1.000000f; - cloud.points[22].getVector3fMap () << -0.047553f, 0.040451f, 1.000000f; - cloud.points[23].getVector3fMap () << 0.047553f, 0.040451f, 1.000000f; - cloud.points[24].getVector3fMap () << -0.029389f, 0.065451f, 1.000000f; - cloud.points[25].getVector3fMap () << 0.029389f, 0.065451f, 1.000000f; - cloud.points[26].getVector3fMap () << 0.000000f, 0.075000f, 1.000000f; - - normals.points[ 0].getNormalVector3fMap () << -0.293893f, -0.309017f, -0.904509f; - normals.points[ 1].getNormalVector3fMap () << 0.293893f, -0.309017f, -0.904508f; - normals.points[ 2].getNormalVector3fMap () << -0.293893f, 0.309017f, -0.904509f; - normals.points[ 3].getNormalVector3fMap () << 0.293893f, 0.309017f, -0.904508f; - normals.points[ 4].getNormalVector3fMap () << -0.181636f, -0.809017f, -0.559017f; - normals.points[ 5].getNormalVector3fMap () << 0.181636f, -0.809017f, -0.559017f; - normals.points[ 6].getNormalVector3fMap () << -0.769421f, -0.309017f, -0.559017f; - normals.points[ 7].getNormalVector3fMap () << 0.769421f, -0.309017f, -0.559017f; - normals.points[ 8].getNormalVector3fMap () << -0.769421f, 0.309017f, -0.559017f; - normals.points[ 9].getNormalVector3fMap () << 0.769421f, 0.309017f, -0.559017f; - normals.points[10].getNormalVector3fMap () << -0.181636f, 0.809017f, -0.559017f; - normals.points[11].getNormalVector3fMap () << 0.181636f, 0.809017f, -0.559017f; - normals.points[12].getNormalVector3fMap () << -0.475528f, -0.809017f, -0.345491f; - normals.points[13].getNormalVector3fMap () << 0.475528f, -0.809017f, -0.345491f; - normals.points[14].getNormalVector3fMap () << -0.475528f, 0.809017f, -0.345491f; - normals.points[15].getNormalVector3fMap () << 0.475528f, 0.809017f, -0.345491f; - normals.points[16].getNormalVector3fMap () << -0.000000f, -1.000000f, 0.000000f; - normals.points[17].getNormalVector3fMap () << 0.000000f, -1.000000f, 0.000000f; - normals.points[18].getNormalVector3fMap () << -0.587785f, -0.809017f, 0.000000f; - normals.points[19].getNormalVector3fMap () << 0.587785f, -0.809017f, 0.000000f; - normals.points[20].getNormalVector3fMap () << -0.951057f, -0.309017f, 0.000000f; - normals.points[21].getNormalVector3fMap () << 0.951057f, -0.309017f, 0.000000f; - normals.points[22].getNormalVector3fMap () << -0.951057f, 0.309017f, 0.000000f; - normals.points[23].getNormalVector3fMap () << 0.951057f, 0.309017f, 0.000000f; - normals.points[24].getNormalVector3fMap () << -0.587785f, 0.809017f, 0.000000f; - normals.points[25].getNormalVector3fMap () << 0.587785f, 0.809017f, 0.000000f; - normals.points[26].getNormalVector3fMap () << 0.000000f, 1.000000f, 0.000000f; + cloud[ 0].getVector3fMap () << -0.014695f, 0.009549f, 0.954775f; + cloud[ 1].getVector3fMap () << 0.014695f, 0.009549f, 0.954775f; + cloud[ 2].getVector3fMap () << -0.014695f, 0.040451f, 0.954775f; + cloud[ 3].getVector3fMap () << 0.014695f, 0.040451f, 0.954775f; + cloud[ 4].getVector3fMap () << -0.009082f, -0.015451f, 0.972049f; + cloud[ 5].getVector3fMap () << 0.009082f, -0.015451f, 0.972049f; + cloud[ 6].getVector3fMap () << -0.038471f, 0.009549f, 0.972049f; + cloud[ 7].getVector3fMap () << 0.038471f, 0.009549f, 0.972049f; + cloud[ 8].getVector3fMap () << -0.038471f, 0.040451f, 0.972049f; + cloud[ 9].getVector3fMap () << 0.038471f, 0.040451f, 0.972049f; + cloud[10].getVector3fMap () << -0.009082f, 0.065451f, 0.972049f; + cloud[11].getVector3fMap () << 0.009082f, 0.065451f, 0.972049f; + cloud[12].getVector3fMap () << -0.023776f, -0.015451f, 0.982725f; + cloud[13].getVector3fMap () << 0.023776f, -0.015451f, 0.982725f; + cloud[14].getVector3fMap () << -0.023776f, 0.065451f, 0.982725f; + cloud[15].getVector3fMap () << 0.023776f, 0.065451f, 0.982725f; + cloud[16].getVector3fMap () << -0.000000f, -0.025000f, 1.000000f; + cloud[17].getVector3fMap () << 0.000000f, -0.025000f, 1.000000f; + cloud[18].getVector3fMap () << -0.029389f, -0.015451f, 1.000000f; + cloud[19].getVector3fMap () << 0.029389f, -0.015451f, 1.000000f; + cloud[20].getVector3fMap () << -0.047553f, 0.009549f, 1.000000f; + cloud[21].getVector3fMap () << 0.047553f, 0.009549f, 1.000000f; + cloud[22].getVector3fMap () << -0.047553f, 0.040451f, 1.000000f; + cloud[23].getVector3fMap () << 0.047553f, 0.040451f, 1.000000f; + cloud[24].getVector3fMap () << -0.029389f, 0.065451f, 1.000000f; + cloud[25].getVector3fMap () << 0.029389f, 0.065451f, 1.000000f; + cloud[26].getVector3fMap () << 0.000000f, 0.075000f, 1.000000f; + + normals[ 0].getNormalVector3fMap () << -0.293893f, -0.309017f, -0.904509f; + normals[ 1].getNormalVector3fMap () << 0.293893f, -0.309017f, -0.904508f; + normals[ 2].getNormalVector3fMap () << -0.293893f, 0.309017f, -0.904509f; + normals[ 3].getNormalVector3fMap () << 0.293893f, 0.309017f, -0.904508f; + normals[ 4].getNormalVector3fMap () << -0.181636f, -0.809017f, -0.559017f; + normals[ 5].getNormalVector3fMap () << 0.181636f, -0.809017f, -0.559017f; + normals[ 6].getNormalVector3fMap () << -0.769421f, -0.309017f, -0.559017f; + normals[ 7].getNormalVector3fMap () << 0.769421f, -0.309017f, -0.559017f; + normals[ 8].getNormalVector3fMap () << -0.769421f, 0.309017f, -0.559017f; + normals[ 9].getNormalVector3fMap () << 0.769421f, 0.309017f, -0.559017f; + normals[10].getNormalVector3fMap () << -0.181636f, 0.809017f, -0.559017f; + normals[11].getNormalVector3fMap () << 0.181636f, 0.809017f, -0.559017f; + normals[12].getNormalVector3fMap () << -0.475528f, -0.809017f, -0.345491f; + normals[13].getNormalVector3fMap () << 0.475528f, -0.809017f, -0.345491f; + normals[14].getNormalVector3fMap () << -0.475528f, 0.809017f, -0.345491f; + normals[15].getNormalVector3fMap () << 0.475528f, 0.809017f, -0.345491f; + normals[16].getNormalVector3fMap () << -0.000000f, -1.000000f, 0.000000f; + normals[17].getNormalVector3fMap () << 0.000000f, -1.000000f, 0.000000f; + normals[18].getNormalVector3fMap () << -0.587785f, -0.809017f, 0.000000f; + normals[19].getNormalVector3fMap () << 0.587785f, -0.809017f, 0.000000f; + normals[20].getNormalVector3fMap () << -0.951057f, -0.309017f, 0.000000f; + normals[21].getNormalVector3fMap () << 0.951057f, -0.309017f, 0.000000f; + normals[22].getNormalVector3fMap () << -0.951057f, 0.309017f, 0.000000f; + normals[23].getNormalVector3fMap () << 0.951057f, 0.309017f, 0.000000f; + normals[24].getNormalVector3fMap () << -0.587785f, 0.809017f, 0.000000f; + normals[25].getNormalVector3fMap () << 0.587785f, 0.809017f, 0.000000f; + normals[26].getNormalVector3fMap () << 0.000000f, 1.000000f, 0.000000f; // Create a shared sphere model pointer directly SampleConsensusModelNormalSpherePtr model (new SampleConsensusModelNormalSphere (cloud.makeShared ())); @@ -217,69 +217,69 @@ TEST (SampleConsensusModelCone, RANSAC) PointCloud normals; cloud.points.resize (31); normals.points.resize (31); - cloud.points[ 0].getVector3fMap () << -0.011247f, 0.200000f, 0.965384f; - cloud.points[ 1].getVector3fMap () << 0.000000f, 0.200000f, 0.963603f; - cloud.points[ 2].getVector3fMap () << 0.011247f, 0.200000f, 0.965384f; - cloud.points[ 3].getVector3fMap () << -0.016045f, 0.175000f, 0.977916f; - cloud.points[ 4].getVector3fMap () << -0.008435f, 0.175000f, 0.974038f; - cloud.points[ 5].getVector3fMap () << 0.004218f, 0.175000f, 0.973370f; - cloud.points[ 6].getVector3fMap () << 0.016045f, 0.175000f, 0.977916f; - cloud.points[ 7].getVector3fMap () << -0.025420f, 0.200000f, 0.974580f; - cloud.points[ 8].getVector3fMap () << 0.025420f, 0.200000f, 0.974580f; - cloud.points[ 9].getVector3fMap () << -0.012710f, 0.150000f, 0.987290f; - cloud.points[10].getVector3fMap () << -0.005624f, 0.150000f, 0.982692f; - cloud.points[11].getVector3fMap () << 0.002812f, 0.150000f, 0.982247f; - cloud.points[12].getVector3fMap () << 0.012710f, 0.150000f, 0.987290f; - cloud.points[13].getVector3fMap () << -0.022084f, 0.175000f, 0.983955f; - cloud.points[14].getVector3fMap () << 0.022084f, 0.175000f, 0.983955f; - cloud.points[15].getVector3fMap () << -0.034616f, 0.200000f, 0.988753f; - cloud.points[16].getVector3fMap () << 0.034616f, 0.200000f, 0.988753f; - cloud.points[17].getVector3fMap () << -0.006044f, 0.125000f, 0.993956f; - cloud.points[18].getVector3fMap () << 0.004835f, 0.125000f, 0.993345f; - cloud.points[19].getVector3fMap () << -0.017308f, 0.150000f, 0.994376f; - cloud.points[20].getVector3fMap () << 0.017308f, 0.150000f, 0.994376f; - cloud.points[21].getVector3fMap () << -0.025962f, 0.175000f, 0.991565f; - cloud.points[22].getVector3fMap () << 0.025962f, 0.175000f, 0.991565f; - cloud.points[23].getVector3fMap () << -0.009099f, 0.125000f, 1.000000f; - cloud.points[24].getVector3fMap () << 0.009099f, 0.125000f, 1.000000f; - cloud.points[25].getVector3fMap () << -0.018199f, 0.150000f, 1.000000f; - cloud.points[26].getVector3fMap () << 0.018199f, 0.150000f, 1.000000f; - cloud.points[27].getVector3fMap () << -0.027298f, 0.175000f, 1.000000f; - cloud.points[28].getVector3fMap () << 0.027298f, 0.175000f, 1.000000f; - cloud.points[29].getVector3fMap () << -0.036397f, 0.200000f, 1.000000f; - cloud.points[30].getVector3fMap () << 0.036397f, 0.200000f, 1.000000f; - - normals.points[ 0].getNormalVector3fMap () << -0.290381f, -0.342020f, -0.893701f; - normals.points[ 1].getNormalVector3fMap () << 0.000000f, -0.342020f, -0.939693f; - normals.points[ 2].getNormalVector3fMap () << 0.290381f, -0.342020f, -0.893701f; - normals.points[ 3].getNormalVector3fMap () << -0.552338f, -0.342020f, -0.760227f; - normals.points[ 4].getNormalVector3fMap () << -0.290381f, -0.342020f, -0.893701f; - normals.points[ 5].getNormalVector3fMap () << 0.145191f, -0.342020f, -0.916697f; - normals.points[ 6].getNormalVector3fMap () << 0.552337f, -0.342020f, -0.760227f; - normals.points[ 7].getNormalVector3fMap () << -0.656282f, -0.342020f, -0.656283f; - normals.points[ 8].getNormalVector3fMap () << 0.656282f, -0.342020f, -0.656283f; - normals.points[ 9].getNormalVector3fMap () << -0.656283f, -0.342020f, -0.656282f; - normals.points[10].getNormalVector3fMap () << -0.290381f, -0.342020f, -0.893701f; - normals.points[11].getNormalVector3fMap () << 0.145191f, -0.342020f, -0.916697f; - normals.points[12].getNormalVector3fMap () << 0.656282f, -0.342020f, -0.656282f; - normals.points[13].getNormalVector3fMap () << -0.760228f, -0.342020f, -0.552337f; - normals.points[14].getNormalVector3fMap () << 0.760228f, -0.342020f, -0.552337f; - normals.points[15].getNormalVector3fMap () << -0.893701f, -0.342020f, -0.290380f; - normals.points[16].getNormalVector3fMap () << 0.893701f, -0.342020f, -0.290380f; - normals.points[17].getNormalVector3fMap () << -0.624162f, -0.342020f, -0.624162f; - normals.points[18].getNormalVector3fMap () << 0.499329f, -0.342020f, -0.687268f; - normals.points[19].getNormalVector3fMap () << -0.893701f, -0.342020f, -0.290380f; - normals.points[20].getNormalVector3fMap () << 0.893701f, -0.342020f, -0.290380f; - normals.points[21].getNormalVector3fMap () << -0.893701f, -0.342020f, -0.290381f; - normals.points[22].getNormalVector3fMap () << 0.893701f, -0.342020f, -0.290381f; - normals.points[23].getNormalVector3fMap () << -0.939693f, -0.342020f, 0.000000f; - normals.points[24].getNormalVector3fMap () << 0.939693f, -0.342020f, 0.000000f; - normals.points[25].getNormalVector3fMap () << -0.939693f, -0.342020f, 0.000000f; - normals.points[26].getNormalVector3fMap () << 0.939693f, -0.342020f, 0.000000f; - normals.points[27].getNormalVector3fMap () << -0.939693f, -0.342020f, 0.000000f; - normals.points[28].getNormalVector3fMap () << 0.939693f, -0.342020f, 0.000000f; - normals.points[29].getNormalVector3fMap () << -0.939693f, -0.342020f, 0.000000f; - normals.points[30].getNormalVector3fMap () << 0.939693f, -0.342020f, 0.000000f; + cloud[ 0].getVector3fMap () << -0.011247f, 0.200000f, 0.965384f; + cloud[ 1].getVector3fMap () << 0.000000f, 0.200000f, 0.963603f; + cloud[ 2].getVector3fMap () << 0.011247f, 0.200000f, 0.965384f; + cloud[ 3].getVector3fMap () << -0.016045f, 0.175000f, 0.977916f; + cloud[ 4].getVector3fMap () << -0.008435f, 0.175000f, 0.974038f; + cloud[ 5].getVector3fMap () << 0.004218f, 0.175000f, 0.973370f; + cloud[ 6].getVector3fMap () << 0.016045f, 0.175000f, 0.977916f; + cloud[ 7].getVector3fMap () << -0.025420f, 0.200000f, 0.974580f; + cloud[ 8].getVector3fMap () << 0.025420f, 0.200000f, 0.974580f; + cloud[ 9].getVector3fMap () << -0.012710f, 0.150000f, 0.987290f; + cloud[10].getVector3fMap () << -0.005624f, 0.150000f, 0.982692f; + cloud[11].getVector3fMap () << 0.002812f, 0.150000f, 0.982247f; + cloud[12].getVector3fMap () << 0.012710f, 0.150000f, 0.987290f; + cloud[13].getVector3fMap () << -0.022084f, 0.175000f, 0.983955f; + cloud[14].getVector3fMap () << 0.022084f, 0.175000f, 0.983955f; + cloud[15].getVector3fMap () << -0.034616f, 0.200000f, 0.988753f; + cloud[16].getVector3fMap () << 0.034616f, 0.200000f, 0.988753f; + cloud[17].getVector3fMap () << -0.006044f, 0.125000f, 0.993956f; + cloud[18].getVector3fMap () << 0.004835f, 0.125000f, 0.993345f; + cloud[19].getVector3fMap () << -0.017308f, 0.150000f, 0.994376f; + cloud[20].getVector3fMap () << 0.017308f, 0.150000f, 0.994376f; + cloud[21].getVector3fMap () << -0.025962f, 0.175000f, 0.991565f; + cloud[22].getVector3fMap () << 0.025962f, 0.175000f, 0.991565f; + cloud[23].getVector3fMap () << -0.009099f, 0.125000f, 1.000000f; + cloud[24].getVector3fMap () << 0.009099f, 0.125000f, 1.000000f; + cloud[25].getVector3fMap () << -0.018199f, 0.150000f, 1.000000f; + cloud[26].getVector3fMap () << 0.018199f, 0.150000f, 1.000000f; + cloud[27].getVector3fMap () << -0.027298f, 0.175000f, 1.000000f; + cloud[28].getVector3fMap () << 0.027298f, 0.175000f, 1.000000f; + cloud[29].getVector3fMap () << -0.036397f, 0.200000f, 1.000000f; + cloud[30].getVector3fMap () << 0.036397f, 0.200000f, 1.000000f; + + normals[ 0].getNormalVector3fMap () << -0.290381f, -0.342020f, -0.893701f; + normals[ 1].getNormalVector3fMap () << 0.000000f, -0.342020f, -0.939693f; + normals[ 2].getNormalVector3fMap () << 0.290381f, -0.342020f, -0.893701f; + normals[ 3].getNormalVector3fMap () << -0.552338f, -0.342020f, -0.760227f; + normals[ 4].getNormalVector3fMap () << -0.290381f, -0.342020f, -0.893701f; + normals[ 5].getNormalVector3fMap () << 0.145191f, -0.342020f, -0.916697f; + normals[ 6].getNormalVector3fMap () << 0.552337f, -0.342020f, -0.760227f; + normals[ 7].getNormalVector3fMap () << -0.656282f, -0.342020f, -0.656283f; + normals[ 8].getNormalVector3fMap () << 0.656282f, -0.342020f, -0.656283f; + normals[ 9].getNormalVector3fMap () << -0.656283f, -0.342020f, -0.656282f; + normals[10].getNormalVector3fMap () << -0.290381f, -0.342020f, -0.893701f; + normals[11].getNormalVector3fMap () << 0.145191f, -0.342020f, -0.916697f; + normals[12].getNormalVector3fMap () << 0.656282f, -0.342020f, -0.656282f; + normals[13].getNormalVector3fMap () << -0.760228f, -0.342020f, -0.552337f; + normals[14].getNormalVector3fMap () << 0.760228f, -0.342020f, -0.552337f; + normals[15].getNormalVector3fMap () << -0.893701f, -0.342020f, -0.290380f; + normals[16].getNormalVector3fMap () << 0.893701f, -0.342020f, -0.290380f; + normals[17].getNormalVector3fMap () << -0.624162f, -0.342020f, -0.624162f; + normals[18].getNormalVector3fMap () << 0.499329f, -0.342020f, -0.687268f; + normals[19].getNormalVector3fMap () << -0.893701f, -0.342020f, -0.290380f; + normals[20].getNormalVector3fMap () << 0.893701f, -0.342020f, -0.290380f; + normals[21].getNormalVector3fMap () << -0.893701f, -0.342020f, -0.290381f; + normals[22].getNormalVector3fMap () << 0.893701f, -0.342020f, -0.290381f; + normals[23].getNormalVector3fMap () << -0.939693f, -0.342020f, 0.000000f; + normals[24].getNormalVector3fMap () << 0.939693f, -0.342020f, 0.000000f; + normals[25].getNormalVector3fMap () << -0.939693f, -0.342020f, 0.000000f; + normals[26].getNormalVector3fMap () << 0.939693f, -0.342020f, 0.000000f; + normals[27].getNormalVector3fMap () << -0.939693f, -0.342020f, 0.000000f; + normals[28].getNormalVector3fMap () << 0.939693f, -0.342020f, 0.000000f; + normals[29].getNormalVector3fMap () << -0.939693f, -0.342020f, 0.000000f; + normals[30].getNormalVector3fMap () << 0.939693f, -0.342020f, 0.000000f; // Create a shared cylinder model pointer directly SampleConsensusModelConePtr model (new SampleConsensusModelCone (cloud.makeShared ())); @@ -323,47 +323,47 @@ TEST (SampleConsensusModelCylinder, RANSAC) PointCloud normals; cloud.points.resize (20); normals.points.resize (20); - cloud.points[ 0].getVector3fMap () << -0.499902f, 2.199701f, 0.000008f; - cloud.points[ 1].getVector3fMap () << -0.875397f, 2.030177f, 0.050104f; - cloud.points[ 2].getVector3fMap () << -0.995875f, 1.635973f, 0.099846f; - cloud.points[ 3].getVector3fMap () << -0.779523f, 1.285527f, 0.149961f; - cloud.points[ 4].getVector3fMap () << -0.373285f, 1.216488f, 0.199959f; - cloud.points[ 5].getVector3fMap () << -0.052893f, 1.475973f, 0.250101f; - cloud.points[ 6].getVector3fMap () << -0.036558f, 1.887591f, 0.299839f; - cloud.points[ 7].getVector3fMap () << -0.335048f, 2.171994f, 0.350001f; - cloud.points[ 8].getVector3fMap () << -0.745456f, 2.135528f, 0.400072f; - cloud.points[ 9].getVector3fMap () << -0.989282f, 1.803311f, 0.449983f; - cloud.points[10].getVector3fMap () << -0.900651f, 1.400701f, 0.500126f; - cloud.points[11].getVector3fMap () << -0.539658f, 1.201468f, 0.550079f; - cloud.points[12].getVector3fMap () << -0.151875f, 1.340951f, 0.599983f; - cloud.points[13].getVector3fMap () << -0.000724f, 1.724373f, 0.649882f; - cloud.points[14].getVector3fMap () << -0.188573f, 2.090983f, 0.699854f; - cloud.points[15].getVector3fMap () << -0.587925f, 2.192257f, 0.749956f; - cloud.points[16].getVector3fMap () << -0.927724f, 1.958846f, 0.800008f; - cloud.points[17].getVector3fMap () << -0.976888f, 1.549655f, 0.849970f; - cloud.points[18].getVector3fMap () << -0.702003f, 1.242707f, 0.899954f; - cloud.points[19].getVector3fMap () << -0.289916f, 1.246296f, 0.950075f; - - normals.points[ 0].getNormalVector3fMap () << 0.000098f, 1.000098f, 0.000008f; - normals.points[ 1].getNormalVector3fMap () << -0.750891f, 0.660413f, 0.000104f; - normals.points[ 2].getNormalVector3fMap () << -0.991765f, -0.127949f, -0.000154f; - normals.points[ 3].getNormalVector3fMap () << -0.558918f, -0.829439f, -0.000039f; - normals.points[ 4].getNormalVector3fMap () << 0.253627f, -0.967447f, -0.000041f; - normals.points[ 5].getNormalVector3fMap () << 0.894105f, -0.447965f, 0.000101f; - normals.points[ 6].getNormalVector3fMap () << 0.926852f, 0.375543f, -0.000161f; - normals.points[ 7].getNormalVector3fMap () << 0.329948f, 0.943941f, 0.000001f; - normals.points[ 8].getNormalVector3fMap () << -0.490966f, 0.871203f, 0.000072f; - normals.points[ 9].getNormalVector3fMap () << -0.978507f, 0.206425f, -0.000017f; - normals.points[10].getNormalVector3fMap () << -0.801227f, -0.598534f, 0.000126f; - normals.points[11].getNormalVector3fMap () << -0.079447f, -0.996697f, 0.000079f; - normals.points[12].getNormalVector3fMap () << 0.696154f, -0.717889f, -0.000017f; - normals.points[13].getNormalVector3fMap () << 0.998685f, 0.048502f, -0.000118f; - normals.points[14].getNormalVector3fMap () << 0.622933f, 0.782133f, -0.000146f; - normals.points[15].getNormalVector3fMap () << -0.175948f, 0.984480f, -0.000044f; - normals.points[16].getNormalVector3fMap () << -0.855476f, 0.517824f, 0.000008f; - normals.points[17].getNormalVector3fMap () << -0.953769f, -0.300571f, -0.000030f; - normals.points[18].getNormalVector3fMap () << -0.404035f, -0.914700f, -0.000046f; - normals.points[19].getNormalVector3fMap () << 0.420154f, -0.907445f, 0.000075f; + cloud[ 0].getVector3fMap () << -0.499902f, 2.199701f, 0.000008f; + cloud[ 1].getVector3fMap () << -0.875397f, 2.030177f, 0.050104f; + cloud[ 2].getVector3fMap () << -0.995875f, 1.635973f, 0.099846f; + cloud[ 3].getVector3fMap () << -0.779523f, 1.285527f, 0.149961f; + cloud[ 4].getVector3fMap () << -0.373285f, 1.216488f, 0.199959f; + cloud[ 5].getVector3fMap () << -0.052893f, 1.475973f, 0.250101f; + cloud[ 6].getVector3fMap () << -0.036558f, 1.887591f, 0.299839f; + cloud[ 7].getVector3fMap () << -0.335048f, 2.171994f, 0.350001f; + cloud[ 8].getVector3fMap () << -0.745456f, 2.135528f, 0.400072f; + cloud[ 9].getVector3fMap () << -0.989282f, 1.803311f, 0.449983f; + cloud[10].getVector3fMap () << -0.900651f, 1.400701f, 0.500126f; + cloud[11].getVector3fMap () << -0.539658f, 1.201468f, 0.550079f; + cloud[12].getVector3fMap () << -0.151875f, 1.340951f, 0.599983f; + cloud[13].getVector3fMap () << -0.000724f, 1.724373f, 0.649882f; + cloud[14].getVector3fMap () << -0.188573f, 2.090983f, 0.699854f; + cloud[15].getVector3fMap () << -0.587925f, 2.192257f, 0.749956f; + cloud[16].getVector3fMap () << -0.927724f, 1.958846f, 0.800008f; + cloud[17].getVector3fMap () << -0.976888f, 1.549655f, 0.849970f; + cloud[18].getVector3fMap () << -0.702003f, 1.242707f, 0.899954f; + cloud[19].getVector3fMap () << -0.289916f, 1.246296f, 0.950075f; + + normals[ 0].getNormalVector3fMap () << 0.000098f, 1.000098f, 0.000008f; + normals[ 1].getNormalVector3fMap () << -0.750891f, 0.660413f, 0.000104f; + normals[ 2].getNormalVector3fMap () << -0.991765f, -0.127949f, -0.000154f; + normals[ 3].getNormalVector3fMap () << -0.558918f, -0.829439f, -0.000039f; + normals[ 4].getNormalVector3fMap () << 0.253627f, -0.967447f, -0.000041f; + normals[ 5].getNormalVector3fMap () << 0.894105f, -0.447965f, 0.000101f; + normals[ 6].getNormalVector3fMap () << 0.926852f, 0.375543f, -0.000161f; + normals[ 7].getNormalVector3fMap () << 0.329948f, 0.943941f, 0.000001f; + normals[ 8].getNormalVector3fMap () << -0.490966f, 0.871203f, 0.000072f; + normals[ 9].getNormalVector3fMap () << -0.978507f, 0.206425f, -0.000017f; + normals[10].getNormalVector3fMap () << -0.801227f, -0.598534f, 0.000126f; + normals[11].getNormalVector3fMap () << -0.079447f, -0.996697f, 0.000079f; + normals[12].getNormalVector3fMap () << 0.696154f, -0.717889f, -0.000017f; + normals[13].getNormalVector3fMap () << 0.998685f, 0.048502f, -0.000118f; + normals[14].getNormalVector3fMap () << 0.622933f, 0.782133f, -0.000146f; + normals[15].getNormalVector3fMap () << -0.175948f, 0.984480f, -0.000044f; + normals[16].getNormalVector3fMap () << -0.855476f, 0.517824f, 0.000008f; + normals[17].getNormalVector3fMap () << -0.953769f, -0.300571f, -0.000030f; + normals[18].getNormalVector3fMap () << -0.404035f, -0.914700f, -0.000046f; + normals[19].getNormalVector3fMap () << 0.420154f, -0.907445f, 0.000075f; // Create a shared cylinder model pointer directly SampleConsensusModelCylinderPtr model (new SampleConsensusModelCylinder (cloud.makeShared ())); @@ -406,24 +406,24 @@ TEST (SampleConsensusModelCircle2D, RANSAC) PointCloud cloud; cloud.points.resize (18); - cloud.points[ 0].getVector3fMap () << 3.587751f, -4.190982f, 0.0f; - cloud.points[ 1].getVector3fMap () << 3.808883f, -4.412265f, 0.0f; - cloud.points[ 2].getVector3fMap () << 3.587525f, -5.809143f, 0.0f; - cloud.points[ 3].getVector3fMap () << 2.999913f, -5.999980f, 0.0f; - cloud.points[ 4].getVector3fMap () << 2.412224f, -5.809090f, 0.0f; - cloud.points[ 5].getVector3fMap () << 2.191080f, -5.587682f, 0.0f; - cloud.points[ 6].getVector3fMap () << 2.048941f, -5.309003f, 0.0f; - cloud.points[ 7].getVector3fMap () << 2.000397f, -4.999944f, 0.0f; - cloud.points[ 8].getVector3fMap () << 2.999953f, -6.000056f, 0.0f; - cloud.points[ 9].getVector3fMap () << 2.691127f, -5.951136f, 0.0f; - cloud.points[10].getVector3fMap () << 2.190892f, -5.587838f, 0.0f; - cloud.points[11].getVector3fMap () << 2.048874f, -5.309052f, 0.0f; - cloud.points[12].getVector3fMap () << 1.999990f, -5.000147f, 0.0f; - cloud.points[13].getVector3fMap () << 2.049026f, -4.690918f, 0.0f; - cloud.points[14].getVector3fMap () << 2.190956f, -4.412162f, 0.0f; - cloud.points[15].getVector3fMap () << 2.412231f, -4.190918f, 0.0f; - cloud.points[16].getVector3fMap () << 2.691027f, -4.049060f, 0.0f; - cloud.points[17].getVector3fMap () << 2.000000f, -3.000000f, 0.0f; + cloud[ 0].getVector3fMap () << 3.587751f, -4.190982f, 0.0f; + cloud[ 1].getVector3fMap () << 3.808883f, -4.412265f, 0.0f; + cloud[ 2].getVector3fMap () << 3.587525f, -5.809143f, 0.0f; + cloud[ 3].getVector3fMap () << 2.999913f, -5.999980f, 0.0f; + cloud[ 4].getVector3fMap () << 2.412224f, -5.809090f, 0.0f; + cloud[ 5].getVector3fMap () << 2.191080f, -5.587682f, 0.0f; + cloud[ 6].getVector3fMap () << 2.048941f, -5.309003f, 0.0f; + cloud[ 7].getVector3fMap () << 2.000397f, -4.999944f, 0.0f; + cloud[ 8].getVector3fMap () << 2.999953f, -6.000056f, 0.0f; + cloud[ 9].getVector3fMap () << 2.691127f, -5.951136f, 0.0f; + cloud[10].getVector3fMap () << 2.190892f, -5.587838f, 0.0f; + cloud[11].getVector3fMap () << 2.048874f, -5.309052f, 0.0f; + cloud[12].getVector3fMap () << 1.999990f, -5.000147f, 0.0f; + cloud[13].getVector3fMap () << 2.049026f, -4.690918f, 0.0f; + cloud[14].getVector3fMap () << 2.190956f, -4.412162f, 0.0f; + cloud[15].getVector3fMap () << 2.412231f, -4.190918f, 0.0f; + cloud[16].getVector3fMap () << 2.691027f, -4.049060f, 0.0f; + cloud[17].getVector3fMap () << 2.000000f, -3.000000f, 0.0f; // Create a shared 2d circle model pointer directly SampleConsensusModelCircle2DPtr model (new SampleConsensusModelCircle2D (cloud.makeShared ())); @@ -467,26 +467,26 @@ TEST (SampleConsensusModelCircle3D, RANSAC) PointCloud cloud; cloud.points.resize (20); - cloud.points[ 0].getVector3fMap () << 1.00000000f, 5.0000000f, -2.9000001f; - cloud.points[ 1].getVector3fMap () << 1.03420200f, 5.0000000f, -2.9060307f; - cloud.points[ 2].getVector3fMap () << 1.06427870f, 5.0000000f, -2.9233956f; - cloud.points[ 3].getVector3fMap () << 1.08660260f, 5.0000000f, -2.9500000f; - cloud.points[ 4].getVector3fMap () << 1.09848080f, 5.0000000f, -2.9826353f; - cloud.points[ 5].getVector3fMap () << 1.09848080f, 5.0000000f, -3.0173647f; - cloud.points[ 6].getVector3fMap () << 1.08660260f, 5.0000000f, -3.0500000f; - cloud.points[ 7].getVector3fMap () << 1.06427870f, 5.0000000f, -3.0766044f; - cloud.points[ 8].getVector3fMap () << 1.03420200f, 5.0000000f, -3.0939693f; - cloud.points[ 9].getVector3fMap () << 1.00000000f, 5.0000000f, -3.0999999f; - cloud.points[10].getVector3fMap () << 0.96579796f, 5.0000000f, -3.0939693f; - cloud.points[11].getVector3fMap () << 0.93572122f, 5.0000000f, -3.0766044f; - cloud.points[12].getVector3fMap () << 0.91339743f, 5.0000000f, -3.0500000f; - cloud.points[13].getVector3fMap () << 0.90151924f, 5.0000000f, -3.0173647f; - cloud.points[14].getVector3fMap () << 0.90151924f, 5.0000000f, -2.9826353f; - cloud.points[15].getVector3fMap () << 0.91339743f, 5.0000000f, -2.9500000f; - cloud.points[16].getVector3fMap () << 0.93572122f, 5.0000000f, -2.9233956f; - cloud.points[17].getVector3fMap () << 0.96579796f, 5.0000000f, -2.9060307f; - cloud.points[18].getVector3fMap () << 0.85000002f, 4.8499999f, -3.1500001f; - cloud.points[19].getVector3fMap () << 1.15000000f, 5.1500001f, -2.8499999f; + cloud[ 0].getVector3fMap () << 1.00000000f, 5.0000000f, -2.9000001f; + cloud[ 1].getVector3fMap () << 1.03420200f, 5.0000000f, -2.9060307f; + cloud[ 2].getVector3fMap () << 1.06427870f, 5.0000000f, -2.9233956f; + cloud[ 3].getVector3fMap () << 1.08660260f, 5.0000000f, -2.9500000f; + cloud[ 4].getVector3fMap () << 1.09848080f, 5.0000000f, -2.9826353f; + cloud[ 5].getVector3fMap () << 1.09848080f, 5.0000000f, -3.0173647f; + cloud[ 6].getVector3fMap () << 1.08660260f, 5.0000000f, -3.0500000f; + cloud[ 7].getVector3fMap () << 1.06427870f, 5.0000000f, -3.0766044f; + cloud[ 8].getVector3fMap () << 1.03420200f, 5.0000000f, -3.0939693f; + cloud[ 9].getVector3fMap () << 1.00000000f, 5.0000000f, -3.0999999f; + cloud[10].getVector3fMap () << 0.96579796f, 5.0000000f, -3.0939693f; + cloud[11].getVector3fMap () << 0.93572122f, 5.0000000f, -3.0766044f; + cloud[12].getVector3fMap () << 0.91339743f, 5.0000000f, -3.0500000f; + cloud[13].getVector3fMap () << 0.90151924f, 5.0000000f, -3.0173647f; + cloud[14].getVector3fMap () << 0.90151924f, 5.0000000f, -2.9826353f; + cloud[15].getVector3fMap () << 0.91339743f, 5.0000000f, -2.9500000f; + cloud[16].getVector3fMap () << 0.93572122f, 5.0000000f, -2.9233956f; + cloud[17].getVector3fMap () << 0.96579796f, 5.0000000f, -2.9060307f; + cloud[18].getVector3fMap () << 0.85000002f, 4.8499999f, -3.1500001f; + cloud[19].getVector3fMap () << 1.15000000f, 5.1500001f, -2.8499999f; // Create a shared 3d circle model pointer directly SampleConsensusModelCircle3DPtr model (new SampleConsensusModelCircle3D (cloud.makeShared ())); diff --git a/test/search/test_flann_search.cpp b/test/search/test_flann_search.cpp index c2833097225..4ef4d33c6b1 100644 --- a/test/search/test_flann_search.cpp +++ b/test/search/test_flann_search.cpp @@ -83,7 +83,7 @@ TEST (PCL, FlannSearch_nearestKSearch) multimap sorted_brute_force_result; for (std::size_t i = 0; i < cloud.points.size (); ++i) { - float distance = euclideanDistance (cloud.points[i], test_point); + float distance = euclideanDistance (cloud[i], test_point); sorted_brute_force_result.insert (make_pair (distance, int (i))); } float max_dist = 0.0f; @@ -108,7 +108,7 @@ TEST (PCL, FlannSearch_nearestKSearch) // Check if all found neighbors have distance smaller than max_dist for (const int &k_index : k_indices) { - const PointXYZ& point = cloud.points[k_index]; + const PointXYZ& point = cloud[k_index]; bool ok = euclideanDistance (test_point, point) <= max_dist; if (!ok) ok = (std::abs (euclideanDistance (test_point, point)) - max_dist) <= 1e-6; @@ -159,8 +159,8 @@ TEST (PCL, FlannSearch_differentPointT) for (std::size_t i = 0; i < cloud_rgb.points.size (); ++i) { - //FlannSearch.nearestKSearchT (cloud_rgb.points[i], no_of_neighbors, k_indices_t, k_distances_t); - FlannSearch.nearestKSearch (cloud_big.points[i], no_of_neighbors, k_indices, k_distances); + //FlannSearch.nearestKSearchT (cloud_rgb[i], no_of_neighbors, k_indices_t, k_distances_t); + FlannSearch.nearestKSearch (cloud_big[i], no_of_neighbors, k_indices, k_distances); EXPECT_EQ (k_indices.size (), indices[i].size ()); EXPECT_EQ (k_distances.size (), dists[i].size ()); for (std::size_t j = 0; j< no_of_neighbors; j++) @@ -195,7 +195,7 @@ TEST (PCL, FlannSearch_multipointKnnSearch) for (std::size_t i = 0; i < cloud_big.points.size (); ++i) { - FlannSearch.nearestKSearch (cloud_big.points[i], no_of_neighbors, k_indices, k_distances); + FlannSearch.nearestKSearch (cloud_big[i], no_of_neighbors, k_indices, k_distances); EXPECT_EQ (k_indices.size (), indices[i].size ()); EXPECT_EQ (k_distances.size (), dists[i].size ()); for (std::size_t j = 0; j< no_of_neighbors; j++ ) diff --git a/test/search/test_kdtree.cpp b/test/search/test_kdtree.cpp index 6c73feb172d..5339661ccbc 100644 --- a/test/search/test_kdtree.cpp +++ b/test/search/test_kdtree.cpp @@ -78,7 +78,7 @@ init () multimap sorted_brute_force_result; for (std::size_t i = 0; i < cloud.points.size (); ++i) { - float distance = euclideanDistance (cloud.points[i], test_point); + float distance = euclideanDistance (cloud[i], test_point); sorted_brute_force_result.insert (make_pair (distance, static_cast (i))); } float max_dist = 0.0f; @@ -103,7 +103,7 @@ init () // Check if all found neighbors have distance smaller than max_dist for (const int &k_index : k_indices) { - const PointXYZ& point = cloud.points[k_index]; + const PointXYZ& point = cloud[k_index]; bool ok = euclideanDistance (test_point, point) <= max_dist; if (!ok) ok = (std::abs (euclideanDistance (test_point, point)) - max_dist) <= 1e-6; @@ -152,8 +152,8 @@ TEST (PCL, KdTree_differentPointT) for (std::size_t i = 0; i < cloud_rgb.points.size (); ++i) { - kdtree.nearestKSearchT (cloud_rgb.points[i], no_of_neighbors, k_indices_t, k_distances_t); - kdtree.nearestKSearch (cloud_big.points[i], no_of_neighbors, k_indices, k_distances); + kdtree.nearestKSearchT (cloud_rgb[i], no_of_neighbors, k_indices_t, k_distances_t); + kdtree.nearestKSearch (cloud_big[i], no_of_neighbors, k_indices, k_distances); EXPECT_EQ (k_indices.size (), indices[i].size ()); EXPECT_EQ (k_distances.size (), dists[i].size ()); for (std::size_t j=0; j< no_of_neighbors; j++) @@ -185,7 +185,7 @@ TEST (PCL, KdTree_multipointKnnSearch) for (std::size_t i = 0; i < cloud_big.points.size (); ++i) { - kdtree.nearestKSearch (cloud_big.points[i], no_of_neighbors, k_indices, k_distances); + kdtree.nearestKSearch (cloud_big[i], no_of_neighbors, k_indices, k_distances); EXPECT_EQ (k_indices.size (), indices[i].size ()); EXPECT_EQ (k_distances.size (), dists[i].size ()); for (std::size_t j=0; j< no_of_neighbors; j++) diff --git a/test/segmentation/test_segmentation.cpp b/test/segmentation/test_segmentation.cpp index 5121ecc57bb..0f892c31a36 100644 --- a/test/segmentation/test_segmentation.cpp +++ b/test/segmentation/test_segmentation.cpp @@ -421,7 +421,7 @@ main (int argc, char** argv) // Tranpose the cloud cloud_t = cloud; for (std::size_t i = 0; i < cloud.points.size (); ++i) - cloud_t.points[i].x += 0.01f; + cloud_t[i].x += 0.01f; cloud_ = cloud.makeShared (); cloud_t_ = cloud_t.makeShared (); diff --git a/test/surface/test_concave_hull.cpp b/test/surface/test_concave_hull.cpp index 7c56b22c6f4..67d8718e87a 100644 --- a/test/surface/test_concave_hull.cpp +++ b/test/surface/test_concave_hull.cpp @@ -215,9 +215,9 @@ TEST (PCL, ConcaveHull_LTable) { for (std::size_t j = 0; j <= 2; j++) { - cloud_out_ltable.points[npoints].x = float (i) * 0.5f; - cloud_out_ltable.points[npoints].y = -float (j) * 0.5f; - cloud_out_ltable.points[npoints].z = 0.f; + cloud_out_ltable[npoints].x = float (i) * 0.5f; + cloud_out_ltable[npoints].y = -float (j) * 0.5f; + cloud_out_ltable[npoints].z = 0.f; npoints++; } } @@ -226,9 +226,9 @@ TEST (PCL, ConcaveHull_LTable) { for(std::size_t j = 3; j < 8; j++) { - cloud_out_ltable.points[npoints].x = float (i) * 0.5f; - cloud_out_ltable.points[npoints].y = -float (j) * 0.5f; - cloud_out_ltable.points[npoints].z = 0.f; + cloud_out_ltable[npoints].x = float (i) * 0.5f; + cloud_out_ltable[npoints].y = -float (j) * 0.5f; + cloud_out_ltable[npoints].z = 0.f; npoints++; } } diff --git a/test/surface/test_convex_hull.cpp b/test/surface/test_convex_hull.cpp index cccc78f948b..6e88471994f 100644 --- a/test/surface/test_convex_hull.cpp +++ b/test/surface/test_convex_hull.cpp @@ -129,8 +129,8 @@ TEST (PCL, ConvexHull_bunny) ASSERT_EQ (hull.points.size (), hull2.points.size ()); for (std::size_t i = 0; i < hull.points.size (); ++i) { - const PointXYZ & p1 = hull.points[i]; - const PointXYZ & p2 = hull2.points[i]; + const PointXYZ & p1 = hull[i]; + const PointXYZ & p2 = hull2[i]; ASSERT_EQ (p1.x, p2.x); ASSERT_EQ (p1.y, p2.y); ASSERT_EQ (p1.z, p2.z); @@ -196,9 +196,9 @@ TEST (PCL, ConvexHull_LTable) { for (std::size_t j = 0; j <= 2; j++) { - cloud_out_ltable.points[npoints].x = float (i) * 0.5f; - cloud_out_ltable.points[npoints].y = -float (j) * 0.5f; - cloud_out_ltable.points[npoints].z = 0.f; + cloud_out_ltable[npoints].x = float (i) * 0.5f; + cloud_out_ltable[npoints].y = -float (j) * 0.5f; + cloud_out_ltable[npoints].z = 0.f; npoints++; } } @@ -207,37 +207,37 @@ TEST (PCL, ConvexHull_LTable) { for (std::size_t j = 3; j < 8; j++) { - cloud_out_ltable.points[npoints].x = float (i) * 0.5f; - cloud_out_ltable.points[npoints].y = -float (j) * 0.5f; - cloud_out_ltable.points[npoints].z = 0.f; + cloud_out_ltable[npoints].x = float (i) * 0.5f; + cloud_out_ltable[npoints].y = -float (j) * 0.5f; + cloud_out_ltable[npoints].z = 0.f; npoints++; } } // add the five points on the hull - cloud_out_ltable.points[npoints].x = -0.5f; - cloud_out_ltable.points[npoints].y = 0.5f; - cloud_out_ltable.points[npoints].z = 0.f; + cloud_out_ltable[npoints].x = -0.5f; + cloud_out_ltable[npoints].y = 0.5f; + cloud_out_ltable[npoints].z = 0.f; npoints++; - cloud_out_ltable.points[npoints].x = 4.5f; - cloud_out_ltable.points[npoints].y = 0.5f; - cloud_out_ltable.points[npoints].z = 0.f; + cloud_out_ltable[npoints].x = 4.5f; + cloud_out_ltable[npoints].y = 0.5f; + cloud_out_ltable[npoints].z = 0.f; npoints++; - cloud_out_ltable.points[npoints].x = 4.5f; - cloud_out_ltable.points[npoints].y = -1.0f; - cloud_out_ltable.points[npoints].z = 0.f; + cloud_out_ltable[npoints].x = 4.5f; + cloud_out_ltable[npoints].y = -1.0f; + cloud_out_ltable[npoints].z = 0.f; npoints++; - cloud_out_ltable.points[npoints].x = 1.0f; - cloud_out_ltable.points[npoints].y = -4.5f; - cloud_out_ltable.points[npoints].z = 0.f; + cloud_out_ltable[npoints].x = 1.0f; + cloud_out_ltable[npoints].y = -4.5f; + cloud_out_ltable[npoints].z = 0.f; npoints++; - cloud_out_ltable.points[npoints].x = -0.5f; - cloud_out_ltable.points[npoints].y = -4.5f; - cloud_out_ltable.points[npoints].z = 0.f; + cloud_out_ltable[npoints].x = -0.5f; + cloud_out_ltable[npoints].y = -4.5f; + cloud_out_ltable[npoints].z = 0.f; npoints++; cloud_out_ltable.points.resize (npoints); @@ -291,8 +291,8 @@ TEST (PCL, ConvexHull_LTable) ASSERT_EQ (hull.points.size (), hull2.points.size ()); for (std::size_t i = 0; i < hull.points.size (); ++i) { - const PointXYZ & p1 = hull.points[i]; - const PointXYZ & p2 = hull2.points[i]; + const PointXYZ & p1 = hull[i]; + const PointXYZ & p2 = hull2[i]; ASSERT_EQ (p1.x, p2.x); ASSERT_EQ (p1.y, p2.y); ASSERT_EQ (p1.z, p2.z); diff --git a/test/surface/test_marching_cubes.cpp b/test/surface/test_marching_cubes.cpp index 319afc4ffd7..6a86296cbae 100644 --- a/test/surface/test_marching_cubes.cpp +++ b/test/surface/test_marching_cubes.cpp @@ -76,9 +76,9 @@ TEST (PCL, MarchingCubesTest) std::vector vertices; hoppe.reconstruct (points, vertices); - EXPECT_NEAR (points.points[points.size()/2].x, -0.037143, 1e-3); - EXPECT_NEAR (points.points[points.size()/2].y, 0.098213, 1e-3); - EXPECT_NEAR (points.points[points.size()/2].z, -0.044911, 1e-3); + EXPECT_NEAR (points[points.size()/2].x, -0.037143, 1e-3); + EXPECT_NEAR (points[points.size()/2].y, 0.098213, 1e-3); + EXPECT_NEAR (points[points.size()/2].z, -0.044911, 1e-3); EXPECT_EQ (vertices[vertices.size ()/2].vertices[0], 11202); EXPECT_EQ (vertices[vertices.size ()/2].vertices[1], 11203); EXPECT_EQ (vertices[vertices.size ()/2].vertices[2], 11204); @@ -92,9 +92,9 @@ TEST (PCL, MarchingCubesTest) rbf.setOffSurfaceDisplacement (0.02f); rbf.reconstruct (points, vertices); - EXPECT_NEAR (points.points[points.size()/2].x, -0.025630, 1e-3); - EXPECT_NEAR (points.points[points.size()/2].y, 0.135228, 1e-3); - EXPECT_NEAR (points.points[points.size()/2].z, 0.035766, 1e-3); + EXPECT_NEAR (points[points.size()/2].x, -0.025630, 1e-3); + EXPECT_NEAR (points[points.size()/2].y, 0.135228, 1e-3); + EXPECT_NEAR (points[points.size()/2].z, 0.035766, 1e-3); EXPECT_EQ (vertices[vertices.size ()/2].vertices[0], 4275); EXPECT_EQ (vertices[vertices.size ()/2].vertices[1], 4276); EXPECT_EQ (vertices[vertices.size ()/2].vertices[2], 4277); diff --git a/tools/image_viewer.cpp b/tools/image_viewer.cpp index a01a510a82f..80869c812a4 100644 --- a/tools/image_viewer.cpp +++ b/tools/image_viewer.cpp @@ -64,7 +64,7 @@ main (int, char ** argv) float* img = new float[cloud.width * cloud.height]; for (int i = 0; i < static_cast (xyz.points.size ()); ++i) - img[i] = xyz.points[i].z; + img[i] = xyz[i].z; depth_image_viewer_.showFloatImage (img, cloud.width, cloud.height, diff --git a/tools/mesh_sampling.cpp b/tools/mesh_sampling.cpp index 23f98d7c1d0..681cde1dd2f 100644 --- a/tools/mesh_sampling.cpp +++ b/tools/mesh_sampling.cpp @@ -159,20 +159,20 @@ uniform_sampling (vtkSmartPointer polydata, std::size_t n_samples, Eigen::Vector3f n (0, 0, 0); Eigen::Vector3f c (0, 0, 0); randPSurface (polydata, &cumulativeAreas, totalArea, p, calc_normal, n, calc_color, c); - cloud_out.points[i].x = p[0]; - cloud_out.points[i].y = p[1]; - cloud_out.points[i].z = p[2]; + cloud_out[i].x = p[0]; + cloud_out[i].y = p[1]; + cloud_out[i].z = p[2]; if (calc_normal) { - cloud_out.points[i].normal_x = n[0]; - cloud_out.points[i].normal_y = n[1]; - cloud_out.points[i].normal_z = n[2]; + cloud_out[i].normal_x = n[0]; + cloud_out[i].normal_y = n[1]; + cloud_out[i].normal_z = n[2]; } if (calc_color) { - cloud_out.points[i].r = static_cast(c[0]); - cloud_out.points[i].g = static_cast(c[1]); - cloud_out.points[i].b = static_cast(c[2]); + cloud_out[i].r = static_cast(c[0]); + cloud_out[i].g = static_cast(c[1]); + cloud_out[i].b = static_cast(c[2]); } } } diff --git a/tools/obj_rec_ransac_result.cpp b/tools/obj_rec_ransac_result.cpp index 15187307ed3..dcd9adeb9da 100644 --- a/tools/obj_rec_ransac_result.cpp +++ b/tools/obj_rec_ransac_result.cpp @@ -355,13 +355,13 @@ loadScene (const char* file_name, PointCloud& non_plane_points, PointC { if ( static_cast (id) == inliers->indices[i] ) { - plane_points.points[i] = all_points->points[id]; + plane_points[i] = all_points->points[id]; ++i; } else { - non_plane_points.points[j] = all_points->points[id]; - non_plane_normals.points[j] = all_normals->points[id]; + non_plane_points[j] = all_points->points[id]; + non_plane_normals[j] = all_normals->points[id]; ++j; } ++id; @@ -370,8 +370,8 @@ loadScene (const char* file_name, PointCloud& non_plane_points, PointC // Just copy the rest of the non-plane points for ( std::size_t id = inliers->indices.size (); id < all_points->size () ; ++id, ++j ) { - non_plane_points.points[j] = all_points->points[id]; - non_plane_normals.points[j] = all_normals->points[id]; + non_plane_points[j] = all_points->points[id]; + non_plane_normals[j] = all_normals->points[id]; } return true; diff --git a/tools/train_linemod_template.cpp b/tools/train_linemod_template.cpp index d63dfa250d0..d80c40c186a 100644 --- a/tools/train_linemod_template.cpp +++ b/tools/train_linemod_template.cpp @@ -212,7 +212,7 @@ compute (const PointCloudXYZRGBA::ConstPtr & input, float min_depth, float max_d { if (!foreground_mask[i]) { - pcl::PointXYZRGBA & p = template_cloud.points[i]; + pcl::PointXYZRGBA & p = template_cloud[i]; p.x = p.y = p.z = std::numeric_limits::quiet_NaN (); } } diff --git a/tracking/include/pcl/tracking/impl/particle_filter.hpp b/tracking/include/pcl/tracking/impl/particle_filter.hpp index 05d3257df2c..4c4c73c9f5b 100644 --- a/tracking/include/pcl/tracking/impl/particle_filter.hpp +++ b/tracking/include/pcl/tracking/impl/particle_filter.hpp @@ -309,7 +309,7 @@ ParticleFilterTracker::computeTransformedPointCloudWithNormal( // destructively assigns to cloud pcl::transformPointCloudWithNormals(*ref_, cloud, trans); for (std::size_t i = 0; i < cloud.points.size(); i++) { - PointInT input_point = cloud.points[i]; + PointInT input_point = cloud[i]; if (!std::isfinite(input_point.x) || !std::isfinite(input_point.y) || !std::isfinite(input_point.z)) diff --git a/tracking/include/pcl/tracking/impl/pyramidal_klt.hpp b/tracking/include/pcl/tracking/impl/pyramidal_klt.hpp index c8bed951df8..aa7026396cc 100644 --- a/tracking/include/pcl/tracking/impl/pyramidal_klt.hpp +++ b/tracking/include/pcl/tracking/impl/pyramidal_klt.hpp @@ -196,15 +196,15 @@ PyramidalKLTTracker::derivatives(const FloatImage& src, ++trow0; float* trow1 = row1; ++trow1; - const float* src_ptr = &(src.points[0]); + const float* src_ptr = &(src[0]); for (int y = 0; y < height; y++) { const float* srow0 = src_ptr + (y > 0 ? y - 1 : height > 1 ? 1 : 0) * width; const float* srow1 = src_ptr + y * width; const float* srow2 = src_ptr + (y < height - 1 ? y + 1 : height > 1 ? height - 2 : 0) * width; - float* grad_x_row = &(grad_x.points[y * width]); - float* grad_y_row = &(grad_y.points[y * width]); + float* grad_x_row = &(grad_x[y * width]); + float* grad_y_row = &(grad_y[y * width]); // do vertical convolution for (int x = 0; x < width; x++) { @@ -484,11 +484,9 @@ PyramidalKLTTracker::spatialGradient( covariance.setZero(); for (int y = 0; y < track_height_; y++) { - const float* img_ptr = &(img.points[0]) + (y + location[1]) * step + location[0]; - const float* grad_x_ptr = - &(grad_x.points[0]) + (y + location[1]) * step + location[0]; - const float* grad_y_ptr = - &(grad_y.points[0]) + (y + location[1]) * step + location[0]; + const float* img_ptr = &(img[0]) + (y + location[1]) * step + location[0]; + const float* grad_x_ptr = &(grad_x[0]) + (y + location[1]) * step + location[0]; + const float* grad_y_ptr = &(grad_y[0]) + (y + location[1]) * step + location[0]; float* win_ptr = win.data() + y * win.cols(); float* grad_x_win_ptr = grad_x_win.data() + y * grad_x_win.cols(); @@ -527,7 +525,7 @@ PyramidalKLTTracker::mismatchVector( const int step = next.width; b.setZero(); for (int y = 0; y < track_height_; y++) { - const float* next_ptr = &(next.points[0]) + (y + location[1]) * step + location[0]; + const float* next_ptr = &(next[0]) + (y + location[1]) * step + location[0]; const float* prev_ptr = prev.data() + y * prev.cols(); const float* prev_grad_x_ptr = prev_grad_x.data() + y * prev_grad_x.cols(); const float* prev_grad_y_ptr = prev_grad_y.data() + y * prev_grad_y.cols(); diff --git a/visualization/include/pcl/visualization/impl/histogram_visualizer.hpp b/visualization/include/pcl/visualization/impl/histogram_visualizer.hpp index b0358252761..ad525fbfd69 100644 --- a/visualization/include/pcl/visualization/impl/histogram_visualizer.hpp +++ b/visualization/include/pcl/visualization/impl/histogram_visualizer.hpp @@ -69,7 +69,7 @@ PCLHistogramVisualizer::addFeatureHistogram ( for (int d = 0; d < hsize; ++d) { xy[0] = d; - xy[1] = cloud.points[0].histogram[d]; + xy[1] = cloud[0].histogram[d]; xy_array->SetTuple (d, xy); } RenWinInteract renwinint; @@ -121,9 +121,9 @@ PCLHistogramVisualizer::addFeatureHistogram ( for (std::uint32_t d = 0; d < fields[field_idx].count; ++d) { xy[0] = d; - //xy[1] = cloud.points[index].histogram[d]; + //xy[1] = cloud[index].histogram[d]; float data; - memcpy (&data, reinterpret_cast (&cloud.points[index]) + fields[field_idx].offset + d * sizeof (float), sizeof (float)); + memcpy (&data, reinterpret_cast (&cloud[index]) + fields[field_idx].offset + d * sizeof (float), sizeof (float)); xy[1] = data; xy_array->SetTuple (d, xy); } @@ -158,7 +158,7 @@ PCLHistogramVisualizer::updateFeatureHistogram ( for (int d = 0; d < hsize; ++d) { xy[0] = d; - xy[1] = cloud.points[0].histogram[d]; + xy[1] = cloud[0].histogram[d]; xy_array->SetTuple (d, xy); } reCreateActor (xy_array, renwinupd, hsize); @@ -204,9 +204,9 @@ PCLHistogramVisualizer::updateFeatureHistogram ( for (std::uint32_t d = 0; d < fields[field_idx].count; ++d) { xy[0] = d; - //xy[1] = cloud.points[index].histogram[d]; + //xy[1] = cloud[index].histogram[d]; float data; - memcpy (&data, reinterpret_cast (&cloud.points[index]) + fields[field_idx].offset + d * sizeof (float), sizeof (float)); + memcpy (&data, reinterpret_cast (&cloud[index]) + fields[field_idx].offset + d * sizeof (float), sizeof (float)); xy[1] = data; xy_array->SetTuple (d, xy); } diff --git a/visualization/include/pcl/visualization/impl/image_viewer.hpp b/visualization/include/pcl/visualization/impl/image_viewer.hpp index 6297b0bb007..b2a034ca131 100644 --- a/visualization/include/pcl/visualization/impl/image_viewer.hpp +++ b/visualization/include/pcl/visualization/impl/image_viewer.hpp @@ -59,9 +59,9 @@ pcl::visualization::ImageViewer::convertRGBCloudToUChar ( int j = 0; for (std::size_t i = 0; i < cloud.points.size (); ++i) { - data[j++] = cloud.points[i].r; - data[j++] = cloud.points[i].g; - data[j++] = cloud.points[i].b; + data[j++] = cloud[i].r; + data[j++] = cloud[i].g; + data[j++] = cloud[i].b; } } @@ -310,7 +310,7 @@ pcl::visualization::ImageViewer::addRectangle ( search.setInputCloud (image); std::vector pp_2d (mask.points.size ()); for (std::size_t i = 0; i < mask.points.size (); ++i) - search.projectPoint (mask.points[i], pp_2d[i]); + search.projectPoint (mask[i], pp_2d[i]); pcl::PointXY min_pt_2d, max_pt_2d; min_pt_2d.x = min_pt_2d.y = std::numeric_limits::max (); diff --git a/visualization/include/pcl/visualization/impl/pcl_plotter.hpp b/visualization/include/pcl/visualization/impl/pcl_plotter.hpp index 20ac237e22e..9d7782aa857 100644 --- a/visualization/include/pcl/visualization/impl/pcl_plotter.hpp +++ b/visualization/include/pcl/visualization/impl/pcl_plotter.hpp @@ -56,7 +56,7 @@ PCLPlotter::addFeatureHistogram ( for (int i = 0; i < hsize; ++i) { array_x[i] = i; - array_y[i] = cloud.points[0].histogram[i]; + array_y[i] = cloud[0].histogram[i]; } this->addPlotData(array_x, array_y, id.c_str(), vtkChart::LINE); @@ -96,7 +96,7 @@ PCLPlotter::addFeatureHistogram ( array_x[i] = i; float data; // TODO: replace float with the real data type - memcpy (&data, reinterpret_cast (&cloud.points[index]) + fields[field_idx].offset + i * sizeof (float), sizeof (float)); + memcpy (&data, reinterpret_cast (&cloud[index]) + fields[field_idx].offset + i * sizeof (float), sizeof (float)); array_y[i] = data; } diff --git a/visualization/include/pcl/visualization/simple_buffer_visualizer.h b/visualization/include/pcl/visualization/simple_buffer_visualizer.h index a5be513443d..f4c143a68e6 100644 --- a/visualization/include/pcl/visualization/simple_buffer_visualizer.h +++ b/visualization/include/pcl/visualization/simple_buffer_visualizer.h @@ -178,7 +178,7 @@ namespace pcl { for(int i = 0 ; i < nb_values_ ; ++i) { - cloud_.points[0].histogram[i] = values_[i]; + cloud_[0].histogram[i] = values_[i]; } } diff --git a/visualization/src/common/io.cpp b/visualization/src/common/io.cpp index 08170e70760..4b043778bc4 100644 --- a/visualization/src/common/io.cpp +++ b/visualization/src/common/io.cpp @@ -62,9 +62,9 @@ pcl::visualization::getCorrespondingPointCloud (vtkPolyData *src, { double p[3]; src->GetPoint (i, p); - cloud.points[i].x = static_cast (p[0]); - cloud.points[i].y = static_cast (p[1]); - cloud.points[i].z = static_cast (p[2]); + cloud[i].x = static_cast (p[0]); + cloud[i].y = static_cast (p[1]); + cloud[i].z = static_cast (p[2]); } // Compute a kd-tree for tgt diff --git a/visualization/src/pcl_visualizer.cpp b/visualization/src/pcl_visualizer.cpp index 0d6f9a44065..5d97ebbd8a5 100644 --- a/visualization/src/pcl_visualizer.cpp +++ b/visualization/src/pcl_visualizer.cpp @@ -3212,7 +3212,7 @@ pcl::visualization::PCLVisualizer::addPolylineFromPolygonMesh ( poly_points->SetNumberOfPoints (point_cloud.points.size ()); for (std::size_t i = 0; i < point_cloud.points.size (); ++i) - poly_points->InsertPoint (i, point_cloud.points[i].x, point_cloud.points[i].y, point_cloud.points[i].z); + poly_points->InsertPoint (i, point_cloud[i].x, point_cloud[i].y, point_cloud[i].z); // Create a cell array to store the lines in and add the lines to it vtkSmartPointer cells = vtkSmartPointer::New (); @@ -3330,7 +3330,7 @@ pcl::visualization::PCLVisualizer::addTextureMesh (const pcl::TextureMesh &mesh, poly_points->SetNumberOfPoints (cloud.size ()); for (std::size_t i = 0; i < cloud.points.size (); ++i) { - const pcl::PointXYZRGB &p = cloud.points[i]; + const pcl::PointXYZRGB &p = cloud[i]; poly_points->InsertPoint (i, p.x, p.y, p.z); const unsigned char color[3] = { p.r, p.g, p.b }; colors->InsertNextTupleValue (color); diff --git a/visualization/src/range_image_visualizer.cpp b/visualization/src/range_image_visualizer.cpp index 17c5af71024..de7b3ab475a 100644 --- a/visualization/src/range_image_visualizer.cpp +++ b/visualization/src/range_image_visualizer.cpp @@ -81,7 +81,7 @@ pcl::visualization::RangeImageVisualizer::visualizeBorders ( { for (std::size_t x=0; x