ofxPCL Convex Hull

I’m starting to use ofxPCL to work with point clouds in general. Right now I am trying to build a convex hull from a ofVboMesh that I have generated. Looking at the extended library, #include <pcl/surface/convex_hull.h> should allow me to do this, but the following code seems not to work.

//meshref is a ofVboMesh
ofxPCL::PointCloud hull = ofxPCL::toPCL(meshref);
pcl::ConvexHull<pcl::PointXYZ> chull;
chull.reconstruct(*hull);

std::cerr << "Convex hull has: " << hull->points.size () << " data points." << std::endl;

So I am trying to convert the VboMesh to a point cloud, and then use that point cloud to construct a Convex Hull
However, the toPCL calls out with a ‘no matching function’ error (so I am not even getting as far as the convex hull construction). Perhaps I can’t see what is right in front of my eyes, (most likely) but the toPCL function is given in ofxPCL.h as follows:

template <>
inline PointCloud toPCL(const ofMesh &mesh)
{
PointCloud cloud(new PointCloud::value_type);
convert(mesh, cloud);
return cloud;
}

Can anyone tell me what I am doing wrong?

As a follow up

I don’t know why the toPCL function doesn’t work with the mesh, but for now, as a test, I’ve gone round this issue. It does work with a vector of 3d points, so I am using that as follows:

    ofxPCL::PointCloud samplecloud(new ofxPCL::PointCloud::value_type);
vector<ofVec3f> pings;
for( int i = 0; i < 100; i++ ){
    ofVec3f addPoint;
    addPoint.x = ofRandom(10);
    addPoint.y = ofRandom(10);
    addPoint.z = ofRandom(10);
    pings.push_back(addPoint);
}
samplecloud = ofxPCL::toPCL(pings);
pcl::ConvexHull<pcl::PointXYZ> cHull;
ofxPCL::PointCloud cHull_points(new ofxPCL::PointCloud::value_type);
cHull.setInputCloud(samplecloud);
cHull.setDimension (3);
cHull.reconstruct (*cHull_points);

This compiles and starts to run but gives me an EXC_BAD_ACCESS on the reconstruct function. Does anyone know what might be causing this?

Ta
S

Well, I guess no-one knows and in the meantime I have moved on.

Just in case anyone else ever comes this way; I gave up trying to get the cHull function to work and in-fact dumped the ofxPCL library altogether. Instead, I am loading up 3d points from a .xyz (.txt type) file and then using CGAL’s quickHull implementation to construct the convex hull.

The CGAL section is here:
http://doc.cgal.org/latest/Convex_hull_3/index.html

It is fairly easy to grap the relevant package from their library and refer to it from an Openframeworks sketch, you just need the following:

#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/algorithm.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/convex_hull_3.h>