Point Cloud Library - Writing functions to accept multiple types -


static pcl::pointcloud<pcl::pointxyzrgb>::ptr extractconcavehull(     pcl::pointcloud<pcl::pointxyzrgb>::ptr inputcloud,     double alpha ); 

this function example. instead of writing 2 function calls, 1 pointxyz , 1 pointxyzrgb , 1 pointxyzrgbnormal, there way can use generic type? pointcloud object, , on compile time able cast accordingly

this should work (i have not tested it).

template<typename point_type> static typename pcl::pointcloud<point_type>::ptr  extractconcavehull(     typename pcl::pointcloud<point_type>::ptr inputcloud,     double alpha ); 

you can pass reference

template<typename point_type> static void  extractconcavehull(     const typename pcl::pointcloud<point_type>::ptr& inpcloud,     const typename pcl::pointcloud<point_type>::ptr& outcloud,     double alpha ); 

you gonna have define templated methods in header file.


Comments