PointCloudLibrary/pcl

Use user defined point(define PCL_NO_PRECOMPILE) will let supervoxel_clustering compile failed.

Open

#3,170 opened on Jun 18, 2019

View on GitHub
 (1 comment) (0 reactions) (0 assignees)C++ (9,023 stars) (4,506 forks)batch import
good first issuekind: bugkind: todomodule: octree

Description

Why these template specialization is implemented in supervoxel_clustering.cpp but not in supervoxel_clustering.hpp, and leave empty definitions in .hpp?

That will make compile failed with LNK2019 errors, if I defined PCL_NO_PRECOMPILE to compile with my own point type, and use pcl::PointXYZRGBA with supervoxel_clustering .

namespace pcl
{ 
  namespace octree
  {
    //Explicit overloads for RGB types
    template<>
    void
    pcl::octree::OctreePointCloudAdjacencyContainer<pcl::PointXYZRGB,pcl::SupervoxelClustering<pcl::PointXYZRGB>::VoxelData>::addPoint (const pcl::PointXYZRGB &new_point);
    
    template<>
    void
    pcl::octree::OctreePointCloudAdjacencyContainer<pcl::PointXYZRGBA,pcl::SupervoxelClustering<pcl::PointXYZRGBA>::VoxelData>::addPoint (const pcl::PointXYZRGBA &new_point);
    
    //Explicit overloads for RGB types
    template<> void
    pcl::octree::OctreePointCloudAdjacencyContainer<pcl::PointXYZRGB,pcl::SupervoxelClustering<pcl::PointXYZRGB>::VoxelData>::computeData ();
    
    template<> void
    pcl::octree::OctreePointCloudAdjacencyContainer<pcl::PointXYZRGBA,pcl::SupervoxelClustering<pcl::PointXYZRGBA>::VoxelData>::computeData ();
    
    //Explicit overloads for XYZ types
    template<>
    void
    pcl::octree::OctreePointCloudAdjacencyContainer<pcl::PointXYZ,pcl::SupervoxelClustering<pcl::PointXYZ>::VoxelData>::addPoint (const pcl::PointXYZ &new_point);
    
    template<> void
    pcl::octree::OctreePointCloudAdjacencyContainer<pcl::PointXYZ,pcl::SupervoxelClustering<pcl::PointXYZ>::VoxelData>::computeData ();
  }
}
  template<> void
  pcl::SupervoxelClustering<pcl::PointXYZRGB>::VoxelData::getPoint (pcl::PointXYZRGB &point_arg) const;
  
  template<> void
  pcl::SupervoxelClustering<pcl::PointXYZRGBA>::VoxelData::getPoint (pcl::PointXYZRGBA &point_arg ) const;

And those function in origin pcl::octree::OctreePointCloudAdjacencyContainer is do nothing... Why not throw some error like "Not implement"? So that will make users know they need to implement those functions, because when a function can run (actually no) with no errors, that will make people hard to find where is fucked up....

 /** \brief Add new point to container- this just counts points
       * \note To actually store data in the leaves, need to specialize this
       * for your point and data type as in supervoxel_clustering.hpp
       */
       // param[in] new_point the new point to add  
      void 
      addPoint (const PointInT& /*new_point*/)
      {
        using namespace pcl::common;
        ++num_points_;
      }
/** \brief Function for working on data added. Base implementation does nothing 
       * */
      void
      computeData ()
      {
      }

Contributor guide