template <typename PointInT> void pcl::MeshConstruction<PointInT>::reconstruct (std::vector<pcl::Vertices> &polygons) { if (!initCompute ()) { polygons.clear (); return; } // Check if a space search locator was given if (check_tree_) { if (!tree_) { if (input_->isOrganized ()) tree_.reset (new pcl::search::OrganizedNeighbor<PointInT> ()); else tree_.reset (new pcl::search::KdTree<PointInT> (false)); } // Send the surface dataset to the spatial locator tree_->setInputCloud (input_, indices_); } // Set up the output dataset //polygons.clear (); //polygons.reserve (2 * indices_->size ()); /// NOTE: usually the number of triangles is around twice the number of vertices // Perform the actual surface reconstruction performReconstruction (polygons); deinitCompute (); }
template <typename PointInT> void pcl::ConvexHull<PointInT>::performReconstruction (PolygonMesh &output) { // Perform reconstruction pcl::PointCloud<PointInT> hull_points; performReconstruction (hull_points, output.polygons, true); // Convert the PointCloud into a PointCloud2 pcl::toROSMsg (hull_points, output.cloud); }
template <typename PointInT> void pcl::ConvexHull<PointInT>::reconstruct (PointCloud &points, std::vector<pcl::Vertices> &polygons) { points.header = input_->header; if (!initCompute () || input_->points.empty () || indices_->empty ()) { points.points.clear (); return; } // Perform the actual surface reconstruction performReconstruction (points, polygons, true); points.width = static_cast<uint32_t> (points.points.size ()); points.height = 1; points.is_dense = true; deinitCompute (); }
template <typename PointInT, typename NormalOutT> void pcl::MovingLeastSquares<PointInT, NormalOutT>::reconstruct (PointCloudIn &output) { // check if normals have to be computed/saved if (normals_) { // Copy the header normals_->header = input_->header; // Clear the fields in case the method exits before computation normals_->width = normals_->height = 0; normals_->points.clear (); } // Copy the header output.header = input_->header; if (!initCompute ()) { output.width = output.height = 0; output.points.clear (); return; } // Check if a space search locator was given if (!tree_) { PCL_ERROR ("[pcl::%s::compute] No spatial search method was given!\n", getClassName ().c_str ()); output.width = output.height = 0; output.points.clear (); return; } // Send the surface dataset to the spatial locator tree_->setInputCloud (input_, indices_); // Perform the actual surface reconstruction performReconstruction (output); deinitCompute (); }
template <typename PointInT> void pcl::SurfaceReconstruction<PointInT>::reconstruct (pcl::PolygonMesh &output) { // Copy the header output.header = input_->header; if (!initCompute ()) { output.cloud.width = output.cloud.height = 0; output.cloud.data.clear (); output.polygons.clear (); return; } // Check if a space search locator was given if (check_tree_) { if (!tree_) { if (input_->isOrganized ()) tree_.reset (new pcl::search::OrganizedNeighbor<PointInT> ()); else tree_.reset (new pcl::search::KdTree<PointInT> (false)); } // Send the surface dataset to the spatial locator tree_->setInputCloud (input_, indices_); } // Set up the output dataset pcl::toROSMsg (*input_, output.cloud); /// NOTE: passing in boost shared pointer with * as const& should be OK here output.polygons.clear (); output.polygons.reserve (2*indices_->size ()); /// NOTE: usually the number of triangles is around twice the number of vertices // Perform the actual surface reconstruction performReconstruction (output); deinitCompute (); }
template <typename PointInT> void pcl::ConvexHull<PointInT>::performReconstruction (std::vector<pcl::Vertices> &polygons) { pcl::PointCloud<PointInT> hull_points; performReconstruction (hull_points, polygons, true); }